1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-02 17:09:26 +02:00

The ruler and sash draw functions treat their own backgrounds

This commit is contained in:
Paul Licameli 2018-11-02 20:00:12 -04:00
parent 951e7d27da
commit e70b240338
4 changed files with 24 additions and 11 deletions

View File

@ -369,7 +369,8 @@ void TrackArtist::DrawTrack(TrackPanelDrawingContext &context,
} }
void TrackArtist::DrawVRuler void TrackArtist::DrawVRuler
(TrackPanelDrawingContext &context, const Track *t, const wxRect & rect_) ( TrackPanelDrawingContext &context, const Track *t, const wxRect & rect_,
bool bSelected )
{ {
auto dc = &context.dc; auto dc = &context.dc;
bool highlight = false; bool highlight = false;
@ -378,11 +379,16 @@ void TrackArtist::DrawVRuler
#endif #endif
// Paint the background
AColor::MediumTrackInfo(dc, bSelected);
dc->DrawRectangle( rect_ );
// Stroke the left border // Stroke the left border
dc->SetPen(*wxBLACK_PEN); dc->SetPen(*wxBLACK_PEN);
{ {
const auto left = rect_.GetLeft(); const auto left = rect_.GetLeft();
AColor::Line( *dc, left, rect_.GetTop(), left, rect_.GetBottom() ); AColor::Line( *dc, left, rect_.GetTop(), left, rect_.GetBottom() );
} }
// Label and Time tracks do not have a vruler // Label and Time tracks do not have a vruler

View File

@ -69,7 +69,7 @@ class AUDACITY_DLL_API TrackArtist {
bool hasSolo); bool hasSolo);
void DrawVRuler(TrackPanelDrawingContext &context, void DrawVRuler(TrackPanelDrawingContext &context,
const Track *t, const wxRect & rect); const Track *t, const wxRect & rect, bool bSelected );
void UpdateVRuler(const Track *t, const wxRect & rect); void UpdateVRuler(const Track *t, const wxRect & rect);

View File

@ -1128,7 +1128,7 @@ void TrackPanel::DrawEverythingElse(TrackPanelDrawingContext &context,
rect.y += kTopMargin; rect.y += kTopMargin;
rect.width = GetVRulerWidth(); rect.width = GetVRulerWidth();
rect.height -= (kTopMargin + kBottomMargin); rect.height -= (kTopMargin + kBottomMargin);
mTrackArtist->DrawVRuler(context, visibleT, rect); mTrackArtist->DrawVRuler(context, visibleT, rect, t->GetSelected());
} }
} }
@ -1612,7 +1612,9 @@ void TrackPanel::DrawOutside
rect.height -= kTopInset; rect.height -= kTopInset;
int labelw = GetLabelWidth(); int labelw = GetLabelWidth();
mTrackInfo.DrawBackground( dc, rect, t->GetSelected(), labelw ); int vrul = GetVRulerOffset();
mTrackInfo.DrawBackground( dc, rect, t->GetSelected(), vrul );
// Vaughan, 2010-08-24: No longer doing this. // Vaughan, 2010-08-24: No longer doing this.
// Draw sync-lock tiles in ruler area. // Draw sync-lock tiles in ruler area.
@ -1623,7 +1625,6 @@ void TrackPanel::DrawOutside
// TrackArtist::DrawSyncLockTiles(dc, tileFill); // TrackArtist::DrawSyncLockTiles(dc, tileFill);
//} //}
int vrul = GetVRulerOffset();
DrawBordersAroundTrack( dc, rect ); DrawBordersAroundTrack( dc, rect );
{ {
auto channels = TrackList::Channels(t); auto channels = TrackList::Channels(t);
@ -1638,7 +1639,7 @@ void TrackPanel::DrawOutside
wxRect sashRect{ wxRect sashRect{
vrul, yy, rect.GetRight() - vrul, kSeparatorThickness vrul, yy, rect.GetRight() - vrul, kSeparatorThickness
}; };
DrawSash( dc, sashRect, labelw ); DrawSash( dc, sashRect, labelw, t->GetSelected() );
} }
} }
@ -1687,7 +1688,8 @@ void TrackPanel::DrawOutsideOfTrack
dc->DrawRectangle(side); dc->DrawRectangle(side);
} }
void TrackPanel::DrawSash( wxDC * dc, const wxRect & rect, int labelw ) void TrackPanel::DrawSash(
wxDC * dc, const wxRect & rect, int labelw, bool bSelected )
{ {
// Area between channels of a group // Area between channels of a group
// Paint the channel separator over (what would be) the lower border of this // Paint the channel separator over (what would be) the lower border of this
@ -1695,6 +1697,10 @@ void TrackPanel::DrawSash( wxDC * dc, const wxRect & rect, int labelw )
ADCChanger cleanup{ dc }; ADCChanger cleanup{ dc };
// Paint the left part of the background
AColor::MediumTrackInfo(dc, bSelected);
dc->DrawRectangle( rect.GetX(), rect.GetY(), labelw, rect.GetHeight() );
// Stroke the left border // Stroke the left border
dc->SetPen(*wxBLACK_PEN); dc->SetPen(*wxBLACK_PEN);
{ {
@ -2510,11 +2516,11 @@ void TrackInfo::DrawBordersWithin
// Paint the whole given rectangle some fill color // Paint the whole given rectangle some fill color
void TrackInfo::DrawBackground( void TrackInfo::DrawBackground(
wxDC * dc, const wxRect & rect, bool bSelected, const int labelw) const wxDC * dc, const wxRect & rect, bool bSelected, const int vrul) const
{ {
// fill in label // fill in label
wxRect fill = rect; wxRect fill = rect;
fill.width = labelw - kLeftInset; fill.width = vrul - kLeftInset;
AColor::MediumTrackInfo(dc, bSelected); AColor::MediumTrackInfo(dc, bSelected);
dc->DrawRectangle(fill); dc->DrawRectangle(fill);

View File

@ -152,7 +152,7 @@ public:
void DrawBackground( void DrawBackground(
wxDC * dc, const wxRect & rect, bool bSelected, const int labelw ) const; wxDC * dc, const wxRect & rect, bool bSelected, const int vrul ) const;
// void DrawBordersWithin( // void DrawBordersWithin(
// wxDC * dc, const wxRect & rect, const Track &track ) const; // wxDC * dc, const wxRect & rect, const Track &track ) const;
@ -379,7 +379,8 @@ protected:
void DrawBordersAroundTrack(wxDC* dc, const wxRect & rect ); void DrawBordersAroundTrack(wxDC* dc, const wxRect & rect );
void DrawOutsideOfTrack ( void DrawOutsideOfTrack (
TrackPanelDrawingContext &context, const wxRect & rect ); TrackPanelDrawingContext &context, const wxRect & rect );
void DrawSash ( wxDC* dc, const wxRect & rect, int labelw ); void DrawSash (
wxDC* dc, const wxRect & rect, int labelw, bool bSelected );
public: public:
// Set the object that performs catch-all event handling when the pointer // Set the object that performs catch-all event handling when the pointer