Add an option to restore the old behaviour while dropping a folder

The new behaviour (by default) is open the folder in "Folder as
Workspace". The old behaviour is open all files in folder (recursively).
Now user can choose it.
pull/2280/head
Don Ho 2016-09-13 23:12:36 +02:00
parent e31e37ebc3
commit 6bbfc7a095
6 changed files with 20 additions and 3 deletions

View File

@ -3101,7 +3101,8 @@ void Notepad_plus::dropFiles(HDROP hdrop)
} }
} }
bool isOldMode = false; NppParameters *pNppParam = NppParameters::getInstance();
bool isOldMode = pNppParam->getNppGUI()._isFolderDroppedOpenFiles;
if (isOldMode || folderPaths.size() == 0) // old mode or new mode + only files if (isOldMode || folderPaths.size() == 0) // old mode or new mode + only files
{ {

View File

@ -4707,6 +4707,10 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
if (optNameNewStyleSaveDlg && !lstrcmp(optNameNewStyleSaveDlg, TEXT("yes"))) if (optNameNewStyleSaveDlg && !lstrcmp(optNameNewStyleSaveDlg, TEXT("yes")))
_nppGUI._useNewStyleSaveDlg = true; _nppGUI._useNewStyleSaveDlg = true;
const TCHAR * optNameFolderDroppedOpenFiles = element->Attribute(TEXT("isFolderDroppedOpenFiles"));
if (optNameFolderDroppedOpenFiles && !lstrcmp(optNameFolderDroppedOpenFiles, TEXT("yes")))
_nppGUI._isFolderDroppedOpenFiles = true;
} }
} }
} }
@ -5480,6 +5484,9 @@ bool NppParameters::writeGUIParams()
const TCHAR * pStrNewStyleSaveDlg = _nppGUI._useNewStyleSaveDlg ? TEXT("yes") : TEXT("no"); const TCHAR * pStrNewStyleSaveDlg = _nppGUI._useNewStyleSaveDlg ? TEXT("yes") : TEXT("no");
element->SetAttribute(TEXT("newStyleSaveDlg"), pStrNewStyleSaveDlg); element->SetAttribute(TEXT("newStyleSaveDlg"), pStrNewStyleSaveDlg);
const TCHAR * pStrFolderDroppedOpenFiles = _nppGUI._isFolderDroppedOpenFiles ? TEXT("yes") : TEXT("no");
element->SetAttribute(TEXT("isFolderDroppedOpenFiles"), pStrFolderDroppedOpenFiles);
} }
else if (!lstrcmp(nm, TEXT("sessionExt"))) else if (!lstrcmp(nm, TEXT("sessionExt")))
{ {
@ -5816,6 +5823,7 @@ bool NppParameters::writeGUIParams()
GUIConfigElement->SetAttribute(TEXT("fileSwitcherWithoutExtColumn"), _nppGUI._fileSwitcherWithoutExtColumn?TEXT("yes"):TEXT("no")); GUIConfigElement->SetAttribute(TEXT("fileSwitcherWithoutExtColumn"), _nppGUI._fileSwitcherWithoutExtColumn?TEXT("yes"):TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("backSlashIsEscapeCharacterForSql"), _nppGUI._backSlashIsEscapeCharacterForSql?TEXT("yes"):TEXT("no")); GUIConfigElement->SetAttribute(TEXT("backSlashIsEscapeCharacterForSql"), _nppGUI._backSlashIsEscapeCharacterForSql?TEXT("yes"):TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("newStyleSaveDlg"), _nppGUI._useNewStyleSaveDlg?TEXT("yes"):TEXT("no")); GUIConfigElement->SetAttribute(TEXT("newStyleSaveDlg"), _nppGUI._useNewStyleSaveDlg?TEXT("yes"):TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("isFolderDroppedOpenFiles"), _nppGUI._isFolderDroppedOpenFiles ? TEXT("yes") : TEXT("no"));
} }
if (!searchEngineExist) if (!searchEngineExist)

View File

@ -819,6 +819,8 @@ struct NppGUI final
enum SearchEngineChoice{ se_custom = 0, se_duckDuckGo = 1, se_google = 2, se_bing = 3, se_yahoo = 4 }; enum SearchEngineChoice{ se_custom = 0, se_duckDuckGo = 1, se_google = 2, se_bing = 3, se_yahoo = 4 };
SearchEngineChoice _searchEngineChoice = se_google; SearchEngineChoice _searchEngineChoice = se_google;
generic_string _searchEngineCustom; generic_string _searchEngineCustom;
bool _isFolderDroppedOpenFiles = false;
}; };
struct ScintillaViewParams struct ScintillaViewParams

View File

