Improve new style save file dialog
The right file extension (which correspond to document type) is selected while saving a new file in the new style save file dialog.
This commit is contained in:
parent
fa51c2af6e
commit
69ef27b654
|
@ -1593,7 +1593,7 @@ bool Notepad_plus::fileSaveAs(BufferID id, bool isSaveCopy)
|
|||
int langTypeIndex = setFileOpenSaveDlgFilters(fDlg, false, buf->getLangType());
|
||||
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();
|
||||
|
@ -1828,7 +1828,8 @@ bool Notepad_plus::isFileSession(const TCHAR * filename)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Notepad_plus::isFileWorkspace(const TCHAR * filename) {
|
||||
bool Notepad_plus::isFileWorkspace(const TCHAR * filename)
|
||||
{
|
||||
// if filename matches the ext of user defined workspace file ext, then it'll be opened as a workspace
|
||||
const TCHAR *definedWorkspaceExt = NppParameters::getInstance().getNppGUI()._definedWorkspaceExt.c_str();
|
||||
if (*definedWorkspaceExt != '\0')
|
||||
|
|
|
@ -35,8 +35,7 @@
|
|||
|
||||
FileDialog *FileDialog::staticThis = NULL;
|
||||
|
||||
FileDialog::FileDialog(HWND hwnd, HINSTANCE hInst)
|
||||
: _nbCharFileExt(0), _nbExt(0), _fileExt(NULL), _extTypeIndex(-1)
|
||||
FileDialog::FileDialog(HWND hwnd, HINSTANCE hInst)
|
||||
{
|
||||
staticThis = this;
|
||||
|
||||
|
@ -269,6 +268,8 @@ TCHAR * FileDialog::doSaveDlg()
|
|||
NppParameters& params = NppParameters::getInstance();
|
||||
_ofn.lpstrInitialDir = params.getWorkingDir();
|
||||
_ofn.lpstrDefExt = _defExt.c_str();
|
||||
if (_extTypeIndex != -1)
|
||||
_ofn.nFilterIndex = _extTypeIndex + 1; // +1 for the file extension combobox index starts from 1
|
||||
|
||||
_ofn.Flags |= OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_ENABLESIZING;
|
||||
|
||||
|
|
|
@ -66,16 +66,16 @@ private:
|
|||
TCHAR _fileName[MAX_PATH*8];
|
||||
generic_string _defExt;
|
||||
|
||||
TCHAR * _fileExt;
|
||||
int _nbCharFileExt;
|
||||
TCHAR * _fileExt = nullptr;
|
||||
int _nbCharFileExt = 0;
|
||||
|
||||
stringVector _fileNames;
|
||||
|
||||
OPENFILENAME _ofn;
|
||||
winVer _winVersion;
|
||||
|
||||
int _nbExt;
|
||||
int _extTypeIndex;
|
||||
int _nbExt = 0;
|
||||
int _extTypeIndex = -1;
|
||||
static FileDialog *staticThis;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue