2010-04-01 20:48:24 -06:00
|
|
|
#ifndef _CONFIGBOX_H_
|
|
|
|
#define _CONFIGBOX_H_
|
|
|
|
|
|
|
|
#define SLIDER_TICK_COUNT 100
|
|
|
|
#define DETECT_WAIT_TIME 1500
|
|
|
|
#define PREVIEW_UPDATE_TIME 25
|
|
|
|
|
|
|
|
// might have to change this setup for wiimote
|
2010-04-12 23:15:38 -06:00
|
|
|
#define PROFILES_PATH "Profiles/"
|
2010-04-01 20:48:24 -06:00
|
|
|
|
|
|
|
#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>
|
2010-06-04 23:30:23 -06:00
|
|
|
#include <wx/spinctrl.h>
|
2010-04-01 20:48:24 -06:00
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
#include <vector>
|
|
|
|
|
2010-04-12 23:15:38 -06:00
|
|
|
#include <ControllerInterface/ControllerInterface.h>
|
2010-06-03 12:05:08 -06:00
|
|
|
#include "Config.h"
|
2010-04-01 20:48:24 -06:00
|
|
|
#include "FileSearch.h"
|
|
|
|
|
2010-04-07 21:33:16 -06:00
|
|
|
class PadSetting
|
2010-04-01 20:48:24 -06:00
|
|
|
{
|
2010-04-07 21:33:16 -06:00
|
|
|
protected:
|
2010-04-12 23:15:38 -06:00
|
|
|
PadSetting() {}
|
2010-04-07 21:33:16 -06:00
|
|
|
|
2010-04-01 20:48:24 -06:00
|
|
|
public:
|
2010-04-07 21:33:16 -06:00
|
|
|
virtual void UpdateGUI() = 0;
|
|
|
|
virtual void UpdateValue() = 0;
|
2010-04-12 23:15:38 -06:00
|
|
|
};
|
2010-04-01 20:48:24 -06:00
|
|
|
|
2010-04-12 23:15:38 -06:00
|
|
|
class PadSettingExtension : public wxChoice, public PadSetting
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PadSettingExtension( wxWindow* const parent, ControllerEmu::Extension* const ext );
|
|
|
|
void UpdateGUI();
|
|
|
|
void UpdateValue();
|
|
|
|
|
|
|
|
ControllerEmu::Extension* const extension;
|
2010-04-01 20:48:24 -06:00
|
|
|
};
|
|
|
|
|
2010-06-04 23:30:23 -06:00
|
|
|
class PadSettingChoice : public wxSpinCtrl, public PadSetting
|
2010-04-07 21:33:16 -06:00
|
|
|
{
|
|
|
|
public:
|
2010-06-04 23:30:23 -06:00
|
|
|
PadSettingChoice( wxWindow* const parent, ControllerEmu::ControlGroup::Setting* const setting )
|
|
|
|
: wxSpinCtrl(parent, -1, wxEmptyString, wxDefaultPosition
|
|
|
|
, wxSize( 54, -1 ), 0, setting->low, setting->high, setting->value * 100)
|
|
|
|
, value(setting->value) {}
|
|
|
|
|
2010-04-07 21:33:16 -06:00
|
|
|
void UpdateGUI();
|
|
|
|
void UpdateValue();
|
2010-04-12 23:15:38 -06:00
|
|
|
|
|
|
|
ControlState& value;
|
2010-04-07 21:33:16 -06:00
|
|
|
};
|
|
|
|
|
2010-04-12 23:15:38 -06:00
|
|
|
class PadSettingCheckBox : public wxCheckBox, public PadSetting
|
2010-04-07 21:33:16 -06:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
PadSettingCheckBox( wxWindow* const parent, ControlState& _value, const char* const label );
|
|
|
|
void UpdateGUI();
|
|
|
|
void UpdateValue();
|
|
|
|
|
2010-04-12 23:15:38 -06:00
|
|
|
ControlState& value;
|
|
|
|
};
|
2010-04-07 21:33:16 -06:00
|
|
|
|
2010-04-01 20:48:24 -06:00
|
|
|
class ControlChooser : public wxStaticBoxSizer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ControlChooser( wxWindow* const parent, ControllerInterface::ControlReference* const ref, wxWindow* const eventsink );
|
|
|
|
|
|
|
|
void UpdateGUI();
|
2010-04-14 17:50:33 -06:00
|
|
|
void UpdateListContents();
|
|
|
|
void UpdateListSelection();
|
2010-04-01 20:48:24 -06:00
|
|
|
|
|
|
|
ControllerInterface::ControlReference* control_reference;
|
|
|
|
|
|
|
|
wxTextCtrl* textctrl;
|
|
|
|
wxListBox* control_lbox;
|
|
|
|
wxChoice* mode_cbox;
|
|
|
|
wxSlider* range_slider;
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxStaticText* m_bound_label;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ControlList : public wxDialog
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
ControlList( wxWindow* const parent, ControllerInterface::ControlReference* const ref, ControlChooser* const chooser );
|
|
|
|
|
|
|
|
private:
|
|
|
|
ControlChooser* const m_control_chooser;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ControlDialog : public wxDialog
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ControlDialog( wxWindow* const parent, ControllerInterface::ControlReference* const ref, const std::vector<ControllerInterface::Device*>& devs );
|
2010-04-14 17:50:33 -06:00
|
|
|
|
2010-04-01 20:48:24 -06:00
|
|
|
void SelectControl( wxCommandEvent& event );
|
2010-04-14 17:50:33 -06:00
|
|
|
void DetectControl( wxCommandEvent& event );
|
|
|
|
void ClearControl( wxCommandEvent& event );
|
|
|
|
void SetControl( wxCommandEvent& event );
|
|
|
|
void SetDevice( wxCommandEvent& event );
|
2010-04-01 20:48:24 -06:00
|
|
|
|
|
|
|
ControllerInterface::ControlReference* const control_reference;
|
|
|
|
wxComboBox* device_cbox;
|
|
|
|
ControlChooser* control_chooser;
|
|
|
|
};
|
|
|
|
|
2010-04-12 23:15:38 -06:00
|
|
|
class ExtensionButton : public wxButton
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ExtensionButton( wxWindow* const parent, ControllerEmu::Extension* const ext )
|
|
|
|
: wxButton( parent, -1, wxT("Configure"), wxDefaultPosition )
|
|
|
|
, extension(ext) {}
|
|
|
|
|
|
|
|
ControllerEmu::Extension* const extension;
|
|
|
|
};
|
|
|
|
|
2010-04-01 20:48:24 -06:00
|
|
|
class ControlButton : public wxButton
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ControlButton( wxWindow* const parent, ControllerInterface::ControlReference* const _ref, const unsigned int width, const std::string& label = "" );
|
|
|
|
|
|
|
|
ControllerInterface::ControlReference* const control_reference;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ControlGroupBox : public wxStaticBoxSizer
|
|
|
|
{
|
|
|
|
public:
|
2010-04-12 23:15:38 -06:00
|
|
|
ControlGroupBox( ControllerEmu::ControlGroup* const group, wxWindow* const parent, wxWindow* const eventsink );
|
2010-04-01 20:48:24 -06:00
|
|
|
|
|
|
|
ControllerEmu::ControlGroup* control_group;
|
|
|
|
wxStaticBitmap* static_bitmap;
|
2010-04-07 21:33:16 -06:00
|
|
|
std::vector< PadSetting* > options;
|
2010-04-01 20:48:24 -06:00
|
|
|
std::vector< wxButton* > controls;
|
|
|
|
std::vector<ControlButton*> control_buttons;
|
|
|
|
};
|
|
|
|
|
2010-04-12 23:15:38 -06:00
|
|
|
class ControlGroupsSizer : public wxBoxSizer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ControlGroupsSizer( ControllerEmu* const controller, wxWindow* const parent, wxWindow* const eventsink, std::vector<ControlGroupBox*>* const groups = NULL );
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2010-04-01 20:48:24 -06:00
|
|
|
class ConfigDialog;
|
|
|
|
|
|
|
|
class GamepadPage : public wxNotebookPage
|
|
|
|
{
|
|
|
|
friend class ConfigDialog;
|
|
|
|
|
|
|
|
public:
|
2010-04-14 17:50:33 -06:00
|
|
|
GamepadPage( wxWindow* parent, const unsigned int pad_num, ConfigDialog* const config_dialog );
|
2010-04-01 20:48:24 -06:00
|
|
|
|
|
|
|
void UpdateGUI();
|
|
|
|
|
|
|
|
void RefreshDevices( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void LoadProfile( wxCommandEvent& event );
|
|
|
|
void SaveProfile( wxCommandEvent& event );
|
|
|
|
void DeleteProfile( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void ConfigControl( wxCommandEvent& event );
|
2010-06-04 23:30:23 -06:00
|
|
|
void ClearControl( wxCommandEvent& event );
|
2010-04-01 20:48:24 -06:00
|
|
|
void DetectControl( wxCommandEvent& event );
|
|
|
|
|
2010-04-12 23:15:38 -06:00
|
|
|
void ConfigExtension( wxCommandEvent& event );
|
|
|
|
|
2010-04-01 20:48:24 -06:00
|
|
|
void SetDevice( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void ClearAll( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void AdjustControlOption( wxCommandEvent& event );
|
|
|
|
void AdjustSetting( wxCommandEvent& event );
|
|
|
|
|
|
|
|
wxComboBox* profile_cbox;
|
|
|
|
wxComboBox* device_cbox;
|
|
|
|
|
|
|
|
std::vector<ControlGroupBox*> control_groups;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
ControllerEmu* const controller;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
ControlDialog* m_control_dialog;
|
|
|
|
ConfigDialog* const m_config_dialog;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ConfigDialog : public wxDialog
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
ConfigDialog( wxWindow* const parent, Plugin& plugin, const std::string& name, const bool _is_game_running );
|
|
|
|
~ConfigDialog();
|
|
|
|
|
|
|
|
void ClickSave( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void UpdateDeviceComboBox();
|
|
|
|
void UpdateProfileComboBox();
|
|
|
|
|
|
|
|
void UpdateControlReferences();
|
|
|
|
void UpdateBitmaps(wxTimerEvent&);
|
|
|
|
|
|
|
|
const bool is_game_running;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
wxNotebook* m_pad_notebook;
|
|
|
|
std::vector<GamepadPage*> m_padpages;
|
|
|
|
Plugin& m_plugin;
|
|
|
|
wxTimer* m_update_timer;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|