Ignore:
Timestamp:
Feb 14, 2018, 10:39:55 AM (7 years ago)
Author:
chronos
Message:
  • Added: Basic color theming support. Colors can be changed only for some controls.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormSettings.pas

    r154 r174  
    2323    CheckBoxAlwaysOnTop: TCheckBox;
    2424    ComboBoxLanguage: TComboBox;
     25    ComboBoxTheme: TComboBox;
    2526    Label1: TLabel;
    2627    Label2: TLabel;
     28    Label3: TLabel;
    2729    SpinEditDPI: TSpinEdit;
    2830    procedure ButtonOkClick(Sender: TObject);
     
    4749
    4850uses
    49   UCore;
     51  UCore, UTheme;
    5052
    5153{ TFormSettings }
     
    5355procedure TFormSettings.FormShow(Sender: TObject);
    5456begin
    55   Core.CoolTranslator1.LanguageListToStrings(ComboBoxLanguage.Items);
    56   ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.CoolTranslator1.Language);
    57   if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
    5857end;
    5958
    6059procedure TFormSettings.ButtonOkClick(Sender: TObject);
    6160begin
    62   if ComboBoxLanguage.ItemIndex <> -1 then
    63     Core.CoolTranslator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
    6461end;
    6562
     
    7774begin
    7875  Core.CoolTranslator1.TranslateComponentRecursive(Self);
     76  Core.ThemeManager.UseTheme(Self);
     77  Core.ThemeManager.Themes.LoadToStrings(ComboBoxTheme.Items);
     78  Core.CoolTranslator1.LanguageListToStrings(ComboBoxLanguage.Items);
    7979end;
    8080
    8181procedure TFormSettings.Load;
    8282begin
     83  ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.CoolTranslator1.Language);
     84  if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
     85  ComboBoxTheme.ItemIndex := ComboBoxTheme.Items.IndexOfObject(Core.ThemeManager.Theme);
     86  if ComboBoxTheme.ItemIndex = -1 then ComboBoxTheme.ItemIndex := 0;
    8387  CheckBoxAlwaysOnTop.Checked := Core.AlwaysOnTop;
    8488  CheckBoxStartOnLogon.Checked := Core.StartOnLogon;
     
    9296procedure TFormSettings.Save;
    9397begin
     98  if ComboBoxLanguage.ItemIndex <> -1 then
     99    Core.CoolTranslator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
     100  if ComboBoxTheme.ItemIndex <> -1 then
     101    Core.ThemeManager.Theme := TTheme(ComboBoxTheme.Items.Objects[ComboBoxTheme.ItemIndex]);
    94102  Core.AlwaysOnTop := CheckBoxAlwaysOnTop.Checked;
    95103  Core.StartOnLogon := CheckBoxStartOnLogon.Checked;
Note: See TracChangeset for help on using the changeset viewer.