Audacity 3.2.0
Functions
WaveTrackVRulerControls Namespace Reference

Functions

AUDACITY_DLL_API RulerScratchRuler ()
 
AUDACITY_DLL_API void DoDraw (TrackVRulerControls &controls, TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
 

Function Documentation

◆ DoDraw()

void WaveTrackVRulerControls::DoDraw ( TrackVRulerControls controls,
TrackPanelDrawingContext context,
const wxRect &  rect,
unsigned  iPass 
)

Definition at line 35 of file WaveTrackVRulerControls.cpp.

38{
39 Ruler &vruler = ScratchRuler();
40
41 // Draw on a later pass because the bevel overpaints one pixel
42 // out of bounds on the bottom
43
44 if ( iPass == TrackArtist::PassControls ) {
45 auto rect = rect_;
46 --rect.width;
47 --rect.height;
48
49 auto dc = &context.dc;
50
51 // All waves have a ruler in the info panel
52 // The ruler needs a bevelled surround.
53 wxRect bev = rect;
54 bev.Inflate(-1, 0);
55 bev.width += 1;
56
57 bool highlight = false;
58#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
59 highlight = rect.Contains(context.lastState.GetPosition());
60#endif
61
62 AColor::BevelTrackInfo(*dc, true, bev, highlight);
63
64 // Right align the ruler
65 wxRect rr = rect;
66 rr.width--;
67
68 auto t = controls.FindTrack();
69 if ( !t )
70 return;
71
72// Next code tests for a VRuler that is narrower than the rectangle
73// we are drawing into. If so, it 'right aligns' the ruler into the
74// rectangle.
75// However, it seems this occurs only because vrulerSize is not up to
76// date. That in turn caused Bug 2248, which was the labels being
77// drawn further right than they should be (in MultiView mode).
78// #ifdeffing out this code fixes bug 2248
79#if 0
80 if ( t->vrulerSize.GetWidth() < rect.GetWidth()) {
81 int adj = rr.GetWidth() - t->vrulerSize.GetWidth();
82 rr.x += adj;
83 rr.width -= adj;
84 }
85#endif
86
87 controls.UpdateRuler(rr);
88
89 vruler.SetTickColour( theTheme.Colour( clrTrackPanelText ));
90 vruler.Draw(*dc);
91 }
92}
THEME_API Theme theTheme
Definition: Theme.cpp:82
static void BevelTrackInfo(wxDC &dc, bool up, const wxRect &r, bool highlight=false)
Definition: AColor.cpp:340
std::shared_ptr< Track > FindTrack()
Used to display a Ruler.
Definition: Ruler.h:28
void SetTickColour(const wxColour &colour)
Definition: Ruler.h:129
void Draw(wxDC &dc) const
Definition: Ruler.cpp:438
wxColour & Colour(int iIndex)
virtual void UpdateRuler(const wxRect &rect)=0
AUDACITY_DLL_API Ruler & ScratchRuler()

References AColor::BevelTrackInfo(), ThemeBase::Colour(), TrackPanelDrawingContext::dc, Ruler::Draw(), CommonTrackPanelCell::FindTrack(), TrackPanelDrawingContext::lastState, TrackArtist::PassControls, ScratchRuler(), Ruler::SetTickColour(), theTheme, and TrackVRulerControls::UpdateRuler().

Referenced by SpectrumVRulerControls::Draw(), and WaveformVRulerControls::Draw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ScratchRuler()

Ruler & WaveTrackVRulerControls::ScratchRuler ( )

Definition at line 28 of file WaveTrackVRulerControls.cpp.

29{
30 static Ruler theRuler{
32 return theRuler;
33}
static const LinearUpdater & Instance()
static const RealFormat & LinearInstance()
Definition: RealFormat.cpp:14

References LinearUpdater::Instance(), and RealFormat::LinearInstance().

Referenced by DoDraw(), SpectrumVRulerControls::DoUpdateVRuler(), and WaveformVRulerControls::DoUpdateVRuler().

Here is the call graph for this function:
Here is the caller graph for this function: