Ignore:
Timestamp:
Sep 21, 2018, 2:09:10 PM (6 years ago)
Author:
chronos
Message:
  • Added: Support for color themes.
  • Added: Remember dimensions for more forms.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormSettings.pas

    r195 r243  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   Spin, ComCtrls;
     9  Spin, ComCtrls, ExtCtrls;
    1010
    1111type
     
    1616    ButtonOk: TButton;
    1717    ButtonCancel: TButton;
     18    CheckBox2: TCheckBox;
     19    CheckBoxAutoSaveTurn: TCheckBox;
     20    CheckBoxDevelMode: TCheckBox;
    1821    CheckBoxReopenLastFile: TCheckBox;
    19     CheckBoxAutoSaveTurn: TCheckBox;
    20     CheckBox2: TCheckBox;
    21     CheckBoxDevelMode: TCheckBox;
    2222    ComboBoxLanguage: TComboBox;
     23    ComboBoxTheme: TComboBox;
    2324    Label1: TLabel;
    2425    Label2: TLabel;
     
    2627    Label4: TLabel;
    2728    Label5: TLabel;
     29    Label6: TLabel;
    2830    PageControl1: TPageControl;
     31    Panel1: TPanel;
     32    Panel2: TPanel;
     33    SpinEditAnimSpeed: TSpinEdit;
    2934    SpinEditX: TSpinEdit;
    3035    SpinEditY: TSpinEdit;
    31     SpinEditAnimSpeed: TSpinEdit;
    3236    TabSheetGeneral: TTabSheet;
    3337    TabSheetDebug: TTabSheet;
    3438    procedure CheckBox2Change(Sender: TObject);
     39    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    3540    procedure FormCreate(Sender: TObject);
    3641    procedure FormShow(Sender: TObject);
     
    5055
    5156uses
    52   UCore, ULanguages;
     57  UCore, ULanguages, UTheme;
    5358
    5459{ TFormSettings }
     
    6065end;
    6166
     67procedure TFormSettings.FormClose(Sender: TObject; var CloseAction: TCloseAction
     68  );
     69begin
     70  Core.PersistentForm.Save(Self);
     71end;
     72
    6273procedure TFormSettings.FormCreate(Sender: TObject);
    6374begin
    6475  PageControl1.TabIndex := 0;
    6576  Core.CoolTranslator1.TranslateComponentRecursive(Self);
     77  Core.ThemeManager1.Themes.LoadToStrings(ComboBoxTheme.Items);
     78  Core.CoolTranslator1.LanguageListToStrings(ComboBoxLanguage.Items);
    6679end;
    6780
    6881procedure TFormSettings.FormShow(Sender: TObject);
    6982begin
     83  Core.PersistentForm.Load(Self);
     84  Core.ThemeManager1.UseTheme(Self);
    7085  {$IFDEF DEBUG}
    7186  TabSheetDebug.TabVisible := True;
     
    7792procedure TFormSettings.Load;
    7893begin
    79   Core.CoolTranslator1.LanguageListToStrings(ComboBoxLanguage.Items);
    8094  ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.CoolTranslator1.Language);
    8195  if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
     96  ComboBoxTheme.ItemIndex := ComboBoxTheme.Items.IndexOfObject(Core.ThemeManager1.Theme);
     97  if ComboBoxTheme.ItemIndex = -1 then ComboBoxTheme.ItemIndex := 0;
    8298  CheckBoxDevelMode.Checked := Core.DevelMode;
    8399  SpinEditAnimSpeed.Value := Core.AnimationSpeed;
     
    93109  if ComboBoxLanguage.ItemIndex <> -1 then
    94110    Core.CoolTranslator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
     111   if ComboBoxTheme.ItemIndex <> -1 then
     112    Core.ThemeManager1.Theme := TTheme(ComboBoxTheme.Items.Objects[ComboBoxTheme.ItemIndex]);
    95113  Core.DevelMode := CheckBoxDevelMode.Checked;
    96114  Core.AnimationSpeed := SpinEditAnimSpeed.Value;
Note: See TracChangeset for help on using the changeset viewer.