[ENHANCE] Enhance Project Manager.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@813 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2011-09-21 01:05:24 +00:00
parent e107b8a547
commit 87a142c5e8
6 changed files with 40 additions and 16 deletions

View File

@ -786,9 +786,9 @@ void Notepad_plus::saveDockingParams()
if (floatContArray[floatCont] == 0)
{
RECT *pRc = nppGUI._dockingData.getFloatingRCFrom(floatCont);
if (pRc)
vFloatingWindowInfo.push_back(FloatingWindowInfo(floatCont, pRc->left, pRc->top, pRc->right, pRc->bottom));
RECT rc;
if (nppGUI._dockingData.getFloatingRCFrom(floatCont, rc))
vFloatingWindowInfo.push_back(FloatingWindowInfo(floatCont, rc.left, rc.top, rc.right, rc.bottom));
floatContArray[floatCont] = 1;
}
@ -3850,9 +3850,9 @@ bool Notepad_plus::getIntegralDockingData(tTbData & dockData, int & iCont, bool
if (dockData.iPrevCont != -1)
{
int cont = (pddi._currContainer < DOCKCONT_MAX ? pddi._prevContainer : pddi._currContainer);
RECT *pRc = dockingData.getFloatingRCFrom(cont);
if (pRc)
dockData.rcFloat = *pRc;
RECT rc;
if (dockingData.getFloatingRCFrom(cont, rc))
dockData.rcFloat = rc;
}
return true;
}

View File

@ -222,13 +222,19 @@ struct DockingManagerData {
vector<PluginDlgDockingInfo> _pluginDockInfo;
vector<ContainerTabInfo> _containerTabInfo;
RECT * getFloatingRCFrom(int floatCont) {
bool getFloatingRCFrom(int floatCont, RECT & rc) {
for (size_t i = 0 ; i < _flaotingWindowInfo.size() ; i++)
{
if (_flaotingWindowInfo[i]._cont == floatCont)
return &(_flaotingWindowInfo[i]._pos);
{
rc.left = _flaotingWindowInfo[i]._pos.left;
rc.top = _flaotingWindowInfo[i]._pos.top;
rc.right = _flaotingWindowInfo[i]._pos.right;
rc.bottom = _flaotingWindowInfo[i]._pos.bottom;
return true;
}
return NULL;
}
return false;
}
};

View File

@ -128,6 +128,7 @@ void ProjectPanel::initMenus()
{
_hWorkSpaceMenu = ::CreatePopupMenu();
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_NEWPROJECT, TEXT("Add New Project"));
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_NEWWS, TEXT("New WorkSpace"));
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_OPENWS, TEXT("Open WorkSpace"));
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_RELOADWS, TEXT("Reload WorkSpace"));
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_SAVEWS, TEXT("Save"));
@ -253,11 +254,19 @@ bool ProjectPanel::openWorkSpace(const TCHAR *projectFileName)
buildTreeFrom(childNode, projectItem);
}
setWorkSpaceDirty(false);
_treeView.expand(rootItem);
delete pXmlDocProject;
return loadOkay;
}
void ProjectPanel::newWorkSpace()
{
_treeView.addItem(TEXT("Work Space"), TVI_ROOT, INDEX_CLEAN_ROOT);
setWorkSpaceDirty(false);
_workSpaceFilePath = TEXT("");
}
bool ProjectPanel::writeWorkSpace(TCHAR *projectFileName)
{
//write <NotepadPlus>: use the default file name if new file name is not given
@ -597,10 +606,14 @@ void ProjectPanel::popupMenuCmd(int cmdID)
}
break;
case IDM_PROJECT_NEWWS :
_treeView.removeAllItems();
newWorkSpace();
break;
case IDM_PROJECT_RENAME :
TreeView_EditLabel(_treeView.getHSelf(), hTreeItem);
break;
break;
case IDM_PROJECT_NEWFOLDER :
{
HTREEITEM addedItem = _treeView.addItem(TEXT("Folder Name"), hTreeItem, INDEX_CLOSED_NODE);

View File

@ -53,6 +53,7 @@ public:
};
bool openWorkSpace(const TCHAR *projectFileName);
void newWorkSpace();
protected:

View File

@ -29,11 +29,12 @@
#define IDD_PROJECTPANEL_MENUWS (IDD_PROJECTPANEL + 20)
#define IDM_PROJECT_NEWPROJECT (IDD_PROJECTPANEL_MENUWS + 1)
#define IDM_PROJECT_OPENWS (IDD_PROJECTPANEL_MENUWS + 2)
#define IDM_PROJECT_RELOADWS (IDD_PROJECTPANEL_MENUWS + 3)
#define IDM_PROJECT_SAVEWS (IDD_PROJECTPANEL_MENUWS + 4)
#define IDM_PROJECT_SAVEASWS (IDD_PROJECTPANEL_MENUWS + 5)
#define IDM_PROJECT_SAVEACOPYASWS (IDD_PROJECTPANEL_MENUWS + 6)
#define IDM_PROJECT_NEWWS (IDD_PROJECTPANEL_MENUWS + 2)
#define IDM_PROJECT_OPENWS (IDD_PROJECTPANEL_MENUWS + 3)
#define IDM_PROJECT_RELOADWS (IDD_PROJECTPANEL_MENUWS + 4)
#define IDM_PROJECT_SAVEWS (IDD_PROJECTPANEL_MENUWS + 5)
#define IDM_PROJECT_SAVEASWS (IDD_PROJECTPANEL_MENUWS + 6)
#define IDM_PROJECT_SAVEACOPYASWS (IDD_PROJECTPANEL_MENUWS + 7)
#define IDD_PROJECTPANEL_CTRL (IDD_PROJECTPANEL + 30)
#define ID_PROJECTTREEVIEW (IDD_PROJECTPANEL_CTRL + 1)

View File

@ -44,6 +44,9 @@ public:
HTREEITEM getNextSibling(HTREEITEM hItem) const {
return TreeView_GetNextSibling(_hSelf, hItem);
};
void expand(HTREEITEM hItem) const {
TreeView_Expand(_hSelf, hItem, TVE_EXPAND);
};
void setItemImage(HTREEITEM hTreeItem, int iImage, int iSelectedImage);
protected: