From 77c56b461ff2ab117d16bd0f1f498b1e031ed62f Mon Sep 17 00:00:00 2001 From: mattias Date: Mon, 22 Jan 2007 16:50:11 +0000 Subject: [PATCH] IDE: close project now asks to save git-svn-id: trunk@10492 - --- ide/lazarusidestrconsts.pas | 1 + ide/main.pp | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 61a348a239..20903b38b9 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -155,6 +155,7 @@ resourcestring lisKMSaveAs = 'SaveAs'; lisKMSaveAll = 'SaveAll'; lisDiscardChanges = 'Discard changes'; + lisDoNotCloseTheProject = 'Do not close the project'; lisDoNotCloseTheIDE = 'Do not close the IDE'; lisMenuSaveAs = 'Save As ...'; lisMenuSaveAll = 'Save All'; diff --git a/ide/main.pp b/ide/main.pp index e1dfca36bd..e51c7996bc 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -3091,7 +3091,31 @@ procedure TMainIDE.mnuCloseProjectClicked(Sender: TObject); var DlgResult: TModalResult; begin + // stop debugging/compiling/... + if not DoResetToolStatus(true) then exit; + + // check foreign windows + if not CloseQueryIDEWindows then exit; + + // check project + if SomethingOfProjectIsModified then begin + DlgResult:=QuestionDlg(lisProjectChanged, + Format(lisSaveChangesToProject, [Project1.Title]), mtConfirmation, + [mrYes, lisMenuSave, mrNo, lisDiscardChanges, + mrAbort, lisDoNotCloseTheProject], + 0); + case DlgResult of + mrYes: + if not (DoSaveProject([]) in [mrOk,mrIgnore]) then exit; + mrCancel, mrAbort: + Exit; + end; + end; + + // close DoCloseProject; + + // ask what to do next while Project1=nil do begin DlgResult:=QuestionDlg(lisProjectClosed, Format(lisTheProjectIsClosedThereAreNowThreePossibilitiesHin, [#13]),