MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / OnPaint

Method OnPaint

src/gui/visualisationcontrol.cc:43–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41// clang-format on
42
43void VisualisationControl::OnPaint(wxPaintEvent&)
44{
45 auto size = GetSize();
46 int w = size.GetWidth();
47 int w2 = w / 2;
48 int h = size.GetHeight();
49 int h2 = h / 2;
50
51 int centrey = h * 1.5;
52 int scalesize = h - BORDER * 4;
53 int sectorsize = scalesize / TRACKS;
54 scalesize = sectorsize * TRACKS;
55 int scaletop = h2 - scalesize / 2;
56 int scalebottom = scaletop + scalesize - 1;
57 int outerradius = centrey - scaletop + BORDER;
58 int innerradius = centrey - scalebottom - BORDER;
59
60 wxPaintDC dc(this);
61 dc.SetBackground(*wxWHITE_BRUSH);
62 dc.Clear();
63
64 dc.SetPen(*wxBLACK_PEN);
65 dc.SetBrush(*wxLIGHT_GREY_BRUSH);
66 dc.DrawCircle({w2, centrey}, outerradius);
67 dc.SetBrush(dc.GetBackground());
68 dc.DrawCircle({w2, centrey}, innerradius);
69
70 dc.SetPen(AXIS_PEN);
71 dc.DrawLine({w2, scaletop}, {w2, scalebottom});
72
73 if (_mode != VISMODE_NOTHING)
74 {
75 if (_mode == VISMODE_READING)
76 {
77 dc.SetPen(READ_ARROW_PEN);
78 dc.SetBrush(READ_ARROW_BRUSH);
79 }
80 else if (_mode == VISMODE_WRITING)
81 {
82 dc.SetPen(WRITE_ARROW_PEN);
83 dc.SetBrush(WRITE_ARROW_BRUSH);
84 }
85
86 int factor = (_head == 0) ? -1 : 1;
87
88 int y = scaletop + _track * sectorsize;
89 wxPoint points[] = {
90 {w2 + factor * TICK, y - 1 },
91 {w2 + factor * TICK, y + sectorsize - 1},
92 {w2 + factor * TICK * 2, y + sectorsize / 2}
93 };
94 dc.DrawPolygon(3, points);
95 }
96
97 for (int track = 0; track <= TRACKS; track++)
98 {
99 int y = scaletop + track * sectorsize;
100 dc.SetBrush(AXIS_BRUSH);

Callers

nothing calls this directly

Calls 5

ClearMethod · 0.45
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected