ide: if we answer yes on "Stop the debugging" when we are closing IDE then close IDE after we stop (fixes last part of bug #0007562)

git-svn-id: trunk@18899 -
This commit is contained in:
paul 2009-03-05 10:35:46 +00:00
parent 6912d02459
commit ad5a5e1c39
3 changed files with 34 additions and 22 deletions

View File

@ -533,6 +533,7 @@ type
FRenamingComponents: TFPList; // list of TComponents currently renaming FRenamingComponents: TFPList; // list of TComponents currently renaming
FOIHelpProvider: TAbstractIDEHTMLProvider; FOIHelpProvider: TAbstractIDEHTMLProvider;
FWaitForClose: Boolean;
procedure RenameInheritedMethods(AnUnitInfo: TUnitInfo; List: TStrings); procedure RenameInheritedMethods(AnUnitInfo: TUnitInfo; List: TStrings);
function OIHelpProvider: TAbstractIDEHTMLProvider; function OIHelpProvider: TAbstractIDEHTMLProvider;
@ -680,7 +681,7 @@ type
procedure CreateOftenUsedForms; override; procedure CreateOftenUsedForms; override;
procedure CreateSearchResultWindow; procedure CreateSearchResultWindow;
procedure UpdateDefaultPascalFileExtensions; procedure UpdateDefaultPascalFileExtensions;
function DoResetToolStatus(Interactive: boolean): boolean; override; function DoResetToolStatus(AFlags: TResetToolFlags): boolean; override;
// files/units // files/units
function DoNewFile(NewFileDescriptor: TProjectFileDescriptor; function DoNewFile(NewFileDescriptor: TProjectFileDescriptor;
@ -1104,6 +1105,7 @@ begin
inherited Create(TheOwner); inherited Create(TheOwner);
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.Create INHERITED');{$ENDIF} {$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.Create INHERITED');{$ENDIF}
FWaitForClose := False;
FDockingManager:=TLazDockingManager.Create(Self); FDockingManager:=TLazDockingManager.Create(Self);
SetupDialogs; SetupDialogs;
@ -1538,11 +1540,11 @@ procedure TMainIDE.MainIDEFormCloseQuery(Sender: TObject;
var var
MsgResult: integer; MsgResult: integer;
begin begin
CanClose:=false; CanClose := False;
FCheckingFilesOnDisk:=true; FCheckingFilesOnDisk := True;
try try
// stop debugging/compiling/... // stop debugging/compiling/...
if (ToolStatus = itExiting) or not DoResetToolStatus(True) then exit; if (ToolStatus = itExiting) or not DoResetToolStatus([rfInteractive, rfCloseOnDone]) then exit;
// check foreign windows // check foreign windows
if not CloseQueryIDEWindows then exit; if not CloseQueryIDEWindows then exit;
@ -3176,27 +3178,31 @@ end;
procedure TMainIDE.SetToolStatus(const AValue: TIDEToolStatus); procedure TMainIDE.SetToolStatus(const AValue: TIDEToolStatus);
begin begin
inherited SetToolStatus(AValue); inherited SetToolStatus(AValue);
if DebugBoss<>nil then if DebugBoss <> nil then
DebugBoss.UpdateButtonsAndMenuItems; DebugBoss.UpdateButtonsAndMenuItems;
if FWaitForClose and (ToolStatus = itNone) then
begin
FWaitForClose := False;
MainIDEBar.Close;
end;
end; end;
function TMainIDE.DoResetToolStatus(Interactive: boolean): boolean; function TMainIDE.DoResetToolStatus(AFlags: TResetToolFlags): boolean;
begin begin
Result:=false; Result := False;
case ToolStatus of case ToolStatus of
itDebugger:
itDebugger: begin
begin if (rfInteractive in AFlags)
if Interactive and (QuestionDlg(lisStopDebugging,
and (QuestionDlg(lisStopDebugging, lisStopTheDebugging, mtConfirmation,
lisStopTheDebugging, mtConfirmation, [mrYes, lisMenuStop, mrCancel, lisContinue], 0) <> mrYes)
[mrYes, lisMenuStop, mrCancel, lisContinue], 0)<>mrYes) then exit;
then exit; if (DebugBoss.DoStopProject = mrOK) and (ToolStatus = itDebugger) and (rfCloseOnDone in AFlags) then
DebugBoss.DoStopProject; FWaitForClose := True;
end; end;
end; end;
Result:=ToolStatus=itNone; Result := ToolStatus = itNone;
end; end;
procedure TMainIDE.Notification(AComponent: TComponent; Operation: TOperation); procedure TMainIDE.Notification(AComponent: TComponent; Operation: TOperation);
@ -3430,7 +3436,7 @@ var
ARecentProject: String; ARecentProject: String;
begin begin
// stop debugging/compiling/... // stop debugging/compiling/...
if not DoResetToolStatus(true) then exit; if not DoResetToolStatus([rfInteractive]) then exit;
// check foreign windows // check foreign windows
if not CloseQueryIDEWindows then exit; if not CloseQueryIDEWindows then exit;

View File

@ -72,6 +72,12 @@ uses
MainBar, MainIntf; MainBar, MainIntf;
type type
TResetToolFlag = (
rfInteractive,
rfCloseOnDone
);
TResetToolFlags = set of TResetToolFlag;
{ TMainIDEBase } { TMainIDEBase }
TMainIDEBase = class(TMainIDEInterface) TMainIDEBase = class(TMainIDEInterface)
@ -120,7 +126,7 @@ type
public public
property ToolStatus: TIDEToolStatus read FToolStatus write SetToolStatus; property ToolStatus: TIDEToolStatus read FToolStatus write SetToolStatus;
function DoResetToolStatus(Interactive: boolean): boolean; virtual; abstract; function DoResetToolStatus(AFlags: TResetToolFlags): boolean; virtual; abstract;
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
procedure StartIDE; virtual; abstract; procedure StartIDE; virtual; abstract;

View File

@ -3517,7 +3517,7 @@ var
BuildIDEFlags: TBuildLazarusFlags; BuildIDEFlags: TBuildLazarusFlags;
Msg: string; Msg: string;
begin begin
if not MainIDE.DoResetToolStatus(true) then exit(mrCancel); if not MainIDE.DoResetToolStatus([rfInteractive]) then exit(mrCancel);
PackageGraph.BeginUpdate(true); PackageGraph.BeginUpdate(true);
PkgList:=nil; PkgList:=nil;