Changeset 118 for trunk/Forms
- Timestamp:
- Oct 23, 2022, 10:55:55 PM (2 years ago)
- Location:
- trunk/Forms
- Files:
-
- 6 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.lfm
r112 r118 37 37 Top = 21 38 38 end 39 object Translator1: TTranslator40 POFilesFolder = 'Languages'41 OnTranslate = Translator1Translate42 Left = 49643 Top = 35844 end45 39 object ApplicationInfo1: TApplicationInfo 46 40 Identification = 1 … … 61 55 Top = 460 62 56 end 63 object PersistentForm1: TPersistentForm64 MinVisiblePart = 5065 EntireVisible = False66 Left = 48867 Top = 53668 end69 57 end -
trunk/Forms/UFormMain.pas
r100 r118 15 15 ApplicationInfo1: TApplicationInfo; 16 16 PaintBox1: TPaintBox; 17 PersistentForm1: TPersistentForm;18 17 Timer1: TTimer; 19 Translator1: TTranslator;20 18 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 21 19 procedure FormCreate(Sender: TObject); … … 60 58 61 59 uses 62 UFormImages, UPixelPointer ;60 UFormImages, UPixelPointer, UCore, UFormTest, UTestCases; 63 61 64 62 resourcestring … … 79 77 {$IFDEF UNIX} 80 78 // If installed in UNIX system then use installation directory for po files 81 if not DirectoryExists( Translator1.POFilesFolder) and DirectoryExists(UnixLanguagesDir) then82 Translator1.POFilesFolder := UnixLanguagesDir;79 if not DirectoryExists(Core.Translator1.POFilesFolder) and DirectoryExists(UnixLanguagesDir) then 80 Core.Translator1.POFilesFolder := UnixLanguagesDir; 83 81 {$ENDIF} 84 82 85 83 Engine := TEngine.Create; 86 84 Engine.RegistryContext := ApplicationInfo1.GetRegistryContext; 85 Engine.Translator := Core.Translator1; 87 86 LoadConfig; 88 87 // Load cities after language core is loaded to have city names translated … … 95 94 procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction); 96 95 begin 97 PersistentForm1.Save(Self);96 Core.PersistentForm1.Save(Self); 98 97 end; 99 98 … … 116 115 const 117 116 KeyF11 = 122; 117 {$IFDEF DEBUG} 118 KeyF12 = 123; 119 {$ENDIF} 118 120 begin 119 121 if Key = KeyF11 then begin 120 122 FullScreen := not FullScreen; 121 PersistentForm1.SetFullScreen(FormMain.FullScreen);123 Core.PersistentForm1.SetFullScreen(FormMain.FullScreen); 122 124 end else 125 {$IFDEF DEBUG} 126 if Key = KeyF12 then begin 127 FormTest := TFormTest.Create(nil); 128 try 129 FormTest.TestCases := InitTestCases; 130 try 131 FormTest.ShowModal; 132 finally 133 FormTest.TestCases.Free; 134 end; 135 finally 136 FormTest.Free; 137 end; 138 end else 139 {$ENDIF} 123 140 Engine.KeyUp(Key); 124 141 end; … … 128 145 if not Initialized then begin 129 146 Initialized := True; 130 PersistentForm1.RegistryContext := ApplicationInfo1.GetRegistryContext;131 PersistentForm1.Load(Self, False, True);132 FullScreen := PersistentForm1.FormFullScreen;147 Core.PersistentForm1.RegistryContext := ApplicationInfo1.GetRegistryContext; 148 Core.PersistentForm1.Load(Self, False, True); 149 FullScreen := Core.PersistentForm1.FormFullScreen; 133 150 Engine.InitMenus; 134 151 Engine.OnDarkModeChange := DarkModeChange; … … 214 231 if ValueExists('LanguageCode') then begin 215 232 LangCode := ReadStringWithDefault('LanguageCode', ''); 216 Translator1.Language :=Translator1.Languages.SearchByCode(LangCode);217 end else Translator1.Language :=Translator1.Languages.SearchByCode('');233 Core.Translator1.Language := Core.Translator1.Languages.SearchByCode(LangCode); 234 end else Core.Translator1.Language := Core.Translator1.Languages.SearchByCode(''); 218 235 Engine.LoadFromRegistry; 219 236 finally … … 228 245 CurrentContext := ApplicationInfo1.GetRegistryContext; 229 246 230 if Assigned( Translator1.Language) and (Translator1.Language.Code <> '') then231 WriteString('LanguageCode', Translator1.Language.Code)247 if Assigned(Core.Translator1.Language) and (Core.Translator1.Language.Code <> '') then 248 WriteString('LanguageCode', Core.Translator1.Language.Code) 232 249 else DeleteValue('LanguageCode'); 233 250 Engine.SaveToRegistry;
Note:
See TracChangeset
for help on using the changeset viewer.