Ignore:
Timestamp:
Jun 7, 2024, 12:47:11 PM (5 months ago)
Author:
chronos
Message:
  • Modified: Remove U prefix from unit names.
  • Modified: Used TFormEx for all forms for code simplification.
  • Fixed: Fullscreen mode switching error.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Forms/FormSettings.pas

    r85 r86  
    1 unit UFormSettings;
    2 
    3 {$mode delphi}
     1unit FormSettings;
    42
    53interface
     
    75uses
    86  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ComCtrls,
    9   Languages, Theme;
     7  Languages, Theme, FormEx;
    108
    119type
     
    1311  { TFormSettings }
    1412
    15   TFormSettings = class(TForm)
     13  TFormSettings = class(TFormEx)
    1614    ButtonOk: TButton;
    1715    ButtonCancel: TButton;
     
    2422    procedure ButtonCancelClick(Sender: TObject);
    2523    procedure ButtonOkClick(Sender: TObject);
    26     procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    2724    procedure FormCreate(Sender: TObject);
    2825    procedure FormShow(Sender: TObject);
    29   private
    30 
    31   public
    32 
    3326  end;
    34 
    35 var
    36   FormSettings: TFormSettings;
    3727
    3828
     
    4232
    4333uses
    44   UCore;
     34  Core;
    4535
    4636resourcestring
    4737  SLanguageChangeTitle = 'Language change';
    4838  SLanguageChangeMessage = 'Interface language was changed. It may require restart of application.';
    49 
    5039
    5140{ TFormSettings }
     
    5847procedure TFormSettings.ButtonOkClick(Sender: TObject);
    5948begin
    60   Core.Game.AnimationDuration := TrackBar1.Position;
     49  Core.Core.Game.AnimationDuration := TrackBar1.Position;
    6150  if ComboBoxLanguage.ItemIndex <> -1 then begin
    62     if (Core.Translator1.Language <> TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex])) then
     51    if (Core.Core.Translator1.Language <> TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex])) then
    6352      MessageDlg(SLanguageChangeTitle, SLanguageChangeMessage, mtInformation, [mbOk], 0);
    64     Core.Translator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
     53    Core.Core.Translator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
    6554  end;
    6655  if ComboBoxTheme.ItemIndex <> -1 then
    67     Core.ThemeManager1.Theme := TTheme(ComboBoxTheme.Items.Objects[ComboBoxTheme.ItemIndex]);
     56    Core.Core.ThemeManager1.Theme := TTheme(ComboBoxTheme.Items.Objects[ComboBoxTheme.ItemIndex]);
    6857  ModalResult := mrOk;
    69 end;
    70 
    71 procedure TFormSettings.FormClose(Sender: TObject; var CloseAction: TCloseAction
    72   );
    73 begin
    74   Core.PersistentForm1.Save(Self);
    7558end;
    7659
    7760procedure TFormSettings.FormCreate(Sender: TObject);
    7861begin
    79   Core.Translator1.TranslateComponentRecursive(Self);
    80   Core.Translator1.LanguageListToStrings(ComboBoxLanguage.Items);
    81   Core.ThemeManager1.UseTheme(Self);
    82   Core.ThemeManager1.Themes.LoadToStrings(ComboBoxTheme.Items);
     62  Core.Core.Translator1.LanguageListToStrings(ComboBoxLanguage.Items);
     63  Core.Core.ThemeManager1.Themes.LoadToStrings(ComboBoxTheme.Items);
    8364end;
    8465
    8566procedure TFormSettings.FormShow(Sender: TObject);
    8667begin
    87   Core.PersistentForm1.Load(Self);
    88   TrackBar1.Position := Core.Game.AnimationDuration;
    89   ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.Translator1.Language);
     68  TrackBar1.Position := Core.Core.Game.AnimationDuration;
     69  ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.Core.Translator1.Language);
    9070  if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
    91   ComboBoxTheme.ItemIndex := ComboBoxTheme.Items.IndexOfObject(Core.ThemeManager1.Theme);
     71  ComboBoxTheme.ItemIndex := ComboBoxTheme.Items.IndexOfObject(Core.Core.ThemeManager1.Theme);
    9272  if ComboBoxTheme.ItemIndex = -1 then ComboBoxTheme.ItemIndex := 0;
    9373end;
Note: See TracChangeset for help on using the changeset viewer.