(windows)padsimple now shows human-readable names after you set a new key

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@692 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2008-09-25 17:57:57 +00:00
parent c1b340feb5
commit 3055091932
1 changed files with 11 additions and 12 deletions

View File

@ -72,9 +72,10 @@ ConfigDialog::~ConfigDialog()
}
inline void AddControl(wxPanel *pan, wxButton **button, wxStaticBoxSizer *sizer,
const char *name, int ctl, int controller) {
const char *name, int ctl, int controller)
{
wxBoxSizer *hButton = new wxBoxSizer(wxHORIZONTAL);
char keyStr[6] = {0};
char keyStr[10] = {0};
hButton->Add(new wxStaticText(pan, 0, wxString::FromAscii(name),
wxDefaultPosition, wxDefaultSize), 0,
@ -82,14 +83,12 @@ inline void AddControl(wxPanel *pan, wxButton **button, wxStaticBoxSizer *sizer,
#ifdef _WIN32
DInput::DIKToString(pad[controller].keyForControl[ctl], keyStr);
#else
XKeyToString(pad[controller].keyForControl[ctl], keyStr);
XKeyToString(pad[controller].keyForControl[ctl], keyStr);
#endif
*button = new wxButton(pan, ctl, wxString::FromAscii(keyStr),
wxDefaultPosition, wxDefaultSize, 0);
hButton->Add(*button, 0, wxEXPAND|wxALL);
sizer->Add(hButton);
}
@ -226,14 +225,17 @@ void ConfigDialog::OnKeyDown(wxKeyEvent& event)
{
if(m_dinput.diks[i])
{
char keyStr[10] = {0};
pad[page].keyForControl[clickedButton->GetId()] = i;
DInput::DIKToString(i, keyStr);
clickedButton->SetLabel(wxString::FromAscii(keyStr));
}
}
#else
pad[page].keyForControl[clickedButton->GetId()] = wxCharCodeWXToX(event.GetKeyCode());
#endif
clickedButton->SetLabel(wxString::Format(_T("%c"), event.GetKeyCode()));
clickedButton->Disconnect();
#endif
clickedButton->Disconnect();
}
clickedButton = NULL;
@ -275,7 +277,4 @@ void ConfigDialog::OnButtonClick(wxCommandEvent& event)
clickedButton->Connect(wxID_ANY, wxEVT_KEY_DOWN,
wxKeyEventHandler(ConfigDialog::OnKeyDown),
(wxObject*)NULL, this);
//clickedButton->SetLabel(wxString::Format(wxT("%i"), keyPress));
//clickedButton->SetLabel(wxString::Format(wxT("%s %i"), oldLabel, keyPress));
}