mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 16:19:28 +02:00
Options: Key mapping, allow Retry. Issue #0021256
git-svn-id: trunk@35296 -
This commit is contained in:
parent
d95ba53c9e
commit
f37d2be89d
@ -10,7 +10,7 @@ object ShortCutDialog: TShortCutDialog
|
|||||||
ClientHeight = 260
|
ClientHeight = 260
|
||||||
ClientWidth = 545
|
ClientWidth = 545
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
LCLVersion = '0.9.29'
|
LCLVersion = '0.9.31'
|
||||||
object PrimaryGroupBox: TGroupBox
|
object PrimaryGroupBox: TGroupBox
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 93
|
Height = 93
|
||||||
@ -34,10 +34,18 @@ object ShortCutDialog: TShortCutDialog
|
|||||||
object BtnPanel: TButtonPanel
|
object BtnPanel: TButtonPanel
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 36
|
Height = 26
|
||||||
Top = 216
|
Top = 216
|
||||||
Width = 533
|
Width = 533
|
||||||
Align = alTop
|
Align = alTop
|
||||||
|
OKButton.Name = 'OKButton'
|
||||||
|
OKButton.DefaultCaption = True
|
||||||
|
HelpButton.Name = 'HelpButton'
|
||||||
|
HelpButton.DefaultCaption = True
|
||||||
|
CloseButton.Name = 'CloseButton'
|
||||||
|
CloseButton.DefaultCaption = True
|
||||||
|
CancelButton.Name = 'CancelButton'
|
||||||
|
CancelButton.DefaultCaption = True
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
ShowButtons = [pbOK, pbCancel]
|
ShowButtons = [pbOK, pbCancel]
|
||||||
ShowBevel = False
|
ShowBevel = False
|
||||||
|
@ -62,7 +62,7 @@ type
|
|||||||
procedure SetSecondaryShortCut(const AValue: TIDEShortCut);
|
procedure SetSecondaryShortCut(const AValue: TIDEShortCut);
|
||||||
procedure SetShowSecondary(const AValue: boolean);
|
procedure SetShowSecondary(const AValue: boolean);
|
||||||
procedure SetShowSequence(const AValue: boolean);
|
procedure SetShowSequence(const AValue: boolean);
|
||||||
function ResolveConflicts(Key: TIDEShortCut; Scope: TIDECommandScope): boolean;
|
function ResolveConflicts(Key: TIDEShortCut; Scope: TIDECommandScope): TModalResult;
|
||||||
procedure UpdateCaptions;
|
procedure UpdateCaptions;
|
||||||
public
|
public
|
||||||
procedure ClearKeys;
|
procedure ClearKeys;
|
||||||
@ -204,10 +204,15 @@ begin
|
|||||||
// get old relation
|
// get old relation
|
||||||
CurRelation:=KeyCommandRelationList.Relations[RelationIndex];
|
CurRelation:=KeyCommandRelationList.Relations[RelationIndex];
|
||||||
|
|
||||||
if not ResolveConflicts(NewKeyA,CurRelation.Category.Scope) then
|
case ResolveConflicts(NewKeyA,CurRelation.Category.Scope) of
|
||||||
begin
|
mrCancel: begin
|
||||||
debugln('TShortCutDialog.OkButtonClick ResolveConflicts failed for key1');
|
debugln('TShortCutDialog.OkButtonClick ResolveConflicts failed for key1');
|
||||||
exit;
|
exit;
|
||||||
|
end;
|
||||||
|
mrRetry: begin
|
||||||
|
ModalResult:=mrNone;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//debugln('TShortCutDialog.OkButtonClick B ShortcutA=',KeyAndShiftStateToEditorKeyString(NewKeyA),' ShortcutB=',KeyAndShiftStateToEditorKeyString(NewKeyB));
|
//debugln('TShortCutDialog.OkButtonClick B ShortcutA=',KeyAndShiftStateToEditorKeyString(NewKeyA),' ShortcutB=',KeyAndShiftStateToEditorKeyString(NewKeyB));
|
||||||
@ -220,10 +225,16 @@ begin
|
|||||||
NewKeyB.Key2:=VK_UNKNOWN;
|
NewKeyB.Key2:=VK_UNKNOWN;
|
||||||
NewKeyB.Shift2:=[];
|
NewKeyB.Shift2:=[];
|
||||||
end
|
end
|
||||||
else if not ResolveConflicts(NewKeyB,CurRelation.Category.Scope)
|
else
|
||||||
then begin
|
case ResolveConflicts(NewKeyB,CurRelation.Category.Scope) of
|
||||||
debugln('TShortCutDialog.OkButtonClick ResolveConflicts failed for key1');
|
mrCancel: begin
|
||||||
exit;
|
debugln('TShortCutDialog.OkButtonClick ResolveConflicts failed for key1');
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
mrRetry: begin
|
||||||
|
ModalResult:=mrNone;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//debugln('TShortCutDialog.OkButtonClick C ShortcutA=',KeyAndShiftStateToEditorKeyString(NewKeyA),' ShortcutB=',KeyAndShiftStateToEditorKeyString(NewKeyB));
|
//debugln('TShortCutDialog.OkButtonClick C ShortcutA=',KeyAndShiftStateToEditorKeyString(NewKeyA),' ShortcutB=',KeyAndShiftStateToEditorKeyString(NewKeyB));
|
||||||
@ -303,7 +314,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TShortCutDialog.ResolveConflicts(Key: TIDEShortCut;
|
function TShortCutDialog.ResolveConflicts(Key: TIDEShortCut;
|
||||||
Scope: TIDECommandScope): boolean;
|
Scope: TIDECommandScope): TModalResult;
|
||||||
type
|
type
|
||||||
TConflictType = (ctNone,ctConflictKeyA,ctConflictKeyB);
|
TConflictType = (ctNone,ctConflictKeyA,ctConflictKeyB);
|
||||||
var
|
var
|
||||||
@ -314,13 +325,11 @@ var
|
|||||||
j: integer;
|
j: integer;
|
||||||
conflictType: TConflictType;
|
conflictType: TConflictType;
|
||||||
begin
|
begin
|
||||||
|
Result:=mrOK;
|
||||||
// search for conflict
|
// search for conflict
|
||||||
CurRelation:=KeyCommandRelationList.Relations[RelationIndex];
|
CurRelation:=KeyCommandRelationList.Relations[RelationIndex];
|
||||||
if Key.Key1=VK_UNKNOWN then
|
if Key.Key1=VK_UNKNOWN then
|
||||||
begin
|
|
||||||
Result:=true;
|
|
||||||
exit;
|
exit;
|
||||||
end;
|
|
||||||
//Try to find an IDE command that conflicts
|
//Try to find an IDE command that conflicts
|
||||||
for j:=0 to KeyCommandRelationList.RelationCount-1 do begin
|
for j:=0 to KeyCommandRelationList.RelationCount-1 do begin
|
||||||
conflictType:=ctNone;
|
conflictType:=ctNone;
|
||||||
@ -353,21 +362,24 @@ begin
|
|||||||
else
|
else
|
||||||
ConflictName:=ConflictName
|
ConflictName:=ConflictName
|
||||||
+' ('+KeyAndShiftStateToEditorKeyString(ConflictRelation.ShortcutB);
|
+' ('+KeyAndShiftStateToEditorKeyString(ConflictRelation.ShortcutB);
|
||||||
if MessageDlg(lisPEConflictFound,
|
case MessageDlg(lisPEConflictFound,
|
||||||
Format(lisTheKeyIsAlreadyAssignedToRemoveTheOldAssignmentAnd, [
|
Format(lisTheKeyIsAlreadyAssignedToRemoveTheOldAssignmentAnd, [
|
||||||
KeyAndShiftStateToEditorKeyString(Key), #13, ConflictName, #13, #13,
|
KeyAndShiftStateToEditorKeyString(Key), #13, ConflictName, #13, #13,
|
||||||
#13, CurName]), mtConfirmation, [mbYes, mbNo], 0) <> mrYes then
|
#13, CurName]), mtConfirmation, [mbYes, mbNo, mbCancel], 0)
|
||||||
begin
|
of
|
||||||
Result:=false;
|
mrYes: Result:=mrOK;
|
||||||
exit;
|
mrCancel: Result:=mrCancel;
|
||||||
|
else Result:=mrRetry;
|
||||||
end;
|
end;
|
||||||
if (conflictType=ctConflictKeyA) then
|
if Result=mrOK then begin
|
||||||
ConflictRelation.ShortcutA:=ConflictRelation.ShortcutB;
|
if (conflictType=ctConflictKeyA) then
|
||||||
ConflictRelation.ClearShortcutB;
|
ConflictRelation.ShortcutA:=ConflictRelation.ShortcutB;
|
||||||
|
ConflictRelation.ClearShortcutB;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
break;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Result:=true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TShortCutDialog.UpdateCaptions;
|
procedure TShortCutDialog.UpdateCaptions;
|
||||||
|
Loading…
Reference in New Issue
Block a user