diff options
Diffstat (limited to 'src/report_popup.cpp')
-rw-r--r-- | src/report_popup.cpp | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/report_popup.cpp b/src/report_popup.cpp index 674eea0..7ceef0d 100644 --- a/src/report_popup.cpp +++ b/src/report_popup.cpp | |||
@@ -28,21 +28,20 @@ ReportPopup::ReportPopup(wxWindow* parent) | |||
28 | void ReportPopup::SetDoorId(int door_id) { | 28 | void ReportPopup::SetDoorId(int door_id) { |
29 | door_id_ = door_id; | 29 | door_id_ = door_id; |
30 | 30 | ||
31 | UpdateIndicators(); | 31 | ResetIndicators(); |
32 | } | 32 | } |
33 | 33 | ||
34 | void ReportPopup::Reset() { | 34 | void ReportPopup::Reset() { |
35 | door_id_ = -1; | 35 | door_id_ = -1; |
36 | } | 36 | } |
37 | 37 | ||
38 | void ReportPopup::UpdateIndicators() { | 38 | void ReportPopup::ResetIndicators() { |
39 | wxMemoryDC mem_dc; | ||
40 | |||
41 | wxFont the_font = GetFont().Scale(GetDPIScaleFactor()); | 39 | wxFont the_font = GetFont().Scale(GetDPIScaleFactor()); |
42 | mem_dc.SetFont(the_font); | ||
43 | |||
44 | const std::map<std::string, bool>& report = GetDoorRequirements(door_id_); | 40 | const std::map<std::string, bool>& report = GetDoorRequirements(door_id_); |
45 | 41 | ||
42 | wxMemoryDC mem_dc; | ||
43 | mem_dc.SetFont(the_font); | ||
44 | |||
46 | int acc_height = FromDIP(10); | 45 | int acc_height = FromDIP(10); |
47 | int col_width = 0; | 46 | int col_width = 0; |
48 | 47 | ||
@@ -58,16 +57,26 @@ void ReportPopup::UpdateIndicators() { | |||
58 | } | 57 | } |
59 | 58 | ||
60 | int item_width = col_width + FromDIP(10 + 32); | 59 | int item_width = col_width + FromDIP(10 + 32); |
61 | int full_width = item_width + FromDIP(20); | 60 | full_width_ = item_width + FromDIP(20); |
61 | full_height_ = acc_height; | ||
62 | 62 | ||
63 | Fit(); | 63 | Fit(); |
64 | SetVirtualSize(full_width, acc_height); | 64 | SetVirtualSize(full_width_, full_height_); |
65 | 65 | ||
66 | rendered_ = wxBitmap(full_width, acc_height); | 66 | UpdateIndicators(); |
67 | } | ||
68 | |||
69 | void ReportPopup::UpdateIndicators() { | ||
70 | wxFont the_font = GetFont().Scale(GetDPIScaleFactor()); | ||
71 | const std::map<std::string, bool>& report = GetDoorRequirements(door_id_); | ||
72 | |||
73 | rendered_ = wxBitmap(full_width_, full_height_); | ||
74 | |||
75 | wxMemoryDC mem_dc; | ||
67 | mem_dc.SelectObject(rendered_); | 76 | mem_dc.SelectObject(rendered_); |
68 | mem_dc.SetPen(*wxTRANSPARENT_PEN); | 77 | mem_dc.SetPen(*wxTRANSPARENT_PEN); |
69 | mem_dc.SetBrush(*wxBLACK_BRUSH); | 78 | mem_dc.SetBrush(*wxBLACK_BRUSH); |
70 | mem_dc.DrawRectangle({0, 0}, {full_width, acc_height}); | 79 | mem_dc.DrawRectangle({0, 0}, {full_width_, full_height_}); |
71 | 80 | ||
72 | mem_dc.SetFont(the_font); | 81 | mem_dc.SetFont(the_font); |
73 | 82 | ||
@@ -101,7 +110,7 @@ void ReportPopup::OnPaint(wxPaintEvent& event) { | |||
101 | 110 | ||
102 | void ReportPopup::OnDPIChanged(wxDPIChangedEvent& event) { | 111 | void ReportPopup::OnDPIChanged(wxDPIChangedEvent& event) { |
103 | LoadIcons(); | 112 | LoadIcons(); |
104 | UpdateIndicators(); | 113 | ResetIndicators(); |
105 | 114 | ||
106 | event.Skip(); | 115 | event.Skip(); |
107 | } | 116 | } |