From 6a4d6ceedad0a258f18f3b1e2de233153ae93040 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 25 Jun 2016 14:16:09 -0400 Subject: [PATCH 01/14] Separate source files for ScrubbingToolBar --- mac/Audacity.xcodeproj/project.pbxproj | 12 +- src/Makefile.am | 2 + src/Project.cpp | 1 + src/toolbars/EditToolBar.cpp | 243 ----------------- src/toolbars/EditToolBar.h | 62 ----- src/toolbars/ScrubbingToolBar.cpp | 253 ++++++++++++++++++ src/toolbars/ScrubbingToolBar.h | 76 ++++++ src/toolbars/ToolManager.cpp | 1 + src/tracks/ui/Scrubbing.cpp | 2 +- win/Projects/Audacity/Audacity.vcxproj | 2 + .../Audacity/Audacity.vcxproj.filters | 6 + 11 files changed, 351 insertions(+), 309 deletions(-) create mode 100644 src/toolbars/ScrubbingToolBar.cpp create mode 100644 src/toolbars/ScrubbingToolBar.h diff --git a/mac/Audacity.xcodeproj/project.pbxproj b/mac/Audacity.xcodeproj/project.pbxproj index 8d200bda0..948884d26 100644 --- a/mac/Audacity.xcodeproj/project.pbxproj +++ b/mac/Audacity.xcodeproj/project.pbxproj @@ -1215,6 +1215,7 @@ 5ED1D0AD1CDE55BD00471E3C /* Overlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5ED1D0A91CDE55BD00471E3C /* Overlay.cpp */; }; 5ED1D0AE1CDE55BD00471E3C /* OverlayPanel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5ED1D0AB1CDE55BD00471E3C /* OverlayPanel.cpp */; }; 5ED1D0B11CDE560C00471E3C /* BackedPanel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5ED1D0AF1CDE560C00471E3C /* BackedPanel.cpp */; }; + 5EF17C231D1F0A690090A642 /* ScrubbingToolBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF17C211D1F0A690090A642 /* ScrubbingToolBar.cpp */; }; 8406A93812D0F2510011EA01 /* EQDefaultCurves.xml in Resources */ = {isa = PBXBuildFile; fileRef = 8406A93712D0F2510011EA01 /* EQDefaultCurves.xml */; }; 8484F31413086237002DF7F0 /* DeviceManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8484F31213086237002DF7F0 /* DeviceManager.cpp */; }; ED15214D163C22F000451B5F /* lsr.c in Sources */ = {isa = PBXBuildFile; fileRef = ED152123163C220300451B5F /* lsr.c */; }; @@ -2994,6 +2995,8 @@ 5ED1D0AC1CDE55BD00471E3C /* OverlayPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OverlayPanel.h; sourceTree = ""; }; 5ED1D0AF1CDE560C00471E3C /* BackedPanel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BackedPanel.cpp; sourceTree = ""; }; 5ED1D0B01CDE560C00471E3C /* BackedPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackedPanel.h; sourceTree = ""; }; + 5EF17C211D1F0A690090A642 /* ScrubbingToolBar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrubbingToolBar.cpp; sourceTree = ""; }; + 5EF17C221D1F0A690090A642 /* ScrubbingToolBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrubbingToolBar.h; sourceTree = ""; }; 82FF184D13CF01A600C1B664 /* dBTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = dBTable.cpp; path = sbsms/src/dBTable.cpp; sourceTree = ""; }; 82FF184E13CF01A600C1B664 /* dBTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dBTable.h; path = sbsms/src/dBTable.h; sourceTree = ""; }; 82FF184F13CF01A600C1B664 /* slide.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = slide.cpp; path = sbsms/src/slide.cpp; sourceTree = ""; }; @@ -5224,9 +5227,6 @@ 2897F6DB0AB3DB5A003C20C5 /* toolbars */ = { isa = PBXGroup; children = ( - 28001B481A0F0EB6007DD161 /* SpectralSelectionBar.cpp */, - 28001B491A0F0EB6007DD161 /* SpectralSelectionBar.h */, - 28001B4A1A0F0EB6007DD161 /* SpectralSelectionBarListener.h */, 2897F6DC0AB3DB5A003C20C5 /* ControlToolBar.cpp */, 2897F6DD0AB3DB5A003C20C5 /* ControlToolBar.h */, 289F9C7C0AC671BB00797DC1 /* DeviceToolBar.cpp */, @@ -5237,9 +5237,14 @@ 2897F6E10AB3DB5A003C20C5 /* MeterToolBar.h */, 2897F6E20AB3DB5A003C20C5 /* MixerToolBar.cpp */, 2897F6E30AB3DB5A003C20C5 /* MixerToolBar.h */, + 5EF17C211D1F0A690090A642 /* ScrubbingToolBar.cpp */, + 5EF17C221D1F0A690090A642 /* ScrubbingToolBar.h */, 2897F6E40AB3DB5A003C20C5 /* SelectionBar.cpp */, 2897F6E50AB3DB5A003C20C5 /* SelectionBar.h */, 2803C8BB19F35B4900278526 /* SelectionBarListener.h */, + 28001B481A0F0EB6007DD161 /* SpectralSelectionBar.cpp */, + 28001B491A0F0EB6007DD161 /* SpectralSelectionBar.h */, + 28001B4A1A0F0EB6007DD161 /* SpectralSelectionBarListener.h */, 2897F6E60AB3DB5A003C20C5 /* ToolBar.cpp */, 2897F6E70AB3DB5A003C20C5 /* ToolBar.h */, 2897F6E80AB3DB5A003C20C5 /* ToolDock.cpp */, @@ -7323,6 +7328,7 @@ 1790B12E09883BFD008A330A /* Amplify.cpp in Sources */, 1790B13409883BFD008A330A /* ChangePitch.cpp in Sources */, 1790B13509883BFD008A330A /* ChangeSpeed.cpp in Sources */, + 5EF17C231D1F0A690090A642 /* ScrubbingToolBar.cpp in Sources */, 1790B13609883BFD008A330A /* ChangeTempo.cpp in Sources */, 1790B13709883BFD008A330A /* ClickRemoval.cpp in Sources */, 1790B13809883BFD008A330A /* Compressor.cpp in Sources */, diff --git a/src/Makefile.am b/src/Makefile.am index b0dd2a48f..3d173dba3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -513,6 +513,8 @@ audacity_SOURCES = \ toolbars/MeterToolBar.h \ toolbars/MixerToolBar.cpp \ toolbars/MixerToolBar.h \ + toolbars/ScrubbingToolBar.cpp \ + toolbars/ScrubbingToolBar.h \ toolbars/SelectionBar.cpp \ toolbars/SelectionBar.h \ toolbars/SpectralSelectionBar.cpp \ diff --git a/src/Project.cpp b/src/Project.cpp index b87c47050..90f3923a4 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -151,6 +151,7 @@ scroll information. It also has some status flags. #include "toolbars/EditToolBar.h" #include "toolbars/MeterToolBar.h" #include "toolbars/MixerToolBar.h" +#include "toolbars/ScrubbingToolBar.h" #include "toolbars/SelectionBar.h" #include "toolbars/SpectralSelectionBar.h" #include "toolbars/ToolsToolBar.h" diff --git a/src/toolbars/EditToolBar.cpp b/src/toolbars/EditToolBar.cpp index ed2920d28..480209fed 100644 --- a/src/toolbars/EditToolBar.cpp +++ b/src/toolbars/EditToolBar.cpp @@ -346,246 +346,3 @@ void EditToolBar::EnableDisableButtons() mButtons[ETBSyncLockID]->PopUp(); #endif } - - -// PRL: to do: move the below to its own file -// Much of this is imitative of EditToolBar. Should there be a common base -// class? -#include "../Audacity.h" - -// For compilers that support precompilation, includes "wx/wx.h". -#include - -#ifndef WX_PRECOMP -#include -#include -#include -#include -#include -#endif - -#include "../AllThemeResources.h" -#include "../AudioIO.h" -#include "../ImageManipulation.h" -#include "../Internat.h" -#include "../Prefs.h" -#include "../Project.h" -#include "../Theme.h" -#include "../Track.h" -#include "../UndoManager.h" -#include "../widgets/AButton.h" -#include "../widgets/Ruler.h" -#include "../tracks/ui/Scrubbing.h" - -#include "../Experimental.h" - -IMPLEMENT_CLASS(ScrubbingToolBar, ToolBar); - -//const int BUTTON_WIDTH = 27; -//const int SEPARATOR_WIDTH = 14; - -//////////////////////////////////////////////////////////// -/// Methods for ScrubbingToolBar -//////////////////////////////////////////////////////////// - -BEGIN_EVENT_TABLE( ScrubbingToolBar, ToolBar ) -EVT_COMMAND_RANGE( STBFirstButton, - STBFirstButton + STBNumButtons - 1, - wxEVT_COMMAND_BUTTON_CLICKED, - ScrubbingToolBar::OnButton ) -END_EVENT_TABLE() - -//Standard contructor -ScrubbingToolBar::ScrubbingToolBar() -: ToolBar(ScrubbingBarID, _("Scrub"), wxT("Scrub")) -{ -} - -ScrubbingToolBar::~ScrubbingToolBar() -{ -} - -void ScrubbingToolBar::Create(wxWindow * parent) -{ - ToolBar::Create(parent); -} - -/// This is a convenience function that allows for button creation in -/// MakeButtons() with fewer arguments -/// Very similar to code in ControlToolBar... -AButton *ScrubbingToolBar::AddButton - (teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled, - int id, - const wxChar *label, - bool toggle) -{ - AButton *&r = mButtons[id]; - - r = ToolBar::MakeButton - (this, - bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall, - eEnabledUp, eEnabledDown, eDisabled, - wxWindowID(id), - wxDefaultPosition, - toggle, - theTheme.ImageSize( bmpRecoloredUpSmall )); - - r->SetLabel(label); - // JKC: Unlike ControlToolBar, does not have a focus rect. Shouldn't it? - // r->SetFocusRect( r->GetRect().Deflate( 4, 4 ) ); - - Add( r, 0, wxALIGN_CENTER ); - - return r; -} - -void ScrubbingToolBar::Populate() -{ - MakeButtonBackgroundsSmall(); - - /* Buttons */ - AddButton(bmpScrub, bmpScrub, bmpScrubDisabled, STBScrubID, - _("Scrub"), true); - AddButton(bmpSeek, bmpSeek, bmpSeekDisabled, STBSeekID, - _("Seek"), true); - AddButton(bmpToggleScrubBar, bmpToggleScrubBar, bmpToggleScrubBar, - STBBarID, - _("Scrub bar"), true); - - - RegenerateTooltips(); -} - -void ScrubbingToolBar::UpdatePrefs() -{ - RegenerateTooltips(); - - // Set label to pull in language change - SetLabel(_("Scrubbing")); - - // Give base class a chance - ToolBar::UpdatePrefs(); -} - -void ScrubbingToolBar::RegenerateTooltips() -{ -#if wxUSE_TOOLTIPS - std::vector commands; - auto fn = [&] - (AButton &button, const wxString &label, const wxString &command) - { - commands.clear(); - commands.push_back(label); - commands.push_back(command); - ToolBar::SetButtonToolTip(button, commands); - }; - - auto project = GetActiveProject(); - if (project) { - auto &scrubber = project->GetScrubber(); - - const auto scrubButton = mButtons[STBScrubID]; - const auto seekButton = mButtons[STBSeekID]; - - wxString label; - label = ( - scrubber.Scrubs() - /* i18n-hint: These commands assist the user in finding a sound by ear. ... - "Scrubbing" is variable-speed playback, ... - "Seeking" is normal speed playback but with skips - */ - ? _("Stop Scrubbing") - : _("Start Scrubbing") - ); - fn(*scrubButton, label, wxT("Scrub")); - - label = ( - scrubber.Seeks() - /* i18n-hint: These commands assist the user in finding a sound by ear. ... - "Scrubbing" is variable-speed playback, ... - "Seeking" is normal speed playback but with skips - */ - ? _("Stop Seeking") - : _("Start Seeking") - ); - fn(*seekButton, label, wxT("Seek")); - - label = ( - project->GetRulerPanel()->ShowingScrubBar() - ? _("Hide Scrub Bar") - : _("Show Scrub Bar") - ); - fn(*mButtons[STBBarID], label, wxT("ToggleScrubBar")); - } -#endif -} - -void ScrubbingToolBar::OnButton(wxCommandEvent &event) -{ - AudacityProject *p = GetActiveProject(); - if (!p) return; - auto &scrubber = p->GetScrubber(); - - int id = event.GetId(); - - switch (id) { - case STBScrubID: - scrubber.OnScrub(event); - break; - case STBSeekID: - scrubber.OnSeek(event); - break; - case STBBarID: - scrubber.OnToggleScrubBar(event); - break; - default: - wxASSERT(false); - } - - EnableDisableButtons(); -} - -void ScrubbingToolBar::EnableDisableButtons() -{ - const auto scrubButton = mButtons[STBScrubID]; - scrubButton->SetEnabled(true); - const auto seekButton = mButtons[STBSeekID]; - seekButton->SetEnabled(true); - - AudacityProject *p = GetActiveProject(); - if (!p) return; - - auto &scrubber = p->GetScrubber(); - const auto canScrub = scrubber.CanScrub(); - - if (scrubber.Scrubs()) { - scrubButton->PushDown(); - scrubButton->Enable(); - } - else { - scrubButton->PopUp(); - if (canScrub) - scrubButton->Enable(); - else - scrubButton->Disable(); - } - - if (scrubber.Seeks()) { - seekButton->PushDown(); - seekButton->Enable(); - } - else { - seekButton->PopUp(); - if (canScrub) - seekButton->Enable(); - else - seekButton->Disable(); - } - - const auto barButton = mButtons[STBBarID]; - barButton->Enable(); - if (p->GetRulerPanel()->ShowingScrubBar()) - barButton->PushDown(); - else - barButton->PopUp(); -} diff --git a/src/toolbars/EditToolBar.h b/src/toolbars/EditToolBar.h index 088136896..8f8cbfe67 100644 --- a/src/toolbars/EditToolBar.h +++ b/src/toolbars/EditToolBar.h @@ -97,67 +97,5 @@ class EditToolBar final : public ToolBar { DECLARE_EVENT_TABLE(); }; -// PRL: to do: move this to its own file - -#include - -#include "ToolBar.h" -#include "../Theme.h" -#include "../Experimental.h" - -class wxCommandEvent; -class wxDC; -class wxImage; -class wxWindow; - -class AButton; - -enum { - STBScrubID, - STBSeekID, - STBBarID, - - STBNumButtons, - STBFirstButton = STBScrubID -}; - -class ScrubbingToolBar final : public ToolBar { - -public: - - ScrubbingToolBar(); - virtual ~ScrubbingToolBar(); - - void Create(wxWindow *parent); - - void OnButton(wxCommandEvent & event); - - void Populate(); - void Repaint(wxDC * WXUNUSED(dc)) {}; - void EnableDisableButtons() override; - void UpdatePrefs() override; - - void RegenerateTooltips() override; - -private: - - AButton *AddButton(teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled, - int id, const wxChar *label, bool toggle = false); - - void MakeButtons(); - - AButton *mButtons[STBNumButtons]; - - wxImage *upImage; - wxImage *downImage; - wxImage *hiliteImage; - -public: - - DECLARE_CLASS(EditToolBar); - DECLARE_EVENT_TABLE(); -}; - - #endif diff --git a/src/toolbars/ScrubbingToolBar.cpp b/src/toolbars/ScrubbingToolBar.cpp new file mode 100644 index 000000000..7354ae468 --- /dev/null +++ b/src/toolbars/ScrubbingToolBar.cpp @@ -0,0 +1,253 @@ +/********************************************************************** + + Audacity: A Digital Audio Editor + + ScrubbingToolBar.cpp + + Paul Licameli + + See ScrubbingToolBar.h for details + + *******************************************************************/ + +// Much of this is imitative of EditToolBar. Should there be a common base +// class? +#include "../Audacity.h" +#include "ScrubbingToolBar.h" + +// For compilers that support precompilation, includes "wx/wx.h". +#include + +#ifndef WX_PRECOMP +#include +#include +#include +#include +#include +#endif + +#include "../AllThemeResources.h" +#include "../AudioIO.h" +#include "../ImageManipulation.h" +#include "../Internat.h" +#include "../Prefs.h" +#include "../Project.h" +#include "../Theme.h" +#include "../Track.h" +#include "../UndoManager.h" +#include "../widgets/AButton.h" +#include "../widgets/Ruler.h" +#include "../tracks/ui/Scrubbing.h" + +#include "../Experimental.h" + +IMPLEMENT_CLASS(ScrubbingToolBar, ToolBar); + +//const int BUTTON_WIDTH = 27; +//const int SEPARATOR_WIDTH = 14; + +//////////////////////////////////////////////////////////// +/// Methods for ScrubbingToolBar +//////////////////////////////////////////////////////////// + +BEGIN_EVENT_TABLE( ScrubbingToolBar, ToolBar ) +EVT_COMMAND_RANGE( STBFirstButton, + STBFirstButton + STBNumButtons - 1, + wxEVT_COMMAND_BUTTON_CLICKED, + ScrubbingToolBar::OnButton ) +END_EVENT_TABLE() + +//Standard contructor +ScrubbingToolBar::ScrubbingToolBar() +: ToolBar(ScrubbingBarID, _("Scrub"), wxT("Scrub")) +{ +} + +ScrubbingToolBar::~ScrubbingToolBar() +{ +} + +void ScrubbingToolBar::Create(wxWindow * parent) +{ + ToolBar::Create(parent); +} + +/// This is a convenience function that allows for button creation in +/// MakeButtons() with fewer arguments +/// Very similar to code in ControlToolBar... +AButton *ScrubbingToolBar::AddButton +(teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled, + int id, + const wxChar *label, + bool toggle) +{ + AButton *&r = mButtons[id]; + + r = ToolBar::MakeButton + (this, + bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall, + eEnabledUp, eEnabledDown, eDisabled, + wxWindowID(id), + wxDefaultPosition, + toggle, + theTheme.ImageSize( bmpRecoloredUpSmall )); + + r->SetLabel(label); + // JKC: Unlike ControlToolBar, does not have a focus rect. Shouldn't it? + // r->SetFocusRect( r->GetRect().Deflate( 4, 4 ) ); + + Add( r, 0, wxALIGN_CENTER ); + + return r; +} + +void ScrubbingToolBar::Populate() +{ + MakeButtonBackgroundsSmall(); + + /* Buttons */ + AddButton(bmpScrub, bmpScrub, bmpScrubDisabled, STBScrubID, + _("Scrub"), true); + AddButton(bmpSeek, bmpSeek, bmpSeekDisabled, STBSeekID, + _("Seek"), true); + AddButton(bmpToggleScrubBar, bmpToggleScrubBar, bmpToggleScrubBar, + STBBarID, + _("Scrub bar"), true); + + + RegenerateTooltips(); +} + +void ScrubbingToolBar::UpdatePrefs() +{ + RegenerateTooltips(); + + // Set label to pull in language change + SetLabel(_("Scrubbing")); + + // Give base class a chance + ToolBar::UpdatePrefs(); +} + +void ScrubbingToolBar::RegenerateTooltips() +{ +#if wxUSE_TOOLTIPS + std::vector commands; + auto fn = [&] + (AButton &button, const wxString &label, const wxString &command) + { + commands.clear(); + commands.push_back(label); + commands.push_back(command); + ToolBar::SetButtonToolTip(button, commands); + }; + + auto project = GetActiveProject(); + if (project) { + auto &scrubber = project->GetScrubber(); + + const auto scrubButton = mButtons[STBScrubID]; + const auto seekButton = mButtons[STBSeekID]; + + wxString label; + label = ( + scrubber.Scrubs() + /* i18n-hint: These commands assist the user in finding a sound by ear. ... + "Scrubbing" is variable-speed playback, ... + "Seeking" is normal speed playback but with skips + */ + ? _("Stop Scrubbing") + : _("Start Scrubbing") + ); + fn(*scrubButton, label, wxT("Scrub")); + + label = ( + scrubber.Seeks() + /* i18n-hint: These commands assist the user in finding a sound by ear. ... + "Scrubbing" is variable-speed playback, ... + "Seeking" is normal speed playback but with skips + */ + ? _("Stop Seeking") + : _("Start Seeking") + ); + fn(*seekButton, label, wxT("Seek")); + + label = ( + project->GetRulerPanel()->ShowingScrubBar() + ? _("Hide Scrub Bar") + : _("Show Scrub Bar") + ); + fn(*mButtons[STBBarID], label, wxT("ToggleScrubBar")); + } +#endif +} + +void ScrubbingToolBar::OnButton(wxCommandEvent &event) +{ + AudacityProject *p = GetActiveProject(); + if (!p) return; + auto &scrubber = p->GetScrubber(); + + int id = event.GetId(); + + switch (id) { + case STBScrubID: + scrubber.OnScrub(event); + break; + case STBSeekID: + scrubber.OnSeek(event); + break; + case STBBarID: + scrubber.OnToggleScrubBar(event); + break; + default: + wxASSERT(false); + } + + EnableDisableButtons(); +} + +void ScrubbingToolBar::EnableDisableButtons() +{ + const auto scrubButton = mButtons[STBScrubID]; + scrubButton->SetEnabled(true); + const auto seekButton = mButtons[STBSeekID]; + seekButton->SetEnabled(true); + + AudacityProject *p = GetActiveProject(); + if (!p) return; + + auto &scrubber = p->GetScrubber(); + const auto canScrub = scrubber.CanScrub(); + + if (scrubber.Scrubs()) { + scrubButton->PushDown(); + scrubButton->Enable(); + } + else { + scrubButton->PopUp(); + if (canScrub) + scrubButton->Enable(); + else + scrubButton->Disable(); + } + + if (scrubber.Seeks()) { + seekButton->PushDown(); + seekButton->Enable(); + } + else { + seekButton->PopUp(); + if (canScrub) + seekButton->Enable(); + else + seekButton->Disable(); + } + + const auto barButton = mButtons[STBBarID]; + barButton->Enable(); + if (p->GetRulerPanel()->ShowingScrubBar()) + barButton->PushDown(); + else + barButton->PopUp(); +} diff --git a/src/toolbars/ScrubbingToolBar.h b/src/toolbars/ScrubbingToolBar.h new file mode 100644 index 000000000..a34bd90f3 --- /dev/null +++ b/src/toolbars/ScrubbingToolBar.h @@ -0,0 +1,76 @@ +/********************************************************************** + + Audacity: A Digital Audio Editor + + + ScrubbingToolbar.h + + Paul Licameli + + **********************************************************************/ + +#ifndef __AUDACITY_SCRUBBING_TOOLBAR__ +#define __AUDACITY_SCRUBBING_TOOLBAR__ + + + +#include + +#include "ToolBar.h" +#include "../Theme.h" +#include "../Experimental.h" + +class wxCommandEvent; +class wxDC; +class wxImage; +class wxWindow; + +class AButton; + +enum { + STBScrubID, + STBSeekID, + STBBarID, + + STBNumButtons, + STBFirstButton = STBScrubID +}; + +class ScrubbingToolBar final : public ToolBar { + +public: + + ScrubbingToolBar(); + virtual ~ScrubbingToolBar(); + + void Create(wxWindow *parent); + + void OnButton(wxCommandEvent & event); + + void Populate(); + void Repaint(wxDC * WXUNUSED(dc)) {}; + void EnableDisableButtons() override; + void UpdatePrefs() override; + + void RegenerateTooltips() override; + +private: + + AButton *AddButton(teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled, + int id, const wxChar *label, bool toggle = false); + + void MakeButtons(); + + AButton *mButtons[STBNumButtons]; + + wxImage *upImage; + wxImage *downImage; + wxImage *hiliteImage; + +public: + + DECLARE_CLASS(EditToolBar); + DECLARE_EVENT_TABLE(); +}; + +#endif diff --git a/src/toolbars/ToolManager.cpp b/src/toolbars/ToolManager.cpp index adfb02868..334d676c0 100644 --- a/src/toolbars/ToolManager.cpp +++ b/src/toolbars/ToolManager.cpp @@ -53,6 +53,7 @@ #include "EditToolBar.h" #include "MeterToolBar.h" #include "MixerToolBar.h" +#include "ScrubbingToolBar.h" #include "SelectionBar.h" #include "SpectralSelectionBar.h" #include "ToolsToolBar.h" diff --git a/src/tracks/ui/Scrubbing.cpp b/src/tracks/ui/Scrubbing.cpp index 2a0ac064b..a119b9a15 100644 --- a/src/tracks/ui/Scrubbing.cpp +++ b/src/tracks/ui/Scrubbing.cpp @@ -21,7 +21,7 @@ Paul Licameli split from TrackPanel.cpp #include "../../commands/CommandFunctors.h" #include "../../prefs/PlaybackPrefs.h" #include "../../toolbars/ControlToolBar.h" -#include "../../toolbars/EditToolBar.h" +#include "../../toolbars/ScrubbingToolBar.h" #include "../../toolbars/ToolManager.h" #undef USE_TRANSCRIPTION_TOOLBAR diff --git a/win/Projects/Audacity/Audacity.vcxproj b/win/Projects/Audacity/Audacity.vcxproj index 2661bf57a..c7a670f31 100755 --- a/win/Projects/Audacity/Audacity.vcxproj +++ b/win/Projects/Audacity/Audacity.vcxproj @@ -212,6 +212,7 @@ + @@ -445,6 +446,7 @@ + diff --git a/win/Projects/Audacity/Audacity.vcxproj.filters b/win/Projects/Audacity/Audacity.vcxproj.filters index a0a6ab13f..5a3377d7c 100755 --- a/win/Projects/Audacity/Audacity.vcxproj.filters +++ b/win/Projects/Audacity/Audacity.vcxproj.filters @@ -884,6 +884,9 @@ src\effects + + src\toolbars + @@ -1789,6 +1792,9 @@ src\effects + + src\toolbars + From fe509ed412a77a9e04c4b6b93d7a47f3b5f20205 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Fri, 24 Jun 2016 23:48:03 -0400 Subject: [PATCH 02/14] Fix drawing of focus rectangles in buttons, meters, sliders on Mac --- src/AColor.cpp | 9 +++++++++ src/toolbars/ControlToolBar.cpp | 9 ++++++++- src/widgets/AButton.cpp | 2 -- src/widgets/Meter.cpp | 2 -- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/AColor.cpp b/src/AColor.cpp index b0f1d1241..9c8a6a459 100644 --- a/src/AColor.cpp +++ b/src/AColor.cpp @@ -174,11 +174,20 @@ void AColor::DrawFocus(wxDC & dc, wxRect & rect) x2 = rect.GetRight(), y2 = rect.GetBottom(); +#ifdef __WXMAC__ + // Why must this be different? + // Otherwise nothing is visible if you do as for the + // other platforms. + dc.SetPen(wxPen(wxT("MEDIUM GREY"), 1, wxSOLID)); + + dc.SetLogicalFunction(wxCOPY); +#else dc.SetPen(wxPen(wxT("MEDIUM GREY"), 0, wxSOLID)); // this seems to be closer than what Windows does than wxINVERT although // I'm still not sure if it's correct dc.SetLogicalFunction(wxAND_REVERSE); +#endif wxCoord z; for ( z = x1 + 1; z < x2; z += 2 ) diff --git a/src/toolbars/ControlToolBar.cpp b/src/toolbars/ControlToolBar.cpp index a8cb8d15e..4febfea62 100644 --- a/src/toolbars/ControlToolBar.cpp +++ b/src/toolbars/ControlToolBar.cpp @@ -138,7 +138,14 @@ AButton *ControlToolBar::MakeButton(teBmps eEnabledUp, teBmps eEnabledDown, teBm wxDefaultPosition, processdownevents, theTheme.ImageSize( bmpRecoloredUpLarge )); r->SetLabel(label); - r->SetFocusRect( r->GetRect().Deflate( 12, 12 ) ); + enum { deflation = +#ifdef __WXMAC__ + 3 +#else + 12 +#endif + }; + r->SetFocusRect( r->GetClientRect().Deflate( deflation, deflation ) ); return r; } diff --git a/src/widgets/AButton.cpp b/src/widgets/AButton.cpp index fd7804588..3afae75d6 100644 --- a/src/widgets/AButton.cpp +++ b/src/widgets/AButton.cpp @@ -343,12 +343,10 @@ void AButton::OnPaint(wxPaintEvent & WXUNUSED(event)) mImages[mAlternateIdx].mArr[buttonState].Draw(dc, GetClientRect()); -#if defined(__WXMSW__) || defined(__WXGTK__) if( mButtonIsFocused ) { AColor::DrawFocus( dc, mFocusRect ); } -#endif } void AButton::OnErase(wxEraseEvent & WXUNUSED(event)) diff --git a/src/widgets/Meter.cpp b/src/widgets/Meter.cpp index 3f126a4a5..c7941710d 100644 --- a/src/widgets/Meter.cpp +++ b/src/widgets/Meter.cpp @@ -659,13 +659,11 @@ void Meter::OnPaint(wxPaintEvent & WXUNUSED(event)) } } -#if defined(__WXMSW__) || defined(__WXGTK__) if (mIsFocused) { wxRect r = mIconRect; AColor::DrawFocus(destDC, r.Inflate(1, 1)); } -#endif delete paintDC; } From d31e96aa5741f893b6c20556bda79c06db7b35c1 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Fri, 24 Jun 2016 23:23:20 -0400 Subject: [PATCH 03/14] Make tabbing between toolbar buttons work on Mac --- src/widgets/AButton.cpp | 9 +++++++++ src/widgets/AButton.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/widgets/AButton.cpp b/src/widgets/AButton.cpp index 3afae75d6..d1ca98113 100644 --- a/src/widgets/AButton.cpp +++ b/src/widgets/AButton.cpp @@ -242,6 +242,15 @@ void AButton::UseDisabledAsDownHiliteImage(bool flag) mUseDisabledAsDownHiliteImage = flag; } +// This compensates for a but in wxWidgets 3.0.2 for mac: +// Couldn't set focus from keyboard when AcceptsFocus returns false; +// this bypasses that limitation +void AButton::SetFocusFromKbd() +{ + auto temp = AButton::TemporarilyAllowFocus(); + SetFocus(); +} + void AButton::SetAlternateImages(unsigned idx, wxImage up, wxImage over, diff --git a/src/widgets/AButton.h b/src/widgets/AButton.h index a57d5af54..af071e06c 100644 --- a/src/widgets/AButton.h +++ b/src/widgets/AButton.h @@ -59,6 +59,8 @@ class AButton final : public wxWindow { bool AcceptsFocus() const override { return s_AcceptsFocus; } bool AcceptsFocusFromKeyboard() const override { return true; } + void SetFocusFromKbd() override; + // Associate a set of four images (button up, highlight, button down, // disabled) with one nondefault state of the button void SetAlternateImages(unsigned idx, From 57788c8d7ada79f6ff9a54ff4fdaaf79b40004a8 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 25 Jun 2016 00:06:22 -0400 Subject: [PATCH 04/14] Fix Mac tabbing to sliders and meters, analogously to buttons... ... And make sure they don't steal focus when clicked or double clicked --- src/Menus.cpp | 8 ++++++-- src/widgets/AButton.cpp | 7 ++++++- src/widgets/AButton.h | 5 +---- src/widgets/ASlider.cpp | 16 ++++++++++++++++ src/widgets/ASlider.h | 14 +++++++++++++- src/widgets/Meter.cpp | 17 +++++++++++++++++ src/widgets/Meter.h | 14 ++++++++++++-- 7 files changed, 71 insertions(+), 10 deletions(-) diff --git a/src/Menus.cpp b/src/Menus.cpp index 5c28cd5b9..0cf500a59 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -137,6 +137,8 @@ simplifies construction of menu items. #include "tracks/ui/Scrubbing.h" #include "prefs/TracksPrefs.h" +#include "widgets/Meter.h" + enum { kAlignStartZero = 0, kAlignStartSelStart, @@ -2752,10 +2754,12 @@ void AudacityProject::OnSetRightSelection() void AudacityProject::NextOrPrevFrame(bool forward) { // Focus won't take in a dock unless at least one descendant window - // accepts focus. Tell all AButtons to take focus for the duration of this + // accepts focus. Tell controls to take focus for the duration of this // function, only. Outside of this, they won't steal the focus when // clicked. - auto temp = AButton::TemporarilyAllowFocus(); + auto temp1 = AButton::TemporarilyAllowFocus(); + auto temp2 = ASlider::TemporarilyAllowFocus(); + auto temp3 = Meter::TemporarilyAllowFocus(); // Define the set of windows we rotate among. diff --git a/src/widgets/AButton.cpp b/src/widgets/AButton.cpp index d1ca98113..2097af780 100644 --- a/src/widgets/AButton.cpp +++ b/src/widgets/AButton.cpp @@ -247,7 +247,7 @@ void AButton::UseDisabledAsDownHiliteImage(bool flag) // this bypasses that limitation void AButton::SetFocusFromKbd() { - auto temp = AButton::TemporarilyAllowFocus(); + auto temp = TemporarilyAllowFocus(); SetFocus(); } @@ -574,6 +574,11 @@ void AButton::SetControl(bool control) mWasControlDown = control; } +auto AButton::TemporarilyAllowFocus() -> TempAllowFocus { + s_AcceptsFocus = true; + return std::move(TempAllowFocus{ &s_AcceptsFocus }); +} + #if wxUSE_ACCESSIBILITY AButtonAx::AButtonAx( wxWindow *window ): diff --git a/src/widgets/AButton.h b/src/widgets/AButton.h index af071e06c..0b9ae77f5 100644 --- a/src/widgets/AButton.h +++ b/src/widgets/AButton.h @@ -144,10 +144,7 @@ class AButton final : public wxWindow { using TempAllowFocus = std::unique_ptr; public: - static TempAllowFocus TemporarilyAllowFocus() { - s_AcceptsFocus = true; - return std::move(TempAllowFocus{ &s_AcceptsFocus }); - } + static TempAllowFocus TemporarilyAllowFocus(); private: diff --git a/src/widgets/ASlider.cpp b/src/widgets/ASlider.cpp index 526951ed8..48d208489 100644 --- a/src/widgets/ASlider.cpp +++ b/src/widgets/ASlider.cpp @@ -1783,6 +1783,22 @@ bool ASlider::IsEnabled() const return mLWSlider->GetEnabled(); } +bool ASlider::s_AcceptsFocus{ false }; + +auto ASlider::TemporarilyAllowFocus() -> TempAllowFocus { + s_AcceptsFocus = true; + return std::move(TempAllowFocus{ &s_AcceptsFocus }); +} + +// This compensates for a but in wxWidgets 3.0.2 for mac: +// Couldn't set focus from keyboard when AcceptsFocus returns false; +// this bypasses that limitation +void ASlider::SetFocusFromKbd() +{ + auto temp = TemporarilyAllowFocus(); + SetFocus(); +} + #if wxUSE_ACCESSIBILITY ASliderAx::ASliderAx( wxWindow * window ) : diff --git a/src/widgets/ASlider.h b/src/widgets/ASlider.h index ff4d6a0ec..927741f81 100644 --- a/src/widgets/ASlider.h +++ b/src/widgets/ASlider.h @@ -15,6 +15,7 @@ #include "../Experimental.h" +#include "../MemoryX.h" #include #include #include @@ -264,7 +265,10 @@ class ASlider /* not final */ : public wxPanel int orientation = wxHORIZONTAL); virtual ~ASlider(); - bool AcceptsFocus() const override { return false; } + bool AcceptsFocus() const override { return s_AcceptsFocus; } + bool AcceptsFocusFromKeyboard() const override { return true; } + + void SetFocusFromKbd() override; void GetScroll(float & line, float & page); void SetScroll(float line, float page); @@ -298,6 +302,14 @@ class ASlider /* not final */ : public wxPanel bool Enable(bool enable = true); bool IsEnabled() const; +private: + static bool s_AcceptsFocus; + struct Resetter { void operator () (bool *p) const { if(p) *p = false; } }; + using TempAllowFocus = std::unique_ptr; + +public: + static TempAllowFocus TemporarilyAllowFocus(); + private: LWSlider *mLWSlider; bool mSliderIsFocused; diff --git a/src/widgets/Meter.cpp b/src/widgets/Meter.cpp index c7941710d..3b2378274 100644 --- a/src/widgets/Meter.cpp +++ b/src/widgets/Meter.cpp @@ -2083,6 +2083,23 @@ wxString Meter::Key(const wxString & key) const return wxT("/Meter/Output/") + key; } +bool Meter::s_AcceptsFocus{ false }; + +auto Meter::TemporarilyAllowFocus() -> TempAllowFocus { + s_AcceptsFocus = true; + return std::move(TempAllowFocus{ &s_AcceptsFocus }); +} + +// This compensates for a but in wxWidgets 3.0.2 for mac: +// Couldn't set focus from keyboard when AcceptsFocus returns false; +// this bypasses that limitation +void Meter::SetFocusFromKbd() +{ + auto temp = TemporarilyAllowFocus(); + SetFocus(); +} + + #if wxUSE_ACCESSIBILITY MeterAx::MeterAx(wxWindow *window): diff --git a/src/widgets/Meter.h b/src/widgets/Meter.h index adacdd23a..f70b34248 100644 --- a/src/widgets/Meter.h +++ b/src/widgets/Meter.h @@ -113,8 +113,10 @@ class Meter final : public wxPanel ~Meter(); - bool AcceptsFocus() const override { return false; }; - bool AcceptsFocusFromKeyboard() const override { return true; }; + bool AcceptsFocus() const override { return s_AcceptsFocus; } + bool AcceptsFocusFromKeyboard() const override { return true; } + + void SetFocusFromKbd() override; void UpdatePrefs(); void Clear(); @@ -179,6 +181,14 @@ class Meter final : public wxPanel void *SaveState(); void RestoreState(void *state); + private: + static bool s_AcceptsFocus; + struct Resetter { void operator () (bool *p) const { if(p) *p = false; } }; + using TempAllowFocus = std::unique_ptr; + + public: + static TempAllowFocus TemporarilyAllowFocus(); + private: // // Event handlers From ae14cb0dbccf9587b7a13f5ddc49c2b27acfec1e Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 25 Jun 2016 02:42:22 -0400 Subject: [PATCH 05/14] Allow tabbing to the button on the time ruler... ... by making the ruler and the upper tool dock part of one panel --- src/Menus.cpp | 2 +- src/Project.cpp | 27 ++++++++++++++++++++++----- src/Project.h | 4 +++- src/toolbars/ToolManager.cpp | 4 ++-- src/toolbars/ToolManager.h | 2 +- src/widgets/Ruler.cpp | 7 ++++--- src/widgets/Ruler.h | 3 ++- 7 files changed, 35 insertions(+), 14 deletions(-) diff --git a/src/Menus.cpp b/src/Menus.cpp index 0cf500a59..6cb1045f0 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -2770,7 +2770,7 @@ void AudacityProject::NextOrPrevFrame(bool forward) ; wxWindow *const begin [rotationSize] = { - mToolManager->GetTopDock(), + GetTopPanel(), #ifdef EXPERIMENTAL_TIME_RULER_NAVIGATION GetRulerPanel(), #endif diff --git a/src/Project.cpp b/src/Project.cpp index 90f3923a4..464b9ca2e 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -875,10 +875,21 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, // Near as I can tell, this is only a problem under Windows. // + + // PRL: this panel groups the top tool dock and the ruler into one + // tab cycle. + // Must create it with non-default width equal to the main window width, + // or else the device toolbar doesn't make initial widths of the choice + // controls correct. + mTopPanel = safenew wxPanel { + this, wxID_ANY, wxDefaultPosition, { this->GetSize().GetWidth(), -1 } + }; + mTopPanel->SetAutoLayout(true); + // // Create the ToolDock // - mToolManager = std::make_unique( this ); + mToolManager = std::make_unique( this, mTopPanel ); GetSelectionBar()->SetListener(this); #ifdef EXPERIMENTAL_SPECTRAL_EDITING GetSpectralSelectionBar()->SetListener(this); @@ -888,7 +899,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, // // Create the horizontal ruler // - mRuler = safenew AdornedRulerPanel( this, + mRuler = safenew AdornedRulerPanel( this, mTopPanel, wxID_ANY, wxDefaultPosition, wxSize( -1, AdornedRulerPanel::GetRulerHeight(false) ), @@ -928,12 +939,18 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, //pPage->SetBackgroundColour( theTheme.Colour( clrDark )); #endif + { + auto ubs = std::make_unique(wxVERTICAL); + ubs->Add(mToolManager->GetTopDock(), 0, wxEXPAND | wxALIGN_TOP); + ubs->Add(mRuler, 0, wxEXPAND); + mTopPanel->SetSizer(ubs.release()); + } + wxBoxSizer *bs; { auto ubs = std::make_unique(wxVERTICAL); bs = ubs.get(); - bs->Add(mToolManager->GetTopDock(), 0, wxEXPAND | wxALIGN_TOP); - bs->Add(mRuler, 0, wxEXPAND); + bs->Add(mTopPanel, 0, wxEXPAND | wxALIGN_TOP); bs->Add(pPage, 1, wxEXPAND); bs->Add(mToolManager->GetBotDock(), 0, wxEXPAND); SetAutoLayout(true); @@ -999,7 +1016,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, // will be given the focus even if we try to SetFocus(). By // making the TrackPanel that first window, we resolve several // keyboard focus problems. - pPage->MoveBeforeInTabOrder(mToolManager->GetTopDock()); + pPage->MoveBeforeInTabOrder(mTopPanel); bs = (wxBoxSizer *)pPage->GetSizer(); diff --git a/src/Project.h b/src/Project.h index 29d9173e6..0e33dfb0e 100644 --- a/src/Project.h +++ b/src/Project.h @@ -258,7 +258,8 @@ class AUDACITY_DLL_API AudacityProject final : public wxFrame, bool GetDirty() { return mDirty; } void SetProjectTitle(); - TrackPanel * GetTrackPanel(){return mTrackPanel;} + wxPanel *GetTopPanel() { return mTopPanel; } + TrackPanel * GetTrackPanel() {return mTrackPanel;} bool GetIsEmpty(); @@ -594,6 +595,7 @@ public: wxStatusBar *mStatusBar; AdornedRulerPanel *mRuler{}; + wxPanel *mTopPanel{}; TrackPanel *mTrackPanel{}; TrackFactory *mTrackFactory{}; wxPanel * mMainPanel; diff --git a/src/toolbars/ToolManager.cpp b/src/toolbars/ToolManager.cpp index 334d676c0..fa50ab039 100644 --- a/src/toolbars/ToolManager.cpp +++ b/src/toolbars/ToolManager.cpp @@ -350,7 +350,7 @@ END_EVENT_TABLE() // // Constructor // -ToolManager::ToolManager( AudacityProject *parent ) +ToolManager::ToolManager( AudacityProject *parent, wxWindow *topDockParent ) : wxEvtHandler() { wxPoint pt[ 3 ]; @@ -433,7 +433,7 @@ ToolManager::ToolManager( AudacityProject *parent ) this ); // Create the top and bottom docks - mTopDock = safenew ToolDock( this, mParent, TopDockID ); + mTopDock = safenew ToolDock( this, topDockParent, TopDockID ); mBotDock = safenew ToolDock( this, mParent, BotDockID ); // Create all of the toolbars diff --git a/src/toolbars/ToolManager.h b/src/toolbars/ToolManager.h index 4c4da2ece..8e8eb0d55 100644 --- a/src/toolbars/ToolManager.h +++ b/src/toolbars/ToolManager.h @@ -45,7 +45,7 @@ class ToolManager final : public wxEvtHandler public: - ToolManager( AudacityProject *parent ); + ToolManager( AudacityProject *parent, wxWindow *topDockParent ); ~ToolManager(); void LayoutToolBars(); diff --git a/src/widgets/Ruler.cpp b/src/widgets/Ruler.cpp index 5f534a2c7..e1736a05e 100644 --- a/src/widgets/Ruler.cpp +++ b/src/widgets/Ruler.cpp @@ -1953,13 +1953,14 @@ BEGIN_EVENT_TABLE(AdornedRulerPanel, OverlayPanel) END_EVENT_TABLE() -AdornedRulerPanel::AdornedRulerPanel(AudacityProject* parent, +AdornedRulerPanel::AdornedRulerPanel(AudacityProject* project, + wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, ViewInfo *viewinfo) : OverlayPanel(parent, id, pos, size) -, mProject(parent) +, mProject(project) , mViewInfo(viewinfo) { for (auto &button : mButtons) @@ -1991,7 +1992,7 @@ AdornedRulerPanel::AdornedRulerPanel(AudacityProject* parent, mRuler.SetLabelEdges( false ); mRuler.SetFormat( Ruler::TimeFormat ); - mTracks = parent->GetTracks(); + mTracks = project->GetTracks(); mSnapManager = NULL; mIsSnapped = false; diff --git a/src/widgets/Ruler.h b/src/widgets/Ruler.h index d091bc43d..4259d4c82 100644 --- a/src/widgets/Ruler.h +++ b/src/widgets/Ruler.h @@ -285,7 +285,8 @@ class QuickPlayRulerOverlay; class AUDACITY_DLL_API AdornedRulerPanel final : public OverlayPanel { public: - AdornedRulerPanel(AudacityProject* parent, + AdornedRulerPanel(AudacityProject *project, + wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, From 4739f3e27b4359fcf897c24644b33032a4d0e3da Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 25 Jun 2016 14:18:23 -0400 Subject: [PATCH 06/14] Compensate for wxW 3 tab navigation deficiencies on Mac... ... using char hook event handlers. We don't need to go the extreme length of patching wxWidgets source. --- mac/Audacity.xcodeproj/project.pbxproj | 52 +++++++++++-------- src/Lyrics.cpp | 6 +-- src/Lyrics.h | 4 +- src/Makefile.am | 2 + src/MixerBoard.cpp | 4 +- src/MixerBoard.h | 4 +- src/Project.cpp | 4 +- src/ShuttleGui.cpp | 15 +++--- src/effects/AutoDuck.cpp | 4 +- src/effects/AutoDuck.h | 4 +- src/effects/Compressor.cpp | 4 +- src/effects/Compressor.h | 4 +- src/effects/Effect.cpp | 8 +-- src/effects/EffectRack.cpp | 2 +- src/effects/Equalization.cpp | 6 +-- src/effects/Equalization.h | 2 +- src/effects/ScienFilter.cpp | 4 +- src/effects/ScienFilter.h | 2 +- src/effects/audiounits/AudioUnitEffect.cpp | 4 +- src/effects/lv2/LV2Effect.cpp | 3 +- src/export/Export.cpp | 6 +-- src/export/Export.h | 4 +- src/export/ExportCL.cpp | 6 +-- src/export/ExportFFmpegDialogs.cpp | 12 ++--- src/export/ExportFFmpegDialogs.h | 11 ++-- src/export/ExportFLAC.cpp | 4 +- src/export/ExportMP2.cpp | 4 +- src/export/ExportMP3.cpp | 6 +-- src/export/ExportOGG.cpp | 4 +- src/export/ExportPCM.cpp | 6 +-- src/prefs/BatchPrefs.cpp | 2 +- src/prefs/PrefsPanel.h | 6 +-- src/toolbars/ToolBar.cpp | 10 ++-- src/toolbars/ToolBar.h | 4 +- src/toolbars/ToolDock.cpp | 6 +-- src/toolbars/ToolDock.h | 3 +- src/widgets/BackedPanel.cpp | 4 +- src/widgets/BackedPanel.h | 4 +- src/widgets/ExpandingToolBar.cpp | 22 ++++---- src/widgets/ExpandingToolBar.h | 7 +-- src/widgets/ImageRoll.cpp | 6 +-- src/widgets/ImageRoll.h | 4 +- src/widgets/Meter.cpp | 6 +-- src/widgets/Meter.h | 3 +- src/widgets/Ruler.cpp | 8 +-- src/widgets/Ruler.h | 2 +- src/widgets/wxPanelWrapper.cpp | 37 +++++++++++++ src/widgets/wxPanelWrapper.h | 32 ++++++++++++ win/Projects/Audacity/Audacity.vcxproj | 2 + .../Audacity/Audacity.vcxproj.filters | 6 +++ 50 files changed, 231 insertions(+), 144 deletions(-) create mode 100644 src/widgets/wxPanelWrapper.cpp create mode 100644 src/widgets/wxPanelWrapper.h diff --git a/mac/Audacity.xcodeproj/project.pbxproj b/mac/Audacity.xcodeproj/project.pbxproj index 948884d26..670fdfe0e 100644 --- a/mac/Audacity.xcodeproj/project.pbxproj +++ b/mac/Audacity.xcodeproj/project.pbxproj @@ -1212,6 +1212,7 @@ 5E74D2E31CC4429700D88B0B /* EditCursorOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E74D2DD1CC4429700D88B0B /* EditCursorOverlay.cpp */; }; 5E74D2E41CC4429700D88B0B /* PlayIndicatorOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E74D2DF1CC4429700D88B0B /* PlayIndicatorOverlay.cpp */; }; 5E74D2E51CC4429700D88B0B /* Scrubbing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E74D2E11CC4429700D88B0B /* Scrubbing.cpp */; }; + 5E94A1BA1D1F1C8400A8713A /* wxPanelWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E94A1B81D1F1C8400A8713A /* wxPanelWrapper.cpp */; }; 5ED1D0AD1CDE55BD00471E3C /* Overlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5ED1D0A91CDE55BD00471E3C /* Overlay.cpp */; }; 5ED1D0AE1CDE55BD00471E3C /* OverlayPanel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5ED1D0AB1CDE55BD00471E3C /* OverlayPanel.cpp */; }; 5ED1D0B11CDE560C00471E3C /* BackedPanel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5ED1D0AF1CDE560C00471E3C /* BackedPanel.cpp */; }; @@ -2987,6 +2988,8 @@ 5E74D2E01CC4429700D88B0B /* PlayIndicatorOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlayIndicatorOverlay.h; sourceTree = ""; }; 5E74D2E11CC4429700D88B0B /* Scrubbing.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Scrubbing.cpp; sourceTree = ""; }; 5E74D2E21CC4429700D88B0B /* Scrubbing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Scrubbing.h; sourceTree = ""; }; + 5E94A1B81D1F1C8400A8713A /* wxPanelWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wxPanelWrapper.cpp; sourceTree = ""; }; + 5E94A1B91D1F1C8400A8713A /* wxPanelWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wxPanelWrapper.h; sourceTree = ""; }; 5ED18DB61CC16B1E00FAFE95 /* Reverb_libSoX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reverb_libSoX.h; sourceTree = ""; }; 5ED18DB71CC290AB00FAFE95 /* wxFileNameWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wxFileNameWrapper.h; sourceTree = ""; }; 5ED1D0A91CDE55BD00471E3C /* Overlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Overlay.cpp; sourceTree = ""; }; @@ -4302,53 +4305,55 @@ isa = PBXGroup; children = ( 1790B0FE09883BFD008A330A /* AButton.cpp */, - 1790B10009883BFD008A330A /* ASlider.cpp */, - 28F1D8170A2D0018005506A7 /* AttachableScrollBar.cpp */, - 5ED1D0AF1CDE560C00471E3C /* BackedPanel.cpp */, - 283AA0E90C56ED08002CBD34 /* ErrorDialog.cpp */, - 28F1D8190A2D0018005506A7 /* ExpandingToolBar.cpp */, - 28CCDCFF0F939FD70081F2FC /* FileHistory.cpp */, - 2897F6FC0AB3DCD0003C20C5 /* Grabber.cpp */, - 280828580A75E0EA000002EF /* Grid.cpp */, - 280112791943EE0E00D98A16 /* HelpSystem.cpp */, - 28530C480DF2105200555C94 /* HtmlWindow.cpp */, - 28F1D81B0A2D0019005506A7 /* ImageRoll.cpp */, - 2849A41E17F8BEC2005C653F /* KeyView.cpp */, - 2816372C0BAE3B6C0079C746 /* LinkingHtmlWindow.cpp */, - 1790B10309883BFD008A330A /* Meter.cpp */, - 1790B10509883BFD008A330A /* MultiDialog.cpp */, - 28001B3C1A0F0E5D007DD161 /* NumericTextCtrl.cpp */, - 28F2CED0181867BB00573D61 /* numformatter.cpp */, - 5ED1D0A91CDE55BD00471E3C /* Overlay.cpp */, - 5ED1D0AB1CDE55BD00471E3C /* OverlayPanel.cpp */, - 28530C4A0DF2105200555C94 /* ProgressDialog.cpp */, - 1790B10709883BFD008A330A /* Ruler.cpp */, - 28F2CED2181867BB00573D61 /* valnum.cpp */, - 1790B10B09883BFD008A330A /* Warning.cpp */, 1790B0FF09883BFD008A330A /* AButton.h */, + 1790B10009883BFD008A330A /* ASlider.cpp */, 1790B10109883BFD008A330A /* ASlider.h */, + 28F1D8170A2D0018005506A7 /* AttachableScrollBar.cpp */, 28F1D8180A2D0018005506A7 /* AttachableScrollBar.h */, + 5ED1D0AF1CDE560C00471E3C /* BackedPanel.cpp */, 5ED1D0B01CDE560C00471E3C /* BackedPanel.h */, + 283AA0E90C56ED08002CBD34 /* ErrorDialog.cpp */, 283AA0EA0C56ED08002CBD34 /* ErrorDialog.h */, + 28F1D8190A2D0018005506A7 /* ExpandingToolBar.cpp */, 28F1D81A0A2D0018005506A7 /* ExpandingToolBar.h */, + 28CCDCFF0F939FD70081F2FC /* FileHistory.cpp */, 28CCDD040F93A0B20081F2FC /* FileHistory.h */, + 2897F6FC0AB3DCD0003C20C5 /* Grabber.cpp */, 2897F6FD0AB3DCD0003C20C5 /* Grabber.h */, + 280828580A75E0EA000002EF /* Grid.cpp */, 280828590A75E0EA000002EF /* Grid.h */, + 280112791943EE0E00D98A16 /* HelpSystem.cpp */, 2801127A1943EE0E00D98A16 /* HelpSystem.h */, + 28530C480DF2105200555C94 /* HtmlWindow.cpp */, 28530C490DF2105200555C94 /* HtmlWindow.h */, + 28F1D81B0A2D0019005506A7 /* ImageRoll.cpp */, 28F1D81C0A2D0019005506A7 /* ImageRoll.h */, + 2849A41E17F8BEC2005C653F /* KeyView.cpp */, 2849A41F17F8BEC2005C653F /* KeyView.h */, + 2816372C0BAE3B6C0079C746 /* LinkingHtmlWindow.cpp */, 2816372D0BAE3B6C0079C746 /* LinkingHtmlWindow.h */, + 1790B10309883BFD008A330A /* Meter.cpp */, 1790B10409883BFD008A330A /* Meter.h */, + 1790B10509883BFD008A330A /* MultiDialog.cpp */, 1790B10609883BFD008A330A /* MultiDialog.h */, + 28001B3C1A0F0E5D007DD161 /* NumericTextCtrl.cpp */, 28001B3D1A0F0E5D007DD161 /* NumericTextCtrl.h */, + 28F2CED0181867BB00573D61 /* numformatter.cpp */, 28F2CED1181867BB00573D61 /* numformatter.h */, + 5ED1D0A91CDE55BD00471E3C /* Overlay.cpp */, 5ED1D0AA1CDE55BD00471E3C /* Overlay.h */, + 5ED1D0AB1CDE55BD00471E3C /* OverlayPanel.cpp */, 5ED1D0AC1CDE55BD00471E3C /* OverlayPanel.h */, + 28530C4A0DF2105200555C94 /* ProgressDialog.cpp */, 28530C4B0DF2105200555C94 /* ProgressDialog.h */, + 1790B10709883BFD008A330A /* Ruler.cpp */, 1790B10809883BFD008A330A /* Ruler.h */, + 28F2CED2181867BB00573D61 /* valnum.cpp */, 28F2CED3181867BB00573D61 /* valnum.h */, + 1790B10B09883BFD008A330A /* Warning.cpp */, 1790B10C09883BFD008A330A /* Warning.h */, + 5E94A1B81D1F1C8400A8713A /* wxPanelWrapper.cpp */, + 5E94A1B91D1F1C8400A8713A /* wxPanelWrapper.h */, ); path = widgets; sourceTree = ""; @@ -7347,6 +7352,7 @@ 1790B14709883BFD008A330A /* Nyquist.cpp in Sources */, 1790B14809883BFD008A330A /* Phaser.cpp in Sources */, 1790B14A09883BFD008A330A /* Repeat.cpp in Sources */, + 5E94A1BA1D1F1C8400A8713A /* wxPanelWrapper.cpp in Sources */, 1790B14B09883BFD008A330A /* Reverse.cpp in Sources */, 1790B14C09883BFD008A330A /* Silence.cpp in Sources */, 1790B14D09883BFD008A330A /* SimpleMono.cpp in Sources */, diff --git a/src/Lyrics.cpp b/src/Lyrics.cpp index 3c465e96b..b9391bfef 100644 --- a/src/Lyrics.cpp +++ b/src/Lyrics.cpp @@ -69,7 +69,7 @@ void HighlightTextCtrl::OnMouseEvent(wxMouseEvent& event) //v static const kHighlightTextCtrlID = 7654; -BEGIN_EVENT_TABLE(Lyrics, wxPanel) +BEGIN_EVENT_TABLE(Lyrics, wxPanelWrapper) EVT_KEY_DOWN(Lyrics::OnKeyEvent) EVT_PAINT(Lyrics::OnPaint) EVT_SIZE(Lyrics::OnSize) @@ -78,12 +78,12 @@ BEGIN_EVENT_TABLE(Lyrics, wxPanel) // EVT_COMMAND_LEFT_CLICK(kHighlightTextCtrlID, Lyrics::OnHighlightTextCtrl) END_EVENT_TABLE() -IMPLEMENT_CLASS(Lyrics, wxPanel) +IMPLEMENT_CLASS(Lyrics, wxPanelWrapper) Lyrics::Lyrics(wxWindow* parent, wxWindowID id, const wxPoint& pos /*= wxDefaultPosition*/, const wxSize& size /*= wxDefaultSize*/): - wxPanel(parent, id, pos, size), + wxPanelWrapper(parent, id, pos, size), mWidth(size.x), mHeight(size.y) { mKaraokeHeight = mHeight; diff --git a/src/Lyrics.h b/src/Lyrics.h index f9cfd87b8..c4aacd10e 100644 --- a/src/Lyrics.h +++ b/src/Lyrics.h @@ -15,8 +15,8 @@ #include "Audacity.h" #include -#include #include +#include "widgets/wxPanelWrapper.h" class LabelTrack; @@ -58,7 +58,7 @@ private: DECLARE_EVENT_TABLE() }; -class Lyrics final : public wxPanel +class Lyrics final : public wxPanelWrapper { DECLARE_DYNAMIC_CLASS(Lyrics) diff --git a/src/Makefile.am b/src/Makefile.am index 3d173dba3..e0fda624d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -584,6 +584,8 @@ audacity_SOURCES = \ widgets/valnum.h \ widgets/Warning.cpp \ widgets/Warning.h \ + widgets/wxPanelWrapper.cpp \ + widgets/wxPanelWrapper.h \ xml/XMLFileReader.cpp \ xml/XMLFileReader.h \ xml/XMLWriter.cpp \ diff --git a/src/MixerBoard.cpp b/src/MixerBoard.cpp index 3cc9e59ad..db5025fc8 100644 --- a/src/MixerBoard.cpp +++ b/src/MixerBoard.cpp @@ -140,7 +140,7 @@ enum { ID_TOGGLEBUTTON_SOLO, }; -BEGIN_EVENT_TABLE(MixerTrackCluster, wxPanel) +BEGIN_EVENT_TABLE(MixerTrackCluster, wxPanelWrapper) EVT_MOUSE_EVENTS(MixerTrackCluster::OnMouseEvent) EVT_PAINT(MixerTrackCluster::OnPaint) @@ -157,7 +157,7 @@ MixerTrackCluster::MixerTrackCluster(wxWindow* parent, WaveTrack* pLeftTrack, WaveTrack* pRightTrack /*= NULL*/, const wxPoint& pos /*= wxDefaultPosition*/, const wxSize& size /*= wxDefaultSize*/) -: wxPanel(parent, -1, pos, size) +: wxPanelWrapper(parent, -1, pos, size) { mMixerBoard = grandParent; mProject = project; diff --git a/src/MixerBoard.h b/src/MixerBoard.h index 83d4936ad..8d041b805 100644 --- a/src/MixerBoard.h +++ b/src/MixerBoard.h @@ -17,13 +17,13 @@ #include #include #include -#include #include #include #include #include "widgets/AButton.h" #include "widgets/ASlider.h" +#include "widgets/wxPanelWrapper.h" // containment hierarchy: // MixerBoardFrame -> MixerBoard -> MixerBoardScrolledWindow -> MixerTrackCluster(s) @@ -68,7 +68,7 @@ class NoteTrack; #endif class WaveTrack; -class MixerTrackCluster final : public wxPanel +class MixerTrackCluster final : public wxPanelWrapper { public: MixerTrackCluster(wxWindow* parent, diff --git a/src/Project.cpp b/src/Project.cpp index 464b9ca2e..3d800d367 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -881,7 +881,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, // Must create it with non-default width equal to the main window width, // or else the device toolbar doesn't make initial widths of the choice // controls correct. - mTopPanel = safenew wxPanel { + mTopPanel = safenew wxPanelWrapper { this, wxID_ANY, wxDefaultPosition, { this->GetSize().GetWidth(), -1 } }; mTopPanel->SetAutoLayout(true); @@ -925,7 +925,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, // Not using a notebook, so we place the track panel inside another panel, // this keeps the notebook code and normal code consistant and also // paves the way for adding additional windows inside the track panel. - mMainPanel = safenew wxPanel(this, -1, + mMainPanel = safenew wxPanelWrapper(this, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER); diff --git a/src/ShuttleGui.cpp b/src/ShuttleGui.cpp index c84506879..c466771a2 100644 --- a/src/ShuttleGui.cpp +++ b/src/ShuttleGui.cpp @@ -107,6 +107,7 @@ for registering for changes. #include "Experimental.h" #include "Shuttle.h" #include "WrappedType.h" +#include "widgets/wxPanelWrapper.h" ShuttleGuiBase::ShuttleGuiBase(wxWindow * pParent, teShuttleMode ShuttleMode ) { @@ -790,7 +791,7 @@ wxPanel * ShuttleGuiBase::StartPanel(int iStyle) if( mShuttleMode != eIsCreating ) return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxPanel); wxPanel * pPanel; - mpWind = pPanel = safenew wxPanel( GetParent(), miId, wxDefaultPosition, wxDefaultSize, + mpWind = pPanel = safenew wxPanelWrapper( GetParent(), miId, wxDefaultPosition, wxDefaultSize, Style( wxNO_BORDER )); if( iStyle != 0 ) @@ -847,7 +848,7 @@ wxNotebookPage * ShuttleGuiBase::StartNotebookPage( const wxString & Name ) return NULL; // return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wx); wxNotebook * pNotebook = (wxNotebook*)mpParent; - wxNotebookPage * pPage = safenew wxPanel(GetParent()); + wxNotebookPage * pPage = safenew wxPanelWrapper(GetParent()); pPage->SetName(Name); pNotebook->AddPage( @@ -869,7 +870,7 @@ void ShuttleGuiBase::StartNotebookPage( const wxString & Name, wxNotebookPage * return; // return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wx); wxNotebook * pNotebook = (wxNotebook*)mpParent; -// wxNotebookPage * pPage = safenew wxPanel(GetParent()); +// wxNotebookPage * pPage = safenew wxPanelWrapper(GetParent()); pPage->Create( mpParent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, wxT("panel")); pPage->SetName(Name); @@ -895,7 +896,7 @@ void ShuttleGuiBase::EndNotebookPage() // Doxygen description is at the start of the file // this is a wxPanel with erase background disabled. -class InvisiblePanel final : public wxPanel +class InvisiblePanel final : public wxPanelWrapper { public: InvisiblePanel( @@ -904,7 +905,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL ) : - wxPanel( parent, id, pos, size, style ) + wxPanelWrapper( parent, id, pos, size, style ) { }; ~InvisiblePanel(){;}; @@ -914,7 +915,7 @@ public: }; -BEGIN_EVENT_TABLE(InvisiblePanel, wxPanel) +BEGIN_EVENT_TABLE(InvisiblePanel, wxPanelWrapper) // EVT_PAINT(InvisiblePanel::OnPaint) EVT_ERASE_BACKGROUND( InvisiblePanel::OnErase) END_EVENT_TABLE() @@ -932,7 +933,7 @@ wxPanel * ShuttleGuiBase::StartInvisiblePanel() if( mShuttleMode != eIsCreating ) return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxPanel); wxPanel * pPanel; - mpWind = pPanel = safenew wxPanel(GetParent(), miId, wxDefaultPosition, wxDefaultSize, + mpWind = pPanel = safenew wxPanelWrapper(GetParent(), miId, wxDefaultPosition, wxDefaultSize, wxNO_BORDER); mpWind->SetBackgroundColour( diff --git a/src/effects/AutoDuck.cpp b/src/effects/AutoDuck.cpp index 288fbda40..601d48b59 100644 --- a/src/effects/AutoDuck.cpp +++ b/src/effects/AutoDuck.cpp @@ -607,7 +607,7 @@ static int GetDistance(const wxPoint& first, const wxPoint& second) return distanceY; } -BEGIN_EVENT_TABLE(EffectAutoDuckPanel, wxPanel) +BEGIN_EVENT_TABLE(EffectAutoDuckPanel, wxPanelWrapper) EVT_PAINT(EffectAutoDuckPanel::OnPaint) EVT_MOUSE_CAPTURE_CHANGED(EffectAutoDuckPanel::OnMouseCaptureChanged) EVT_MOUSE_CAPTURE_LOST(EffectAutoDuckPanel::OnMouseCaptureLost) @@ -617,7 +617,7 @@ BEGIN_EVENT_TABLE(EffectAutoDuckPanel, wxPanel) END_EVENT_TABLE() EffectAutoDuckPanel::EffectAutoDuckPanel(wxWindow *parent, EffectAutoDuck *effect) -: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(600, 300)) +: wxPanelWrapper(parent, wxID_ANY, wxDefaultPosition, wxSize(600, 300)) { mParent = parent; mEffect = effect; diff --git a/src/effects/AutoDuck.h b/src/effects/AutoDuck.h index b63a75043..ba53752b7 100644 --- a/src/effects/AutoDuck.h +++ b/src/effects/AutoDuck.h @@ -14,12 +14,12 @@ #include #include #include -#include #include #include #include #include "Effect.h" +#include "../widgets/wxPanelWrapper.h" class EffectAutoDuckPanel; class ShuttleGui; @@ -90,7 +90,7 @@ private: friend class EffectAutoDuckPanel; }; -class EffectAutoDuckPanel final : public wxPanel +class EffectAutoDuckPanel final : public wxPanelWrapper { public: EffectAutoDuckPanel(wxWindow *parent, EffectAutoDuck *effect); diff --git a/src/effects/Compressor.cpp b/src/effects/Compressor.cpp index 07538d044..44d9ec199 100644 --- a/src/effects/Compressor.cpp +++ b/src/effects/Compressor.cpp @@ -664,7 +664,7 @@ void EffectCompressor::UpdateUI() // EffectCompressorPanel //---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(EffectCompressorPanel, wxPanel) +BEGIN_EVENT_TABLE(EffectCompressorPanel, wxPanelWrapper) EVT_PAINT(EffectCompressorPanel::OnPaint) EVT_SIZE(EffectCompressorPanel::OnSize) END_EVENT_TABLE() @@ -673,7 +673,7 @@ EffectCompressorPanel::EffectCompressorPanel(wxWindow *parent, double & threshold, double & noiseFloor, double & ratio) -: wxPanel(parent), +: wxPanelWrapper(parent), threshold(threshold), noiseFloor(noiseFloor), ratio(ratio) diff --git a/src/effects/Compressor.h b/src/effects/Compressor.h index f45b362d8..ca931b059 100644 --- a/src/effects/Compressor.h +++ b/src/effects/Compressor.h @@ -15,11 +15,11 @@ #include #include #include -#include #include #include #include #include +#include "../widgets/wxPanelWrapper.h" #include "TwoPassSimpleMono.h" @@ -133,7 +133,7 @@ private: DECLARE_EVENT_TABLE(); }; -class EffectCompressorPanel final : public wxPanel +class EffectCompressorPanel final : public wxPanelWrapper { public: EffectCompressorPanel(wxWindow *parent, diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index 27d16dcf4..abc8a3c15 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -2793,11 +2793,11 @@ void EffectDialog::OnOk(wxCommandEvent & WXUNUSED(evt)) // /////////////////////////////////////////////////////////////////////////////// -class EffectPanel final : public wxPanel +class EffectPanel final : public wxPanelWrapper { public: EffectPanel(wxWindow *parent) - : wxPanel(parent) + : wxPanelWrapper(parent) { // This fools NVDA into not saying "Panel" when the dialog gets focus SetName(wxT("\a")); @@ -2984,8 +2984,8 @@ bool EffectUIHost::Initialize() vs->Add(hs.release(), 1, wxEXPAND); } - wxPanel *buttonPanel = safenew wxPanel(this, wxID_ANY); - wxPanel *const bar = safenew wxPanel(buttonPanel, wxID_ANY); + wxPanel *buttonPanel = safenew wxPanelWrapper(this, wxID_ANY); + wxPanel *const bar = safenew wxPanelWrapper(buttonPanel, wxID_ANY); // This fools NVDA into not saying "Panel" when the dialog gets focus bar->SetName(wxT("\a")); diff --git a/src/effects/EffectRack.cpp b/src/effects/EffectRack.cpp index 316b95a4b..70adf8f0a 100644 --- a/src/effects/EffectRack.cpp +++ b/src/effects/EffectRack.cpp @@ -106,7 +106,7 @@ EffectRack::EffectRack() { auto bs = std::make_unique(wxVERTICAL); - mPanel = safenew wxPanel(this, wxID_ANY); + mPanel = safenew wxPanelWrapper(this, wxID_ANY); bs->Add(mPanel, 1, wxEXPAND); SetSizer(bs.release()); } diff --git a/src/effects/Equalization.cpp b/src/effects/Equalization.cpp index cc85cceef..d4f57f190 100644 --- a/src/effects/Equalization.cpp +++ b/src/effects/Equalization.cpp @@ -732,7 +732,7 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S) szrG = S.GetSizer(); // Panel used to host the sliders since they will be positioned manually. - mGraphicPanel = safenew wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(-1, 150)); + mGraphicPanel = safenew wxPanelWrapper(parent, wxID_ANY, wxDefaultPosition, wxSize(-1, 150)); S.Prop(1).AddWindow(mGraphicPanel, wxEXPAND); for (int i = 0; (i < NUMBER_OF_BANDS) && (kThirdOct[i] <= mHiFreq); ++i) @@ -2887,7 +2887,7 @@ void EffectEqualization::OnBench( wxCommandEvent & event) // EqualizationPanel //---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(EqualizationPanel, wxPanel) +BEGIN_EVENT_TABLE(EqualizationPanel, wxPanelWrapper) EVT_PAINT(EqualizationPanel::OnPaint) EVT_MOUSE_EVENTS(EqualizationPanel::OnMouseEvent) EVT_MOUSE_CAPTURE_LOST(EqualizationPanel::OnCaptureLost) @@ -2895,7 +2895,7 @@ BEGIN_EVENT_TABLE(EqualizationPanel, wxPanel) END_EVENT_TABLE() EqualizationPanel::EqualizationPanel(EffectEqualization *effect, wxWindow *parent) -: wxPanel(parent) +: wxPanelWrapper(parent) { mParent = parent; mEffect = effect; diff --git a/src/effects/Equalization.h b/src/effects/Equalization.h index 33f6f732f..c3d9dce39 100644 --- a/src/effects/Equalization.h +++ b/src/effects/Equalization.h @@ -279,7 +279,7 @@ private: friend class EditCurvesDialog; }; -class EqualizationPanel final : public wxPanel +class EqualizationPanel final : public wxPanelWrapper { public: EqualizationPanel(EffectEqualization *effect, wxWindow *parent); diff --git a/src/effects/ScienFilter.cpp b/src/effects/ScienFilter.cpp index 25174169e..3acaff38d 100644 --- a/src/effects/ScienFilter.cpp +++ b/src/effects/ScienFilter.cpp @@ -1008,13 +1008,13 @@ void EffectScienFilter::EnableDisableRippleCtl(int FilterType) // EffectScienFilterPanel //---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(EffectScienFilterPanel, wxPanel) +BEGIN_EVENT_TABLE(EffectScienFilterPanel, wxPanelWrapper) EVT_PAINT(EffectScienFilterPanel::OnPaint) EVT_SIZE(EffectScienFilterPanel::OnSize) END_EVENT_TABLE() EffectScienFilterPanel::EffectScienFilterPanel(EffectScienFilter *effect, wxWindow *parent) -: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(400, 200)) +: wxPanelWrapper(parent, wxID_ANY, wxDefaultPosition, wxSize(400, 200)) { mEffect = effect; mParent = parent; diff --git a/src/effects/ScienFilter.h b/src/effects/ScienFilter.h index 87c67fb2a..75b02d879 100644 --- a/src/effects/ScienFilter.h +++ b/src/effects/ScienFilter.h @@ -135,7 +135,7 @@ private: friend class EffectScienFilterPanel; }; -class EffectScienFilterPanel final : public wxPanel +class EffectScienFilterPanel final : public wxPanelWrapper { public: EffectScienFilterPanel(EffectScienFilter *effect, wxWindow *parent); diff --git a/src/effects/audiounits/AudioUnitEffect.cpp b/src/effects/audiounits/AudioUnitEffect.cpp index 455b49150..fc7c307dc 100644 --- a/src/effects/audiounits/AudioUnitEffect.cpp +++ b/src/effects/audiounits/AudioUnitEffect.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -34,6 +33,7 @@ #include "../../ShuttleGui.h" #include "../../widgets/valnum.h" +#include "../../widgets/wxPanelWrapper.h" #include "AudioUnitEffect.h" @@ -1758,7 +1758,7 @@ bool AudioUnitEffect::PopulateUI(wxWindow *parent) auto mainSizer = std::make_unique(wxVERTICAL); wxASSERT(mParent); // To justify safenew - container = safenew wxPanel(mParent, wxID_ANY); + container = safenew wxPanelWrapper(mParent, wxID_ANY); mainSizer->Add(container, 1, wxEXPAND); mParent->SetSizer(mainSizer.release()); diff --git a/src/effects/lv2/LV2Effect.cpp b/src/effects/lv2/LV2Effect.cpp index 4058a27a4..94f997f82 100644 --- a/src/effects/lv2/LV2Effect.cpp +++ b/src/effects/lv2/LV2Effect.cpp @@ -31,6 +31,7 @@ #include "../../Internat.h" #include "../../ShuttleGui.h" #include "../../widgets/valnum.h" +#include "../../widgets/wxPanelWrapper.h" #include "lilv/lilv.h" #include "suil/suil.h" @@ -1449,7 +1450,7 @@ bool LV2Effect::BuildFancy() } // Use a panel to host the plugins GUI - mContainer = safenew wxPanel(mParent, wxID_ANY); + mContainer = safenew wxPanelWrapper(mParent, wxID_ANY); if (!mContainer) { lilv_uis_free(uis); diff --git a/src/export/Export.cpp b/src/export/Export.cpp index dbc0ecdfd..1a0ac4fda 100644 --- a/src/export/Export.cpp +++ b/src/export/Export.cpp @@ -220,7 +220,7 @@ bool ExportPlugin::DisplayOptions(wxWindow * WXUNUSED(parent), int WXUNUSED(form wxWindow *ExportPlugin::OptionsCreate(wxWindow *parent, int WXUNUSED(format)) { wxASSERT(parent); // To justify safenew - wxPanel *p = safenew wxPanel(parent, wxID_ANY); + wxPanel *p = safenew wxPanelWrapper(parent, wxID_ANY); ShuttleGui S(p, eIsCreatingFromPrefs); S.StartHorizontalLay(wxCENTER); @@ -985,7 +985,7 @@ bool Exporter::SetAutoExportOptions(AudacityProject *project) { // ExportMixerPanel //---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(ExportMixerPanel, wxPanel) +BEGIN_EVENT_TABLE(ExportMixerPanel, wxPanelWrapper) EVT_PAINT(ExportMixerPanel::OnPaint) EVT_MOUSE_EVENTS(ExportMixerPanel::OnMouseEvent) END_EVENT_TABLE() @@ -993,7 +993,7 @@ END_EVENT_TABLE() ExportMixerPanel::ExportMixerPanel( MixerSpec *mixerSpec, wxArrayString trackNames,wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size): - wxPanel(parent, id, pos, size) + wxPanelWrapper(parent, id, pos, size) { mBitmap = NULL; mWidth = 0; diff --git a/src/export/Export.h b/src/export/Export.h index ff130b2fc..a1c7d1dfb 100644 --- a/src/export/Export.h +++ b/src/export/Export.h @@ -16,10 +16,10 @@ #include #include #include -#include #include #include "../Tags.h" #include "../SampleFormat.h" +#include "../widgets/wxPanelWrapper.h" #include "FileDialog.h" @@ -215,7 +215,7 @@ private: //---------------------------------------------------------------------------- // ExportMixerPanel //---------------------------------------------------------------------------- -class ExportMixerPanel final : public wxPanel +class ExportMixerPanel final : public wxPanelWrapper { public: ExportMixerPanel( MixerSpec *mixerSpec, wxArrayString trackNames, diff --git a/src/export/ExportCL.cpp b/src/export/ExportCL.cpp index 77b99d2ed..d853ef863 100644 --- a/src/export/ExportCL.cpp +++ b/src/export/ExportCL.cpp @@ -39,7 +39,7 @@ // ExportCLOptions //---------------------------------------------------------------------------- -class ExportCLOptions final : public wxPanel +class ExportCLOptions final : public wxPanelWrapper { public: ExportCLOptions(wxWindow *parent, int format); @@ -60,14 +60,14 @@ private: #define ID_BROWSE 5000 -BEGIN_EVENT_TABLE(ExportCLOptions, wxPanel) +BEGIN_EVENT_TABLE(ExportCLOptions, wxPanelWrapper) EVT_BUTTON(ID_BROWSE, ExportCLOptions::OnBrowse) END_EVENT_TABLE() /// /// ExportCLOptions::ExportCLOptions(wxWindow *parent, int WXUNUSED(format)) -: wxPanel(parent, wxID_ANY) +: wxPanelWrapper(parent, wxID_ANY) { mHistory.Load(*gPrefs, wxT("/FileFormats/ExternalProgramHistory")); diff --git a/src/export/ExportFFmpegDialogs.cpp b/src/export/ExportFFmpegDialogs.cpp index 65b730379..a8ef4cf50 100644 --- a/src/export/ExportFFmpegDialogs.cpp +++ b/src/export/ExportFFmpegDialogs.cpp @@ -142,7 +142,7 @@ const int ExportFFmpegAC3Options::iAC3BitRates[] = { 32000, 40000, 48000, 56000, const int ExportFFmpegAC3Options::iAC3SampleRates[] = { 32000, 44100, 48000, 0 }; ExportFFmpegAC3Options::ExportFFmpegAC3Options(wxWindow *parent, int WXUNUSED(format)) -: wxPanel(parent, wxID_ANY) +: wxPanelWrapper(parent, wxID_ANY) { for (unsigned int i=0; i < (sizeof(iAC3BitRates)/sizeof(int)); i++) { @@ -205,7 +205,7 @@ bool ExportFFmpegAC3Options::TransferDataFromWindow() //---------------------------------------------------------------------------- ExportFFmpegAACOptions::ExportFFmpegAACOptions(wxWindow *parent, int WXUNUSED(format)) -: wxPanel(parent, wxID_ANY) +: wxPanelWrapper(parent, wxID_ANY) { ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); @@ -268,7 +268,7 @@ int ExportFFmpegAMRNBOptions::iAMRNBBitRate[] = { 4750, 5150, 5900, 6700, 7400, 7950, 10200, 12200 }; ExportFFmpegAMRNBOptions::ExportFFmpegAMRNBOptions(wxWindow *parent, int WXUNUSED(format)) -: wxPanel(parent, wxID_ANY) +: wxPanelWrapper(parent, wxID_ANY) { for (unsigned int i=0; i < (sizeof(iAMRNBBitRate)/sizeof(int)); i++) { @@ -338,7 +338,7 @@ const int ExportFFmpegWMAOptions::iWMABitRate[] = { 24000, 32000, 40000, 48000, 64000, 80000, 96000, 128000, 160000, 192000, 256000, 320000 }; ExportFFmpegWMAOptions::ExportFFmpegWMAOptions(wxWindow *parent, int WXUNUSED(format)) -: wxPanel(parent, wxID_ANY) +: wxPanelWrapper(parent, wxID_ANY) { for (unsigned int i=0; i < (sizeof(iWMABitRate)/sizeof(int)); i++) { @@ -402,12 +402,12 @@ bool ExportFFmpegWMAOptions::TransferDataFromWindow() #define OpenID 9000 -BEGIN_EVENT_TABLE(ExportFFmpegCustomOptions, wxPanel) +BEGIN_EVENT_TABLE(ExportFFmpegCustomOptions, wxPanelWrapper) EVT_BUTTON(OpenID, ExportFFmpegCustomOptions::OnOpen) END_EVENT_TABLE() ExportFFmpegCustomOptions::ExportFFmpegCustomOptions(wxWindow *parent, int WXUNUSED(format)) -: wxPanel(parent, wxID_ANY) +: wxPanelWrapper(parent, wxID_ANY) { ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); diff --git a/src/export/ExportFFmpegDialogs.h b/src/export/ExportFFmpegDialogs.h index ea3707c1f..79ffe9a92 100644 --- a/src/export/ExportFFmpegDialogs.h +++ b/src/export/ExportFFmpegDialogs.h @@ -20,6 +20,7 @@ LRN #include #include "../xml/XMLFileReader.h" #include "../FileNames.h" +#include "../widgets/wxPanelWrapper.h" /// Identifiers for pre-set export types. @@ -58,7 +59,7 @@ struct CompatibilityEntry /// AC3 export options dialog -class ExportFFmpegAC3Options final : public wxPanel +class ExportFFmpegAC3Options final : public wxPanelWrapper { public: @@ -84,7 +85,7 @@ private: int mBitRateFromChoice; }; -class ExportFFmpegAACOptions final : public wxPanel +class ExportFFmpegAACOptions final : public wxPanelWrapper { public: @@ -100,7 +101,7 @@ private: wxSpinCtrl *mQualitySpin; }; -class ExportFFmpegAMRNBOptions final : public wxPanel +class ExportFFmpegAMRNBOptions final : public wxPanelWrapper { public: @@ -122,7 +123,7 @@ private: int mBitRateFromChoice; }; -class ExportFFmpegWMAOptions final : public wxPanel +class ExportFFmpegWMAOptions final : public wxPanelWrapper { public: @@ -145,7 +146,7 @@ private: int mBitRateFromChoice; }; -class ExportFFmpegCustomOptions final : public wxPanel +class ExportFFmpegCustomOptions final : public wxPanelWrapper { public: diff --git a/src/export/ExportFLAC.cpp b/src/export/ExportFLAC.cpp index 980f6d135..196555910 100644 --- a/src/export/ExportFLAC.cpp +++ b/src/export/ExportFLAC.cpp @@ -47,7 +47,7 @@ and libvorbis examples, Monty // ExportFLACOptions Class //---------------------------------------------------------------------------- -class ExportFLACOptions final : public wxPanel +class ExportFLACOptions final : public wxPanelWrapper { public: @@ -62,7 +62,7 @@ public: /// /// ExportFLACOptions::ExportFLACOptions(wxWindow *parent, int WXUNUSED(format)) -: wxPanel(parent, wxID_ANY) +: wxPanelWrapper(parent, wxID_ANY) { ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); diff --git a/src/export/ExportMP2.cpp b/src/export/ExportMP2.cpp index 47230f9d8..c8a1f8e26 100644 --- a/src/export/ExportMP2.cpp +++ b/src/export/ExportMP2.cpp @@ -82,7 +82,7 @@ static int iBitrates[] = { 192, 224, 256, 320, 384 }; -class ExportMP2Options final : public wxPanel +class ExportMP2Options final : public wxPanelWrapper { public: ExportMP2Options(wxWindow *parent, int format); @@ -100,7 +100,7 @@ private: /// /// ExportMP2Options::ExportMP2Options(wxWindow *parent, int WXUNUSED(format)) -: wxPanel(parent, wxID_ANY) +: wxPanelWrapper(parent, wxID_ANY) { for (unsigned int i=0; i < (sizeof(iBitrates)/sizeof(int)); i++) { diff --git a/src/export/ExportMP3.cpp b/src/export/ExportMP3.cpp index bf5249396..3b3eea2db 100644 --- a/src/export/ExportMP3.cpp +++ b/src/export/ExportMP3.cpp @@ -262,7 +262,7 @@ static void InitMP3_Statics() } } -class ExportMP3Options final : public wxPanel +class ExportMP3Options final : public wxPanelWrapper { public: @@ -305,7 +305,7 @@ private: DECLARE_EVENT_TABLE() }; -BEGIN_EVENT_TABLE(ExportMP3Options, wxPanel) +BEGIN_EVENT_TABLE(ExportMP3Options, wxPanelWrapper) EVT_RADIOBUTTON(ID_SET, ExportMP3Options::OnSET) EVT_RADIOBUTTON(ID_VBR, ExportMP3Options::OnVBR) EVT_RADIOBUTTON(ID_ABR, ExportMP3Options::OnABR) @@ -317,7 +317,7 @@ END_EVENT_TABLE() /// /// ExportMP3Options::ExportMP3Options(wxWindow *parent, int WXUNUSED(format)) -: wxPanel(parent, wxID_ANY) +: wxPanelWrapper(parent, wxID_ANY) { InitMP3_Statics(); diff --git a/src/export/ExportOGG.cpp b/src/export/ExportOGG.cpp index 8a7bf5c72..012264528 100644 --- a/src/export/ExportOGG.cpp +++ b/src/export/ExportOGG.cpp @@ -42,7 +42,7 @@ // ExportOGGOptions //---------------------------------------------------------------------------- -class ExportOGGOptions final : public wxPanel +class ExportOGGOptions final : public wxPanelWrapper { public: @@ -61,7 +61,7 @@ private: /// /// ExportOGGOptions::ExportOGGOptions(wxWindow *parent, int WXUNUSED(format)) -: wxPanel(parent, wxID_ANY) +: wxPanelWrapper(parent, wxID_ANY) { mOggQualityUnscaled = gPrefs->Read(wxT("/FileFormats/OggExportQuality"),50)/10; diff --git a/src/export/ExportPCM.cpp b/src/export/ExportPCM.cpp index 560e411cb..e7ce955eb 100644 --- a/src/export/ExportPCM.cpp +++ b/src/export/ExportPCM.cpp @@ -92,7 +92,7 @@ static void WriteExportFormatPref(int format) #define ID_HEADER_CHOICE 7102 #define ID_ENCODING_CHOICE 7103 -class ExportPCMOptions final : public wxPanel +class ExportPCMOptions final : public wxPanelWrapper { public: @@ -123,12 +123,12 @@ private: DECLARE_EVENT_TABLE() }; -BEGIN_EVENT_TABLE(ExportPCMOptions, wxPanel) +BEGIN_EVENT_TABLE(ExportPCMOptions, wxPanelWrapper) EVT_CHOICE(ID_HEADER_CHOICE, ExportPCMOptions::OnHeaderChoice) END_EVENT_TABLE() ExportPCMOptions::ExportPCMOptions(wxWindow *parent, int selformat) -: wxPanel(parent, wxID_ANY) +: wxPanelWrapper(parent, wxID_ANY) { int format; diff --git a/src/prefs/BatchPrefs.cpp b/src/prefs/BatchPrefs.cpp index f8460f1ba..fd71aa5b9 100644 --- a/src/prefs/BatchPrefs.cpp +++ b/src/prefs/BatchPrefs.cpp @@ -29,7 +29,7 @@ #include "../Menus.h" #include "../toolbars/ToolManager.h" -BEGIN_EVENT_TABLE(BatchPrefs, wxPanel) +BEGIN_EVENT_TABLE(BatchPrefs, PrefsPanel) END_EVENT_TABLE() /// Constructor diff --git a/src/prefs/PrefsPanel.h b/src/prefs/PrefsPanel.h index c13cc8146..364d88013 100644 --- a/src/prefs/PrefsPanel.h +++ b/src/prefs/PrefsPanel.h @@ -28,8 +28,8 @@ ThemePrefs. #ifndef __AUDACITY_PREFS_PANEL__ #define __AUDACITY_PREFS_PANEL__ -#include #include +#include "../widgets/wxPanelWrapper.h" /* A few constants for an attempt at semi-uniformity */ #define PREFS_FONT_SIZE 8 @@ -40,11 +40,11 @@ ThemePrefs. #define TOP_LEVEL_BORDER 5 #define GENERIC_CONTROL_BORDER 5 -class PrefsPanel /* not final */ : public wxPanel +class PrefsPanel /* not final */ : public wxPanelWrapper { public: PrefsPanel(wxWindow * parent, const wxString &title) - : wxPanel(parent, wxID_ANY) + : wxPanelWrapper(parent, wxID_ANY) { SetLabel(title); // Provide visual label SetName(title); // Provide audible label diff --git a/src/toolbars/ToolBar.cpp b/src/toolbars/ToolBar.cpp index be4343d60..424b117e7 100644 --- a/src/toolbars/ToolBar.cpp +++ b/src/toolbars/ToolBar.cpp @@ -267,7 +267,7 @@ void ToolBarResizer::OnKeyDown(wxKeyEvent &event) // // Define class to RTTI // -IMPLEMENT_CLASS( ToolBar, wxPanel ); +IMPLEMENT_CLASS( ToolBar, wxPanelWrapper ); // // Custom event @@ -277,7 +277,7 @@ DEFINE_EVENT_TYPE(EVT_TOOLBAR_UPDATED) // // Event table // -BEGIN_EVENT_TABLE( ToolBar, wxPanel ) +BEGIN_EVENT_TABLE( ToolBar, wxPanelWrapper ) EVT_PAINT( ToolBar::OnPaint ) EVT_ERASE_BACKGROUND( ToolBar::OnErase ) EVT_MOUSE_EVENTS( ToolBar::OnMouseEvents ) @@ -290,7 +290,7 @@ ToolBar::ToolBar( int type, const wxString &label, const wxString §ion, bool resizable ) -: wxPanel() +: wxPanelWrapper() { // Save parameters mType = type; @@ -425,13 +425,13 @@ void ToolBar::Create( wxWindow *parent ) mParent = parent; // Create the window and label it - wxPanel::Create( mParent, + wxPanelWrapper::Create( mParent, mType, wxDefaultPosition, wxDefaultSize, wxNO_BORDER | wxTAB_TRAVERSAL, GetTitle() ); - wxPanel::SetLabel( GetLabel() ); + wxPanelWrapper::SetLabel( GetLabel() ); // Go do the rest of the creation ReCreateButtons(); diff --git a/src/toolbars/ToolBar.h b/src/toolbars/ToolBar.h index 8b7f0b3a9..90f4af362 100644 --- a/src/toolbars/ToolBar.h +++ b/src/toolbars/ToolBar.h @@ -17,10 +17,10 @@ #include #include -#include #include #include "../Theme.h" +#include "../widgets/wxPanelWrapper.h" class wxDC; class wxEraseEvent; @@ -84,7 +84,7 @@ enum // How may pixels padding each side of a floating toolbar enum { ToolBarFloatMargin = 1 }; -class ToolBar /* not final */ : public wxPanel +class ToolBar /* not final */ : public wxPanelWrapper { public: diff --git a/src/toolbars/ToolDock.cpp b/src/toolbars/ToolDock.cpp index 87ddec5d3..af4cdcf33 100644 --- a/src/toolbars/ToolDock.cpp +++ b/src/toolbars/ToolDock.cpp @@ -325,7 +325,7 @@ void ToolBarConfiguration::Write gPrefs->Write( wxT("Show"), bar->IsVisible() ); } -IMPLEMENT_CLASS( ToolDock, wxPanel ); +IMPLEMENT_CLASS( ToolDock, wxPanelWrapper ); //////////////////////////////////////////////////////////// /// Methods for ToolDock @@ -336,7 +336,7 @@ IMPLEMENT_CLASS( ToolDock, wxPanel ); // DEFINE_EVENT_TYPE( EVT_TOOLBAR_FLOAT ); -BEGIN_EVENT_TABLE( ToolDock, wxPanel ) +BEGIN_EVENT_TABLE( ToolDock, wxPanelWrapper ) EVT_GRABBER( wxID_ANY, ToolDock::OnGrabber ) EVT_ERASE_BACKGROUND( ToolDock::OnErase ) EVT_PAINT( ToolDock::OnPaint ) @@ -348,7 +348,7 @@ END_EVENT_TABLE() // Constructor // ToolDock::ToolDock( ToolManager *manager, wxWindow *parent, int dockid ): - wxPanel( parent, dockid, wxDefaultPosition, parent->GetSize() ) + wxPanelWrapper( parent, dockid, wxDefaultPosition, parent->GetSize() ) { SetLabel( _( "ToolDock" ) ); SetName( _( "ToolDock" ) ); diff --git a/src/toolbars/ToolDock.h b/src/toolbars/ToolDock.h index 6437c8329..212cc7ea3 100644 --- a/src/toolbars/ToolDock.h +++ b/src/toolbars/ToolDock.h @@ -16,7 +16,6 @@ #include #include "../MemoryX.h" // for std::move #include -#include #include "ToolBar.h" @@ -282,7 +281,7 @@ private: Forest mForest; }; -class ToolDock final : public wxPanel +class ToolDock final : public wxPanelWrapper { public: diff --git a/src/widgets/BackedPanel.cpp b/src/widgets/BackedPanel.cpp index ecc344d57..78148fe76 100644 --- a/src/widgets/BackedPanel.cpp +++ b/src/widgets/BackedPanel.cpp @@ -13,7 +13,7 @@ BackedPanel::BackedPanel(wxWindow * parent, wxWindowID id, const wxPoint & pos, const wxSize & size, long style) -: wxPanel(parent, id, pos, size, style) +: wxPanelWrapper(parent, id, pos, size, style) , mBacking{ safenew wxBitmap(1, 1) } { // Preinit the backing DC and bitmap so routines that require it will @@ -77,7 +77,7 @@ void BackedPanel::OnSize(wxSizeEvent & /* event */) Refresh(); } -BEGIN_EVENT_TABLE(BackedPanel, wxPanel) +BEGIN_EVENT_TABLE(BackedPanel, wxPanelWrapper) EVT_SIZE(BackedPanel::OnSize) END_EVENT_TABLE() diff --git a/src/widgets/BackedPanel.h b/src/widgets/BackedPanel.h index 0e8040549..a9faf78a9 100644 --- a/src/widgets/BackedPanel.h +++ b/src/widgets/BackedPanel.h @@ -10,10 +10,10 @@ #define __AUDACITY_BACKED_PANEL__ #include "../MemoryX.h" -#include #include +#include "wxPanelWrapper.h" -class AUDACITY_DLL_API BackedPanel /* not final */ : public wxPanel { +class AUDACITY_DLL_API BackedPanel /* not final */ : public wxPanelWrapper { public: BackedPanel(wxWindow * parent, wxWindowID id, const wxPoint & pos, diff --git a/src/widgets/ExpandingToolBar.cpp b/src/widgets/ExpandingToolBar.cpp index 1032c586a..796488159 100644 --- a/src/widgets/ExpandingToolBar.cpp +++ b/src/widgets/ExpandingToolBar.cpp @@ -107,13 +107,13 @@ public: // ExpandingToolBar // -BEGIN_EVENT_TABLE(ExpandingToolBar, wxPanel) +BEGIN_EVENT_TABLE(ExpandingToolBar, wxPanelWrapper) EVT_SIZE(ExpandingToolBar::OnSize) EVT_TIMER(kTimerID, ExpandingToolBar::OnTimer) EVT_BUTTON(kToggleButtonID, ExpandingToolBar::OnToggle) END_EVENT_TABLE() -IMPLEMENT_CLASS(ExpandingToolBar, wxPanel) +IMPLEMENT_CLASS(ExpandingToolBar, wxPanelWrapper) //static int ExpandingToolBar::msNoAutoExpandStack = 0; @@ -122,7 +122,7 @@ ExpandingToolBar::ExpandingToolBar(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size): - wxPanel(parent, id, pos, size), + wxPanelWrapper(parent, id, pos, size), mIsAutoExpanded(false), mIsManualExpanded(false), mIsExpanded(false), @@ -135,9 +135,9 @@ ExpandingToolBar::ExpandingToolBar(wxWindow* parent, mDragImage(NULL), mTopLevelParent(NULL) { - mMainPanel = safenew wxPanel(this, -1, + mMainPanel = safenew wxPanelWrapper(this, -1, wxDefaultPosition, wxSize(1, 1)); - mExtraPanel = safenew wxPanel(this, -1, + mExtraPanel = safenew wxPanelWrapper(this, -1, wxDefaultPosition, wxSize(1, 1)); mGrabber = NULL; @@ -655,20 +655,20 @@ void ExpandingToolBar::FinishMoving() // ToolBarGrabber // -BEGIN_EVENT_TABLE(ToolBarGrabber, wxPanel) +BEGIN_EVENT_TABLE(ToolBarGrabber, wxPanelWrapper) EVT_PAINT(ToolBarGrabber::OnPaint) EVT_SIZE(ToolBarGrabber::OnSize) EVT_MOUSE_EVENTS(ToolBarGrabber::OnMouse) END_EVENT_TABLE() -IMPLEMENT_CLASS(ToolBarGrabber, wxPanel) +IMPLEMENT_CLASS(ToolBarGrabber, wxPanelWrapper) ToolBarGrabber::ToolBarGrabber(wxWindow *parent, wxWindowID id, ExpandingToolBar *ownerToolbar, const wxPoint& pos, const wxSize& size): - wxPanel(parent, id, pos, size), + wxPanelWrapper(parent, id, pos, size), mOwnerToolBar(ownerToolbar) { wxImage grabberImages = theTheme.Image(bmpToolBarGrabber); @@ -835,18 +835,18 @@ void ToolBarFrame::Fit() // ToolBarArea // -BEGIN_EVENT_TABLE(ToolBarArea, wxPanel) +BEGIN_EVENT_TABLE(ToolBarArea, wxPanelWrapper) EVT_SIZE(ToolBarArea::OnSize) EVT_MOUSE_EVENTS(ToolBarArea::OnMouse) END_EVENT_TABLE() -IMPLEMENT_CLASS(ToolBarArea, wxPanel) +IMPLEMENT_CLASS(ToolBarArea, wxPanelWrapper) ToolBarArea::ToolBarArea(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size): - wxPanel(parent, id, pos, size), + wxPanelWrapper(parent, id, pos, size), mInOnSize(false), mCapturedChild(NULL) { diff --git a/src/widgets/ExpandingToolBar.h b/src/widgets/ExpandingToolBar.h index 735494b49..3696b0a81 100644 --- a/src/widgets/ExpandingToolBar.h +++ b/src/widgets/ExpandingToolBar.h @@ -20,6 +20,7 @@ #include #include "ImageRoll.h" +#include "wxPanelWrapper.h" class wxDragImage; @@ -43,7 +44,7 @@ WX_DECLARE_OBJARRAY(wxRect, wxArrayRect); // Can be docked into a ToolBarArea or floated in an ToolBarFrame; // -class ExpandingToolBar final : public wxPanel +class ExpandingToolBar final : public wxPanelWrapper { public: DECLARE_DYNAMIC_CLASS(ExpandingToolBar) @@ -121,7 +122,7 @@ class ExpandingToolBar final : public wxPanel friend class ExpandingToolBarEvtHandler; }; -class ToolBarGrabber final : public wxPanel +class ToolBarGrabber final : public wxPanelWrapper { public: DECLARE_DYNAMIC_CLASS(ToolBarGrabber); @@ -193,7 +194,7 @@ class ToolBarFrame final : public wxMiniFrame // ToolBarArea sets the height dynamically based on the number of // toolbars it contains. // -class ToolBarArea final : public wxPanel +class ToolBarArea final : public wxPanelWrapper { public: DECLARE_DYNAMIC_CLASS(ToolBarArea) diff --git a/src/widgets/ImageRoll.cpp b/src/widgets/ImageRoll.cpp index 9bc6c7d3c..88f760ebd 100644 --- a/src/widgets/ImageRoll.cpp +++ b/src/widgets/ImageRoll.cpp @@ -414,12 +414,12 @@ void ImageRoll::Draw(wxDC &dc, wxRect rect, wxRasterOperationMode WXUNUSED(logic } // switch } -BEGIN_EVENT_TABLE(ImageRollPanel, wxPanel) +BEGIN_EVENT_TABLE(ImageRollPanel, wxPanelWrapper) EVT_PAINT(ImageRollPanel::OnPaint) EVT_SIZE(ImageRollPanel::OnSize) END_EVENT_TABLE() -IMPLEMENT_CLASS(ImageRollPanel, wxPanel) +IMPLEMENT_CLASS(ImageRollPanel, wxPanelWrapper) ImageRollPanel::ImageRollPanel(wxWindow *parent, wxWindowID id, @@ -427,7 +427,7 @@ ImageRollPanel::ImageRollPanel(wxWindow *parent, const wxPoint& pos, const wxSize& size, long style): - wxPanel(parent, id, pos, size, style), + wxPanelWrapper(parent, id, pos, size, style), mImageRoll(imgRoll), mLogicalFunction(wxCOPY) { diff --git a/src/widgets/ImageRoll.h b/src/widgets/ImageRoll.h index ceacc0443..b7793d646 100644 --- a/src/widgets/ImageRoll.h +++ b/src/widgets/ImageRoll.h @@ -16,8 +16,8 @@ #include #include #include -#include #include +#include "wxPanelWrapper.h" #if !wxCHECK_VERSION(3,0,0) #define wxRasterOperationMode int @@ -67,7 +67,7 @@ class ImageRoll // A very simple class that just display an ImageRoll that doesn't // do anything -class ImageRollPanel final : public wxPanel +class ImageRollPanel final : public wxPanelWrapper { public: DECLARE_DYNAMIC_CLASS(ImageRollPanel); diff --git a/src/widgets/Meter.cpp b/src/widgets/Meter.cpp index 3b2378274..58ff19dc4 100644 --- a/src/widgets/Meter.cpp +++ b/src/widgets/Meter.cpp @@ -192,7 +192,7 @@ enum { OnPreferencesID }; -BEGIN_EVENT_TABLE(Meter, wxPanel) +BEGIN_EVENT_TABLE(Meter, wxPanelWrapper) EVT_TIMER(OnMeterUpdateID, Meter::OnMeterUpdate) EVT_MOUSE_EVENTS(Meter::OnMouse) EVT_CONTEXT_MENU(Meter::OnContext) @@ -207,7 +207,7 @@ BEGIN_EVENT_TABLE(Meter, wxPanel) EVT_MENU(OnPreferencesID, Meter::OnPreferences) END_EVENT_TABLE() -IMPLEMENT_CLASS(Meter, wxPanel) +IMPLEMENT_CLASS(Meter, wxPanelWrapper) Meter::Meter(AudacityProject *project, wxWindow* parent, wxWindowID id, @@ -216,7 +216,7 @@ Meter::Meter(AudacityProject *project, const wxSize& size /*= wxDefaultSize*/, Style style /*= HorizontalStereo*/, float fDecayRate /*= 60.0f*/) -: wxPanel(parent, id, pos, size, wxTAB_TRAVERSAL | wxNO_BORDER | wxWANTS_CHARS), +: wxPanelWrapper(parent, id, pos, size, wxTAB_TRAVERSAL | wxNO_BORDER | wxWANTS_CHARS), mProject(project), mQueue(1024), mWidth(size.x), diff --git a/src/widgets/Meter.h b/src/widgets/Meter.h index f70b34248..562de3bf6 100644 --- a/src/widgets/Meter.h +++ b/src/widgets/Meter.h @@ -17,7 +17,6 @@ #define __AUDACITY_METER__ #include -#include #include #include "../SampleFormat.h" @@ -86,7 +85,7 @@ class MeterUpdateQueue class MeterAx; -class Meter final : public wxPanel +class Meter final : public wxPanelWrapper { DECLARE_DYNAMIC_CLASS(Meter) diff --git a/src/widgets/Ruler.cpp b/src/widgets/Ruler.cpp index e1736a05e..e9cf113f7 100644 --- a/src/widgets/Ruler.cpp +++ b/src/widgets/Ruler.cpp @@ -1603,18 +1603,18 @@ void Ruler::SetUseZoomInfo(int leftOffset, const ZoomInfo *zoomInfo) // RulerPanel // -BEGIN_EVENT_TABLE(RulerPanel, wxPanel) +BEGIN_EVENT_TABLE(RulerPanel, wxPanelWrapper) EVT_ERASE_BACKGROUND(RulerPanel::OnErase) EVT_PAINT(RulerPanel::OnPaint) EVT_SIZE(RulerPanel::OnSize) END_EVENT_TABLE() -IMPLEMENT_CLASS(RulerPanel, wxPanel) +IMPLEMENT_CLASS(RulerPanel, wxPanelWrapper) RulerPanel::RulerPanel(wxWindow* parent, wxWindowID id, const wxPoint& pos /*= wxDefaultPosition*/, const wxSize& size /*= wxDefaultSize*/): - wxPanel(parent, id, pos, size) + wxPanelWrapper(parent, id, pos, size) { } @@ -1651,7 +1651,7 @@ void RulerPanel::DoSetSize(int x, int y, int width, int height, int sizeFlags) { - wxPanel::DoSetSize(x, y, width, height, sizeFlags); + wxPanelWrapper::DoSetSize(x, y, width, height, sizeFlags); int w, h; GetClientSize(&w, &h); diff --git a/src/widgets/Ruler.h b/src/widgets/Ruler.h index 4259d4c82..c69322379 100644 --- a/src/widgets/Ruler.h +++ b/src/widgets/Ruler.h @@ -243,7 +243,7 @@ private: NumberScale *mpNumberScale; }; -class AUDACITY_DLL_API RulerPanel final : public wxPanel { +class AUDACITY_DLL_API RulerPanel final : public wxPanelWrapper { DECLARE_DYNAMIC_CLASS(RulerPanel) public: diff --git a/src/widgets/wxPanelWrapper.cpp b/src/widgets/wxPanelWrapper.cpp new file mode 100644 index 000000000..9367efb59 --- /dev/null +++ b/src/widgets/wxPanelWrapper.cpp @@ -0,0 +1,37 @@ +// +// wxPanelWrapper.cpp +// Audacity +// +// Created by Paul Licameli on 6/25/16. +// +// + +#include "../Audacity.h" +#include "wxPanelWrapper.h" + +IMPLEMENT_CLASS(wxPanelWrapper, wxPanel) + +wxPanelWrapper::wxPanelWrapper(wxWindow * parent, wxWindowID id, + const wxPoint & pos, + const wxSize & size, + long style) +: wxPanel(parent, id, pos, size, style) +{} + +void wxPanelWrapper::OnCharHook(wxKeyEvent &event) +{ + if (event.GetKeyCode() == WXK_TAB) { + wxWindow::FindFocus()->Navigate( + event.ShiftDown() + ? wxNavigationKeyEvent::IsBackward + : wxNavigationKeyEvent::IsForward + ); + return; + } + + event.Skip(); +} + +BEGIN_EVENT_TABLE(wxPanelWrapper, wxPanel) + EVT_CHAR_HOOK(wxPanelWrapper::OnCharHook) +END_EVENT_TABLE() diff --git a/src/widgets/wxPanelWrapper.h b/src/widgets/wxPanelWrapper.h new file mode 100644 index 000000000..40fda1b99 --- /dev/null +++ b/src/widgets/wxPanelWrapper.h @@ -0,0 +1,32 @@ +// +// wxPanelWrapper.h +// Audacity +// +// Created by Paul Licameli on 6/25/16. +// +// + +#ifndef __AUDACITY_WXPANEL_WRAPPER__ +#define __AUDACITY_WXPANEL_WRAPPER__ + +#include + +class AUDACITY_DLL_API wxPanelWrapper /* not final */ : public wxPanel { +public: + wxPanelWrapper() : wxPanel {} {} + + wxPanelWrapper(wxWindow * parent, wxWindowID id = wxID_ANY, + const wxPoint & pos = wxDefaultPosition, + const wxSize & size = wxDefaultSize, + // default as for wxPanel: + long style = wxTAB_TRAVERSAL | wxNO_BORDER); + +private: + void OnCharHook(wxKeyEvent &event); + + DECLARE_DYNAMIC_CLASS(wxPanelWrapper); + + DECLARE_EVENT_TABLE() +}; + +#endif diff --git a/win/Projects/Audacity/Audacity.vcxproj b/win/Projects/Audacity/Audacity.vcxproj index c7a670f31..0944a3fc7 100755 --- a/win/Projects/Audacity/Audacity.vcxproj +++ b/win/Projects/Audacity/Audacity.vcxproj @@ -231,6 +231,7 @@ + @@ -462,6 +463,7 @@ + diff --git a/win/Projects/Audacity/Audacity.vcxproj.filters b/win/Projects/Audacity/Audacity.vcxproj.filters index 5a3377d7c..b84f0eb8a 100755 --- a/win/Projects/Audacity/Audacity.vcxproj.filters +++ b/win/Projects/Audacity/Audacity.vcxproj.filters @@ -887,6 +887,9 @@ src\toolbars + + src\widgets + @@ -1795,6 +1798,9 @@ src\toolbars + + src\widgets + From 9f6eedf6e4415b31d4eb2a65e3845f5d287e7fd1 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 25 Jun 2016 19:38:38 -0400 Subject: [PATCH 07/14] Bug682: fix Tab key navigation in Preferences, particulary Keyboard --- src/prefs/PrefsDialog.cpp | 9 +++++++++ src/prefs/PrefsDialog.h | 2 ++ src/widgets/wxPanelWrapper.cpp | 7 ++++++- src/widgets/wxPanelWrapper.h | 2 ++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/prefs/PrefsDialog.cpp b/src/prefs/PrefsDialog.cpp index cf2903217..4a76638fb 100644 --- a/src/prefs/PrefsDialog.cpp +++ b/src/prefs/PrefsDialog.cpp @@ -73,6 +73,9 @@ BEGIN_EVENT_TABLE(PrefsDialog, wxDialog) EVT_BUTTON(wxID_CANCEL, PrefsDialog::OnCancel) EVT_BUTTON(wxID_APPLY, PrefsDialog::OnApply) EVT_TREE_KEY_DOWN(wxID_ANY, PrefsDialog::OnTreeKeyDown) // Handles key events when tree has focus + + EVT_CHAR_HOOK(PrefsDialog::OnCharHook) + END_EVENT_TABLE() @@ -373,6 +376,12 @@ void PrefsDialog::OnTreeKeyDown(wxTreeEvent & event) event.Skip(); // Ensure standard behavior when enter is not pressed } +void PrefsDialog::OnCharHook(wxKeyEvent &event) +{ + // Common behavior, let's define it in just one place + wxPanelWrapper::DoCharHook(event); +} + void PrefsDialog::OnOK(wxCommandEvent & WXUNUSED(event)) { RecordExpansionState(); diff --git a/src/prefs/PrefsDialog.h b/src/prefs/PrefsDialog.h index 7550d5862..fc4f30d2b 100644 --- a/src/prefs/PrefsDialog.h +++ b/src/prefs/PrefsDialog.h @@ -61,6 +61,8 @@ class PrefsDialog /* not final */ : public wxDialog void OnApply(wxCommandEvent & e); void OnTreeKeyDown(wxTreeEvent & e); // Used to dismiss the dialog when enter is pressed with focus on tree + void OnCharHook(wxKeyEvent &e); + void SelectPageByName(const wxString &pageName); // Accessor to help implementations of SavePreferredPage(), diff --git a/src/widgets/wxPanelWrapper.cpp b/src/widgets/wxPanelWrapper.cpp index 9367efb59..51621d718 100644 --- a/src/widgets/wxPanelWrapper.cpp +++ b/src/widgets/wxPanelWrapper.cpp @@ -18,7 +18,7 @@ wxPanelWrapper::wxPanelWrapper(wxWindow * parent, wxWindowID id, : wxPanel(parent, id, pos, size, style) {} -void wxPanelWrapper::OnCharHook(wxKeyEvent &event) +void wxPanelWrapper::DoCharHook(wxKeyEvent &event) { if (event.GetKeyCode() == WXK_TAB) { wxWindow::FindFocus()->Navigate( @@ -32,6 +32,11 @@ void wxPanelWrapper::OnCharHook(wxKeyEvent &event) event.Skip(); } +void wxPanelWrapper::OnCharHook(wxKeyEvent &event) +{ + DoCharHook(event); +} + BEGIN_EVENT_TABLE(wxPanelWrapper, wxPanel) EVT_CHAR_HOOK(wxPanelWrapper::OnCharHook) END_EVENT_TABLE() diff --git a/src/widgets/wxPanelWrapper.h b/src/widgets/wxPanelWrapper.h index 40fda1b99..92e6b0757 100644 --- a/src/widgets/wxPanelWrapper.h +++ b/src/widgets/wxPanelWrapper.h @@ -21,6 +21,8 @@ public: // default as for wxPanel: long style = wxTAB_TRAVERSAL | wxNO_BORDER); + static void DoCharHook(wxKeyEvent &event); + private: void OnCharHook(wxKeyEvent &event); From 7d25dedafd3827340d4e8c54dfc8c3c7848be72d Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 25 Jun 2016 21:17:54 -0400 Subject: [PATCH 08/14] Apply recent navigation fixes only where needed on Mac... ... Windows didn't need them, Preferences already navigated correctly between the panes, but the new changes caused navigation to get trapped in radio button groups. --- src/widgets/wxPanelWrapper.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/widgets/wxPanelWrapper.cpp b/src/widgets/wxPanelWrapper.cpp index 51621d718..db8474b0c 100644 --- a/src/widgets/wxPanelWrapper.cpp +++ b/src/widgets/wxPanelWrapper.cpp @@ -20,6 +20,9 @@ wxPanelWrapper::wxPanelWrapper(wxWindow * parent, wxWindowID id, void wxPanelWrapper::DoCharHook(wxKeyEvent &event) { +#ifdef __WXMAC + // Compensate for the regressions in TAB key navigation + // due to the switch to wxWidgets 3.0.2 if (event.GetKeyCode() == WXK_TAB) { wxWindow::FindFocus()->Navigate( event.ShiftDown() @@ -28,6 +31,7 @@ void wxPanelWrapper::DoCharHook(wxKeyEvent &event) ); return; } +#endif event.Skip(); } From 9e9001d7bfc6d7f53c86b141b7d600c5227a9da0 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 25 Jun 2016 22:03:14 -0400 Subject: [PATCH 09/14] fix linux build --- src/widgets/ImageRoll.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/widgets/ImageRoll.cpp b/src/widgets/ImageRoll.cpp index 88f760ebd..9550e402e 100644 --- a/src/widgets/ImageRoll.cpp +++ b/src/widgets/ImageRoll.cpp @@ -94,6 +94,7 @@ *//*******************************************************************/ +#include "../Audacity.h" #include "ImageRoll.h" #include From 2910cc2a6f1ad91c0aa5c63fa6c5f9e940107bdd Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 25 Jun 2016 22:15:45 -0400 Subject: [PATCH 10/14] fix mac build --- src/AudacityApp.cpp | 2 +- src/toolbars/ToolManager.cpp | 16 ++++++++-------- src/widgets/wxPanelWrapper.cpp | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index c50327838..d0d54992f 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -1187,7 +1187,7 @@ bool AudacityApp::OnInit() #if defined(__WXMAC__) // Disable window animation - wxSystemOptions::SetOption(wxMAC_WINDOW_PLAIN_TRANSITION, 1); + wxSystemOptions::SetOption(wxMAC_WINDOW_PLAIN_TRANSITION, 0); #endif #ifdef AUDACITY_NAME diff --git a/src/toolbars/ToolManager.cpp b/src/toolbars/ToolManager.cpp index fa50ab039..8a9a9adc0 100644 --- a/src/toolbars/ToolManager.cpp +++ b/src/toolbars/ToolManager.cpp @@ -666,7 +666,7 @@ void ToolManager::ReadConfig() #if defined(__WXMAC__) // Disable window animation - wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); + //wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); #endif // Change to the bar root @@ -852,7 +852,7 @@ void ToolManager::ReadConfig() #if defined(__WXMAC__) // Reinstate original transition - wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition ); + //wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition ); #endif if (!someFound) @@ -1055,7 +1055,7 @@ void ToolManager::OnMouse( wxMouseEvent & event ) #if defined(__WXMAC__) // Disable window animation - wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); + //wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); #endif // Retrieve the event position @@ -1189,7 +1189,7 @@ void ToolManager::OnMouse( wxMouseEvent & event ) #if defined(__WXMAC__) // Reinstate original transition - wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition ); + //wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition ); #endif } @@ -1236,14 +1236,14 @@ void ToolManager::OnTimer( wxTimerEvent & event ) #if defined(__WXMAC__) // Disable window animation - wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); + //wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); #endif mIndicator->Show( !state ); #if defined(__WXMAC__) // Disable window animation - wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition ); + //wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition ); #endif } @@ -1313,7 +1313,7 @@ void ToolManager::OnGrabber( GrabberEvent & event ) { #if defined(__WXMAC__) // Disable window animation - wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); + //wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); #endif // Adjust the starting position @@ -1334,7 +1334,7 @@ void ToolManager::OnGrabber( GrabberEvent & event ) #if defined(__WXMAC__) // Reinstate original transition - wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition ); + //wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition ); #endif } else diff --git a/src/widgets/wxPanelWrapper.cpp b/src/widgets/wxPanelWrapper.cpp index db8474b0c..95970fa73 100644 --- a/src/widgets/wxPanelWrapper.cpp +++ b/src/widgets/wxPanelWrapper.cpp @@ -20,7 +20,7 @@ wxPanelWrapper::wxPanelWrapper(wxWindow * parent, wxWindowID id, void wxPanelWrapper::DoCharHook(wxKeyEvent &event) { -#ifdef __WXMAC +#ifdef __WXMAC__ // Compensate for the regressions in TAB key navigation // due to the switch to wxWidgets 3.0.2 if (event.GetKeyCode() == WXK_TAB) { From 107507e125be0cd0ee86f1469d951d88af9295e9 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 25 Jun 2016 22:17:24 -0400 Subject: [PATCH 11/14] Revert "fix mac build" This reverts commit 2910cc2a6f1ad91c0aa5c63fa6c5f9e940107bdd. --- src/AudacityApp.cpp | 2 +- src/toolbars/ToolManager.cpp | 16 ++++++++-------- src/widgets/wxPanelWrapper.cpp | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index d0d54992f..c50327838 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -1187,7 +1187,7 @@ bool AudacityApp::OnInit() #if defined(__WXMAC__) // Disable window animation - wxSystemOptions::SetOption(wxMAC_WINDOW_PLAIN_TRANSITION, 0); + wxSystemOptions::SetOption(wxMAC_WINDOW_PLAIN_TRANSITION, 1); #endif #ifdef AUDACITY_NAME diff --git a/src/toolbars/ToolManager.cpp b/src/toolbars/ToolManager.cpp index 8a9a9adc0..fa50ab039 100644 --- a/src/toolbars/ToolManager.cpp +++ b/src/toolbars/ToolManager.cpp @@ -666,7 +666,7 @@ void ToolManager::ReadConfig() #if defined(__WXMAC__) // Disable window animation - //wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); + wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); #endif // Change to the bar root @@ -852,7 +852,7 @@ void ToolManager::ReadConfig() #if defined(__WXMAC__) // Reinstate original transition - //wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition ); + wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition ); #endif if (!someFound) @@ -1055,7 +1055,7 @@ void ToolManager::OnMouse( wxMouseEvent & event ) #if defined(__WXMAC__) // Disable window animation - //wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); + wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); #endif // Retrieve the event position @@ -1189,7 +1189,7 @@ void ToolManager::OnMouse( wxMouseEvent & event ) #if defined(__WXMAC__) // Reinstate original transition - //wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition ); + wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition ); #endif } @@ -1236,14 +1236,14 @@ void ToolManager::OnTimer( wxTimerEvent & event ) #if defined(__WXMAC__) // Disable window animation - //wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); + wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); #endif mIndicator->Show( !state ); #if defined(__WXMAC__) // Disable window animation - //wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition ); + wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition ); #endif } @@ -1313,7 +1313,7 @@ void ToolManager::OnGrabber( GrabberEvent & event ) { #if defined(__WXMAC__) // Disable window animation - //wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); + wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); #endif // Adjust the starting position @@ -1334,7 +1334,7 @@ void ToolManager::OnGrabber( GrabberEvent & event ) #if defined(__WXMAC__) // Reinstate original transition - //wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition ); + wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition ); #endif } else diff --git a/src/widgets/wxPanelWrapper.cpp b/src/widgets/wxPanelWrapper.cpp index 95970fa73..db8474b0c 100644 --- a/src/widgets/wxPanelWrapper.cpp +++ b/src/widgets/wxPanelWrapper.cpp @@ -20,7 +20,7 @@ wxPanelWrapper::wxPanelWrapper(wxWindow * parent, wxWindowID id, void wxPanelWrapper::DoCharHook(wxKeyEvent &event) { -#ifdef __WXMAC__ +#ifdef __WXMAC // Compensate for the regressions in TAB key navigation // due to the switch to wxWidgets 3.0.2 if (event.GetKeyCode() == WXK_TAB) { From 1cd9d28d108bc5cd616f304e2afd8697dc801393 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 25 Jun 2016 22:18:13 -0400 Subject: [PATCH 12/14] fix mac build --- src/widgets/wxPanelWrapper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/wxPanelWrapper.cpp b/src/widgets/wxPanelWrapper.cpp index db8474b0c..95970fa73 100644 --- a/src/widgets/wxPanelWrapper.cpp +++ b/src/widgets/wxPanelWrapper.cpp @@ -20,7 +20,7 @@ wxPanelWrapper::wxPanelWrapper(wxWindow * parent, wxWindowID id, void wxPanelWrapper::DoCharHook(wxKeyEvent &event) { -#ifdef __WXMAC +#ifdef __WXMAC__ // Compensate for the regressions in TAB key navigation // due to the switch to wxWidgets 3.0.2 if (event.GetKeyCode() == WXK_TAB) { From 7315af547f00fdf9f454978860869923516a035d Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 25 Jun 2016 23:34:26 -0400 Subject: [PATCH 13/14] Bug1424: Better positioned scrubbing tool bar with legacy .cfg file --- src/toolbars/ToolManager.cpp | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/toolbars/ToolManager.cpp b/src/toolbars/ToolManager.cpp index fa50ab039..f367b01f6 100644 --- a/src/toolbars/ToolManager.cpp +++ b/src/toolbars/ToolManager.cpp @@ -835,10 +835,51 @@ void ToolManager::ReadConfig() d->LoadConfig(); // Add all unordered toolbars + bool deviceWasPositioned = false; for( int ord = 0; ord < (int) unordered[ dock ].GetCount(); ord++ ) { ToolBar *t = mBars[ unordered[ dock ][ ord ] ]; + if (deviceWasPositioned && + t->GetType() == DeviceBarID) + continue; + + if (someFound && + t->GetType() == ScrubbingBarID) { + // Special case code to put the NEW scrubbing toolbar where we + // want it, when audacity.cfg is present from an older version + ToolBar *lastRoot {}; + + // Change from the ideal configuration to the constrained one, + // just as when dragging and dropping + ToolBarConfiguration dummy; + mTopDock->WrapConfiguration(dummy); + + // Start a NEW row with just the scrubbing toolbar + auto &configuration = mTopDock->GetConfiguration(); + for (const auto place : configuration) + if (place.position.rightOf == nullptr) + lastRoot = place.pTree->pBar; + ToolBarConfiguration::Position position { + nullptr, lastRoot, false + }; + mTopDock->Dock(t, false, position); + + // Reposition the device toolbar, if it was docked above, + // right of scrubbing + const auto deviceToolBar = mBars[ DeviceBarID ]; + if (deviceToolBar->GetDock() == mTopDock) { + deviceToolBar->GetDock()->Undock(deviceToolBar); + position = { t, nullptr }; + mTopDock->Dock(deviceToolBar, false, position); + + // Remember not to place the device toolbar again + deviceWasPositioned = true; + } + + continue; + } + // Dock it d->Dock( t, false ); From 016919a53bb8f17de2a9070fbe84ed88fb27e175 Mon Sep 17 00:00:00 2001 From: James Crook Date: Sun, 26 Jun 2016 08:35:19 +0100 Subject: [PATCH 14/14] Bug1223: (correction). Fix new potential crash in following pointer. With recent changes to the Nyquist code for freeing blocks, the pointer 'next' could be uninitialised when 'list' points to the zero chain. So Audacity would follow a rogue pointer. We'd get away with it if the uninitialised value happened to be zero. --- lib-src/libnyquist/nyquist/nyqsrc/sound.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib-src/libnyquist/nyquist/nyqsrc/sound.c b/lib-src/libnyquist/nyquist/nyqsrc/sound.c index 84803fdc3..534c2c803 100644 --- a/lib-src/libnyquist/nyquist/nyqsrc/sound.c +++ b/lib-src/libnyquist/nyquist/nyqsrc/sound.c @@ -528,6 +528,7 @@ void snd_list_unref(snd_list_type list) break; // the rest of the list is shared, nothing more to free } + next = NULL; // list nodes either point to a block of samples or this is the // last list node (list->block == NULL) which points to a suspension // lists can also terminate at the zero_block, which is an infinite @@ -540,7 +541,6 @@ void snd_list_unref(snd_list_type list) /* free suspension structure */ /* nyquist_printf("freeing susp@%p\n", list->u.susp); */ (*(list->u.susp->free))(list->u.susp); - next = NULL; } /* if (list == list_watch) printf("freeing watched snd_list %p\n", list); */