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

@ -88,6 +88,37 @@ void Notepad_plus::command(int id)
}
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();
break;

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

@ -50,8 +50,8 @@ MenuPosition menuPos[] = {
{ 8, -1, -1, "run" },
{ 0, 2, -1, "file-openFolder" },
{ 0, 11, -1, "file-closeMore" },
{ 0, 20, -1, "file-recentFiles" },
{ 0, 12, -1, "file-closeMore" },
{ 0, 21, -1, "file-recentFiles" },
{ 1, 10, -1, "edit-copyToClipboard" },
{ 1, 11, -1, "edit-indent" },

View File

@ -55,38 +55,39 @@
#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)