mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-25 12:20:22 +02:00
IDE: disable run speed button if project and file not runnable
git-svn-id: trunk@28051 -
This commit is contained in:
parent
ec803db711
commit
c94957e49b
@ -2060,15 +2060,29 @@ end;
|
||||
procedure TDebugManager.UpdateButtonsAndMenuItems;
|
||||
var
|
||||
DebuggerInvalid: boolean;
|
||||
CanRun: Boolean;
|
||||
SrcEdit: TSourceEditorInterface;
|
||||
AnUnitInfo: TUnitInfo;
|
||||
begin
|
||||
if (MainIDE=nil) or (MainIDE.ToolStatus = itExiting)
|
||||
then exit;
|
||||
|
||||
DebuggerInvalid:=(FDebugger=nil) or (MainIDE.ToolStatus<>itDebugger);
|
||||
MainIDE.GetCurrentUnitInfo(SrcEdit,AnUnitInfo);
|
||||
with MainIDEBar do begin
|
||||
// For 'run' and 'step' bypass 'idle', so we can set the filename later
|
||||
RunSpeedButton.Enabled := DebuggerInvalid
|
||||
or (dcRun in FDebugger.Commands) or (FDebugger.State = dsIdle);
|
||||
CanRun:=false;
|
||||
if Project1<>nil then
|
||||
begin
|
||||
if (AnUnitInfo<>nil) and (AnUnitInfo.RunFileIfActive) then
|
||||
CanRun:=true
|
||||
else if pfRunnable in Project1.Flags then
|
||||
CanRun:=true;
|
||||
debugln(['TDebugManager.UpdateButtonsAndMenuItems ',pfRunnable in Project1.Flags]);
|
||||
end;
|
||||
RunSpeedButton.Enabled := CanRun
|
||||
and (DebuggerInvalid
|
||||
or (dcRun in FDebugger.Commands) or (FDebugger.State = dsIdle));
|
||||
itmRunMenuRun.Enabled := RunSpeedButton.Enabled;
|
||||
PauseSpeedButton.Enabled := (not DebuggerInvalid)
|
||||
and (dcPause in FDebugger.Commands);
|
||||
@ -2100,8 +2114,6 @@ begin
|
||||
// menu view
|
||||
itmViewRegisters.Enabled := (not DebuggerInvalid);
|
||||
itmViewAssembler.Enabled := (not DebuggerInvalid);
|
||||
// TODO: add other debugger menuitems
|
||||
// TODO: implement by actions
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -16087,6 +16087,8 @@ begin
|
||||
MainIDEBar.itmViewToggleFormUnit.Enabled := HasResources;
|
||||
end;
|
||||
MainIDEBar.ToggleFormSpeedBtn.Enabled := MainIDEBar.itmViewToggleFormUnit.Enabled;
|
||||
|
||||
DebugBoss.UpdateButtonsAndMenuItems;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user