moving to wxWidgets 3.0

Building and customizing Audacity from the source code.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Edgar
Forum Crew
Posts: 2042
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

moving to wxWidgets 3.0

Post by Edgar » Tue Dec 06, 2011 8:07 pm

Currently Audacity will not build with any wxWidgets release beyond the 2.8 series; wx29 has many bug fixes which might benefit Audacity but the Audacity code needs some massaging to make it wx29+ compliant. The included patch is stale and will need to be applied manually, it was current as of when I created it but changes will have been made since then! I can only test this on Windows 7 so other OSes will have minor differences which are not explored here.

On Windows one must change all the solutions (there are 25 of them currently--Audacity, help, libflac, tolame etc.) and each solution's configuration (currently 4, but the non-Unicode ones may not exist for long--Release, Debug, Unicode Release & Unicode Debug) so that they use the wx29 libraries. To do this open each solution's property page's Linker's Input panel's Additional Dependencies dialog:
2wx29a.png
2wx29a.png (184.85 KiB) Viewed 10649 times
wxbase28ud.lib will change to wxbase29ud.lib etc. (or maybe even wxbase30ud.lib depending on the version of wxWidgets you are targeting). Many of the solutions may not link with the wxWidgets libraries--if one of any solution's configuration does not then none of its configurations do; only a few will need to be changed.

Don't forget to change your WXWIN environmental variable to point to your wx29 folder; this will need to be done before opening VC++ and may even require a reboot to take full effect.

Code: Select all

Index: lib-src/ffmpeg/libavutil/common.h
===================================================================
--- lib-src/ffmpeg/libavutil/common.h   (revision 11306)
+++ lib-src/ffmpeg/libavutil/common.h   (working copy)
@@ -36,6 +36,8 @@
#include <string.h>
#include "attributes.h"

+#include "../win32/stdint.h"
+
//rounded division & shift
#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
/* assume b>0 */
Index: lib-src/portaudio-v19/src/hostapi/dsound/pa_win_ds.c
===================================================================
--- lib-src/portaudio-v19/src/hostapi/dsound/pa_win_ds.c   (revision 11306)
+++ lib-src/portaudio-v19/src/hostapi/dsound/pa_win_ds.c   (working copy)
@@ -102,7 +102,8 @@
#include "pa_win_ds.h"
#include "pa_win_ds_dynlink.h"
#include "pa_win_waveformat.h"
-#include "pa_win_wdmks_utils.h"
+//#include "pa_win_wdmks_utils.h"
+#include "../../os/win/pa_win_wdmks_utils.h"


#if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) /* MSC version 6 and above */
Index: lib-src/twolame/libtwolame/common.h
===================================================================
--- lib-src/twolame/libtwolame/common.h   (revision 11306)
+++ lib-src/twolame/libtwolame/common.h   (working copy)
@@ -27,12 +27,12 @@
#define _COMMON_H

#ifdef _WIN32
-# include "../win32/configwin.h"
+#include "configwin.h"
/*
  * When building as a Win32 DLL, some functions are not allowed to be inlined,
  * otherwise the Microsoft Visual Studio 2005 linker will complain
  */
-# define NO_DLL_INLINE
+#define NO_DLL_INLINE
#else
# include "config.h"
/*
Index: src/AudacityApp.cpp
===================================================================
--- src/AudacityApp.cpp   (revision 11306)
+++ src/AudacityApp.cpp   (working copy)
@@ -603,7 +603,7 @@
       if (!cmd.IsEmpty()) {
          wxCommandEvent e(EVT_OPEN_AUDIO_FILE);
          e.SetString(data);
-         project->AddPendingEvent(e);
+         project->GetEventHandler()->AddPendingEvent(e);
       }

       return true;
@@ -651,7 +651,7 @@

    wxCommandEvent e(EVT_OPEN_AUDIO_FILE);
    e.SetString(fileName);
-   AddPendingEvent(e);
+   GetEventHandler()->AddPendingEvent(e);
}

// in response of a print-document apple event
@@ -663,7 +663,7 @@

    wxCommandEvent e(EVT_OPEN_AUDIO_FILE);
    e.SetString(fileName);
-   AddPendingEvent(e);
+   GetEventHandler()->AddPendingEvent(e);
}

// in response of a open-application apple event
Index: src/AudioIO.cpp
===================================================================
--- src/AudioIO.cpp   (revision 11306)
+++ src/AudioIO.cpp   (working copy)
@@ -550,7 +550,7 @@
       wxString errStr = _("Could not find any audio devices.n");
       errStr += _("You will not be able to play or record audio.nn");
       wxString paErrStr = LAT1CTOWX(Pa_GetErrorText(err));
-      if (paErrStr)
+      if (paErrStr != wxEmptyString)
          errStr += _("Error: ")+paErrStr;
       // XXX: we are in libaudacity, popping up dialogs not allowed!  A
       // long-term solution will probably involve exceptions
Index: src/commands/ScriptCommandRelay.cpp
===================================================================
--- src/commands/ScriptCommandRelay.cpp   (revision 11306)
+++ src/commands/ScriptCommandRelay.cpp   (working copy)
@@ -57,7 +57,7 @@
    wxASSERT(cmd != NULL);
    AppCommandEvent ev;
    ev.SetCommand(cmd);
-   project->AddPendingEvent(ev);
+   project->GetEventHandler()->AddPendingEvent(ev);
}

/// This is the function which actually obeys one command.  Rather than applying
Index: src/effects/Compressor.cpp
===================================================================
--- src/effects/Compressor.cpp   (revision 11306)
+++ src/effects/Compressor.cpp   (working copy)
@@ -38,6 +38,7 @@
#include <wx/textdlg.h>
#include <wx/brush.h>
#include <wx/image.h>
+#include <wx/dcclient.h>
#include <wx/dcmemory.h>

#include "Compressor.h"
Index: src/effects/VST/VSTEffect.cpp
===================================================================
--- src/effects/VST/VSTEffect.cpp   (revision 11306)
+++ src/effects/VST/VSTEffect.cpp   (working copy)
@@ -32,6 +32,7 @@
#include <wx/stattext.h>
#include <wx/stopwatch.h>
#include <wx/utils.h>
+#include <wx/textctrl.h>

#if defined(__WXMAC__)
#include <dlfcn.h>
@@ -41,6 +42,10 @@
#endif

#if defined(__WXMSW__)
+   #include <wx/msw/wrapwin.h>
+   #include <WinBase.h>
+   #include <WinDef.h>
+   #include <WinNT.h>
    #include <wx/msw/seh.h>
    #include <windows.h>
    #include <shlwapi.h>
Index: src/import/ImportRaw.cpp
===================================================================
--- src/import/ImportRaw.cpp   (revision 11306)
+++ src/import/ImportRaw.cpp   (working copy)
@@ -323,7 +323,7 @@

       if (sf_format_check(&info)) {
          mEncodingSubtype[mNumEncodings] = subtype;
-         encodings.Add(LAT1CTOWX(sf_encoding_index_name(i)));
+         encodings.Add(wxString (sf_encoding_index_name(i).wc_str(), wxConvISO8859_1));

          if ((mEncoding & SF_FORMAT_SUBMASK) == subtype)
             selection = mNumEncodings;
Index: src/Internat.h
===================================================================
--- src/Internat.h   (revision 11306)
+++ src/Internat.h   (working copy)
@@ -12,6 +12,7 @@
#ifndef __AUDACITY_INTERNAT__
#define __AUDACITY_INTERNAT__

+#include <wx/thread.h>
#include <wx/arrstr.h>
#include <wx/string.h>
#include <wx/longlong.h>
Index: src/ondemand/ODManager.cpp
===================================================================
--- src/ondemand/ODManager.cpp   (revision 11306)
+++ src/ondemand/ODManager.cpp   (working copy)
@@ -311,7 +311,7 @@
          AudacityProject::AllProjectsDeleteLock();
          AudacityProject* proj = GetActiveProject();
          if(proj)
-            proj->AddPendingEvent( event );
+            proj->GetEventHandler()->AddPendingEvent( event );
          AudacityProject::AllProjectsDeleteUnlock();
       }
       mTerminateMutex.Lock();
Index: src/ondemand/ODTask.cpp
===================================================================
--- src/ondemand/ODTask.cpp   (revision 11306)
+++ src/ondemand/ODTask.cpp   (working copy)
@@ -158,7 +158,7 @@
          if(IsTaskAssociatedWithProject(gAudacityProjects[i]))
          {
             //this assumes tasks are only associated with one project.
-            gAudacityProjects[i]->AddPendingEvent( event );
+            gAudacityProjects[i]->GetEventHandler()->AddPendingEvent( event );
             //mark the changes so that the project can be resaved.
             gAudacityProjects[i]->GetUndoManager()->SetODChangesFlag();
             break;
Index: src/PitchName.cpp
===================================================================
--- src/PitchName.cpp   (revision 11306)
+++ src/PitchName.cpp   (working copy)
@@ -16,7 +16,7 @@

*//*******************************************************************/

-
+#include <wx/string.h>
#include <math.h>
#include <stdio.h>

Index: src/prefs/KeyConfigPrefs.cpp
===================================================================
--- src/prefs/KeyConfigPrefs.cpp   (revision 11306)
+++ src/prefs/KeyConfigPrefs.cpp   (working copy)
@@ -122,6 +122,7 @@
@@ -350,7 +352,7 @@
       nevent.SetDirection(!e.ShiftDown());
       nevent.SetEventObject(t);
       nevent.SetCurrentFocus(t);
-      t->GetParent()->ProcessEvent(nevent);
+      t->GetParent()->GetEventHandler()->ProcessEvent(nevent);

       return;
    }
Index: src/Project.cpp
===================================================================
--- src/Project.cpp   (revision 11306)
+++ src/Project.cpp   (working copy)
@@ -1657,7 +1703,7 @@
       wxCommandEvent e(EVT_CAPTURE_KEY);
       e.SetEventObject(&event);

-      if (w->ProcessEvent(e)) {
+      if (w->GetEventHandler()->ProcessEvent(e)) {
          return false;
       }
    }
