Ignore:
Timestamp:
Nov 30, 2023, 10:16:14 PM (12 months ago)
Author:
chronos
Message:
  • Modified: Updated high dpi branch from trunk.
  • Modified: Use generics.collections instead of fgl.
  • Modified: Compile with Delphi syntax.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Settings.pas

    r412 r465  
    11unit Settings;
    2 
    3 {$mode delphi}
    42
    53interface
     
    75uses
    86  UDpiControls, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   LCLProc, ScreenTools, Messg, ButtonA, Registry, fgl, Directories, DrawDlg,
    10   ButtonC, UKeyBindings, ULanguages;
     7  LCLProc, ScreenTools, Messg, ButtonA, Directories, DrawDlg, ButtonC,
     8  KeyBindings, Languages;
    119
    1210type
     
    5856{$R *.lfm}
    5957
     58uses
     59  Start;
     60
    6061var
    6162  SFullScreen, SGamma, SRestartMsg, SShortCutPrimary, SShortCutSecondary,
     
    7778procedure TSettingsDlg.FormCreate(Sender: TObject);
    7879begin
     80  Color := clBlack;
    7981  LocalKeyBindings := TKeyBindings.Create;
    8082
     
    117119  Shift: TShiftState);
    118120begin
    119   if Assigned(CurrentKeyBinding) and not (Key in [16..18]) then begin
     121  if (Sender is TDpiEdit) and Assigned(CurrentKeyBinding) and not (Key in [16..18]) then begin
    120122    CurrentKeyBinding.ShortCut := Key or
    121123      (scShift * Integer(ssShift in Shift)) or
     
    131133  var Key: Word; Shift: TShiftState);
    132134begin
    133   if Assigned(CurrentKeyBinding) and not (Key in [16..18]) then begin
     135  if (Sender is TDpiEdit) and Assigned(CurrentKeyBinding) and not (Key in [16..18]) then begin
    134136    CurrentKeyBinding.ShortCut2 := Key or
    135137      (scShift * Integer(ssShift in Shift)) or
     
    192194procedure TSettingsDlg.FormShow(Sender: TObject);
    193195begin
     196  Caption := Phrases2.Lookup('ACTIONHEADER_CONFIG');
    194197  ReloadLanguages;
    195   Languages.LoadToStrings(ListLanguages.Items);
     198  StartDlg.Translator.LanguageListToStrings(ListLanguages.Items);
    196199  ListLanguages.Font.Color := MainTexture.ColorMark;
    197200  ListKeyBindings.Font.Color := MainTexture.ColorMark;
     
    260263procedure TSettingsDlg.LoadData;
    261264begin
    262   ListLanguages.ItemIndex := Languages.Search(LocaleCode);
    263   if (ListLanguages.ItemIndex = -1) and (Languages.Count > 0) then
    264     ListLanguages.ItemIndex := 0;
     265  StartDlg.Translator.Language := StartDlg.Translator.Languages.SearchByCode(LocaleCode);
     266  StartDlg.Translator.LanguageListToStrings(ListLanguages.Items, False);
     267  ListLanguages.ItemIndex := ListLanguages.Items.IndexOfObject(StartDlg.Translator.Language);
     268  if ListLanguages.ItemIndex = -1 then ListLanguages.ItemIndex := 0;
    265269  if FullScreen then ButtonFullscreen.ButtonIndex := 3
    266270    else ButtonFullscreen.ButtonIndex := 2;
    267271  LocalGamma := Gamma;
    268   LocalKeyBindings.Assign(KeyBindings);
     272  LocalKeyBindings.Assign(KeyBindings.KeyBindings);
    269273end;
    270274
     
    274278begin
    275279  NeedRestart := Gamma <> LocalGamma;
    276   LocaleCode := Languages[ListLanguages.ItemIndex].ShortName;
     280  if ListLanguages.ItemIndex <> -1 then begin
     281    StartDlg.Translator.Language := TLanguage(ListLanguages.Items.Objects[ListLanguages.ItemIndex]);
     282    LocaleCode := StartDlg.Translator.Language.Code;
     283  end else begin
     284    StartDlg.Translator.Language := nil;
     285    LocaleCode := '';
     286  end;
    277287  FullScreen := (ButtonFullscreen.ButtonIndex and 1) = 1;
    278288  Gamma := LocalGamma;
    279289  if NeedRestart then SimpleMessage(SRestartMsg);
    280   KeyBindings.Assign(LocalKeyBindings);
     290  KeyBindings.KeyBindings.Assign(LocalKeyBindings);
    281291end;
    282292
    283293end.
    284294
     295
     296
Note: See TracChangeset for help on using the changeset viewer.