GTK : WIP display config dialog

This commit is contained in:
bgk 2008-10-27 19:48:33 +00:00
parent ec3e07d6a8
commit 0656b44a39
9 changed files with 492 additions and 330 deletions

View File

@ -207,6 +207,7 @@ SET(SRC_GTK
src/gtk/filters.cpp
src/gtk/joypadconfig.cpp
src/gtk/directoriesconfig.cpp
src/gtk/displayconfig.cpp
src/gtk/screenarea.cpp
src/gtk/screenarea-cairo.cpp
src/gtk/screenarea-xvideo.cpp

View File

@ -19,8 +19,6 @@
#ifndef __VBA_DIRECTORIESCONFIG_H__
#define __VBA_DIRECTORIESCONFIG_H__
#include <vector>
#include <gtkmm/dialog.h>
#include <gtkmm/label.h>
#include <gtkmm/table.h>

163
src/gtk/displayconfig.cpp Normal file
View File

@ -0,0 +1,163 @@
// -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 2008 VBA-M development team
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or(at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "displayconfig.h"
#include <gtkmm/stock.h>
#include <gtkmm/frame.h>
#include <gtkmm/radiobutton.h>
#include <gtkmm/liststore.h>
#include "intl.h"
#include "filters.h"
namespace VBA
{
DisplayConfigDialog::DisplayConfigDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder) :
Gtk::Dialog(_pstDialog),
m_poConfig(0)
{
//TODO Move to filters.h
struct
{
const char * m_csName;
const EFilter2x m_eFilter;
}
astFilter[] =
{
{ "None", FilterNone },
{ "2xSaI", Filter2xSaI },
{ "Super 2xSaI", FilterSuper2xSaI },
{ "Super Eagle", FilterSuperEagle },
{ "Pixelate", FilterPixelate },
{ "AdvanceMAME Scale2x", FilterAdMame2x },
{ "Bilinear", FilterBilinear },
{ "Bilinear Plus", FilterBilinearPlus },
{ "Scanlines", FilterScanlines },
{ "TV Mode", FilterScanlinesTV },
{ "hq2x", FilterHq2x },
{ "lq2x", FilterLq2x }
};
struct
{
const char * m_csName;
const EFilterIB m_eFilterIB;
}
astFilterIB[] =
{
{ "None", FilterIBNone },
{ "Smart interframe blending", FilterIBSmart },
{ "Interframe motion blur", FilterIBMotionBlur }
};
refBuilder->get_widget("FiltersComboBox", m_poFiltersComboBox);
refBuilder->get_widget("IBFiltersComboBox", m_poIBFiltersComboBox);
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_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));
// Populate the filters combobox
Glib::RefPtr<Gtk::ListStore> poFiltersListStore;
poFiltersListStore = Glib::RefPtr<Gtk::ListStore>::cast_static(refBuilder->get_object("FiltersListStore"));
for (guint i = 0; i < G_N_ELEMENTS(astFilter); i++)
{
Gtk::TreeModel::Row row = *(poFiltersListStore->append());
row->set_value(0, std::string(astFilter[i].m_csName));
}
// Populate the interframe blending filters combobox
Glib::RefPtr<Gtk::ListStore> poIBFiltersListStore;
poIBFiltersListStore = Glib::RefPtr<Gtk::ListStore>::cast_static(refBuilder->get_object("IBFiltersListStore"));
for (guint i = 0; i < G_N_ELEMENTS(astFilterIB); i++)
{
Gtk::TreeModel::Row row = *(poIBFiltersListStore->append());
row->set_value(0, std::string(astFilterIB[i].m_csName));
}
}
void DisplayConfigDialog::vSetConfig(Config::Section * _poConfig, VBA::Window * _poWindow)
{
m_poConfig = _poConfig;
m_poWindow = _poWindow;
int iDefaultFilter = m_poConfig->oGetKey<int>("filter2x");
m_poFiltersComboBox->set_active(iDefaultFilter);
int iDefaultFilterIB = m_poConfig->oGetKey<int>("filterIB");
m_poIBFiltersComboBox->set_active(iDefaultFilterIB);
// Set the default output module
VBA::Window::EVideoOutput _eOutput = (VBA::Window::EVideoOutput)m_poConfig->oGetKey<int>("output");
switch (_eOutput)
{
case VBA::Window::OutputOpenGL:
m_poOutputOpenGLRadioButton->set_active();
break;
case VBA::Window::OutputXvideo:
m_poOutputXvRadioButton->set_active();
break;
default:
m_poOutputCairoRadioButton->set_active();
break;
}
}
void DisplayConfigDialog::vOnFilterChanged()
{
int iFilter = m_poFiltersComboBox->get_active_row_number();
if (iFilter >= 0)
{
m_poConfig->vSetKey("filter2x", iFilter);
m_poWindow->vApplyConfigFilter();
}
}
void DisplayConfigDialog::vOnFilterIBChanged()
{
int iFilterIB = m_poIBFiltersComboBox->get_active_row_number();
if (iFilterIB >= 0)
{
m_poConfig->vSetKey("filterIB", iFilterIB);
m_poWindow->vApplyConfigFilterIB();
}
}
void DisplayConfigDialog::vOnOutputChanged(VBA::Window::EVideoOutput _eOutput)
{
if (_eOutput == VBA::Window::OutputOpenGL && m_poOutputOpenGLRadioButton->get_active())
m_poConfig->vSetKey("output", VBA::Window::OutputOpenGL);
else if (_eOutput == VBA::Window::OutputCairo && m_poOutputCairoRadioButton->get_active())
m_poConfig->vSetKey("output", VBA::Window::OutputCairo);
else if (_eOutput == VBA::Window::OutputXvideo && m_poOutputXvRadioButton->get_active())
m_poConfig->vSetKey("output", VBA::Window::OutputXvideo);
m_poWindow->vApplyConfigScreenArea();
}
} // namespace VBA