Index: src/Tags.cpp
===================================================================
--- src/Tags.cpp   (revision 11306)
+++ src/Tags.cpp   (working copy)
@@ -482,7 +482,8 @@

       while (*attrs) {
          wxString attr = *attrs++;
-         if (!*attr)
+         if (attr == wxEmptyString)
             break;
          wxString value = *attrs++;

Index: src/toolbars/ControlToolBar.cpp
===================================================================
--- src/toolbars/ControlToolBar.cpp   (revision 11306)
+++ src/toolbars/ControlToolBar.cpp   (working copy)
@@ -586,10 +586,10 @@
       }
       else {
          // msmeyer: Show error message if stream could not be opened
-         wxMessageBox(_(
-            "Error while opening sound device. "
-            wxT("Please check the output device settings and the project sample rate.")),
-            _("Error"), wxOK | wxICON_EXCLAMATION, this);
+         wxString messageA(_("Error while opening sound device. "));
+         wxString messageB(wxT("Please check the output device settings and the project sample rate."));
+         messageA.Append(messageB);
+         wxMessageBox(messageA, _("Error"), wxOK | wxICON_EXCLAMATION, this);
       }
    }

@@ -928,9 +928,10 @@
          }

          // msmeyer: Show error message if stream could not be opened
-         wxMessageBox(_("Error while opening sound device. "
-            wxT("Please check the input device settings and the project sample rate.")),
-                      _("Error"), wxOK | wxICON_EXCLAMATION, this);
+         wxString messageA(_("Error while opening sound device. "));
+         wxString messageB(wxT("Please check the input device settings and the project sample rate."));
+         messageA.Append(messageB);
+         wxMessageBox(messageA, _("Error"), wxOK | wxICON_EXCLAMATION, this);

          SetPlay(false);
          SetStop(false);
Index: src/toolbars/DeviceToolBar.cpp
===================================================================
--- src/toolbars/DeviceToolBar.cpp   (revision 11306)
+++ src/toolbars/DeviceToolBar.cpp   (working copy)
@@ -72,8 +72,8 @@
    ToolBar::Create(parent);

    // Simulate a size event to set initial meter placement/size
-   wxSizeEvent dummy;
-   OnSize(dummy);
+   //wxSizeEvent dummy;//efm5 debug figure this out
+   //OnSize(dummy);//wx's V says Layout() or just nothing
}

void DeviceToolBar::RecreateTipWindows()
Index: src/toolbars/ToolDock.h
===================================================================
--- src/toolbars/ToolDock.h   (revision 11306)
+++ src/toolbars/ToolDock.h   (working copy)
@@ -40,8 +40,8 @@
enum
{
    NoDockID = 0,
-   TopDockID,
-   BotDockID,
+   TopDockID = 2,
+   BotDockID = 3,
    DockCount = 2
};

Index: src/toolbars/ToolManager.cpp
===================================================================
--- src/toolbars/ToolManager.cpp   (revision 11306)
+++ src/toolbars/ToolManager.cpp   (working copy)
@@ -740,12 +740,24 @@
       gPrefs->SetPath( bar->GetSection() );

       // Search both docks for toolbar order
-      int to = mTopDock->GetOrder( bar );
-      int bo = mBotDock->GetOrder( bar );
+      int top = mTopDock->GetOrder( bar );
+      int bottom = mBotDock->GetOrder( bar );

       // Save
-      gPrefs->Write( wxT("Dock"), to ? TopDockID : bo ? BotDockID : NoDockID );
-      gPrefs->Write( wxT("Order"), to + bo );
+      wxString dock;
+      if (top) {
+         dock.Printf(wxT("%d"), TopDockID);
+         gPrefs->Write( wxT("Dock"), dock );
+      }
+      else if (bottom) {
+         dock.Printf(wxT("%d"), BotDockID);
+         gPrefs->Write( wxT("Dock"), dock );
+      }
+      else {
+         dock.Printf(wxT("%d"), NoDockID);
+         gPrefs->Write( wxT("Dock"), dock );
+      }
+      gPrefs->Write( wxT("Order"), (top + bottom) );
       gPrefs->Write( wxT("Show"), IsVisible( ndx ) );

       wxPoint pos( -1, -1 );
Index: src/toolbars/ToolsToolBar.cpp
===================================================================
--- src/toolbars/ToolsToolBar.cpp   (revision 11306)
+++ src/toolbars/ToolsToolBar.cpp   (working copy)
@@ -59,18 +59,18 @@

// Strings to convert a tool number into a status message
// These MUST be in the same order as the ids above.
-const wxChar * MessageOfTool[numTools] = { wxTRANSLATE("Click and drag to select audio"),
-   wxTRANSLATE("Click and drag to edit the amplitude envelope"),
-   wxTRANSLATE("Click and drag to edit the samples"),
+const wxChar * MessageOfTool[numTools] = { _("Click and drag to select audio"),
+   _("Click and drag to edit the amplitude envelope"),
+   _("Click and drag to edit the samples"),
#if defined( __WXMAC__ )
-   wxTRANSLATE("Click to Zoom In, Shift-Click to Zoom Out"),
+   _("Click to Zoom In, Shift-Click to Zoom Out"),
#elif defined( __WXMSW__ )
-   wxTRANSLATE("Drag to Zoom Into Region, Right-Click to Zoom Out"),
+   _("Drag to Zoom Into Region, Right-Click to Zoom Out"),
#elif defined( __WXGTK__ )
-   wxTRANSLATE("Left=Zoom In, Right=Zoom Out, Middle=Normal"),
+   _("Left=Zoom In, Right=Zoom Out, Middle=Normal"),
#endif
-   wxTRANSLATE("Click and drag to move a track in time"),
-   wxT("") // multi-mode tool
+   _("Click and drag to move a track in time"),
+   wxString(wxEmptyString) // multi-mode tool
};

////////////////////////////////////////////////////////////
Index: src/TrackPanel.cpp
===================================================================
--- src/TrackPanel.cpp   (revision 11306)
+++ src/TrackPanel.cpp   (working copy)
@@ -4768,7 +4763,7 @@
       // The activate event is used to make the
       // parent window 'come alive' if it didn't have focus.
       wxActivateEvent e;
-      GetParent()->ProcessEvent(e);
+      GetParent()->GetEventHandler()->ProcessEvent(e);

       // wxTimers seem to be a little unreliable, so this
       // "primes" it to make sure it keeps going for a while...
@@ -5199,28 +5203,42 @@
    int trackKind = pTrack->GetKind();
    currentTool = selectTool; // the default.

-   if( event.ButtonIsDown(3) || event.RightUp()){
+   if( event.RightIsDown() || event.RightUp())
+   {
       currentTool = zoomTool;
-   } else if( trackKind == Track::Time ){
+   }
+   else if( trackKind == Track::Time )
+   {
       currentTool = envelopeTool;
-   } else if( trackKind == Track::Label ){
+   }
+   else if( trackKind == Track::Label )
+   {
       currentTool = selectTool;
-   } else if( trackKind != Track::Wave) {
+   }
+   else if( trackKind != Track::Wave)
+   {
       currentTool = selectTool;
    // So we are in a wave track.
    //FIX-ME: Not necessarily. Haven't checked Track::Note (#if defined(USE_MIDI)).
    // From here on the order in which we hit test determines
    // which tool takes priority in the rare cases where it
    // could be more than one.
-   } else if (event.CmdDown()){
+   }
+   else if (event.CmdDown())
+   {
       // msmeyer: If control is down, slide single clip
       // msmeyer: If control and shift are down, slide all clips
       currentTool = slideTool;
-   } else if( HitTestEnvelope( pTrack, r, event ) ){
+   }
+   else if( HitTestEnvelope( pTrack, r, event ) )
+   {
       currentTool = envelopeTool;
-   } else if( HitTestSlide( pTrack, r, event )){
+   }
+   else if( HitTestSlide( pTrack, r, event ))
+   {
       currentTool = slideTool;
-   } else if( HitTestSamples( pTrack, r, event )){
+   }
+   else if( HitTestSamples( pTrack, r, event )){
       currentTool = drawTool;
    }

@@ -7712,28 +7737,27 @@

TrackInfo::TrackInfo(wxWindow * pParentIn)
{
-
+   mpFont = NULL;
    pParent = pParentIn;

    // Populate sliders array
+
    for (unsigned int i = 0; i < kInitialSliders; ++i) {
       MakeMoreSliders();
    }
    mSliderOffset = 0;

-   int fontSize = 10;
-   mFont.Create(fontSize, wxSWISS, wxNORMAL, wxNORMAL);
-
    int allowableWidth = GetTrackInfoWidth() - 2; // 2 to allow for left/right borders
    int textWidth, textHeight;
+   int fontSize = 10;
+   mpFont = new wxFont(fontSize, wxFONTFAMILY_SWISS,
+                       wxFONTSTYLE_NORMAL,
+                       wxFONTWEIGHT_NORMAL);//no mem alloc testing
    do {
-      mFont.SetPointSize(fontSize);
+      mpFont->SetPointSize(fontSize);
       pParent->GetTextExtent(_("Stereo, 999999Hz"),
-                             &textWidth,
-                             &textHeight,
-                             NULL,
-                             NULL,
-                             &mFont);
+                             &textWidth, &textHeight,
+                             NULL, NULL, mpFont);
       fontSize--;
    } while (textWidth >= allowableWidth);
}
@@ -7745,6 +7769,7 @@
       delete mGains[i];
    for(i=0; i<mPans.Count(); i++)
       delete mPans[i];
+   if (mpFont) delete mpFont;
}

static const int kTrackInfoWidth = 100;
@@ -7826,7 +7851,7 @@
/// todo Probably should move to 'Utils.cpp'.
void TrackInfo::SetTrackInfoFont(wxDC * dc)
{
-   dc->SetFont(mFont);
+   dc->SetFont(*mpFont);
}

void TrackInfo::DrawBordersWithin(wxDC* dc, const wxRect r, bool bHasMuteSolo)
Index: src/TrackPanel.h
===================================================================
--- src/TrackPanel.h   (revision 11306)
+++ src/TrackPanel.h   (working copy)
@@ -143,7 +143,7 @@
    LWSlider * PanSlider(int trackIndex);

    wxWindow * pParent;
-   wxFont mFont;
+   wxFont * mpFont;

    friend class TrackPanel;
};
Index: src/UploadDialog.cpp
===================================================================
--- src/UploadDialog.cpp   (revision 11306)
+++ src/UploadDialog.cpp   (working copy)
@@ -123,12 +123,12 @@
     icons->Add(*mp3Icon);
     icons->Add(*upIcon);

