[ENHANCE] Enhance Project Manager.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@820 f5eea248-9336-0410-98b8-ebc06183d4e3remotes/trunk
parent
b040f8ccef
commit
49eb552f71
|
@ -47,7 +47,7 @@ BOOL CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPar
|
||||||
ProjectPanel::initMenus();
|
ProjectPanel::initMenus();
|
||||||
|
|
||||||
// Create toolbar menu
|
// Create toolbar menu
|
||||||
int style = WS_CHILD | WS_VISIBLE | CCS_ADJUSTABLE | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT;
|
int style = WS_CHILD | WS_VISIBLE | CCS_ADJUSTABLE | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT | TBSTYLE_LIST;
|
||||||
_hToolbarMenu = CreateWindowEx(0,TOOLBARCLASSNAME,NULL, style,
|
_hToolbarMenu = CreateWindowEx(0,TOOLBARCLASSNAME,NULL, style,
|
||||||
0,0,0,0,_hSelf,(HMENU)0, _hInst, NULL);
|
0,0,0,0,_hSelf,(HMENU)0, _hInst, NULL);
|
||||||
TBBUTTON tbButtons[2];
|
TBBUTTON tbButtons[2];
|
||||||
|
@ -144,13 +144,14 @@ void ProjectPanel::checkIfNeedSave(const TCHAR *title)
|
||||||
void ProjectPanel::initMenus()
|
void ProjectPanel::initMenus()
|
||||||
{
|
{
|
||||||
_hWorkSpaceMenu = ::CreatePopupMenu();
|
_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_NEWWS, TEXT("New WorkSpace"));
|
||||||
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_OPENWS, TEXT("Open 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_RELOADWS, TEXT("Reload WorkSpace"));
|
||||||
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_SAVEWS, TEXT("Save"));
|
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_SAVEWS, TEXT("Save"));
|
||||||
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_SAVEASWS, TEXT("Save As..."));
|
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_SAVEASWS, TEXT("Save As..."));
|
||||||
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_SAVEACOPYASWS, TEXT("Save a Copy As..."));
|
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_SAVEACOPYASWS, TEXT("Save a Copy As..."));
|
||||||
|
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, (UINT)-1, 0);
|
||||||
|
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_NEWPROJECT, TEXT("Add New Project"));
|
||||||
|
|
||||||
_hProjectMenu = ::CreatePopupMenu();
|
_hProjectMenu = ::CreatePopupMenu();
|
||||||
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_RENAME, TEXT("Rename"));
|
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_RENAME, TEXT("Rename"));
|
||||||
|
@ -167,6 +168,7 @@ void ProjectPanel::initMenus()
|
||||||
_hFileMenu = ::CreatePopupMenu();
|
_hFileMenu = ::CreatePopupMenu();
|
||||||
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_PROJECT_RENAME, TEXT("Rename"));
|
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_PROJECT_RENAME, TEXT("Rename"));
|
||||||
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_PROJECT_DELETEFILE, TEXT("Remove"));
|
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_PROJECT_DELETEFILE, TEXT("Remove"));
|
||||||
|
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_PROJECT_MODIFYFILEPATH, TEXT("Modify File Path"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -373,8 +375,6 @@ generic_string ProjectPanel::getRelativePath(const generic_string & filePath, co
|
||||||
if (pos_found == generic_string::npos)
|
if (pos_found == generic_string::npos)
|
||||||
return filePath;
|
return filePath;
|
||||||
const TCHAR *relativeFile = filePath.c_str() + lstrlen(wsfn) + 1;
|
const TCHAR *relativeFile = filePath.c_str() + lstrlen(wsfn) + 1;
|
||||||
|
|
||||||
//printStr(relativeFile);
|
|
||||||
return relativeFile;
|
return relativeFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -700,6 +700,7 @@ void ProjectPanel::popupMenuCmd(int cmdID)
|
||||||
case IDM_PROJECT_RENAME :
|
case IDM_PROJECT_RENAME :
|
||||||
TreeView_EditLabel(_treeView.getHSelf(), hTreeItem);
|
TreeView_EditLabel(_treeView.getHSelf(), hTreeItem);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_PROJECT_NEWFOLDER :
|
case IDM_PROJECT_NEWFOLDER :
|
||||||
{
|
{
|
||||||
HTREEITEM addedItem = _treeView.addItem(TEXT("Folder Name"), hTreeItem, INDEX_CLOSED_NODE);
|
HTREEITEM addedItem = _treeView.addItem(TEXT("Folder Name"), hTreeItem, INDEX_CLOSED_NODE);
|
||||||
|
@ -826,6 +827,40 @@ void ProjectPanel::popupMenuCmd(int cmdID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IDM_PROJECT_MODIFYFILEPATH :
|
||||||
|
{
|
||||||
|
FileRelocalizerDlg fileRelocalizerDlg;
|
||||||
|
fileRelocalizerDlg.init(_hInst, _hParent);
|
||||||
|
|
||||||
|
TCHAR textBuffer[MAX_PATH];
|
||||||
|
TVITEM tvItem;
|
||||||
|
tvItem.hItem = hTreeItem;
|
||||||
|
tvItem.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
|
||||||
|
tvItem.pszText = textBuffer;
|
||||||
|
tvItem.cchTextMax = MAX_PATH;
|
||||||
|
|
||||||
|
SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem);
|
||||||
|
if (!tvItem.lParam)
|
||||||
|
return;
|
||||||
|
generic_string * fn = (generic_string *)tvItem.lParam;
|
||||||
|
|
||||||
|
if (fileRelocalizerDlg.doDialog(fn->c_str()) == 0)
|
||||||
|
{
|
||||||
|
generic_string newValue = fileRelocalizerDlg.getFullFilePath();
|
||||||
|
if (*fn == newValue)
|
||||||
|
return;
|
||||||
|
|
||||||
|
*fn = newValue;
|
||||||
|
TCHAR *strValueLabel = ::PathFindFileName(fn->c_str());
|
||||||
|
lstrcpy(textBuffer, strValueLabel);
|
||||||
|
int iImage = ::PathFileExists(fn->c_str())?INDEX_LEAF:INDEX_LEAF_INVALID;
|
||||||
|
tvItem.iImage = tvItem.iSelectedImage = iImage;
|
||||||
|
SendMessage(_treeView.getHSelf(), TVM_SETITEM, 0,(LPARAM)&tvItem);
|
||||||
|
setWorkSpaceDirty(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -864,3 +899,56 @@ void ProjectPanel::addFiles(HTREEITEM hTreeItem)
|
||||||
setWorkSpaceDirty(true);
|
setWorkSpaceDirty(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL CALLBACK FileRelocalizerDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
||||||
|
{
|
||||||
|
switch (Message)
|
||||||
|
{
|
||||||
|
case WM_INITDIALOG :
|
||||||
|
{
|
||||||
|
goToCenter();
|
||||||
|
::SetDlgItemText(_hSelf, IDC_EDIT_FILEFULLPATHNAME, _fullFilePath.c_str());
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_COMMAND :
|
||||||
|
{
|
||||||
|
switch (wParam)
|
||||||
|
{
|
||||||
|
case IDOK :
|
||||||
|
{
|
||||||
|
TCHAR textBuf[MAX_PATH];
|
||||||
|
::GetDlgItemText(_hSelf, IDC_EDIT_FILEFULLPATHNAME, textBuf, MAX_PATH);
|
||||||
|
_fullFilePath = textBuf;
|
||||||
|
::EndDialog(_hSelf, 0);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
case IDCANCEL :
|
||||||
|
::EndDialog(_hSelf, -1);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default :
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int FileRelocalizerDlg::doDialog(const TCHAR *fn, bool isRTL)
|
||||||
|
{
|
||||||
|
_fullFilePath = fn;
|
||||||
|
|
||||||
|
if (isRTL)
|
||||||
|
{
|
||||||
|
DLGTEMPLATE *pMyDlgTemplate = NULL;
|
||||||
|
HGLOBAL hMyDlgTemplate = makeRTLResource(IDD_FILERELOCALIZER_DIALOG, &pMyDlgTemplate);
|
||||||
|
int result = ::DialogBoxIndirectParam(_hInst, pMyDlgTemplate, _hParent, (DLGPROC)dlgProc, (LPARAM)this);
|
||||||
|
::GlobalFree(hMyDlgTemplate);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return ::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_FILERELOCALIZER_DIALOG), _hParent, (DLGPROC)dlgProc, (LPARAM)this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,4 +92,30 @@ protected:
|
||||||
void showContextMenu(int x, int y);
|
void showContextMenu(int x, int y);
|
||||||
generic_string getAbsoluteFilePath(const TCHAR * relativePath);
|
generic_string getAbsoluteFilePath(const TCHAR * relativePath);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class FileRelocalizerDlg : public StaticDialog
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
FileRelocalizerDlg() : StaticDialog() {};
|
||||||
|
void init(HINSTANCE hInst, HWND parent){
|
||||||
|
Window::init(hInst, parent);
|
||||||
|
};
|
||||||
|
|
||||||
|
int doDialog(const TCHAR *fn, bool isRTL = false);
|
||||||
|
|
||||||
|
virtual void destroy() {
|
||||||
|
};
|
||||||
|
|
||||||
|
generic_string getFullFilePath() {
|
||||||
|
return _fullFilePath;
|
||||||
|
};
|
||||||
|
|
||||||
|
protected :
|
||||||
|
virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
|
private :
|
||||||
|
generic_string _fullFilePath;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
#endif // PROJECTPANEL_H
|
#endif // PROJECTPANEL_H
|
||||||
|
|
|
@ -28,3 +28,14 @@ FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
CONTROL "",ID_PROJECTTREEVIEW,"SysTreeView32", TVS_HASBUTTONS | TVS_EDITLABELS | TVS_INFOTIP | TVS_HASLINES | WS_BORDER | WS_HSCROLL | WS_TABSTOP,7,7,172,93
|
CONTROL "",ID_PROJECTTREEVIEW,"SysTreeView32", TVS_HASBUTTONS | TVS_EDITLABELS | TVS_INFOTIP | TVS_HASLINES | WS_BORDER | WS_HSCROLL | WS_TABSTOP,7,7,172,93
|
||||||
END
|
END
|
||||||
|
|
||||||
|
IDD_FILERELOCALIZER_DIALOG DIALOGEX 0, 0, 350, 48
|
||||||
|
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
|
EXSTYLE WS_EX_TOOLWINDOW
|
||||||
|
CAPTION "Change file full path name"
|
||||||
|
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||||
|
BEGIN
|
||||||
|
DEFPUSHBUTTON "OK",IDOK,235,27,50,14
|
||||||
|
PUSHBUTTON "Cancel",IDCANCEL,290,27,50,14
|
||||||
|
EDITTEXT IDC_EDIT_FILEFULLPATHNAME,7,7,335,14,ES_AUTOHSCROLL
|
||||||
|
END
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#define IDM_PROJECT_ADDFILES (IDD_PROJECTPANEL_MENU + 3)
|
#define IDM_PROJECT_ADDFILES (IDD_PROJECTPANEL_MENU + 3)
|
||||||
#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 IDM_PROJECT_MODIFYFILEPATH (IDD_PROJECTPANEL_MENU + 6)
|
||||||
|
|
||||||
#define IDD_PROJECTPANEL_MENUWS (IDD_PROJECTPANEL + 20)
|
#define IDD_PROJECTPANEL_MENUWS (IDD_PROJECTPANEL + 20)
|
||||||
#define IDM_PROJECT_NEWPROJECT (IDD_PROJECTPANEL_MENUWS + 1)
|
#define IDM_PROJECT_NEWPROJECT (IDD_PROJECTPANEL_MENUWS + 1)
|
||||||
|
@ -41,5 +42,9 @@
|
||||||
#define IDB_PROJECT_BTN (IDD_PROJECTPANEL_CTRL + 2)
|
#define IDB_PROJECT_BTN (IDD_PROJECTPANEL_CTRL + 2)
|
||||||
#define IDB_EDIT_BTN (IDD_PROJECTPANEL_CTRL + 3)
|
#define IDB_EDIT_BTN (IDD_PROJECTPANEL_CTRL + 3)
|
||||||
|
|
||||||
|
|
||||||
|
#define IDD_FILERELOCALIZER_DIALOG 3200
|
||||||
|
#define IDC_EDIT_FILEFULLPATHNAME (IDD_FILERELOCALIZER_DIALOG + 1)
|
||||||
|
|
||||||
#endif // PROJECTPANEL_RC_H
|
#endif // PROJECTPANEL_RC_H
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue