From 3dbdb52448b3f36551f5c98d6548a6c6b9f77f77 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Tue, 9 Feb 2016 00:18:13 +0100 Subject: [PATCH] Folder as Workspace - Bonus: Shell Execute command --- .../src/WinControls/FileBrowser/fileBrowser.cpp | 16 +++++++++++++++- .../src/WinControls/FileBrowser/fileBrowser_rc.h | 14 +++++--------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp index fffc31b6..088443fe 100644 --- a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp +++ b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp @@ -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); diff --git a/PowerEditor/src/WinControls/FileBrowser/fileBrowser_rc.h b/PowerEditor/src/WinControls/FileBrowser/fileBrowser_rc.h index 1f6b837e..5fb0e4ee 100644 --- a/PowerEditor/src/WinControls/FileBrowser/fileBrowser_rc.h +++ b/PowerEditor/src/WinControls/FileBrowser/fileBrowser_rc.h @@ -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)