diff options
Diffstat (limited to 'src/tracker_frame.cpp')
-rw-r--r-- | src/tracker_frame.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/tracker_frame.cpp b/src/tracker_frame.cpp index 80fd137..b9282f5 100644 --- a/src/tracker_frame.cpp +++ b/src/tracker_frame.cpp | |||
@@ -2,9 +2,12 @@ | |||
2 | 2 | ||
3 | #include <wx/aboutdlg.h> | 3 | #include <wx/aboutdlg.h> |
4 | #include <wx/choicebk.h> | 4 | #include <wx/choicebk.h> |
5 | #include <wx/filedlg.h> | ||
5 | #include <wx/notebook.h> | 6 | #include <wx/notebook.h> |
7 | #include <wx/stdpaths.h> | ||
6 | #include <wx/webrequest.h> | 8 | #include <wx/webrequest.h> |
7 | 9 | ||
10 | #include <fmt/core.h> | ||
8 | #include <nlohmann/json.hpp> | 11 | #include <nlohmann/json.hpp> |
9 | #include <sstream> | 12 | #include <sstream> |
10 | 13 | ||
@@ -23,6 +26,7 @@ enum TrackerFrameIds { | |||
23 | ID_SETTINGS = 3, | 26 | ID_SETTINGS = 3, |
24 | ID_ZOOM_IN = 4, | 27 | ID_ZOOM_IN = 4, |
25 | ID_ZOOM_OUT = 5, | 28 | ID_ZOOM_OUT = 5, |
29 | ID_OPEN_SAVE_FILE = 6, | ||
26 | }; | 30 | }; |
27 | 31 | ||
28 | wxDEFINE_EVENT(STATE_RESET, wxCommandEvent); | 32 | wxDEFINE_EVENT(STATE_RESET, wxCommandEvent); |
@@ -38,6 +42,7 @@ TrackerFrame::TrackerFrame() | |||
38 | 42 | ||
39 | wxMenu *menuFile = new wxMenu(); | 43 | wxMenu *menuFile = new wxMenu(); |
40 | menuFile->Append(ID_CONNECT, "&Connect"); | 44 | menuFile->Append(ID_CONNECT, "&Connect"); |
45 | menuFile->Append(ID_OPEN_SAVE_FILE, "&Open Save Data\tCtrl-O"); | ||
41 | menuFile->Append(ID_SETTINGS, "&Settings"); | 46 | menuFile->Append(ID_SETTINGS, "&Settings"); |
42 | menuFile->Append(wxID_EXIT); | 47 | menuFile->Append(wxID_EXIT); |
43 | 48 | ||
@@ -71,6 +76,7 @@ TrackerFrame::TrackerFrame() | |||
71 | Bind(wxEVT_MENU, &TrackerFrame::OnZoomIn, this, ID_ZOOM_IN); | 76 | Bind(wxEVT_MENU, &TrackerFrame::OnZoomIn, this, ID_ZOOM_IN); |
72 | Bind(wxEVT_MENU, &TrackerFrame::OnZoomOut, this, ID_ZOOM_OUT); | 77 | Bind(wxEVT_MENU, &TrackerFrame::OnZoomOut, this, ID_ZOOM_OUT); |
73 | Bind(wxEVT_NOTEBOOK_PAGE_CHANGED, &TrackerFrame::OnChangePage, this); | 78 | Bind(wxEVT_NOTEBOOK_PAGE_CHANGED, &TrackerFrame::OnChangePage, this); |
79 | Bind(wxEVT_MENU, &TrackerFrame::OnOpenFile, this, ID_OPEN_SAVE_FILE); | ||
74 | Bind(STATE_RESET, &TrackerFrame::OnStateReset, this); | 80 | Bind(STATE_RESET, &TrackerFrame::OnStateReset, this); |
75 | Bind(STATE_CHANGED, &TrackerFrame::OnStateChanged, this); | 81 | Bind(STATE_CHANGED, &TrackerFrame::OnStateChanged, this); |
76 | Bind(STATUS_CHANGED, &TrackerFrame::OnStatusChanged, this); | 82 | Bind(STATUS_CHANGED, &TrackerFrame::OnStatusChanged, this); |
@@ -131,6 +137,7 @@ void TrackerFrame::OnAbout(wxCommandEvent &event) { | |||
131 | about_info.SetName("Lingo Archipelago Tracker"); | 137 | about_info.SetName("Lingo Archipelago Tracker"); |
132 | about_info.SetVersion(kTrackerVersion.ToString()); | 138 | about_info.SetVersion(kTrackerVersion.ToString()); |
133 | about_info.AddDeveloper("hatkirby"); | 139 | about_info.AddDeveloper("hatkirby"); |
140 | about_info.AddDeveloper("art0007i"); | ||
134 | about_info.AddArtist("Brenton Wildes"); | 141 | about_info.AddArtist("Brenton Wildes"); |
135 | about_info.AddArtist("kinrah"); | 142 | about_info.AddArtist("kinrah"); |
136 | 143 | ||
@@ -204,10 +211,36 @@ void TrackerFrame::OnChangePage(wxBookCtrlEvent &event) { | |||
204 | zoom_out_menu_item_->Enable(event.GetSelection() == 1); | 211 | zoom_out_menu_item_->Enable(event.GetSelection() == 1); |
205 | } | 212 | } |
206 | 213 | ||
214 | void TrackerFrame::OnOpenFile(wxCommandEvent& event) { | ||
215 | wxFileDialog open_file_dialog( | ||
216 | this, "Open Lingo Save File", | ||
217 | fmt::format("{}\\Godot\\app_userdata\\Lingo\\level1_stable", | ||
218 | wxStandardPaths::Get().GetUserConfigDir().ToStdString()), | ||
219 | AP_GetSaveName(), "Lingo save file (*.save)|*.save", | ||
220 | wxFD_OPEN | wxFD_FILE_MUST_EXIST); | ||
221 | if (open_file_dialog.ShowModal() == wxID_CANCEL) { | ||
222 | return; | ||
223 | } | ||
224 | |||
225 | std::string savedata_path = open_file_dialog.GetPath().ToStdString(); | ||
226 | |||
227 | if (panels_panel_ == nullptr) { | ||
228 | panels_panel_ = new TrackerPanel(notebook_); | ||
229 | notebook_->AddPage(panels_panel_, "Panels"); | ||
230 | } | ||
231 | |||
232 | notebook_->SetSelection(notebook_->FindPage(panels_panel_)); | ||
233 | panels_panel_->SetSavedataPath(savedata_path); | ||
234 | } | ||
235 | |||
207 | void TrackerFrame::OnStateReset(wxCommandEvent& event) { | 236 | void TrackerFrame::OnStateReset(wxCommandEvent& event) { |
208 | tracker_panel_->UpdateIndicators(); | 237 | tracker_panel_->UpdateIndicators(); |
209 | achievements_pane_->UpdateIndicators(); | 238 | achievements_pane_->UpdateIndicators(); |
210 | subway_map_->OnConnect(); | 239 | subway_map_->OnConnect(); |
240 | if (panels_panel_ != nullptr) { | ||
241 | notebook_->DeletePage(notebook_->FindPage(panels_panel_)); | ||
242 | panels_panel_ = nullptr; | ||
243 | } | ||
211 | Refresh(); | 244 | Refresh(); |
212 | } | 245 | } |
213 | 246 | ||
@@ -215,6 +248,9 @@ void TrackerFrame::OnStateChanged(wxCommandEvent &event) { | |||
215 | tracker_panel_->UpdateIndicators(); | 248 | tracker_panel_->UpdateIndicators(); |
216 | achievements_pane_->UpdateIndicators(); | 249 | achievements_pane_->UpdateIndicators(); |
217 | subway_map_->UpdateIndicators(); | 250 | subway_map_->UpdateIndicators(); |
251 | if (panels_panel_ != nullptr) { | ||
252 | panels_panel_->UpdateIndicators(); | ||
253 | } | ||
218 | Refresh(); | 254 | Refresh(); |
219 | } | 255 | } |
220 | 256 | ||