diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 35c16690..a684bca7 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -699,12 +699,20 @@ bool Notepad_plus::saveGUIParams() bool Notepad_plus::saveProjectPanelsParams() { if (_pProjectPanel_1) + { + _pProjectPanel_1->checkIfNeedSave(TEXT("Project Panel 1")); (NppParameters::getInstance())->setWorkSpaceFilePath(0, _pProjectPanel_1->getWorkSpaceFilePath()); + } if (_pProjectPanel_2) + { + _pProjectPanel_2->checkIfNeedSave(TEXT("Project Panel 2")); (NppParameters::getInstance())->setWorkSpaceFilePath(1, _pProjectPanel_2->getWorkSpaceFilePath()); + } if (_pProjectPanel_3) + { + _pProjectPanel_3->checkIfNeedSave(TEXT("Project Panel 3")); (NppParameters::getInstance())->setWorkSpaceFilePath(2, _pProjectPanel_3->getWorkSpaceFilePath()); - + } return (NppParameters::getInstance())->writeProjectPanelsSettings(); } diff --git a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp index 7e3b84dc..e9e3ad14 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp +++ b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp @@ -125,6 +125,22 @@ BOOL CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPar return DockingDlgInterface::run_dlgProc(message, wParam, lParam); } +void ProjectPanel::checkIfNeedSave(const TCHAR *title) +{ + if (_isDirty) + { + display(); + int res = ::MessageBox(_hSelf, TEXT("The work space was modified. Do you want to save the it?"), title, MB_YESNO | MB_ICONQUESTION); + if (res == IDYES) + { + if (!saveWorkSpace()) + ::MessageBox(_hSelf, TEXT("Your work space was not saved."), title, MB_OK | MB_ICONERROR); + } + //else if (res == IDNO) + // Don't save so do nothing here + } +} + void ProjectPanel::initMenus() { _hWorkSpaceMenu = ::CreatePopupMenu(); diff --git a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.h b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.h index 9835d963..ac7b9e0f 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.h +++ b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.h @@ -62,6 +62,11 @@ public: const TCHAR * getWorkSpaceFilePath() const { return _workSpaceFilePath.c_str(); }; + bool isDirty() const { + return _isDirty; + }; + void checkIfNeedSave(const TCHAR *title); + protected: TreeView _treeView; HIMAGELIST _hImaLst;