From dfddd07b8b5cbff7c09103a694aed40bda254a2d Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 13 Mar 2025 12:47:54 -0400 Subject: Obsolete savefile reader + IPC solves Now, panel solve state is all read from the sync fields in datastorage. The "show hunt panels" field in settings is now a radio box, and you can choose to show all panels. --- src/tracker_frame.cpp | 54 ++++----------------------------------------------- 1 file changed, 4 insertions(+), 50 deletions(-) (limited to 'src/tracker_frame.cpp') 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 { ID_SETTINGS = 3, ID_ZOOM_IN = 4, ID_ZOOM_OUT = 5, - ID_OPEN_SAVE_FILE = 6, ID_IPC_CONNECT = 7, ID_LOG_DIALOG = 8, }; @@ -77,7 +76,6 @@ TrackerFrame::TrackerFrame() wxMenu *menuFile = new wxMenu(); menuFile->Append(ID_AP_CONNECT, "&Connect to Archipelago"); menuFile->Append(ID_IPC_CONNECT, "&Connect to Lingo"); - menuFile->Append(ID_OPEN_SAVE_FILE, "&Open Save Data\tCtrl-O"); menuFile->Append(ID_SETTINGS, "&Settings"); menuFile->Append(wxID_EXIT); @@ -114,7 +112,6 @@ TrackerFrame::TrackerFrame() Bind(wxEVT_MENU, &TrackerFrame::OnZoomOut, this, ID_ZOOM_OUT); Bind(wxEVT_MENU, &TrackerFrame::OnOpenLogWindow, this, ID_LOG_DIALOG); Bind(wxEVT_NOTEBOOK_PAGE_CHANGED, &TrackerFrame::OnChangePage, this); - Bind(wxEVT_MENU, &TrackerFrame::OnOpenFile, this, ID_OPEN_SAVE_FILE); Bind(wxEVT_SPLITTER_SASH_POS_CHANGED, &TrackerFrame::OnSashPositionChanged, this); Bind(STATE_RESET, &TrackerFrame::OnStateReset, this); @@ -252,7 +249,7 @@ void TrackerFrame::OnSettings(wxCommandEvent &event) { GetTrackerConfig().should_check_for_updates = dlg.GetShouldCheckForUpdates(); GetTrackerConfig().hybrid_areas = dlg.GetHybridAreas(); - GetTrackerConfig().show_hunt_panels = dlg.GetShowHuntPanels(); + GetTrackerConfig().visible_panels = dlg.GetVisiblePanels(); GetTrackerConfig().track_position = dlg.GetTrackPosition(); GetTrackerConfig().Save(); @@ -303,28 +300,6 @@ void TrackerFrame::OnChangePage(wxBookCtrlEvent &event) { zoom_out_menu_item_->Enable(event.GetSelection() == 1); } -void TrackerFrame::OnOpenFile(wxCommandEvent &event) { - wxFileDialog open_file_dialog( - this, "Open Lingo Save File", - fmt::format("{}\\Godot\\app_userdata\\Lingo\\level1_stable", - wxStandardPaths::Get().GetUserConfigDir().ToStdString()), - AP_GetSaveName(), "Lingo save file (*.save)|*.save", - wxFD_OPEN | wxFD_FILE_MUST_EXIST); - if (open_file_dialog.ShowModal() == wxID_CANCEL) { - return; - } - - std::string savedata_path = open_file_dialog.GetPath().ToStdString(); - - if (panels_panel_ == nullptr) { - panels_panel_ = new TrackerPanel(notebook_); - notebook_->AddPage(panels_panel_, "Panels"); - } - - notebook_->SetSelection(notebook_->FindPage(panels_panel_)); - panels_panel_->SetSavedataPath(savedata_path); -} - void TrackerFrame::OnSashPositionChanged(wxSplitterEvent& event) { notebook_->Refresh(); } @@ -336,36 +311,20 @@ void TrackerFrame::OnStateReset(wxCommandEvent &event) { options_pane_->OnConnect(); paintings_pane_->ResetIndicators(); subway_map_->OnConnect(); - if (panels_panel_ != nullptr) { - notebook_->DeletePage(notebook_->FindPage(panels_panel_)); - panels_panel_ = nullptr; - } Refresh(); } void TrackerFrame::OnStateChanged(StateChangedEvent &event) { const StateUpdate &state = event.GetState(); - if (state.open_panels_tab) { - if (panels_panel_ == nullptr) { - panels_panel_ = new TrackerPanel(notebook_); - panels_panel_->SetPanelsMode(); - notebook_->AddPage(panels_panel_, "Panels"); - } - panels_panel_->UpdateIndicators(/*reset=*/false); - if (notebook_->GetSelection() == 2) { - Refresh(); - } - - return; - } - bool hunt_panels = false; - if (GetTrackerConfig().show_hunt_panels) { + if (GetTrackerConfig().visible_panels == TrackerConfig::kHUNT_PANELS) { hunt_panels = std::any_of( state.panels.begin(), state.panels.end(), [](int solve_index) { return GD_GetPanel(GD_GetPanelBySolveIndex(solve_index)).hunt; }); + } else if (GetTrackerConfig().visible_panels == TrackerConfig::kALL_PANELS) { + hunt_panels = true; } if (!state.items.empty() || !state.paintings.empty() || @@ -375,15 +334,10 @@ void TrackerFrame::OnStateChanged(StateChangedEvent &event) { // panels later, we can get rid of this. tracker_panel_->UpdateIndicators(/*reset=*/state.changed_settings); subway_map_->UpdateIndicators(); - if (panels_panel_ != nullptr) { - panels_panel_->UpdateIndicators(/*reset=*/false); - } Refresh(); } else if (state.player_position && GetTrackerConfig().track_position) { if (notebook_->GetSelection() == 0) { tracker_panel_->Refresh(); - } else if (notebook_->GetSelection() == 2) { - panels_panel_->Refresh(); } } -- cgit 1.4.1