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

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

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

@ -50,8 +50,8 @@ MenuPosition menuPos[] = {
{ 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" },

View File

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