diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index 2e0700bc3..f74c57884 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -221,6 +221,7 @@ BEGIN MENUITEM "Explorer", IDM_FILE_OPEN_FOLDER MENUITEM "cmd", IDM_FILE_OPEN_CMD END + MENUITEM "Open Folder as Workspace", IDM_FILE_OPENFOLDERASWORSPACE MENUITEM "Re&load from Disk", IDM_FILE_RELOAD MENUITEM "&Save", IDM_FILE_SAVE MENUITEM "Save &As...", IDM_FILE_SAVEAS diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index dabbc317f..1d9e77952 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -87,6 +87,37 @@ void Notepad_plus::command(int id) cmd.run(_pPublicInterface->getHSelf()); } break; + + case IDM_FILE_OPENFOLDERASWORSPACE: + { + generic_string folderPath = folderBrowser(_pPublicInterface->getHSelf(), TEXT("Select a folder to add in Folder as Workspace panel")); + if (not folderPath.empty()) + { + if (_pFileBrowser == nullptr) // first launch, check in params to open folders + { + vector dummy; + launchFileBrowser(dummy); + if (_pFileBrowser != nullptr) + { + checkMenuItem(IDM_VIEW_FILEBROWSER, true); + _toolBar.setCheck(IDM_VIEW_FILEBROWSER, true); + _pFileBrowser->setClosed(false); + } + else // problem + return; + } + else + { + if (_pFileBrowser->isClosed()) + { + _pFileBrowser->display(); + _pFileBrowser->setClosed(false); + } + } + _pFileBrowser->addRootFolder(folderPath); + } + } + break; case IDM_FILE_RELOAD: fileReload(); diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index a2671118d..9d9d6b332 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -77,6 +77,7 @@ static const WinMenuKeyDefinition winKeyDefs[] = // {VK_N, IDM_FILE_NEW, true, false, false, nullptr}, {VK_O, IDM_FILE_OPEN, true, false, false, nullptr}, + {VK_NULL, IDM_FILE_OPENFOLDERASWORSPACE, false, false, false, nullptr}, {VK_NULL, IDM_FILE_RELOAD, false, false, false, nullptr}, {VK_S, IDM_FILE_SAVE, true, false, false, nullptr}, {VK_S, IDM_FILE_SAVEAS, true, true, false, nullptr}, diff --git a/PowerEditor/src/localization.cpp b/PowerEditor/src/localization.cpp index 09ef7b384..e3e0a092e 100644 --- a/PowerEditor/src/localization.cpp +++ b/PowerEditor/src/localization.cpp @@ -49,9 +49,9 @@ MenuPosition menuPos[] = { { 7, -1, -1, "macro" }, { 8, -1, -1, "run" }, - { 0, 2, -1, "file-openFolder" }, - { 0, 11, -1, "file-closeMore" }, - { 0, 20, -1, "file-recentFiles" }, + { 0, 2, -1, "file-openFolder" }, + { 0, 12, -1, "file-closeMore" }, + { 0, 21, -1, "file-recentFiles" }, { 1, 10, -1, "edit-copyToClipboard" }, { 1, 11, -1, "edit-indent" }, @@ -69,33 +69,33 @@ MenuPosition menuPos[] = { { 2, 21, -1, "search-jumpDown" }, { 2, 23, -1, "search-bookmark" }, - { 3, 4, -1, "view-showSymbol" }, - { 3, 5, -1, "view-zoom" }, - { 3, 6, -1, "view-moveCloneDocument" }, - { 3, 7, -1, "view-tab" }, + { 3, 4, -1, "view-showSymbol" }, + { 3, 5, -1, "view-zoom" }, + { 3, 6, -1, "view-moveCloneDocument" }, + { 3, 7, -1, "view-tab" }, { 3, 16, -1, "view-collapseLevel" }, { 3, 17, -1, "view-uncollapseLevel" }, { 3, 21, -1, "view-project" }, - { 4, 5, -1, "encoding-characterSets" }, - { 4, 5, 0, "encoding-arabic" }, - { 4, 5, 1, "encoding-baltic" }, - { 4, 5, 2, "encoding-celtic" }, - { 4, 5, 3, "encoding-cyrillic" }, - { 4, 5, 4, "encoding-centralEuropean" }, - { 4, 5, 5, "encoding-chinese" }, - { 4, 5, 6, "encoding-easternEuropean" }, - { 4, 5, 7, "encoding-greek" }, - { 4, 5, 8, "encoding-hebrew" }, - { 4, 5, 9, "encoding-japanese" }, - { 4, 5, 10, "encoding-korean" }, - { 4, 5, 11, "encoding-northEuropean" }, - { 4, 5, 12, "encoding-thai" }, - { 4, 5, 13, "encoding-turkish" }, - { 4, 5, 14, "encoding-westernEuropean" }, - { 4, 5, 15, "encoding-vietnamese" }, + { 4, 5, -1, "encoding-characterSets" }, + { 4, 5, 0, "encoding-arabic" }, + { 4, 5, 1, "encoding-baltic" }, + { 4, 5, 2, "encoding-celtic" }, + { 4, 5, 3, "encoding-cyrillic" }, + { 4, 5, 4, "encoding-centralEuropean" }, + { 4, 5, 5, "encoding-chinese" }, + { 4, 5, 6, "encoding-easternEuropean" }, + { 4, 5, 7, "encoding-greek" }, + { 4, 5, 8, "encoding-hebrew" }, + { 4, 5, 9, "encoding-japanese" }, + { 4, 5, 10, "encoding-korean" }, + { 4, 5, 11, "encoding-northEuropean" }, + { 4, 5, 12, "encoding-thai" }, + { 4, 5, 13, "encoding-turkish" }, + { 4, 5, 14, "encoding-westernEuropean" }, + { 4, 5, 15, "encoding-vietnamese" }, - { 6, 4, -1, "settings-import" }, + { 6, 4, -1, "settings-import" }, { -1, -1, -1, "" } // End of array }; diff --git a/PowerEditor/src/menuCmdID.h b/PowerEditor/src/menuCmdID.h index c83d9c104..a9ca95e8f 100644 --- a/PowerEditor/src/menuCmdID.h +++ b/PowerEditor/src/menuCmdID.h @@ -55,39 +55,40 @@ #define IDM_FILE_OPEN_FOLDER (IDM_FILE + 19) #define IDM_FILE_OPEN_CMD (IDM_FILE + 20) #define IDM_FILE_RESTORELASTCLOSEDFILE (IDM_FILE + 21) + #define IDM_FILE_OPENFOLDERASWORSPACE (IDM_FILE + 22) // IMPORTANT: If list above is modified, you have to change the following values: // To be updated if new menu item(s) is (are) added in menu "File" - #define IDM_FILEMENU_LASTONE IDM_FILE_RESTORELASTCLOSEDFILE - - + #define IDM_FILEMENU_LASTONE IDM_FILE_OPENFOLDERASWORSPACE // 0 based position of command "Exit" including the bars in the file menu // and without counting "Recent files history" items // 0 New // 1 Open... -// 2 Open Folder -// 3 Reload from Disk -// 4 Save -// 5 Save As... -// 6 Save a Copy As... -// 7 Save All -// 8 Rename... -// 9 Close -//10 Close All -//11 Close More -//12 Move to Recycle Bin -//13 -------- -//14 Load Session... -//15 Save Session... -//16 -------- -//17 Print... -//18 Print Now -//19 -------- -//20 Exit - #define IDM_FILEMENU_EXISTCMDPOSITION 20 - +// 2 Open Containing Folder +// 3 Open Folder as Workspace +// 4 Reload from Disk +// 5 Save +// 6 Save As... +// 7 Save a Copy As... +// 8 Save All +// 9 Rename... +//10 Close +//11 Close All +//12 Close More +//13 Move to Recycle Bin +//14 -------- +//15 Load Session... +//16 Save Session... +//17 -------- +//18 Print... +//19 Print Now +//20 -------- +//21 Exit + #define IDM_FILEMENU_EXISTCMDPOSITION 21 + + #define IDM_EDIT (IDM + 2000) #define IDM_EDIT_CUT (IDM_EDIT + 1) #define IDM_EDIT_COPY (IDM_EDIT + 2)