GTK: Turned the last menu based settings into a dialog
This commit is contained in:
parent
ef8609241a
commit
b213ae372b
|
@ -92,8 +92,8 @@ ADD_DEFINITIONS (-DVERSION='"${VERSION}"' -DPKGDATADIR='"${PKGDATADIR}"' -DPACKA
|
|||
|
||||
# Linking is disabled if SFML has not been found
|
||||
IF( NOT SFML_FOUND )
|
||||
ADD_DEFINITIONS (-DNO_LINK)
|
||||
MESSAGE(STATUS "SFML was not found, link support is disabled")
|
||||
ADD_DEFINITIONS (-DNO_LINK)
|
||||
MESSAGE(STATUS "SFML was not found, link support is disabled")
|
||||
ENDIF( NOT SFML_FOUND )
|
||||
|
||||
# The debugger is enabled by default
|
||||
|
@ -248,6 +248,7 @@ SET(SRC_GTK
|
|||
src/gtk/system.cpp
|
||||
src/gtk/windowcallbacks.cpp
|
||||
src/gtk/filters.cpp
|
||||
src/gtk/generalconfig.cpp
|
||||
src/gtk/gameboyconfig.cpp
|
||||
src/gtk/gameboyadvanceconfig.cpp
|
||||
src/gtk/cheatlist.cpp
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
// -*- C++ -*-
|
||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 2011 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 "generalconfig.h"
|
||||
|
||||
#include <gtkmm/stock.h>
|
||||
#include <gtkmm/frame.h>
|
||||
#include <gtkmm/liststore.h>
|
||||
|
||||
#include "intl.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
|
||||
PreferencesDialog::PreferencesDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder) :
|
||||
Gtk::Dialog(_pstDialog),
|
||||
m_poConfig(0)
|
||||
{
|
||||
refBuilder->get_widget("PauseWhenInactiveCheckButton", m_poPauseWhenInactiveCheckButton);
|
||||
refBuilder->get_widget("FrameSkipAutomaticCheckButton", m_poFrameSkipAutomaticCheckButton);
|
||||
refBuilder->get_widget("FrameSkipLevelSpinButton", m_poFrameSkipLevelSpinButton);
|
||||
refBuilder->get_widget("SpeedIndicatorComboBox", m_poSpeedIndicatorComboBox);
|
||||
|
||||
m_poPauseWhenInactiveCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &PreferencesDialog::vOnPauseWhenInactiveChanged));
|
||||
m_poFrameSkipAutomaticCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &PreferencesDialog::vOnFrameskipChanged));
|
||||
m_poFrameSkipLevelSpinButton->signal_changed().connect(sigc::mem_fun(*this, &PreferencesDialog::vOnFrameskipChanged));
|
||||
m_poSpeedIndicatorComboBox->signal_changed().connect(sigc::mem_fun(*this, &PreferencesDialog::vOnSpeedIndicatorChanged));
|
||||
|
||||
}
|
||||
|
||||
void PreferencesDialog::vSetConfig(Config::Section * _poConfig, VBA::Window * _poWindow)
|
||||
{
|
||||
m_poConfig = _poConfig;
|
||||
m_poWindow = _poWindow;
|
||||
|
||||
bool bPauseWhenInactive = m_poConfig->oGetKey<bool>("pause_when_inactive");
|
||||
m_poPauseWhenInactiveCheckButton->set_active(bPauseWhenInactive);
|
||||
|
||||
std::string sFrameskip = m_poConfig->oGetKey<std::string>("frameskip");
|
||||
int iFrameskip = 0;
|
||||
bool bAutoFrameskip = false;
|
||||
|
||||
if (sFrameskip == "auto")
|
||||
bAutoFrameskip = true;
|
||||
else
|
||||
iFrameskip = m_poConfig->oGetKey<int>("frameskip");
|
||||
|
||||
m_poFrameSkipAutomaticCheckButton->set_active(bAutoFrameskip);
|
||||
m_poFrameSkipLevelSpinButton->set_sensitive(!bAutoFrameskip);
|
||||
m_poFrameSkipLevelSpinButton->set_value(iFrameskip);
|
||||
|
||||
int iShowSpeed = m_poConfig->oGetKey<int>("show_speed");
|
||||
m_poSpeedIndicatorComboBox->set_active(iShowSpeed);
|
||||
}
|
||||
|
||||
void PreferencesDialog::vOnPauseWhenInactiveChanged()
|
||||
{
|
||||
bool bPauseWhenInactive = m_poPauseWhenInactiveCheckButton->get_active();
|
||||
m_poConfig->vSetKey("pause_when_inactive", bPauseWhenInactive);
|
||||
}
|
||||
|
||||
void PreferencesDialog::vOnFrameskipChanged()
|
||||
{
|
||||
bool bAutoFrameskip = m_poFrameSkipAutomaticCheckButton->get_active();
|
||||
|
||||
if (bAutoFrameskip)
|
||||
{
|
||||
m_poConfig->vSetKey("frameskip", "auto");
|
||||
}
|
||||
else
|
||||
{
|
||||
int iFrameskip = m_poFrameSkipLevelSpinButton->get_value();
|
||||
m_poConfig->vSetKey("frameskip", iFrameskip);
|
||||
}
|
||||
|
||||
m_poFrameSkipLevelSpinButton->set_sensitive(!bAutoFrameskip);
|
||||
|
||||
m_poWindow->vApplyConfigFrameskip();
|
||||
}
|
||||
|
||||
void PreferencesDialog::vOnSpeedIndicatorChanged()
|
||||
{
|
||||
int iShowSpeed = m_poSpeedIndicatorComboBox->get_active_row_number();
|
||||
m_poConfig->vSetKey<int>("show_speed", iShowSpeed);
|
||||
|
||||
m_poWindow->vApplyConfigShowSpeed();
|
||||
}
|
||||
|
||||
} // namespace VBA
|
|
@ -0,0 +1,56 @@
|
|||
// -*- 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_GENERALCONFIG_H__
|
||||
#define __VBA_GENERALCONFIG_H__
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
#include "configfile.h"
|
||||
#include "window.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
|
||||
class PreferencesDialog : public Gtk::Dialog
|
||||
{
|
||||
public:
|
||||
PreferencesDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder);
|
||||
|
||||
void vSetConfig(Config::Section * _poConfig, VBA::Window * _poWindow);
|
||||
|
||||
private:
|
||||
void vOnPauseWhenInactiveChanged();
|
||||
void vOnFrameskipChanged();
|
||||
void vOnSpeedIndicatorChanged();
|
||||
|
||||
|
||||
VBA::Window * m_poWindow;
|
||||
|
||||
Config::Section * m_poConfig;
|
||||
Gtk::CheckButton * m_poPauseWhenInactiveCheckButton;
|
||||
Gtk::CheckButton * m_poFrameSkipAutomaticCheckButton;
|
||||
Gtk::SpinButton * m_poFrameSkipLevelSpinButton;
|
||||
Gtk::ComboBox * m_poSpeedIndicatorComboBox;
|
||||
|
||||
};
|
||||
|
||||
} // namespace VBA
|
||||
|
||||
|
||||
#endif // __VBA_GENERALCONFIG_H__
|
|
@ -0,0 +1,226 @@
|
|||
<?xml version="1.0"?>
|
||||
<interface>
|
||||
<requires lib="gtk+" version="2.16"/>
|
||||
<!-- interface-naming-policy project-wide -->
|
||||
<object class="GtkDialog" id="PreferencesDialog">
|
||||
<property name="border_width">5</property>
|
||||
<property name="title" translatable="yes">Preferences</property>
|
||||
<property name="type_hint">normal</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">none</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="PauseWhenInactiveCheckButton">
|
||||
<property name="label" translatable="yes">Pause when inactive</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>General</b></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="frame2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment2">
|
||||
<property name="visible">True</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="FrameSkipAutomaticCheckButton">
|
||||
<property name="label" translatable="yes">Enable automatic frame skipping</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">Frameskip level : </property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="FrameSkipLevelSpinButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="editable">False</property>
|
||||
<property name="adjustment">FrameSkipAdjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</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"><b>Frameskip</b></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>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment3">
|
||||
<property name="visible">True</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox2">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Speed indicator : </property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="SpeedIndicatorComboBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="model">SpeedIndicatorListStore</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="renderer1"/>
|
||||
<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="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Appearance</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<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">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button2">
|
||||
<property name="label" translatable="yes">gtk-close</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="0">button2</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
<object class="GtkListStore" id="SpeedIndicatorListStore">
|
||||
<columns>
|
||||
<!-- column-name SpeedType -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">None</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Percentage</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Detailed</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="FrameSkipAdjustment">
|
||||
<property name="upper">9</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">1</property>
|
||||
</object>
|
||||
</interface>
|
|
@ -475,194 +475,12 @@
|
|||
<object class="GtkMenu" id="OptionsMenu_menu">
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="FrameskipMenu">
|
||||
<object class="GtkMenuItem" id="GeneralConfigure">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">_Frameskip</property>
|
||||
<property name="label" translatable="yes">_Preferences ...</property>
|
||||
<property name="use_underline">True</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu" id="FrameskipMenu_menu">
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkRadioMenuItem" id="FrameskipAutomatic">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">_Automatic</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioMenuItem" id="Frameskip0">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">_0</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="group">FrameskipAutomatic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioMenuItem" id="Frameskip1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">_1</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="group">FrameskipAutomatic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioMenuItem" id="Frameskip2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">_2</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="group">FrameskipAutomatic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioMenuItem" id="Frameskip3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">_3</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="group">FrameskipAutomatic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioMenuItem" id="Frameskip4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">_4</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="group">FrameskipAutomatic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioMenuItem" id="Frameskip5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">_5</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="group">FrameskipAutomatic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioMenuItem" id="Frameskip6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">_6</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="group">FrameskipAutomatic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioMenuItem" id="Frameskip7">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">_7</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="group">FrameskipAutomatic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioMenuItem" id="Frameskip8">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">_8</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="group">FrameskipAutomatic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioMenuItem" id="Frameskip9">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">_9</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="group">FrameskipAutomatic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="EmulatorMenu">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">_Emulator</property>
|
||||
<property name="use_underline">True</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu" id="EmulatorMenu_menu">
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkCheckMenuItem" id="EmulatorPauseWhenInactive">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Pause when inactive window</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="ShowSpeedMenu">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Show speed</property>
|
||||
<property name="use_underline">True</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu" id="ShowSpeedMenu_menu">
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkRadioMenuItem" id="ShowSpeedNone">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">None</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioMenuItem" id="ShowSpeedPercentage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Percentage</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="group">ShowSpeedNone</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioMenuItem" id="ShowSpeedDetailed">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Detailed</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="group">ShowSpeedNone</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
|
|
@ -68,8 +68,8 @@ const Window::SJoypadKey Window::m_astJoypad[] =
|
|||
{ "capture", KEY_BUTTON_CAPTURE },
|
||||
{ "speed", KEY_BUTTON_SPEED },
|
||||
{ "capture", KEY_BUTTON_CAPTURE },
|
||||
{ "autoA", KEY_BUTTON_AUTO_A },
|
||||
{ "autoB", KEY_BUTTON_AUTO_B }
|
||||
{ "autoA", KEY_BUTTON_AUTO_A },
|
||||
{ "autoB", KEY_BUTTON_AUTO_B }
|
||||
};
|
||||
|
||||
Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Gtk::Builder> & _poXml) :
|
||||
|
@ -149,6 +149,8 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Gtk::Builder> & _poXml
|
|||
vApplyConfigGBASaveType();
|
||||
vApplyConfigGBAFlashSize();
|
||||
vApplyConfigGBARTC();
|
||||
vApplyConfigFrameskip();
|
||||
vApplyConfigShowSpeed();
|
||||
|
||||
Gtk::MenuItem * poMI;
|
||||
Gtk::CheckMenuItem * poCMI;
|
||||
|
@ -253,87 +255,14 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Gtk::Builder> & _poXml
|
|||
_poXml->get_widget("RecentMenu", m_poRecentMenu);
|
||||
m_poRecentMenu->set_submenu(static_cast<Gtk::Menu &>(*m_poRecentChooserMenu));
|
||||
|
||||
// Frameskip menu
|
||||
//
|
||||
struct
|
||||
{
|
||||
const char * m_csName;
|
||||
const int m_iFrameskip;
|
||||
}
|
||||
astFrameskip[] =
|
||||
{
|
||||
{ "FrameskipAutomatic", -1 },
|
||||
{ "Frameskip0", 0 },
|
||||
{ "Frameskip1", 1 },
|
||||
{ "Frameskip2", 2 },
|
||||
{ "Frameskip3", 3 },
|
||||
{ "Frameskip4", 4 },
|
||||
{ "Frameskip5", 5 },
|
||||
{ "Frameskip6", 6 },
|
||||
{ "Frameskip7", 7 },
|
||||
{ "Frameskip8", 8 },
|
||||
{ "Frameskip9", 9 }
|
||||
};
|
||||
int iDefaultFrameskip;
|
||||
if (m_poCoreConfig->sGetKey("frameskip") == "auto")
|
||||
{
|
||||
iDefaultFrameskip = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
iDefaultFrameskip = m_poCoreConfig->oGetKey<int>("frameskip");
|
||||
}
|
||||
for (guint i = 0; i < G_N_ELEMENTS(astFrameskip); i++)
|
||||
{
|
||||
_poXml->get_widget(astFrameskip[i].m_csName, poCMI);
|
||||
if (astFrameskip[i].m_iFrameskip == iDefaultFrameskip)
|
||||
{
|
||||
poCMI->set_active();
|
||||
vOnFrameskipToggled(poCMI, iDefaultFrameskip);
|
||||
}
|
||||
poCMI->signal_toggled().connect(sigc::bind(
|
||||
sigc::mem_fun(*this, &Window::vOnFrameskipToggled),
|
||||
poCMI, astFrameskip[i].m_iFrameskip));
|
||||
}
|
||||
|
||||
// Emulator menu
|
||||
//
|
||||
_poXml->get_widget("DirectoriesConfigure", poMI);
|
||||
poMI->signal_activate().connect(sigc::mem_fun(*this, &Window::vOnDirectories));
|
||||
|
||||
_poXml->get_widget("EmulatorPauseWhenInactive", poCMI);
|
||||
poCMI->set_active(m_poDisplayConfig->oGetKey<bool>("pause_when_inactive"));
|
||||
vOnPauseWhenInactiveToggled(poCMI);
|
||||
poCMI->signal_toggled().connect(sigc::bind(
|
||||
sigc::mem_fun(*this, &Window::vOnPauseWhenInactiveToggled),
|
||||
poCMI));
|
||||
|
||||
// Show speed menu
|
||||
//
|
||||
struct
|
||||
{
|
||||
const char * m_csName;
|
||||
const EShowSpeed m_eShowSpeed;
|
||||
}
|
||||
astShowSpeed[] =
|
||||
{
|
||||
{ "ShowSpeedNone", ShowNone },
|
||||
{ "ShowSpeedPercentage", ShowPercentage },
|
||||
{ "ShowSpeedDetailed", ShowDetailed }
|
||||
};
|
||||
EShowSpeed eDefaultShowSpeed = (EShowSpeed)m_poDisplayConfig->oGetKey<int>("show_speed");
|
||||
for (guint i = 0; i < G_N_ELEMENTS(astShowSpeed); i++)
|
||||
{
|
||||
_poXml->get_widget(astShowSpeed[i].m_csName, poCMI);
|
||||
if (astShowSpeed[i].m_eShowSpeed == eDefaultShowSpeed)
|
||||
{
|
||||
poCMI->set_active();
|
||||
vOnShowSpeedToggled(poCMI, eDefaultShowSpeed);
|
||||
}
|
||||
poCMI->signal_toggled().connect(sigc::bind(
|
||||
sigc::mem_fun(*this, &Window::vOnShowSpeedToggled),
|
||||
poCMI, astShowSpeed[i].m_eShowSpeed));
|
||||
}
|
||||
// Preferences
|
||||
_poXml->get_widget("GeneralConfigure", poMI);
|
||||
poMI->signal_activate().connect(sigc::mem_fun(*this, &Window::vOnGeneralConfigure));
|
||||
|
||||
// Game Boy menu
|
||||
_poXml->get_widget("GameBoyConfigure", poMI);
|
||||
|
@ -592,13 +521,13 @@ void Window::vInitConfig()
|
|||
m_poCoreConfig->vSetKey("gb_use_bios_file", false );
|
||||
m_poCoreConfig->vSetKey("gb_bios_file", "" );
|
||||
m_poCoreConfig->vSetKey("emulator_type", EmulatorAuto );
|
||||
m_poCoreConfig->vSetKey("pause_when_inactive", true );
|
||||
m_poCoreConfig->vSetKey("show_speed", ShowPercentage );
|
||||
|
||||
// Display section
|
||||
//
|
||||
m_poDisplayConfig = m_oConfig.poAddSection("Display");
|
||||
m_poDisplayConfig->vSetKey("scale", 1 );
|
||||
m_poDisplayConfig->vSetKey("show_speed", ShowPercentage );
|
||||
m_poDisplayConfig->vSetKey("pause_when_inactive", true );
|
||||
m_poDisplayConfig->vSetKey("filter2x", FilterNone );
|
||||
m_poDisplayConfig->vSetKey("filterIB", FilterIBNone );
|
||||
#ifdef USE_OPENGL
|
||||
|
@ -737,11 +666,11 @@ void Window::vCheckConfig()
|
|||
m_poDisplayConfig->vSetKey("scale", iAdjusted);
|
||||
}
|
||||
|
||||
iValue = m_poDisplayConfig->oGetKey<int>("show_speed");
|
||||
iValue = m_poCoreConfig->oGetKey<int>("show_speed");
|
||||
iAdjusted = CLAMP(iValue, m_iShowSpeedMin, m_iShowSpeedMax);
|
||||
if (iValue != iAdjusted)
|
||||
{
|
||||
m_poDisplayConfig->vSetKey("show_speed", iAdjusted);
|
||||
m_poCoreConfig->vSetKey("show_speed", iAdjusted);
|
||||
}
|
||||
|
||||
iValue = m_poDisplayConfig->oGetKey<int>("filter2x");
|
||||
|
@ -943,6 +872,32 @@ void Window::vApplyConfigJoypads()
|
|||
}
|
||||
}
|
||||
|
||||
void Window::vApplyConfigFrameskip()
|
||||
{
|
||||
std::string sFrameskip = m_poCoreConfig->oGetKey<std::string>("frameskip");
|
||||
|
||||
if (sFrameskip == "auto")
|
||||
{
|
||||
m_bAutoFrameskip = true;
|
||||
gbFrameSkip = 0;
|
||||
systemFrameSkip = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bAutoFrameskip = false;
|
||||
int iFrameskip = m_poCoreConfig->oGetKey<int>("frameskip");
|
||||
gbFrameSkip = iFrameskip;
|
||||
systemFrameSkip = iFrameskip;
|
||||
}
|
||||
}
|
||||
|
||||
void Window::vApplyConfigShowSpeed()
|
||||
{
|
||||
m_eShowSpeed = (EShowSpeed)m_poCoreConfig->oGetKey<int>("show_speed");
|
||||
if (m_eShowSpeed == ShowNone)
|
||||
vSetDefaultTitle();
|
||||
}
|
||||
|
||||
void Window::vSaveJoypadsToConfig()
|
||||
{
|
||||
for (int i = m_iJoypadMin; i <= m_iJoypadMax; i++)
|
||||
|
|
|
@ -107,6 +107,8 @@ public:
|
|||
void vApplyConfigGBASaveType();
|
||||
void vApplyConfigGBAFlashSize();
|
||||
void vApplyConfigGBARTC();
|
||||
void vApplyConfigFrameskip();
|
||||
void vApplyConfigShowSpeed();
|
||||
void vUpdateScreen();
|
||||
|
||||
inline ECartridge eGetCartridge() const { return m_eCartridge; }
|
||||
|
@ -151,11 +153,9 @@ protected:
|
|||
virtual void vOnFileScreenCapture();
|
||||
virtual void vOnFileClose();
|
||||
virtual void vOnFileExit();
|
||||
virtual void vOnFrameskipToggled(Gtk::CheckMenuItem * _poCMI, int _iValue);
|
||||
virtual void vOnVideoFullscreen();
|
||||
virtual void vOnDirectories();
|
||||
virtual void vOnPauseWhenInactiveToggled(Gtk::CheckMenuItem * _poCMI);
|
||||
virtual void vOnShowSpeedToggled(Gtk::CheckMenuItem * _poCMI, int _iShowSpeed);
|
||||
virtual void vOnGeneralConfigure();
|
||||
virtual void vOnJoypadConfigure();
|
||||
virtual void vOnDisplayConfigure();
|
||||
virtual void vOnSoundConfigure();
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "soundconfig.h"
|
||||
#include "gameboyconfig.h"
|
||||
#include "gameboyadvanceconfig.h"
|
||||
#include "generalconfig.h"
|
||||
#include "cheatlist.h"
|
||||
|
||||
namespace VBA
|
||||
|
@ -355,29 +356,6 @@ void Window::vOnFileExit()
|
|||
hide();
|
||||
}
|
||||
|
||||
void Window::vOnFrameskipToggled(Gtk::CheckMenuItem * _poCMI, int _iValue)
|
||||
{
|
||||
if (! _poCMI->get_active())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_iValue >= 0 && _iValue <= 9)
|
||||
{
|
||||
m_poCoreConfig->vSetKey("frameskip", _iValue);
|
||||
gbFrameSkip = _iValue;
|
||||
systemFrameSkip = _iValue;
|
||||
m_bAutoFrameskip = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_poCoreConfig->vSetKey("frameskip", "auto");
|
||||
gbFrameSkip = 0;
|
||||
systemFrameSkip = 0;
|
||||
m_bAutoFrameskip = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Window::vOnVideoFullscreen()
|
||||
{
|
||||
vToggleFullscreen();
|
||||
|
@ -393,26 +371,6 @@ void Window::vOnDirectories()
|
|||
vUpdateGameSlots();
|
||||
}
|
||||
|
||||
void Window::vOnPauseWhenInactiveToggled(Gtk::CheckMenuItem * _poCMI)
|
||||
{
|
||||
m_poDisplayConfig->vSetKey("pause_when_inactive", _poCMI->get_active());
|
||||
}
|
||||
|
||||
void Window::vOnShowSpeedToggled(Gtk::CheckMenuItem * _poCMI, int _iShowSpeed)
|
||||
{
|
||||
if (! _poCMI->get_active())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_eShowSpeed = (EShowSpeed)_iShowSpeed;
|
||||
if (m_eShowSpeed == ShowNone)
|
||||
{
|
||||
vSetDefaultTitle();
|
||||
}
|
||||
m_poDisplayConfig->vSetKey("show_speed", _iShowSpeed);
|
||||
}
|
||||
|
||||
void Window::vOnJoypadConfigure()
|
||||
{
|
||||
JoypadConfigDialog oDialog(m_poInputConfig);
|
||||
|
@ -472,6 +430,19 @@ void Window::vOnGameBoyAdvanceConfigure()
|
|||
poDialog->hide();
|
||||
}
|
||||
|
||||
void Window::vOnGeneralConfigure()
|
||||
{
|
||||
std::string sUiFile = sGetUiFilePath("preferences.ui");
|
||||
Glib::RefPtr<Gtk::Builder> poBuilder = Gtk::Builder::create_from_file(sUiFile);
|
||||
|
||||
PreferencesDialog * poDialog = 0;
|
||||
poBuilder->get_widget_derived("PreferencesDialog", poDialog);
|
||||
poDialog->vSetConfig(m_poCoreConfig, this);
|
||||
poDialog->set_transient_for(*this);
|
||||
poDialog->run();
|
||||
poDialog->hide();
|
||||
}
|
||||
|
||||
void Window::vOnCheatList()
|
||||
{
|
||||
if (m_eCartridge == CartridgeGBA)
|
||||
|
@ -518,7 +489,7 @@ void Window::vOnHelpAbout()
|
|||
"along with this program. If not, see <http://www.gnu.org/licenses/>.";
|
||||
const char csCopyright[] = "Copyright (C) 1999-2003 Forgotten\n"
|
||||
"Copyright (C) 2004-2006 VBA development team\n"
|
||||
"Copyright (C) 2007-2008 VBA-M development team";
|
||||
"Copyright (C) 2007-2011 VBA-M development team";
|
||||
|
||||
oAboutDialog.set_transient_for(*this);
|
||||
|
||||
|
@ -563,7 +534,7 @@ bool Window::on_focus_in_event(GdkEventFocus * _pstEvent)
|
|||
{
|
||||
if (emulating
|
||||
&& ! m_bPaused
|
||||
&& m_poDisplayConfig->oGetKey<bool>("pause_when_inactive"))
|
||||
&& m_poCoreConfig->oGetKey<bool>("pause_when_inactive"))
|
||||
{
|
||||
vStartEmu();
|
||||
soundResume();
|
||||
|
@ -575,7 +546,7 @@ bool Window::on_focus_out_event(GdkEventFocus * _pstEvent)
|
|||
{
|
||||
if (emulating
|
||||
&& ! m_bPaused
|
||||
&& m_poDisplayConfig->oGetKey<bool>("pause_when_inactive"))
|
||||
&& m_poCoreConfig->oGetKey<bool>("pause_when_inactive"))
|
||||
{
|
||||
vStopEmu();
|
||||
soundPause();
|
||||
|
|
Loading…
Reference in New Issue