finally implement file name hint on NFD (Windows)
for "auto-fill file name when saving"
This commit is contained in:
parent
0f5adae785
commit
ab006d5d78
2 changed files with 39 additions and 10 deletions
27
extern/nfd-modified/src/nfd_win.cpp
vendored
27
extern/nfd-modified/src/nfd_win.cpp
vendored
|
|
@ -466,6 +466,15 @@ nfdresult_t NFD_OpenDialog( const std::vector<std::string>& filterList,
|
|||
goto end;
|
||||
}
|
||||
|
||||
// Set the file name
|
||||
if (defaultFileName!=NULL) {
|
||||
std::wstring defFileName=utf8To16(defaultFileName);
|
||||
result = fileOpenDialog->SetFileName(defFileName.c_str());
|
||||
if ( !SUCCEEDED(result) ) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
// Pass the callback
|
||||
winEvents=new NFDWinEvents(selCallback);
|
||||
if ( !SUCCEEDED(fileOpenDialog->Advise(winEvents,&eventID)) ) {
|
||||
|
|
@ -577,6 +586,15 @@ nfdresult_t NFD_OpenDialogMultiple( const std::vector<std::string>& filterList,
|
|||
goto end;
|
||||
}
|
||||
|
||||
// Set the file name
|
||||
if (defaultFileName!=NULL) {
|
||||
std::wstring defFileName=utf8To16(defaultFileName);
|
||||
result = fileOpenDialog->SetFileName(defFileName.c_str());
|
||||
if ( !SUCCEEDED(result) ) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
// Pass the callback
|
||||
winEvents=new NFDWinEvents(selCallback);
|
||||
if ( !SUCCEEDED(fileOpenDialog->Advise(winEvents,&eventID)) ) {
|
||||
|
|
@ -686,6 +704,15 @@ nfdresult_t NFD_SaveDialog( const std::vector<std::string>& filterList,
|
|||
goto end;
|
||||
}
|
||||
|
||||
// Set the file name
|
||||
if (defaultFileName!=NULL) {
|
||||
std::wstring defFileName=utf8To16(defaultFileName);
|
||||
result = fileSaveDialog->SetFileName(defFileName.c_str());
|
||||
if ( !SUCCEEDED(result) ) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
// Set a flag for no history
|
||||
DWORD dwFlags;
|
||||
result = fileSaveDialog->GetOptions(&dwFlags);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue