InputConfigDiagBitmaps: Start a cleanup by splitting code out

This doesn't have any functional changes, it just removes part of the
mess by killing indentation.
This commit is contained in:
Jasper St. Pierre 2014-07-11 07:34:34 -04:00
parent 68a4979f35
commit 3c411c33e8
1 changed files with 334 additions and 329 deletions

View File

@ -29,36 +29,8 @@
class wxTimerEvent; class wxTimerEvent;
void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event)) static void DrawControlGroupBox(wxDC &dc, ControlGroupBox *g)
{ {
wxFont small_font(6, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
g_controller_interface.UpdateInput();
// don't want game thread updating input when we are using it here
std::unique_lock<std::recursive_mutex> lk(g_controller_interface.update_lock, std::try_to_lock);
if (!lk.owns_lock())
return;
GamepadPage* const current_page = (GamepadPage*)m_pad_notebook->GetPage(m_pad_notebook->GetSelection());
for (ControlGroupBox* g : current_page->control_groups)
{
// if this control group has a bitmap
if (g->static_bitmap)
{
wxMemoryDC dc;
wxBitmap bitmap(g->static_bitmap->GetBitmap());
dc.SelectObject(bitmap);
dc.Clear();
dc.SetFont(small_font);
dc.SetTextForeground(0xC0C0C0);
// label for sticks and stuff
if (64 == bitmap.GetHeight())
dc.DrawText(StrToWxStr(g->control_group->name).Upper(), 4, 2);
switch (g->control_group->type) switch (g->control_group->type)
{ {
case GROUP_TYPE_TILT : case GROUP_TYPE_TILT :
@ -388,6 +360,39 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
default: default:
break; break;
} }
}
void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
{
wxFont small_font(6, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
g_controller_interface.UpdateInput();
// don't want game thread updating input when we are using it here
std::unique_lock<std::recursive_mutex> lk(g_controller_interface.update_lock, std::try_to_lock);
if (!lk.owns_lock())
return;
GamepadPage* const current_page = (GamepadPage*)m_pad_notebook->GetPage(m_pad_notebook->GetSelection());
for (ControlGroupBox* g : current_page->control_groups)
{
// if this control group has a bitmap
if (g->static_bitmap)
{
wxMemoryDC dc;
wxBitmap bitmap(g->static_bitmap->GetBitmap());
dc.SelectObject(bitmap);
dc.Clear();
dc.SetFont(small_font);
dc.SetTextForeground(0xC0C0C0);
// label for sticks and stuff
if (64 == bitmap.GetHeight())
dc.DrawText(StrToWxStr(g->control_group->name).Upper(), 4, 2);
DrawControlGroupBox(dc, g);
// box outline // box outline
// Windows XP color // Windows XP color