]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/filedlg.cpp
Removed some unnecessary bitmaps; other minor changes
[wxWidgets.git] / src / msw / filedlg.cpp
index 05c91f918cddab38ead2b96355bc616b54bf08db..db3b773dd0f1338d8cd8868e2d26b66da8d9a259 100644 (file)
@@ -82,12 +82,36 @@ char *wxFileSelector(const char *title,
         defaultFilenameString = "";
 
     wxFileDialog fileDialog(parent, title, defaultDirString, defaultFilenameString, filter2, flags, wxPoint(x, y));
-
+    if(defaultExtension)
+      {
+       unsigned int ii;
+       int filterFind,filterIndex=0;
+       filterFind=1;
+       for(ii=0;ii<filter2.Length();ii++)
+         {
+           if(filter2[ii] == '|')
+             {
+               unsigned int is=ii++;
+               filterIndex++;
+               for(;ii<filter2.Length();ii++)
+                 if(filter2[ii] == '|')
+                   break;
+               if(ii-is-1 > 0 && is+1 < filter2.Length())
+                 if(filter2.Mid(is+1,ii-is-1) == defaultExtension)
+                   {
+                     filterFind=filterIndex;
+                     break;
+                   }
+             }
+         }
+       fileDialog.SetFilterIndex(filterFind);
+      }                 
+    
     if ( fileDialog.ShowModal() == wxID_OK )
-    {
+      {
         strcpy(wxBuffer, (const char *)fileDialog.GetPath());
         return wxBuffer;
-    }
+      }
     else
         return NULL;
 }
@@ -271,7 +295,8 @@ int wxFileDialog::ShowModal(void)
                 extension = extension + strlen( extension ) +1;
             }
 
-            if (  (extension = strrchr( extension, '.' ))   // != "blabla" 
+            extension = strrchr( extension, '.' );
+            if (  extension                                 // != "blabla" 
                   && !strrchr( extension, '*' )             // != "blabla.*"
                   && !strrchr( extension, '?' )             // != "blabla.?"
                   && extension[1]                           // != "blabla."
@@ -328,10 +353,10 @@ wxDefaultFileSelector(bool load, const char *what, const char *extension, const
   char prompt[50];
   wxString str;
   if (load)
-    str = (const char*) wxTString("Load %s file");
+    str = "Load %s file";
   else
-    str = (const char*) wxTString("Save %s file");
-  sprintf(prompt, str, what);
+    str = "Save %s file";
+  sprintf(prompt, wxGetTranslation(str), what);
 
   if (*ext == '.') ext++;
   char wild[60];