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 "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

View File

@ -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<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:
fileReload();

View File

@ -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},

View File

@ -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
};

View File

@ -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)