Merge branch 'rr1-maint' into rr1-gambatte

This commit is contained in:
Ilari Liusvaara 2012-08-29 18:48:08 +03:00
commit 03338e498b

View file

@ -240,7 +240,7 @@ int extract_token(std::string& str, std::string& tok, const char* sep, bool seq
struct keyentry_mod_data struct keyentry_mod_data
{ {
wxCheckBox* pressed; wxComboBox* pressed;
unsigned tmpflags; unsigned tmpflags;
}; };
@ -282,6 +282,7 @@ int extract_token(std::string& str, std::string& tok, const char* sep, bool seq
bool clearable) bool clearable)
: wxDialog(parent, wxID_ANY, towxstring(title), wxDefaultPosition, wxSize(-1, -1)) : wxDialog(parent, wxID_ANY, towxstring(title), wxDefaultPosition, wxSize(-1, -1))
{ {
wxString boxchoices[] = { wxT("Released"), wxT("Don't care"), wxT("Pressed") };
std::vector<wxString> classeslist; std::vector<wxString> classeslist;
wxString emptystring; wxString emptystring;
std::set<std::string> mods, keys; std::set<std::string> mods, keys;
@ -304,13 +305,14 @@ int extract_token(std::string& str, std::string& tok, const char* sep, bool seq
top_s = new wxFlexGridSizer(3, 1, 0, 0); top_s = new wxFlexGridSizer(3, 1, 0, 0);
SetSizer(top_s); SetSizer(top_s);
t_s = new wxFlexGridSizer(1, 3, 0, 0); t_s = new wxFlexGridSizer(2, 3, 0, 0);
wxFlexGridSizer* t2_s = new wxFlexGridSizer(mods.size(), 1, 0, 0); wxFlexGridSizer* t2_s = new wxFlexGridSizer(mods.size(), 2, 0, 0);
for(auto i : mods) { for(auto i : mods) {
keyentry_mod_data m; keyentry_mod_data m;
t2_s->Add(m.pressed = new wxCheckBox(this, wxID_ANY, towxstring(i), wxDefaultPosition, t2_s->Add(new wxStaticText(this, wxID_ANY, towxstring(i)), 0, wxGROW);
wxDefaultSize, wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER), 1, wxGROW); t2_s->Add(m.pressed = new wxComboBox(this, wxID_ANY, boxchoices[1], wxDefaultPosition,
m.pressed->Set3StateValue(wxCHK_UNDETERMINED); wxDefaultSize, 3, boxchoices, wxCB_READONLY), 1, wxGROW);
m.pressed->SetSelection(1);
modifiers[i] = m; modifiers[i] = m;
m.pressed->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, m.pressed->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
wxCommandEventHandler(wxdialog_keyentry::on_change_setting), NULL, this); wxCommandEventHandler(wxdialog_keyentry::on_change_setting), NULL, this);
@ -368,9 +370,9 @@ int extract_token(std::string& str, std::string& tok, const char* sep, bool seq
{ {
if(!modifiers.count(mod)) if(!modifiers.count(mod))
return; return;
if(modifiers[mod].pressed->Get3StateValue() == wxCHK_UNDETERMINED) { if(modifiers[mod].pressed->GetSelection() == 1) {
wxCommandEvent e; wxCommandEvent e;
modifiers[mod].pressed->Set3StateValue(wxCHK_UNCHECKED); modifiers[mod].pressed->SetSelection(0);
on_change_setting(e); on_change_setting(e);
} }
} }
@ -379,9 +381,9 @@ int extract_token(std::string& str, std::string& tok, const char* sep, bool seq
{ {
if(!modifiers.count(mod)) if(!modifiers.count(mod))
return; return;
if(modifiers[mod].pressed->Get3StateValue() != wxCHK_UNDETERMINED) { if(modifiers[mod].pressed->GetSelection() != 1) {
wxCommandEvent e; wxCommandEvent e;
modifiers[mod].pressed->Set3StateValue(wxCHK_CHECKED); modifiers[mod].pressed->SetSelection(2);
on_change_setting(e); on_change_setting(e);
} }
} }
@ -494,7 +496,7 @@ int extract_token(std::string& str, std::string& tok, const char* sep, bool seq
bool f; bool f;
f = true; f = true;
for(auto i : modifiers) { for(auto i : modifiers) {
if(i.second.pressed->Get3StateValue() == wxCHK_CHECKED) { if(i.second.pressed->GetSelection() == 2) {
if(!f) if(!f)
x = x + ","; x = x + ",";
f = false; f = false;
@ -504,7 +506,7 @@ int extract_token(std::string& str, std::string& tok, const char* sep, bool seq
x = x + "/"; x = x + "/";
f = true; f = true;
for(auto i : modifiers) { for(auto i : modifiers) {
if(i.second.pressed->Get3StateValue() != wxCHK_UNDETERMINED) { if(i.second.pressed->GetSelection() != 1) {
if(!f) if(!f)
x = x + ","; x = x + ",";
f = false; f = false;