Merge branch 'rr1-maint'

This commit is contained in:
Ilari Liusvaara 2012-04-11 00:11:05 +03:00
commit 0d1c7a1616

View file

@ -516,6 +516,7 @@ public:
private: private:
void refresh(); void refresh();
wxSizer* jgrid; wxSizer* jgrid;
wxStaticText* no_joysticks;
std::map<std::string, wxButton*> buttons; std::map<std::string, wxButton*> buttons;
std::map<int, std::string> ids; std::map<int, std::string> ids;
int last_id; int last_id;
@ -555,7 +556,10 @@ wxeditor_esettings_joystick::wxeditor_esettings_joystick(wxWindow* parent)
: wxPanel(parent, -1) : wxPanel(parent, -1)
{ {
last_id = wxID_HIGHEST + 1; last_id = wxID_HIGHEST + 1;
SetSizer(jgrid = new wxBoxSizer(wxVERTICAL)); 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(); refresh();
jgrid->SetSizeHints(this); jgrid->SetSizeHints(this);
Fit(); Fit();
@ -588,7 +592,9 @@ void wxeditor_esettings_joystick::refresh()
} }
}); });
unsigned jcount = 0;
for(auto i : x) { for(auto i : x) {
jcount++;
if(buttons.count(i.first)) { if(buttons.count(i.first)) {
//Okay, this already exists. Update. //Okay, this already exists. Update.
buttons[i.first]->SetLabel(towxstring(formatsettings(i.first, i.second))); buttons[i.first]->SetLabel(towxstring(formatsettings(i.first, i.second)));
@ -613,6 +619,13 @@ void wxeditor_esettings_joystick::refresh()
jgrid->Detach(i.second); jgrid->Detach(i.second);
} }
} }
if(jcount > 0) {
jgrid->Detach(no_joysticks);
no_joysticks->Hide();
} else {
no_joysticks->Show();
jgrid->Add(no_joysticks);
}
jgrid->Layout(); jgrid->Layout();
this->Refresh(); this->Refresh();
Fit(); Fit();
@ -1533,7 +1546,6 @@ wxeditor_esettings::wxeditor_esettings(wxWindow* parent)
tabset->AddPage(new wxeditor_esettings_aliases(tabset), wxT("Aliases")); tabset->AddPage(new wxeditor_esettings_aliases(tabset), wxT("Aliases"));
tabset->AddPage(new wxeditor_esettings_bindings(tabset), wxT("Bindings")); tabset->AddPage(new wxeditor_esettings_bindings(tabset), wxT("Bindings"));
tabset->AddPage(new wxeditor_esettings_advanced(tabset), wxT("Advanced")); tabset->AddPage(new wxeditor_esettings_advanced(tabset), wxT("Advanced"));
tabset->SetMinSize(wxSize(400, 420));
top_s->Add(tabset, 1, wxGROW); top_s->Add(tabset, 1, wxGROW);
wxBoxSizer* pbutton_s = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* pbutton_s = new wxBoxSizer(wxHORIZONTAL);