[ENHANCE] Enhance Project Manager.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@817 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2011-09-26 00:43:06 +00:00
parent cfa7850d01
commit 79399432c0
3 changed files with 30 additions and 1 deletions

View File

@ -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();
}

View File

@ -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();

View File

@ -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;