1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-06 07:29:07 +02:00

Rectangle passed VRuler draw function agrees with hit test rectangle...

... that is, it is one wider than before.  But the drawing routine compensates
to make the picture no different.
This commit is contained in:
Paul Licameli 2018-10-30 14:57:19 -04:00
parent e70b240338
commit d0d88118cc
2 changed files with 13 additions and 15 deletions

View File

@ -372,6 +372,9 @@ void TrackArtist::DrawVRuler
( TrackPanelDrawingContext &context, const Track *t, const wxRect & rect_, ( TrackPanelDrawingContext &context, const Track *t, const wxRect & rect_,
bool bSelected ) bool bSelected )
{ {
auto rect = rect_;
--rect.width;
auto dc = &context.dc; auto dc = &context.dc;
bool highlight = false; bool highlight = false;
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING #ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
@ -381,21 +384,19 @@ void TrackArtist::DrawVRuler
// Paint the background // Paint the background
AColor::MediumTrackInfo(dc, bSelected); AColor::MediumTrackInfo(dc, bSelected);
dc->DrawRectangle( rect_ ); 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
// But give it a beveled area // But give it a beveled area
t->TypeSwitch( t->TypeSwitch(
[&](const LabelTrack *) { [&](const LabelTrack *) {
const wxRect &rect = rect_;
wxRect bev = rect; wxRect bev = rect;
bev.Inflate(-1, 0); bev.Inflate(-1, 0);
bev.width += 1; bev.width += 1;
@ -403,7 +404,6 @@ void TrackArtist::DrawVRuler
}, },
[&](const TimeTrack *) { [&](const TimeTrack *) {
const wxRect &rect = rect_;
wxRect bev = rect; wxRect bev = rect;
bev.Inflate(-1, 0); bev.Inflate(-1, 0);
bev.width += 1; bev.width += 1;
@ -425,7 +425,6 @@ void TrackArtist::DrawVRuler
}, },
[&](const WaveTrack *) { [&](const WaveTrack *) {
const wxRect &rect = rect_;
// All waves have a ruler in the info panel // All waves have a ruler in the info panel
// The ruler needs a bevelled surround. // The ruler needs a bevelled surround.
wxRect bev = rect; wxRect bev = rect;
@ -451,8 +450,6 @@ void TrackArtist::DrawVRuler
#ifdef USE_MIDI #ifdef USE_MIDI
, ,
[&](const NoteTrack *track) { [&](const NoteTrack *track) {
wxRect rect = rect_;
// The note track draws a vertical keyboard to label pitches // The note track draws a vertical keyboard to label pitches
UpdateVRuler(t, rect); UpdateVRuler(t, rect);

View File

@ -1123,12 +1123,13 @@ void TrackPanel::DrawEverythingElse(TrackPanelDrawingContext &context,
#endif #endif
if (region.Contains(0, trackRect.y, GetLeftOffset(), trackRect.height)) { if (region.Contains(0, trackRect.y, GetLeftOffset(), trackRect.height)) {
wxRect rect = trackRect; wxRect rect{
rect.x += GetVRulerOffset(); GetVRulerOffset(),
rect.y += kTopMargin; trackRect.y + kTopMargin,
rect.width = GetVRulerWidth(); GetVRulerWidth() + 1,
rect.height -= (kTopMargin + kBottomMargin); trackRect.height - kSeparatorThickness
mTrackArtist->DrawVRuler(context, visibleT, rect, t->GetSelected()); };
mTrackArtist->DrawVRuler( context, visibleT, rect, t->GetSelected() );
} }
} }