GTK : Moved the video scale selection to the display config dialog

This commit is contained in:
bgk 2008-10-28 09:20:13 +00:00
parent 22608c2585
commit a24c229a28
7 changed files with 98 additions and 102 deletions

View File

@ -35,12 +35,14 @@ DisplayConfigDialog::DisplayConfigDialog(GtkDialog* _pstDialog, const Glib::RefP
{
refBuilder->get_widget("FiltersComboBox", m_poFiltersComboBox);
refBuilder->get_widget("IBFiltersComboBox", m_poIBFiltersComboBox);
refBuilder->get_widget("DefaultScaleComboBox", m_poDefaultScaleComboBox);
refBuilder->get_widget("OutputOpenGL", m_poOutputOpenGLRadioButton);
refBuilder->get_widget("OutputCairo", m_poOutputCairoRadioButton);
refBuilder->get_widget("OutputXv", m_poOutputXvRadioButton);
m_poFiltersComboBox->signal_changed().connect(sigc::mem_fun(*this, &DisplayConfigDialog::vOnFilterChanged));
m_poIBFiltersComboBox->signal_changed().connect(sigc::mem_fun(*this, &DisplayConfigDialog::vOnFilterIBChanged));
m_poDefaultScaleComboBox->signal_changed().connect(sigc::mem_fun(*this, &DisplayConfigDialog::vOnScaleChanged));
m_poOutputOpenGLRadioButton->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &DisplayConfigDialog::vOnOutputChanged), VBA::Window::OutputOpenGL));
m_poOutputCairoRadioButton->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &DisplayConfigDialog::vOnOutputChanged), VBA::Window::OutputCairo));
m_poOutputXvRadioButton->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &DisplayConfigDialog::vOnOutputChanged), VBA::Window::OutputXvideo));
@ -78,6 +80,9 @@ void DisplayConfigDialog::vSetConfig(Config::Section * _poConfig, VBA::Window *
int iDefaultFilterIB = m_poConfig->oGetKey<int>("filterIB");
m_poIBFiltersComboBox->set_active(iDefaultFilterIB);
int iDefaultScale = m_poConfig->oGetKey<int>("scale");
m_poDefaultScaleComboBox->set_active(iDefaultScale - 1);
// Set the default output module
VBA::Window::EVideoOutput _eOutput = (VBA::Window::EVideoOutput)m_poConfig->oGetKey<int>("output");
switch (_eOutput)
@ -126,4 +131,14 @@ void DisplayConfigDialog::vOnOutputChanged(VBA::Window::EVideoOutput _eOutput)
m_poWindow->vApplyConfigScreenArea();
}
void DisplayConfigDialog::vOnScaleChanged()
{
int iScale = m_poDefaultScaleComboBox->get_active_row_number() + 1;
if (iScale > 0)
{
m_poConfig->vSetKey("scale", iScale);
m_poWindow->vUpdateScreen();
}
}
} // namespace VBA

View File

@ -40,12 +40,14 @@ private:
void vOnFilterChanged();
void vOnFilterIBChanged();
void vOnOutputChanged(VBA::Window::EVideoOutput _eOutput);
void vOnScaleChanged();
VBA::Window * m_poWindow;
Config::Section * m_poConfig;
Gtk::ComboBox * m_poFiltersComboBox;
Gtk::ComboBox * m_poIBFiltersComboBox;
Gtk::ComboBox * m_poDefaultScaleComboBox;
Gtk::RadioButton * m_poOutputOpenGLRadioButton;
Gtk::RadioButton * m_poOutputCairoRadioButton;
Gtk::RadioButton * m_poOutputXvRadioButton;

View File

@ -18,6 +18,31 @@
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="ScalingListStore">
<columns>
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0">1x</col>
</row>
<row>
<col id="0">2x</col>
</row>
<row>
<col id="0">3x</col>
</row>
<row>
<col id="0">4x</col>
</row>
<row>
<col id="0">5x</col>
</row>
<row>
<col id="0">6x</col>
</row>
</data>
</object>
<object class="GtkDialog" id="dialog1">
<property name="border_width">5</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
@ -91,6 +116,61 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Default scaling : </property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</object>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="DefaultScaleComboBox">
<property name="visible">True</property>
<property name="model">ScalingListStore</property>
<child>
<object class="GtkCellRendererText" id="renderer3"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Zoom&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame3">
<property name="visible">True</property>

