From 1e195ecea61fdba851bfb61bb8e4a3a6a10fe09d Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Thu, 30 Jul 2015 02:02:59 -0500 Subject: [PATCH] Fix many wx3.1.0 assertions now to prevent double testing --- src/AudacityApp.cpp | 26 +++++++++++++------------- src/Benchmark.cpp | 2 +- src/FreqWindow.cpp | 4 ++-- src/HistoryWindow.cpp | 2 +- src/PluginManager.cpp | 4 ++-- src/Project.cpp | 14 +++++++------- src/ShuttleGui.cpp | 4 ++-- src/commands/CommandTargets.h | 2 +- src/effects/Compressor.cpp | 2 +- src/effects/Effect.cpp | 2 +- src/effects/Equalization.cpp | 12 ++++++------ src/effects/ScienFilter.cpp | 4 ++-- src/prefs/KeyConfigPrefs.cpp | 2 +- src/prefs/PrefsDialog.cpp | 2 +- src/toolbars/ToolBar.cpp | 2 +- src/widgets/ASlider.cpp | 6 +++++- src/widgets/ProgressDialog.cpp | 4 ++-- src/widgets/Ruler.cpp | 4 ++++ 18 files changed, 53 insertions(+), 45 deletions(-) diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index 8003e3973..d9b72447f 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -213,10 +213,10 @@ It handles initialization and termination by subclassing wxApp. # pragma comment(lib, "wxmsw" V "u" D "_qa") # endif # pragma comment(lib, "wxbase" V "u" D) -# pragma comment(lib, "wxbase" V "u" D "_net.lib") -# pragma comment(lib, "wxmsw" V "u" D "_adv.lib") -# pragma comment(lib, "wxmsw" V "u" D "_core.lib") -# pragma comment(lib, "wxmsw" V "u" D "_html.lib") +# pragma comment(lib, "wxbase" V "u" D "_net") +# pragma comment(lib, "wxmsw" V "u" D "_adv") +# pragma comment(lib, "wxmsw" V "u" D "_core") +# pragma comment(lib, "wxmsw" V "u" D "_html") # pragma comment(lib, "wxpng" D) # pragma comment(lib, "wxzlib" D) # pragma comment(lib, "wxjpeg" D) @@ -651,12 +651,7 @@ public: }; }; -#if !defined(__WXMAC__) && !defined(__WXMSW__) -IMPLEMENT_APP(AudacityApp) -/* make the application class known to wxWidgets for dynamic construction */ -#endif - -#if defined(__WXMAC__) || defined(__WXMSW__) +#if defined(__WXMAC__) // This should be removed when Lame and FFmpeg support is converted // from loadable libraries to commands. // @@ -672,7 +667,6 @@ IMPLEMENT_APP(AudacityApp) IMPLEMENT_APP_NO_MAIN(AudacityApp) IMPLEMENT_WX_THEME_SUPPORT -#if defined(__WXMAC__) int main(int argc, char *argv[]) { if (getenv("DYLD_LIBRARY_PATH")) { @@ -687,7 +681,11 @@ int main(int argc, char *argv[]) return wxEntry(argc, argv); } -#elif defined(__WXMSW__) +#elif defined(__WXMSW__) && !wxCHECK_VERSION(3, 1, 0) +// Disable telling Windows that we support HiDPI displays. It is forced on +// in wxWidget versions between 3.0.0 and 3.1.0. +IMPLEMENT_APP_NO_MAIN(AudacityApp) +IMPLEMENT_WX_THEME_SUPPORT extern "C" int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, @@ -705,7 +703,9 @@ extern "C" int WINAPI WinMain(HINSTANCE hInstance, /* wWinMain() above too. */ return wxEntry(hInstance, hPrevInstance, NULL, nCmdShow); } -#endif + +#else +IMPLEMENT_APP(AudacityApp) #endif #ifdef __WXMAC__ diff --git a/src/Benchmark.cpp b/src/Benchmark.cpp index 44886c882..3e89d69c3 100644 --- a/src/Benchmark.cpp +++ b/src/Benchmark.cpp @@ -229,7 +229,7 @@ void BenchmarkDialog::MakeBenchmarkDialog() } S.EndHorizontalLay(); - S.StartHorizontalLay(wxALIGN_RIGHT, false); + S.StartHorizontalLay(wxALIGN_NOT | wxALIGN_LEFT, false); { S.Id(wxID_CANCEL).AddButton(wxT("Close")); } diff --git a/src/FreqWindow.cpp b/src/FreqWindow.cpp index b793b9f34..6c83e66ec 100644 --- a/src/FreqWindow.cpp +++ b/src/FreqWindow.cpp @@ -296,7 +296,7 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id, mFreqPlot = new FreqPlot(this); mFreqPlot->SetMinSize(wxSize(wxDefaultCoord, FREQ_WINDOW_HEIGHT)); S.Prop(1); - S.AddWindow(mFreqPlot, wxEXPAND | wxALIGN_CENTRE); + S.AddWindow(mFreqPlot, wxEXPAND); S.StartHorizontalLay(wxEXPAND, 0); { @@ -476,7 +476,7 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id, S.AddSpace(5); mProgress = new FreqGauge(this); //, wxID_ANY, wxST_SIZEGRIP); - S.AddWindow(mProgress, wxEXPAND | wxALIGN_BOTTOM); + S.AddWindow(mProgress, wxEXPAND); // Log-frequency axis works for spectrum plots only. if (mAlg != SpectrumAnalyst::Spectrum) diff --git a/src/HistoryWindow.cpp b/src/HistoryWindow.cpp index affe716df..c03a44a9e 100644 --- a/src/HistoryWindow.cpp +++ b/src/HistoryWindow.cpp @@ -113,7 +113,7 @@ HistoryWindow::HistoryWindow(AudacityProject *parent, UndoManager *manager): } S.EndStatic(); - S.StartHorizontalLay(wxALIGN_BOTTOM | wxALIGN_RIGHT, false); + S.StartHorizontalLay(wxALIGN_RIGHT, false); { S.SetBorder(10); S.Id(wxID_OK).AddButton(_("&OK"))->SetDefault(); diff --git a/src/PluginManager.cpp b/src/PluginManager.cpp index f9f860d5a..d18a4aa35 100644 --- a/src/PluginManager.cpp +++ b/src/PluginManager.cpp @@ -535,7 +535,7 @@ void PluginRegistrationDialog::PopulateOrExchange(ShuttleGui &S) } S.EndHorizontalLay(); - S.StartHorizontalLay(wxALIGN_RIGHT, 0); + S.StartHorizontalLay(wxALIGN_NOT | wxALIGN_LEFT, 0); { wxRadioButton* rb; /* i18n-hint: This is before radio buttons selecting which effects to show */ @@ -571,7 +571,7 @@ void PluginRegistrationDialog::PopulateOrExchange(ShuttleGui &S) mEffects->InsertColumn(COL_State, _("State")); mEffects->InsertColumn(COL_Path, _("Path")); - S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxEXPAND, 0); + S.StartHorizontalLay(wxALIGN_LEFT | wxEXPAND, 0); { S.Id(ID_SelectAll).AddButton(_("&Select All")); S.Id(ID_ClearAll).AddButton(_("C&lear All")); diff --git a/src/Project.cpp b/src/Project.cpp index 380e57b71..bf5598606 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -887,10 +887,10 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, #endif wxBoxSizer *bs = new wxBoxSizer( wxVERTICAL ); - bs->Add( mToolManager->GetTopDock(), 0, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP ); - bs->Add( mRuler, 0, wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTRE ); - bs->Add( pPage, 1, wxEXPAND | wxALIGN_LEFT ); - bs->Add( mToolManager->GetBotDock(), 0, wxEXPAND | wxALIGN_LEFT | wxALIGN_BOTTOM ); + bs->Add( mToolManager->GetTopDock(), 0, wxEXPAND | wxALIGN_TOP ); + bs->Add( mRuler, 0, wxEXPAND ); + bs->Add( pPage, 1, wxEXPAND ); + bs->Add( mToolManager->GetBotDock(), 0, wxEXPAND ); SetAutoLayout( true ); SetSizer( bs ); bs->Layout(); @@ -936,8 +936,8 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, vs = new wxBoxSizer( wxVERTICAL ); // Vertical scroll bar - vs->Add( mVsbar, 1, wxEXPAND | wxALIGN_RIGHT | wxALIGN_TOP ); - hs->Add( vs, 0, wxEXPAND | wxALIGN_RIGHT | wxALIGN_TOP ); + vs->Add( mVsbar, 1, wxEXPAND | wxALIGN_TOP ); + hs->Add( vs, 0, wxEXPAND | wxALIGN_TOP ); bs->Add( hs, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP ); // Bottom horizontal grouping @@ -947,7 +947,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, hs->Add( mTrackPanel->GetLeftOffset() - 1, 0 ); hs->Add( mHsbar, 1, wxALIGN_BOTTOM ); hs->Add( mVsbar->GetSize().GetWidth(), 0 ); - bs->Add( hs, 0, wxEXPAND | wxALIGN_LEFT | wxALIGN_BOTTOM ); + bs->Add( hs, 0, wxEXPAND | wxALIGN_LEFT ); // Lay it out pPage->SetAutoLayout(true); diff --git a/src/ShuttleGui.cpp b/src/ShuttleGui.cpp index deb98ed16..8970a6ece 100644 --- a/src/ShuttleGui.cpp +++ b/src/ShuttleGui.cpp @@ -219,7 +219,7 @@ void ShuttleGuiBase::AddPrompt(const wxString &Prompt) mpWind = new wxStaticText(mpParent, -1, Prompt, wxDefaultPosition, wxDefaultSize, Style( wxALIGN_RIGHT )); mpWind->SetName(wxStripMenuCodes(Prompt)); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) - UpdateSizersCore( false, wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL ); + UpdateSizersCore( false, wxALL | wxALIGN_CENTRE_VERTICAL ); } /// Left aligned text string. @@ -233,7 +233,7 @@ void ShuttleGuiBase::AddUnits(const wxString &Prompt) mpWind = new wxStaticText(mpParent, -1, Prompt, wxDefaultPosition, wxDefaultSize, Style( wxALIGN_LEFT )); mpWind->SetName(Prompt); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) - UpdateSizersCore( false, wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL ); + UpdateSizersCore( false, wxALL | wxALIGN_LEFT ); } /// Centred text string. diff --git a/src/commands/CommandTargets.h b/src/commands/CommandTargets.h index ffdf70510..561b94a31 100644 --- a/src/commands/CommandTargets.h +++ b/src/commands/CommandTargets.h @@ -118,7 +118,7 @@ public: {} virtual void Update(wxString message) { - mStatus.SetStatusText(message, mainStatusBarField); + mStatus.SetStatusText(message, 0); } }; diff --git a/src/effects/Compressor.cpp b/src/effects/Compressor.cpp index ca506eb77..6f188c467 100644 --- a/src/effects/Compressor.cpp +++ b/src/effects/Compressor.cpp @@ -217,7 +217,7 @@ void EffectCompressor::PopulateOrExchange(ShuttleGui & S) S.StartStatic(wxT("")); { - S.StartMultiColumn(3, wxEXPAND | wxALIGN_CENTER_VERTICAL); + S.StartMultiColumn(3, wxEXPAND); { S.SetStretchyCol(1); mThresholdLabel = S.AddVariableText(_("Threshold:"), true, diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index 57b3bf830..d5ecdfcc0 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -3050,7 +3050,7 @@ bool EffectUIHost::Initialize() } buttonPanel->SetSizer(CreateStdButtonSizer(buttonPanel, buttons, bar)); - vs->Add(buttonPanel, 0, wxEXPAND | wxALIGN_CENTER_VERTICAL); + vs->Add(buttonPanel, 0, wxEXPAND); SetSizer(vs); Layout(); diff --git a/src/effects/Equalization.cpp b/src/effects/Equalization.cpp index fab552507..8875bc87f 100644 --- a/src/effects/Equalization.cpp +++ b/src/effects/Equalization.cpp @@ -587,11 +587,11 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S) szr2 = new wxBoxSizer( wxVERTICAL ); mdBMaxSlider = new wxSlider(parent, ID_dBMax, DEF_dBMax, MIN_dBMax, MAX_dBMax, wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL|wxSL_INVERSE); - szr2->Add( mdBMaxSlider, 1, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 4 ); + szr2->Add( mdBMaxSlider, 1, wxALIGN_LEFT|wxALL, 4 ); mdBMinSlider = new wxSlider(parent, ID_dBMin, DEF_dBMin, MIN_dBMin, MAX_dBMin, wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL|wxSL_INVERSE); - szr2->Add( mdBMinSlider, 1, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 4 ); - szr1->Add( szr2, 0, wxEXPAND|wxALIGN_CENTRE|wxALL, 4 ); + szr2->Add( mdBMinSlider, 1, wxALIGN_LEFT|wxALL, 4 ); + szr1->Add( szr2, 0, wxEXPAND|wxALL, 4 ); #if wxUSE_ACCESSIBILITY mdBMaxSlider->SetName(_("Max dB")); @@ -619,7 +619,7 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S) szr1->Add( szr4, 0, wxEXPAND|wxALIGN_LEFT|wxALL ); mPanel = new EqualizationPanel(this, parent); - szr1->Add( mPanel, 1, wxEXPAND|wxALIGN_CENTRE); + szr1->Add( mPanel, 1, wxEXPAND); szr3 = new wxBoxSizer( wxVERTICAL ); szr1->Add( szr3, 0, wxALIGN_CENTRE|wxRIGHT, 0); //spacer for last EQ @@ -646,7 +646,7 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S) szr1->Add( szr5, 0, wxEXPAND|wxALIGN_LEFT|wxALL ); szr1->Layout(); - szrV->Add( szr1, 1, wxEXPAND|wxALIGN_CENTER|wxALL, 0 ); + szrV->Add( szr1, 1, wxEXPAND|wxALL, 0 ); // ------------------------------------------------------------------- // Graphic EQ - parent gets laid out horizontally in onSize @@ -659,7 +659,7 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S) mSliders[i] = new wxSlider(parent, ID_Slider + i, 0, -20, +20, wxDefaultPosition, wxSize(20, 124), wxSL_VERTICAL| wxSL_INVERSE); - szrG->Add( mSliders[i], 0, wxEXPAND|wxALIGN_CENTER ); + szrG->Add( mSliders[i], 0, wxEXPAND ); szrG->Add(0, 0, 0); // horizontal spacer - used to put EQ sliders in correct position mSliders[i]->Connect(wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(EffectEqualization::OnErase)); mEQVals[i] = 0.; diff --git a/src/effects/ScienFilter.cpp b/src/effects/ScienFilter.cpp index 7dee7f0e1..cf76b3d1d 100644 --- a/src/effects/ScienFilter.cpp +++ b/src/effects/ScienFilter.cpp @@ -392,7 +392,7 @@ void EffectScienFilter::PopulateOrExchange(ShuttleGui & S) S.SetBorder(1); S.AddSpace(1, 1); S.Prop(1); - S.AddWindow(mdBRuler, wxEXPAND | wxALIGN_RIGHT | wxTOP); + S.AddWindow(mdBRuler, wxALIGN_RIGHT | wxTOP); S.AddSpace(1, 1); } S.EndVerticalLay(); @@ -402,7 +402,7 @@ void EffectScienFilter::PopulateOrExchange(ShuttleGui & S) S.SetBorder(5); S.Prop(1); - S.AddWindow(mPanel, wxEXPAND | wxALIGN_CENTRE | wxRIGHT); + S.AddWindow(mPanel, wxEXPAND | wxRIGHT); S.SetSizeHints(-1, -1); S.StartVerticalLay(); diff --git a/src/prefs/KeyConfigPrefs.cpp b/src/prefs/KeyConfigPrefs.cpp index 5c1ed5d4e..9b80d2c27 100644 --- a/src/prefs/KeyConfigPrefs.cpp +++ b/src/prefs/KeyConfigPrefs.cpp @@ -220,7 +220,7 @@ void KeyConfigPrefs::PopulateOrExchange(ShuttleGui & S) NULL, this); } - S.AddWindow(mFilter, wxALIGN_RIGHT); + S.AddWindow(mFilter, wxALIGN_NOT | wxALIGN_LEFT); } S.EndHorizontalLay(); } diff --git a/src/prefs/PrefsDialog.cpp b/src/prefs/PrefsDialog.cpp index 39cc0a56c..73787121b 100644 --- a/src/prefs/PrefsDialog.cpp +++ b/src/prefs/PrefsDialog.cpp @@ -272,7 +272,7 @@ PrefsDialog::PrefsDialog // Frankly, this is a hack to work around a bug in wxTreebook, and // will have to be revisited if we add another category to mCategories. // JKC later added a category and 20 onto the 7. - SetSizeHints(sz.x, sz.y + 7 + 20, 800, 600); + SetSizeHints(sz.x, sz.y + 7 + 20, 800, 627); // Center after all that resizing, but make sure it doesn't end up // off-screen diff --git a/src/toolbars/ToolBar.cpp b/src/toolbars/ToolBar.cpp index 99a5877d8..9f39818c9 100644 --- a/src/toolbars/ToolBar.cpp +++ b/src/toolbars/ToolBar.cpp @@ -444,7 +444,7 @@ void ToolBar::ReCreateButtons() { // Create the resizer and add it to the main sizer mResizer = new ToolBarResizer( this ); - ms->Add( mResizer, 0, wxEXPAND | wxALIGN_RIGHT | wxALIGN_TOP | wxLEFT, 1 ); + ms->Add( mResizer, 0, wxEXPAND | wxALIGN_TOP | wxLEFT, 1 ); mResizer->SetToolTip( _("Click and drag to resize toolbar") ); } diff --git a/src/widgets/ASlider.cpp b/src/widgets/ASlider.cpp index fb107a69b..e8f9a6a61 100644 --- a/src/widgets/ASlider.cpp +++ b/src/widgets/ASlider.cpp @@ -798,6 +798,10 @@ void LWSlider::Draw() void LWSlider::FormatPopWin() { + if (!mTipPanel) { + return; + } + wxString label; wxString valstr; @@ -841,6 +845,7 @@ void LWSlider::FormatPopWin() } mTipPanel->SetLabel(label); + mTipPanel->Refresh(); } bool LWSlider::ShowDialog() @@ -1126,7 +1131,6 @@ void LWSlider::SendUpdate( float newValue ) mCurrentValue = newValue; FormatPopWin(); - mTipPanel->Refresh(); Refresh(); diff --git a/src/widgets/ProgressDialog.cpp b/src/widgets/ProgressDialog.cpp index 8903afd01..3dd8a6c19 100644 --- a/src/widgets/ProgressDialog.cpp +++ b/src/widgets/ProgressDialog.cpp @@ -1131,13 +1131,13 @@ bool ProgressDialog::Create(const wxString & title, if (!(flags & pdlgHideStopButton)) { w = new wxButton(this, wxID_OK, _("Stop")); - h->Add(w, 0, wxALIGN_RIGHT | wxRIGHT, 10); + h->Add(w, 0, wxRIGHT, 10); } if (!(flags & pdlgHideCancelButton)) { w = new wxButton(this, wxID_CANCEL, _("Cancel")); - h->Add(w, 0, wxALIGN_RIGHT | wxRIGHT, 10); + h->Add(w, 0, wxRIGHT, 10); } v->Add(h, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 10); diff --git a/src/widgets/Ruler.cpp b/src/widgets/Ruler.cpp index 11d484210..f422779ef 100644 --- a/src/widgets/Ruler.cpp +++ b/src/widgets/Ruler.cpp @@ -1871,6 +1871,10 @@ void AdornedRulerPanel::OnPaint(wxPaintEvent & WXUNUSED(evt)) void AdornedRulerPanel::OnSize(wxSizeEvent & WXUNUSED(evt)) { mOuter = GetClientRect(); + if (mOuter.GetWidth() == 0 || mOuter.GetHeight() == 0) + { + return; + } mInner = mOuter; mInner.x += 1; // +1 for left bevel