Changeset 145 for trunk/Forms/FormOptions.pas
- Timestamp:
- Jun 5, 2023, 6:44:57 PM (18 months ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/FormOptions.pas
r144 r145 1 unit UFormOptions;1 unit FormOptions; 2 2 3 3 interface … … 5 5 uses 6 6 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 7 Spin, ComCtrls, ExtCtrls, UTarget, UTheme;7 Spin, ComCtrls, ExtCtrls, Target, Theme; 8 8 9 9 type … … 47 47 procedure FormCreate(Sender: TObject); 48 48 procedure FormShow(Sender: TObject); 49 private50 { private declarations }51 49 public 52 50 procedure UpdateInterface; … … 55 53 end; 56 54 57 var58 FormOptions: TFormOptions;59 55 60 56 implementation … … 63 59 64 60 uses 65 UCore, ULanguages;61 Core, Languages; 66 62 67 63 { TFormOptions } … … 69 65 procedure TFormOptions.FormShow(Sender: TObject); 70 66 begin 71 Core. PersistentForm1.Load(Self);67 Core.Core.PersistentForm1.Load(Self); 72 68 end; 73 69 … … 91 87 procedure TFormOptions.Load; 92 88 begin 93 ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.Translator.Language); 94 if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0; 95 ComboBoxTheme.ItemIndex := ComboBoxTheme.Items.IndexOfObject(Core.ThemeManager.Theme); 96 if ComboBoxTheme.ItemIndex = -1 then ComboBoxTheme.ItemIndex := 0; 97 CheckBoxReopenLastFile.Checked := Core.OpenProjectOnStart; 98 CheckBoxOptimizeAddSub.Checked := Core.Optimizations.AddSub; 99 CheckBoxOptimizeSetZero.Checked := Core.Optimizations.SetZero; 100 CheckBoxOptimizeMerge.Checked := Core.Optimizations.Merge; 101 CheckBoxOptimizeRelativeIndexes.Checked := Core.Optimizations.RelativeIndexes; 102 CheckBoxOptimizeCopyMultiply.Checked := Core.Optimizations.CopyMultiply; 103 SpinEditDPIX.Value := Core.ScaleDPI1.DPI.X; 104 SpinEditDPIY.Value := Core.ScaleDPI1.DPI.Y; 105 CheckBoxDPIAuto.Checked := Core.ScaleDPI1.AutoDetect; 106 ComboBoxOptimization.ItemIndex := Integer(Core.OptimizationLevel); 107 SpinEditCellSize.Value := Core.CellSize; 108 SpinEditMemorySize.Value := Core.MemorySize; 109 CheckBoxDebugEnabled.Checked := Core.DebugEnabled; 110 if Core.OptionsFormTabIndex < PageControl1.PageCount then 111 PageControl1.TabIndex := Core.OptionsFormTabIndex 112 else PageControl1.TabIndex := 0; 89 with Core.Core do begin 90 ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Translator.Language); 91 if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0; 92 ComboBoxTheme.ItemIndex := ComboBoxTheme.Items.IndexOfObject(ThemeManager.Theme); 93 if ComboBoxTheme.ItemIndex = -1 then ComboBoxTheme.ItemIndex := 0; 94 CheckBoxReopenLastFile.Checked := OpenProjectOnStart; 95 CheckBoxOptimizeAddSub.Checked := Optimizations.AddSub; 96 CheckBoxOptimizeSetZero.Checked := Optimizations.SetZero; 97 CheckBoxOptimizeMerge.Checked := Optimizations.Merge; 98 CheckBoxOptimizeRelativeIndexes.Checked := Optimizations.RelativeIndexes; 99 CheckBoxOptimizeCopyMultiply.Checked := Optimizations.CopyMultiply; 100 SpinEditDPIX.Value := ScaleDPI1.DPI.X; 101 SpinEditDPIY.Value := ScaleDPI1.DPI.Y; 102 CheckBoxDPIAuto.Checked := ScaleDPI1.AutoDetect; 103 ComboBoxOptimization.ItemIndex := Integer(OptimizationLevel); 104 SpinEditCellSize.Value := CellSize; 105 SpinEditMemorySize.Value := MemorySize; 106 CheckBoxDebugEnabled.Checked := DebugEnabled; 107 if OptionsFormTabIndex < PageControl1.PageCount then 108 PageControl1.TabIndex := OptionsFormTabIndex 109 else PageControl1.TabIndex := 0; 110 end; 113 111 UpdateInterface; 114 112 end; … … 116 114 procedure TFormOptions.Save; 117 115 begin 116 with Core.Core do begin 118 117 if ComboBoxLanguage.ItemIndex <> -1 then 119 Core.Translator.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);118 Translator.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]); 120 119 if ComboBoxTheme.ItemIndex <> -1 then 121 Core.ThemeManager.Theme := TTheme(ComboBoxTheme.Items.Objects[ComboBoxTheme.ItemIndex]); 122 Core.OpenProjectOnStart := CheckBoxReopenLastFile.Checked; 123 Core.ScaleDPI1.DPI := Point(SpinEditDPIX.Value, SpinEditDPIY.Value); 124 Core.ScaleDPI1.AutoDetect := CheckBoxDPIAuto.Checked; 125 Core.OptimizationLevel := TCompilerOptimization(ComboBoxOptimization.ItemIndex); 126 Core.CellSize := SpinEditCellSize.Value; 127 Core.MemorySize := SpinEditMemorySize.Value; 128 Core.Optimizations.AddSub := CheckBoxOptimizeAddSub.Checked; 129 Core.Optimizations.SetZero := CheckBoxOptimizeSetZero.Checked; 130 Core.Optimizations.Merge := CheckBoxOptimizeMerge.Checked; 131 Core.Optimizations.RelativeIndexes := CheckBoxOptimizeRelativeIndexes.Checked; 132 Core.Optimizations.CopyMultiply := CheckBoxOptimizeCopyMultiply.Checked; 133 Core.DebugEnabled := CheckBoxDebugEnabled.Checked; 134 Core.OptionsFormTabIndex := PageControl1.TabIndex; 120 ThemeManager.Theme := TTheme(ComboBoxTheme.Items.Objects[ComboBoxTheme.ItemIndex]); 121 OpenProjectOnStart := CheckBoxReopenLastFile.Checked; 122 ScaleDPI1.DPI := Point(SpinEditDPIX.Value, SpinEditDPIY.Value); 123 ScaleDPI1.AutoDetect := CheckBoxDPIAuto.Checked; 124 OptimizationLevel := TCompilerOptimization(ComboBoxOptimization.ItemIndex); 125 CellSize := SpinEditCellSize.Value; 126 MemorySize := SpinEditMemorySize.Value; 127 Optimizations.AddSub := CheckBoxOptimizeAddSub.Checked; 128 Optimizations.SetZero := CheckBoxOptimizeSetZero.Checked; 129 Optimizations.Merge := CheckBoxOptimizeMerge.Checked; 130 Optimizations.RelativeIndexes := CheckBoxOptimizeRelativeIndexes.Checked; 131 Optimizations.CopyMultiply := CheckBoxOptimizeCopyMultiply.Checked; 132 DebugEnabled := CheckBoxDebugEnabled.Checked; 133 OptionsFormTabIndex := PageControl1.TabIndex; 134 end; 135 135 end; 136 136 … … 157 157 ); 158 158 begin 159 Core. PersistentForm1.Save(Self);159 Core.Core.PersistentForm1.Save(Self); 160 160 end; 161 161 162 162 procedure TFormOptions.FormCreate(Sender: TObject); 163 163 begin 164 Core.Translator.TranslateComponentRecursive(Self); 165 Core.ThemeManager.UseTheme(Self); 166 Core.ThemeManager.Themes.LoadToStrings(ComboBoxTheme.Items); 167 Core.Translator.LanguageListToStrings(ComboBoxLanguage.Items); 164 with Core.Core do begin 165 Translator.TranslateComponentRecursive(Self); 166 ThemeManager.UseTheme(Self); 167 ThemeManager.Themes.LoadToStrings(ComboBoxTheme.Items); 168 Translator.LanguageListToStrings(ComboBoxLanguage.Items); 169 end; 168 170 ComboBoxOptimization.Items.Clear; 169 171 ComboBoxOptimization.Items.Add(CompilerOptimizationText[coNone]);
Note:
See TracChangeset
for help on using the changeset viewer.