1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-06 23:02:42 +02:00

Move drawing code for background of vertical rulers

This commit is contained in:
Paul Licameli 2018-11-03 12:47:26 -04:00
parent e7c1f7424d
commit 363f6f8b7b
3 changed files with 34 additions and 11 deletions

View File

@ -293,17 +293,6 @@ void TrackArt::DrawVRuler
#endif
// Paint the background
AColor::MediumTrackInfo(dc, bSelected);
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() );
}
// Label and Time tracks do not have a vruler
// But give it a beveled area
t->TypeSwitch(

View File

@ -13,7 +13,10 @@ Paul Licameli split from TrackPanel.cpp
#include "TrackView.h"
#include "../../AColor.h"
#include "../../Track.h"
#include "../../TrackArtist.h"
#include "../../TrackPanelDrawingContext.h"
#include "../../ViewInfo.h"
#include <wx/cursor.h>
@ -85,3 +88,29 @@ void TrackVRulerControls::DrawZooming
dc->DrawRectangle(rect);
}
void TrackVRulerControls::Draw(
TrackPanelDrawingContext &context,
const wxRect &rect_, unsigned iPass )
{
// Common initial part of drawing for all subtypes
if ( iPass == TrackArtist::PassMargins ) {
auto rect = rect_;
--rect.width;
auto dc = &context.dc;
// Paint the background
auto pTrack = FindTrack();
AColor::MediumTrackInfo(dc, pTrack && pTrack->GetSelected() );
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() );
}
}
}

View File

@ -46,6 +46,11 @@ public:
protected:
std::shared_ptr<Track> DoFindTrack() override;
// TrackPanelDrawable implementation
void Draw(
TrackPanelDrawingContext &context,
const wxRect &rect, unsigned iPass ) override;
Track *GetTrack() const;
std::weak_ptr<TrackView> mwTrackView;