mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-05 04:18:31 +02:00
Revert: Refactor menu change code.
This commit is contained in:
parent
edf4f0b416
commit
bf510fbd62
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user