This is bound to break something for 2.8.
Except that it should be exactly the same as we've been
doing for wx 2.9 builds.

Based upon SVN r1245.

From: "A. Maitland Bottoms" <[email protected]>
Date: Thu, 23 May 2013 20:42:58 -0400
Subject: [PATCH] preprocess wx-2.9 features
Description: This looks like it loses functionality under wx-2.8

--- a/src/fdmdv2_main.cpp
+++ b/src/fdmdv2_main.cpp
@@ -162,7 +162,11 @@
     SetTopWindow(frame);
     // Should guarantee that the first plot tab defined is the one
     // displayed. But it doesn't when built from command line.  Why?
+#ifdef FUTURE_WXWIN_COMPATIBILITY_3_0
     frame->m_auiNbookCtrl->ChangeSelection(0);
+#else
+    frame->m_auiNbookCtrl->SetSelection(0);
+#endif
     frame->Layout();
     frame->Show();
     g_parent =frame;
@@ -387,7 +391,9 @@
     setsnrBeta(wxGetApp().m_snrSlow);
 
 #ifdef _USE_TIMER
+#ifdef FUTURE_WXWIN_COMPATIBILITY_3_0
     Bind(wxEVT_TIMER, &MainFrame::OnTimer, this);       // ID_MY_WINDOW);
+#endif
     m_plotTimer.SetOwner(this, ID_TIMER_WATERFALL);
     //m_panelWaterfall->Refresh();
 #endif
@@ -543,7 +549,9 @@
     if(m_plotTimer.IsRunning())
     {
         m_plotTimer.Stop();
+#ifdef FUTURE_WXWIN_COMPATIBILITY_3_0
         Unbind(wxEVT_TIMER, &MainFrame::OnTimer, this);
+#endif
     }
 #endif //_USE_TIMER
 
@@ -907,13 +915,21 @@
     if (g_tx)
     {
         // tx-> rx transition, swap to the page we were on for last rx
+#ifdef FUTURE_WXWIN_COMPATIBILITY_3_0
         m_auiNbookCtrl->ChangeSelection(wxGetApp().m_rxNbookCtrl);
+#else
+        m_auiNbookCtrl->SetSelection(wxGetApp().m_rxNbookCtrl);
+#endif
     }
     else
     {
         // rx-> tx transition, swap to Mic In page to monitor speech
         wxGetApp().m_rxNbookCtrl = m_auiNbookCtrl->GetSelection();
+#ifdef FUTURE_WXWIN_COMPATIBILITY_3_0
         m_auiNbookCtrl->ChangeSelection(m_auiNbookCtrl->GetPageIndex((wxWindow 
*)m_panelSpeechIn));
+#else
+        m_auiNbookCtrl->SetSelection(m_auiNbookCtrl->GetPageIndex((wxWindow 
*)m_panelSpeechIn));
+#endif
     }
     g_tx = m_btnTogPTT->GetValue();
     // Tortured and tortuous logic, it seems to me...
@@ -1057,10 +1073,12 @@
     SetSizerAndFit(sizerTop);
 }
 
+#ifdef FUTURE_WXWIN_COMPATIBILITY_3_0
 static wxWindow* createMyExtraPlayFilePanel(wxWindow *parent)
 {
     return new MyExtraPlayFilePanel(parent);
 }
+#endif
 
 //-------------------------------------------------------------------------
 // OnPlayFileToMicIn()
@@ -1093,8 +1111,9 @@
                                     );
 
         // add the loop check box
+#ifdef FUTURE_WXWIN_COMPATIBILITY_3_0
         openFileDialog.SetExtraControlCreator(&createMyExtraPlayFilePanel);
-
+#endif
         if(openFileDialog.ShowModal() == wxID_CANCEL)
         {
             return;     // the user changed their mind...
@@ -1123,11 +1142,12 @@
             wxMessageBox(strErr, wxT("Couldn't open sound file"), wxOK);
             return;
         }
-
+#ifdef FUTURE_WXWIN_COMPATIBILITY_3_0
         wxWindow * const ctrl = openFileDialog.GetExtraControl();
 
         // Huh?! I just copied wxWidgets-2.9.4/samples/dialogs ....
         g_loopPlayFileToMicIn = 
static_cast<MyExtraPlayFilePanel*>(ctrl)->getLoopPlayFileToMicIn();
+#endif
 
         SetStatusText(wxT("Playing File: ") + fileName + wxT(" to Mic Input") 
, 0);
         g_playFileToMicIn = true;
@@ -1169,8 +1189,9 @@
                                     );
 
         // add the loop check box
+#ifdef FUTURE_WXWIN_COMPATIBILITY_3_0
         openFileDialog.SetExtraControlCreator(&createMyExtraPlayFilePanel);
-
+#endif
         if(openFileDialog.ShowModal() == wxID_CANCEL)
         {
             return;     // the user changed their mind...
@@ -1199,12 +1220,12 @@
             wxMessageBox(strErr, wxT("Couldn't open sound file"), wxOK);
             return;
         }
-
+#ifdef FUTURE_WXWIN_COMPATIBILITY_3_0
         wxWindow * const ctrl = openFileDialog.GetExtraControl();
 
         // Huh?! I just copied wxWidgets-2.9.4/samples/dialogs ....
         g_loopPlayFileFromRadio = 
static_cast<MyExtraPlayFilePanel*>(ctrl)->getLoopPlayFileToMicIn();
-
+#endif
         SetStatusText(wxT("Playing File: ") + fileName + wxT(" into From 
Radio") , 0);
         g_playFileFromRadio = true;
     }
@@ -1225,10 +1246,12 @@
     SetSizerAndFit(sizerTop);
 }
 
+#ifdef FUTURE_WXWIN_COMPATIBILITY_3_0
 static wxWindow* createMyExtraRecFilePanel(wxWindow *parent)
 {
     return new MyExtraRecFilePanel(parent);
 }
+#endif
 
 //-------------------------------------------------------------------------
 // OnRecFileFromRadio()
@@ -1261,8 +1284,9 @@
                                     );
 
         // add the loop check box
+#ifdef FUTURE_WXWIN_COMPATIBILITY_3_0
         openFileDialog.SetExtraControlCreator(&createMyExtraRecFilePanel);
-
+#endif
         if(openFileDialog.ShowModal() == wxID_CANCEL)
         {
             return;     // the user changed their mind...
@@ -1305,8 +1329,9 @@
         g_recFromRadioSamples = FS*(unsigned int)secs;
 #else
         // work out number of samples to record
-
+#ifdef FUTURE_WXWIN_COMPATIBILITY_3_0
         wxWindow * const ctrl = openFileDialog.GetExtraControl();
+
         wxString secsString = 
static_cast<MyExtraRecFilePanel*>(ctrl)->getSecondsToRecord();
         wxLogDebug("test: %s secsString: %s\n", wxT("testing 123"), 
secsString);
 
@@ -1322,6 +1347,7 @@
             return;
         }
 #endif
+#endif
 
         g_sfRecFile = sf_open(soundFile.mb_str(), SFM_WRITE, &sfInfo);
         if(g_sfRecFile == NULL)
--- a/src/fdmdv2_main.h
+++ b/src/fdmdv2_main.h
@@ -40,9 +40,11 @@
 #include "wx/mstream.h"
 #include "wx/wfstream.h"
 #include "wx/quantize.h"
+#ifdef FUTURE_WXWIN_COMPATIBILITY_3_0
 #include "wx/scopedptr.h"
-#include "wx/stopwatch.h"
 #include "wx/versioninfo.h"
+#endif
+#include "wx/stopwatch.h"
 #include <wx/sound.h>
 #include <wx/url.h>
 #include <wx/sstream.h>
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Freetel-codec2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freetel-codec2

Reply via email to