From d5ad02521ed5558ba6a958d5334cfce6f0e8e6fc Mon Sep 17 00:00:00 2001 From: Scott Sumner <30118311+sasumner@users.noreply.github.com> Date: Thu, 31 Dec 2020 20:54:54 -0500 Subject: [PATCH] Improve option for setting save dialog filter to All Types Fix #9325, close #9328 --- PowerEditor/installer/nativeLang/english.xml | 2 +- PowerEditor/src/NppIO.cpp | 3 +-- PowerEditor/src/Parameters.cpp | 10 +++++----- PowerEditor/src/Parameters.h | 2 +- PowerEditor/src/WinControls/Preference/preference.rc | 2 +- .../src/WinControls/Preference/preferenceDlg.cpp | 6 +++--- PowerEditor/src/WinControls/Preference/preference_rc.h | 2 +- 7 files changed, 13 insertions(+), 14 deletions(-) diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml index 18f38d2a7..6961c8d32 100644 --- a/PowerEditor/installer/nativeLang/english.xml +++ b/PowerEditor/installer/nativeLang/english.xml @@ -1042,7 +1042,7 @@ You can define several column markers by using white space to separate the diffe - + diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index 8bf0e306d..8c503f10b 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -1646,8 +1646,7 @@ bool Notepad_plus::fileSaveAs(BufferID id, bool isSaveCopy) LangType langType = buf->getLangType(); int langTypeIndex = 0; - if (!((NppParameters::getInstance()).getNppGUI()._setSaveDlgExtFiltToAllTypesForNormText && - buf->isUntitled() && langType == L_TEXT)) + if (!((NppParameters::getInstance()).getNppGUI()._setSaveDlgExtFiltToAllTypes)) { langTypeIndex = setFileOpenSaveDlgFilters(fDlg, false, langType); } diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 626086007..56c3b620f 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -5305,9 +5305,9 @@ void NppParameters::feedGUIParameters(TiXmlNode *node) if (optDocPeekOnMap) _nppGUI._isDocPeekOnMap = (lstrcmp(optDocPeekOnMap, TEXT("yes")) == 0); - const TCHAR* saveDlgExtFilterToAllTypesForNormText = element->Attribute(TEXT("saveDlgExtFilterToAllTypesForNormalText")); - if (saveDlgExtFilterToAllTypesForNormText) - _nppGUI._setSaveDlgExtFiltToAllTypesForNormText = (lstrcmp(saveDlgExtFilterToAllTypesForNormText, TEXT("yes")) == 0); + const TCHAR* saveDlgExtFilterToAllTypes = element->Attribute(TEXT("saveDlgExtFilterToAllTypes")); + if (saveDlgExtFilterToAllTypes) + _nppGUI._setSaveDlgExtFiltToAllTypes = (lstrcmp(saveDlgExtFilterToAllTypes, TEXT("yes")) == 0); } else if (!lstrcmp(nm, TEXT("commandLineInterpreter"))) { @@ -6229,7 +6229,7 @@ void NppParameters::createXmlTreeFromGUIParams() GUIConfigElement->SetAttribute(TEXT("setting"), _nppGUI._multiInstSetting); } - // + // { TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); GUIConfigElement->SetAttribute(TEXT("name"), TEXT("MISC")); @@ -6241,7 +6241,7 @@ void NppParameters::createXmlTreeFromGUIParams() GUIConfigElement->SetAttribute(TEXT("isFolderDroppedOpenFiles"), _nppGUI._isFolderDroppedOpenFiles ? TEXT("yes") : TEXT("no")); GUIConfigElement->SetAttribute(TEXT("docPeekOnTab"), _nppGUI._isDocPeekOnTab ? TEXT("yes") : TEXT("no")); GUIConfigElement->SetAttribute(TEXT("docPeekOnMap"), _nppGUI._isDocPeekOnMap ? TEXT("yes") : TEXT("no")); - GUIConfigElement->SetAttribute(TEXT("saveDlgExtFilterToAllTypesForNormalText"), _nppGUI._setSaveDlgExtFiltToAllTypesForNormText ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("saveDlgExtFilterToAllTypes"), _nppGUI._setSaveDlgExtFiltToAllTypes ? TEXT("yes") : TEXT("no")); } // diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index d0b7a13dd..0b98c9a07 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -826,7 +826,7 @@ struct NppGUI final bool _rememberLastSession = true; // remember next session boolean will be written in the settings bool _isCmdlineNosessionActivated = false; // used for if -nosession is indicated on the launch time bool _detectEncoding = true; - bool _setSaveDlgExtFiltToAllTypesForNormText = false; + bool _setSaveDlgExtFiltToAllTypes = false; bool _doTaskList = true; bool _maitainIndent = true; bool _enableSmartHilite = true; diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc index 19ac3d556..981b15f52 100644 --- a/PowerEditor/src/WinControls/Preference/preference.rc +++ b/PowerEditor/src/WinControls/Preference/preference.rc @@ -429,7 +429,7 @@ BEGIN // "Enable Notepad++ auto-updater" should be always the 1st item, because it'll be hidden if GUP.exe is absent CONTROL "Enable Notepad++ auto-updater",IDC_CHECK_AUTOUPDATE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,94,217,10 - CONTROL "Set Save dialog file extension filter to .* instead of .txt for Normal Text",IDC_CHECK_SAVEDLGEXTFILTALLTYPESFORNORMTEXT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,109,267,10 + CONTROL "Set Save dialog file extension filter to *.*",IDC_CHECK_SAVEDLGEXTFILTALLTYPES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,109,267,10 CONTROL "Autodetect character encoding",IDC_CHECK_DETECTENCODING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,124,217,10 CONTROL "Minimize to system tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,139,217,10 CONTROL "Show only filename in title bar",IDC_CHECK_SHORTTITLE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,154,217,10 diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 9384965b2..d8aa94ed5 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -988,7 +988,7 @@ INT_PTR CALLBACK MiscSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) ::SendDlgItemMessage(_hSelf, IDC_CHECK_MIN2SYSTRAY, BM_SETCHECK, nppGUI._isMinimizedToTray, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_DETECTENCODING, BM_SETCHECK, nppGUI._detectEncoding, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_AUTOUPDATE, BM_SETCHECK, nppGUI._autoUpdateOpt._doAutoUpdate, 0); - ::SendDlgItemMessage(_hSelf, IDC_CHECK_SAVEDLGEXTFILTALLTYPESFORNORMTEXT, BM_SETCHECK, nppGUI._setSaveDlgExtFiltToAllTypesForNormText, 0); + ::SendDlgItemMessage(_hSelf, IDC_CHECK_SAVEDLGEXTFILTALLTYPES, BM_SETCHECK, nppGUI._setSaveDlgExtFiltToAllTypes, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_DIRECTWRITE_ENABLE, BM_SETCHECK, nppGUI._writeTechnologyEngine == directWriteTechnology, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLEDOCPEEKER, BM_SETCHECK, nppGUI._isDocPeekOnTab ? BST_CHECKED : BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLEDOCPEEKONMAP, BM_SETCHECK, nppGUI._isDocPeekOnMap ? BST_CHECKED : BST_UNCHECKED, 0); @@ -1065,8 +1065,8 @@ INT_PTR CALLBACK MiscSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) nppGUI._autoUpdateOpt._doAutoUpdate = isCheckedOrNot(static_cast(wParam)); return TRUE; - case IDC_CHECK_SAVEDLGEXTFILTALLTYPESFORNORMTEXT: - nppGUI._setSaveDlgExtFiltToAllTypesForNormText = isCheckedOrNot(static_cast(wParam)); + case IDC_CHECK_SAVEDLGEXTFILTALLTYPES: + nppGUI._setSaveDlgExtFiltToAllTypes = isCheckedOrNot(static_cast(wParam)); return TRUE; case IDC_CHECK_MIN2SYSTRAY: diff --git a/PowerEditor/src/WinControls/Preference/preference_rc.h b/PowerEditor/src/WinControls/Preference/preference_rc.h index 52a5e2901..749242ae8 100644 --- a/PowerEditor/src/WinControls/Preference/preference_rc.h +++ b/PowerEditor/src/WinControls/Preference/preference_rc.h @@ -204,7 +204,7 @@ #define IDC_CHECK_SMARTHILITEWHOLEWORDONLY (IDD_PREFERENCE_SUB_MISC + 38) #define IDC_CHECK_SMARTHILITEUSEFINDSETTINGS (IDD_PREFERENCE_SUB_MISC + 39) #define IDC_CHECK_SMARTHILITEANOTHERRVIEW (IDD_PREFERENCE_SUB_MISC + 40) - #define IDC_CHECK_SAVEDLGEXTFILTALLTYPESFORNORMTEXT (IDD_PREFERENCE_SUB_MISC + 51) + #define IDC_CHECK_SAVEDLGEXTFILTALLTYPES (IDD_PREFERENCE_SUB_MISC + 51) //-- xFileEditViewHistoryParameterGUI: Additional Checkbox for enabling the history for restoring the edit view per file. #define IDC_CHECK_REMEMBEREDITVIEWPERFILE (IDD_PREFERENCE_SUB_MISC + 41)