1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
// GUI_Preferences_Language - Preferences interface of MediaInfo
// Copyright (C) 2002-2012 MediaArea.net SARL, Info@MediaArea.net
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//---------------------------------------------------------------------------
// Compilation condition
#ifndef MEDIAINFOGUI_PREFS_NO
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "GUI/VCL/GUI_Preferences_Language.h"
#include "Common/Preferences.h"
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
//---------------------------------------------------------------------------
//***************************************************************************
// Constructor/Destructor
//***************************************************************************
//---------------------------------------------------------------------------
__fastcall TPreferences_LanguageF::TPreferences_LanguageF(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TPreferences_LanguageF::GrilleKeyUp(TObject *Sender,
WORD &Key, TShiftState Shift)
{
EditedLanguage(GUI_Text(Grille->Cells[0][Grille->Row]))=GUI_Text(Grille->Cells[2][Grille->Row]);
}
//---------------------------------------------------------------------------
void __fastcall TPreferences_LanguageF::OKClick(TObject *Sender)
{
EditedLanguage.Save();
}
//---------------------------------------------------------------------------
int TPreferences_LanguageF::Run(const Ztring &Name)
{
ZtringListListF Default;
Default.Load(Prefs->BaseFolder+Prefs->FolderNames[Prefs_Language]+_T("\\")+Prefs->DefaultNames[Prefs_Language]+_T(".csv"));
EditedLanguage.Load(Prefs->BaseFolder+Prefs->FolderNames[Prefs_Language]+_T("\\")+Name+_T(".csv"));
Grille->RowCount=Default.size()+1;
Grille->Cells[0][0]="Program name";
Grille->Cells[1][0]="Default translation";
Grille->Cells[2][0]="Your translation";
for (size_t Pos=0; Pos<Default.size(); Pos++)
{
Grille->Cells[0][Pos+1]=Default(Pos, 0).c_str();
Grille->Cells[1][Pos+1]=Default(Pos, 1).c_str();
Grille->Cells[2][Pos+1]=EditedLanguage(Default(Pos, 0), 1).c_str();
}
return ShowModal();
}
//---------------------------------------------------------------------------
void __fastcall TPreferences_LanguageF::FormResize(TObject *Sender)
{
Grille->Width=ClientWidth-Grille->Left;
Grille->Height=ClientHeight-Grille->Top; //Why 40? I don't know!
Grille->ColWidths[0]=Grille->Width*1/7;
Grille->ColWidths[1]=Grille->Width*3/7;
Grille->ColWidths[2]=Grille->Width*3/7;
OK->Left=ClientWidth-OK->Width;
Cancel->Left=OK->Left-Cancel->Width;
}
//***************************************************************************
// C++
//***************************************************************************
#endif //MEDIAINFOGUI_PREFS_NO
|