]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/fldlgcmn.cpp
removed invalid restriction
[wxWidgets.git] / src / common / fldlgcmn.cpp
index 512c5a3a70f156181cabc82644fba4d403a616ec..c9d8e15494ec59745c43c6436ba8db78329df270 100644 (file)
@@ -9,7 +9,7 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation "filedlg.h"
 #endif
 
@@ -42,25 +42,41 @@ wxFileDialogBase::wxFileDialogBase(wxWindow *parent,
                                    const wxString& defaultFile,
                                    const wxString& wildCard,
                                    long style,
-                                   const wxPoint& pos)
+                                   const wxPoint& WXUNUSED(pos))
+                : m_message(message),
+                  m_dir(defaultDir),
+                  m_fileName(defaultFile),
+                  m_wildCard(wildCard)
 {
     m_parent = parent;
-    m_message = message;
-    m_dir = defaultDir;
-    m_fileName = defaultFile;
-    m_wildCard = wildCard;
     m_dialogStyle = style;
-    m_path = wxT("");
     m_filterIndex = 0;
 
-    if (m_wildCard.IsEmpty())
-        m_wildCard = wxFileSelectorDefaultWildcardStr;
-
-    // convert m_wildCard from "*.bar" to "Files (*.bar)|*.bar"
-    if ( m_wildCard.Find(wxT('|')) == wxNOT_FOUND )
+    if ( wildCard.empty() || wildCard == wxFileSelectorDefaultWildcardStr )
+    {
+        m_wildCard = wxString::Format(_("All files (%s)|%s"),
+                                      wxFileSelectorDefaultWildcardStr,
+                                      wxFileSelectorDefaultWildcardStr);
+    }
+    else // have wild card
     {
-        m_wildCard.Printf(_("Files (%s)|%s"),
-                          m_wildCard.c_str(), m_wildCard.c_str());
+        // 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"),
+                            wildCard.c_str() + nDot,
+                            wildCard.c_str(),
+                            wildCard.c_str()
+                         );
+        }
     }
 }