Move UDPConfigDiag into Dolphin, to allow building of UDP Wiimote again.

Please test this, I don't have any phones or whatever capable of communicating with it.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6405 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
j4ck.fr0st
2010-11-14 13:30:57 +00:00
parent 6fe343df61
commit 01ac354e97
14 changed files with 177 additions and 222 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="Dolphin"
ProjectGUID="{A72606EF-C5C1-4954-90AD-F0F93A8D97D9}"
RootNamespace="DolphinWX"
@ -924,6 +924,14 @@
RelativePath=".\Src\PatchAddEdit.h"
>
</File>
<File
RelativePath=".\Src\UDPConfigDiag.cpp"
>
</File>
<File
RelativePath=".\Src\UDPConfigDiag.h"
>
</File>
<File
RelativePath=".\Src\WiimoteConfigDiag.cpp"
>

View File

@ -16,19 +16,21 @@
// http://code.google.com/p/dolphin-emu/
#include "InputConfigDiag.h"
#include "UDPConfigDiag.h"
#define _connect_macro_(b, f, c, s) (b)->Connect(wxID_ANY, (c), wxCommandEventHandler( f ), (wxObject*)0, (wxEvtHandler*)s)
#define WXSTR_FROM_STR(s) (wxString::From8BitData((s).c_str()))
// ToAscii was causing probs with some extended ascii characters, To8BitData seems to work
#define STR_FROM_WXSTR(w) (std::string((w).To8BitData()))
#ifdef USE_UDP_WIIMOTE
void GamepadPage::ConfigUDPWii(wxCommandEvent &event)
{
UDPWrapper* const wrp = ((UDPConfigButton*)event.GetEventObject())->wrapper;
wrp->Configure(this);
wxDialog * diag = new UDPConfigDiag(this, wrp);
diag->Center();
diag->ShowModal();
diag->Destroy();
}
#endif
void GamepadPage::ConfigExtension( wxCommandEvent& event )
{
@ -836,7 +838,6 @@ ControlGroupBox::ControlGroupBox( ControllerEmu::ControlGroup* const group, wxWi
Add(configure_btn, 0, wxALL|wxEXPAND, 3 );
}
break;
#ifdef USE_UDP_WIIMOTE
case GROUP_TYPE_UDPWII:
{
wxButton* const btn = new UDPConfigButton( parent, (UDPWrapper*)group );
@ -844,7 +845,6 @@ ControlGroupBox::ControlGroupBox( ControllerEmu::ControlGroup* const group, wxWi
Add(btn, 0, wxALL|wxEXPAND, 3);
}
break;
#endif
default:
{
//options

View File

@ -146,8 +146,6 @@ public:
ControllerInterface::ControlReference* const control_reference;
};
#ifdef USE_UDP_WIIMOTE
class UDPConfigButton : public wxButton
{
public:
@ -158,8 +156,6 @@ public:
{}
};
#endif
class ControlGroupBox : public wxStaticBoxSizer
{
public:
@ -177,8 +173,6 @@ class ControlGroupsSizer : public wxBoxSizer
{
public:
ControlGroupsSizer( ControllerEmu* const controller, wxWindow* const parent, wxWindow* const eventsink, std::vector<ControlGroupBox*>* const groups = NULL );
};
class InputConfigDialog;

View File

@ -0,0 +1,86 @@
#include "UDPConfigDiag.h"
#include "UDPWrapper.h"
#include "Common.h"
#include "ControllerEmu.h"
#include "IniFile.h"
#include <string>
#define _connect_macro_(b, f, c, s) (b)->Connect(wxID_ANY, (c), wxCommandEventHandler( f ), (wxObject*)0, (wxEvtHandler*)s)
UDPConfigDiag::UDPConfigDiag(wxWindow * const parent, UDPWrapper * _wrp) :
wxDialog(parent, -1, wxT("UDP Wiimote"), wxDefaultPosition, wxDefaultSize),
wrp(_wrp)
{
wxBoxSizer *const outer_sizer = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *const sizer1 = new wxBoxSizer(wxVERTICAL);
wxStaticBoxSizer *const sizer2 = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Update"));
outer_sizer->Add(sizer1, 0, wxTOP | wxLEFT | wxRIGHT | wxEXPAND, 5);
outer_sizer->Add(sizer2, 1, wxLEFT | wxRIGHT | wxEXPAND, 10);
enable = new wxCheckBox(this,wxID_ANY,wxT("Enable"));
butt = new wxCheckBox(this,wxID_ANY,wxT("Buttons"));
accel = new wxCheckBox(this,wxID_ANY,wxT("Acceleration"));
point = new wxCheckBox(this,wxID_ANY,wxT("IR Pointer"));
nun = new wxCheckBox(this,wxID_ANY,wxT("Nunchuk"));
nunaccel = new wxCheckBox(this,wxID_ANY,wxT("Nunchuk Acceleration"));
wxButton *const ok_butt = new wxButton(this,wxID_ANY,wxT("OK"));
wxBoxSizer *const port_sizer = new wxBoxSizer(wxHORIZONTAL);
port_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("UDP Port:")), 0, wxALIGN_CENTER);
port_tbox = new wxTextCtrl(this, wxID_ANY, wxString::FromUTF8(wrp->port.c_str()));
port_sizer->Add(port_tbox, 1, wxLEFT | wxEXPAND , 5);
_connect_macro_(enable, UDPConfigDiag::ChangeState ,wxEVT_COMMAND_CHECKBOX_CLICKED, this);
_connect_macro_(butt, UDPConfigDiag::ChangeUpdateFlags ,wxEVT_COMMAND_CHECKBOX_CLICKED, this);
_connect_macro_(accel, UDPConfigDiag::ChangeUpdateFlags ,wxEVT_COMMAND_CHECKBOX_CLICKED, this);
_connect_macro_(point, UDPConfigDiag::ChangeUpdateFlags ,wxEVT_COMMAND_CHECKBOX_CLICKED, this);
_connect_macro_(nun, UDPConfigDiag::ChangeUpdateFlags ,wxEVT_COMMAND_CHECKBOX_CLICKED, this);
_connect_macro_(nunaccel, UDPConfigDiag::ChangeUpdateFlags ,wxEVT_COMMAND_CHECKBOX_CLICKED, this);
_connect_macro_(ok_butt, UDPConfigDiag::OKPressed, wxEVT_COMMAND_BUTTON_CLICKED, this);
_connect_macro_(port_tbox, UDPConfigDiag::ChangeState, wxEVT_COMMAND_TEXT_UPDATED, this);
enable->SetValue(wrp->udpEn);
butt->SetValue(wrp->updButt);
accel->SetValue(wrp->updAccel);
point->SetValue(wrp->updIR);
nun->SetValue(wrp->updNun);
nunaccel->SetValue(wrp->updNunAccel);
sizer1->Add(enable, 1, wxALL | wxEXPAND, 5);
sizer1->Add(port_sizer, 1, wxBOTTOM | wxLEFT| wxRIGHT | wxEXPAND, 5);
sizer2->Add(butt, 1, wxALL | wxEXPAND, 5);
sizer2->Add(accel, 1, wxALL | wxEXPAND, 5);
sizer2->Add(point, 1, wxALL | wxEXPAND, 5);
sizer2->Add(nun, 1, wxALL | wxEXPAND, 5);
sizer2->Add(nunaccel, 1, wxALL | wxEXPAND, 5);
outer_sizer->Add(ok_butt, 0, wxALL | wxALIGN_RIGHT, 5);
SetSizerAndFit(outer_sizer);
Layout();
}
void UDPConfigDiag::ChangeUpdateFlags(wxCommandEvent & WXUNUSED(event))
{
wrp->updAccel=accel->GetValue();
wrp->updButt=butt->GetValue();
wrp->updIR=point->GetValue();
wrp->updNun=nun->GetValue();
wrp->updNunAccel=nunaccel->GetValue();
}
void UDPConfigDiag::ChangeState(wxCommandEvent & WXUNUSED(event))
{
wrp->udpEn=enable->GetValue();
wrp->port=port_tbox->GetValue().mb_str(wxConvUTF8);
wrp->Refresh();
}
void UDPConfigDiag::OKPressed(wxCommandEvent & WXUNUSED(event))
{
Close();
}

View File

@ -0,0 +1,35 @@
#ifndef UDPCONFIGDIAG_H
#define UDPCONFIGDIAG_H
#include "UDPWrapper.h"
#include <wx/wx.h>
#include <wx/listbox.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/combobox.h>
#include <wx/checkbox.h>
#include <wx/notebook.h>
#include <wx/panel.h>
#include <wx/spinctrl.h>
class UDPConfigDiag : public wxDialog
{
public:
UDPConfigDiag(wxWindow * const parent, UDPWrapper * _wrp);
private:
UDPWrapper * wrp;
void ChangeUpdateFlags(wxCommandEvent & event);
void ChangeState(wxCommandEvent & event);
void OKPressed(wxCommandEvent & event);
wxCheckBox * enable;
wxCheckBox * butt;
wxCheckBox * accel;
wxCheckBox * point;
wxCheckBox * nun;
wxCheckBox * nunaccel;
wxTextCtrl * port_tbox;
};
#endif