X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9e152a55785098472ca1c0df110ad0a1203f710f..dc302518e6bf48326d202475bf78874fedcb2d9c:/src/common/filefn.cpp diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 940e50bc18..3c0a2f5285 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -1350,10 +1350,10 @@ bool wxMkdir(const wxString& dir, int perm) // assume mkdir() has 2 args on non Windows-OS/2 platforms and on Windows too // for the GNU compiler #if (!(defined(__WXMSW__) || defined(__OS2__) || defined(__DOS__))) || (defined(__GNUWIN32__) && !defined(__MINGW32__)) || defined(__WINE__) || defined(__WXMICROWIN__) - #ifndef MSVCRT - if ( mkdir(wxFNCONV(dirname), perm) != 0 ) - #else + #if defined(MSVCRT) if ( mkdir(wxFNCONV(dirname)) != 0 ) + #else + if ( mkdir(wxFNCONV(dirname), perm) != 0 ) #endif #elif defined(__OS2__) if (::DosCreateDir((PSZ)dirname, NULL) != 0) // enhance for EAB's?? @@ -1838,9 +1838,9 @@ time_t WXDLLEXPORT wxFileModificationTime(const wxString& filename) // Parses the filterStr, returning the number of filters. // Returns 0 if none or if there's a problem. -// filterStr is in the form: "All files (*.*)|*.*|JPEG Files (*.jpeg)|*.jpg" +// filterStr is in the form: "All files (*.*)|*.*|JPEG Files (*.jpeg)|*.jpeg" -int WXDLLEXPORT wxParseWildcard(const wxString& filterStr, wxArrayString& descriptions, wxArrayString& filters) +int WXDLLEXPORT wxParseCommonDialogsFilter(const wxString& filterStr, wxArrayString& descriptions, wxArrayString& filters) { descriptions.Clear(); filters.Clear(); @@ -1855,10 +1855,10 @@ int WXDLLEXPORT wxParseWildcard(const wxString& filterStr, wxArrayString& descri if ( pos == wxNOT_FOUND ) { // if there are no '|'s at all in the string just take the entire - // string as filter + // string as filter and make description empty for later autocompletion if ( filters.IsEmpty() ) { - descriptions.Add(filterStr); + descriptions.Add(wxEmptyString); filters.Add(filterStr); } else @@ -1886,6 +1886,62 @@ int WXDLLEXPORT wxParseWildcard(const wxString& filterStr, wxArrayString& descri filters.Add(filter); } +#if defined(__WXMOTIF__) + // split it so there is one wildcard per entry + for( size_t i = 0 ; i < descriptions.GetCount() ; i++ ) + { + pos = filters[i].Find(wxT(';')); + if (pos != wxNOT_FOUND) + { + // first split only filters + descriptions.Insert(descriptions[i],i+1); + filters.Insert(filters[i].Mid(pos+1),i+1); + filters[i]=filters[i].Left(pos); + + // autoreplace new filter in description with pattern: + // C/C++ Files(*.cpp;*.c;*.h)|*.cpp;*.c;*.h + // cause split into: + // C/C++ Files(*.cpp)|*.cpp + // C/C++ Files(*.c;*.h)|*.c;*.h + // and next iteration cause another split into: + // C/C++ Files(*.cpp)|*.cpp + // C/C++ Files(*.c)|*.c + // C/C++ Files(*.h)|*.h + for ( size_t k=i;kbefore.Find(_T(')'),true)) + { + before = before.Left(pos+1); + before << filters[k]; + pos = after.Find(_T(')')); + int pos1 = after.Find(_T('(')); + if (pos != wxNOT_FOUND && (pos