void TASInputDlg::CreateWiiLayout(int num) { if (m_has_layout) return; CreateBaseLayout(); m_buttons[6] = &m_one; m_buttons[7] = &m_two; m_buttons[8] = &m_plus; m_buttons[9] = &m_minus; m_buttons[10] = &m_home; m_controls[4] = &m_x_cont; m_controls[5] = &m_y_cont; m_controls[6] = &m_z_cont; m_main_stick = CreateStick(ID_MAIN_STICK, 1024, 768, 512, 384, true, false); m_main_stick_szr = CreateStickLayout(&m_main_stick, _("IR")); m_x_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512); m_y_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512); m_z_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 616); wxStaticBoxSizer* const axisBox = CreateAccelLayout(&m_x_cont, &m_y_cont, &m_z_cont, _("Orientation")); wxStaticBoxSizer* const m_buttons_box = new wxStaticBoxSizer(wxVERTICAL, this, _("Buttons")); wxGridSizer* const m_buttons_grid = new wxGridSizer(4); m_plus = CreateButton("+"); m_minus = CreateButton("-"); m_one = CreateButton("1"); m_two = CreateButton("2"); m_home = CreateButton("Home"); m_main_szr = new wxBoxSizer(wxVERTICAL); m_wiimote_szr = new wxBoxSizer(wxHORIZONTAL); m_ext_szr = new wxBoxSizer(wxHORIZONTAL); m_cc_szr = CreateCCLayout(); if (Core::IsRunning()) { m_ext = ((WiimoteEmu::Wiimote*)Wiimote::GetConfig()->controllers[num])->CurrentExtension(); } else { IniFile ini; ini.Load(File::GetUserPath(D_CONFIG_IDX) + "WiimoteNew.ini"); std::string extension; ini.GetIfExists("Wiimote" + std::to_string(num + 1), "Extension", &extension); if (extension == "Nunchuk") m_ext = 1; if (extension == "Classic") m_ext = 2; } m_buttons[11] = &m_c; m_buttons[12] = &m_z; m_controls[2] = &m_c_stick.x_cont; m_controls[3] = &m_c_stick.y_cont; m_controls[7] = &m_nx_cont; m_controls[8] = &m_ny_cont; m_controls[9] = &m_nz_cont; m_c_stick = CreateStick(ID_C_STICK, 255, 255, 128, 128, false, true); m_c_stick_szr = CreateStickLayout(&m_c_stick, _("Nunchuk stick")); m_nx_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512); m_ny_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512); m_nz_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512); wxStaticBoxSizer* const nunchukaxisBox = CreateAccelLayout(&m_nx_cont, &m_ny_cont, &m_nz_cont, _("Nunchuk orientation")); m_c = CreateButton("C"); m_z = CreateButton("Z"); m_ext_szr->Add(m_c_stick_szr, 0, wxLEFT | wxBOTTOM | wxRIGHT, 5); m_ext_szr->Add(nunchukaxisBox); for (Control* const control : m_controls) { if (control != nullptr) control->slider->Bind(wxEVT_RIGHT_UP, &TASInputDlg::OnRightClickSlider, this); } for (unsigned int i = 4; i < ArraySize(m_buttons); ++i) if (m_buttons[i] != nullptr) m_buttons_grid->Add(m_buttons[i]->checkbox); m_buttons_grid->AddSpacer(5); m_buttons_box->Add(m_buttons_grid); m_buttons_box->Add(m_buttons_dpad); m_wiimote_szr->Add(m_main_stick_szr, 0, wxALL, 5); m_wiimote_szr->Add(axisBox, 0, wxTOP | wxRIGHT, 5); m_wiimote_szr->Add(m_buttons_box, 0, wxTOP | wxRIGHT, 5); m_main_szr->Add(m_wiimote_szr); m_main_szr->Add(m_ext_szr); m_main_szr->Add(m_cc_szr); HandleExtensionChange(); m_has_layout = true; }
void TASInputDlg::CreateWiiLayout(int num) { if (m_has_layout) return; const int space5 = FromDIP(5); CreateBaseLayout(); m_buttons[6] = &m_one; m_buttons[7] = &m_two; m_buttons[8] = &m_plus; m_buttons[9] = &m_minus; m_buttons[10] = &m_home; m_controls[4] = &m_x_cont; m_controls[5] = &m_y_cont; m_controls[6] = &m_z_cont; m_main_stick = CreateStick(ID_MAIN_STICK, 1024, 768, 512, 384, true, false); // i18n: IR stands for infrared and refers to the pointer functionality of Wii Remotes m_main_stick_szr = CreateStickLayout(&m_main_stick, _("IR")); m_x_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512); m_y_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512); m_z_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 616); wxStaticBoxSizer* const axisBox = CreateAccelLayout(&m_x_cont, &m_y_cont, &m_z_cont, _("Orientation")); m_plus = CreateButton("+"); m_plus.checkbox->SetClientData(&m_plus); m_minus = CreateButton("-"); m_minus.checkbox->SetClientData(&m_minus); m_one = CreateButton("1"); m_one.checkbox->SetClientData(&m_one); m_two = CreateButton("2"); m_two.checkbox->SetClientData(&m_two); m_home = CreateButton("HOME"); m_home.checkbox->SetClientData(&m_home); m_cc_szr = CreateCCLayout(); if (Core::IsRunning()) { m_ext = static_cast<WiimoteEmu::Wiimote*>(Wiimote::GetConfig()->GetController(num)) ->CurrentExtension(); } else { IniFile ini; ini.Load(File::GetUserPath(D_CONFIG_IDX) + "WiimoteNew.ini"); std::string extension; ini.GetIfExists("Wiimote" + std::to_string(num + 1), "Extension", &extension); if (extension == "Nunchuk") m_ext = 1; if (extension == "Classic") m_ext = 2; } m_buttons[11] = &m_c; m_buttons[12] = &m_z; m_controls[2] = &m_c_stick.x_cont; m_controls[3] = &m_c_stick.y_cont; m_controls[7] = &m_nx_cont; m_controls[8] = &m_ny_cont; m_controls[9] = &m_nz_cont; m_c_stick = CreateStick(ID_C_STICK, 255, 255, 128, 128, false, true); m_c_stick_szr = CreateStickLayout(&m_c_stick, _("Nunchuk stick")); m_nx_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512); m_ny_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512); m_nz_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512); wxStaticBoxSizer* const nunchukaxisBox = CreateAccelLayout(&m_nx_cont, &m_ny_cont, &m_nz_cont, _("Nunchuk orientation")); m_c = CreateButton("C"); m_c.checkbox->SetClientData(&m_c); m_z = CreateButton("Z"); m_z.checkbox->SetClientData(&m_z); for (Control* const control : m_controls) { if (control != nullptr) control->slider->Bind(wxEVT_RIGHT_UP, &TASInputDlg::OnRightClickSlider, this); } m_ext_szr = new wxBoxSizer(wxHORIZONTAL); m_ext_szr->Add(m_c_stick_szr, 0, wxBOTTOM, space5); m_ext_szr->AddSpacer(space5); m_ext_szr->Add(nunchukaxisBox, 0, wxBOTTOM, space5); // Add non-DPad related buttons first. auto* const buttons_grid = new wxGridSizer(4); for (size_t i = 4; i < m_buttons.size(); ++i) { if (m_buttons[i] != nullptr) buttons_grid->Add(m_buttons[i]->checkbox); } buttons_grid->Add(space5, space5); auto* const buttons_box = new wxStaticBoxSizer(wxVERTICAL, this, _("Buttons")); buttons_box->Add(buttons_grid); buttons_box->Add(m_buttons_dpad, 0, wxTOP, space5); m_wiimote_szr = new wxBoxSizer(wxHORIZONTAL); m_wiimote_szr->AddSpacer(space5); m_wiimote_szr->Add(m_main_stick_szr); m_wiimote_szr->Add(axisBox, 0, wxLEFT, space5); m_wiimote_szr->Add(buttons_box, 0, wxLEFT, space5); m_wiimote_szr->AddSpacer(space5); // NOTE: Not all of these are visible at the same time. m_main_szr = new wxBoxSizer(wxVERTICAL); m_main_szr->Add(m_wiimote_szr, 0, wxTOP | wxBOTTOM, space5); m_main_szr->Add(m_ext_szr, 0, wxLEFT | wxRIGHT, space5); m_main_szr->Add(m_cc_szr, 0, wxLEFT | wxRIGHT, space5); SetSizer(m_main_szr); HandleExtensionChange(); FinishLayout(); }