-    wxFlexGridSizer *topSizer = new wxFlexGridSizer(2, 1);
+    wxFlexGridSizer *topSizer = new wxFlexGridSizer(2, 1, 0);
     wxStaticBoxSizer *connectionBox = new wxStaticBoxSizer(new wxStaticBox(this, -1, wxT("FTP Connection"), wxDefaultPosition, wxDefaultSize, 0, wxT("")), wxVERTICAL);
     wxStaticBoxSizer *fileBox = new wxStaticBoxSizer(new wxStaticBox(this, -1, wxT("File Manager"), wxDefaultPosition, wxDefaultSize, 0, wxT("")), wxVERTICAL);
     wxStaticBoxSizer *siteBox = new wxStaticBoxSizer(new wxStaticBox(this, -1, wxT("Site Manager"), wxDefaultPosition, wxDefaultSize, 0, wxT("")), wxVERTICAL);

-    wxFlexGridSizer *connectionSizer = new wxFlexGridSizer(2, 4);
+    wxFlexGridSizer *connectionSizer = new wxFlexGridSizer(2, 4, 0);
     wxBoxSizer *leftSizer = new wxBoxSizer(wxVERTICAL);
     wxBoxSizer *rightSizer = new wxBoxSizer(wxVERTICAL);
     wxBoxSizer *fileButtonSizer = new wxBoxSizer(wxHORIZONTAL);
Index: src/widgets/ASlider.cpp
===================================================================
--- src/widgets/ASlider.cpp   (revision 11306)
+++ src/widgets/ASlider.cpp   (working copy)
@@ -1191,7 +1191,7 @@
                nevent.SetDirection( !event.ShiftDown() );
                nevent.SetEventObject( mParent );
                nevent.SetCurrentFocus( mParent );
-               mParent->GetParent()->ProcessEvent( nevent );
+               mParent->GetParent()->GetEventHandler()->ProcessEvent( nevent );
             }
             break;

@@ -1203,7 +1203,7 @@
                if (def && def->IsEnabled()) {
                   wxCommandEvent cevent(wxEVT_COMMAND_BUTTON_CLICKED,
                         def->GetId());
-                  mParent->ProcessEvent(cevent);
+                  mParent->GetEventHandler()->ProcessEvent(cevent);
                }
             }

@@ -1228,7 +1228,7 @@
    int intValue = (int)( ( mCurrentValue - mMinValue ) * 1000.0f /
                          ( mMaxValue - mMinValue ) );
    e.SetInt( intValue );
-   mParent->ProcessEvent( e );
+   mParent->GetEventHandler()->ProcessEvent( e );
}

int LWSlider::ValueToPosition(float val)
Index: src/widgets/Grabber.cpp
===================================================================
--- src/widgets/Grabber.cpp   (revision 11306)
+++ src/widgets/Grabber.cpp   (working copy)
@@ -83,7 +83,7 @@
    e.SetEventObject(parent);

    // Queue the event
-   parent->AddPendingEvent(e);
+   parent->GetEventHandler()->AddPendingEvent(e);
}

//
Index: src/widgets/Grid.cpp
===================================================================
--- src/widgets/Grid.cpp   (revision 11306)
+++ src/widgets/Grid.cpp   (working copy)
@@ -28,7 +28,7 @@

TimeEditor::TimeEditor()
{
-   TimeEditor(wxT("seconds"), 44100);
+   TimeEditor(wxT("seconds"), 44100.0);
}

TimeEditor::TimeEditor(const wxString &format, double rate)
@@ -303,8 +303,7 @@
    Choice()->SetFocus();
}

-bool ChoiceEditor::EndEdit(int row, int col,
-                           wxGrid* grid)
+bool ChoiceEditor::EndEdit(int row, int col, wxGrid * grid)
{
    wxString val = mChoices[Choice()->GetSelection()];

@@ -492,7 +491,7 @@
             if (def && def->IsEnabled()) {
                wxCommandEvent cevent(wxEVT_COMMAND_BUTTON_CLICKED,
                                      def->GetId());
-               GetParent()->ProcessEvent(cevent);
+               GetParent()->GetEventHandler()->ProcessEvent(cevent);
             }
          }
          else {
Index: src/widgets/Grid.h
===================================================================
--- src/widgets/Grid.h   (revision 11306)
+++ src/widgets/Grid.h   (working copy)
@@ -53,6 +53,8 @@

    void BeginEdit(int row, int col, wxGrid *grid);
    bool EndEdit(int row, int col, wxGrid *grid);
+   bool EndEdit(int row, int col, const wxGrid *grid, const wxString& oldval, wxString *newval);
+   void ApplyEdit(int row, int col, wxGrid* grid);

    void Reset();

@@ -125,6 +127,9 @@

    void BeginEdit(int row, int col, wxGrid *grid);
    bool EndEdit(int row, int col, wxGrid *grid);
+   bool EndEdit(int row, int col, const wxGrid *grid,
+                const wxString& oldval, wxString *newval);
+   void ApplyEdit(int row, int col, wxGrid* grid);

    void Reset();

Index: src/widgets/ImageRoll.cpp
===================================================================
--- src/widgets/ImageRoll.cpp   (revision 11306)
+++ src/widgets/ImageRoll.cpp   (working copy)
@@ -100,6 +100,8 @@
#include <wx/bitmap.h>
#include <wx/dcmemory.h>
#include <wx/image.h>
+#include <wx/defs.h>
+#include <wx/dcclient.h>

WX_DEFINE_OBJARRAY(BitmapArray);
WX_DEFINE_OBJARRAY(ImageArray);
@@ -299,19 +301,19 @@
}

void ImageRoll::DrawBitmap(wxDC &dc, wxBitmap &bitmap,
-                           int x, int y, int logicalFunc)
+                           int x, int y, wxRasterOperationMode logicalFunction)
{
-   if (logicalFunc == wxCOPY)
+   if (logicalFunction == wxCOPY)
       dc.DrawBitmap(bitmap, x, y);
    else {
       wxMemoryDC memDC;
       memDC.SelectObject(bitmap);
       dc.Blit(x, y, bitmap.GetWidth(), bitmap.GetHeight(),
-              &memDC, 0, 0, logicalFunc);
+         &memDC, 0, 0, logicalFunction);
    }
}

-void ImageRoll::Draw(wxDC &dc, wxRect rect, int logicalFunc)
+void ImageRoll::Draw(wxDC &dc, wxRect rect, wxRasterOperationMode logicalFunction)
{
    int width = rect.width;
    int height = rect.height;
@@ -434,9 +436,9 @@
                 mImageRoll.GetMaxSize());
}

-void ImageRollPanel::SetLogicalFunction(int func)
+void ImageRollPanel::SetLogicalFunction(wxRasterOperationMode logicalFunction)
{
-   mLogicalFunction = func;
+   mLogicalFunction = logicalFunction;
}

void ImageRollPanel::OnPaint(wxPaintEvent &evt)
Index: src/widgets/ImageRoll.h
===================================================================
--- src/widgets/ImageRoll.h   (revision 11306)
+++ src/widgets/ImageRoll.h   (working copy)
@@ -15,6 +15,7 @@
#include <wx/defs.h>
#include <wx/dynarray.h>
#include <wx/panel.h>
+#include <wx/dc.h>

WX_DECLARE_OBJARRAY(wxBitmap, BitmapArray);
WX_DECLARE_OBJARRAY(wxImage, ImageArray);
@@ -40,7 +41,7 @@
    wxSize GetMaxSize() const { return mMaxSize; }

    void Draw(wxDC &dc, wxRect rect,
-             int logicalFunc = wxCOPY);
+             wxRasterOperationMode logicalFunction = wxCOPY);

    static ImageArray SplitH(const wxImage &src, wxColour magicColor);
    static ImageArray SplitV(const wxImage &src, wxColour magicColor);
@@ -48,7 +49,7 @@
  protected:

    void DrawBitmap(wxDC &dc, wxBitmap &bitmap,
-                   int x, int y, int logicalFunc = wxCOPY);
+                   int x, int y, wxRasterOperationMode logicalFunction = wxCOPY);

    void Init(RollType type, const wxImage &src, wxColour magicColor);

@@ -72,7 +73,7 @@
                   const wxSize& size = wxDefaultSize,
                   long style = wxTAB_TRAVERSAL);

-   void SetLogicalFunction(int func);
+   void SetLogicalFunction(wxRasterOperationMode logicalFunction);

    void OnPaint(wxPaintEvent &evt);
    void OnSize(wxSizeEvent &evt);
@@ -80,7 +81,7 @@
  protected:
    ImageRoll mImageRoll;

-   int mLogicalFunction;
+   wxRasterOperationMode mLogicalFunction;

    DECLARE_EVENT_TABLE();

Index: src/widgets/TimeTextCtrl.cpp
===================================================================
--- src/widgets/TimeTextCtrl.cpp   (revision 11306)
+++ src/widgets/TimeTextCtrl.cpp   (working copy)
@@ -176,6 +176,7 @@
#include <wx/stattext.h>
#include <wx/tooltip.h>
#include <wx/toplevel.h>
+#include <wx/dcclient.h>

#ifdef _DEBUG
     #ifdef _MSC_VER
@@ -1152,7 +1153,7 @@
       nevent.SetDirection(!event.ShiftDown());
       nevent.SetEventObject(parent);
       nevent.SetCurrentFocus(parent);
-      GetParent()->ProcessEvent(nevent);
+      GetParent()->GetEventHandler()->ProcessEvent(nevent);
    }

    else if (keyCode == WXK_RETURN || keyCode == WXK_NUMPAD_ENTER) {
@@ -1161,7 +1162,7 @@
       if (def && def->IsEnabled()) {
          wxCommandEvent cevent(wxEVT_COMMAND_BUTTON_CLICKED,
                                def->GetId());
-         GetParent()->ProcessEvent(cevent);
+         GetParent()->GetEventHandler()->ProcessEvent(cevent);
       }
    }

Index: src/xml/XMLWriter.cpp
===================================================================
--- src/xml/XMLWriter.cpp   (revision 11306)
+++ src/xml/XMLWriter.cpp   (working copy)
@@ -246,7 +246,7 @@
       mHasKids[0] = true;
    }

-   Write(value.c_str());
+   Write(value);
}

