Changeset 385 for trunk


Ignore:
Timestamp:
Apr 27, 2021, 6:42:29 PM (4 years ago)
Author:
chronos
Message:
  • Added: Allow to change key bindings from Settings dialog.
  • Added: Allow to reset settings in Settings dialog.
Location:
trunk
Files:
1 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/GameServer.pas

    r384 r385  
    12221222    begin
    12231223      GenerateStat(pTurn);
    1224       StatRequest := false
     1224      StatRequest := false;
    12251225    end;
    12261226    // complete all internal commands following an sTurn before generating statistics
  • trunk/Integrated.lpi

    r368 r385  
    9595      </Item2>
    9696    </RequiredPackages>
    97     <Units Count="47">
     97    <Units Count="48">
    9898      <Unit0>
    9999        <Filename Value="Integrated.lpr"/>
     
    356356        <IsPartOfProject Value="True"/>
    357357      </Unit46>
     358      <Unit47>
     359        <Filename Value="ULanguages.pas"/>
     360        <IsPartOfProject Value="True"/>
     361      </Unit47>
    358362    </Units>
    359363  </ProjectOptions>
  • trunk/Language.txt

    r364 r385  
    341341#BTN_NO No
    342342#BTN_INFO Info
     343#BTN_RESET Reset
    343344
    344345'Button Tooltips
     
    952953Gamma
    953954Restart is needed to apply changes
     955Primary
     956Secondary
     957Languages
     958Key bindings
  • trunk/LocalPlayer/Term.pas

    r364 r385  
    34403440  NoMapPanel := TIsoMap.Create;
    34413441
    3442   KeyBindings.LoadFromRegistry(HKEY_CURRENT_USER, AppRegistryKey + '\KeyBindings');
    34433442  UpdateKeyShortcuts;
    34443443
     
    35393538  I: Integer;
    35403539begin
    3541   KeyBindings.SaveToRegistry(HKEY_CURRENT_USER, AppRegistryKey + '\KeyBindings');
    35423540  MainFormKeyDown := nil;
    35433541  FreeAndNil(sb);
  • trunk/LocalPlayer/UKeyBindings.pas

    r293 r385  
    1717    ShortCut: TShortCut;
    1818    ShortCut2: TShortCut;
     19    DefaultShortCut: TShortCut;
     20    DefaultShortCut2: TShortCut;
    1921    function Test(AShortCut: TShortCut): Boolean;
     22    procedure Assign(Source: TKeyBinding);
     23    procedure SetDefault;
    2024  end;
    2125
     
    2327
    2428  TKeyBindings = class(TFPGObjectList<TKeyBinding>)
     29  private
    2530  public
    2631    function AddItem(const ShortName, FullName: string; ShortCut: TShortCut; ShortCut2: TShortCut = 0): TKeyBinding; overload;
     
    2934    procedure LoadFromRegistry(RootKey: HKEY; Key: string);
    3035    procedure SaveToRegistry(RootKey: HKEY; Key: string);
     36    procedure LoadToStrings(Strings: TStrings);
     37    procedure Assign(Source: TKeyBindings);
     38    procedure ResetToDefault;
    3139  end;
    3240
     
    123131end;
    124132
     133procedure TKeyBinding.Assign(Source: TKeyBinding);
     134begin
     135  ShortName := Source.ShortName;
     136  FullName := Source.FullName;
     137  ShortCut := Source.ShortCut;
     138  ShortCut2 := Source.ShortCut2;
     139  DefaultShortCut := Source.DefaultShortCut;
     140  DefaultShortCut2 := Source.DefaultShortCut2;
     141end;
     142
     143procedure TKeyBinding.SetDefault;
     144begin
     145  ShortCut := DefaultShortCut;
     146  ShortCut2 := DefaultShortCut2;
     147end;
     148
    125149{ TKeyBindings }
    126150
     
    133157  Result.ShortCut := ShortCut;
    134158  Result.ShortCut2 := ShortCut2;
     159  Result.DefaultShortCut := ShortCut;
     160  Result.DefaultShortCut2 := ShortCut2;
    135161  Add(Result);
    136162end;
     
    205231    Free;
    206232  end;
     233end;
     234
     235procedure TKeyBindings.LoadToStrings(Strings: TStrings);
     236var
     237  I: Integer;
     238  Text: string;
     239begin
     240  Strings.Clear;
     241  for I := 0 to Count - 1 do begin
     242    Text:= '';
     243    if Items[I].ShortCut <> 0 then
     244      Text:= Text + ShortCutToText(Items[I].ShortCut);
     245    if Items[I].ShortCut2 <> 0 then begin
     246      if Text <> '' then Text := Text + ', ';
     247      Text:= Text + ShortCutToText(Items[I].ShortCut2);
     248    end;
     249    if Text <> '' then Text := Items[I].FullName + ' (' + Text + ')'
     250      else Text := Items[I].FullName;
     251    Strings.Add(Text);
     252  end;
     253end;
     254
     255procedure TKeyBindings.Assign(Source: TKeyBindings);
     256var
     257  I: Integer;
     258begin
     259  while Count < Source.Count do
     260    Add(TKeyBinding.Create);
     261  while Count > Source.Count do
     262    Delete(Count - 1);
     263  for I := 0 to Count - 1 do
     264    Items[I].Assign(Source.Items[I]);
     265end;
     266
     267procedure TKeyBindings.ResetToDefault;
     268var
     269  I: Integer;
     270begin
     271  for I := 0 to Count - 1 do
     272    Items[I].SetDefault;
    207273end;
    208274
  • trunk/Localization/cs/Language.txt

    r364 r385  
    341341#BTN_NO Ne
    342342#BTN_INFO Info
     343#BTN_RESET Výchozí
    343344
    344345'Button Tooltips
     
    952953Gamma
    953954Pro projevení změn je potřeba restart
     955Hlavní
     956Vedlejší
     957Jazyky
     958Klávesové zkratky
  • trunk/Localization/de/Language.txt

    r364 r385  
    344344#BTN_NO Nein
    345345#BTN_INFO Info
     346#BTN_RESET Reset
    346347
    347348'Button Tooltips
     
    970971Gamma
    971972Restart is needed to apply changes
     973Primary
     974Secondary
     975Languages
     976Key bindings
  • trunk/Localization/it/Language.txt

    r364 r385  
    331331#BTN_NO No
    332332#BTN_INFO Dati
     333#BTN_RESET Reset
    333334
    334335'Button Tooltips
     
    942943Gamma
    943944Restart is needed to apply changes
     945Primary
     946Secondary
     947Languages
     948Key bindings
  • trunk/Localization/ru/Language.txt

    r364 r385  
    351351#BTN_NO Нет
    352352#BTN_INFO Информация
     353#BTN_RESET Reset
    353354
    354355'Названия кнопок-инструментов
     
    977978Gamma
    978979Restart is needed to apply changes
     980Primary
     981Secondary
     982Languages
     983Key bindings
  • trunk/Localization/zh-Hans/language.txt

    r364 r385  
    344344#BTN_NO ·ñ
    345345#BTN_INFO °ïÖú
     346#BTN_RESET Reset
    346347
    347348'Button Tooltips
     
    969970Gamma
    970971Restart is needed to apply changes
     972Primary
     973Secondary
     974Languages
     975Key bindings
  • trunk/Localization/zh-Hant/language.txt

    r364 r385  
    344344#BTN_NO §_
    345345#BTN_INFO À°§U
     346#BTN_RESET Reset
    346347
    347348'Button Tooltips
     
    969970Gamma
    970971Restart is needed to apply changes
     972Primary
     973Secondary
     974Languages
     975Key bindings
  • trunk/Settings.lfm

    r317 r385  
    1010  DesignTimePPI = 144
    1111  FormStyle = fsStayOnTop
     12  OnClose = FormClose
    1213  OnCreate = FormCreate
    1314  OnDestroy = FormDestroy
     
    1718  LCLVersion = '2.0.12.0'
    1819  Scaled = False
    19   object List: TListBox
     20  object ListLanguages: TListBox
    2021    Tag = 15360
    21     Left = 24
    22     Height = 304
    23     Top = 16
    24     Width = 424
    25     Anchors = [akTop, akLeft, akRight, akBottom]
     22    Left = 16
     23    Height = 267
     24    Top = 32
     25    Width = 144
    2626    BorderStyle = bsNone
    2727    Color = clBlack
     
    3434    ItemHeight = 0
    3535    ParentFont = False
    36     ScrollWidth = 424
    37     TabOrder = 0
     36    ScrollWidth = 144
     37    TabOrder = 1
    3838    TabStop = False
    3939    TopIndex = -1
    4040  end
    41   object OKBtn: TButtonA
    42     Left = 272
     41  object ButtonOk: TButtonA
     42    Left = 364
    4343    Height = 25
    4444    Top = 400
     
    4646    Down = False
    4747    Permanent = False
    48     OnClick = OKBtnClick
     48    OnClick = ButtonOkClick
    4949  end
    50   object CancelBtn: TButtonA
    51     Left = 96
     50  object ButtonCancel: TButtonA
     51    Left = 244
    5252    Height = 25
    5353    Top = 400
     
    5555    Down = False
    5656    Permanent = False
    57     OnClick = CancelBtnClick
     57    OnClick = ButtonCancelClick
    5858  end
    5959  object ButtonFullscreen: TButtonC
     
    8989    ButtonIndex = 0
    9090  end
     91  object ListKeyBindings: TListBox
     92    Tag = 15360
     93    Left = 176
     94    Height = 192
     95    Top = 32
     96    Width = 288
     97    BorderStyle = bsNone
     98    Color = clBlack
     99    ExtendedSelect = False
     100    Font.Color = 4176863
     101    Font.Height = -15
     102    Font.Name = 'Times New Roman'
     103    Font.Style = [fsBold]
     104    IntegralHeight = True
     105    ItemHeight = 0
     106    OnSelectionChange = ListKeyBindingsSelectionChange
     107    ParentFont = False
     108    ScrollWidth = 288
     109    TabOrder = 0
     110    TabStop = False
     111    TopIndex = -1
     112  end
     113  object EditShortCutPrimary: TEdit
     114    Left = 176
     115    Height = 42
     116    Top = 256
     117    Width = 136
     118    Enabled = False
     119    OnKeyUp = EditShortCutPrimaryKeyUp
     120    TabOrder = 2
     121  end
     122  object EditShortCutSecondary: TEdit
     123    Left = 328
     124    Height = 42
     125    Top = 257
     126    Width = 136
     127    Enabled = False
     128    OnKeyUp = EditShortCutSecondaryKeyUp
     129    TabOrder = 3
     130  end
     131  object ButtonReset: TButtonA
     132    Left = 16
     133    Height = 25
     134    Top = 400
     135    Width = 100
     136    Down = False
     137    Permanent = False
     138    OnClick = ButtonResetClick
     139  end
    91140end
  • trunk/Settings.pas

    r352 r385  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   ScreenTools, Messg, ButtonA, Registry, fgl, Directories, DrawDlg, ButtonC;
     9  LCLProc, ScreenTools, Messg, ButtonA, Registry, fgl, Directories, DrawDlg,
     10  ButtonC, UKeyBindings, ULanguages;
    1011
    1112type
    12   TLanguage = class
    13     ShortName: string;
    14     FullName: string;
    15     Author: string;
    16   end;
    17 
    18   { TLanguages }
    19 
    20   TLanguages = class(TFPGObjectList<TLanguage>)
    21     procedure AddItem(const ShortName, FullName: string);
    22     procedure LoadToStrings(Strings: TStrings);
    23     function Search(ShortName: string): Integer;
    24   end;
    25 
    2613  { TSettingsDlg }
    2714
     
    2916    ButtonFullscreen: TButtonC;
    3017    Down2Btn: TButtonC;
    31     List: TListBox;
    32     OKBtn: TButtonA;
    33     CancelBtn: TButtonA;
     18    EditShortCutPrimary: TEdit;
     19    EditShortCutSecondary: TEdit;
     20    ListLanguages: TListBox;
     21    ListKeyBindings: TListBox;
     22    ButtonOk: TButtonA;
     23    ButtonCancel: TButtonA;
     24    ButtonReset: TButtonA;
    3425    Up2Btn: TButtonC;
    3526    procedure ButtonFullscreenClick(Sender: TObject);
    36     procedure CancelBtnClick(Sender: TObject);
     27    procedure ButtonCancelClick(Sender: TObject);
     28    procedure ButtonResetClick(Sender: TObject);
    3729    procedure Down2BtnClick(Sender: TObject);
     30    procedure EditShortCutPrimaryKeyUp(Sender: TObject; var Key: Word;
     31      Shift: TShiftState);
     32    procedure EditShortCutSecondaryKeyUp(Sender: TObject; var Key: Word;
     33      Shift: TShiftState);
     34    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    3835    procedure FormCreate(Sender: TObject);
    3936    procedure FormDestroy(Sender: TObject);
    4037    procedure FormPaint(Sender: TObject);
    4138    procedure FormShow(Sender: TObject);
    42     procedure OKBtnClick(Sender: TObject);
     39    procedure ListKeyBindingsSelectionChange(Sender: TObject; User: boolean);
     40    procedure ButtonOkClick(Sender: TObject);
    4341    procedure Up2BtnClick(Sender: TObject);
    4442  private
    4543    LocalGamma: Integer;
     44    LocalKeyBindings: TKeyBindings;
     45    CurrentKeyBinding: TKeyBinding;
     46    procedure UpdateShortCutItem;
    4647  public
    47     Languages: TLanguages;
    4848    procedure LoadData;
    4949    procedure SaveData;
     
    5353  SettingsDlg: TSettingsDlg;
    5454
     55
    5556implementation
    5657
    5758{$R *.lfm}
    5859
    59 { TLanguages }
    60 
    61 procedure TLanguages.AddItem(const ShortName, FullName: string);
    6260var
    63   Language: TLanguage;
    64 begin
    65   Language := TLanguage.Create;
    66   Language.ShortName := ShortName;
    67   Language.FullName := FullName;
    68   Add(Language);
    69 end;
    70 
    71 procedure TLanguages.LoadToStrings(Strings: TStrings);
    72 var
    73   I: Integer;
    74 begin
    75   Strings.Clear;
    76   for I := 0 to Count - 1 do
    77     Strings.Add(Items[I].FullName);
    78 end;
    79 
    80 function TLanguages.Search(ShortName: string): Integer;
    81 var
    82   I: Integer;
    83 begin
    84   I := 0;
    85   while (I < Count) and (Items[I].ShortName <> ShortName) do Inc(I);
    86   if I < Count then Result := I
    87     else Result := -1;
     61  SFullScreen, SGamma, SRestartMsg, SShortCutPrimary, SShortCutSecondary,
     62  SLanguages, SKeyBindings: string;
     63
     64procedure ReloadLanguages;
     65begin
     66  SFullScreen := Phrases.Lookup('SETTINGS', 0);
     67  SGamma := Phrases.Lookup('SETTINGS', 1);
     68  SRestartMsg := Phrases.Lookup('SETTINGS', 2);
     69  SShortCutPrimary := Phrases.Lookup('SETTINGS', 3);
     70  SShortCutSecondary := Phrases.Lookup('SETTINGS', 4);
     71  SLanguages := Phrases.Lookup('SETTINGS', 5);
     72  SKeyBindings := Phrases.Lookup('SETTINGS', 6);
    8873end;
    8974
     
    9277procedure TSettingsDlg.FormCreate(Sender: TObject);
    9378begin
     79  LocalKeyBindings := TKeyBindings.Create;
     80
    9481  Canvas.Font.Assign(UniFont[ftNormal]);
    9582  Canvas.Brush.Style := bsClear;
    9683
    97   Languages := TLanguages.Create;
    98   Languages.AddItem('', 'System');
    99   Languages.AddItem('cs', 'Czech');
    100   Languages.AddItem('de', 'German');
    101   Languages.AddItem('en', 'English');
    102   Languages.AddItem('it', 'Italian');
    103   Languages.AddItem('ru', 'Russian');
    104   Languages.AddItem('zh-Hant', 'Traditional Chinese');
    105   Languages.AddItem('zh-Hans', 'Simplified Chinese');
    106 
    107   OKBtn.Caption := Phrases.Lookup('BTN_OK');
    108   CancelBtn.Caption := Phrases.Lookup('BTN_CANCEL');
     84  ButtonOk.Caption := Phrases.Lookup('BTN_OK');
     85  ButtonCancel.Caption := Phrases.Lookup('BTN_CANCEL');
     86  ButtonReset.Caption := Phrases.Lookup('BTN_RESET');
    10987  InitButtons;
    11088end;
    11189
    112 procedure TSettingsDlg.CancelBtnClick(Sender: TObject);
     90procedure TSettingsDlg.ButtonCancelClick(Sender: TObject);
    11391begin
    11492  ModalResult := mrCancel;
     93end;
     94
     95procedure TSettingsDlg.ButtonResetClick(Sender: TObject);
     96begin
     97  ListLanguages.ItemIndex := 0;
     98  ButtonFullscreen.ButtonIndex := 3;
     99  LocalGamma := 100;
     100  ListKeyBindings.ItemIndex := -1;
     101  ListKeyBindingsSelectionChange(nil, False);
     102  LocalKeyBindings.ResetToDefault;
     103  LocalKeyBindings.LoadToStrings(ListKeyBindings.Items);
     104  Repaint;
    115105end;
    116106
     
    124114end;
    125115
     116procedure TSettingsDlg.EditShortCutPrimaryKeyUp(Sender: TObject; var Key: Word;
     117  Shift: TShiftState);
     118begin
     119  if (Sender is TEdit) and Assigned(CurrentKeyBinding) and not (Key in [16..18]) then begin
     120    CurrentKeyBinding.ShortCut := Key or
     121      (scShift * Integer(ssShift in Shift)) or
     122      (scCtrl * Integer(ssCtrl in Shift)) or
     123      (scAlt * Integer(ssAlt in Shift));
     124    EditShortCutPrimary.Text := ShortCutToText(CurrentKeyBinding.ShortCut);
     125    Key := 0;
     126    UpdateShortCutItem;
     127  end;
     128end;
     129
     130procedure TSettingsDlg.EditShortCutSecondaryKeyUp(Sender: TObject;
     131  var Key: Word; Shift: TShiftState);
     132begin
     133  if (Sender is TEdit) and Assigned(CurrentKeyBinding) and not (Key in [16..18]) then begin
     134    CurrentKeyBinding.ShortCut2 := Key or
     135      (scShift * Integer(ssShift in Shift)) or
     136      (scCtrl * Integer(ssCtrl in Shift)) or
     137      (scAlt * Integer(ssAlt in Shift));
     138    EditShortCutSecondary.Text := ShortCutToText(CurrentKeyBinding.ShortCut2);
     139    Key := 0;
     140    UpdateShortCutItem;
     141  end;
     142end;
     143
     144procedure TSettingsDlg.FormClose(Sender: TObject; var CloseAction: TCloseAction
     145  );
     146begin
     147  ListKeyBindings.ItemIndex := -1;
     148end;
     149
    126150procedure TSettingsDlg.ButtonFullscreenClick(Sender: TObject);
    127151begin
     
    131155procedure TSettingsDlg.FormDestroy(Sender: TObject);
    132156begin
    133   FreeAndNil(Languages);
     157  FreeAndNil(LocalKeyBindings);
    134158end;
    135159
    136160procedure TSettingsDlg.FormPaint(Sender: TObject);
    137 var
    138   S: string;
    139161begin
    140162  PaintBackground(self, 3, 3, ClientWidth - 6, ClientHeight - 6);
     
    144166  Frame(Canvas, 2, 2, ClientWidth - 3, ClientHeight - 3,
    145167    MainTexture.ColorBevelLight, MainTexture.ColorBevelShade);
    146   EditFrame(Canvas, List.BoundsRect, MainTexture);
    147   BtnFrame(Canvas, OKBtn.BoundsRect, MainTexture);
    148   BtnFrame(Canvas, CancelBtn.BoundsRect, MainTexture);
     168  EditFrame(Canvas, ListLanguages.BoundsRect, MainTexture);
     169  BtnFrame(Canvas, ButtonOk.BoundsRect, MainTexture);
     170  BtnFrame(Canvas, ButtonCancel.BoundsRect, MainTexture);
    149171
    150172  RFrame(Canvas, ButtonFullscreen.Left - 1, ButtonFullscreen.Top - 1,
     
    152174    MainTexture.ColorBevelLight);
    153175
    154   S := Phrases.Lookup('SETTINGS', 0);
     176  LoweredTextOut(Canvas, -2, MainTexture, ListLanguages.Left,
     177    ListLanguages.Top - 26, SLanguages);
     178  LoweredTextOut(Canvas, -2, MainTexture, ListKeyBindings.Left,
     179    ListKeyBindings.Top - 26, SKeyBindings);
    155180  LoweredTextOut(Canvas, -2, MainTexture, ButtonFullscreen.Left + 32,
    156     ButtonFullscreen.Top - 4, S);
    157 
    158   // Gamma
    159   UnderlinedTitleValue(Canvas, Phrases.Lookup('SETTINGS', 1), IntToStr(LocalGamma) + '%',
     181    ButtonFullscreen.Top - 4, SFullScreen);
     182  UnderlinedTitleValue(Canvas, SGamma, IntToStr(LocalGamma) + '%',
    160183    Up2Btn.Left - 150 - 4, Up2Btn.Top + 2, 150);
     184  LoweredTextOut(Canvas, -2, MainTexture, EditShortCutPrimary.Left,
     185    EditShortCutPrimary.Top - 26, SShortCutPrimary);
     186  LoweredTextOut(Canvas, -2, MainTexture, EditShortCutSecondary.Left,
     187    EditShortCutSecondary.Top - 26, SShortCutSecondary);
    161188end;
    162189
    163190procedure TSettingsDlg.FormShow(Sender: TObject);
    164191begin
    165   Languages.LoadToStrings(List.Items);
    166   List.Font.Color := MainTexture.ColorMark;
     192  ReloadLanguages;
     193  Languages.LoadToStrings(ListLanguages.Items);
     194  ListLanguages.Font.Color := MainTexture.ColorMark;
     195  ListKeyBindings.Font.Color := MainTexture.ColorMark;
    167196  LoadData;
    168 end;
    169 
    170 procedure TSettingsDlg.OKBtnClick(Sender: TObject);
     197  LocalKeyBindings.LoadToStrings(ListKeyBindings.Items);
     198end;
     199
     200procedure TSettingsDlg.ListKeyBindingsSelectionChange(Sender: TObject;
     201  User: boolean);
     202begin
     203  if Assigned(CurrentKeyBinding) then begin
     204    CurrentKeyBinding.ShortCut := TextToShortCut(EditShortCutPrimary.Text);
     205    CurrentKeyBinding.ShortCut2 := TextToShortCut(EditShortCutSecondary.Text);
     206  end;
     207
     208  if ListKeyBindings.ItemIndex >= 0 then
     209    CurrentKeyBinding := LocalKeyBindings[ListKeyBindings.ItemIndex]
     210    else CurrentKeyBinding := nil;
     211
     212  if Assigned(CurrentKeyBinding) then begin
     213    if CurrentKeyBinding.ShortCut <> 0 then
     214      EditShortCutPrimary.Text := ShortCutToText(CurrentKeyBinding.ShortCut)
     215      else EditShortCutPrimary.Text := '';
     216    EditShortCutPrimary.Enabled := True;
     217    if CurrentKeyBinding.ShortCut2 <> 0 then
     218      EditShortCutSecondary.Text := ShortCutToText(CurrentKeyBinding.ShortCut2)
     219      else EditShortCutSecondary.Text := '';
     220    EditShortCutSecondary.Enabled := True;
     221  end else begin
     222    EditShortCutPrimary.Text := '';
     223    EditShortCutPrimary.Enabled := False;
     224    EditShortCutSecondary.Text := '';
     225    EditShortCutSecondary.Enabled := False;
     226  end;
     227end;
     228
     229procedure TSettingsDlg.ButtonOkClick(Sender: TObject);
    171230begin
    172231  SaveData;
     
    182241end;
    183242
     243procedure TSettingsDlg.UpdateShortCutItem;
     244begin
     245  if Assigned(CurrentKeyBinding) then begin
     246    CurrentKeyBinding.ShortCut := TextToShortCut(EditShortCutPrimary.Text);
     247    CurrentKeyBinding.ShortCut2 := TextToShortCut(EditShortCutSecondary.Text);
     248    LocalKeyBindings.LoadToStrings(ListKeyBindings.Items);
     249  end;
     250end;
     251
    184252procedure TSettingsDlg.LoadData;
    185253begin
    186   List.ItemIndex := Languages.Search(LocaleCode);
    187   if (List.ItemIndex = -1) and (Languages.Count > 0) then
    188     List.ItemIndex := 0;
     254  ListLanguages.ItemIndex := Languages.Search(LocaleCode);
     255  if (ListLanguages.ItemIndex = -1) and (Languages.Count > 0) then
     256    ListLanguages.ItemIndex := 0;
    189257  if FullScreen then ButtonFullscreen.ButtonIndex := 3
    190258    else ButtonFullscreen.ButtonIndex := 2;
    191259  LocalGamma := Gamma;
     260  LocalKeyBindings.Assign(KeyBindings);
    192261end;
    193262
     
    197266begin
    198267  NeedRestart := Gamma <> LocalGamma;
    199   LocaleCode := Languages[List.ItemIndex].ShortName;
     268  LocaleCode := Languages[ListLanguages.ItemIndex].ShortName;
    200269  FullScreen := (ButtonFullscreen.ButtonIndex and 1) = 1;
    201270  Gamma := LocalGamma;
    202   if NeedRestart then SimpleMessage(Phrases.Lookup('SETTINGS', 2));
     271  if NeedRestart then SimpleMessage(SRestartMsg);
     272  KeyBindings.Assign(LocalKeyBindings);
    203273end;
    204274
  • trunk/Start.pas

    r381 r385  
    428428    Free;
    429429  end;
     430
     431  KeyBindings.LoadFromRegistry(HKEY_CURRENT_USER, AppRegistryKey + '\KeyBindings');
    430432end;
    431433
     
    450452    Free;
    451453  end;
     454
     455  KeyBindings.SaveToRegistry(HKEY_CURRENT_USER, AppRegistryKey + '\KeyBindings');
    452456end;
    453457
Note: See TracChangeset for help on using the changeset viewer.