From 186545a42fd028d70b24b9767e37f41b59bf0e2e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 20 Apr 2004 23:07:13 +0000 Subject: [PATCH] replaced generic automatic filter string by 2 different ones for all files and all files with the given extension git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26890 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/fldlgcmn.cpp | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/src/common/fldlgcmn.cpp b/src/common/fldlgcmn.cpp index 6003bc9449..a6431eba63 100644 --- a/src/common/fldlgcmn.cpp +++ b/src/common/fldlgcmn.cpp @@ -43,24 +43,39 @@ wxFileDialogBase::wxFileDialogBase(wxWindow *parent, const wxString& wildCard, long style, const wxPoint& WXUNUSED(pos)) + : m_message(message), + m_dir(defaultDir), + m_fileName(defaultFile) { m_parent = parent; - m_message = message; - m_dir = defaultDir; - m_fileName = defaultFile; - if (wildCard.IsEmpty()) - m_wildCard = wxFileSelectorDefaultWildcardStr; - else - m_wildCard = wildCard ; m_dialogStyle = style; - m_path = wxT(""); m_filterIndex = 0; - // convert m_wildCard from "*.bar" to "Files (*.bar)|*.bar" - if ( m_wildCard.Find(wxT('|')) == wxNOT_FOUND ) + if ( wildCard.empty() ) { - m_wildCard = wxString::Format(_("Files (%s)|%s"), - m_wildCard.c_str(), m_wildCard.c_str()); + m_wildCard = wxString::Format(_("All files (%s)|%s"), + wxFileSelectorDefaultWildcardStr, + wxFileSelectorDefaultWildcardStr); + } + else // have wild card + { + // convert m_wildCard from "*.bar" to "bar files (*.bar)|*.bar" + if ( m_wildCard.Find(wxT('|')) == wxNOT_FOUND ) + { + wxString::size_type nDot = m_wildCard.find(_T("*.")); + if ( nDot != wxString::npos ) + nDot++; + else + nDot = 0; + + m_wildCard = wxString::Format + ( + _("%s files (%s)|%s"), + m_wildCard.c_str() + nDot, + m_wildCard.c_str(), + m_wildCard.c_str() + ); + } } } -- 2.45.2