Ignore:
Timestamp:
Jun 5, 2023, 6:44:57 PM (18 months ago)
Author:
chronos
Message:
  • Modified: Remove U prefix from unit names.
  • Modified: Updated Common package.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Forms/FormOptions.pas

    r144 r145  
    1 unit UFormOptions;
     1unit FormOptions;
    22
    33interface
     
    55uses
    66  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    7   Spin, ComCtrls, ExtCtrls, UTarget, UTheme;
     7  Spin, ComCtrls, ExtCtrls, Target, Theme;
    88
    99type
     
    4747    procedure FormCreate(Sender: TObject);
    4848    procedure FormShow(Sender: TObject);
    49   private
    50     { private declarations }
    5149  public
    5250    procedure UpdateInterface;
     
    5553  end;
    5654
    57 var
    58   FormOptions: TFormOptions;
    5955
    6056implementation
     
    6359
    6460uses
    65   UCore, ULanguages;
     61  Core, Languages;
    6662
    6763{ TFormOptions }
     
    6965procedure TFormOptions.FormShow(Sender: TObject);
    7066begin
    71   Core.PersistentForm1.Load(Self);
     67  Core.Core.PersistentForm1.Load(Self);
    7268end;
    7369
     
    9187procedure TFormOptions.Load;
    9288begin
    93   ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.Translator.Language);
    94   if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
    95   ComboBoxTheme.ItemIndex := ComboBoxTheme.Items.IndexOfObject(Core.ThemeManager.Theme);
    96   if ComboBoxTheme.ItemIndex = -1 then ComboBoxTheme.ItemIndex := 0;
    97   CheckBoxReopenLastFile.Checked := Core.OpenProjectOnStart;
    98   CheckBoxOptimizeAddSub.Checked := Core.Optimizations.AddSub;
    99   CheckBoxOptimizeSetZero.Checked := Core.Optimizations.SetZero;
    100   CheckBoxOptimizeMerge.Checked := Core.Optimizations.Merge;
    101   CheckBoxOptimizeRelativeIndexes.Checked := Core.Optimizations.RelativeIndexes;
    102   CheckBoxOptimizeCopyMultiply.Checked := Core.Optimizations.CopyMultiply;
    103   SpinEditDPIX.Value := Core.ScaleDPI1.DPI.X;
    104   SpinEditDPIY.Value := Core.ScaleDPI1.DPI.Y;
    105   CheckBoxDPIAuto.Checked := Core.ScaleDPI1.AutoDetect;
    106   ComboBoxOptimization.ItemIndex := Integer(Core.OptimizationLevel);
    107   SpinEditCellSize.Value := Core.CellSize;
    108   SpinEditMemorySize.Value := Core.MemorySize;
    109   CheckBoxDebugEnabled.Checked := Core.DebugEnabled;
    110   if Core.OptionsFormTabIndex < PageControl1.PageCount then
    111     PageControl1.TabIndex := Core.OptionsFormTabIndex
    112     else PageControl1.TabIndex := 0;
     89  with Core.Core do begin
     90    ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Translator.Language);
     91    if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
     92    ComboBoxTheme.ItemIndex := ComboBoxTheme.Items.IndexOfObject(ThemeManager.Theme);
     93    if ComboBoxTheme.ItemIndex = -1 then ComboBoxTheme.ItemIndex := 0;
     94    CheckBoxReopenLastFile.Checked := OpenProjectOnStart;
     95    CheckBoxOptimizeAddSub.Checked := Optimizations.AddSub;
     96    CheckBoxOptimizeSetZero.Checked := Optimizations.SetZero;
     97    CheckBoxOptimizeMerge.Checked := Optimizations.Merge;
     98    CheckBoxOptimizeRelativeIndexes.Checked := Optimizations.RelativeIndexes;
     99    CheckBoxOptimizeCopyMultiply.Checked := Optimizations.CopyMultiply;
     100    SpinEditDPIX.Value := ScaleDPI1.DPI.X;
     101    SpinEditDPIY.Value := ScaleDPI1.DPI.Y;
     102    CheckBoxDPIAuto.Checked := ScaleDPI1.AutoDetect;
     103    ComboBoxOptimization.ItemIndex := Integer(OptimizationLevel);
     104    SpinEditCellSize.Value := CellSize;
     105    SpinEditMemorySize.Value := MemorySize;
     106    CheckBoxDebugEnabled.Checked := DebugEnabled;
     107    if OptionsFormTabIndex < PageControl1.PageCount then
     108      PageControl1.TabIndex := OptionsFormTabIndex
     109      else PageControl1.TabIndex := 0;
     110  end;
    113111  UpdateInterface;
    114112end;
     
    116114procedure TFormOptions.Save;
    117115begin
     116  with Core.Core do begin
    118117  if ComboBoxLanguage.ItemIndex <> -1 then
    119     Core.Translator.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
     118    Translator.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
    120119  if ComboBoxTheme.ItemIndex <> -1 then
    121     Core.ThemeManager.Theme := TTheme(ComboBoxTheme.Items.Objects[ComboBoxTheme.ItemIndex]);
    122   Core.OpenProjectOnStart := CheckBoxReopenLastFile.Checked;
    123   Core.ScaleDPI1.DPI := Point(SpinEditDPIX.Value, SpinEditDPIY.Value);
    124   Core.ScaleDPI1.AutoDetect := CheckBoxDPIAuto.Checked;
    125   Core.OptimizationLevel := TCompilerOptimization(ComboBoxOptimization.ItemIndex);
    126   Core.CellSize := SpinEditCellSize.Value;
    127   Core.MemorySize := SpinEditMemorySize.Value;
    128   Core.Optimizations.AddSub := CheckBoxOptimizeAddSub.Checked;
    129   Core.Optimizations.SetZero := CheckBoxOptimizeSetZero.Checked;
    130   Core.Optimizations.Merge := CheckBoxOptimizeMerge.Checked;
    131   Core.Optimizations.RelativeIndexes := CheckBoxOptimizeRelativeIndexes.Checked;
    132   Core.Optimizations.CopyMultiply := CheckBoxOptimizeCopyMultiply.Checked;
    133   Core.DebugEnabled := CheckBoxDebugEnabled.Checked;
    134   Core.OptionsFormTabIndex := PageControl1.TabIndex;
     120    ThemeManager.Theme := TTheme(ComboBoxTheme.Items.Objects[ComboBoxTheme.ItemIndex]);
     121    OpenProjectOnStart := CheckBoxReopenLastFile.Checked;
     122    ScaleDPI1.DPI := Point(SpinEditDPIX.Value, SpinEditDPIY.Value);
     123    ScaleDPI1.AutoDetect := CheckBoxDPIAuto.Checked;
     124    OptimizationLevel := TCompilerOptimization(ComboBoxOptimization.ItemIndex);
     125    CellSize := SpinEditCellSize.Value;
     126    MemorySize := SpinEditMemorySize.Value;
     127    Optimizations.AddSub := CheckBoxOptimizeAddSub.Checked;
     128    Optimizations.SetZero := CheckBoxOptimizeSetZero.Checked;
     129    Optimizations.Merge := CheckBoxOptimizeMerge.Checked;
     130    Optimizations.RelativeIndexes := CheckBoxOptimizeRelativeIndexes.Checked;
     131    Optimizations.CopyMultiply := CheckBoxOptimizeCopyMultiply.Checked;
     132    DebugEnabled := CheckBoxDebugEnabled.Checked;
     133    OptionsFormTabIndex := PageControl1.TabIndex;
     134  end;
    135135end;
    136136
     
    157157  );
    158158begin
    159   Core.PersistentForm1.Save(Self);
     159  Core.Core.PersistentForm1.Save(Self);
    160160end;
    161161
    162162procedure TFormOptions.FormCreate(Sender: TObject);
    163163begin
    164   Core.Translator.TranslateComponentRecursive(Self);
    165   Core.ThemeManager.UseTheme(Self);
    166   Core.ThemeManager.Themes.LoadToStrings(ComboBoxTheme.Items);
    167   Core.Translator.LanguageListToStrings(ComboBoxLanguage.Items);
     164  with Core.Core do begin
     165    Translator.TranslateComponentRecursive(Self);
     166    ThemeManager.UseTheme(Self);
     167    ThemeManager.Themes.LoadToStrings(ComboBoxTheme.Items);
     168    Translator.LanguageListToStrings(ComboBoxLanguage.Items);
     169  end;
    168170  ComboBoxOptimization.Items.Clear;
    169171  ComboBoxOptimization.Items.Add(CompilerOptimizationText[coNone]);
Note: See TracChangeset for help on using the changeset viewer.