IDE: configure external tools: fixed saving shortcuts

git-svn-id: trunk@46428 -
This commit is contained in:
mattias 2014-10-04 12:03:46 +00:00
parent b55a4754f9
commit 6a49b9864d
2 changed files with 16 additions and 21 deletions

View File

@ -3049,7 +3049,7 @@ var
i: integer;
ExtToolCat: TIDECommandCategory;
ExtToolRelation: TKeyCommandRelation;
ToolName: string;
ToolLocalizedName: string;
cmd: word;
CmdRel: TKeyCommandRelation;
begin
@ -3058,11 +3058,11 @@ begin
if NewCount>fExtToolCount then begin
// increase available external tool commands
while NewCount>fExtToolCount do begin
ToolName:=Format(srkmecExtTool,[fExtToolCount]);
ToolLocalizedName:=Format(srkmecExtTool,[fExtToolCount]);
cmd:=ecExtToolFirst+fExtToolCount;
CmdRel:=TKeyCommandRelation.Create(ExtToolCat,
Format('External tool %d',[fExtToolCount]), // keep name untranslated
ToolName, cmd);
ToolLocalizedName, cmd);
FRelations.Add(CmdRel);
inc(fExtToolCount);
end;

View File

@ -4395,6 +4395,7 @@ begin
SaveEnvironment(true);
// save shortcuts to editor options
ExternalUserTools.SaveShortCuts(EditorOpts.KeyMap);
EditorOpts.Save;
UpdateExternalUserToolsInMenu;
end;
end;
@ -7576,12 +7577,15 @@ end;
procedure TMainIDE.UpdateExternalUserToolsInMenu;
var
ToolCount: integer;
procedure CreateToolMenuItems;
var
Section: TIDEMenuSection;
begin
Section:=itmCustomTools;
Section: TIDEMenuSection;
CurMenuItem: TIDEMenuItem;
i: Integer;
ExtTool: TExternalUserTool;
begin
ToolCount:=ExternalUserTools.Count;
Section:=itmCustomTools;
Section.BeginUpdate;
try
// add enough menuitems
while Section.Count-1<ToolCount do
RegisterIDEMenuCommand(Section.GetPath,
@ -7589,14 +7593,8 @@ var
// delete unneeded menuitems
while Section.Count-1>ToolCount do
Section[Section.Count-1].Free;
end;
procedure SetToolMenuItems;
var
CurMenuItem: TIDEMenuItem;
i: Integer;
ExtTool: TExternalUserTool;
begin
// set caption and command
for i:=0 to ToolCount-1 do begin
CurMenuItem:=itmCustomTools[i+1]; // Note: the first menu item is the "Configure"
ExtTool:=ExternalUserTools[i];
@ -7606,12 +7604,9 @@ var
EditorOpts.KeyMap.FindIDECommand(ecExtToolFirst+i);
CurMenuItem.OnClick:=@mnuExternalUserToolClick;
end;
finally
Section.EndUpdate;
end;
begin
ToolCount:=ExternalUserTools.Count;
CreateToolMenuItems;
SetToolMenuItems;
end;
function TMainIDE.PrepareForCompile: TModalResult;