57
src/gtk/displayconfig.h Normal file
View File

@ -0,0 +1,57 @@
// -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 2008 VBA-M development team
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or(at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef __VBA_DISPLAYCONFIG_H__
#define __VBA_DISPLAYCONFIG_H__
#include <gtkmm/dialog.h>
#include <gtkmm/builder.h>
#include <gtkmm/combobox.h>
#include "configfile.h"
#include "window.h"
namespace VBA
{
class DisplayConfigDialog : public Gtk::Dialog
{
public:
DisplayConfigDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder);
void vSetConfig(Config::Section * _poConfig, VBA::Window * _poWindow);
private:
void vOnFilterChanged();
void vOnFilterIBChanged();
void vOnOutputChanged(VBA::Window::EVideoOutput _eOutput);
VBA::Window * m_poWindow;
Config::Section * m_poConfig;
Gtk::ComboBox * m_poFiltersComboBox;
Gtk::ComboBox * m_poIBFiltersComboBox;
Gtk::RadioButton * m_poOutputOpenGLRadioButton;
Gtk::RadioButton * m_poOutputCairoRadioButton;
Gtk::RadioButton * m_poOutputXvRadioButton;
};
} // namespace VBA
#endif // __VBA_DISPLAYCONFIG_H__

211
src/gtk/ui/display.ui Normal file
View File

