21 {
22 wxAutoBufferedPaintDC dc(this);
23
24
25 int text_width, text_height;
26 dc.GetTextExtent("m",&text_width,&text_height);
28 int tick_w = text_width / 2;
29
30 dc.SetBrush(GetBackgroundColour());
31 dc.SetPen(GetBackgroundColour());
32 dc.DrawRectangle(GetClientRect());
33
37
41 return;
42 }
43
44
48 dc.SetPen( wxPen( wxColor(std::min(222,color), 222-std::max(color-222,0), 60), 1) );
50 }
55 else {
58 }
59 }
60 }
61
62
66
68
69
71
72
73 float last_mark = -10000;
76 int y =
m_rect.GetBottom();
78 dc.DrawLine(x,y+tick_w+1,x,y-tick_w);
79 auto label = math_x == 0 ? "0" : wxString().Format(wxT("%.1f") , math_x);
80 dc.GetTextExtent(label,&text_width,&text_height);
81 dc.DrawText(label ,wxPoint(x - text_width * .5, y + .8 *
scale_unit));
82 last_mark = x;
83 }
84
85
86 last_mark=10000;
91 dc.DrawLine(x-tick_w,y,x+tick_w+1,y);
92 auto label = wxString()<<math_y;
93 dc.GetTextExtent(label,&text_width,&text_height);
94 dc.DrawText(label ,wxPoint(x -
scale_unit - text_width, y - .5 * text_height + 1));
95 last_mark = y;
96 }
97
98
99 wxString label =
_(
L(
"Time")) +
" (" +
_(
L(
"s")) +
")";
100 dc.GetTextExtent(label,&text_width,&text_height);
102 label =
_(
L(
"Volumetric speed")) +
" (" +
_(
L(u8
"mm³/s")) +
")";
103 dc.GetTextExtent(label,&text_width,&text_height);
104 dc.DrawRotatedText(label,wxPoint(0,0.5*(
m_rect.GetBottom()+
m_rect.GetTop())+text_width/2.f),90);
105
106
109 continue;
110
112 wxString value_label = wxString().Format(wxT(
"%.1f"),
button.get_pos().m_y);
113
115 dc.GetTextExtent(value_label, &label_width, &label_height);
116
117 const int padding = 4;
118
119 int label_x = button_screen_pos.x - (label_width/2);
120 label_x = std::clamp(label_x,
m_rect.GetLeft() + (padding*2),
m_rect.GetRight() - label_width - (padding*2));
121
122
123 int label_y = button_screen_pos.y - (
side/2) - label_height - (padding*2);
124 if (label_y - (padding*2) <
m_rect.GetTop()) {
125 label_y = button_screen_pos.y + (
side/2) + (padding*2);
126 }
127
128
132 wxRect label_rect(label_x - padding, label_y - padding, label_width + (2*padding), label_height + (2*padding));
133 dc.DrawRoundedRectangle(label_rect, 2);
134
135
137 dc.DrawText(value_label, wxPoint(label_x, label_y));
138 }
139}
#define _(s)
Definition 3mf.cpp:306
#define L(s)
Definition ExtrusionEntity.cpp:25
std::vector< int > m_line_to_draw
Definition RammingChart.hpp:118
wxPoint math_to_screen(const wxPoint2DDouble &math) const
Definition RammingChart.hpp:82
static const bool splines
Definition RammingChart.hpp:63
int side
Definition RammingChart.hpp:65
static wxColour darkModeColorFor(wxColour const &color)
Definition StateColor.cpp:219
wxColour bg_color()
Definition SpeedDialDialog.cpp:69
bool button(const IconManager::Icon &activ, const IconManager::Icon &hover, const IconManager::Icon &disable, bool disabled)
Use icon as button with 3 states activ hover and disabled.
Definition IconManager.cpp:418