#pragma hdrstop
#endif
+#if wxUSE_FILEDLG
+
#ifndef WX_PRECOMP
#include "wx/utils.h"
#include "wx/msgdlg.h"
flags, wxPoint(x, y));
if( wxStrlen(defaultExtension) != 0 )
{
- int filterFind = 1,
+ int filterFind = 0,
filterIndex = 0;
for( unsigned int i = 0; i < filter2.Len(); i++ )
{
// save the start index of the new filter
unsigned int is = i++;
- filterIndex++;
// find the end of the filter
for( ; i < filter2.Len(); i++ )
if( i-is-1 > 0 && is+1 < filter2.Len() )
{
if( filter2.Mid(is+1,i-is-1).Contains(defaultExtension) )
-// if( filter2.Mid(is+1,i-is-1) == defaultExtension )
{
filterFind = filterIndex;
break;
}
}
+
+ filterIndex++;
}
}
wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
- long style, const wxPoint& pos)
+ long style, const wxPoint& WXUNUSED(pos))
{
m_message = message;
m_dialogStyle = style;
//== Execute FileDialog >>=================================================
- bool success = (m_dialogStyle & wxSAVE) ? (GetSaveFileName(&of) != 0)
- : (GetOpenFileName(&of) != 0);
+ bool success = (m_dialogStyle & wxSAVE ? GetSaveFileName(&of)
+ : GetOpenFileName(&of)) != 0;
DWORD errCode = CommDlgExtendedError();
const wxChar *default_name,
wxWindow *parent)
{
- wxString prompt;
- wxString str;
- if (load) str = _("Load %s file");
- else str = _("Save %s file");
- prompt.Printf(str, what);
+ wxString prompt;
+ wxString str;
+ if (load)
+ str = _("Load %s file");
+ else
+ str = _("Save %s file");
+ prompt.Printf(str, what);
- const wxChar *ext = extension;
- if (*ext == wxT('.'))
- ext++;
+ const wxChar *ext = extension;
+ if (*ext == wxT('.'))
+ ext++;
- wxString wild;
- wild.Printf(wxT("*.%s"), ext);
+ wxString wild;
+ wild.Printf(wxT("*.%s"), ext);
- return wxFileSelector (prompt, NULL, default_name, ext, wild, 0, parent);
+ return wxFileSelector(prompt, NULL, default_name, ext, wild,
+ load ? wxOPEN : wxSAVE, parent);
}
// Generic file load dialog
return wxDefaultFileSelector(FALSE, what, extension, default_name, parent);
}
+#endif // wxUSE_FILEDLG