mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-10 12:48:17 +02:00
IDE: fixed updating key/command relations, bug #30436
git-svn-id: branches/fixes_1_6@52775 -
This commit is contained in:
parent
63c57240c6
commit
6d5267d15a
@ -502,7 +502,7 @@ type
|
||||
end;
|
||||
PIDEShortCut = ^TIDEShortCut;
|
||||
|
||||
{ TIDECommandCategory
|
||||
{ TIDECommandCategory - list of TKeyCommandRelation
|
||||
TIDECommandCategory is used to divide the commands in handy packets }
|
||||
|
||||
TIDECommandCategory = class(TList)
|
||||
|
@ -614,8 +614,11 @@ var
|
||||
i: integer;
|
||||
KeyCommandRelation: TKeyCommandRelation;
|
||||
begin
|
||||
//debugln(['TExternalUserTools.LoadShortCuts ',KeyCommandRelationList.ExtToolCount,' ',Count]);
|
||||
KeyCommandRelationList.ExtToolCount:=Count;
|
||||
for i:=0 to Count-1 do begin
|
||||
KeyCommandRelation:=KeyCommandRelationList.FindByCommand(ecExtToolFirst+i);
|
||||
//debugln(['TExternalUserTools.LoadShortCuts ',i,'/',Count,' ',KeyCommandRelation.Name]);
|
||||
if KeyCommandRelation<>nil then begin
|
||||
Items[i].Key:=KeyCommandRelation.ShortcutA.Key1;
|
||||
Items[i].Shift:=KeyCommandRelation.ShortcutA.Shift1;
|
||||
@ -632,9 +635,11 @@ var
|
||||
i: integer;
|
||||
KeyCommandRelation: TKeyCommandRelation;
|
||||
begin
|
||||
//debugln(['TExternalUserTools.SaveShortCuts ',KeyCommandRelationList.ExtToolCount,' ',Count]);
|
||||
KeyCommandRelationList.ExtToolCount:=Count;
|
||||
for i:=0 to Count-1 do begin
|
||||
KeyCommandRelation:=KeyCommandRelationList.FindByCommand(ecExtToolFirst+i);
|
||||
//debugln(['TExternalUserTools.SaveShortCuts ',i,'/',Count,' ',KeyCommandRelation.Name]);
|
||||
if KeyCommandRelation<>nil then begin
|
||||
KeyCommandRelation.ShortcutA:=IDEShortCut(Items[i].Key,Items[i].Shift,
|
||||
VK_UNKNOWN,[]);
|
||||
|
@ -206,7 +206,7 @@ type
|
||||
procedure RemoveCommand(ACommand: TIDECommand);
|
||||
public
|
||||
property ExtToolCount: integer read fExtToolCount write SetExtToolCount;// in menu
|
||||
property Relations[Index:integer]:TKeyCommandRelation read GetRelation; default;
|
||||
property Relations[Index:integer]: TKeyCommandRelation read GetRelation; default;
|
||||
property RelationCount:integer read GetRelationCount;
|
||||
end;
|
||||
|
||||
@ -3199,7 +3199,10 @@ var
|
||||
CmdRel: TKeyCommandRelation;
|
||||
begin
|
||||
if NewCount=fExtToolCount then exit;
|
||||
//debugln(['TKeyCommandRelationList.SetExtToolCount NewCount=',NewCount,' fExtToolCount=',fExtToolCount]);
|
||||
ExtToolCat:=FindCategoryByName(CommandCategoryToolMenuName);
|
||||
//for i:=0 to ExtToolCat.Count-1 do
|
||||
// debugln([' ',i,'/',ExtToolCat.Count,' ',TKeyCommandRelation(ExtToolCat[i]).Name]);
|
||||
if NewCount>fExtToolCount then begin
|
||||
// increase available external tool commands
|
||||
while NewCount>fExtToolCount do begin
|
||||
@ -3213,13 +3216,14 @@ begin
|
||||
end;
|
||||
end else begin
|
||||
// decrease available external tool commands
|
||||
// they are always at the end of the Tools menu
|
||||
// Note: the commands are somewhere in the list, not neccesarily at the end
|
||||
i:=ExtToolCat.Count-1;
|
||||
while (i>=0) and (fExtToolCount>NewCount) do begin
|
||||
while (i>=0) do begin
|
||||
if TObject(ExtToolCat[i]) is TKeyCommandRelation then begin
|
||||
ExtToolRelation:=TKeyCommandRelation(ExtToolCat[i]);
|
||||
if (ExtToolRelation.Command>=ecExtToolFirst)
|
||||
and (ExtToolRelation.Command<=ecExtToolLast) then begin
|
||||
cmd:=ExtToolRelation.Command;
|
||||
if (cmd>=ecExtToolFirst) and (cmd<=ecExtToolLast)
|
||||
and (cmd>=ecExtToolFirst+fExtToolCount) then begin
|
||||
fRelations.Remove(ExtToolRelation);
|
||||
fCmdRelCache.Remove(ExtToolRelation);
|
||||
ExtToolCat.Delete(i);
|
||||
|
Loading…
Reference in New Issue
Block a user