[NEW_FEATURE] Add "Move Up" (Ctrl+Up) and "Move Down" (Ctrl+Down) commands in Project Panel.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@852 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
f90935057d
commit
9138bbc5e8
@ -148,6 +148,12 @@ BOOL CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPar
|
||||
::DestroyWindow(_hToolbarMenu);
|
||||
break;
|
||||
}
|
||||
case WM_KEYDOWN:
|
||||
//if (wParam == VK_F2)
|
||||
{
|
||||
::MessageBoxA(NULL,"vkF2","",MB_OK);
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
return DockingDlgInterface::run_dlgProc(message, wParam, lParam);
|
||||
@ -194,6 +200,8 @@ void ProjectPanel::initMenus()
|
||||
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, (UINT)-1, 0);
|
||||
::InsertMenu(_hWorkSpaceMenu, 0, MF_BYCOMMAND, IDM_PROJECT_NEWPROJECT, newproject_workspace.c_str());
|
||||
|
||||
generic_string edit_moveup = pNativeSpeaker->getProjectPanelLangMenuStr("ProjectMenu", IDM_PROJECT_MOVEUP, PM_MOVEUPENTRY);
|
||||
generic_string edit_movedown = pNativeSpeaker->getProjectPanelLangMenuStr("ProjectMenu", IDM_PROJECT_MOVEDOWN, PM_MOVEDOWNENTRY);
|
||||
generic_string edit_rename = pNativeSpeaker->getProjectPanelLangMenuStr("ProjectMenu", IDM_PROJECT_RENAME, PM_EDITRENAME);
|
||||
generic_string edit_addfolder = pNativeSpeaker->getProjectPanelLangMenuStr("ProjectMenu", IDM_PROJECT_NEWFOLDER, PM_EDITNEWFOLDER);
|
||||
generic_string edit_addfiles = pNativeSpeaker->getProjectPanelLangMenuStr("ProjectMenu", IDM_PROJECT_ADDFILES, PM_EDITADDFILES);
|
||||
@ -201,12 +209,17 @@ void ProjectPanel::initMenus()
|
||||
generic_string edit_remove = pNativeSpeaker->getProjectPanelLangMenuStr("ProjectMenu", IDM_PROJECT_DELETEFOLDER, PM_EDITREMOVE);
|
||||
|
||||
_hProjectMenu = ::CreatePopupMenu();
|
||||
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_MOVEUP, edit_moveup.c_str());
|
||||
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_MOVEDOWN, edit_movedown.c_str());
|
||||
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, UINT(-1), 0);
|
||||
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_RENAME, edit_rename.c_str());
|
||||
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_NEWFOLDER, edit_addfolder.c_str());
|
||||
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_ADDFILES, edit_addfiles.c_str());
|
||||
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_ADDFILESRECUSIVELY, edit_addfilesRecursive.c_str());
|
||||
::InsertMenu(_hProjectMenu, 0, MF_BYCOMMAND, IDM_PROJECT_DELETEFOLDER, edit_remove.c_str());
|
||||
|
||||
edit_moveup = pNativeSpeaker->getProjectPanelLangMenuStr("FolderMenu", IDM_PROJECT_MOVEUP, PM_MOVEUPENTRY);
|
||||
edit_movedown = pNativeSpeaker->getProjectPanelLangMenuStr("FolderMenu", IDM_PROJECT_MOVEDOWN, PM_MOVEDOWNENTRY);
|
||||
edit_rename = pNativeSpeaker->getProjectPanelLangMenuStr("FolderMenu", IDM_PROJECT_RENAME, PM_EDITRENAME);
|
||||
edit_addfolder = pNativeSpeaker->getProjectPanelLangMenuStr("FolderMenu", IDM_PROJECT_NEWFOLDER, PM_EDITNEWFOLDER);
|
||||
edit_addfiles = pNativeSpeaker->getProjectPanelLangMenuStr("FolderMenu", IDM_PROJECT_ADDFILES, PM_EDITADDFILES);
|
||||
@ -214,21 +227,25 @@ void ProjectPanel::initMenus()
|
||||
edit_remove = pNativeSpeaker->getProjectPanelLangMenuStr("FolderMenu", IDM_PROJECT_DELETEFOLDER, PM_EDITREMOVE);
|
||||
|
||||
_hFolderMenu = ::CreatePopupMenu();
|
||||
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_PROJECT_MOVEUP, TEXT("Move Up"));
|
||||
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_PROJECT_MOVEDOWN, TEXT("Move Down"));
|
||||
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_PROJECT_MOVEUP, edit_moveup.c_str());
|
||||
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_PROJECT_MOVEDOWN, edit_movedown.c_str());
|
||||
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, UINT(-1), 0);
|
||||
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_PROJECT_RENAME, edit_rename.c_str());
|
||||
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_PROJECT_NEWFOLDER, edit_addfolder.c_str());
|
||||
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_PROJECT_ADDFILES, edit_addfiles.c_str());
|
||||
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_PROJECT_ADDFILESRECUSIVELY, edit_addfilesRecursive.c_str());
|
||||
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_PROJECT_DELETEFOLDER, edit_remove.c_str());
|
||||
|
||||
edit_moveup = pNativeSpeaker->getProjectPanelLangMenuStr("FileMenu", IDM_PROJECT_MOVEUP, PM_MOVEUPENTRY);
|
||||
edit_movedown = pNativeSpeaker->getProjectPanelLangMenuStr("FileMenu", IDM_PROJECT_MOVEDOWN, PM_MOVEDOWNENTRY);
|
||||
edit_rename = pNativeSpeaker->getProjectPanelLangMenuStr("FileMenu", IDM_PROJECT_RENAME, PM_EDITRENAME);
|
||||
edit_remove = pNativeSpeaker->getProjectPanelLangMenuStr("FileMenu", IDM_PROJECT_DELETEFILE, PM_EDITREMOVE);
|
||||
generic_string edit_modifyfile = pNativeSpeaker->getProjectPanelLangMenuStr("FileMenu", IDM_PROJECT_MODIFYFILEPATH, PM_EDITMODIFYFILE);
|
||||
|
||||
_hFileMenu = ::CreatePopupMenu();
|
||||
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_PROJECT_MOVEUP, TEXT("Move Up"));
|
||||
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_PROJECT_MOVEDOWN, TEXT("Move Down"));
|
||||
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_PROJECT_MOVEUP, edit_moveup.c_str());
|
||||
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_PROJECT_MOVEDOWN, edit_movedown.c_str());
|
||||
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, UINT(-1), 0);
|
||||
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_PROJECT_RENAME, edit_rename.c_str());
|
||||
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_PROJECT_DELETEFILE, edit_remove.c_str());
|
||||
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_PROJECT_MODIFYFILEPATH, edit_modifyfile.c_str());
|
||||
@ -605,6 +622,7 @@ void ProjectPanel::notified(LPNMHDR notification)
|
||||
//tvItem.hItem = _treeView.getSelection();
|
||||
//::SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem);
|
||||
LPNMTVKEYDOWN ptvkd = (LPNMTVKEYDOWN)notification;
|
||||
|
||||
if (ptvkd->wVKey == VK_DELETE)
|
||||
{
|
||||
HTREEITEM hItem = _treeView.getSelection();
|
||||
@ -623,7 +641,20 @@ void ProjectPanel::notified(LPNMHDR notification)
|
||||
else
|
||||
_treeView.toggleExpandCollapse(hItem);
|
||||
}
|
||||
|
||||
else if (ptvkd->wVKey == VK_UP)
|
||||
{
|
||||
if (0x80 & GetKeyState(VK_CONTROL))
|
||||
{
|
||||
popupMenuCmd(IDM_PROJECT_MOVEUP);
|
||||
}
|
||||
}
|
||||
else if (ptvkd->wVKey == VK_DOWN)
|
||||
{
|
||||
if (0x80 & GetKeyState(VK_CONTROL))
|
||||
{
|
||||
popupMenuCmd(IDM_PROJECT_MOVEDOWN);
|
||||
}
|
||||
}
|
||||
else if (ptvkd->wVKey == VK_F2)
|
||||
popupMenuCmd(IDM_PROJECT_RENAME);
|
||||
|
||||
@ -844,15 +875,15 @@ void ProjectPanel::popupMenuCmd(int cmdID)
|
||||
|
||||
case IDM_PROJECT_MOVEDOWN :
|
||||
{
|
||||
_treeView.moveDown(hTreeItem);
|
||||
setWorkSpaceDirty(true);
|
||||
if (_treeView.moveDown(hTreeItem))
|
||||
setWorkSpaceDirty(true);
|
||||
}
|
||||
break;
|
||||
|
||||
case IDM_PROJECT_MOVEUP :
|
||||
{
|
||||
_treeView.moveUp(hTreeItem);
|
||||
setWorkSpaceDirty(true);
|
||||
if (_treeView.moveUp(hTreeItem))
|
||||
setWorkSpaceDirty(true);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -45,12 +45,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#define PM_EDITNEWFOLDER TEXT("Add Folder")
|
||||
#define PM_EDITADDFILES TEXT("Add Files...")
|
||||
#define PM_EDITADDFILESRECUSIVELY TEXT("Add Files from Directory...")
|
||||
#define PM_EDITREMOVE TEXT("Remove")
|
||||
#define PM_EDITREMOVE TEXT("Remove\tDEL")
|
||||
#define PM_EDITMODIFYFILE TEXT("Modify File Path")
|
||||
|
||||
#define PM_WORKSPACEMENUENTRY TEXT("Workspace")
|
||||
#define PM_EDITMENUENTRY TEXT("Edit")
|
||||
|
||||
#define PM_MOVEUPENTRY TEXT("Move Up\tCtrl+Up")
|
||||
#define PM_MOVEDOWNENTRY TEXT("Move Down\tCtrl+Down")
|
||||
|
||||
enum NodeType {
|
||||
nodeType_root = 0, nodeType_project = 1, nodeType_folder = 2, nodeType_file = 3
|
||||
};
|
||||
|
@ -53,17 +53,28 @@ void TreeView::destroy()
|
||||
|
||||
LRESULT TreeView::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
/*
|
||||
switch(Message)
|
||||
{
|
||||
|
||||
case WM_KEYDOWN:
|
||||
if (wParam == VK_F2)
|
||||
::MessageBoxA(NULL, "VK_F2", "", MB_OK);
|
||||
if (wParam == VK_UP && (0x80 & GetKeyState(VK_CONTROL)))
|
||||
{
|
||||
HTREEITEM hTreeItem = getSelection();
|
||||
moveUp(hTreeItem);
|
||||
return TRUE;
|
||||
}
|
||||
else if (wParam == VK_DOWN && (0x80 & GetKeyState(VK_CONTROL)))
|
||||
{
|
||||
HTREEITEM hTreeItem = getSelection();
|
||||
moveDown(hTreeItem);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return ::CallWindowProc(_defaultProc, hwnd, Message, wParam, lParam);
|
||||
}
|
||||
|
||||
*/
|
||||
return ::CallWindowProc(_defaultProc, hwnd, Message, wParam, lParam);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user