Changeset 86 for trunk/Forms/FormSettings.pas
- Timestamp:
- Jun 7, 2024, 12:47:11 PM (5 months ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/FormSettings.pas
r85 r86 1 unit UFormSettings; 2 3 {$mode delphi} 1 unit FormSettings; 4 2 5 3 interface … … 7 5 uses 8 6 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ComCtrls, 9 Languages, Theme ;7 Languages, Theme, FormEx; 10 8 11 9 type … … 13 11 { TFormSettings } 14 12 15 TFormSettings = class(TForm )13 TFormSettings = class(TFormEx) 16 14 ButtonOk: TButton; 17 15 ButtonCancel: TButton; … … 24 22 procedure ButtonCancelClick(Sender: TObject); 25 23 procedure ButtonOkClick(Sender: TObject); 26 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);27 24 procedure FormCreate(Sender: TObject); 28 25 procedure FormShow(Sender: TObject); 29 private30 31 public32 33 26 end; 34 35 var36 FormSettings: TFormSettings;37 27 38 28 … … 42 32 43 33 uses 44 UCore;34 Core; 45 35 46 36 resourcestring 47 37 SLanguageChangeTitle = 'Language change'; 48 38 SLanguageChangeMessage = 'Interface language was changed. It may require restart of application.'; 49 50 39 51 40 { TFormSettings } … … 58 47 procedure TFormSettings.ButtonOkClick(Sender: TObject); 59 48 begin 60 Core. Game.AnimationDuration := TrackBar1.Position;49 Core.Core.Game.AnimationDuration := TrackBar1.Position; 61 50 if ComboBoxLanguage.ItemIndex <> -1 then begin 62 if (Core. Translator1.Language <> TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex])) then51 if (Core.Core.Translator1.Language <> TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex])) then 63 52 MessageDlg(SLanguageChangeTitle, SLanguageChangeMessage, mtInformation, [mbOk], 0); 64 Core. Translator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);53 Core.Core.Translator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]); 65 54 end; 66 55 if ComboBoxTheme.ItemIndex <> -1 then 67 Core. ThemeManager1.Theme := TTheme(ComboBoxTheme.Items.Objects[ComboBoxTheme.ItemIndex]);56 Core.Core.ThemeManager1.Theme := TTheme(ComboBoxTheme.Items.Objects[ComboBoxTheme.ItemIndex]); 68 57 ModalResult := mrOk; 69 end;70 71 procedure TFormSettings.FormClose(Sender: TObject; var CloseAction: TCloseAction72 );73 begin74 Core.PersistentForm1.Save(Self);75 58 end; 76 59 77 60 procedure TFormSettings.FormCreate(Sender: TObject); 78 61 begin 79 Core.Translator1.TranslateComponentRecursive(Self); 80 Core.Translator1.LanguageListToStrings(ComboBoxLanguage.Items); 81 Core.ThemeManager1.UseTheme(Self); 82 Core.ThemeManager1.Themes.LoadToStrings(ComboBoxTheme.Items); 62 Core.Core.Translator1.LanguageListToStrings(ComboBoxLanguage.Items); 63 Core.Core.ThemeManager1.Themes.LoadToStrings(ComboBoxTheme.Items); 83 64 end; 84 65 85 66 procedure TFormSettings.FormShow(Sender: TObject); 86 67 begin 87 Core.PersistentForm1.Load(Self); 88 TrackBar1.Position := Core.Game.AnimationDuration; 89 ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.Translator1.Language); 68 TrackBar1.Position := Core.Core.Game.AnimationDuration; 69 ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.Core.Translator1.Language); 90 70 if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0; 91 ComboBoxTheme.ItemIndex := ComboBoxTheme.Items.IndexOfObject(Core. ThemeManager1.Theme);71 ComboBoxTheme.ItemIndex := ComboBoxTheme.Items.IndexOfObject(Core.Core.ThemeManager1.Theme); 92 72 if ComboBoxTheme.ItemIndex = -1 then ComboBoxTheme.ItemIndex := 0; 93 73 end;
Note:
See TracChangeset
for help on using the changeset viewer.