[ENHANCE] Enhance Project Manager.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@810 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
0fd460401a
commit
647748824a
@ -160,7 +160,6 @@ Notepad_plus::~Notepad_plus()
|
|||||||
|
|
||||||
if (_pProjectPanel)
|
if (_pProjectPanel)
|
||||||
{
|
{
|
||||||
_pProjectPanel->destroy();
|
|
||||||
delete _pProjectPanel;
|
delete _pProjectPanel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,36 +33,38 @@ BOOL CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPar
|
|||||||
{
|
{
|
||||||
case WM_INITDIALOG :
|
case WM_INITDIALOG :
|
||||||
{
|
{
|
||||||
// Create toolbar menu
|
ProjectPanel::initMenus();
|
||||||
int style = WS_CHILD | WS_VISIBLE | CCS_ADJUSTABLE | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT;
|
|
||||||
_hToolbarMenu = CreateWindowEx(0,TOOLBARCLASSNAME,NULL, style,
|
|
||||||
0,0,0,0,_hSelf,(HMENU)0, _hInst, NULL);
|
|
||||||
TBBUTTON tbButtons[2];
|
|
||||||
|
|
||||||
static TCHAR *projectMenuStr = TEXT("Project");
|
// Create toolbar menu
|
||||||
tbButtons[0].idCommand = IDB_PROJECT_BTN;
|
int style = WS_CHILD | WS_VISIBLE | CCS_ADJUSTABLE | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT;
|
||||||
tbButtons[0].iBitmap = I_IMAGENONE;
|
_hToolbarMenu = CreateWindowEx(0,TOOLBARCLASSNAME,NULL, style,
|
||||||
tbButtons[0].fsState = TBSTATE_ENABLED;
|
0,0,0,0,_hSelf,(HMENU)0, _hInst, NULL);
|
||||||
tbButtons[0].fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE;
|
TBBUTTON tbButtons[2];
|
||||||
tbButtons[0].iString = (INT_PTR)projectMenuStr;
|
|
||||||
|
|
||||||
static TCHAR *editMenuStr = TEXT("Edit");
|
static TCHAR *projectMenuStr = TEXT("WorkSpace");
|
||||||
tbButtons[1].idCommand = IDB_EDIT_BTN;
|
tbButtons[0].idCommand = IDB_PROJECT_BTN;
|
||||||
tbButtons[1].iBitmap = I_IMAGENONE;
|
tbButtons[0].iBitmap = I_IMAGENONE;
|
||||||
tbButtons[1].fsState = TBSTATE_ENABLED;
|
tbButtons[0].fsState = TBSTATE_ENABLED;
|
||||||
tbButtons[1].fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE;
|
tbButtons[0].fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE;
|
||||||
tbButtons[1].iString = (INT_PTR)editMenuStr;
|
tbButtons[0].iString = (INT_PTR)projectMenuStr;
|
||||||
|
|
||||||
SendMessage(_hToolbarMenu, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
|
static TCHAR *editMenuStr = TEXT("Edit");
|
||||||
SendMessage(_hToolbarMenu, TB_ADDBUTTONS, (WPARAM)sizeof(tbButtons) / sizeof(TBBUTTON), (LPARAM)&tbButtons);
|
tbButtons[1].idCommand = IDB_EDIT_BTN;
|
||||||
SendMessage(_hToolbarMenu, TB_AUTOSIZE, 0, 0);
|
tbButtons[1].iBitmap = I_IMAGENONE;
|
||||||
ShowWindow(_hToolbarMenu, SW_SHOW);
|
tbButtons[1].fsState = TBSTATE_ENABLED;
|
||||||
|
tbButtons[1].fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE;
|
||||||
|
tbButtons[1].iString = (INT_PTR)editMenuStr;
|
||||||
|
|
||||||
|
SendMessage(_hToolbarMenu, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
|
||||||
|
SendMessage(_hToolbarMenu, TB_ADDBUTTONS, (WPARAM)sizeof(tbButtons) / sizeof(TBBUTTON), (LPARAM)&tbButtons);
|
||||||
|
SendMessage(_hToolbarMenu, TB_AUTOSIZE, 0, 0);
|
||||||
|
ShowWindow(_hToolbarMenu, SW_SHOW);
|
||||||
|
|
||||||
_treeView.init(_hInst, _hSelf, ID_PROJECTTREEVIEW);
|
_treeView.init(_hInst, _hSelf, ID_PROJECTTREEVIEW);
|
||||||
|
|
||||||
_treeView.initImageList(IDI_PROJECT_ROOT, IDI_PROJECT_FOLDEROPEN, IDI_PROJECT_FOLDERCLOSE, IDI_PROJECT_FILE, IDI_PROJECT_FILEINVALID);
|
_treeView.initImageList(IDI_PROJECT_ROOT, IDI_PROJECT_FOLDEROPEN, IDI_PROJECT_FOLDERCLOSE, IDI_PROJECT_FILE, IDI_PROJECT_FILEINVALID);
|
||||||
_treeView.display();
|
_treeView.display();
|
||||||
openProject(TEXT("D:\\source\\notepad++\\trunk\\PowerEditor\\src\\WinControls\\ProjectPanel\\demo.xml"));
|
openWorkSpace(TEXT("D:\\source\\notepad++\\trunk\\PowerEditor\\src\\WinControls\\ProjectPanel\\demo.xml"));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +85,7 @@ BOOL CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPar
|
|||||||
|
|
||||||
HWND hwnd = _treeView.getHSelf();
|
HWND hwnd = _treeView.getHSelf();
|
||||||
if (hwnd)
|
if (hwnd)
|
||||||
::MoveWindow(hwnd, 0, toolbarMenuRect.bottom + 2, width, height - toolbarMenuRect.bottom - 2, TRUE);
|
::MoveWindow(hwnd, 0, toolbarMenuRect.bottom + 2, width, height - toolbarMenuRect.bottom - 2, TRUE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,6 +102,8 @@ BOOL CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPar
|
|||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
{
|
{
|
||||||
_treeView.destroy();
|
_treeView.destroy();
|
||||||
|
destroyMenus();
|
||||||
|
::DestroyWindow(_hToolbarMenu);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,15 +113,15 @@ BOOL CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPar
|
|||||||
return DockingDlgInterface::run_dlgProc(message, wParam, lParam);
|
return DockingDlgInterface::run_dlgProc(message, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectPanel::init(HINSTANCE hInst, HWND hPere)
|
void ProjectPanel::initMenus()
|
||||||
{
|
{
|
||||||
DockingDlgInterface::init(hInst, hPere);
|
|
||||||
|
|
||||||
_hProjectMenu = ::CreatePopupMenu();
|
_hProjectMenu = ::CreatePopupMenu();
|
||||||
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_NEWPROJ, TEXT("New Project"));
|
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_NEWPROJECT, TEXT("Add New Project"));
|
||||||
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_OPENPROJ, TEXT("Open Project File"));
|
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_OPENWS, TEXT("Open WorkSpace"));
|
||||||
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_SAVEPROJ, TEXT("Save"));
|
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_RELOADWS, TEXT("Reload WorkSpace"));
|
||||||
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_SAVEASPROJ, TEXT("Save As..."));
|
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_SAVEWS, TEXT("Save"));
|
||||||
|
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_SAVEASWS, TEXT("Save As..."));
|
||||||
|
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_SAVEACOPYASWS, TEXT("Save a Copy As..."));
|
||||||
|
|
||||||
_hRootMenu = ::CreatePopupMenu();
|
_hRootMenu = ::CreatePopupMenu();
|
||||||
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_PROJECT_RENAME, TEXT("Rename"));
|
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_PROJECT_RENAME, TEXT("Rename"));
|
||||||
@ -136,7 +140,15 @@ void ProjectPanel::init(HINSTANCE hInst, HWND hPere)
|
|||||||
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_PROJECT_DELETEFILE, TEXT("Remove"));
|
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_PROJECT_DELETEFILE, TEXT("Remove"));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProjectPanel::openProject(TCHAR *projectFileName)
|
void ProjectPanel::destroyMenus()
|
||||||
|
{
|
||||||
|
::DestroyMenu(_hProjectMenu);
|
||||||
|
::DestroyMenu(_hRootMenu);
|
||||||
|
::DestroyMenu(_hFolderMenu);
|
||||||
|
::DestroyMenu(_hFileMenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProjectPanel::openWorkSpace(const TCHAR *projectFileName)
|
||||||
{
|
{
|
||||||
TiXmlDocument *pXmlDocProject = new TiXmlDocument(projectFileName);
|
TiXmlDocument *pXmlDocProject = new TiXmlDocument(projectFileName);
|
||||||
bool loadOkay = pXmlDocProject->LoadFile();
|
bool loadOkay = pXmlDocProject->LoadFile();
|
||||||
@ -147,17 +159,78 @@ bool ProjectPanel::openProject(TCHAR *projectFileName)
|
|||||||
if (!root)
|
if (!root)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
root = root->FirstChild(TEXT("Project"));
|
|
||||||
if (!root)
|
TiXmlNode *childNode = root->FirstChildElement(TEXT("Project"));
|
||||||
|
if (!childNode)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
HTREEITEM rootItem = _treeView.addItem((root->ToElement())->Attribute(TEXT("name")), TVI_ROOT, INDEX_PROJECT_ROOT);
|
for ( ; childNode ; childNode = childNode->NextSibling(TEXT("Project")))
|
||||||
buildTreeFrom(root, rootItem);
|
{
|
||||||
|
HTREEITEM rootItem = _treeView.addItem((childNode->ToElement())->Attribute(TEXT("name")), TVI_ROOT, INDEX_PROJECT_ROOT);
|
||||||
|
buildTreeFrom(childNode, rootItem);
|
||||||
|
}
|
||||||
delete pXmlDocProject;
|
delete pXmlDocProject;
|
||||||
|
|
||||||
return loadOkay;
|
return loadOkay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ProjectPanel::writeWorkSpace(TCHAR *projectFileName)
|
||||||
|
{
|
||||||
|
//write <NotepadPlus>: use the default file name if new file name is not given
|
||||||
|
TiXmlDocument projDoc(projectFileName?projectFileName:_workSpaceFilePath.c_str());
|
||||||
|
TiXmlNode *root = projDoc.InsertEndChild(TiXmlElement(TEXT("NotepadPlus")));
|
||||||
|
|
||||||
|
TCHAR textBuffer[MAX_PATH];
|
||||||
|
TVITEM tvItem;
|
||||||
|
tvItem.mask = TVIF_TEXT;
|
||||||
|
tvItem.pszText = textBuffer;
|
||||||
|
tvItem.cchTextMax = MAX_PATH;
|
||||||
|
|
||||||
|
//for each project, write <Project>
|
||||||
|
for (HTREEITEM tvProj = _treeView.getRoot();
|
||||||
|
tvProj != NULL;
|
||||||
|
tvProj = _treeView.getNextSibling(tvProj))
|
||||||
|
{
|
||||||
|
tvItem.hItem = tvProj;
|
||||||
|
SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem);
|
||||||
|
//printStr(tvItem.pszText);
|
||||||
|
|
||||||
|
TiXmlNode *projRoot = root->InsertEndChild(TiXmlElement(TEXT("Project")));
|
||||||
|
projRoot->ToElement()->SetAttribute(TEXT("name"), tvItem.pszText);
|
||||||
|
buildProjectXml(projRoot, tvProj);
|
||||||
|
}
|
||||||
|
projDoc.SaveFile();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectPanel::buildProjectXml(TiXmlNode *node, HTREEITEM hItem)
|
||||||
|
{
|
||||||
|
TCHAR textBuffer[MAX_PATH];
|
||||||
|
TVITEM tvItem;
|
||||||
|
tvItem.mask = TVIF_TEXT | TVIF_PARAM;
|
||||||
|
tvItem.pszText = textBuffer;
|
||||||
|
tvItem.cchTextMax = MAX_PATH;
|
||||||
|
|
||||||
|
for (HTREEITEM hItemNode = _treeView.getChildFrom(hItem);
|
||||||
|
hItemNode != NULL;
|
||||||
|
hItemNode = _treeView.getNextSibling(hItemNode))
|
||||||
|
{
|
||||||
|
tvItem.hItem = hItemNode;
|
||||||
|
SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem);
|
||||||
|
if (tvItem.lParam != NULL)
|
||||||
|
{
|
||||||
|
generic_string *fn = (generic_string *)tvItem.lParam;
|
||||||
|
TiXmlNode *fileLeaf = node->InsertEndChild(TiXmlElement(TEXT("File")));
|
||||||
|
fileLeaf->ToElement()->SetAttribute(TEXT("name"), fn->c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TiXmlNode *folderNode = node->InsertEndChild(TiXmlElement(TEXT("Folder")));
|
||||||
|
folderNode->ToElement()->SetAttribute(TEXT("name"), tvItem.pszText);
|
||||||
|
buildProjectXml(folderNode, hItemNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool ProjectPanel::buildTreeFrom(TiXmlNode *projectRoot, HTREEITEM hParentItem)
|
bool ProjectPanel::buildTreeFrom(TiXmlNode *projectRoot, HTREEITEM hParentItem)
|
||||||
{
|
{
|
||||||
for (TiXmlNode *childNode = projectRoot->FirstChildElement();
|
for (TiXmlNode *childNode = projectRoot->FirstChildElement();
|
||||||
@ -180,8 +253,8 @@ bool ProjectPanel::buildTreeFrom(TiXmlNode *projectRoot, HTREEITEM hParentItem)
|
|||||||
{
|
{
|
||||||
const TCHAR *strValue = (childNode->ToElement())->Attribute(TEXT("name"));
|
const TCHAR *strValue = (childNode->ToElement())->Attribute(TEXT("name"));
|
||||||
TCHAR *strValueLabel = ::PathFindFileName(strValue);
|
TCHAR *strValueLabel = ::PathFindFileName(strValue);
|
||||||
int iImage = ::PathFileExists(strValue)?INDEX_LEAF:INDEX_LEAF_INVALID;
|
int iImage = ::PathFileExists(strValue)?INDEX_LEAF:INDEX_LEAF_INVALID;
|
||||||
_treeView.addItem(strValueLabel, hParentItem, iImage, strValue);
|
_treeView.addItem(strValueLabel, hParentItem, iImage, strValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -310,7 +383,6 @@ NodeType ProjectPanel::getNodeType(HTREEITEM hItem)
|
|||||||
tvItem.mask = TVIF_IMAGE | TVIF_PARAM;
|
tvItem.mask = TVIF_IMAGE | TVIF_PARAM;
|
||||||
SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem);
|
SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem);
|
||||||
|
|
||||||
|
|
||||||
// Root
|
// Root
|
||||||
if (tvItem.iImage == INDEX_PROJECT_ROOT)
|
if (tvItem.iImage == INDEX_PROJECT_ROOT)
|
||||||
{
|
{
|
||||||
@ -379,6 +451,9 @@ void ProjectPanel::popupMenuCmd(int cmdID)
|
|||||||
|
|
||||||
switch (cmdID)
|
switch (cmdID)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Toolbar menu buttons
|
||||||
|
//
|
||||||
case IDB_PROJECT_BTN:
|
case IDB_PROJECT_BTN:
|
||||||
{
|
{
|
||||||
POINT p = getMenuDisplyPoint(0);
|
POINT p = getMenuDisplyPoint(0);
|
||||||
@ -388,7 +463,7 @@ void ProjectPanel::popupMenuCmd(int cmdID)
|
|||||||
|
|
||||||
case IDB_EDIT_BTN:
|
case IDB_EDIT_BTN:
|
||||||
{
|
{
|
||||||
POINT p = getMenuDisplyPoint(0);
|
POINT p = getMenuDisplyPoint(1);
|
||||||
HMENU hMenu = NULL;
|
HMENU hMenu = NULL;
|
||||||
NodeType nodeType = getNodeType(hTreeItem);
|
NodeType nodeType = getNodeType(hTreeItem);
|
||||||
if (nodeType == nodeType_root)
|
if (nodeType == nodeType_root)
|
||||||
@ -401,6 +476,16 @@ void ProjectPanel::popupMenuCmd(int cmdID)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Toolbar menu commands
|
||||||
|
//
|
||||||
|
case IDM_PROJECT_NEWPROJECT :
|
||||||
|
{
|
||||||
|
HTREEITEM addedItem = _treeView.addItem(TEXT("Project Name"), TVI_ROOT, INDEX_PROJECT_ROOT);
|
||||||
|
TreeView_EditLabel(_treeView.getHSelf(), addedItem);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case IDM_PROJECT_RENAME :
|
case IDM_PROJECT_RENAME :
|
||||||
TreeView_EditLabel(_treeView.getHSelf(), hTreeItem);
|
TreeView_EditLabel(_treeView.getHSelf(), hTreeItem);
|
||||||
break;
|
break;
|
||||||
@ -420,6 +505,56 @@ void ProjectPanel::popupMenuCmd(int cmdID)
|
|||||||
_treeView.expandItemGUI(hTreeItem);
|
_treeView.expandItemGUI(hTreeItem);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IDM_PROJECT_OPENWS:
|
||||||
|
{
|
||||||
|
FileDialog fDlg(_hSelf, ::GetModuleHandle(NULL));
|
||||||
|
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
|
||||||
|
if (TCHAR *fn = fDlg.doOpenSingleFileDlg())
|
||||||
|
{
|
||||||
|
_treeView.removeAllItems();
|
||||||
|
openWorkSpace(fn);
|
||||||
|
_workSpaceFilePath = fn;
|
||||||
|
_isDirty = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IDM_PROJECT_RELOADWS:
|
||||||
|
{
|
||||||
|
if (::PathFileExists(_workSpaceFilePath.c_str()))
|
||||||
|
{
|
||||||
|
_treeView.removeAllItems();
|
||||||
|
openWorkSpace(_workSpaceFilePath.c_str());
|
||||||
|
_isDirty = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IDM_PROJECT_SAVEWS:
|
||||||
|
writeWorkSpace();
|
||||||
|
_isDirty = false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IDM_PROJECT_SAVEACOPYASWS:
|
||||||
|
case IDM_PROJECT_SAVEASWS:
|
||||||
|
{
|
||||||
|
FileDialog fDlg(_hSelf, ::GetModuleHandle(NULL));
|
||||||
|
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
|
||||||
|
|
||||||
|
if (TCHAR *fn = fDlg.doSaveDlg())
|
||||||
|
{
|
||||||
|
writeWorkSpace(fn);
|
||||||
|
if (cmdID == IDM_PROJECT_SAVEASWS)
|
||||||
|
{
|
||||||
|
_workSpaceFilePath = fn;
|
||||||
|
_isDirty = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case IDM_PROJECT_DELETEFOLDER :
|
case IDM_PROJECT_DELETEFOLDER :
|
||||||
{
|
{
|
||||||
HTREEITEM parent = TreeView_GetParent(_treeView.getHSelf(), hTreeItem);
|
HTREEITEM parent = TreeView_GetParent(_treeView.getHSelf(), hTreeItem);
|
||||||
|
@ -39,14 +39,10 @@ public:
|
|||||||
ProjectPanel(): DockingDlgInterface(IDD_PROJECTPANEL),\
|
ProjectPanel(): DockingDlgInterface(IDD_PROJECTPANEL),\
|
||||||
_hToolbarMenu(NULL), _hProjectMenu(NULL), _hRootMenu(NULL), _hFolderMenu(NULL), _hFileMenu(NULL){};
|
_hToolbarMenu(NULL), _hProjectMenu(NULL), _hRootMenu(NULL), _hFolderMenu(NULL), _hFileMenu(NULL){};
|
||||||
|
|
||||||
void init(HINSTANCE hInst, HWND hPere);
|
|
||||||
|
|
||||||
void destroy() {
|
void init(HINSTANCE hInst, HWND hPere) {
|
||||||
::DestroyMenu(_hProjectMenu);
|
DockingDlgInterface::init(hInst, hPere);
|
||||||
::DestroyMenu(_hRootMenu);
|
}
|
||||||
::DestroyMenu(_hFolderMenu);
|
|
||||||
::DestroyMenu(_hFileMenu);
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual void display(bool toShow = true) const {
|
virtual void display(bool toShow = true) const {
|
||||||
DockingDlgInterface::display(toShow);
|
DockingDlgInterface::display(toShow);
|
||||||
@ -56,20 +52,28 @@ public:
|
|||||||
_hParent = parent2set;
|
_hParent = parent2set;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool openProject(TCHAR *projectFileName);
|
void destroyMenus();
|
||||||
|
void initMenus();
|
||||||
|
|
||||||
|
bool openWorkSpace(const TCHAR *projectFileName);
|
||||||
void addFiles(HTREEITEM hTreeItem);
|
void addFiles(HTREEITEM hTreeItem);
|
||||||
|
|
||||||
|
bool writeWorkSpace(TCHAR *projectFileName = NULL);
|
||||||
|
void buildProjectXml(TiXmlNode *root, HTREEITEM hItem);
|
||||||
|
NodeType getNodeType(HTREEITEM hItem);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TreeView _treeView;
|
TreeView _treeView;
|
||||||
HWND _hToolbarMenu;
|
HWND _hToolbarMenu;
|
||||||
HMENU _hProjectMenu, _hRootMenu, _hFolderMenu, _hFileMenu;
|
HMENU _hProjectMenu, _hRootMenu, _hFolderMenu, _hFileMenu;
|
||||||
|
generic_string _workSpaceFilePath;
|
||||||
|
bool _isDirty;
|
||||||
|
|
||||||
void popupMenuCmd(int cmdID);
|
void popupMenuCmd(int cmdID);
|
||||||
POINT getMenuDisplyPoint(int iButton);
|
POINT getMenuDisplyPoint(int iButton);
|
||||||
virtual BOOL CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
virtual BOOL CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
bool buildTreeFrom(TiXmlNode *projectRoot, HTREEITEM hParentItem);
|
bool buildTreeFrom(TiXmlNode *projectRoot, HTREEITEM hParentItem);
|
||||||
void notified(LPNMHDR notification);
|
void notified(LPNMHDR notification);
|
||||||
void showContextMenu(int x, int y);
|
void showContextMenu(int x, int y);
|
||||||
NodeType getNodeType(HTREEITEM hItem);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif // PROJECTPANEL_H
|
#endif // PROJECTPANEL_H
|
||||||
|
@ -27,12 +27,13 @@
|
|||||||
#define IDM_PROJECT_DELETEFOLDER (IDD_PROJECTPANEL_MENU + 4)
|
#define IDM_PROJECT_DELETEFOLDER (IDD_PROJECTPANEL_MENU + 4)
|
||||||
#define IDM_PROJECT_DELETEFILE (IDD_PROJECTPANEL_MENU + 5)
|
#define IDM_PROJECT_DELETEFILE (IDD_PROJECTPANEL_MENU + 5)
|
||||||
|
|
||||||
#define IDD_PROJECTPANEL_MENUPROJ (IDD_PROJECTPANEL + 20)
|
#define IDD_PROJECTPANEL_MENUWS (IDD_PROJECTPANEL + 20)
|
||||||
#define IDM_PROJECT_NEWPROJ (IDD_PROJECTPANEL_MENUPROJ + 1)
|
#define IDM_PROJECT_NEWPROJECT (IDD_PROJECTPANEL_MENUWS + 1)
|
||||||
#define IDM_PROJECT_OPENPROJ (IDD_PROJECTPANEL_MENUPROJ + 2)
|
#define IDM_PROJECT_OPENWS (IDD_PROJECTPANEL_MENUWS + 2)
|
||||||
#define IDM_PROJECT_SAVEPROJ (IDD_PROJECTPANEL_MENUPROJ + 3)
|
#define IDM_PROJECT_RELOADWS (IDD_PROJECTPANEL_MENUWS + 3)
|
||||||
#define IDM_PROJECT_SAVEASPROJ (IDD_PROJECTPANEL_MENUPROJ + 4)
|
#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 IDD_PROJECTPANEL_CTRL (IDD_PROJECTPANEL + 30)
|
#define IDD_PROJECTPANEL_CTRL (IDD_PROJECTPANEL + 30)
|
||||||
#define ID_PROJECTTREEVIEW (IDD_PROJECTPANEL_CTRL + 1)
|
#define ID_PROJECTTREEVIEW (IDD_PROJECTPANEL_CTRL + 1)
|
||||||
|
@ -136,6 +136,17 @@ void TreeView::removeItem(HTREEITEM hTreeItem)
|
|||||||
TreeView_DeleteItem(_hSelf, hTreeItem);
|
TreeView_DeleteItem(_hSelf, hTreeItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TreeView::removeAllItems()
|
||||||
|
{
|
||||||
|
for (HTREEITEM tvProj = getRoot();
|
||||||
|
tvProj != NULL;
|
||||||
|
tvProj = getNextSibling(tvProj))
|
||||||
|
{
|
||||||
|
cleanSubEntries(tvProj);
|
||||||
|
}
|
||||||
|
TreeView_DeleteAllItems(_hSelf);
|
||||||
|
}
|
||||||
|
|
||||||
void TreeView::cleanSubEntries(HTREEITEM hTreeItem)
|
void TreeView::cleanSubEntries(HTREEITEM hTreeItem)
|
||||||
{
|
{
|
||||||
for (HTREEITEM hItem = getChildFrom(hTreeItem); hItem != NULL; hItem = getNextSibling(hItem))
|
for (HTREEITEM hItem = getChildFrom(hTreeItem); hItem != NULL; hItem = getNextSibling(hItem))
|
||||||
|
@ -36,16 +36,20 @@ public:
|
|||||||
virtual void destroy();
|
virtual void destroy();
|
||||||
HTREEITEM addItem(const TCHAR *itemName, HTREEITEM hParentItem, int iImage, const TCHAR *filePath = NULL);
|
HTREEITEM addItem(const TCHAR *itemName, HTREEITEM hParentItem, int iImage, const TCHAR *filePath = NULL);
|
||||||
void removeItem(HTREEITEM hTreeItem);
|
void removeItem(HTREEITEM hTreeItem);
|
||||||
|
void removeAllItems();
|
||||||
void cleanSubEntries(HTREEITEM hTreeItem);
|
void cleanSubEntries(HTREEITEM hTreeItem);
|
||||||
HTREEITEM getChildFrom(HTREEITEM hTreeItem) {
|
HTREEITEM getChildFrom(HTREEITEM hTreeItem) const {
|
||||||
return TreeView_GetChild(_hSelf, hTreeItem);
|
return TreeView_GetChild(_hSelf, hTreeItem);
|
||||||
};
|
};
|
||||||
HTREEITEM getNextSibling(HTREEITEM hTreeItem){
|
HTREEITEM getSelection() const {
|
||||||
return TreeView_GetNextSibling(_hSelf ,hTreeItem);
|
|
||||||
};
|
|
||||||
HTREEITEM getSelection() {
|
|
||||||
return TreeView_GetSelection(_hSelf);
|
return TreeView_GetSelection(_hSelf);
|
||||||
};
|
};
|
||||||
|
HTREEITEM getRoot() const {
|
||||||
|
return TreeView_GetRoot(_hSelf);
|
||||||
|
};
|
||||||
|
HTREEITEM getNextSibling(HTREEITEM hItem) const {
|
||||||
|
return TreeView_GetNextSibling(_hSelf, hItem);
|
||||||
|
};
|
||||||
void expandItemGUI(HTREEITEM hTreeItem);
|
void expandItemGUI(HTREEITEM hTreeItem);
|
||||||
void collapsItemGUI(HTREEITEM hTreeItem);
|
void collapsItemGUI(HTREEITEM hTreeItem);
|
||||||
BOOL initImageList(int project_root_id, int open_node_id, int closed_node_id, int leaf_id, int ivalid_leaf_id);
|
BOOL initImageList(int project_root_id, int open_node_id, int closed_node_id, int leaf_id, int ivalid_leaf_id);
|
||||||
|
@ -26,4 +26,6 @@
|
|||||||
<Folder name="Scintilla">
|
<Folder name="Scintilla">
|
||||||
</Folder>
|
</Folder>
|
||||||
</Project>
|
</Project>
|
||||||
|
<Project name="Win32 GUP" >
|
||||||
|
</Project>
|
||||||
</NotepadPlus>
|
</NotepadPlus>
|
@ -1611,11 +1611,11 @@
|
|||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\src\resource.h"
|
RelativePath="..\src\WinControls\Preference\resource.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\src\WinControls\Preference\resource.h"
|
RelativePath="..\src\resource.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
|
Loading…
Reference in New Issue
Block a user