@ -0,0 +1,211 @@
<?xml version="1.0"?>
<interface>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">600</property>
<property name="lower">100</property>
<property name="page_increment">10</property>
<property name="step_increment">100</property>
<property name="page_size">10</property>
<property name="value">100</property>
</object>
<object class="GtkListStore" id="IBFiltersListStore">
<columns>
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="FiltersListStore">
<columns>
<column type="gchararray"/>
</columns>
</object>
<object class="GtkDialog" id="dialog1">
<property name="border_width">5</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<child>
<object class="GtkRadioButton" id="OutputOpenGL">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">OpenGL</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
</child>
<child>
<object class="GtkRadioButton" id="OutputCairo">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Cairo</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">OutputOpenGL</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="OutputXv">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">XVideo</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">OutputOpenGL</property>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Module de sortie&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame3">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<object class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<object class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<child>
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Interframe blending : </property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Fullscreen filter : </property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="IBFiltersComboBox">
<property name="visible">True</property>
<property name="model">IBFiltersListStore</property>
<child>
<object class="GtkCellRendererText" id="renderer1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="FiltersComboBox">
<property name="visible">True</property>
<property name="model">FiltersListStore</property>
<child>
<object class="GtkCellRendererText" id="renderer2"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Filters&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="position">3</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="label" translatable="yes">gtk-close</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="1">button1</action-widget>
</action-widgets>
</object>
</interface>

View File

@ -459,41 +459,6 @@
<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>
@ -872,150 +837,10 @@
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="FilterMenu">
<widget class="GtkMenuItem" id="DisplayConfigure">
<property name="visible">True</property>
<property name="label" translatable="yes">F_ilter</property>
<property name="label" translatable="yes">_Display ...</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="FilterMenu_menu">
<child>
<widget class="GtkMenuItem" id="InterframeBlendingMenu">
<property name="visible">True</property>
<property name="label" translatable="yes">Interframe _blending</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="InterframeBlendingMenu_menu">
<child>
<widget class="GtkRadioMenuItem" id="IFBNone">
<property name="visible">True</property>
<property name="label" translatable="yes">_None</property>
<property name="use_underline">True</property>
<property name="active">True</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="IFBSmart">
<property name="visible">True</property>
<property name="label" translatable="yes">_Smart</property>
<property name="use_underline">True</property>
<property name="group">IFBNone</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="IFBMotionBlur">
<property name="visible">True</property>
<property name="label" translatable="yes">_Motion Blur</property>
<property name="use_underline">True</property>
<property name="group">IFBNone</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator20">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="FilterNone">
<property name="visible">True</property>
<property name="label" translatable="yes">_None</property>
<property name="use_underline">True</property>
<property name="active">True</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="FilterTVMode">
<property name="visible">True</property>
<property name="label" translatable="yes">_TV Mode</property>
<property name="use_underline">True</property>
<property name="group">FilterNone</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="Filter2xSaI">
<property name="visible">True</property>
<property name="label" translatable="yes">_2xSaI</property>
<property name="use_underline">True</property>
<property name="group">FilterNone</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="FilterSuper2xSaI">
<property name="visible">True</property>
<property name="label" translatable="yes">_Super 2xSaI</property>
<property name="use_underline">True</property>
<property name="group">FilterNone</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="FilterSuperEagle">
<property name="visible">True</property>
<property name="label" translatable="yes">Super _Eagle</property>
<property name="use_underline">True</property>
<property name="group">FilterNone</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="FilterPixelate">
<property name="visible">True</property>
<property name="label" translatable="yes">_Pixelate</property>
<property name="use_underline">True</property>
<property name="group">FilterNone</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="FilterAdvanceMame2x">
<property name="visible">True</property>
<property name="label" translatable="yes">_AdvanceMAME 2x</property>
<property name="use_underline">True</property>
<property name="group">FilterNone</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="FilterBilinear">
<property name="visible">True</property>
<property name="label" translatable="yes">Bilinea_r</property>
<property name="use_underline">True</property>
<property name="group">FilterNone</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="FilterBilinearPlus">
<property name="visible">True</property>
<property name="label" translatable="yes">Bilinear Pl_us</property>
<property name="use_underline">True</property>
<property name="group">FilterNone</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="FilterScanlines">
<property name="visible">True</property>
<property name="label" translatable="yes">S_canlines</property>
<property name="use_underline">True</property>
<property name="group">FilterNone</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="FilterHq2x">
<property name="visible">True</property>
<property name="label" translatable="yes">h_q2x</property>
<property name="use_underline">True</property>
<property name="group">FilterNone</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="FilterLq2x">
<property name="visible">True</property>
<property name="label" translatable="yes">_lq2x</property>
<property name="use_underline">True</property>
<property name="group">FilterNone</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>

View File

@ -140,7 +140,10 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
}
vCreateFileOpenDialog();
vLoadJoypadsFromConfig();
vApplyConfigJoypads();
vApplyConfigScreenArea();
vApplyConfigFilter();
vApplyConfigFilterIB();
Gtk::MenuItem * poMI;
Gtk::CheckMenuItem * poCMI;
@ -148,33 +151,6 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
// Menu bar
m_poMenuBar = dynamic_cast<Gtk::MenuBar *>(_poXml->get_widget("MenuBar"));
// Video output menu
//
struct
{
const char * m_csName;
const EVideoOutput m_eVideoOutput;
}
astVideoOutput[] =
{
{ "VideoOpenGL", OutputOpenGL },
{ "VideoCairo", OutputCairo },
{ "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"));
@ -549,68 +525,9 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
poCMI, astEmulatorType[i].m_eEmulatorType));
}
// Filter menu
//
struct
{
const char * m_csName;
const EFilter2x m_eFilter2x;
}
astFilter2x[] =
{
{ "FilterNone", FilterNone },
{ "FilterTVMode", FilterScanlinesTV },
{ "Filter2xSaI", Filter2xSaI },
{ "FilterSuper2xSaI", FilterSuper2xSaI },
{ "FilterSuperEagle", FilterSuperEagle },
{ "FilterPixelate", FilterPixelate },
{ "FilterAdvanceMame2x", FilterAdMame2x },
{ "FilterBilinear", FilterBilinear },
{ "FilterBilinearPlus", FilterBilinearPlus },
{ "FilterScanlines", FilterScanlines },
{ "FilterHq2x", FilterHq2x },
{ "FilterLq2x", FilterLq2x }
};
EFilter2x eDefaultFilter2x = (EFilter2x)m_poDisplayConfig->oGetKey<int>("filter2x");
for (guint i = 0; i < G_N_ELEMENTS(astFilter2x); i++)
{
poCMI = dynamic_cast<Gtk::CheckMenuItem *>(_poXml->get_widget(astFilter2x[i].m_csName));
if (astFilter2x[i].m_eFilter2x == eDefaultFilter2x)
{
poCMI->set_active();
vOnFilter2xToggled(poCMI, eDefaultFilter2x);
}
poCMI->signal_toggled().connect(sigc::bind(
sigc::mem_fun(*this, &Window::vOnFilter2xToggled),
poCMI, astFilter2x[i].m_eFilter2x));
}
// Interframe blending menu
//
struct
{
const char * m_csName;
const EFilterIB m_eFilterIB;
}
astFilterIB[] =
{
{ "IFBNone", FilterIBNone },
{ "IFBSmart", FilterIBSmart },
{ "IFBMotionBlur", FilterIBMotionBlur }
};
EFilterIB eDefaultFilterIB = (EFilterIB)m_poDisplayConfig->oGetKey<int>("filterIB");
for (guint i = 0; i < G_N_ELEMENTS(astFilterIB); i++)
{
poCMI = dynamic_cast<Gtk::CheckMenuItem *>(_poXml->get_widget(astFilterIB[i].m_csName));
if (astFilterIB[i].m_eFilterIB == eDefaultFilterIB)
{
poCMI->set_active();
vOnFilterIBToggled(poCMI, eDefaultFilterIB);
}
poCMI->signal_toggled().connect(sigc::bind(
sigc::mem_fun(*this, &Window::vOnFilterIBToggled),
poCMI, astFilterIB[i].m_eFilterIB));
}
// Display menu
poMI = dynamic_cast<Gtk::MenuItem *>(_poXml->get_widget("DisplayConfigure"));
poMI->signal_activate().connect(sigc::mem_fun(*this, &Window::vOnDisplayConfigure));
// Joypad menu
//
@ -713,8 +630,10 @@ void Window::vInitColors(EColorFormat _eColorFormat)
Init_2xSaI(32);
}
void Window::vInitScreenArea(EVideoOutput _eVideoOutput)
void Window::vApplyConfigScreenArea()
{
EVideoOutput eVideoOutput = (EVideoOutput)m_poDisplayConfig->oGetKey<int>("output");;
Gtk::Alignment * poC;
poC = dynamic_cast<Gtk::Alignment *>(m_poXml->get_widget("ScreenContainer"));
@ -723,7 +642,7 @@ void Window::vInitScreenArea(EVideoOutput _eVideoOutput)
try
{
switch (_eVideoOutput)
switch (eVideoOutput)
{
#ifdef USE_OPENGL
case OutputOpenGL:
@ -879,10 +798,6 @@ void Window::vInitConfig()
inputGetKeymap(PAD_DEFAULT, m_astJoypad[j].m_eKeyFlag));
}
}
m_poInputConfig->vSetKey("autofire_A", false );
m_poInputConfig->vSetKey("autofire_B", false );
m_poInputConfig->vSetKey("autofire_L", false );
m_poInputConfig->vSetKey("autofire_R", false );
}
void Window::vCheckConfig()
@ -1053,6 +968,26 @@ void Window::vSaveConfig(const std::string & _rsFile)
}
}
void Window::vApplyConfigFilter()
{
int iFilter = m_poDisplayConfig->oGetKey<int>("filter2x");
m_poScreenArea->vSetFilter2x((EFilter2x)iFilter);
if (emulating)
{
vDrawScreen();
}
}
void Window::vApplyConfigFilterIB()
{
int iFilter = m_poDisplayConfig->oGetKey<int>("filterIB");
m_poScreenArea->vSetFilterIB((EFilterIB)iFilter);
if (emulating)
{
vDrawScreen();
}
}
void Window::vHistoryAdd(const std::string & _rsFile)
{
std::string sURL = "file://" + _rsFile;
@ -1060,7 +995,7 @@ void Window::vHistoryAdd(const std::string & _rsFile)
m_poRecentManager->add_item(sURL);
}
void Window::vLoadJoypadsFromConfig()
void Window::vApplyConfigJoypads()
{
for (int i = m_iJoypadMin; i <= m_iJoypadMax; i++)
{

View File

@ -53,6 +53,13 @@ public:
CartridgeGBA
};
enum EVideoOutput
{
OutputCairo,
OutputOpenGL,
OutputXvideo
};
// GB/GBA screen sizes
const int m_iGBScreenWidth;
const int m_iGBScreenHeight;
@ -68,6 +75,9 @@ public:
void vComputeFrameskip(int _iRate);
void vShowSpeed(int _iSpeed);
void vCaptureScreen(int _iNum);
void vApplyConfigFilter();
void vApplyConfigFilterIB();
void vApplyConfigScreenArea();
inline ECartridge eGetCartridge() const { return m_eCartridge; }
@ -122,13 +132,6 @@ protected:
ColorFormatBGR
};
enum EVideoOutput
{
OutputCairo,
OutputOpenGL,
OutputXvideo
};
virtual void vOnFileOpen();
virtual void vOnFileLoad();
virtual void vOnFileSave();
@ -145,7 +148,6 @@ protected:
virtual void vOnFileExit();
virtual void vOnFrameskipToggled(Gtk::CheckMenuItem * _poCMI, int _iValue);
virtual void vOnVideoFullscreen();
virtual void vOnVideoOutputToggled(Gtk::CheckMenuItem * _poCMI, int _iOutput);
virtual void vOnVideoScaleToggled(Gtk::CheckMenuItem * _poCMI, int _iScale);
virtual void vOnDirectories();
virtual void vOnPauseWhenInactiveToggled(Gtk::CheckMenuItem * _poCMI);
@ -160,9 +162,8 @@ protected:
virtual void vOnGBBorderToggled(Gtk::CheckMenuItem * _poCMI);
virtual void vOnGBPrinterToggled(Gtk::CheckMenuItem * _poCMI);
virtual void vOnEmulatorTypeToggled(Gtk::CheckMenuItem * _poCMI, int _iEmulatorType);
virtual void vOnFilter2xToggled(Gtk::CheckMenuItem * _poCMI, int _iFilter2x);
virtual void vOnFilterIBToggled(Gtk::CheckMenuItem * _poCMI, int _iFilterIB);
virtual void vOnJoypadConfigure();
virtual void vOnDisplayConfigure();
virtual void vOnHelpAbout();
virtual bool bOnEmuIdle();
@ -264,11 +265,10 @@ private:
void vInitConfig();
void vCheckConfig();
void vInitColors(EColorFormat _eColorFormat);
void vInitScreenArea(EVideoOutput _eVideoOutput);
void vLoadConfig(const std::string & _rsFile);
void vSaveConfig(const std::string & _rsFile);
void vHistoryAdd(const std::string & _rsFile);
void vLoadJoypadsFromConfig();
void vApplyConfigJoypads();
void vSaveJoypadsToConfig();
void vUpdateScreen();
void vDrawDefaultScreen();

View File

@ -21,6 +21,7 @@
#include <gtkmm/stock.h>
#include <gtkmm/messagedialog.h>
#include <gtkmm/aboutdialog.h>
#include <gtkmm/builder.h>
#include <SDL.h>
@ -37,6 +38,7 @@
#include "intl.h"
#include "joypadconfig.h"
#include "directoriesconfig.h"
#include "displayconfig.h"
namespace VBA
{
@ -361,18 +363,6 @@ void Window::vOnVideoFullscreen()
vToggleFullscreen();
}
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())
@ -566,36 +556,6 @@ void Window::vOnEmulatorTypeToggled(Gtk::CheckMenuItem * _poCMI, int _iEmulatorT
m_poCoreConfig->vSetKey("emulator_type", _iEmulatorType);
}
void Window::vOnFilter2xToggled(Gtk::CheckMenuItem * _poCMI, int _iFilter2x)
{
if (! _poCMI->get_active())
{
return;
}
m_poScreenArea->vSetFilter2x((EFilter2x)_iFilter2x);
if (emulating)
{
vDrawScreen();
}
m_poDisplayConfig->vSetKey("filter2x", _iFilter2x);
}
void Window::vOnFilterIBToggled(Gtk::CheckMenuItem * _poCMI, int _iFilterIB)
{
if (! _poCMI->get_active())
{
return;
}
m_poScreenArea->vSetFilterIB((EFilterIB)_iFilterIB);
if (emulating)
{
vDrawScreen();
}
m_poDisplayConfig->vSetKey("filterIB", _iFilterIB);
}
void Window::vOnJoypadConfigure()
{
JoypadConfigDialog oDialog(m_poInputConfig);
@ -603,6 +563,18 @@ void Window::vOnJoypadConfigure()
oDialog.run();
}
void Window::vOnDisplayConfigure()
{
Glib::RefPtr<Gtk::Builder> poBuilder = Gtk::Builder::create_from_file("src/gtk/ui/display.ui");
DisplayConfigDialog * poDialog = 0;
poBuilder->get_widget_derived("dialog1", poDialog);
poDialog->vSetConfig(m_poDisplayConfig, this);
poDialog->set_transient_for(*this);
poDialog->run();
poDialog->hide();
}
void Window::vOnHelpAbout()
{
Gtk::AboutDialog oAboutDialog;