Ignore:
Timestamp:
Jun 21, 2024, 12:44:53 PM (5 months ago)
Author:
chronos
Message:
  • Modified: Remove U prefix from unit names.
  • Modified: Use TFormEx for all forms for code simplification.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Forms/FormSettings.pas

    r316 r317  
    1 unit UFormSettings;
     1unit FormSettings;
    22
    33interface
     
    55uses
    66  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    7   Spin, ComCtrls, ExtCtrls;
     7  Spin, ComCtrls, ExtCtrls, FormEx;
    88
    99type
     
    1111  { TFormSettings }
    1212
    13   TFormSettings = class(TForm)
     13  TFormSettings = class(TFormEx)
    1414    ButtonOk: TButton;
    1515    ButtonCancel: TButton;
     
    3535    TabSheetDebug: TTabSheet;
    3636    procedure CheckBox2Change(Sender: TObject);
    37     procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    3837    procedure FormCreate(Sender: TObject);
    3938    procedure FormShow(Sender: TObject);
     
    4342  end;
    4443
    45 var
    46   FormSettings: TFormSettings;
    4744
    4845
     
    5249
    5350uses
    54   UCore, Languages, Theme;
     51  Core, Languages, Theme;
    5552
    5653{ TFormSettings }
     
    6259end;
    6360
    64 procedure TFormSettings.FormClose(Sender: TObject; var CloseAction: TCloseAction
    65   );
    66 begin
    67   Core.PersistentForm.Save(Self);
    68 end;
    69 
    7061procedure TFormSettings.FormCreate(Sender: TObject);
    7162begin
    7263  PageControl1.TabIndex := 0;
    73   Core.CoolTranslator1.TranslateComponentRecursive(Self);
    74   Core.ThemeManager1.Themes.LoadToStrings(ComboBoxTheme.Items);
    75   Core.CoolTranslator1.LanguageListToStrings(ComboBoxLanguage.Items);
     64  Core.Core.ThemeManager1.Themes.LoadToStrings(ComboBoxTheme.Items);
     65  Core.Core.Translator1.LanguageListToStrings(ComboBoxLanguage.Items);
    7666end;
    7767
    7868procedure TFormSettings.FormShow(Sender: TObject);
    7969begin
    80   Core.PersistentForm.Load(Self);
    81   Core.ThemeManager1.UseTheme(Self);
    8270  {$IFDEF DEBUG}
    8371  TabSheetDebug.TabVisible := True;
     
    8977procedure TFormSettings.Load;
    9078begin
    91   ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.CoolTranslator1.Language);
     79  ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.Core.Translator1.Language);
    9280  if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
    93   ComboBoxTheme.ItemIndex := ComboBoxTheme.Items.IndexOfObject(Core.ThemeManager1.Theme);
     81  ComboBoxTheme.ItemIndex := ComboBoxTheme.Items.IndexOfObject(Core.Core.ThemeManager1.Theme);
    9482  if ComboBoxTheme.ItemIndex = -1 then ComboBoxTheme.ItemIndex := 0;
    95   CheckBoxDevelMode.Checked := Core.DevelMode;
    96   SpinEditAnimSpeed.Value := Core.AnimationSpeed;
    97   CheckBox2.Checked := Core.ScaleDPI1.AutoDetect;
    98   SpinEditX.Value := Core.ScaleDPI1.DPI.X;
    99   SpinEditY.Value := Core.ScaleDPI1.DPI.Y;
    100   CheckBoxAutoSaveTurn.Checked := Core.AutoSaveEnabled;
    101   CheckBoxReopenLastFile.Checked := Core.ReopenLastFile;
     83  CheckBoxDevelMode.Checked := Core.Core.DevelMode;
     84  SpinEditAnimSpeed.Value := Core.Core.AnimationSpeed;
     85  CheckBox2.Checked := Core.Core.ScaleDPI1.AutoDetect;
     86  SpinEditX.Value := Core.Core.ScaleDPI1.DPI.X;
     87  SpinEditY.Value := Core.Core.ScaleDPI1.DPI.Y;
     88  CheckBoxAutoSaveTurn.Checked := Core.Core.AutoSaveEnabled;
     89  CheckBoxReopenLastFile.Checked := Core.Core.ReopenLastFile;
    10290end;
    10391
     
    10593begin
    10694  if ComboBoxLanguage.ItemIndex <> -1 then
    107     Core.CoolTranslator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
     95    Core.Core.Translator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
    10896   if ComboBoxTheme.ItemIndex <> -1 then
    109     Core.ThemeManager1.Theme := TTheme(ComboBoxTheme.Items.Objects[ComboBoxTheme.ItemIndex]);
    110   Core.DevelMode := CheckBoxDevelMode.Checked;
    111   Core.AnimationSpeed := SpinEditAnimSpeed.Value;
    112   Core.ScaleDPI1.AutoDetect := CheckBox2.Checked;
    113   Core.ScaleDPI1.DPI := Point(SpinEditX.Value, SpinEditY.Value);
    114   Core.AutoSaveEnabled := CheckBoxAutoSaveTurn.Checked;
    115   Core.ReopenLastFile := CheckBoxReopenLastFile.Checked;
     97    Core.Core.ThemeManager1.Theme := TTheme(ComboBoxTheme.Items.Objects[ComboBoxTheme.ItemIndex]);
     98  Core.Core.DevelMode := CheckBoxDevelMode.Checked;
     99  Core.Core.AnimationSpeed := SpinEditAnimSpeed.Value;
     100  Core.Core.ScaleDPI1.AutoDetect := CheckBox2.Checked;
     101  Core.Core.ScaleDPI1.DPI := Point(SpinEditX.Value, SpinEditY.Value);
     102  Core.Core.AutoSaveEnabled := CheckBoxAutoSaveTurn.Checked;
     103  Core.Core.ReopenLastFile := CheckBoxReopenLastFile.Checked;
    116104end;
    117105
Note: See TracChangeset for help on using the changeset viewer.