#include "paintings_pane.h" #include #include #include #include #include "ap_state.h" #include "game_data.h" #include "tracker_state.h" namespace { std::string GetPaintingDisplayName(const std::string& id) { const PaintingExit& painting = GD_GetPaintingExit(GD_GetPaintingByName(id)); const MapArea& map_area = GD_GetMapArea(painting.map_area); return fmt::format("{} - {}", map_area.name, painting.display_name); } } // namespace PaintingsPane::PaintingsPane(wxWindow* parent) : wxPanel(parent, wxID_ANY) { wxStaticText* label = new wxStaticText(this, wxID_ANY, "Shuffled paintings grouped by destination:"); tree_ctrl_ = new wxDataViewTreeCtrl(this, wxID_ANY); wxBoxSizer* top_sizer = new wxBoxSizer(wxVERTICAL); top_sizer->Add(label, wxSizerFlags().Border()); top_sizer->Add(tree_ctrl_, wxSizerFlags().Expand().Proportion(1)); SetSizerAndFit(top_sizer); } void PaintingsPane::UpdateIndicators() { tree_ctrl_->DeleteAllItems(); if (!AP_IsPaintingShuffle()) { return; } std::map> grouped_paintings; for (const auto& [from, to] : AP_GetPaintingMapping()) { if (IsPaintingReachable(GD_GetPaintingByName(from)) && AP_IsPaintingChecked(from)) { grouped_paintings[GetPaintingDisplayName(to)].insert( GetPaintingDisplayName(from)); } } for (const auto& [to, froms] : grouped_paintings) { wxDataViewItem tree_branch = tree_ctrl_->AppendContainer(wxDataViewItem(0), to); for (const std::string& from : froms) { tree_ctrl_->AppendItem(tree_branch, from); } } }