GTK GUI :

Added a menu to select the video output module
This commit is contained in:
bgk 2008-04-25 09:34:16 +00:00
parent bd20a2e6aa
commit 348caa1b80
4 changed files with 80 additions and 7 deletions

View File

@ -598,6 +598,41 @@
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="VideoMenu_menu">
<child>
<widget class="GtkRadioMenuItem" id="VideoOpenGL">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_OpenGL</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_as_radio">True</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="VideoCairo">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Cairo</property>
<property name="use_underline">True</property>
<property name="draw_as_radio">True</property>
<property name="group">VideoOpenGL</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="VideoXv">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Xvideo</property>
<property name="use_underline">True</property>
<property name="draw_as_radio">True</property>
<property name="group">VideoOpenGL</property>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator57">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="Video1x">
<property name="visible">True</property>

View File

@ -124,8 +124,6 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
vSaveConfig(m_sConfigFile);
}
vInitScreenArea();
vCreateFileOpenDialog();
vLoadHistoryFromConfig();
vLoadJoypadsFromConfig();
@ -133,6 +131,33 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
Gtk::MenuItem * poMI;
Gtk::CheckMenuItem * poCMI;
// Video output menu
//
struct
{
const char * m_csName;
const EVideoOutput m_eVideoOutput;
}
astVideoOutput[] =
{
{ "VideoOpenGL", OutputOpenGL },
{ "VideoCairo", OutputGtk },
{ "VideoXv", OutputXvideo }
};
EVideoOutput eDefaultVideoOutput = (EVideoOutput)m_poDisplayConfig->oGetKey<int>("output");
for (guint i = 0; i < G_N_ELEMENTS(astVideoOutput); i++)
{
poCMI = dynamic_cast<Gtk::CheckMenuItem *>(_poXml->get_widget(astVideoOutput[i].m_csName));
if (astVideoOutput[i].m_eVideoOutput == eDefaultVideoOutput)
{
poCMI->set_active();
vOnVideoOutputToggled(poCMI, eDefaultVideoOutput);
}
poCMI->signal_toggled().connect(sigc::bind(
sigc::mem_fun(*this, &Window::vOnVideoOutputToggled),
poCMI, astVideoOutput[i].m_eVideoOutput));
}
// File menu
//
poMI = dynamic_cast<Gtk::MenuItem *>(_poXml->get_widget("FileOpen"));
@ -861,17 +886,17 @@ Window::~Window()
m_poInstance = NULL;
}
void Window::vInitScreenArea()
void Window::vInitScreenArea(EVideoOutput _eVideoOutput)
{
Gtk::Alignment * poC;
poC = dynamic_cast<Gtk::Alignment *>(m_poXml->get_widget("ScreenContainer"));
poC->remove();
poC->set(Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER, 0.0, 0.0);
EVideoOutput eVideoOutput = (EVideoOutput)m_poDisplayConfig->oGetKey<int>("output");
try
{
switch (eVideoOutput)
switch (_eVideoOutput)
{
#ifdef USE_OPENGL
case OutputOpenGL:

View File

@ -159,6 +159,7 @@ protected:
virtual void vOnFrameskipToggled(Gtk::CheckMenuItem * _poCMI, int _iValue);
virtual void vOnThrottleToggled(Gtk::CheckMenuItem * _poCMI, int _iPercent);
virtual void vOnThrottleOther(Gtk::CheckMenuItem * _poCMI);
virtual void vOnVideoOutputToggled(Gtk::CheckMenuItem * _poCMI, int _iOutput);
virtual void vOnVideoScaleToggled(Gtk::CheckMenuItem * _poCMI, int _iScale);
virtual void vOnLayerToggled(Gtk::CheckMenuItem * _poCMI, int _iLayer);
virtual void vOnDirectories();
@ -291,7 +292,7 @@ private:
void vUnInitSystem();
void vInitConfig();
void vCheckConfig();
void vInitScreenArea();
void vInitScreenArea(EVideoOutput _eVideoOutput);
void vLoadConfig(const std::string & _rsFile);
void vSaveConfig(const std::string & _rsFile);
void vLoadHistoryFromConfig();

View File

@ -590,6 +590,18 @@ void Window::vOnThrottleOther(Gtk::CheckMenuItem * _poCMI)
vSelectBestThrottleItem();
}
void Window::vOnVideoOutputToggled(Gtk::CheckMenuItem * _poCMI, int _iOutput)
{
if (! _poCMI->get_active())
{
return;
}
m_poDisplayConfig->vSetKey("output", _iOutput);
vInitScreenArea((EVideoOutput)_iOutput);
}
void Window::vOnVideoScaleToggled(Gtk::CheckMenuItem * _poCMI, int _iScale)
{
if (! _poCMI->get_active())