GTK :
Moved default joypad selection to the joypad config dialog.
This commit is contained in:
parent
3d34d0d9eb
commit
e8b08761c9
|
@ -45,6 +45,7 @@ JoypadConfigDialog::JoypadConfigDialog() :
|
|||
Gtk::Dialog("Joypad config", true, true),
|
||||
m_oTitleHBox(false, 5),
|
||||
m_oTitleLabel("Joypad :", Gtk::ALIGN_RIGHT),
|
||||
m_oDefaultJoypad("Default joypad"),
|
||||
m_oTable(G_N_ELEMENTS(m_astKeys), 2, false),
|
||||
m_ePad(PAD_MAIN)
|
||||
{
|
||||
|
@ -78,14 +79,17 @@ JoypadConfigDialog::JoypadConfigDialog() :
|
|||
m_oTitleHBox.set_border_width(5);
|
||||
m_oTable.set_border_width(5);
|
||||
m_oTable.set_spacings(5);
|
||||
get_vbox()->set_spacing(5);
|
||||
get_vbox()->pack_start(m_oTitleHBox);
|
||||
get_vbox()->pack_start(m_oSeparator);
|
||||
get_vbox()->pack_start(m_oDefaultJoypad);
|
||||
get_vbox()->pack_start(m_oTable);
|
||||
|
||||
// Signals and default values
|
||||
m_oConfigSig = Glib::signal_idle().connect(sigc::mem_fun(*this, &JoypadConfigDialog::bOnConfigIdle),
|
||||
Glib::PRIORITY_DEFAULT_IDLE);
|
||||
|
||||
m_oDefaultJoypad.signal_toggled().connect(sigc::mem_fun(*this,
|
||||
&JoypadConfigDialog::vOnDefaultJoypadSelect) );
|
||||
m_oTitleCombo.signal_changed().connect(sigc::mem_fun(*this,
|
||||
&JoypadConfigDialog::vOnJoypadSelect) );
|
||||
m_oTitleCombo.set_active_text("1");
|
||||
|
@ -100,9 +104,11 @@ JoypadConfigDialog::~JoypadConfigDialog()
|
|||
|
||||
void JoypadConfigDialog::vUpdateEntries()
|
||||
{
|
||||
m_oDefaultJoypad.set_active(inputGetDefaultJoypad() == m_ePad);
|
||||
|
||||
for (guint i = 0; i < m_oEntries.size(); i++)
|
||||
{
|
||||
const char * csName = 0;
|
||||
const char * csName = 0;
|
||||
|
||||
guint uiKeyval = inputGetKeymap(m_ePad, m_astKeys[i].m_eKeyFlag);
|
||||
int dev = uiKeyval >> 16;
|
||||
|
@ -267,4 +273,16 @@ void JoypadConfigDialog::vOnJoypadSelect()
|
|||
vUpdateEntries();
|
||||
}
|
||||
|
||||
void JoypadConfigDialog::vOnDefaultJoypadSelect()
|
||||
{
|
||||
if (m_oDefaultJoypad.get_active())
|
||||
{
|
||||
inputSetDefaultJoypad(m_ePad);
|
||||
}
|
||||
else
|
||||
{
|
||||
inputSetDefaultJoypad(PAD_MAIN);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace VBA
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <gtkmm/entry.h>
|
||||
#include <gtkmm/comboboxtext.h>
|
||||
#include <gtkmm/separator.h>
|
||||
#include <gtkmm/checkbutton.h>
|
||||
|
||||
#include "../sdl/inputSDL.h"
|
||||
|
||||
|
@ -58,6 +59,7 @@ private:
|
|||
Gtk::Label m_oTitleLabel;
|
||||
Gtk::ComboBoxText m_oTitleCombo;
|
||||
Gtk::HSeparator m_oSeparator;
|
||||
Gtk::CheckButton m_oDefaultJoypad;
|
||||
Gtk::Table m_oTable;
|
||||
Gtk::Button * m_poOkButton;
|
||||
std::vector<Gtk::Entry *> m_oEntries;
|
||||
|
@ -69,6 +71,7 @@ private:
|
|||
|
||||
bool bOnConfigIdle();
|
||||
void vOnJoypadSelect();
|
||||
void vOnDefaultJoypadSelect();
|
||||
void vUpdateEntries();
|
||||
void vEmptyEventQueue();
|
||||
};
|
||||
|
|
|
@ -1044,48 +1044,6 @@
|
|||
<property name="use_underline">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkSeparatorMenuItem" id="separator18">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkRadioMenuItem" id="Joypad1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_1</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkRadioMenuItem" id="Joypad2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_2</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="group">Joypad1</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkRadioMenuItem" id="Joypad3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_3</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="group">Joypad1</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkRadioMenuItem" id="Joypad4">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_4</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="group">Joypad1</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkSeparatorMenuItem" id="separator24">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="AutofireMenu">
|
||||
<property name="visible">True</property>
|
||||
|
|
|
@ -614,22 +614,8 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
|
|||
poMI = dynamic_cast<Gtk::MenuItem *>(_poXml->get_widget("JoypadConfigure"));
|
||||
poMI->signal_activate().connect(sigc::mem_fun(*this, &Window::vOnJoypadConfigure));
|
||||
|
||||
int iDefaultJoypad = m_poInputConfig->oGetKey<int>("active_joypad");
|
||||
for (int i = m_iJoypadMin; i <= m_iJoypadMax; i++)
|
||||
{
|
||||
char csName[20];
|
||||
snprintf(csName, sizeof(csName), "Joypad%d", i + 1);
|
||||
|
||||
poCMI = dynamic_cast<Gtk::CheckMenuItem *>(_poXml->get_widget(csName));
|
||||
if (i == iDefaultJoypad)
|
||||
{
|
||||
poCMI->set_active();
|
||||
vOnJoypadToggled(poCMI, (EPad)iDefaultJoypad);
|
||||
}
|
||||
poCMI->signal_toggled().connect(sigc::bind(
|
||||
sigc::mem_fun(*this, &Window::vOnJoypadToggled),
|
||||
poCMI, (EPad)i));
|
||||
}
|
||||
EPad eDefaultJoypad = (EPad)m_poInputConfig->oGetKey<int>("active_joypad");
|
||||
inputSetDefaultJoypad(eDefaultJoypad);
|
||||
|
||||
// Autofire menu
|
||||
//
|
||||
|
|
|
@ -160,7 +160,6 @@ protected:
|
|||
virtual void vOnFilter2xToggled(Gtk::CheckMenuItem * _poCMI, int _iFilter2x);
|
||||
virtual void vOnFilterIBToggled(Gtk::CheckMenuItem * _poCMI, int _iFilterIB);
|
||||
virtual void vOnJoypadConfigure();
|
||||
virtual void vOnJoypadToggled(Gtk::CheckMenuItem * _poCMI, EPad _eJoypad);
|
||||
virtual void vOnAutofireToggled(Gtk::CheckMenuItem * _poCMI, EKey _eKey);
|
||||
virtual void vOnHelpAbout();
|
||||
virtual bool bOnEmuIdle();
|
||||
|
|
|
@ -641,18 +641,8 @@ void Window::vOnJoypadConfigure()
|
|||
JoypadConfigDialog oDialog;
|
||||
oDialog.set_transient_for(*this);
|
||||
oDialog.run();
|
||||
}
|
||||
|
||||
void Window::vOnJoypadToggled(Gtk::CheckMenuItem * _poCMI, EPad _eJoypad)
|
||||
{
|
||||
if (! _poCMI->get_active())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
inputSetDefaultJoypad(_eJoypad);
|
||||
|
||||
m_poInputConfig->vSetKey("active_joypad", _eJoypad);
|
||||
m_poInputConfig->vSetKey("active_joypad", inputGetDefaultJoypad());
|
||||
}
|
||||
|
||||
void Window::vOnAutofireToggled(Gtk::CheckMenuItem * _poCMI, EKey _eKey)
|
||||
|
|
|
@ -600,3 +600,8 @@ void inputSetDefaultJoypad(EPad pad)
|
|||
{
|
||||
sdlDefaultJoypad = pad;
|
||||
}
|
||||
|
||||
EPad inputGetDefaultJoypad()
|
||||
{
|
||||
return sdlDefaultJoypad;
|
||||
}
|
||||
|
|
|
@ -128,8 +128,14 @@ int inputGetSensorY();
|
|||
|
||||
/**
|
||||
* Set which joypad configuration use when the core doesn't ask for a specific
|
||||
* pad
|
||||
* @param pad Default pad
|
||||
*/
|
||||
void inputSetDefaultJoypad(EPad pad);
|
||||
|
||||
/**
|
||||
* Get the default joypad
|
||||
* pad
|
||||
*/
|
||||
EPad inputGetDefaultJoypad();
|
||||
|
||||
#endif // VBAM_SDL_INPUT_H
|
||||
|
|
Loading…
Reference in New Issue