X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ad81651f00edc6f489d9b6a0839d316a964fd521..1a787c5dc89b1cb6a9ddb4ebef3ad2fb24b49c8c:/src/msw/filedlg.cpp diff --git a/src/msw/filedlg.cpp b/src/msw/filedlg.cpp index bd3fa99176..a96c48e52b 100644 --- a/src/msw/filedlg.cpp +++ b/src/msw/filedlg.cpp @@ -15,35 +15,34 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" +#include "wx/msw/private.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP - #include - #include "wx/defs.h" #include "wx/utils.h" #include "wx/msgdlg.h" #include "wx/dialog.h" #include "wx/filedlg.h" #include "wx/intl.h" #include "wx/log.h" -#endif -#include +// #include "wx/msw/private.h" +#endif #if !defined(__WIN32__) || defined(__SALFORDC__) || defined(__WXWINE__) #include #endif -#include "wx/msw/private.h" - #include #include #include - IMPLEMENT_CLASS(wxFileDialog, wxDialog) +#include "wx/tokenzr.h" + +IMPLEMENT_CLASS(wxFileDialog, wxDialog) wxString wxFileSelector(const wxChar *title, const wxChar *defaultDir, @@ -295,7 +294,7 @@ int wxFileDialog::ShowModal() } of.lpstrFilter = (LPTSTR)(const wxChar *)filterBuffer; - of.nFilterIndex = m_filterIndex; + of.nFilterIndex = m_filterIndex + 1; //=== Setting defaultFileName >>========================================= @@ -356,9 +355,9 @@ int wxFileDialog::ShowModal() //=== Adding the correct extension >>================================= - m_filterIndex = (int)of.nFilterIndex; + m_filterIndex = (int)of.nFilterIndex - 1; - if ( of.nFileExtension && fileNameBuffer[ of.nFileExtension-1] != wxT('.') ) + if ( !of.nFileExtension || (of.nFileExtension && fileNameBuffer[ of.nFileExtension-1] != wxT('.')) ) { // user has typed an filename // without an extension: