TASInputDlg: Get rid of unnecessary event casts

wxCommandEvent already stores the necessary data; the control object
itself doesn't need to be retrieved and casted.
This commit is contained in:
Lioncash 2017-04-02 07:44:08 -04:00
parent 2af5b64f32
commit 598a92426f
1 changed files with 7 additions and 4 deletions

View File

@ -941,16 +941,19 @@ void TASInputDlg::UpdateFromSliders(wxCommandEvent& event)
if (control != nullptr && event.GetId() == control->slider_id)
text = control->text;
}
int value = ((wxSlider*)event.GetEventObject())->GetValue();
if (text)
text->SetValue(std::to_string(value));
if (!text)
return;
const int slider_value = event.GetInt();
text->SetValue(std::to_string(slider_value));
}
void TASInputDlg::UpdateFromText(wxCommandEvent& event)
{
unsigned long value;
if (!((wxTextCtrl*)event.GetEventObject())->GetValue().ToULong(&value))
if (!event.GetString().ToULong(&value))
return;
for (Control* const control : m_controls)