Skip to content
Permalink
Browse files

Add individual clear buttons for input config.

Besides that, we also rename the button for all input to `Clear All`.

- Fix #416.
  • Loading branch information
denisfa authored and rkitover committed Jul 18, 2019
1 parent 53002e5 commit 78bbe1487a5c0360d199d26d45f91512d11a8ef1
Showing with 194 additions and 5 deletions.
  1. +18 −0 src/wx/guiinit.cpp
  2. +176 −5 src/wx/xrc/JoyPanel.xrc
@@ -1646,6 +1646,18 @@ static class JoyPadConfig_t : public wxEvtHandler {
{
bool clear = ev.GetId() == XRCID("Clear");

// For the individual clear buttons, we assume their name is
// "Clear" + joynames[i]
// ClearUp for Up; ClearR for R etc
for (int i = 0; i < NUM_KEYS; ++i) {
wxJoyKeyTextCtrl* tc = XRCCTRL_D(*p, joynames[i], wxJoyKeyTextCtrl);
wxString singleClearButton("Clear" + joynames[i]);
if (ev.GetId() == XRCID(singleClearButton)) {
tc->SetValue(wxEmptyString);
return;
}
}

for (int i = 0; i < NUM_KEYS; i++) {
wxJoyKeyTextCtrl* tc = XRCCTRL_D(*p, joynames[i], wxJoyKeyTextCtrl);

@@ -3725,6 +3737,12 @@ bool MainFrame::BindControls()
w->Connect(XRCID("Clear"), wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler(JoyPadConfig_t::JoypadConfigButtons),
NULL, &JoyPadConfigHandler[i]);
for (int j = 0; j < NUM_KEYS; ++j) {
w->Connect(XRCID(wxString("Clear" + joynames[j])),
wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler(JoyPadConfig_t::JoypadConfigButtons),
NULL, &JoyPadConfigHandler[i]);
}
joyDialog->Fit();
}

@@ -24,6 +24,14 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxButton" name="ClearUp">
<label>_Clear</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>A</label>
@@ -39,6 +47,14 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxButton" name="ClearA">
<label>_Clear</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>Down</label>
@@ -54,6 +70,14 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxButton" name="ClearDown">
<label>_Clear</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>B</label>
@@ -69,6 +93,14 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxButton" name="ClearB">
<label>_Clear</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>Left</label>
@@ -84,6 +116,14 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxButton" name="ClearLeft">
<label>_Clear</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>L</label>
@@ -99,6 +139,14 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxButton" name="ClearL">
<label>_Clear</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>Right</label>
@@ -114,6 +162,14 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxButton" name="ClearRight">
<label>_Clear</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>R</label>
@@ -130,6 +186,14 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxButton" name="ClearR">
<label>_Clear</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>Select</label>
@@ -145,6 +209,14 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxButton" name="ClearSelect">
<label>_Clear</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>Start</label>
@@ -160,8 +232,16 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<cols>4</cols>
<growablecols>1,3</growablecols>
<object class="sizeritem">
<object class="wxButton" name="ClearStart">
<label>_Clear</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<cols>6</cols>
<growablecols>1,2,4,5</growablecols>
</object>
</object>
<label>Standard</label>
@@ -183,6 +263,14 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxButton" name="ClearMotionUp">
<label>_Clear</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>Autofire A</label>
@@ -197,6 +285,14 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxButton" name="ClearAutoA">
<label>_Clear</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>Motion Down</label>
@@ -211,6 +307,14 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxButton" name="ClearMotionDown">
<label>_Clear</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>Autofire B</label>
@@ -225,6 +329,14 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxButton" name="ClearAutoB">
<label>_Clear</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>Motion Left/Dark</label>
@@ -239,6 +351,14 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxButton" name="ClearMotionLeft">
<label>_Clear</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>GameShark</label>
@@ -253,6 +373,14 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxButton" name="ClearGS">
<label>_Clear</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>Motion Right/Light</label>
@@ -267,6 +395,14 @@
<flag>wxALL|wxGROW</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxButton" name="ClearMotionRight">
<label>_Clear</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>Speed Up</label>
@@ -281,6 +417,14 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxButton" name="ClearSpeed">
<label>_Clear</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>Spin Left</label>
@@ -295,6 +439,17 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxButton" name="ClearMotionIn">
<label>_Clear</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="spacer">
<flag>wxEXPAND</flag>
</object>
<object class="spacer">
<flag>wxEXPAND</flag>
</object>
@@ -315,6 +470,14 @@
<flag>wxALL|wxGROW</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxButton" name="ClearMotionOut">
<label>_Clear</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>Screenshot</label>
@@ -329,8 +492,16 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<cols>4</cols>
<growablecols>1,3</growablecols>
<object class="sizeritem">
<object class="wxButton" name="ClearCapture">
<label>_Clear</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<cols>6</cols>
<growablecols>1,2,4,5</growablecols>
</object>
</object>
<label>Special</label>
@@ -355,7 +526,7 @@
</object>
<object class="sizeritem">
<object class="wxButton" name="Clear">
<label>Clear</label>
<label>Clear All</label>
</object>
<flag>wxALL</flag>
<border>5</border>

0 comments on commit 78bbe14

Please sign in to comment.
You can’t perform that action at this time.