View File

@ -452,65 +452,6 @@
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="VideoMenu">
<property name="visible">True</property>
<property name="label" translatable="yes">_Video</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="VideoMenu_menu">
<child>
<widget class="GtkRadioMenuItem" id="Video1x">
<property name="visible">True</property>
<property name="label" translatable="yes">_1x</property>
<property name="use_underline">True</property>
<property name="active">True</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="Video2x">
<property name="visible">True</property>
<property name="label" translatable="yes">_2x</property>
<property name="use_underline">True</property>
<property name="group">Video1x</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="Video3x">
<property name="visible">True</property>
<property name="label" translatable="yes">_3x</property>
<property name="use_underline">True</property>
<property name="group">Video1x</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="Video4x">
<property name="visible">True</property>
<property name="label" translatable="yes">_4x</property>
<property name="use_underline">True</property>
<property name="group">Video1x</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="Video5x">
<property name="visible">True</property>
<property name="label" translatable="yes">_5x</property>
<property name="use_underline">True</property>
<property name="group">Video1x</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="Video6x">
<property name="visible">True</property>
<property name="label" translatable="yes">_6x</property>
<property name="use_underline">True</property>
<property name="group">Video1x</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="EmulatorMenu">
<property name="visible">True</property>

View File

@ -281,36 +281,6 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
poCMI, astFrameskip[i].m_iFrameskip));
}
// Video menu
//
struct
{
const char * m_csName;
const int m_iScale;
}
astVideoScale[] =
{
{ "Video1x", 1 },
{ "Video2x", 2 },
{ "Video3x", 3 },
{ "Video4x", 4 },
{ "Video5x", 5 },
{ "Video6x", 6 }
};
int iDefaultScale = m_poDisplayConfig->oGetKey<int>("scale");
for (guint i = 0; i < G_N_ELEMENTS(astVideoScale); i++)
{
poCMI = dynamic_cast<Gtk::CheckMenuItem *>(_poXml->get_widget(astVideoScale[i].m_csName));
if (astVideoScale[i].m_iScale == iDefaultScale)
{
poCMI->set_active();
vOnVideoScaleToggled(poCMI, iDefaultScale);
}
poCMI->signal_toggled().connect(sigc::bind(
sigc::mem_fun(*this, &Window::vOnVideoScaleToggled),
poCMI, astVideoScale[i].m_iScale));
}
// Emulator menu
//
poMI = dynamic_cast<Gtk::MenuItem *>(_poXml->get_widget("DirectoriesConfigure"));

View File

@ -78,6 +78,7 @@ public:
void vApplyConfigFilter();
void vApplyConfigFilterIB();
void vApplyConfigScreenArea();
void vUpdateScreen();
inline ECartridge eGetCartridge() const { return m_eCartridge; }
@ -148,7 +149,6 @@ protected:
virtual void vOnFileExit();
virtual void vOnFrameskipToggled(Gtk::CheckMenuItem * _poCMI, int _iValue);
virtual void vOnVideoFullscreen();
virtual void vOnVideoScaleToggled(Gtk::CheckMenuItem * _poCMI, int _iScale);
virtual void vOnDirectories();
virtual void vOnPauseWhenInactiveToggled(Gtk::CheckMenuItem * _poCMI);
virtual void vOnSelectBios();
@ -270,7 +270,6 @@ private:
void vHistoryAdd(const std::string & _rsFile);
void vApplyConfigJoypads();
void vSaveJoypadsToConfig();
void vUpdateScreen();
void vDrawDefaultScreen();
void vSetDefaultTitle();
void vCreateFileOpenDialog();

View File

@ -363,17 +363,6 @@ void Window::vOnVideoFullscreen()
vToggleFullscreen();
}
void Window::vOnVideoScaleToggled(Gtk::CheckMenuItem * _poCMI, int _iScale)
{
if (! _poCMI->get_active())
{
return;
}
m_poDisplayConfig->vSetKey("scale", _iScale);
vUpdateScreen();
}
void Window::vOnDirectories()
{
DirectoriesConfigDialog oDialog(m_poDirConfig);