| 84 | } |
| 85 | |
| 86 | void 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 | |
| 111 | auto RulerUpdater::MakeTick( |
| 112 | Label lab, |