void XMLWriter::WriteSubTree(const wxChar *value)
Some of the above changes may already have been made, others might be needed! There are a few included changes which only affect readability of the code but I made them to help diagnosing the build errors and left them in as they improve things for everyone (I think <grin> !).

I would suggest following this procedure:
1) download & compile current wxWidgets stable post-2.8 version
2) set WXWIN environmental variable
3) reboot
4) checkout a clean Audacity SVN HEAD
5) open the audacity.sln in VC++ and make all the needed Linker library changes
6) search all Audacity source code for every instance of "AddPendingEvent" it will find a bunch of lines like:
AddPendingEvent(e);
change them to:
GetEventHandler()->AddPendingEvent(e);
(remember the (e) might really be (event) then use "GetEventHandler()->AddPendingEvent(event);" etc.
7) use Batch Build to compile everything (this will get the entire Audacity solution including help and locale plus all the external libraries). You will get a lot of errors!
8) I found it easiest to start with the external libraries--fewer changes--so open the Solution Explorer window and start at the bottom "twolame"--right-click to get a context menu, choose Project Only > Build only twolame, fix errors until it builds then move up to "soundtouch" and continue.
When you hit an error search through the above patch to find the solution (or a similar solution) and apply the fix manually. If you get stuck, post here and I will try to help.
Last edited by Edgar on Thu Nov 14, 2013 6:14 am, edited 1 time in total.

LaurentFr
Posts: 12
Joined: Fri Jul 20, 2012 6:12 pm
Operating System: Please select

Re: moving to wxWidgets 2.9+

Post by LaurentFr » Mon Jul 23, 2012 1:30 pm

Thanks you for example.

I have followed your script but there is something that I don't understand :
when you change
bool EndEdit(int row, int col, wxGrid *grid);
+ bool EndEdit(int row, int col, const wxGrid *grid,
+ const wxString& oldval, wxString *newval);

and you append applyedit
what are the new functions ?

Thanks you for yours answwers

Edgar
Forum Crew
Posts: 2042
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: moving to wxWidgets 2.9+

Post by Edgar » Mon Jul 23, 2012 5:08 pm

LaurentFr wrote: I have followed your script but there is something that I don't understand :
when you change
bool EndEdit(int row, int col, wxGrid *grid);
+ bool EndEdit(int row, int col, const wxGrid *grid,
+ const wxString& oldval, wxString *newval);

and you append applyedit
what are the new functions ?
You obviously studied this very carefully! It has been a long time since my post and to be honest, I am not entirely sure of the answer. I think that this is just holdover code from another bit of work someone else (not I--I would not use variable names like oldval) was doing at the time and has nothing to do with moving to wx2.9. Just ignore it--it's addition will cause no harm but is not needed.

LaurentFr
Posts: 12
Joined: Fri Jul 20, 2012 6:12 pm
Operating System: Please select

Re: moving to wxWidgets 2.9+

Post by LaurentFr » Mon Jul 23, 2012 6:09 pm

A bad solution for my problem of source code of functions :
void TimeEditor::ApplyEdit(int row, int col, wxGrid* grid){};

//bool TimeEditor::EndEdit(int row, int col, wxGrid *grid)
bool TimeEditor::EndEdit(int row, int col,const wxGrid *grid, const wxString& oldval, wxString *newval)

After Link is ok! If I run the program I have got some warning abut Font and Police, but Audacity is running, playing sound....!
Thanks


PS Audacity log file is
21:11:21: Audacity 2.0.2-alpha-Jul 23 2012
21:11:22: Error: locale 'fr' cannot be set.
DirManager: Created new instance.
21:11:38: Trying to load FFmpeg libraries...
21:11:38: Trying to load FFmpeg libraries from system paths. File name is 'avformat-52.dll'.
21:11:38: Looking up PATH environment variable...
21:11:38: PATH = 'C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:Program FilesATI TechnologiesATI Control Panel;C:Program FilesFichiers communsGTK2.0bin;djgppbin;C:Program Filesdoxygenbin;C:Program FilesSupport Tools;C:Program FilesMiKTeX 2.9miktexbin;C:Program Filesscilab-5.4.0-alpha-1bin;C:Program FilesTraiMisc;
21:11:38: Checking that '' is in PATH...
21:11:38: FFmpeg directory is in PATH.
21:11:38: Checking for monolithic avformat from 'avformat-52.dll'.
21:11:38: Error: Failed to load shared library 'avformat-52.dll' (error 126: le module spécifié est introuvable.)
21:11:38: Loading avutil from 'avutil-50.dll'.
21:11:38: Error: Failed to load shared library 'avutil-50.dll' (error 126: le module spécifié est introuvable.)
21:11:38: Loading avcodec from 'avcodec-52.dll'.
21:11:38: Error: Failed to load shared library 'avcodec-52.dll' (error 126: le module spécifié est introuvable.)
21:11:38: Loading avformat from 'avformat-52.dll'.
21:11:38: Error: Failed to load shared library 'avformat-52.dll' (error 126: le module spécifié est introuvable.)
21:11:38: Error: Failed to load FFmpeg libraries.
21:11:38: Error: Failed to find compatible FFmpeg libraries.
LastOpenType is All files
OverrideExtendedImportByOpenFileDialogChoice is 0
21:12:12: File name is c:documents and settingslaurentbureauallonge3.wav
21:12:12: Mime type is *
Appending libsndfile
Appending libav
Appending liboggvorbis
Appending libflac
Appending lof
21:12:12: Opening with libsndfile
21:12:12: Open(c:documents and settingslaurentbureauallonge3.wav) succeeded
AudioIO::GetBestRate() for playback
GetBestRate() suggested rate 48000 Hz
GetBestRate() Returning 48000 Hz

