diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-03-10 12:45:14 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-03-10 12:45:14 -0400 |
commit | 79424e86dd7aa28c1b25868d86fa8ebffc801593 (patch) | |
tree | ebbc23fb998f14d69e638ce8b973b5a7da0b46c6 /src/tracker_frame.cpp | |
parent | d3457700075fab2dac25bcff2775b7ae5a436a28 (diff) | |
download | lingo-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_frame.cpp')
-rw-r--r-- | src/tracker_frame.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/tracker_frame.cpp b/src/tracker_frame.cpp index 6a4ab2e..fa68582 100644 --- a/src/tracker_frame.cpp +++ b/src/tracker_frame.cpp | |||
@@ -255,8 +255,9 @@ void TrackerFrame::OnSettings(wxCommandEvent &event) { | |||
255 | GetTrackerConfig().track_position = dlg.GetTrackPosition(); | 255 | GetTrackerConfig().track_position = dlg.GetTrackPosition(); |
256 | GetTrackerConfig().Save(); | 256 | GetTrackerConfig().Save(); |
257 | 257 | ||
258 | UpdateIndicators( | 258 | UpdateIndicators(StateUpdate{.cleared_locations = true, |
259 | StateUpdate{.cleared_locations = true, .player_position = true}); | 259 | .player_position = true, |
260 | .changed_settings = true}); | ||
260 | } | 261 | } |
261 | } | 262 | } |
262 | 263 | ||
@@ -328,7 +329,7 @@ void TrackerFrame::OnSashPositionChanged(wxSplitterEvent& event) { | |||
328 | } | 329 | } |
329 | 330 | ||
330 | void TrackerFrame::OnStateReset(wxCommandEvent &event) { | 331 | void TrackerFrame::OnStateReset(wxCommandEvent &event) { |
331 | tracker_panel_->UpdateIndicators(); | 332 | tracker_panel_->UpdateIndicators(/*reset=*/true); |
332 | achievements_pane_->UpdateIndicators(); | 333 | achievements_pane_->UpdateIndicators(); |
333 | items_pane_->ResetIndicators(); | 334 | items_pane_->ResetIndicators(); |
334 | options_pane_->OnConnect(); | 335 | options_pane_->OnConnect(); |
@@ -350,7 +351,7 @@ void TrackerFrame::OnStateChanged(StateChangedEvent &event) { | |||
350 | panels_panel_->SetPanelsMode(); | 351 | panels_panel_->SetPanelsMode(); |
351 | notebook_->AddPage(panels_panel_, "Panels"); | 352 | notebook_->AddPage(panels_panel_, "Panels"); |
352 | } | 353 | } |
353 | panels_panel_->UpdateIndicators(); | 354 | panels_panel_->UpdateIndicators(/*reset=*/false); |
354 | if (notebook_->GetSelection() == 2) { | 355 | if (notebook_->GetSelection() == 2) { |
355 | Refresh(); | 356 | Refresh(); |
356 | } | 357 | } |
@@ -361,10 +362,13 @@ void TrackerFrame::OnStateChanged(StateChangedEvent &event) { | |||
361 | if (!state.items.empty() || !state.paintings.empty() || | 362 | if (!state.items.empty() || !state.paintings.empty() || |
362 | state.cleared_locations || | 363 | state.cleared_locations || |
363 | (state.hunt_panels && GetTrackerConfig().show_hunt_panels)) { | 364 | (state.hunt_panels && GetTrackerConfig().show_hunt_panels)) { |
364 | tracker_panel_->UpdateIndicators(); | 365 | // TODO: The only real reason to reset tracker_panel during an active |
366 | // connection is if the hunt panels setting changes. If we remove hunt | ||
367 | // panels later, we can get rid of this. | ||
368 | tracker_panel_->UpdateIndicators(/*reset=*/state.changed_settings); | ||
365 | subway_map_->UpdateIndicators(); | 369 | subway_map_->UpdateIndicators(); |
366 | if (panels_panel_ != nullptr) { | 370 | if (panels_panel_ != nullptr) { |
367 | panels_panel_->UpdateIndicators(); | 371 | panels_panel_->UpdateIndicators(/*reset=*/false); |
368 | } | 372 | } |
369 | Refresh(); | 373 | Refresh(); |
370 | } else if (state.player_position && GetTrackerConfig().track_position) { | 374 | } else if (state.player_position && GetTrackerConfig().track_position) { |