From 87a142c5e8f573478e5c887bc9f6c65b968bcfd9 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Wed, 21 Sep 2011 01:05:24 +0000 Subject: [PATCH] [ENHANCE] Enhance Project Manager. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@813 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.cpp | 12 ++++++------ PowerEditor/src/Parameters.h | 12 +++++++++--- .../WinControls/ProjectPanel/ProjectPanel.cpp | 17 +++++++++++++++-- .../src/WinControls/ProjectPanel/ProjectPanel.h | 1 + .../WinControls/ProjectPanel/ProjectPanel_rc.h | 11 ++++++----- .../src/WinControls/ProjectPanel/TreeView.h | 3 +++ 6 files changed, 40 insertions(+), 16 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 84f62a87..b9a1ee6b 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -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; } diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index d14340d8..13b76f36 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -222,13 +222,19 @@ struct DockingManagerData { vector _pluginDockInfo; vector _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; } }; diff --git a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp index 053d30f8..f4ae2aae 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp +++ b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp @@ -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 : 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); diff --git a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.h b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.h index cf566847..e214f22b 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.h +++ b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.h @@ -53,6 +53,7 @@ public: }; bool openWorkSpace(const TCHAR *projectFileName); + void newWorkSpace(); protected: diff --git a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel_rc.h b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel_rc.h index cbc53cbc..c52e3bf4 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel_rc.h +++ b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel_rc.h @@ -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) diff --git a/PowerEditor/src/WinControls/ProjectPanel/TreeView.h b/PowerEditor/src/WinControls/ProjectPanel/TreeView.h index c3556104..7e9287dd 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/TreeView.h +++ b/PowerEditor/src/WinControls/ProjectPanel/TreeView.h @@ -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: