From fce4bdd510e7898aa75149a1fbbbc4ce35cfc98c Mon Sep 17 00:00:00 2001 From: Squall-Leonhart Date: Mon, 16 Feb 2026 17:07:34 +1100 Subject: [PATCH 1/2] initial-working --- src/gui/wxgui/GameProfileWindow.cpp | 7 +-- src/gui/wxgui/GraphicPacksWindow2.cpp | 63 ++++++++++++++++----------- src/gui/wxgui/GraphicPacksWindow2.h | 18 ++++---- src/gui/wxgui/LoggingWindow.cpp | 4 +- 4 files changed, 54 insertions(+), 38 deletions(-) diff --git a/src/gui/wxgui/GameProfileWindow.cpp b/src/gui/wxgui/GameProfileWindow.cpp index 37fac6bc..fe4534e7 100644 --- a/src/gui/wxgui/GameProfileWindow.cpp +++ b/src/gui/wxgui/GameProfileWindow.cpp @@ -16,9 +16,10 @@ #endif GameProfileWindow::GameProfileWindow(wxWindow* parent, uint64_t title_id) - : wxFrame(parent, wxID_ANY, _("Edit game profile"), wxDefaultPosition, wxSize{ 390, 350 }, wxCLOSE_BOX | wxCLIP_CHILDREN | wxCAPTION | wxRESIZE_BORDER | wxTAB_TRAVERSAL | wxSYSTEM_MENU), m_title_id(title_id) + : wxFrame(parent, wxID_ANY, _("Edit game profile"), wxDefaultPosition, wxDefaultSize, wxCLOSE_BOX | wxCLIP_CHILDREN | wxCAPTION | wxRESIZE_BORDER | wxTAB_TRAVERSAL | wxSYSTEM_MENU), m_title_id(title_id) { SetIcon(wxICON(X_GAME_PROFILE)); + SetSize(FromDIP(wxSize(390, 350))); m_game_profile.Reset(); m_game_profile.Load(title_id); @@ -71,7 +72,7 @@ GameProfileWindow::GameProfileWindow(wxWindow* parent, uint64_t title_id) wxString quantum_values[] = { "20000", "45000", "60000", "80000" ,"100000" }; m_thread_quantum = new wxChoice(box, wxID_ANY, wxDefaultPosition, wxDefaultSize, std::size(quantum_values), quantum_values); - m_thread_quantum->SetMinSize(wxSize(85, -1)); + m_thread_quantum->SetMinSize(FromDIP(wxSize(85, -1))); m_thread_quantum->SetToolTip(_("EXPERT OPTION\nSet the maximum thread slice runtime (in virtual cycles)")); quantum_sizer->Add(m_thread_quantum, 0, wxALL, 5); @@ -196,7 +197,7 @@ GameProfileWindow::GameProfileWindow(wxWindow* parent, uint64_t title_id) profile_sizer->Add(new wxStaticText(panel, wxID_ANY, formatWxString(_("Controller {}"), i + 1)), 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); m_controller_profile[i] = new wxComboBox(panel, wxID_ANY,"", wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_DROPDOWN| wxCB_READONLY); - m_controller_profile[i]->SetMinSize(wxSize(250, -1)); + m_controller_profile[i]->SetMinSize(FromDIP(wxSize(250, -1))); m_controller_profile[i]->Bind(wxEVT_COMBOBOX_DROPDOWN, &GameProfileWindow::OnControllerProfileDropdown, this); m_controller_profile[i]->SetToolTip(_("Forces a given controller profile")); profile_sizer->Add(m_controller_profile[i], 0, wxALL, 5); diff --git a/src/gui/wxgui/GraphicPacksWindow2.cpp b/src/gui/wxgui/GraphicPacksWindow2.cpp index 90f5e17c..ce46448a 100644 --- a/src/gui/wxgui/GraphicPacksWindow2.cpp +++ b/src/gui/wxgui/GraphicPacksWindow2.cpp @@ -194,16 +194,17 @@ void GraphicPacksWindow2::RefreshGraphicPacks() } GraphicPacksWindow2::GraphicPacksWindow2(wxWindow* parent, uint64_t title_id_filter) - : wxDialog(parent, wxID_ANY, _("Graphic packs"), wxDefaultPosition, wxSize(1000,670), wxCLOSE_BOX | wxCLIP_CHILDREN | wxCAPTION | wxRESIZE_BORDER), + : wxDialog(parent, wxID_ANY, _("Graphic packs"), wxDefaultPosition, wxDefaultSize, wxCLOSE_BOX | wxCLIP_CHILDREN | wxCAPTION | wxRESIZE_BORDER), m_installed_games(CafeTitleList::GetAllTitleIds()) { + SetIcon(wxICON(X_BOX)); + SetSize(FromDIP(wxSize(1000, 670))); + SetMinSize(FromDIP(wxSize(500, 400))); + if (title_id_filter != 0) m_filter = fmt::format("{:x}", title_id_filter); m_filter_installed_games = !m_installed_games.empty(); - - SetIcon(wxICON(X_BOX)); - SetMinSize(wxSize(500, 400)); auto main_sizer = new wxBoxSizer(wxVERTICAL); m_splitter_window = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D); @@ -248,6 +249,7 @@ GraphicPacksWindow2::GraphicPacksWindow2(wxWindow* parent, uint64_t title_id_fil // right side m_right_panel = new wxPanel(m_splitter_window, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxNO_BORDER | wxFULL_REPAINT_ON_RESIZE); + m_right_panel->Bind(wxEVT_SIZE, &GraphicPacksWindow2::OnRightPanelResized, this); { auto* sizer = new wxBoxSizer(wxVERTICAL); { @@ -259,7 +261,7 @@ GraphicPacksWindow2::GraphicPacksWindow2(wxWindow* parent, uint64_t title_id_fil auto* box = new wxStaticBox(m_gp_options, wxID_ANY, _("Graphic pack")); auto* box_sizer = new wxStaticBoxSizer(box, wxVERTICAL); - m_graphic_pack_name = new wxStaticText(box, wxID_ANY, wxEmptyString); + m_graphic_pack_name = new wxStaticText(box, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE); box_sizer->Add(m_graphic_pack_name, 1, wxEXPAND | wxALL, 5); inner_sizer->Add(box_sizer, 0, wxEXPAND | wxALL, 5); @@ -269,7 +271,7 @@ GraphicPacksWindow2::GraphicPacksWindow2(wxWindow* parent, uint64_t title_id_fil auto* box = new wxStaticBox(m_gp_options, wxID_ANY, _("Description")); auto* box_sizer = new wxStaticBoxSizer(box, wxVERTICAL); - m_graphic_pack_description = new wxStaticText(box, wxID_ANY, wxEmptyString); + m_graphic_pack_description = new wxStaticText(box, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE); box_sizer->Add(m_graphic_pack_description, 1, wxEXPAND | wxALL, 5); inner_sizer->Add(box_sizer, 0, wxEXPAND | wxALL, 5); @@ -447,29 +449,19 @@ void GraphicPacksWindow2::OnTreeSelectionChanged(wxTreeEvent& event) { m_preset_sizer->Clear(true); m_gp_name = gp->GetName(); - m_graphic_pack_name->SetLabel(wxString::FromUTF8(m_gp_name)); if (gp->GetDescription().empty()) m_gp_description = _("This graphic pack has no description").utf8_string(); else m_gp_description = gp->GetDescription(); - m_graphic_pack_description->SetLabel(wxString::FromUTF8(m_gp_description)); - LoadPresetSelections(gp); m_reload_shaders->Enable(gp->HasShaders()); m_shown_graphic_pack = gp; - m_graphic_pack_name->Wrap(m_graphic_pack_name->GetParent()->GetClientSize().GetWidth() - 20); - m_graphic_pack_name->GetGrandParent()->Layout(); - - m_graphic_pack_description->Wrap(m_graphic_pack_description->GetParent()->GetClientSize().GetWidth() - 20); - m_graphic_pack_description->GetGrandParent()->Layout(); - - m_right_panel->FitInside(); - m_right_panel->Layout(); + UpdateContentLayout(); } return; } @@ -599,6 +591,28 @@ void GraphicPacksWindow2::OnReloadShaders(wxCommandEvent& event) ReloadPack(m_shown_graphic_pack); } +void GraphicPacksWindow2::UpdateContentLayout() +{ + if (!m_shown_graphic_pack) + return; + + const int available_width = m_right_panel->GetClientSize().GetWidth(); + if (available_width <= 0) + return; + + const int wrap_width = available_width - 30; + + m_graphic_pack_name->SetLabel(wxString::FromUTF8(m_gp_name)); + m_graphic_pack_name->Wrap(wrap_width); + + m_graphic_pack_description->SetLabel(wxString::FromUTF8(m_gp_description)); + m_graphic_pack_description->Wrap(wrap_width); + + m_gp_options->Layout(); + m_gp_options->FitInside(); + m_right_panel->Layout(); +} + void GraphicPacksWindow2::OnCheckForUpdates(wxCommandEvent& event) { DownloadGraphicPacksWindow frame(this); @@ -637,6 +651,12 @@ void GraphicPacksWindow2::OnCheckForUpdates(wxCommandEvent& event) } } +void GraphicPacksWindow2::OnRightPanelResized(wxSizeEvent& event) +{ + UpdateContentLayout(); + event.Skip(); +} + void GraphicPacksWindow2::OnSizeChanged(wxSizeEvent& event) { const auto obj = (wxSplitterWindow*)event.GetEventObject(); @@ -645,15 +665,6 @@ void GraphicPacksWindow2::OnSizeChanged(wxSizeEvent& event) const auto width = std::max(obj->GetMinimumPaneSize(), obj->GetParent()->GetClientSize().GetWidth()); obj->SetSashPosition((sint32)(m_ratio * width)); - if (!m_gp_name.empty()) - m_graphic_pack_name->SetLabel(wxString::FromUTF8(m_gp_name)); - - if (!m_gp_description.empty()) - m_graphic_pack_description->SetLabel(wxString::FromUTF8(m_gp_description)); - - m_graphic_pack_name->Wrap(m_graphic_pack_name->GetParent()->GetClientSize().GetWidth() - 10); - m_graphic_pack_description->Wrap(m_graphic_pack_description->GetParent()->GetClientSize().GetWidth() - 10); - event.Skip(); } diff --git a/src/gui/wxgui/GraphicPacksWindow2.h b/src/gui/wxgui/GraphicPacksWindow2.h index 435d1031..e17a81fa 100644 --- a/src/gui/wxgui/GraphicPacksWindow2.h +++ b/src/gui/wxgui/GraphicPacksWindow2.h @@ -16,14 +16,14 @@ class wxChoice; class GraphicPacksWindow2 : public wxDialog { -public: + public: GraphicPacksWindow2(wxWindow* parent, uint64_t title_id_filter); ~GraphicPacksWindow2(); static void RefreshGraphicPacks(); void UpdateTitleRunning(bool running); -private: + private: std::string m_filter; bool m_filter_installed_games; std::vector m_installed_games; @@ -32,17 +32,17 @@ private: void FillGraphicPackList() const; void GetChildren(const wxTreeItemId& id, std::vector& children) const; void ExpandChildren(const std::vector& ids, size_t& counter) const; - - wxSplitterWindow * m_splitter_window; + + wxSplitterWindow* m_splitter_window; wxPanel* m_right_panel; wxScrolled* m_gp_options; - - wxCheckTree * m_graphic_pack_tree; + + wxCheckTree* m_graphic_pack_tree; wxTextCtrl* m_filter_text; wxCheckBox* m_installed_games_only; - wxStaticText* m_graphic_pack_name, *m_graphic_pack_description; + wxStaticText *m_graphic_pack_name, *m_graphic_pack_description; wxBoxSizer* m_preset_sizer; std::vector m_active_preset; wxButton* m_reload_shaders; @@ -59,12 +59,14 @@ private: wxTreeItemId FindTreeItem(const wxTreeItemId& root, const wxString& text) const; void LoadPresetSelections(const GraphicPackPtr& gp); + void UpdateContentLayout(); void OnTreeSelectionChanged(wxTreeEvent& event); void OnTreeChoiceChanged(wxTreeEvent& event); void OnActivePresetChanged(wxCommandEvent& event); void OnReloadShaders(wxCommandEvent& event); void OnCheckForUpdates(wxCommandEvent& event); + void OnRightPanelResized(wxSizeEvent& event); void OnSizeChanged(wxSizeEvent& event); void SashPositionChanged(wxEvent& event); void OnFilterUpdate(wxEvent& event); @@ -75,4 +77,4 @@ private: void ReloadPack(const GraphicPackPtr& graphic_pack) const; void DeleteShadersFromRuntimeCache(const GraphicPackPtr& graphic_pack) const; -}; \ No newline at end of file +}; diff --git a/src/gui/wxgui/LoggingWindow.cpp b/src/gui/wxgui/LoggingWindow.cpp index 6c6ca6c3..1f9c087b 100644 --- a/src/gui/wxgui/LoggingWindow.cpp +++ b/src/gui/wxgui/LoggingWindow.cpp @@ -10,8 +10,10 @@ wxDEFINE_EVENT(EVT_LOG, wxLogEvent); LoggingWindow::LoggingWindow(wxFrame* parent) - : wxFrame(parent, wxID_ANY, _("Logging window"), wxDefaultPosition, wxSize(800, 600), wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL) + : wxFrame(parent, wxID_ANY, _("Logging window"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL) { + SetSize(FromDIP(wxSize(800, 600))); + auto* sizer = new wxBoxSizer( wxVERTICAL ); { auto filter_row = new wxBoxSizer( wxHORIZONTAL ); From 0406e66d01d0dc73a7ba123cac6cf6fa5df5c072 Mon Sep 17 00:00:00 2001 From: Squall-Leonhart Date: Mon, 16 Feb 2026 20:13:48 +1100 Subject: [PATCH 2/2] remove pointless whitespace changes --- src/gui/wxgui/GraphicPacksWindow2.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gui/wxgui/GraphicPacksWindow2.h b/src/gui/wxgui/GraphicPacksWindow2.h index e17a81fa..2f221866 100644 --- a/src/gui/wxgui/GraphicPacksWindow2.h +++ b/src/gui/wxgui/GraphicPacksWindow2.h @@ -16,14 +16,14 @@ class wxChoice; class GraphicPacksWindow2 : public wxDialog { - public: +public: GraphicPacksWindow2(wxWindow* parent, uint64_t title_id_filter); ~GraphicPacksWindow2(); static void RefreshGraphicPacks(); void UpdateTitleRunning(bool running); - private: +private: std::string m_filter; bool m_filter_installed_games; std::vector m_installed_games; @@ -32,17 +32,17 @@ class GraphicPacksWindow2 : public wxDialog void FillGraphicPackList() const; void GetChildren(const wxTreeItemId& id, std::vector& children) const; void ExpandChildren(const std::vector& ids, size_t& counter) const; - - wxSplitterWindow* m_splitter_window; + + wxSplitterWindow * m_splitter_window; wxPanel* m_right_panel; wxScrolled* m_gp_options; - - wxCheckTree* m_graphic_pack_tree; + + wxCheckTree * m_graphic_pack_tree; wxTextCtrl* m_filter_text; wxCheckBox* m_installed_games_only; - wxStaticText *m_graphic_pack_name, *m_graphic_pack_description; + wxStaticText* m_graphic_pack_name, *m_graphic_pack_description; wxBoxSizer* m_preset_sizer; std::vector m_active_preset; wxButton* m_reload_shaders; @@ -77,4 +77,4 @@ class GraphicPacksWindow2 : public wxDialog void ReloadPack(const GraphicPackPtr& graphic_pack) const; void DeleteShadersFromRuntimeCache(const GraphicPackPtr& graphic_pack) const; -}; +}; \ No newline at end of file