@ -186,8 +186,8 @@ BEGIN
CONTROL "",IDC_OPENSAVEDIR_ALWAYSON_RADIO,"Button",BS_AUTORADIOBUTTON,118,89,11,10 CONTROL "",IDC_OPENSAVEDIR_ALWAYSON_RADIO,"Button",BS_AUTORADIOBUTTON,118,89,11,10
EDITTEXT IDC_OPENSAVEDIR_ALWAYSON_EDIT,134,88,179,14,ES_AUTOHSCROLL EDITTEXT IDC_OPENSAVEDIR_ALWAYSON_EDIT,134,88,179,14,ES_AUTOHSCROLL
PUSHBUTTON "...",IDD_OPENSAVEDIR_ALWAYSON_BROWSE_BUTTON,320,87,16,14 PUSHBUTTON "...",IDD_OPENSAVEDIR_ALWAYSON_BROWSE_BUTTON,320,87,16,14
CONTROL "Use new style save dialog (without file extension feature)",IDC_OPENSAVEDIR_CHECK_USENEWSTYLESAVEDIALOG, CONTROL "Use new style save dialog (without file extension feature)",IDC_OPENSAVEDIR_CHECK_USENEWSTYLESAVEDIALOG, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,145,250,10
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,145,250,10 CONTROL "Open all files of folder instead of launching Folder as Workspace on folder dropping",IDC_OPENSAVEDIR_CHECK_DRROPFOLDEROPENFILES, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,158,290,10
END END
IDD_PREFERENCE_RECENTFILESHISTORY_BOX DIALOGEX 0, 0, 455, 185 IDD_PREFERENCE_RECENTFILESHISTORY_BOX DIALOGEX 0, 0, 455, 185

View File

@ -1391,6 +1391,7 @@ INT_PTR CALLBACK DefaultDirectoryDlg::run_dlgProc(UINT message, WPARAM wParam, L
enableDlgTheme(_hSelf, ETDT_ENABLETAB); enableDlgTheme(_hSelf, ETDT_ENABLETAB);
::SendDlgItemMessage(_hSelf, IDC_OPENSAVEDIR_CHECK_USENEWSTYLESAVEDIALOG, BM_SETCHECK, nppGUI._useNewStyleSaveDlg ? BST_CHECKED : BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_OPENSAVEDIR_CHECK_USENEWSTYLESAVEDIALOG, BM_SETCHECK, nppGUI._useNewStyleSaveDlg ? BST_CHECKED : BST_UNCHECKED, 0);
::SendDlgItemMessage(_hSelf, IDC_OPENSAVEDIR_CHECK_DRROPFOLDEROPENFILES, BM_SETCHECK, nppGUI._isFolderDroppedOpenFiles ? BST_CHECKED : BST_UNCHECKED, 0);
} }
case WM_COMMAND : case WM_COMMAND :
@ -1437,6 +1438,10 @@ INT_PTR CALLBACK DefaultDirectoryDlg::run_dlgProc(UINT message, WPARAM wParam, L
nppGUI._useNewStyleSaveDlg = isCheckedOrNot(IDC_OPENSAVEDIR_CHECK_USENEWSTYLESAVEDIALOG); nppGUI._useNewStyleSaveDlg = isCheckedOrNot(IDC_OPENSAVEDIR_CHECK_USENEWSTYLESAVEDIALOG);
return TRUE; return TRUE;
case IDC_OPENSAVEDIR_CHECK_DRROPFOLDEROPENFILES:
nppGUI._isFolderDroppedOpenFiles = isCheckedOrNot(IDC_OPENSAVEDIR_CHECK_DRROPFOLDEROPENFILES);
return TRUE;
default: default:
return FALSE; return FALSE;
} }

View File

@ -222,6 +222,7 @@
#define IDC_CUSTOMIZELENGTHVAL_STATIC (IDD_PREFERENCE_NEWDOCSETTING_BOX + 28) #define IDC_CUSTOMIZELENGTHVAL_STATIC (IDD_PREFERENCE_NEWDOCSETTING_BOX + 28)
#define IDC_DISPLAY_STATIC (IDD_PREFERENCE_NEWDOCSETTING_BOX + 29) #define IDC_DISPLAY_STATIC (IDD_PREFERENCE_NEWDOCSETTING_BOX + 29)
#define IDC_OPENSAVEDIR_CHECK_USENEWSTYLESAVEDIALOG (IDD_PREFERENCE_NEWDOCSETTING_BOX + 30) #define IDC_OPENSAVEDIR_CHECK_USENEWSTYLESAVEDIALOG (IDD_PREFERENCE_NEWDOCSETTING_BOX + 30)
#define IDC_OPENSAVEDIR_CHECK_DRROPFOLDEROPENFILES (IDD_PREFERENCE_NEWDOCSETTING_BOX + 31)
#define IDD_PREFERENCE_DEFAULTDIRECTORY_BOX 6450 //(IDD_PREFERENCE_BOX + 400) #define IDD_PREFERENCE_DEFAULTDIRECTORY_BOX 6450 //(IDD_PREFERENCE_BOX + 400)
#define IDD_PREFERENCE_RECENTFILESHISTORY_BOX 6460 //(IDD_PREFERENCE_BOX + 400) #define IDD_PREFERENCE_RECENTFILESHISTORY_BOX 6460 //(IDD_PREFERENCE_BOX + 400)