Restore file extension feature in save dialog

Fixes #1159, fixes #1129
Restore file extension feature in save dialog: make new style save
dialog optional (without file extension feature).
This commit is contained in:
Don Ho 2015-11-26 19:09:40 +01:00
parent 89cd163cca
commit b61170d669
6 changed files with 48 additions and 25 deletions

View File

@ -4594,6 +4594,11 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
const TCHAR * optNameBackSlashEscape = element->Attribute(TEXT("backSlashIsEscapeCharacterForSql")); const TCHAR * optNameBackSlashEscape = element->Attribute(TEXT("backSlashIsEscapeCharacterForSql"));
if (optNameBackSlashEscape && !lstrcmp(optNameBackSlashEscape, TEXT("no"))) if (optNameBackSlashEscape && !lstrcmp(optNameBackSlashEscape, TEXT("no")))
_nppGUI._backSlashIsEscapeCharacterForSql = false; _nppGUI._backSlashIsEscapeCharacterForSql = false;
const TCHAR * optNameNewStyleSaveDlg = element->Attribute(TEXT("newStyleSaveDlg"));
if (optNameNewStyleSaveDlg && !lstrcmp(optNameNewStyleSaveDlg, TEXT("yes")))
_nppGUI._useNewStyleSaveDlg = true;
} }
} }
} }
@ -5337,6 +5342,9 @@ bool NppParameters::writeGUIParams()
const TCHAR * pStrBackSlashEscape = _nppGUI._backSlashIsEscapeCharacterForSql ? TEXT("yes") : TEXT("no"); const TCHAR * pStrBackSlashEscape = _nppGUI._backSlashIsEscapeCharacterForSql ? TEXT("yes") : TEXT("no");
element->SetAttribute(TEXT("backSlashIsEscapeCharacterForSql"), pStrBackSlashEscape); element->SetAttribute(TEXT("backSlashIsEscapeCharacterForSql"), pStrBackSlashEscape);
const TCHAR * pStrNewStyleSaveDlg = _nppGUI._useNewStyleSaveDlg ? TEXT("yes") : TEXT("no");
element->SetAttribute(TEXT("newStyleSaveDlg"), pStrNewStyleSaveDlg);
} }
else if (!lstrcmp(nm, TEXT("sessionExt"))) else if (!lstrcmp(nm, TEXT("sessionExt")))
{ {
@ -5648,6 +5656,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"));
} }
insertDockingParamNode(GUIRoot); insertDockingParamNode(GUIRoot);
return true; return true;

View File

@ -843,34 +843,29 @@ struct NppGUI final
size_t _snapshotBackupTiming = 7000; size_t _snapshotBackupTiming = 7000;
generic_string _cloudPath; // this option will never be read/written from/to config.xml generic_string _cloudPath; // this option will never be read/written from/to config.xml
unsigned char _availableClouds = '\0'; // this option will never be read/written from/to config.xml unsigned char _availableClouds = '\0'; // this option will never be read/written from/to config.xml
bool _useNewStyleSaveDlg = false;
}; };
struct ScintillaViewParams struct ScintillaViewParams
{ {
ScintillaViewParams() : _lineNumberMarginShow(true), _bookMarkMarginShow(true),_borderWidth(2),\ bool _lineNumberMarginShow = true;
_folderStyle(FOLDER_STYLE_BOX), _foldMarginShow(true), _indentGuideLineShow(true),\ bool _bookMarkMarginShow = true;
_currentLineHilitingShow(true), _wrapSymbolShow(false), _doWrap(false), _edgeNbColumn(80),\ folderStyle _folderStyle = FOLDER_STYLE_BOX; //"simple", "arrow", "circle", "box" and "none"
_zoom(0), _zoom2(0), _whiteSpaceShow(false), _eolShow(false), _lineWrapMethod(LINEWRAP_ALIGNED),\ lineWrapMethod _lineWrapMethod = LINEWRAP_ALIGNED;
_disableAdvancedScrolling(false), _doSmoothFont(false) {}; bool _foldMarginShow = true;
bool _lineNumberMarginShow; bool _indentGuideLineShow = true;
bool _bookMarkMarginShow; bool _currentLineHilitingShow = true;
//bool _docChangeStateMarginShow; bool _wrapSymbolShow = false;
folderStyle _folderStyle; //"simple", "arrow", "circle", "box" and "none" bool _doWrap = false;
lineWrapMethod _lineWrapMethod; int _edgeMode = EDGE_NONE;
bool _foldMarginShow; int _edgeNbColumn = 80;
bool _indentGuideLineShow; int _zoom = 0;
bool _currentLineHilitingShow; int _zoom2 = 0;
bool _wrapSymbolShow; bool _whiteSpaceShow = false;
bool _doWrap;
int _edgeMode;
int _edgeNbColumn;
int _zoom;
int _zoom2;
bool _whiteSpaceShow;
bool _eolShow; bool _eolShow;
int _borderWidth; int _borderWidth = 2;
bool _disableAdvancedScrolling; bool _disableAdvancedScrolling = false;
bool _doSmoothFont; bool _doSmoothFont = false;
}; };
const int NB_LIST = 20; const int NB_LIST = 20;
@ -1564,6 +1559,13 @@ public:
_currentDefaultFgColor = c; _currentDefaultFgColor = c;
} }
bool useNewStyleSaveDlg() const {
return _nppGUI._useNewStyleSaveDlg;
}
void setUseNewStyleSaveDlg(bool v) {
_nppGUI._useNewStyleSaveDlg = v;
}
DPIManager _dpiManager; DPIManager _dpiManager;

View File

@ -254,8 +254,11 @@ TCHAR * FileDialog::doSaveDlg()
_ofn.Flags |= OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_ENABLESIZING; _ofn.Flags |= OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_ENABLESIZING;
//_ofn.Flags |= OFN_ENABLEHOOK; if (!params->useNewStyleSaveDlg())
//_ofn.lpfnHook = OFNHookProc; {
_ofn.Flags |= OFN_ENABLEHOOK;
_ofn.lpfnHook = OFNHookProc;
}
TCHAR *fn = NULL; TCHAR *fn = NULL;
try { try {

View File

@ -186,6 +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,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,145,250,10
END END
IDD_PREFERENCE_RECENTFILESHISTORY_BOX DIALOGEX 0, 0, 455, 185 IDD_PREFERENCE_RECENTFILESHISTORY_BOX DIALOGEX 0, 0, 455, 185

View File

@ -1331,6 +1331,8 @@ INT_PTR CALLBACK DefaultDirectoryDlg::run_dlgProc(UINT Message, WPARAM wParam, L
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture(); ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture();
if (enableDlgTheme) if (enableDlgTheme)
enableDlgTheme(_hSelf, ETDT_ENABLETAB); enableDlgTheme(_hSelf, ETDT_ENABLETAB);
::SendDlgItemMessage(_hSelf, IDC_OPENSAVEDIR_CHECK_USENEWSTYLESAVEDIALOG, BM_SETCHECK, nppGUI._useNewStyleSaveDlg ? BST_CHECKED : BST_UNCHECKED, 0);
} }
case WM_COMMAND : case WM_COMMAND :
@ -1373,6 +1375,10 @@ INT_PTR CALLBACK DefaultDirectoryDlg::run_dlgProc(UINT Message, WPARAM wParam, L
folderBrowser(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT); folderBrowser(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT);
return TRUE; return TRUE;
case IDC_OPENSAVEDIR_CHECK_USENEWSTYLESAVEDIALOG:
nppGUI._useNewStyleSaveDlg = isCheckedOrNot(IDC_OPENSAVEDIR_CHECK_USENEWSTYLESAVEDIALOG);
return TRUE;
default: default:
return FALSE; return FALSE;
} }

View File

@ -207,6 +207,7 @@
#define IDC_RADIO_CUSTOMIZELENTH (IDD_PREFERENCE_NEWDOCSETTING_BOX + 27) #define IDC_RADIO_CUSTOMIZELENTH (IDD_PREFERENCE_NEWDOCSETTING_BOX + 27)
#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 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)