Skip to content

Commit 22cf186

Browse files
committed
[ENHANCE] Enhance Project Manager.
- Notepad-plus svn trunk @ 817
1 parent 656c1b0 commit 22cf186

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

PowerEditor/src/Notepad_plus.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,12 +699,20 @@ bool Notepad_plus::saveGUIParams()
699699
bool Notepad_plus::saveProjectPanelsParams()
700700
{
701701
if (_pProjectPanel_1)
702+
{
703+
_pProjectPanel_1->checkIfNeedSave(TEXT("Project Panel 1"));
702704
(NppParameters::getInstance())->setWorkSpaceFilePath(0, _pProjectPanel_1->getWorkSpaceFilePath());
705+
}
703706
if (_pProjectPanel_2)
707+
{
708+
_pProjectPanel_2->checkIfNeedSave(TEXT("Project Panel 2"));
704709
(NppParameters::getInstance())->setWorkSpaceFilePath(1, _pProjectPanel_2->getWorkSpaceFilePath());
710+
}
705711
if (_pProjectPanel_3)
712+
{
713+
_pProjectPanel_3->checkIfNeedSave(TEXT("Project Panel 3"));
706714
(NppParameters::getInstance())->setWorkSpaceFilePath(2, _pProjectPanel_3->getWorkSpaceFilePath());
707-
715+
}
708716
return (NppParameters::getInstance())->writeProjectPanelsSettings();
709717
}
710718

PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,22 @@ BOOL CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPar
125125
return DockingDlgInterface::run_dlgProc(message, wParam, lParam);
126126
}
127127

128+
void ProjectPanel::checkIfNeedSave(const TCHAR *title)
129+
{
130+
if (_isDirty)
131+
{
132+
display();
133+
int res = ::MessageBox(_hSelf, TEXT("The work space was modified. Do you want to save the it?"), title, MB_YESNO | MB_ICONQUESTION);
134+
if (res == IDYES)
135+
{
136+
if (!saveWorkSpace())
137+
::MessageBox(_hSelf, TEXT("Your work space was not saved."), title, MB_OK | MB_ICONERROR);
138+
}
139+
//else if (res == IDNO)
140+
// Don't save so do nothing here
141+
}
142+
}
143+
128144
void ProjectPanel::initMenus()
129145
{
130146
_hWorkSpaceMenu = ::CreatePopupMenu();

PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ class ProjectPanel : public DockingDlgInterface {
6262
const TCHAR * getWorkSpaceFilePath() const {
6363
return _workSpaceFilePath.c_str();
6464
};
65+
bool isDirty() const {
66+
return _isDirty;
67+
};
68+
void checkIfNeedSave(const TCHAR *title);
69+
6570
protected:
6671
TreeView _treeView;
6772
HIMAGELIST _hImaLst;

0 commit comments

Comments
 (0)