about summary refs log tree commit diff stats
path: root/src/tracker_panel.cpp
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2025-03-10 12:45:14 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2025-03-10 12:45:14 -0400
commit79424e86dd7aa28c1b25868d86fa8ebffc801593 (patch)
treeebbc23fb998f14d69e638ce8b973b5a7da0b46c6 /src/tracker_panel.cpp
parentd3457700075fab2dac25bcff2775b7ae5a436a28 (diff)
downloadlingo-ap-tracker-79424e86dd7aa28c1b25868d86fa8ebffc801593.tar.gz
lingo-ap-tracker-79424e86dd7aa28c1b25868d86fa8ebffc801593.tar.bz2
lingo-ap-tracker-79424e86dd7aa28c1b25868d86fa8ebffc801593.zip
Optimized AreaPopup indicators
The list of indicators and the size of the window are calculated only when necessary (new connection, DPI changed, or hunt panel settings changed) and otherwise all we do is redraw the image.
Diffstat (limited to 'src/tracker_panel.cpp')
-rw-r--r--src/tracker_panel.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/tracker_panel.cpp b/src/tracker_panel.cpp index b4e6697..64e6ab3 100644 --- a/src/tracker_panel.cpp +++ b/src/tracker_panel.cpp
@@ -50,13 +50,19 @@ TrackerPanel::TrackerPanel(wxWindow *parent) : wxPanel(parent, wxID_ANY) {
50 Bind(wxEVT_MOTION, &TrackerPanel::OnMouseMove, this); 50 Bind(wxEVT_MOTION, &TrackerPanel::OnMouseMove, this);
51} 51}
52 52
53void TrackerPanel::UpdateIndicators() { 53void TrackerPanel::UpdateIndicators(bool reset) {
54 if (panels_mode_ && !savedata_path_) { 54 if (panels_mode_ && !savedata_path_) {
55 solved_panels_ = IPC_GetSolvedPanels(); 55 solved_panels_ = IPC_GetSolvedPanels();
56 } 56 }
57 57
58 for (AreaIndicator &area : areas_) { 58 if (reset) {
59 area.popup->UpdateIndicators(); 59 for (AreaIndicator &area : areas_) {
60 area.popup->ResetIndicators();
61 }
62 } else {
63 for (AreaIndicator &area : areas_) {
64 area.popup->UpdateIndicators();
65 }
60 } 66 }
61 67
62 Redraw(); 68 Redraw();
@@ -74,6 +80,7 @@ void TrackerPanel::SetSavedataPath(std::string savedata_path) {
74 savedata_path_ = savedata_path; 80 savedata_path_ = savedata_path;
75 panels_mode_ = true; 81 panels_mode_ = true;
76 82
83 UpdateIndicators(/*reset=*/true);
77 RefreshSavedata(); 84 RefreshSavedata();
78} 85}
79 86
@@ -90,7 +97,7 @@ void TrackerPanel::RefreshSavedata() {
90 } 97 }
91 } 98 }
92 99
93 UpdateIndicators(); 100 UpdateIndicators(/*reset=*/false);
94 Refresh(); 101 Refresh();
95} 102}
96 103