On Sat, May 31, 2014 at 09:16:10PM +0200, Benjamin Drung wrote:
> There are discussions about supporting wx3.0 (and making it the
> default), but no code changes has landed in SVN so far. I do not know
> the current status and why there isn't any progress. Lack of
> manpower/time or bugs? That's why I CCed audacity-devel to get some
> feedback.
> 
> It's probably safe to say that help is appreciated and we are happy for
> patches that add wx3.0 support (without removing wx2.8 support).

The attached is a simple start I made, and should work with both 2.8 and
3.0, though I didn't manage to actually test it compiles due to the
generic file dialog issue.  But I guess it's still useful to you.

BTW, I'd suggest there's no point keeping WXWIN_COMPATIBILITY_2_4 (only
used in one place, and wx2.4 is long long dead).  Also
WXWIN_COMPATIBILITY_2_6 seems to be defined but never used (and wx2.6 is
also long dead).

Cheers,
    Olly
--- a/audacity-2.0.5/lib-src/FileDialog/generic/FileDialogPrivate.cpp	2013-10-19 20:31:33.000000000 +1300
+++ b/audacity-2.0.5/lib-src/FileDialog/generic/FileDialogPrivate.cpp	2014-06-01 20:38:47.890251794 +1200
@@ -40,7 +40,7 @@
 #include "wx/settings.h"
 #include "wx/filefn.h"
 #include "wx/file.h"        // for wxS_IXXX constants only
-#include "wx/filedlg.h"     // wxOPEN, wxSAVE...
+#include "wx/filedlg.h"     // wxFD_OPEN, wxFD_SAVE...
 #include "wx/generic/filedlgg.h"
 #include "wx/generic/dirctrlg.h" // for wxFileIconsTable
 
@@ -991,9 +991,9 @@
    }
    
    if (m_dialogStyle == 0)
-      m_dialogStyle = wxOPEN;
-   if ((m_dialogStyle & wxMULTIPLE ) && !(m_dialogStyle & wxOPEN))
-      m_dialogStyle |= wxOPEN;
+      m_dialogStyle = wxFD_OPEN;
+   if ((m_dialogStyle & wxMULTIPLE ) && !(m_dialogStyle & wxFD_OPEN))
+      m_dialogStyle |= wxFD_OPEN;
    
    if ((m_dir.empty()) || (m_dir == wxT(".")))
    {
@@ -1368,7 +1368,7 @@
    }
 #endif // __UNIX__
    
-   if (!(m_dialogStyle & wxSAVE))
+   if (!(m_dialogStyle & wxFD_SAVE))
    {
       if ((filename.Find(wxT('*')) != wxNOT_FOUND) ||
           (filename.Find(wxT('?')) != wxNOT_FOUND))
@@ -1413,14 +1413,14 @@
    // VZ: the logic of testing for !wxFileExists() only for the open file
    //     dialog is not entirely clear to me, why don't we allow saving to a
    //     file without extension as well?
-   if ( !(m_dialogStyle & wxOPEN) || !wxFileExists(filename) )
+   if ( !(m_dialogStyle & wxFD_OPEN) || !wxFileExists(filename) )
    {
       filename = AppendExtension(filename, m_filterExtension);
    }
    
    // check that the file [doesn't] exist if necessary
-   if ( (m_dialogStyle & wxSAVE) &&
-       (m_dialogStyle & wxOVERWRITE_PROMPT) &&
+   if ( (m_dialogStyle & wxFD_SAVE) &&
+       (m_dialogStyle & wxFD_OVERWRITE_PROMPT) &&
        wxFileExists( filename ) )
    {
       wxString msg;
@@ -1429,8 +1429,8 @@
       if (wxMessageBox(msg, _("Confirm"), wxYES_NO) != wxYES)
          return;
    }
-   else if ( (m_dialogStyle & wxOPEN) &&
-            (m_dialogStyle & wxFILE_MUST_EXIST) &&
+   else if ( (m_dialogStyle & wxFD_OPEN) &&
+            (m_dialogStyle & wxFD_FILE_MUST_EXIST) &&
             !wxFileExists(filename) )
    {
       wxMessageBox(_("Please choose an existing file."), _("Error"),
--- a/audacity-2.0.5/lib-src/FileDialog/win/FileDialogPrivate.cpp	2013-10-19 20:31:33.000000000 +1300
+++ b/audacity-2.0.5/lib-src/FileDialog/win/FileDialogPrivate.cpp	2014-06-01 20:36:58.222264699 +1200
@@ -731,7 +731,7 @@
    of.nMaxFile  = wxMAXPATH;
    
    // we must set the default extension because otherwise Windows would check
-   // for the existing of a wrong file with wxOVERWRITE_PROMPT (i.e. if the
+   // for the existing of a wrong file with wxFD_OVERWRITE_PROMPT (i.e. if the
    // user types "foo" and the default extension is ".bar" we should force it
    // to check for "foo.bar" existence and not "foo")
    wxString defextBuffer; // we need it to be alive until GetSaveFileName()!

Reply via email to