Add preference for save type of normal text files
Fix #8866, close #8948
This commit is contained in:
parent
c306555db4
commit
bbde64c308
@ -1020,6 +1020,7 @@ You can define several column markers by using white space to separate the diffe
|
||||
<Item id="6320" name="No underline"/>
|
||||
<Item id="6322" name="Session file ext.:"/>
|
||||
<Item id="6323" name="Enable Notepad++ auto-updater"/>
|
||||
<Item id="6351" name="Set Save dialog file extension filter to .* instead of .txt for Normal Text"/>
|
||||
<Item id="6324" name="Document Switcher (Ctrl+TAB)"/>
|
||||
<Item id="6331" name="Show only filename in title bar"/>
|
||||
<Item id="6334" name="Autodetect character encoding"/>
|
||||
|
@ -1647,11 +1647,20 @@ bool Notepad_plus::fileSaveAs(BufferID id, bool isSaveCopy)
|
||||
|
||||
FileDialog fDlg(_pPublicInterface->getHSelf(), _pPublicInterface->getHinst());
|
||||
|
||||
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
|
||||
int langTypeIndex = setFileOpenSaveDlgFilters(fDlg, false, buf->getLangType());
|
||||
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
|
||||
|
||||
LangType langType = buf->getLangType();
|
||||
|
||||
int langTypeIndex = 0;
|
||||
if (!((NppParameters::getInstance()).getNppGUI()._setSaveDlgExtFiltToAllTypesForNormText &&
|
||||
buf->isUntitled() && langType == L_TEXT))
|
||||
{
|
||||
langTypeIndex = setFileOpenSaveDlgFilters(fDlg, false, langType);
|
||||
}
|
||||
|
||||
fDlg.setDefFileName(buf->getFileName());
|
||||
|
||||
fDlg.setExtIndex(langTypeIndex + 1); // +1 for "All types"
|
||||
fDlg.setExtIndex(langTypeIndex + 1); // +1 for "All types"
|
||||
|
||||
// Disable file autodetection before opening save dialog to prevent use-after-delete bug.
|
||||
NppParameters& nppParam = NppParameters::getInstance();
|
||||
|
@ -5220,6 +5220,10 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
const TCHAR * optDocPeekOnMap = element->Attribute(TEXT("docPeekOnMap"));
|
||||
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);
|
||||
}
|
||||
else if (!lstrcmp(nm, TEXT("commandLineInterpreter")))
|
||||
{
|
||||
@ -5989,7 +5993,7 @@ void NppParameters::createXmlTreeFromGUIParams()
|
||||
GUIConfigElement->SetAttribute(TEXT("setting"), _nppGUI._multiInstSetting);
|
||||
}
|
||||
|
||||
// <GUIConfig name="MISC" fileSwitcherWithoutExtColumn="no" backSlashIsEscapeCharacterForSql="yes" newStyleSaveDlg="no" isFolderDroppedOpenFiles="no" />
|
||||
// <GUIConfig name="MISC" fileSwitcherWithoutExtColumn="no" backSlashIsEscapeCharacterForSql="yes" newStyleSaveDlg="no" isFolderDroppedOpenFiles="no" saveDlgExtFilterToAllTypesForNormalText="no" />
|
||||
{
|
||||
TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement();
|
||||
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("MISC"));
|
||||
@ -6001,6 +6005,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"));
|
||||
}
|
||||
|
||||
// <GUIConfig name="Searching" "monospacedFontFindDlg"="no" stopFillingFindField="no" findDlgAlwaysVisible="no" confirmReplaceOpenDocs="yes" confirmMacroReplaceOpenDocs="yes" confirmReplaceInFiles="yes" confirmMacroReplaceInFiles="yes" />
|
||||
|
@ -822,6 +822,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 _doTaskList = true;
|
||||
bool _maitainIndent = true;
|
||||
bool _enableSmartHilite = true;
|
||||
|
@ -122,9 +122,10 @@ BEGIN
|
||||
CONTROL "Enable MRU behaviour",IDC_CHECK_STYLEMRU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,28,140,10
|
||||
CONTROL "Peek on tab",IDC_CHECK_ENABLEDOCPEEKER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,58,140,10
|
||||
CONTROL "Peek on document map", IDC_CHECK_ENABLEDOCPEEKONMAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,71,140,10
|
||||
|
||||
|
||||
// "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,128,217,10
|
||||
CONTROL "Enable Notepad++ auto-updater",IDC_CHECK_AUTOUPDATE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,113,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,128,267,10
|
||||
CONTROL "Autodetect character encoding",IDC_CHECK_DETECTENCODING, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,143,217,10
|
||||
CONTROL "Minimize to system tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,158,217,10
|
||||
CONTROL "Show only filename in title bar",IDC_CHECK_SHORTTITLE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,173,217,10
|
||||
|
@ -922,7 +922,8 @@ INT_PTR CALLBACK SettingsDlg::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_AUTOUPDATE, BM_SETCHECK, nppGUI._autoUpdateOpt._doAutoUpdate, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_SAVEDLGEXTFILTALLTYPESFORNORMTEXT, BM_SETCHECK, nppGUI._setSaveDlgExtFiltToAllTypesForNormText, 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);
|
||||
@ -1040,6 +1041,10 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
|
||||
nppGUI._autoUpdateOpt._doAutoUpdate = isCheckedOrNot(static_cast<int32_t>(wParam));
|
||||
return TRUE;
|
||||
|
||||
case IDC_CHECK_SAVEDLGEXTFILTALLTYPESFORNORMTEXT:
|
||||
nppGUI._setSaveDlgExtFiltToAllTypesForNormText = isCheckedOrNot(static_cast<int32_t>(wParam));
|
||||
return TRUE;
|
||||
|
||||
case IDC_CHECK_MIN2SYSTRAY:
|
||||
nppGUI._isMinimizedToTray = isCheckedOrNot(static_cast<int32_t>(wParam));
|
||||
return TRUE;
|
||||
|
@ -199,7 +199,8 @@
|
||||
#define IDC_CHECK_SMARTHILITEWHOLEWORDONLY (IDD_PREFERENCE_SETTING_BOX + 38)
|
||||
#define IDC_CHECK_SMARTHILITEUSEFINDSETTINGS (IDD_PREFERENCE_SETTING_BOX + 39)
|
||||
#define IDC_CHECK_SMARTHILITEANOTHERRVIEW (IDD_PREFERENCE_SETTING_BOX + 40)
|
||||
|
||||
#define IDC_CHECK_SAVEDLGEXTFILTALLTYPESFORNORMTEXT (IDD_PREFERENCE_SETTING_BOX + 51)
|
||||
|
||||
//-- xFileEditViewHistoryParameterGUI: Additional Checkbox for enabling the history for restoring the edit view per file.
|
||||
#define IDC_CHECK_REMEMBEREDITVIEWPERFILE (IDD_PREFERENCE_SETTING_BOX + 41)
|
||||
#define IDC_REMEMBEREDITVIEWPERFILE_STATIC (IDD_PREFERENCE_SETTING_BOX + 42)
|
||||
|
Loading…
Reference in New Issue
Block a user