Changeset 386


Ignore:
Timestamp:
Apr 27, 2021, 6:48:47 PM (3 years ago)
Author:
chronos
Message:
  • Fixed: Remove new key binding from other actions. So one shortcut can control one action.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/UKeyBindings.pas

    r385 r386  
    3737    procedure Assign(Source: TKeyBindings);
    3838    procedure ResetToDefault;
     39    procedure RemoveShortCut(ShortCut: TShortCut);
    3940  end;
    4041
     
    271272  for I := 0 to Count - 1 do
    272273    Items[I].SetDefault;
     274end;
     275
     276procedure TKeyBindings.RemoveShortCut(ShortCut: TShortCut);
     277var
     278  I: Integer;
     279begin
     280  for I := 0 to Count - 1 do begin
     281    if Items[I].ShortCut = ShortCut then Items[I].ShortCut := 0;
     282    if Items[I].ShortCut2 = ShortCut then Items[I].ShortCut2 := 0;
     283  end;
    273284end;
    274285
  • trunk/Settings.pas

    r385 r386  
    244244begin
    245245  if Assigned(CurrentKeyBinding) then begin
     246    if CurrentKeyBinding.ShortCut > 0 then
     247      LocalKeyBindings.RemoveShortCut(CurrentKeyBinding.ShortCut);
     248    if CurrentKeyBinding.ShortCut2 > 0 then
     249      LocalKeyBindings.RemoveShortCut(CurrentKeyBinding.ShortCut2);
    246250    CurrentKeyBinding.ShortCut := TextToShortCut(EditShortCutPrimary.Text);
    247251    CurrentKeyBinding.ShortCut2 := TextToShortCut(EditShortCutSecondary.Text);
Note: See TracChangeset for help on using the changeset viewer.