1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-05 23:19:06 +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_,
bool bSelected )
{
auto rect = rect_;
--rect.width;
auto dc = &context.dc;
bool highlight = false;
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
@ -381,21 +384,19 @@ void TrackArtist::DrawVRuler
// Paint the background
AColor::MediumTrackInfo(dc, bSelected);
dc->DrawRectangle( rect_ );
dc->DrawRectangle( rect );
// Stroke the left border
dc->SetPen(*wxBLACK_PEN);
{
const auto left = rect_.GetLeft();
AColor::Line( *dc, left, rect_.GetTop(), left, rect_.GetBottom() );
const auto left = rect.GetLeft();
AColor::Line( *dc, left, rect.GetTop(), left, rect.GetBottom() );
}
// Label and Time tracks do not have a vruler
// But give it a beveled area
t->TypeSwitch(
[&](const LabelTrack *) {
const wxRect &rect = rect_;
wxRect bev = rect;
bev.Inflate(-1, 0);
bev.width += 1;
@ -403,7 +404,6 @@ void TrackArtist::DrawVRuler
},
[&](const TimeTrack *) {
const wxRect &rect = rect_;
wxRect bev = rect;
bev.Inflate(-1, 0);
bev.width += 1;
@ -425,7 +425,6 @@ void TrackArtist::DrawVRuler
},
[&](const WaveTrack *) {
const wxRect &rect = rect_;
// All waves have a ruler in the info panel
// The ruler needs a bevelled surround.
wxRect bev = rect;
@ -451,8 +450,6 @@ void TrackArtist::DrawVRuler
#ifdef USE_MIDI
,
[&](const NoteTrack *track) {
wxRect rect = rect_;
// The note track draws a vertical keyboard to label pitches
UpdateVRuler(t, rect);

View File

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