Improve save (new style) dialog by adding file extension automatically
1. Add file extension automatically while changing file type via combobox in new style dialog. 2. Add file extension automatically for session files and workspace files while saving in new style dialog. Fix #4876, close #8311, close #8312pull/5785/head
parent
bb6b24ce50
commit
edd746d310
|
@ -2217,6 +2217,7 @@ const TCHAR * Notepad_plus::fileSaveSession(size_t nbFile, TCHAR ** fileNames)
|
|||
sessionExt += TEXT(".");
|
||||
sessionExt += ext;
|
||||
fDlg.setExtFilter(TEXT("Session file"), sessionExt.c_str(), NULL);
|
||||
fDlg.setDefExt(ext);
|
||||
fDlg.setExtIndex(0); // 0 index for "custom extension types"
|
||||
}
|
||||
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
|
||||
|
|
|
@ -267,6 +267,7 @@ TCHAR * FileDialog::doSaveDlg()
|
|||
|
||||
NppParameters& params = NppParameters::getInstance();
|
||||
_ofn.lpstrInitialDir = params.getWorkingDir();
|
||||
_ofn.lpstrDefExt = _defExt.c_str();
|
||||
|
||||
_ofn.Flags |= OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_ENABLESIZING;
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ public:
|
|||
|
||||
int setExtsFilter(const TCHAR *extText, const TCHAR *exts);
|
||||
void setDefFileName(const TCHAR *fn){ wcscpy_s(_fileName, fn);}
|
||||
void setDefExt(const TCHAR *ext){ _defExt = ext;}
|
||||
|
||||
TCHAR * doSaveDlg();
|
||||
stringVector * doOpenMultiFilesDlg();
|
||||
|
@ -63,6 +64,7 @@ protected :
|
|||
|
||||
private:
|
||||
TCHAR _fileName[MAX_PATH*8];
|
||||
generic_string _defExt;
|
||||
|
||||
TCHAR * _fileExt;
|
||||
int _nbCharFileExt;
|
||||
|
|
|
@ -1188,6 +1188,7 @@ void ProjectPanel::setFileExtFilter(FileDialog & fDlg)
|
|||
workspaceExt += TEXT(".");
|
||||
workspaceExt += ext;
|
||||
fDlg.setExtFilter(TEXT("Workspace file"), workspaceExt.c_str(), NULL);
|
||||
fDlg.setDefExt(ext);
|
||||
}
|
||||
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue