Ignore:
Timestamp:
Jan 17, 2025, 9:05:54 PM (4 days ago)
Author:
chronos
Message:
  • Modified: Updated Common package.
  • Modified: Remove U prefix from unit names.
  • Modified: Use Gneeric.Collections instead of fgl.
  • Modified: Do not use global form variables.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Forms/FormSettings.pas

    r218 r219  
    1 unit UFormSettings;
    2 
    3 {$mode delphi}
     1unit FormSettings;
    42
    53interface
     
    75uses
    86  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   Menus, Spin, ExtCtrls, ULanguages;
     7  Menus, Spin, ExtCtrls, Languages, FormEx;
    108
    119type
     
    1311  { TFormSettings }
    1412
    15   TFormSettings = class(TForm)
     13  TFormSettings = class(TFormEx)
    1614    Bevel1: TBevel;
    1715    ButtonOk: TButton;
     
    2826    Label3: TLabel;
    2927    SpinEditDPI: TSpinEdit;
    30     procedure ButtonOkClick(Sender: TObject);
    3128    procedure CheckBoxAutomaticDPIChange(Sender: TObject);
    3229    procedure CheckBoxStartOnLogonChange(Sender: TObject);
    33     procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    3430    procedure FormCreate(Sender: TObject);
    35     procedure FormShow(Sender: TObject);
    36   private
    37     { private declarations }
    3831  public
    3932    procedure Load;
     
    4235  end;
    4336
    44 var
    45   FormSettings: TFormSettings;
    4637
    4738implementation
     
    5041
    5142uses
    52   UCore, UTheme;
     43  Core, Theme;
    5344
    5445{ TFormSettings }
    55 
    56 procedure TFormSettings.FormShow(Sender: TObject);
    57 begin
    58   Core.PersistentForm1.Load(Self);
    59 end;
    60 
    61 procedure TFormSettings.ButtonOkClick(Sender: TObject);
    62 begin
    63 end;
    6446
    6547procedure TFormSettings.CheckBoxAutomaticDPIChange(Sender: TObject);
     
    7355end;
    7456
    75 procedure TFormSettings.FormClose(Sender: TObject; var CloseAction: TCloseAction
    76   );
    77 begin
    78   Core.PersistentForm1.Save(Self);
    79 end;
    80 
    8157procedure TFormSettings.FormCreate(Sender: TObject);
    8258begin
    83   Core.Translator.TranslateComponentRecursive(Self);
    84   Core.ThemeManager.UseTheme(Self);
    85   Core.ThemeManager.Themes.LoadToStrings(ComboBoxTheme.Items);
    86   Core.Translator.LanguageListToStrings(ComboBoxLanguage.Items);
     59  Core.Core.Translator.TranslateComponentRecursive(Self);
     60  Core.Core.ThemeManager.Themes.LoadToStrings(ComboBoxTheme.Items);
     61  Core.Core.Translator.LanguageListToStrings(ComboBoxLanguage.Items);
    8762end;
    8863
    8964procedure TFormSettings.Load;
    9065begin
    91   ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.Translator.Language);
     66  ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.Core.Translator.Language);
    9267  if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
    93   ComboBoxTheme.ItemIndex := ComboBoxTheme.Items.IndexOfObject(Core.ThemeManager.Theme);
     68  ComboBoxTheme.ItemIndex := ComboBoxTheme.Items.IndexOfObject(Core.Core.ThemeManager.Theme);
    9469  if ComboBoxTheme.ItemIndex = -1 then ComboBoxTheme.ItemIndex := 0;
    95   CheckBoxAlwaysOnTop.Checked := Core.AlwaysOnTop;
    96   CheckBoxStartOnLogon.Checked := Core.StartOnLogon;
    97   CheckBoxStartMinimizedToTray.Checked := Core.StartMinimizedToTray;
    98   CheckBoxAutomaticDPI.Checked := Core.ScaleDPI1.AutoDetect;
    99   SpinEditDPI.Value := Core.ScaleDPI1.DPI.X;
    100   CheckBoxReopenLastFileOnStart.Checked := Core.ReopenLastFileOnStart;
     70  CheckBoxAlwaysOnTop.Checked := Core.Core.AlwaysOnTop;
     71  CheckBoxStartOnLogon.Checked := Core.Core.StartOnLogon;
     72  CheckBoxStartMinimizedToTray.Checked := Core.Core.StartMinimizedToTray;
     73  CheckBoxAutomaticDPI.Checked := Core.Core.ScaleDPI1.AutoDetect;
     74  SpinEditDPI.Value := Core.Core.ScaleDPI1.DPI.X;
     75  CheckBoxReopenLastFileOnStart.Checked := Core.Core.ReopenLastFileOnStart;
    10176  UpdateInterface;
    10277end;
     
    10580begin
    10681  if ComboBoxLanguage.ItemIndex <> -1 then
    107     Core.Translator.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
     82    Core.Core.Translator.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
    10883  if ComboBoxTheme.ItemIndex <> -1 then
    109     Core.ThemeManager.Theme := TTheme(ComboBoxTheme.Items.Objects[ComboBoxTheme.ItemIndex]);
    110   Core.AlwaysOnTop := CheckBoxAlwaysOnTop.Checked;
    111   Core.StartOnLogon := CheckBoxStartOnLogon.Checked;
    112   Core.StartMinimizedToTray := CheckBoxStartMinimizedToTray.Checked;
    113   Core.ScaleDPI1.AutoDetect := CheckBoxAutomaticDPI.Checked;
    114   Core.ScaleDPI1.DPI := Point(SpinEditDPI.Value, SpinEditDPI.Value);
    115   Core.ReopenLastFileOnStart := CheckBoxReopenLastFileOnStart.Checked;
     84    Core.Core.ThemeManager.Theme := TTheme(ComboBoxTheme.Items.Objects[ComboBoxTheme.ItemIndex]);
     85  Core.Core.AlwaysOnTop := CheckBoxAlwaysOnTop.Checked;
     86  Core.Core.StartOnLogon := CheckBoxStartOnLogon.Checked;
     87  Core.Core.StartMinimizedToTray := CheckBoxStartMinimizedToTray.Checked;
     88  Core.Core.ScaleDPI1.AutoDetect := CheckBoxAutomaticDPI.Checked;
     89  Core.Core.ScaleDPI1.DPI := Point(SpinEditDPI.Value, SpinEditDPI.Value);
     90  Core.Core.ReopenLastFileOnStart := CheckBoxReopenLastFileOnStart.Checked;
    11691end;
    11792
Note: See TracChangeset for help on using the changeset viewer.