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

View File

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