mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 15:30:52 +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;
|
end;
|
||||||
PIDEShortCut = ^TIDEShortCut;
|
PIDEShortCut = ^TIDEShortCut;
|
||||||
|
|
||||||
{ TIDECommandCategory
|
{ TIDECommandCategory - list of TKeyCommandRelation
|
||||||
TIDECommandCategory is used to divide the commands in handy packets }
|
TIDECommandCategory is used to divide the commands in handy packets }
|
||||||
|
|
||||||
TIDECommandCategory = class(TList)
|
TIDECommandCategory = class(TList)
|
||||||
|
@ -614,8 +614,11 @@ var
|
|||||||
i: integer;
|
i: integer;
|
||||||
KeyCommandRelation: TKeyCommandRelation;
|
KeyCommandRelation: TKeyCommandRelation;
|
||||||
begin
|
begin
|
||||||
|
//debugln(['TExternalUserTools.LoadShortCuts ',KeyCommandRelationList.ExtToolCount,' ',Count]);
|
||||||
|
KeyCommandRelationList.ExtToolCount:=Count;
|
||||||
for i:=0 to Count-1 do begin
|
for i:=0 to Count-1 do begin
|
||||||
KeyCommandRelation:=KeyCommandRelationList.FindByCommand(ecExtToolFirst+i);
|
KeyCommandRelation:=KeyCommandRelationList.FindByCommand(ecExtToolFirst+i);
|
||||||
|
//debugln(['TExternalUserTools.LoadShortCuts ',i,'/',Count,' ',KeyCommandRelation.Name]);
|
||||||
if KeyCommandRelation<>nil then begin
|
if KeyCommandRelation<>nil then begin
|
||||||
Items[i].Key:=KeyCommandRelation.ShortcutA.Key1;
|
Items[i].Key:=KeyCommandRelation.ShortcutA.Key1;
|
||||||
Items[i].Shift:=KeyCommandRelation.ShortcutA.Shift1;
|
Items[i].Shift:=KeyCommandRelation.ShortcutA.Shift1;
|
||||||
@ -632,9 +635,11 @@ var
|
|||||||
i: integer;
|
i: integer;
|
||||||
KeyCommandRelation: TKeyCommandRelation;
|
KeyCommandRelation: TKeyCommandRelation;
|
||||||
begin
|
begin
|
||||||
|
//debugln(['TExternalUserTools.SaveShortCuts ',KeyCommandRelationList.ExtToolCount,' ',Count]);
|
||||||
KeyCommandRelationList.ExtToolCount:=Count;
|
KeyCommandRelationList.ExtToolCount:=Count;
|
||||||
for i:=0 to Count-1 do begin
|
for i:=0 to Count-1 do begin
|
||||||
KeyCommandRelation:=KeyCommandRelationList.FindByCommand(ecExtToolFirst+i);
|
KeyCommandRelation:=KeyCommandRelationList.FindByCommand(ecExtToolFirst+i);
|
||||||
|
//debugln(['TExternalUserTools.SaveShortCuts ',i,'/',Count,' ',KeyCommandRelation.Name]);
|
||||||
if KeyCommandRelation<>nil then begin
|
if KeyCommandRelation<>nil then begin
|
||||||
KeyCommandRelation.ShortcutA:=IDEShortCut(Items[i].Key,Items[i].Shift,
|
KeyCommandRelation.ShortcutA:=IDEShortCut(Items[i].Key,Items[i].Shift,
|
||||||
VK_UNKNOWN,[]);
|
VK_UNKNOWN,[]);
|
||||||
|
@ -206,7 +206,7 @@ type
|
|||||||
procedure RemoveCommand(ACommand: TIDECommand);
|
procedure RemoveCommand(ACommand: TIDECommand);
|
||||||
public
|
public
|
||||||
property ExtToolCount: integer read fExtToolCount write SetExtToolCount;// in menu
|
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;
|
property RelationCount:integer read GetRelationCount;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3199,7 +3199,10 @@ var
|
|||||||
CmdRel: TKeyCommandRelation;
|
CmdRel: TKeyCommandRelation;
|
||||||
begin
|
begin
|
||||||
if NewCount=fExtToolCount then exit;
|
if NewCount=fExtToolCount then exit;
|
||||||
|
//debugln(['TKeyCommandRelationList.SetExtToolCount NewCount=',NewCount,' fExtToolCount=',fExtToolCount]);
|
||||||
ExtToolCat:=FindCategoryByName(CommandCategoryToolMenuName);
|
ExtToolCat:=FindCategoryByName(CommandCategoryToolMenuName);
|
||||||
|
//for i:=0 to ExtToolCat.Count-1 do
|
||||||
|
// debugln([' ',i,'/',ExtToolCat.Count,' ',TKeyCommandRelation(ExtToolCat[i]).Name]);
|
||||||
if NewCount>fExtToolCount then begin
|
if NewCount>fExtToolCount then begin
|
||||||
// increase available external tool commands
|
// increase available external tool commands
|
||||||
while NewCount>fExtToolCount do begin
|
while NewCount>fExtToolCount do begin
|
||||||
@ -3213,13 +3216,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
// decrease available external tool commands
|
// 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;
|
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
|
if TObject(ExtToolCat[i]) is TKeyCommandRelation then begin
|
||||||
ExtToolRelation:=TKeyCommandRelation(ExtToolCat[i]);
|
ExtToolRelation:=TKeyCommandRelation(ExtToolCat[i]);
|
||||||
if (ExtToolRelation.Command>=ecExtToolFirst)
|
cmd:=ExtToolRelation.Command;
|
||||||
and (ExtToolRelation.Command<=ecExtToolLast) then begin
|
if (cmd>=ecExtToolFirst) and (cmd<=ecExtToolLast)
|
||||||
|
and (cmd>=ecExtToolFirst+fExtToolCount) then begin
|
||||||
fRelations.Remove(ExtToolRelation);
|
fRelations.Remove(ExtToolRelation);
|
||||||
fCmdRelCache.Remove(ExtToolRelation);
|
fCmdRelCache.Remove(ExtToolRelation);
|
||||||
ExtToolCat.Delete(i);
|
ExtToolCat.Delete(i);
|
||||||
|
Loading…
Reference in New Issue
Block a user