diff --git a/src/TrackInfo.cpp b/src/TrackInfo.cpp index f9ff41e5f..d2f2a04c2 100644 --- a/src/TrackInfo.cpp +++ b/src/TrackInfo.cpp @@ -564,43 +564,6 @@ void TrackInfo::DrawBordersWithin //#define USE_BEVELS -// Paint the whole given rectangle some fill color -void TrackInfo::DrawBackground( - wxDC * dc, const wxRect & rect, bool bSelected, const int vrul) -{ - // fill in label - wxRect fill = rect; - fill.width = vrul - kLeftMargin; - AColor::MediumTrackInfo(dc, bSelected); - dc->DrawRectangle(fill); - -#ifdef USE_BEVELS - // This branch is not now used - // PRL: todo: banish magic numbers. - // PRL: vrul was the x coordinate of left edge of the vertical ruler. - // PRL: bHasMuteSolo was true iff the track was WaveTrack. - if( bHasMuteSolo ) - { - int ylast = rect.height-20; - int ybutton = wxMin(32,ylast-17); - int ybuttonEnd = 67; - - fill=wxRect( rect.x+1, rect.y+17, vrul-6, ybutton); - AColor::BevelTrackInfo( *dc, true, fill ); - - if( ybuttonEnd < ylast ){ - fill=wxRect( rect.x+1, rect.y+ybuttonEnd, fill.width, ylast - ybuttonEnd); - AColor::BevelTrackInfo( *dc, true, fill ); - } - } - else - { - fill=wxRect( rect.x+1, rect.y+17, vrul-6, rect.height-37); - AColor::BevelTrackInfo( *dc, true, fill ); - } -#endif -} - unsigned TrackInfo::DefaultTrackHeight( const TCPLines &topLines ) { int needed = diff --git a/src/TrackInfo.h b/src/TrackInfo.h index 89f38ed64..c0e1d1acd 100644 --- a/src/TrackInfo.h +++ b/src/TrackInfo.h @@ -92,8 +92,6 @@ namespace TrackInfo void SetTrackInfoFont(wxDC *dc); - void DrawBackground( - wxDC * dc, const wxRect & rect, bool bSelected, const int vrul ); // void DrawBordersWithin( // wxDC * dc, const wxRect & rect, const Track &track ) const; diff --git a/src/TrackPanel.cpp b/src/TrackPanel.cpp index bcf41486e..66f92ede8 100644 --- a/src/TrackPanel.cpp +++ b/src/TrackPanel.cpp @@ -1036,10 +1036,6 @@ void TrackPanel::DrawOutside // Now exclude the resizer below rect.height -= kSeparatorThickness; - int vrul = mViewInfo->GetVRulerOffset(); - - TrackInfo::DrawBackground( dc, rect, t->GetSelected(), vrul ); - // Vaughan, 2010-08-24: No longer doing this. // Draw sync-lock tiles in ruler area. //if (t->IsSyncLockSelected()) { diff --git a/src/tracks/ui/CommonTrackControls.cpp b/src/tracks/ui/CommonTrackControls.cpp index c210cb225..e07b618d2 100644 --- a/src/tracks/ui/CommonTrackControls.cpp +++ b/src/tracks/ui/CommonTrackControls.cpp @@ -12,10 +12,13 @@ Paul Licameli split from TrackControls.cpp #include "TrackButtonHandles.h" #include "TrackSelectHandle.h" +#include "../../AColor.h" #include "../../RefreshCode.h" #include "../../Project.h" #include "../../ProjectHistory.h" +#include "../../TrackArtist.h" #include "../../TrackInfo.h" +#include "../../TrackPanelDrawingContext.h" #include "../../TrackPanelMouseEvent.h" #include "../../TrackUtilities.h" #include @@ -25,6 +28,7 @@ Paul Licameli split from TrackControls.cpp #include "../../Track.h" #include "../../widgets/PopupMenuTable.h" +#include #include std::vector CommonTrackControls::HitTest @@ -265,3 +269,45 @@ unsigned CommonTrackControls::DoContextMenu return data.result; } + +void CommonTrackControls::Draw( + TrackPanelDrawingContext &context, + const wxRect &rect, unsigned iPass ) +{ + if ( iPass == TrackArtist::PassMargins ) { + // fill in label + auto dc = &context.dc; + const auto pTrack = FindTrack(); + AColor::MediumTrackInfo( dc, pTrack && pTrack->GetSelected() ); + dc->DrawRectangle( rect ); + } + + // Some old cut-and-paste legacy from TrackPanel.cpp here: +#undef USE_BEVELS +#ifdef USE_BEVELS + // This branch is not now used + // PRL: todo: banish magic numbers. + // PRL: vrul was the x coordinate of left edge of the vertical ruler. + // PRL: bHasMuteSolo was true iff the track was WaveTrack. + if( bHasMuteSolo ) + { + int ylast = rect.height-20; + int ybutton = wxMin(32,ylast-17); + int ybuttonEnd = 67; + + fill=wxRect( rect.x+1, rect.y+17, vrul-6, ybutton); + AColor::BevelTrackInfo( *dc, true, fill ); + + if( ybuttonEnd < ylast ){ + fill=wxRect( rect.x+1, rect.y+ybuttonEnd, fill.width, ylast - ybuttonEnd); + AColor::BevelTrackInfo( *dc, true, fill ); + } + } + else + { + fill=wxRect( rect.x+1, rect.y+17, vrul-6, rect.height-37); + AColor::BevelTrackInfo( *dc, true, fill ); + } +#endif + +} diff --git a/src/tracks/ui/CommonTrackControls.h b/src/tracks/ui/CommonTrackControls.h index aa048b646..0771a929d 100644 --- a/src/tracks/ui/CommonTrackControls.h +++ b/src/tracks/ui/CommonTrackControls.h @@ -56,6 +56,11 @@ protected: (const wxRect &rect, wxWindow *pParent, wxPoint *pPosition) override; virtual PopupMenuTable *GetMenuExtension(Track *pTrack) = 0; + // TrackPanelDrawable implementation + void Draw( + TrackPanelDrawingContext &context, + const wxRect &rect, unsigned iPass ) override; + std::weak_ptr mCloseHandle; std::weak_ptr mMenuHandle; std::weak_ptr mMinimizeHandle;