Ignore:
Timestamp:
Aug 2, 2018, 10:41:11 AM (6 years ago)
Author:
chronos
Message:
  • Added: Theming support.
  • Modified: Items in Options dialog divided to two pages.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormOptions.pas

    r91 r96  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   Spin, UTarget;
     9  Spin, ComCtrls, ExtCtrls, UTarget, UTheme;
    1010
    1111type
     
    1717    ButtonCancel: TButton;
    1818    CheckBox1: TCheckBox;
     19    CheckBoxDPIAuto: TCheckBox;
    1920    CheckBoxOptimizeAddSub: TCheckBox;
    20     CheckBoxDPIAuto: TCheckBox;
     21    CheckBoxOptimizeCopyMultiply: TCheckBox;
    2122    CheckBoxOptimizeMerge: TCheckBox;
    2223    CheckBoxOptimizeRelativeIndexes: TCheckBox;
    23     CheckBoxOptimizeCopyMultiply: TCheckBox;
    2424    ComboBoxLanguage: TComboBox;
    2525    ComboBoxOptimization: TComboBox;
     26    ComboBoxTheme: TComboBox;
    2627    Label1: TLabel;
    2728    Label2: TLabel;
     
    2930    Label4: TLabel;
    3031    LabelDPI: TLabel;
     32    LabelTheme: TLabel;
    3133    LabelX: TLabel;
     34    PageControl1: TPageControl;
     35    Panel1: TPanel;
     36    Panel2: TPanel;
     37    SpinEditCellSize: TSpinEdit;
    3238    SpinEditDPIX: TSpinEdit;
    3339    SpinEditDPIY: TSpinEdit;
    34     SpinEditCellSize: TSpinEdit;
    3540    SpinEditMemorySize: TSpinEdit;
    36     procedure ButtonOkClick(Sender: TObject);
     41    TabSheetGeneral: TTabSheet;
     42    TabSheetBuild: TTabSheet;
    3743    procedure CheckBoxDPIAutoChange(Sender: TObject);
    3844    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
     
    6268begin
    6369  Core.PersistentForm1.Load(Self);
    64 
    65   Core.CoolTranslator1.LanguageListToStrings(ComboBoxLanguage.Items);
    66   ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.CoolTranslator1.Language);
    67   if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
    68   CheckBox1.Checked := Core.OpenProjectOnStart;
    6970end;
    7071
     
    8788procedure TFormOptions.Load;
    8889begin
     90  ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.CoolTranslator1.Language);
     91  if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
     92  ComboBoxTheme.ItemIndex := ComboBoxTheme.Items.IndexOfObject(Core.ThemeManager.Theme);
     93  if ComboBoxTheme.ItemIndex = -1 then ComboBoxTheme.ItemIndex := 0;
     94  CheckBox1.Checked := Core.OpenProjectOnStart;
    8995  CheckBoxOptimizeAddSub.Checked := Core.Optimizations.AddSub;
    9096  CheckBoxOptimizeMerge.Checked := Core.Optimizations.Merge;
     
    102108procedure TFormOptions.Save;
    103109begin
     110  if ComboBoxLanguage.ItemIndex <> -1 then
     111    Core.CoolTranslator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
     112  if ComboBoxTheme.ItemIndex <> -1 then
     113    Core.ThemeManager.Theme := TTheme(ComboBoxTheme.Items.Objects[ComboBoxTheme.ItemIndex]);
     114  Core.OpenProjectOnStart := CheckBox1.Checked;
    104115  Core.ScaleDPI1.DPI := Point(SpinEditDPIX.Value, SpinEditDPIY.Value);
    105116  Core.ScaleDPI1.AutoDetect := CheckBoxDPIAuto.Checked;
     
    111122  Core.Optimizations.RelativeIndexes := CheckBoxOptimizeRelativeIndexes.Checked;
    112123  Core.Optimizations.CopyMultiply := CheckBoxOptimizeCopyMultiply.Checked;
    113 end;
    114 
    115 procedure TFormOptions.ButtonOkClick(Sender: TObject);
    116 begin
    117   if ComboBoxLanguage.ItemIndex <> -1 then
    118     Core.CoolTranslator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
    119   Core.OpenProjectOnStart := CheckBox1.Checked;
    120124end;
    121125
     
    134138begin
    135139  Core.CoolTranslator1.TranslateComponentRecursive(Self);
     140  Core.ThemeManager.UseTheme(Self);
     141  Core.ThemeManager.Themes.LoadToStrings(ComboBoxTheme.Items);
     142  Core.CoolTranslator1.LanguageListToStrings(ComboBoxLanguage.Items);
    136143end;
    137144
Note: See TracChangeset for help on using the changeset viewer.