This commit is contained in:
Squall Leonhart 2026-04-04 16:50:17 -03:00 committed by GitHub
commit c2d1150396
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 46 additions and 30 deletions

View File

@ -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);

View File

@ -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();
}

View File

@ -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);

View File

@ -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 );