From 9fce776c442e6c4c6df3c28aa3bd8980b7599862 Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Tue, 10 Apr 2012 21:45:43 +0300 Subject: [PATCH 1/3] Wxwidgets: Some more attempts at fixing settings dialog sizing --- src/platform/wxwidgets/settings.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platform/wxwidgets/settings.cpp b/src/platform/wxwidgets/settings.cpp index 30cfe30f..934b7cb5 100644 --- a/src/platform/wxwidgets/settings.cpp +++ b/src/platform/wxwidgets/settings.cpp @@ -555,7 +555,8 @@ wxeditor_esettings_joystick::wxeditor_esettings_joystick(wxWindow* parent) : wxPanel(parent, -1) { last_id = wxID_HIGHEST + 1; - SetSizer(jgrid = new wxBoxSizer(wxVERTICAL)); + SetMinSize(wxSize(400, 420)); + SetSizer(jgrid = new wxFlexGridSizer(0, 1, 0, 0)); refresh(); jgrid->SetSizeHints(this); Fit(); @@ -1533,7 +1534,6 @@ wxeditor_esettings::wxeditor_esettings(wxWindow* parent) tabset->AddPage(new wxeditor_esettings_aliases(tabset), wxT("Aliases")); tabset->AddPage(new wxeditor_esettings_bindings(tabset), wxT("Bindings")); tabset->AddPage(new wxeditor_esettings_advanced(tabset), wxT("Advanced")); - tabset->SetMinSize(wxSize(400, 420)); top_s->Add(tabset, 1, wxGROW); wxBoxSizer* pbutton_s = new wxBoxSizer(wxHORIZONTAL); From ff97dcd4ac136b7f84b3e6f82a6f63958523d623 Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Tue, 10 Apr 2012 22:07:53 +0300 Subject: [PATCH 2/3] Wxwidgets: Mention lack of joysticks in joystick config --- src/platform/wxwidgets/settings.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/platform/wxwidgets/settings.cpp b/src/platform/wxwidgets/settings.cpp index 934b7cb5..ff833bda 100644 --- a/src/platform/wxwidgets/settings.cpp +++ b/src/platform/wxwidgets/settings.cpp @@ -516,6 +516,7 @@ public: private: void refresh(); wxSizer* jgrid; + wxStaticText* no_joysticks; std::map buttons; std::map ids; int last_id; @@ -555,7 +556,8 @@ wxeditor_esettings_joystick::wxeditor_esettings_joystick(wxWindow* parent) : wxPanel(parent, -1) { last_id = wxID_HIGHEST + 1; - SetMinSize(wxSize(400, 420)); + no_joysticks = new wxStaticText(this, wxID_ANY, wxT("Sorry, no joysticks detected")); + no_joysticks->Hide(); SetSizer(jgrid = new wxFlexGridSizer(0, 1, 0, 0)); refresh(); jgrid->SetSizeHints(this); @@ -589,7 +591,9 @@ void wxeditor_esettings_joystick::refresh() } }); + unsigned jcount = 0; for(auto i : x) { + jcount++; if(buttons.count(i.first)) { //Okay, this already exists. Update. buttons[i.first]->SetLabel(towxstring(formatsettings(i.first, i.second))); @@ -614,6 +618,13 @@ void wxeditor_esettings_joystick::refresh() jgrid->Detach(i.second); } } + if(jcount > 0) { + jgrid->Detach(no_joysticks); + no_joysticks->Hide(); + } else { + no_joysticks->Show(); + jgrid->Add(no_joysticks); + } jgrid->Layout(); this->Refresh(); Fit(); From 6e9ce875b8d00d7a3209dfc5d217380d7dcd4f41 Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Wed, 11 Apr 2012 00:09:29 +0300 Subject: [PATCH 3/3] Wxwidgets: Finally fix the settings dialog size This is a nasty hack, but whatever. --- src/platform/wxwidgets/settings.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/platform/wxwidgets/settings.cpp b/src/platform/wxwidgets/settings.cpp index ff833bda..7a173075 100644 --- a/src/platform/wxwidgets/settings.cpp +++ b/src/platform/wxwidgets/settings.cpp @@ -557,6 +557,7 @@ wxeditor_esettings_joystick::wxeditor_esettings_joystick(wxWindow* parent) { last_id = wxID_HIGHEST + 1; no_joysticks = new wxStaticText(this, wxID_ANY, wxT("Sorry, no joysticks detected")); + no_joysticks->SetMinSize(wxSize(400, -1)); no_joysticks->Hide(); SetSizer(jgrid = new wxFlexGridSizer(0, 1, 0, 0)); refresh();