about summary refs log tree commit diff stats
path: root/src/area_popup.h
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/area_popup.h
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/area_popup.h')
-rw-r--r--src/area_popup.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/area_popup.h b/src/area_popup.h index 2401e4e..50e10e8 100644 --- a/src/area_popup.h +++ b/src/area_popup.h
@@ -7,13 +7,32 @@
7#include <wx/wx.h> 7#include <wx/wx.h>
8#endif 8#endif
9 9
10#include <vector>
11
10class AreaPopup : public wxScrolledCanvas { 12class AreaPopup : public wxScrolledCanvas {
11 public: 13 public:
12 AreaPopup(wxWindow* parent, int area_id); 14 AreaPopup(wxWindow* parent, int area_id);
13 15
16 void ResetIndicators();
14 void UpdateIndicators(); 17 void UpdateIndicators();
15 18
16 private: 19 private:
20 enum IndicatorType {
21 kLOCATION,
22 kPAINTING,
23 };
24
25 struct IndicatorInfo {
26 // For locations, the id is an index into the map area's locations list.
27 // For paintings, it is a real painting id.
28 int id;
29 IndicatorType type;
30 int y;
31
32 IndicatorInfo(int id, IndicatorType type, int y)
33 : id(id), type(type), y(y) {}
34 };
35
17 void OnPaint(wxPaintEvent& event); 36 void OnPaint(wxPaintEvent& event);
18 void OnDPIChanged(wxDPIChangedEvent& event); 37 void OnDPIChanged(wxDPIChangedEvent& event);
19 38
@@ -26,6 +45,12 @@ class AreaPopup : public wxScrolledCanvas {
26 const wxBitmap* unchecked_owl_; 45 const wxBitmap* unchecked_owl_;
27 const wxBitmap* checked_owl_; 46 const wxBitmap* checked_owl_;
28 47
48 int full_width_ = 0;
49 int full_height_ = 0;
50 wxSize header_extent_;
51
52 std::vector<IndicatorInfo> indicators_;
53
29 wxBitmap rendered_; 54 wxBitmap rendered_;
30}; 55};
31 56