diff --git a/src/Project.cpp b/src/Project.cpp index ed1fc5f27..7aa33bde6 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -1255,10 +1255,11 @@ AudacityProject::~AudacityProject() this); } -void AudacityProject::ResetColours() +void AudacityProject::ApplyUpdatedTheme() { SetBackgroundColour(theTheme.Colour( clrMedium )); ClearBackground();// For wxGTK. + mTrackPanel->ApplyUpdatedTheme(); } diff --git a/src/Project.h b/src/Project.h index 0c6c88b44..1e445646c 100644 --- a/src/Project.h +++ b/src/Project.h @@ -167,7 +167,8 @@ class AUDACITY_DLL_API AudacityProject final : public wxFrame, const wxPoint & pos, const wxSize & size); virtual ~AudacityProject(); - void ResetColours(); + virtual void ApplyUpdatedTheme(); + AudioIOStartStreamOptions GetDefaultPlayOptions(); TrackList *GetTracks() { return mTracks.get(); } diff --git a/src/Theme.cpp b/src/Theme.cpp index e61383a7f..fae9ed579 100644 --- a/src/Theme.cpp +++ b/src/Theme.cpp @@ -245,8 +245,7 @@ void Theme::ApplyUpdatedImages() { AColor::ReInit(); AudacityProject *p = GetActiveProject(); - p->SetBackgroundColour( theTheme.Colour( clrMedium ) ); - p->ResetColours(); + p->ApplyUpdatedTheme(); for( int ii = 0; ii < ToolBarCount; ++ii ) { ToolBar *pToolBar = p->GetToolManager()->GetToolBar(ii); diff --git a/src/TrackPanel.cpp b/src/TrackPanel.cpp index 6138cc550..b502d9b37 100644 --- a/src/TrackPanel.cpp +++ b/src/TrackPanel.cpp @@ -786,6 +786,12 @@ void TrackPanel::UpdatePrefs() Refresh(); } +void TrackPanel::ApplyUpdatedTheme() +{ + mTrackInfo.ReCreateSliders(); +} + + /// Remembers the track we clicked on and why we captured it. /// We also use this method to clear the record /// of the captured track, passing NULL as the track. @@ -9060,36 +9066,54 @@ TrackInfo::TrackInfo(TrackPanel * pParentIn) { pParent = pParentIn; + mGain = NULL; + mGainCaptured=NULL; + mPan = NULL; + mPanCaptured=NULL; + + ReCreateSliders(); + + UpdatePrefs(); +} + +TrackInfo::~TrackInfo() +{ +} + +void TrackInfo::ReCreateSliders(){ wxRect rect(0, 0, 1000, 1000); wxRect sliderRect; - GetGainRect(rect, sliderRect); + float defPos = 1.0; /* i18n-hint: Title of the Gain slider, used to adjust the volume */ mGain = std::make_unique(pParent, _("Gain"), wxPoint(sliderRect.x, sliderRect.y), wxSize(sliderRect.width, sliderRect.height), DB_SLIDER); - mGain->SetDefaultValue(1.0); + mGain->SetDefaultValue(defPos); + mGainCaptured = std::make_unique(pParent, _("Gain"), wxPoint(sliderRect.x, sliderRect.y), wxSize(sliderRect.width, sliderRect.height), DB_SLIDER); - mGainCaptured->SetDefaultValue(1.0); + mGainCaptured->SetDefaultValue(defPos); GetPanRect(rect, sliderRect); + defPos = 0.0; /* i18n-hint: Title of the Pan slider, used to move the sound left or right */ mPan = std::make_unique(pParent, _("Pan"), wxPoint(sliderRect.x, sliderRect.y), wxSize(sliderRect.width, sliderRect.height), PAN_SLIDER); - mPan->SetDefaultValue(0.0); + mPan->SetDefaultValue(defPos); + mPanCaptured = std::make_unique(pParent, _("Pan"), wxPoint(sliderRect.x, sliderRect.y), wxSize(sliderRect.width, sliderRect.height), PAN_SLIDER); - mPanCaptured->SetDefaultValue(0.0); + mPanCaptured->SetDefaultValue(defPos); #ifdef EXPERIMENTAL_MIDI_OUT GetVelocityRect(rect, sliderRect); @@ -9107,11 +9131,6 @@ TrackInfo::TrackInfo(TrackPanel * pParentIn) mVelocityCaptured->SetDefaultValue(0.0); #endif - UpdatePrefs(); -} - -TrackInfo::~TrackInfo() -{ } int TrackInfo::GetTrackInfoWidth() const diff --git a/src/TrackPanel.h b/src/TrackPanel.h index 10d38c629..0fa9fc5c3 100644 --- a/src/TrackPanel.h +++ b/src/TrackPanel.h @@ -92,6 +92,7 @@ class AUDACITY_DLL_API TrackInfo public: TrackInfo(TrackPanel * pParentIn); ~TrackInfo(); + void ReCreateSliders(); private: int CalcItemY( int iItem ) const; @@ -172,6 +173,7 @@ class AUDACITY_DLL_API TrackPanel final : public OverlayPanel { virtual void DeleteMenus(void); virtual void UpdatePrefs(); + virtual void ApplyUpdatedTheme(); virtual void OnPaint(wxPaintEvent & event); virtual void OnMouseEvent(wxMouseEvent & event); diff --git a/src/widgets/ASlider.cpp b/src/widgets/ASlider.cpp index 0ed75d170..f34a08f9e 100644 --- a/src/widgets/ASlider.cpp +++ b/src/widgets/ASlider.cpp @@ -655,7 +655,8 @@ void LWSlider::Draw(wxDC & paintDC) mThumbBitmap = std::make_unique(wxBitmap( theTheme.Bitmap( bmpSliderThumb ))); -#ifdef OPTIONAL_SLIDER_TICKS +// This code draws the (old) slider thumb. +#if 0 // Create the bitmap mThumbBitmap = std::make_unique(); mThumbBitmap->Create(mThumbWidth, mThumbHeight, paintDC); diff --git a/src/widgets/Ruler.cpp b/src/widgets/Ruler.cpp index 2960ea30a..bac05d15a 100644 --- a/src/widgets/Ruler.cpp +++ b/src/widgets/Ruler.cpp @@ -2026,6 +2026,12 @@ void AdornedRulerPanel::UpdatePrefs() void AdornedRulerPanel::ReCreateButtons() { + // TODO: Should we do this to destroy the grabber?? + // Get rid of any children we may have + // DestroyChildren(); + + SetBackgroundColour(theTheme.Colour( clrMedium )); + for (auto & button : mButtons) { if (button) button->Destroy(); @@ -2039,6 +2045,7 @@ void AdornedRulerPanel::ReCreateButtons() // This makes it visually clearer that the button is a button. wxPoint position( 1, 0 ); + Grabber * pGrabber = safenew Grabber(this, this->GetId()); pGrabber->SetAsSpacer( true ); //pGrabber->SetSize( 10, 27 ); // default is 10,27