MCPcopy Create free account
hub / github.com/audacity/audacity / Draw

Method Draw

src/widgets/RulerUpdater.cpp:86–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84 }
85
86void RulerUpdater::Label::Draw(
87 wxDC& dc, bool twoTone, wxColour c,
88 std::unique_ptr<RulerStruct::Fonts>& fonts) const
89{
90 if (text.has_value() && !text->empty()) {
91 bool altColor = twoTone && value < 0.0;
92
93 dc.SetTextForeground(altColor ? theTheme.Colour(clrTextNegativeNumbers) : c);
94 dc.SetBackgroundMode(wxTRANSPARENT);
95 if (dc.GetFont() == fonts->major) {
96 // Do not draw units as bolded
97 dc.DrawText(text->Translation(), lx, ly);
98 wxSize textSize = dc.GetTextExtent(text->Translation());
99 dc.SetFont(fonts->minor);
100 int unitX = lx + textSize.GetWidth();
101 dc.DrawText(units.Translation(), unitX, ly);
102 dc.SetFont(fonts->major);
103 }
104 else {
105 auto str = *text + units;
106 dc.DrawText(str.Translation(), lx, ly);
107 }
108 }
109}
110
111auto RulerUpdater::MakeTick(
112 Label lab,

Callers

nothing calls this directly

Calls 7

has_valueMethod · 0.80
DrawTextMethod · 0.80
TranslationMethod · 0.80
SetFontMethod · 0.80
emptyMethod · 0.45
GetFontMethod · 0.45
GetWidthMethod · 0.45

Tested by

no test coverage detected