Add "Open Folder as Workspace" command in file menu

This commit is contained in:
Don Ho 2016-03-19 16:15:21 +01:00
parent 77858aac6a
commit 93c704c857
5 changed files with 83 additions and 49 deletions

View File

@ -221,6 +221,7 @@ BEGIN
MENUITEM "Explorer", IDM_FILE_OPEN_FOLDER MENUITEM "Explorer", IDM_FILE_OPEN_FOLDER
MENUITEM "cmd", IDM_FILE_OPEN_CMD MENUITEM "cmd", IDM_FILE_OPEN_CMD
END END
MENUITEM "Open Folder as Workspace", IDM_FILE_OPENFOLDERASWORSPACE
MENUITEM "Re&load from Disk", IDM_FILE_RELOAD MENUITEM "Re&load from Disk", IDM_FILE_RELOAD
MENUITEM "&Save", IDM_FILE_SAVE MENUITEM "&Save", IDM_FILE_SAVE
MENUITEM "Save &As...", IDM_FILE_SAVEAS MENUITEM "Save &As...", IDM_FILE_SAVEAS

View File

@ -87,6 +87,37 @@ void Notepad_plus::command(int id)
cmd.run(_pPublicInterface->getHSelf()); cmd.run(_pPublicInterface->getHSelf());
} }
break; 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<generic_string> 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: case IDM_FILE_RELOAD:
fileReload(); fileReload();

View File

@ -77,6 +77,7 @@ static const WinMenuKeyDefinition winKeyDefs[] =
// //
{VK_N, IDM_FILE_NEW, true, false, false, nullptr}, {VK_N, IDM_FILE_NEW, true, false, false, nullptr},
{VK_O, IDM_FILE_OPEN, 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_NULL, IDM_FILE_RELOAD, false, false, false, nullptr},
{VK_S, IDM_FILE_SAVE, true, false, false, nullptr}, {VK_S, IDM_FILE_SAVE, true, false, false, nullptr},
{VK_S, IDM_FILE_SAVEAS, true, true, false, nullptr}, {VK_S, IDM_FILE_SAVEAS, true, true, false, nullptr},

View File

@ -49,9 +49,9 @@ MenuPosition menuPos[] = {
{ 7, -1, -1, "macro" }, { 7, -1, -1, "macro" },
{ 8, -1, -1, "run" }, { 8, -1, -1, "run" },
{ 0, 2, -1, "file-openFolder" }, { 0, 2, -1, "file-openFolder" },
{ 0, 11, -1, "file-closeMore" }, { 0, 12, -1, "file-closeMore" },
{ 0, 20, -1, "file-recentFiles" }, { 0, 21, -1, "file-recentFiles" },
{ 1, 10, -1, "edit-copyToClipboard" }, { 1, 10, -1, "edit-copyToClipboard" },
{ 1, 11, -1, "edit-indent" }, { 1, 11, -1, "edit-indent" },
@ -69,33 +69,33 @@ MenuPosition menuPos[] = {
{ 2, 21, -1, "search-jumpDown" }, { 2, 21, -1, "search-jumpDown" },
{ 2, 23, -1, "search-bookmark" }, { 2, 23, -1, "search-bookmark" },
{ 3, 4, -1, "view-showSymbol" }, { 3, 4, -1, "view-showSymbol" },
{ 3, 5, -1, "view-zoom" }, { 3, 5, -1, "view-zoom" },
{ 3, 6, -1, "view-moveCloneDocument" }, { 3, 6, -1, "view-moveCloneDocument" },
{ 3, 7, -1, "view-tab" }, { 3, 7, -1, "view-tab" },
{ 3, 16, -1, "view-collapseLevel" }, { 3, 16, -1, "view-collapseLevel" },
{ 3, 17, -1, "view-uncollapseLevel" }, { 3, 17, -1, "view-uncollapseLevel" },
{ 3, 21, -1, "view-project" }, { 3, 21, -1, "view-project" },
{ 4, 5, -1, "encoding-characterSets" }, { 4, 5, -1, "encoding-characterSets" },
{ 4, 5, 0, "encoding-arabic" }, { 4, 5, 0, "encoding-arabic" },
{ 4, 5, 1, "encoding-baltic" }, { 4, 5, 1, "encoding-baltic" },
{ 4, 5, 2, "encoding-celtic" }, { 4, 5, 2, "encoding-celtic" },
{ 4, 5, 3, "encoding-cyrillic" }, { 4, 5, 3, "encoding-cyrillic" },
{ 4, 5, 4, "encoding-centralEuropean" }, { 4, 5, 4, "encoding-centralEuropean" },
{ 4, 5, 5, "encoding-chinese" }, { 4, 5, 5, "encoding-chinese" },
{ 4, 5, 6, "encoding-easternEuropean" }, { 4, 5, 6, "encoding-easternEuropean" },
{ 4, 5, 7, "encoding-greek" }, { 4, 5, 7, "encoding-greek" },
{ 4, 5, 8, "encoding-hebrew" }, { 4, 5, 8, "encoding-hebrew" },
{ 4, 5, 9, "encoding-japanese" }, { 4, 5, 9, "encoding-japanese" },
{ 4, 5, 10, "encoding-korean" }, { 4, 5, 10, "encoding-korean" },
{ 4, 5, 11, "encoding-northEuropean" }, { 4, 5, 11, "encoding-northEuropean" },
{ 4, 5, 12, "encoding-thai" }, { 4, 5, 12, "encoding-thai" },
{ 4, 5, 13, "encoding-turkish" }, { 4, 5, 13, "encoding-turkish" },
{ 4, 5, 14, "encoding-westernEuropean" }, { 4, 5, 14, "encoding-westernEuropean" },
{ 4, 5, 15, "encoding-vietnamese" }, { 4, 5, 15, "encoding-vietnamese" },
{ 6, 4, -1, "settings-import" }, { 6, 4, -1, "settings-import" },
{ -1, -1, -1, "" } // End of array { -1, -1, -1, "" } // End of array
}; };

View File

@ -55,39 +55,40 @@
#define IDM_FILE_OPEN_FOLDER (IDM_FILE + 19) #define IDM_FILE_OPEN_FOLDER (IDM_FILE + 19)
#define IDM_FILE_OPEN_CMD (IDM_FILE + 20) #define IDM_FILE_OPEN_CMD (IDM_FILE + 20)
#define IDM_FILE_RESTORELASTCLOSEDFILE (IDM_FILE + 21) #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: // 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" // 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 // 0 based position of command "Exit" including the bars in the file menu
// and without counting "Recent files history" items // and without counting "Recent files history" items
// 0 New // 0 New
// 1 Open... // 1 Open...
// 2 Open Folder // 2 Open Containing Folder
// 3 Reload from Disk // 3 Open Folder as Workspace
// 4 Save // 4 Reload from Disk
// 5 Save As... // 5 Save
// 6 Save a Copy As... // 6 Save As...
// 7 Save All // 7 Save a Copy As...
// 8 Rename... // 8 Save All
// 9 Close // 9 Rename...
//10 Close All //10 Close
//11 Close More //11 Close All
//12 Move to Recycle Bin //12 Close More
//13 -------- //13 Move to Recycle Bin
//14 Load Session... //14 --------
//15 Save Session... //15 Load Session...
//16 -------- //16 Save Session...
//17 Print... //17 --------
//18 Print Now //18 Print...
//19 -------- //19 Print Now
//20 Exit //20 --------
#define IDM_FILEMENU_EXISTCMDPOSITION 20 //21 Exit
#define IDM_FILEMENU_EXISTCMDPOSITION 21
#define IDM_EDIT (IDM + 2000) #define IDM_EDIT (IDM + 2000)
#define IDM_EDIT_CUT (IDM_EDIT + 1) #define IDM_EDIT_CUT (IDM_EDIT + 1)
#define IDM_EDIT_COPY (IDM_EDIT + 2) #define IDM_EDIT_COPY (IDM_EDIT + 2)