about summary refs log tree commit diff stats
path: root/src/paintings_pane.cpp
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2025-03-08 09:33:06 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2025-03-08 09:33:06 -0500
commit5fe5bec92e86a4a94cddefec51fabc22212b7364 (patch)
treef9190bf341494510be2c3b9b75e907208025fcbb /src/paintings_pane.cpp
parentc96b3e0e27d3086113dffe1eab0f63f906a5f58c (diff)
downloadlingo-ap-tracker-5fe5bec92e86a4a94cddefec51fabc22212b7364.tar.gz
lingo-ap-tracker-5fe5bec92e86a4a94cddefec51fabc22212b7364.tar.bz2
lingo-ap-tracker-5fe5bec92e86a4a94cddefec51fabc22212b7364.zip
Added button to reveal paintings
Diffstat (limited to 'src/paintings_pane.cpp')
-rw-r--r--src/paintings_pane.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/paintings_pane.cpp b/src/paintings_pane.cpp index 352533f..dc6f050 100644 --- a/src/paintings_pane.cpp +++ b/src/paintings_pane.cpp
@@ -1,11 +1,11 @@
1#include "paintings_pane.h" 1#include "paintings_pane.h"
2 2
3#include <map>
4#include <set>
5
6#include <fmt/core.h> 3#include <fmt/core.h>
7#include <wx/dataview.h> 4#include <wx/dataview.h>
8 5
6#include <map>
7#include <set>
8
9#include "ap_state.h" 9#include "ap_state.h"
10#include "game_data.h" 10#include "game_data.h"
11#include "tracker_state.h" 11#include "tracker_state.h"
@@ -21,25 +21,34 @@ std::string GetPaintingDisplayName(const std::string& id) {
21 21
22} // namespace 22} // namespace
23 23
24PaintingsPane::PaintingsPane(wxWindow* parent) 24PaintingsPane::PaintingsPane(wxWindow* parent) : wxPanel(parent, wxID_ANY) {
25 : wxPanel(parent, wxID_ANY) { 25 wxStaticText* label = new wxStaticText(
26 wxStaticText* label = new wxStaticText(this, wxID_ANY, "Shuffled paintings grouped by destination:"); 26 this, wxID_ANY, "Shuffled paintings grouped by destination:");
27 tree_ctrl_ = new wxDataViewTreeCtrl(this, wxID_ANY); 27 tree_ctrl_ = new wxDataViewTreeCtrl(this, wxID_ANY);
28 28
29 reveal_btn_ = new wxButton(this, wxID_ANY, "Reveal shuffled paintings");
30 reveal_btn_->Disable();
31
29 wxBoxSizer* top_sizer = new wxBoxSizer(wxVERTICAL); 32 wxBoxSizer* top_sizer = new wxBoxSizer(wxVERTICAL);
30 top_sizer->Add(label, wxSizerFlags().Border()); 33 top_sizer->Add(label, wxSizerFlags().Border());
31 top_sizer->Add(tree_ctrl_, wxSizerFlags().Expand().Proportion(1)); 34 top_sizer->Add(tree_ctrl_, wxSizerFlags().Expand().Proportion(1));
35 top_sizer->Add(reveal_btn_, wxSizerFlags().Border().Expand());
32 36
33 SetSizerAndFit(top_sizer); 37 SetSizerAndFit(top_sizer);
38
39 reveal_btn_->Bind(wxEVT_BUTTON, &PaintingsPane::OnClickRevealPaintings, this);
34} 40}
35 41
36void PaintingsPane::UpdateIndicators() { 42void PaintingsPane::UpdateIndicators() {
37 tree_ctrl_->DeleteAllItems(); 43 tree_ctrl_->DeleteAllItems();
38 44
39 if (!AP_IsPaintingShuffle()) { 45 if (!AP_IsPaintingShuffle()) {
46 reveal_btn_->Disable();
40 return; 47 return;
41 } 48 }
42 49
50 reveal_btn_->Enable();
51
43 std::map<std::string, std::set<std::string>> grouped_paintings; 52 std::map<std::string, std::set<std::string>> grouped_paintings;
44 53
45 for (const auto& [from, to] : AP_GetPaintingMapping()) { 54 for (const auto& [from, to] : AP_GetPaintingMapping()) {
@@ -59,3 +68,15 @@ void PaintingsPane::UpdateIndicators() {
59 } 68 }
60 } 69 }
61} 70}
71
72void PaintingsPane::OnClickRevealPaintings(wxCommandEvent& event) {
73 if (wxMessageBox("Clicking yes will reveal the mapping between all shuffled "
74 "paintings. This is usually considered a spoiler, and is "
75 "likely not allowed during competitions. This action is not "
76 "reversible. Are you sure you want to proceed?",
77 "Warning", wxYES_NO | wxICON_WARNING) == wxNO) {
78 return;
79 }
80
81 AP_RevealPaintings();
82}