IDE: Simplify and reuse function GetCommand in DebugManager.

git-svn-id: trunk@62727 -
This commit is contained in:
juha 2020-03-09 21:28:53 +00:00
parent c98da657b9
commit 4fe3c9d4be
2 changed files with 8 additions and 35 deletions

View File

@ -2020,24 +2020,14 @@ begin
SrcEditMenuInspect.Tag := Ord(ddtInspect);
end;
function GetCommand(ACommand: word): TIDECommand;
begin
Result:=IDECommandList.FindIDECommand(ACommand);
if Result<>nil then
RegisterIDEButtonCommand(Result);
end;
procedure TDebugManager.SetupMainBarShortCuts;
function GetCmdAndBtn(ACommand: word; out ToolButton: TIDEButtonCommand): TIDECommand;
begin
Result:=IDECommandList.FindIDECommand(ACommand);
if Result<>nil then
ToolButton := RegisterIDEButtonCommand(Result)
else
ToolButton := nil;
end;
function GetCommand(ACommand: word): TIDECommand;
var
ToolButton: TIDEButtonCommand;
begin
Result:=GetCmdAndBtn(ACommand, ToolButton);
end;
begin
with MainIDEBar do
begin
@ -2064,23 +2054,6 @@ begin
end;
procedure TDebugManager.SetupSourceMenuShortCuts;
function GetCmdAndBtn(ACommand: word; out ToolButton: TIDEButtonCommand): TIDECommand;
begin
Result:=IDECommandList.FindIDECommand(ACommand);
if Result<>nil then
ToolButton := RegisterIDEButtonCommand(Result)
else
ToolButton := nil;
end;
function GetCommand(ACommand: word): TIDECommand;
var
ToolButton: TIDEButtonCommand;
begin
Result:=GetCmdAndBtn(ACommand, ToolButton);
end;
begin
SrcEditMenuToggleBreakpoint.Command:=GetCommand(ecToggleBreakPoint);
SrcEditMenuRunToCursor.Command:=GetCommand(ecRunToCursor);

View File

@ -72,7 +72,7 @@ uses
// IDE
LazConf, LazarusIDEStrConsts, Project, BuildManager, EnvironmentOpts,
EditorOptions, CompilerOptions, SourceEditor, SourceSynEditor, FindInFilesDlg,
DesktopManager, Splash, MainBar, MainIntf, Designer, Debugger, RunParamsOpts;
Splash, MainBar, MainIntf, Designer, Debugger, RunParamsOpts;
type
TResetToolFlag = (