Revert: Refactor menu change code.

This commit is contained in:
Margers 2025-03-16 17:21:47 +00:00
parent edf4f0b416
commit bf510fbd62
2 changed files with 19 additions and 27 deletions

View File

@ -850,31 +850,6 @@ begin
IDEUseTabsPattern:={(Editor^.FileName='') or }MatchesMaskList(NameAndExtOf(Editor^.FileName),TabsPattern);
end;
{replace menu entry one with other; bFirst=true switch to aCommand1 }
procedure ChangeMenu(MenuBar:PAdvancedMenuBar; bFirst:Boolean;
aCommand1: sw_word; Const aName1: String; aCommand2: sw_word; Const aName2: String);
var MenuItem : PMenuItem;
begin
MenuItem:=PAdvancedMenuBar(MenuBar)^.GetMenuItem(aCommand1);
if not assigned(MenuItem) then
MenuItem:=PAdvancedMenuBar(MenuBar)^.GetMenuItem(aCommand2);
if assigned(MenuItem) then
begin
If assigned(MenuItem^.Name) then
DisposeStr(MenuItem^.Name);
if bFirst then
begin
MenuItem^.Name:=NewStr(aName1);
MenuItem^.command:=aCommand1;
end
else
begin
MenuItem^.Name:=NewStr(aName2);
MenuItem^.command:=aCommand2;
end;
end;
end;
constructor TIDEApp.Init;
var R: TRect;
begin

View File

@ -295,8 +295,25 @@ end;
procedure TIDEApp.UpdateRunMenu(DebuggeeRunning : boolean);
var MenuItem : PMenuItem;
begin
ChangeMenu(PAdvancedMenuBar(MenuBar),DebuggeeRunning,
cmContinue,menu_run_continue,cmRun,menu_run_run);
MenuItem:=PAdvancedMenuBar(MenuBar)^.GetMenuItem(cmRun);
if not assigned(MenuItem) then
MenuItem:=PAdvancedMenuBar(MenuBar)^.GetMenuItem(cmContinue);
if assigned(MenuItem) then
begin
If assigned(MenuItem^.Name) then
DisposeStr(MenuItem^.Name);
if DebuggeeRunning then
begin
MenuItem^.Name:=NewStr(menu_run_continue);
MenuItem^.command:=cmContinue;
end
else
begin
MenuItem^.Name:=NewStr(menu_run_run);
MenuItem^.command:=cmRun;
end;
end;
MenuItem:=PAdvancedMenuBar(MenuBar)^.GetMenuItem(cmResetDebugger);
if assigned(MenuItem) then
MenuItem^.Disabled:=not DebuggeeRunning;