Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/gui/wxgui/GameProfileWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down
63 changes: 37 additions & 26 deletions src/gui/wxgui/GraphicPacksWindow2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
{
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand All @@ -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();
}

Expand Down
2 changes: 2 additions & 0 deletions src/gui/wxgui/GraphicPacksWindow2.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,14 @@ class GraphicPacksWindow2 : public wxDialog

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);
Expand Down
4 changes: 3 additions & 1 deletion src/gui/wxgui/LoggingWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
Loading