Folder as Workspace - Bonus: Shell Execute command

This commit is contained in:
Don Ho 2016-02-09 00:18:13 +01:00
parent 058c9d5923
commit 3dbdb52448
2 changed files with 20 additions and 10 deletions

View File

@ -265,11 +265,13 @@ void FileBrowser::initPopupMenus()
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_REMOVEROOTFOLDER, TEXT("Remove"));
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, (UINT)-1, 0);
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_COPYEPATH, TEXT("Copy path"));
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, (UINT)-1, 0);
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_EXPLORERHERE, TEXT("Explorer here"));
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_CMDHERE, TEXT("CMD here"));
_hFolderMenu = ::CreatePopupMenu();
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_COPYEPATH, TEXT("Copy path"));
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, (UINT)-1, 0);
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_EXPLORERHERE, TEXT("Explorer here"));
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_CMDHERE, TEXT("CMD here"));
//::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_NEWFOLDER, edit_addfolder.c_str());
@ -279,9 +281,10 @@ void FileBrowser::initPopupMenus()
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_OPENINNPP, TEXT("Open"));
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, (UINT)-1, 0);
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_COPYEPATH, TEXT("Copy path"));
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_SHELLEXECUTE, TEXT("Run by system"));
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, (UINT)-1, 0);
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_EXPLORERHERE, TEXT("Explorer here"));
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_CMDHERE, TEXT("CMD here"));
//::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_RENAME, edit_rename.c_str());
//::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_DELETEFILE, edit_remove.c_str());
//::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_MODIFYFILEPATH, edit_modifyfile.c_str());
}
@ -786,6 +789,17 @@ void FileBrowser::popupMenuCmd(int cmdID)
}
}
break;
case IDM_FILEBROWSER_SHELLEXECUTE:
{
if (not selectedNode) return;
generic_string path = getNodePath(selectedNode);
if (::PathFileExists(path.c_str()))
::ShellExecute(NULL, TEXT("open"), path.c_str(), NULL, NULL, SW_SHOWNORMAL);
}
break;
/*
case IDM_FILEBROWSER_RENAME :
TreeView_EditLabel(_treeView.getHSelf(), hTreeItem);

View File

@ -36,16 +36,12 @@
#define IDM_FILEBROWSER_REMOVEROOTFOLDER (IDD_FILEBROWSER_MENU + 1)
#define IDM_FILEBROWSER_REMOVEALLROOTS (IDD_FILEBROWSER_MENU + 2)
#define IDM_FILEBROWSER_ADDROOT (IDD_FILEBROWSER_MENU + 3)
#define IDM_FILEBROWSER_SHELLEXECUTE (IDD_FILEBROWSER_MENU + 4)
#define IDM_FILEBROWSER_OPENINNPP (IDD_FILEBROWSER_MENU + 5)
#define IDM_FILEBROWSER_COPYEPATH (IDD_FILEBROWSER_MENU + 6)
/*
#define IDM_FILEBROWSER_ADDFILES (IDD_FILEBROWSER_MENU + 3)
*/
#define IDM_FILEBROWSER_OPENINNPP (IDD_FILEBROWSER_MENU + 5)
#define IDM_FILEBROWSER_COPYEPATH (IDD_FILEBROWSER_MENU + 6)
#define IDM_FILEBROWSER_EXPLORERHERE (IDD_FILEBROWSER_MENU + 8)
#define IDM_FILEBROWSER_CMDHERE (IDD_FILEBROWSER_MENU + 9)
#define IDM_FILEBROWSER_EXPLORERHERE (IDD_FILEBROWSER_MENU + 8)
#define IDM_FILEBROWSER_CMDHERE (IDD_FILEBROWSER_MENU + 9)
#define IDD_FILEBROWSER_CTRL (IDD_FILEBROWSER + 30)
#define ID_FILEBROWSERTREEVIEW (IDD_FILEBROWSER_CTRL + 1)