Edgar
Forum Crew
Posts: 2042
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: moving to wxWidgets 2.9+

Post by Edgar » Mon Jul 23, 2012 7:09 pm

LaurentFr wrote: After Link is ok! If I run the program I have got some warning abut Font and Police, but Audacity is running, playing sound....!
A "Very well done!" to you.

It would be nice if you were to do a patch against SVN HEAD with your changes and post it here like I did so that in the future others may have the benefit of your experience.

LaurentFr
Posts: 12
Joined: Fri Jul 20, 2012 6:12 pm
Operating System: Please select

Re: moving to wxWidgets 2.9+

Post by LaurentFr » Tue Jul 24, 2012 11:20 am

I didn't use exactly your modification for event handling. I use ProcessWindowEvent ( http://docs.wxwidgets.org/2.9.4/classwx ... 7e4eab2b57)
As soon as there is no warning I will try to create a new branch in SVN Header. If you want source code now I can give you a link to a zip file of my MSVC project with source code.

When I launch audacity and try to open a file the mask file int the dialog box is wrong. I have source file :
FileDialogPrivate.cpp
line 722
// of.lpstrFilter = (LPTSTR)((const char*)filterBuffer.c_str());
of.lpstrFilter = (LPTSTR)((const char*)filterBuffer.fn_str());


When I want to plot a spectrum there is an access violation at line :
in file FreqWindow.cpp line 747
value = CubicInterpolate(mProcessed[ibin],
mProcessed[ibin + 1],
mProcessed[ibin + 2],
mProcessed[ibin + 3], binmid - ibin);

value of ibin is -842150455 because value of mProcessedSize is -842150451. Variable Initialization ofmProcessSize must be done at line 1113 or 1133 1173 or 1192 in freqWindow.cpp in method FreqWindow::Recalc() but in debug mode program does not execute this line.
To solve this problem I have change source coode of FreqWindow.cpp at line 997 :
//Progress dialog over FFT operation
ProgressDialog *mProgress = new ProgressDialog(_("Plot Spectrum"),_("Drawing Spectrum"));

int start = 0;
int windows = 0;
mProcessedSize = half; // new line20120724
while (start + mWindowSize <= mDataLen) {

Now FFT is OK but I don't think that's a good answer. May be problem is in event handling(?)
Last edited by LaurentFr on Tue Jul 24, 2012 3:29 pm, edited 1 time in total.

Edgar
Forum Crew
Posts: 2042
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: moving to wxWidgets 2.9+

Post by Edgar » Tue Jul 24, 2012 3:16 pm

LaurentFr wrote:I didn't use exactly your modification for event handling. I use ProcessWindowEvent ( http://docs.wxwidgets.org/2.9.4/classwx ... 7e4eab2b57)
As soon as there is no warning I will try to create a new branch in SVN Header. If you want source code now I can give you a link to a zip file of my MSVC project with source code.
My choice on event handling was a while back and based on what the wx folks recommended at the time; your's is probably more up-to-date.

I would love to DL your zipped version!

Edgar
Forum Crew
Posts: 2042
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: moving to wxWidgets 2.9+

Post by Edgar » Thu Nov 14, 2013 3:42 am

LaurentFr wrote:I didn't use exactly your modification for event handling. I use ProcessWindowEvent

Code: Select all

bool wxWindow::ProcessWindowEvent	(	wxEvent & 	event	)	
Convenient wrapper for ProcessEvent().

This is the same as writing

 GetEventHandler()->ProcessEvent(event);
but more convenient. Notice that ProcessEvent() itself can't be called for wxWindow objects as it ignores the event handlers associated with the window; use this function instead.
I see that now and will adopt that version.

Edgar
Forum Crew
Posts: 2042
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: moving to wxWidgets 3.0

Post by Edgar » Thu Nov 14, 2013 6:25 am

Here is a patch for SVN HEAD 12 November 2013 (revision 12937) which compiles (Release & Debug) with no errors and the only warnings are for libraries in lib-src which Audacity's Team does not control. You may not use setting.h as currently supplied with Audacity but must modify the one which comes with wxWidgets 3.0 (the only thing I did was to turn on accessibility:

Code: Select all

// Use wxAccessible for enhanced and customisable accessibility.
// Depends on wxUSE_OLE.
//
// Default is 0.
//
// Recommended setting (at present): 0
#define wxUSE_ACCESSIBILITY 1
Attachments
2wx30.zip
(14.64 KiB) Downloaded 158 times

Edgar
Forum Crew
Posts: 2042
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: moving to wxWidgets 3.0

Post by Edgar » Thu Nov 14, 2013 9:58 pm

The previous patch neglected to update all of the wxFont stuff so, while it will run, it uses the default font everywhere. I hope to post a new patch sometime today with these fixes and a new set of step-by-step directions.

Post Reply