44#include  < wx/stattext.h> 
55#include  < wx/statline.h> 
66#include  < wx/textctrl.h> 
7- #include  < wx/slider.h> 
87
9- #include  " gui/helpers/wxControlObject.h" 
108#include  " input/emulated/ProController.h" 
119#include  " gui/helpers/wxHelpers.h" 
1210#include  " gui/components/wxInputDraw.h" 
@@ -30,16 +28,7 @@ ProControllerInputPanel::ProControllerInputPanel(wxWindow* parent)
3028	for  (auto  id : g_kFirstColumnItems)
3129	{
3230		row++;
33- 
34- 		main_sizer->Add (new  wxStaticText (this , wxID_ANY, to_wxString (ProController::get_button_name (id))), wxGBPosition (row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
35- 
36- 		auto  text_ctrl = new  wxTextCtrl (this , wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
37- 		text_ctrl->SetClientData ((void *)id);
38- 		text_ctrl->SetMinSize (wxSize (150 , -1 ));
39- 		text_ctrl->SetEditable (false );
40- 		text_ctrl->SetBackgroundColour (kKeyColourNormalMode );
41- 		bind_hotkey_events (text_ctrl);
42- 		main_sizer->Add (text_ctrl, wxGBPosition (row, column + 1 ), wxDefaultSpan, wxALL | wxEXPAND, 5 );
31+ 		add_button_row (main_sizer, row, column, id);
4332	}
4433
4534	// ////////////////////////////////////////////////////////////////
@@ -56,16 +45,7 @@ ProControllerInputPanel::ProControllerInputPanel(wxWindow* parent)
5645	for  (auto  id : g_kSecondColumnItems)
5746	{
5847		row++;
59- 
60- 		main_sizer->Add (new  wxStaticText (this , wxID_ANY, to_wxString (ProController::get_button_name (id))), wxGBPosition (row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
61- 
62- 		auto  text_ctrl = new  wxTextCtrl (this , wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
63- 		text_ctrl->SetClientData ((void *)id);
64- 		text_ctrl->SetMinSize (wxSize (150 , -1 ));
65- 		text_ctrl->SetEditable (false );
66- 		text_ctrl->SetBackgroundColour (kKeyColourNormalMode );
67- 		bind_hotkey_events (text_ctrl);
68- 		main_sizer->Add (text_ctrl, wxGBPosition (row, column + 1 ), wxDefaultSpan, wxALL | wxEXPAND, 5 );
48+ 		add_button_row (main_sizer, row, column, id);
6949	}
7050
7151	row++;
@@ -88,16 +68,7 @@ ProControllerInputPanel::ProControllerInputPanel(wxWindow* parent)
8868	for  (auto  id : g_kThirdColumnItems)
8969	{
9070		row++;
91- 
92- 		main_sizer->Add (new  wxStaticText (this , wxID_ANY, to_wxString (ProController::get_button_name (id))), wxGBPosition (row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
93- 
94- 		auto  text_ctrl = new  wxTextCtrl (this , wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
95- 		text_ctrl->SetClientData ((void *)id);
96- 		text_ctrl->SetMinSize (wxSize (150 , -1 ));
97- 		text_ctrl->SetEditable (false );
98- 		text_ctrl->SetBackgroundColour (kKeyColourNormalMode );
99- 		bind_hotkey_events (text_ctrl);
100- 		main_sizer->Add (text_ctrl, wxGBPosition (row, column + 1 ), wxDefaultSpan, wxALL | wxEXPAND, 5 );
71+ 		add_button_row (main_sizer, row, column, id);
10172	}
10273
10374	row++;
@@ -120,24 +91,28 @@ ProControllerInputPanel::ProControllerInputPanel(wxWindow* parent)
12091	for  (auto  id : g_kFourthRowItems)
12192	{
12293		row++;
123- 
124- 		main_sizer->Add (new  wxStaticText (this , wxID_ANY, to_wxString (ProController::get_button_name (id))), wxGBPosition (row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
125- 
126- 		auto  text_ctrl = new  wxTextCtrl (this , wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
127- 		text_ctrl->SetClientData ((void *)id);
128- 		text_ctrl->SetMinSize (wxSize (150 , -1 ));
129- 		text_ctrl->SetEditable (false );
130- 		text_ctrl->SetBackgroundColour (kKeyColourNormalMode );
131- 		bind_hotkey_events (text_ctrl);
132- 		main_sizer->Add (text_ctrl, wxGBPosition (row, column + 1 ), wxDefaultSpan, wxALL | wxEXPAND, 5 );
94+ 		add_button_row (main_sizer, row, column, id);
13395	}
13496
13597	// ////////////////////////////////////////////////////////////////
13698
137- 	//  LoadController(controller);
138- 
13999	SetSizerAndFit (main_sizer);
140- 	// wxWindow::Show(show);
100+ }
101+ 
102+ void  ProControllerInputPanel::add_button_row (wxGridBagSizer *sizer, sint32 row, sint32 column, const  ProController::ButtonId &button_id) {
103+ 	sizer->Add (
104+ 		new  wxStaticText (this , wxID_ANY, wxGetTranslation (to_wxString (ProController::get_button_name (button_id)))),
105+ 		wxGBPosition (row, column),
106+ 		wxDefaultSpan,
107+ 		wxALL | wxALIGN_CENTER_VERTICAL, 5 );
108+ 
109+ 	auto  text_ctrl = new  wxTextCtrl (this , wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
110+ 	text_ctrl->SetClientData ((void *)button_id);
111+ 	text_ctrl->SetMinSize (wxSize (150 , -1 ));
112+ 	text_ctrl->SetEditable (false );
113+ 	text_ctrl->SetBackgroundColour (kKeyColourNormalMode );
114+ 	bind_hotkey_events (text_ctrl);
115+ 	sizer->Add (text_ctrl, wxGBPosition (row, column + 1 ), wxDefaultSpan, wxALL | wxEXPAND, 5 );
141116}
142117
143118void  ProControllerInputPanel::on_timer (const  EmulatedControllerPtr& emulated_controller,
0 commit comments