From 3055091932bc5bf746b68d821673610d06e61620 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Thu, 25 Sep 2008 17:57:57 +0000 Subject: [PATCH] (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 --- .../Plugin_PadSimple/Src/GUI/ConfigDlg.cpp | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Source/Plugins/Plugin_PadSimple/Src/GUI/ConfigDlg.cpp b/Source/Plugins/Plugin_PadSimple/Src/GUI/ConfigDlg.cpp index d0dd0350d8..79404b5134 100644 --- a/Source/Plugins/Plugin_PadSimple/Src/GUI/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_PadSimple/Src/GUI/ConfigDlg.cpp @@ -71,10 +71,11 @@ ConfigDialog::~ConfigDialog() { } -inline void AddControl(wxPanel *pan, wxButton **button, wxStaticBoxSizer *sizer, - const char *name, int ctl, int controller) { +inline void AddControl(wxPanel *pan, wxButton **button, wxStaticBoxSizer *sizer, + 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; @@ -271,11 +273,8 @@ void ConfigDialog::OnButtonClick(wxCommandEvent& event) clickedButton = (wxButton *)event.GetEventObject(); oldLabel = clickedButton->GetLabel(); clickedButton->SetLabel(_("Press Key")); - + 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)); }