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 32 of file WaveTrackVRulerControls.cpp.

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

27{
28 static Ruler theRuler;
29 return theRuler;
30}

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

Here is the caller graph for this function: