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"));
if (optNameBackSlashEscape && !lstrcmp(optNameBackSlashEscape, TEXT("no")))
_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");
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")))
{
@ -5648,6 +5656,7 @@ bool NppParameters::writeGUIParams()
GUIConfigElement->SetAttribute(TEXT("fileSwitcherWithoutExtColumn"), _nppGUI._fileSwitcherWithoutExtColumn?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);
return true;

View File

@ -843,34 +843,29 @@ struct NppGUI final
size_t _snapshotBackupTiming = 7000;
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
bool _useNewStyleSaveDlg = false;
};
struct ScintillaViewParams
{
ScintillaViewParams() : _lineNumberMarginShow(true), _bookMarkMarginShow(true),_borderWidth(2),\
_folderStyle(FOLDER_STYLE_BOX), _foldMarginShow(true), _indentGuideLineShow(true),\
_currentLineHilitingShow(true), _wrapSymbolShow(false), _doWrap(false), _edgeNbColumn(80),\
_zoom(0), _zoom2(0), _whiteSpaceShow(false), _eolShow(false), _lineWrapMethod(LINEWRAP_ALIGNED),\
_disableAdvancedScrolling(false), _doSmoothFont(false) {};
bool _lineNumberMarginShow;
bool _bookMarkMarginShow;
//bool _docChangeStateMarginShow;
folderStyle _folderStyle; //"simple", "arrow", "circle", "box" and "none"
lineWrapMethod _lineWrapMethod;
bool _foldMarginShow;
bool _indentGuideLineShow;
bool _currentLineHilitingShow;
bool _wrapSymbolShow;
bool _doWrap;
int _edgeMode;
int _edgeNbColumn;
int _zoom;
int _zoom2;
bool _whiteSpaceShow;
bool _lineNumberMarginShow = true;
bool _bookMarkMarginShow = true;
folderStyle _folderStyle = FOLDER_STYLE_BOX; //"simple", "arrow", "circle", "box" and "none"
lineWrapMethod _lineWrapMethod = LINEWRAP_ALIGNED;
bool _foldMarginShow = true;
bool _indentGuideLineShow = true;
bool _currentLineHilitingShow = true;
bool _wrapSymbolShow = false;
bool _doWrap = false;
int _edgeMode = EDGE_NONE;
int _edgeNbColumn = 80;
int _zoom = 0;
int _zoom2 = 0;
bool _whiteSpaceShow = false;
bool _eolShow;
int _borderWidth;
bool _disableAdvancedScrolling;
bool _doSmoothFont;
int _borderWidth = 2;
bool _disableAdvancedScrolling = false;
bool _doSmoothFont = false;
};
const int NB_LIST = 20;
@ -1564,6 +1559,13 @@ public:
_currentDefaultFgColor = c;
}
bool useNewStyleSaveDlg() const {
return _nppGUI._useNewStyleSaveDlg;
}
void setUseNewStyleSaveDlg(bool v) {
_nppGUI._useNewStyleSaveDlg = v;
}
DPIManager _dpiManager;

View File

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

View File

@ -186,6 +186,8 @@ BEGIN
CONTROL "",IDC_OPENSAVEDIR_ALWAYSON_RADIO,"Button",BS_AUTORADIOBUTTON,118,89,11,10
EDITTEXT IDC_OPENSAVEDIR_ALWAYSON_EDIT,134,88,179,14,ES_AUTOHSCROLL
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
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();
if (enableDlgTheme)
enableDlgTheme(_hSelf, ETDT_ENABLETAB);
::SendDlgItemMessage(_hSelf, IDC_OPENSAVEDIR_CHECK_USENEWSTYLESAVEDIALOG, BM_SETCHECK, nppGUI._useNewStyleSaveDlg ? BST_CHECKED : BST_UNCHECKED, 0);
}
case WM_COMMAND :
@ -1373,6 +1375,10 @@ INT_PTR CALLBACK DefaultDirectoryDlg::run_dlgProc(UINT Message, WPARAM wParam, L
folderBrowser(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT);
return TRUE;
case IDC_OPENSAVEDIR_CHECK_USENEWSTYLESAVEDIALOG:
nppGUI._useNewStyleSaveDlg = isCheckedOrNot(IDC_OPENSAVEDIR_CHECK_USENEWSTYLESAVEDIALOG);
return TRUE;
default:
return FALSE;
}

View File

@ -207,6 +207,7 @@
#define IDC_RADIO_CUSTOMIZELENTH (IDD_PREFERENCE_NEWDOCSETTING_BOX + 27)
#define IDC_CUSTOMIZELENGTHVAL_STATIC (IDD_PREFERENCE_NEWDOCSETTING_BOX + 28)
#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_RECENTFILESHISTORY_BOX 6460 //(IDD_PREFERENCE_BOX + 400)