mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-25 14:54:39 +02:00
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());
|
int langTypeIndex = setFileOpenSaveDlgFilters(fDlg, false, buf->getLangType());
|
||||||
fDlg.setDefFileName(buf->getFileName());
|
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.
|
// Disable file autodetection before opening save dialog to prevent use-after-delete bug.
|
||||||
NppParameters& nppParam = NppParameters::getInstance();
|
NppParameters& nppParam = NppParameters::getInstance();
|
||||||
@ -1828,7 +1828,8 @@ bool Notepad_plus::isFileSession(const TCHAR * filename)
|
|||||||
return false;
|
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
|
// 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();
|
const TCHAR *definedWorkspaceExt = NppParameters::getInstance().getNppGUI()._definedWorkspaceExt.c_str();
|
||||||
if (*definedWorkspaceExt != '\0')
|
if (*definedWorkspaceExt != '\0')
|
||||||
|
@ -35,8 +35,7 @@
|
|||||||
|
|
||||||
FileDialog *FileDialog::staticThis = NULL;
|
FileDialog *FileDialog::staticThis = NULL;
|
||||||
|
|
||||||
FileDialog::FileDialog(HWND hwnd, HINSTANCE hInst)
|
FileDialog::FileDialog(HWND hwnd, HINSTANCE hInst)
|
||||||
: _nbCharFileExt(0), _nbExt(0), _fileExt(NULL), _extTypeIndex(-1)
|
|
||||||
{
|
{
|
||||||
staticThis = this;
|
staticThis = this;
|
||||||
|
|
||||||
@ -269,6 +268,8 @@ TCHAR * FileDialog::doSaveDlg()
|
|||||||
NppParameters& params = NppParameters::getInstance();
|
NppParameters& params = NppParameters::getInstance();
|
||||||
_ofn.lpstrInitialDir = params.getWorkingDir();
|
_ofn.lpstrInitialDir = params.getWorkingDir();
|
||||||
_ofn.lpstrDefExt = _defExt.c_str();
|
_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;
|
_ofn.Flags |= OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_ENABLESIZING;
|
||||||
|
|
||||||
|
@ -66,16 +66,16 @@ private:
|
|||||||
TCHAR _fileName[MAX_PATH*8];
|
TCHAR _fileName[MAX_PATH*8];
|
||||||
generic_string _defExt;
|
generic_string _defExt;
|
||||||
|
|
||||||
TCHAR * _fileExt;
|
TCHAR * _fileExt = nullptr;
|
||||||
int _nbCharFileExt;
|
int _nbCharFileExt = 0;
|
||||||
|
|
||||||
stringVector _fileNames;
|
stringVector _fileNames;
|
||||||
|
|
||||||
OPENFILENAME _ofn;
|
OPENFILENAME _ofn;
|
||||||
winVer _winVersion;
|
winVer _winVersion;
|
||||||
|
|
||||||
int _nbExt;
|
int _nbExt = 0;
|
||||||
int _extTypeIndex;
|
int _extTypeIndex = -1;
|
||||||
static FileDialog *staticThis;
|
static FileDialog *staticThis;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user