about summary refs log tree commit diff stats
path: root/src/tracker_frame.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tracker_frame.cpp')
-rw-r--r--src/tracker_frame.cpp54
1 files changed, 4 insertions, 50 deletions
diff --git a/src/tracker_frame.cpp b/src/tracker_frame.cpp index 84017a3..c0b070b 100644 --- a/src/tracker_frame.cpp +++ b/src/tracker_frame.cpp
@@ -51,7 +51,6 @@ enum TrackerFrameIds {
51 ID_SETTINGS = 3, 51 ID_SETTINGS = 3,
52 ID_ZOOM_IN = 4, 52 ID_ZOOM_IN = 4,
53 ID_ZOOM_OUT = 5, 53 ID_ZOOM_OUT = 5,
54 ID_OPEN_SAVE_FILE = 6,
55 ID_IPC_CONNECT = 7, 54 ID_IPC_CONNECT = 7,
56 ID_LOG_DIALOG = 8, 55 ID_LOG_DIALOG = 8,
57}; 56};
@@ -77,7 +76,6 @@ TrackerFrame::TrackerFrame()
77 wxMenu *menuFile = new wxMenu(); 76 wxMenu *menuFile = new wxMenu();
78 menuFile->Append(ID_AP_CONNECT, "&Connect to Archipelago"); 77 menuFile->Append(ID_AP_CONNECT, "&Connect to Archipelago");
79 menuFile->Append(ID_IPC_CONNECT, "&Connect to Lingo"); 78 menuFile->Append(ID_IPC_CONNECT, "&Connect to Lingo");
80 menuFile->Append(ID_OPEN_SAVE_FILE, "&Open Save Data\tCtrl-O");
81 menuFile->Append(ID_SETTINGS, "&Settings"); 79 menuFile->Append(ID_SETTINGS, "&Settings");
82 menuFile->Append(wxID_EXIT); 80 menuFile->Append(wxID_EXIT);
83 81
@@ -114,7 +112,6 @@ TrackerFrame::TrackerFrame()
114 Bind(wxEVT_MENU, &TrackerFrame::OnZoomOut, this, ID_ZOOM_OUT); 112 Bind(wxEVT_MENU, &TrackerFrame::OnZoomOut, this, ID_ZOOM_OUT);
115 Bind(wxEVT_MENU, &TrackerFrame::OnOpenLogWindow, this, ID_LOG_DIALOG); 113 Bind(wxEVT_MENU, &TrackerFrame::OnOpenLogWindow, this, ID_LOG_DIALOG);
116 Bind(wxEVT_NOTEBOOK_PAGE_CHANGED, &TrackerFrame::OnChangePage, this); 114 Bind(wxEVT_NOTEBOOK_PAGE_CHANGED, &TrackerFrame::OnChangePage, this);
117 Bind(wxEVT_MENU, &TrackerFrame::OnOpenFile, this, ID_OPEN_SAVE_FILE);
118 Bind(wxEVT_SPLITTER_SASH_POS_CHANGED, &TrackerFrame::OnSashPositionChanged, 115 Bind(wxEVT_SPLITTER_SASH_POS_CHANGED, &TrackerFrame::OnSashPositionChanged,
119 this); 116 this);
120 Bind(STATE_RESET, &TrackerFrame::OnStateReset, this); 117 Bind(STATE_RESET, &TrackerFrame::OnStateReset, this);
@@ -252,7 +249,7 @@ void TrackerFrame::OnSettings(wxCommandEvent &event) {
252 GetTrackerConfig().should_check_for_updates = 249 GetTrackerConfig().should_check_for_updates =
253 dlg.GetShouldCheckForUpdates(); 250 dlg.GetShouldCheckForUpdates();
254 GetTrackerConfig().hybrid_areas = dlg.GetHybridAreas(); 251 GetTrackerConfig().hybrid_areas = dlg.GetHybridAreas();
255 GetTrackerConfig().show_hunt_panels = dlg.GetShowHuntPanels(); 252 GetTrackerConfig().visible_panels = dlg.GetVisiblePanels();
256 GetTrackerConfig().track_position = dlg.GetTrackPosition(); 253 GetTrackerConfig().track_position = dlg.GetTrackPosition();
257 GetTrackerConfig().Save(); 254 GetTrackerConfig().Save();
258 255
@@ -303,28 +300,6 @@ void TrackerFrame::OnChangePage(wxBookCtrlEvent &event) {
303 zoom_out_menu_item_->Enable(event.GetSelection() == 1); 300 zoom_out_menu_item_->Enable(event.GetSelection() == 1);
304} 301}
305 302
306void TrackerFrame::OnOpenFile(wxCommandEvent &event) {
307 wxFileDialog open_file_dialog(
308 this, "Open Lingo Save File",
309 fmt::format("{}\\Godot\\app_userdata\\Lingo\\level1_stable",
310 wxStandardPaths::Get().GetUserConfigDir().ToStdString()),
311 AP_GetSaveName(), "Lingo save file (*.save)|*.save",
312 wxFD_OPEN | wxFD_FILE_MUST_EXIST);
313 if (open_file_dialog.ShowModal() == wxID_CANCEL) {
314 return;
315 }
316
317 std::string savedata_path = open_file_dialog.GetPath().ToStdString();
318
319 if (panels_panel_ == nullptr) {
320 panels_panel_ = new TrackerPanel(notebook_);
321 notebook_->AddPage(panels_panel_, "Panels");
322 }
323
324 notebook_->SetSelection(notebook_->FindPage(panels_panel_));
325 panels_panel_->SetSavedataPath(savedata_path);
326}
327
328void TrackerFrame::OnSashPositionChanged(wxSplitterEvent& event) { 303void TrackerFrame::OnSashPositionChanged(wxSplitterEvent& event) {
329 notebook_->Refresh(); 304 notebook_->Refresh();
330} 305}
@@ -336,36 +311,20 @@ void TrackerFrame::OnStateReset(wxCommandEvent &event) {
336 options_pane_->OnConnect(); 311 options_pane_->OnConnect();
337 paintings_pane_->ResetIndicators(); 312 paintings_pane_->ResetIndicators();
338 subway_map_->OnConnect(); 313 subway_map_->OnConnect();
339 if (panels_panel_ != nullptr) {
340 notebook_->DeletePage(notebook_->FindPage(panels_panel_));
341 panels_panel_ = nullptr;
342 }
343 Refresh(); 314 Refresh();
344} 315}
345 316
346void TrackerFrame::OnStateChanged(StateChangedEvent &event) { 317void TrackerFrame::OnStateChanged(StateChangedEvent &event) {
347 const StateUpdate &state = event.GetState(); 318 const StateUpdate &state = event.GetState();
348 319
349 if (state.open_panels_tab) {
350 if (panels_panel_ == nullptr) {
351 panels_panel_ = new TrackerPanel(notebook_);
352 panels_panel_->SetPanelsMode();
353 notebook_->AddPage(panels_panel_, "Panels");
354 }
355 panels_panel_->UpdateIndicators(/*reset=*/false);
356 if (notebook_->GetSelection() == 2) {
357 Refresh();
358 }
359
360 return;
361 }
362
363 bool hunt_panels = false; 320 bool hunt_panels = false;
364 if (GetTrackerConfig().show_hunt_panels) { 321 if (GetTrackerConfig().visible_panels == TrackerConfig::kHUNT_PANELS) {
365 hunt_panels = std::any_of( 322 hunt_panels = std::any_of(
366 state.panels.begin(), state.panels.end(), [](int solve_index) { 323 state.panels.begin(), state.panels.end(), [](int solve_index) {
367 return GD_GetPanel(GD_GetPanelBySolveIndex(solve_index)).hunt; 324 return GD_GetPanel(GD_GetPanelBySolveIndex(solve_index)).hunt;
368 }); 325 });
326 } else if (GetTrackerConfig().visible_panels == TrackerConfig::kALL_PANELS) {
327 hunt_panels = true;
369 } 328 }
370 329
371 if (!state.items.empty() || !state.paintings.empty() || 330 if (!state.items.empty() || !state.paintings.empty() ||
@@ -375,15 +334,10 @@ void TrackerFrame::OnStateChanged(StateChangedEvent &event) {
375 // panels later, we can get rid of this. 334 // panels later, we can get rid of this.
376 tracker_panel_->UpdateIndicators(/*reset=*/state.changed_settings); 335 tracker_panel_->UpdateIndicators(/*reset=*/state.changed_settings);
377 subway_map_->UpdateIndicators(); 336 subway_map_->UpdateIndicators();
378 if (panels_panel_ != nullptr) {
379 panels_panel_->UpdateIndicators(/*reset=*/false);
380 }
381 Refresh(); 337 Refresh();
382 } else if (state.player_position && GetTrackerConfig().track_position) { 338 } else if (state.player_position && GetTrackerConfig().track_position) {
383 if (notebook_->GetSelection() == 0) { 339 if (notebook_->GetSelection() == 0) {
384 tracker_panel_->Refresh(); 340 tracker_panel_->Refresh();
385 } else if (notebook_->GetSelection() == 2) {
386 panels_panel_->Refresh();
387 } 341 }
388 } 342 }
389 343