GTK : New GBA settings dialog
This commit is contained in:
parent
9788aba1e3
commit
628d618662
|
@ -212,6 +212,7 @@ SET(SRC_GTK
|
|||
src/gtk/windowcallbacks.cpp
|
||||
src/gtk/filters.cpp
|
||||
src/gtk/gameboyconfig.cpp
|
||||
src/gtk/gameboyadvanceconfig.cpp
|
||||
src/gtk/joypadconfig.cpp
|
||||
src/gtk/directoriesconfig.cpp
|
||||
src/gtk/displayconfig.cpp
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
// -*- 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 "gameboyadvanceconfig.h"
|
||||
|
||||
#include "intl.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
|
||||
GameBoyAdvanceConfigDialog::GameBoyAdvanceConfigDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder) :
|
||||
Gtk::Dialog(_pstDialog),
|
||||
m_poConfig(0)
|
||||
{
|
||||
refBuilder->get_widget("SaveTypeComboBox", m_poSaveTypeComboBox);
|
||||
refBuilder->get_widget("FlashSizeComboBox", m_poFlashSizeComboBox);
|
||||
refBuilder->get_widget("BiosCheckButton", m_poBiosCheckButton);
|
||||
refBuilder->get_widget("BiosFileChooserButton", m_poBiosFileChooserButton);
|
||||
|
||||
m_poSaveTypeComboBox->signal_changed().connect(sigc::mem_fun(*this, &GameBoyAdvanceConfigDialog::vOnSaveTypeChanged));
|
||||
m_poFlashSizeComboBox->signal_changed().connect(sigc::mem_fun(*this, &GameBoyAdvanceConfigDialog::vOnFlashSizeChanged));
|
||||
m_poBiosCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &GameBoyAdvanceConfigDialog::vOnUseBiosChanged));
|
||||
m_poBiosFileChooserButton->signal_selection_changed().connect(sigc::mem_fun(*this, &GameBoyAdvanceConfigDialog::vOnBiosSelectionChanged));
|
||||
}
|
||||
|
||||
void GameBoyAdvanceConfigDialog::vSetConfig(Config::Section * _poConfig, VBA::Window * _poWindow)
|
||||
{
|
||||
m_poConfig = _poConfig;
|
||||
m_poWindow = _poWindow;
|
||||
|
||||
VBA::Window::ESaveType eDefaultSaveType = (VBA::Window::ESaveType)m_poConfig->oGetKey<int>("save_type");
|
||||
m_poSaveTypeComboBox->set_active(eDefaultSaveType);
|
||||
|
||||
int iDefaultFlashSize = m_poConfig->oGetKey<int>("flash_size");
|
||||
if (iDefaultFlashSize == 128)
|
||||
{
|
||||
m_poFlashSizeComboBox->set_active(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_poFlashSizeComboBox->set_active(0);
|
||||
}
|
||||
|
||||
bool bUseBios = m_poConfig->oGetKey<bool>("use_bios_file");
|
||||
m_poBiosCheckButton->set_active(bUseBios);
|
||||
m_poBiosFileChooserButton->set_sensitive(bUseBios);
|
||||
|
||||
std::string sBios = m_poConfig->oGetKey<std::string>("bios_file");
|
||||
m_poBiosFileChooserButton->set_filename(sBios);
|
||||
|
||||
const char * acsPattern[] =
|
||||
{
|
||||
"*.[bB][iI][nN]", "*.[aA][gG][bB]", "*.[gG][bB][aA]",
|
||||
"*.[bB][iI][oO][sS]", "*.[zZ][iI][pP]", "*.[zZ]", "*.[gG][zZ]"
|
||||
};
|
||||
|
||||
Gtk::FileFilter oAllFilter;
|
||||
oAllFilter.set_name(_("All files"));
|
||||
oAllFilter.add_pattern("*");
|
||||
|
||||
Gtk::FileFilter oBiosFilter;
|
||||
oBiosFilter.set_name(_("Gameboy Advance BIOS"));
|
||||
for (guint i = 0; i < G_N_ELEMENTS(acsPattern); i++)
|
||||
{
|
||||
oBiosFilter.add_pattern(acsPattern[i]);
|
||||
}
|
||||
|
||||
m_poBiosFileChooserButton->add_filter(oAllFilter);
|
||||
m_poBiosFileChooserButton->add_filter(oBiosFilter);
|
||||
m_poBiosFileChooserButton->set_filter(oBiosFilter);
|
||||
}
|
||||
|
||||
void GameBoyAdvanceConfigDialog::vOnSaveTypeChanged()
|
||||
{
|
||||
int iSaveType = m_poSaveTypeComboBox->get_active_row_number();
|
||||
m_poConfig->vSetKey("save_type", iSaveType);
|
||||
m_poWindow->vApplyConfigGBASaveType();
|
||||
}
|
||||
|
||||
void GameBoyAdvanceConfigDialog::vOnFlashSizeChanged()
|
||||
{
|
||||
int iFlashSize = m_poFlashSizeComboBox->get_active_row_number();
|
||||
if (iFlashSize == 0)
|
||||
{
|
||||
m_poConfig->vSetKey("flash_size", 64);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_poConfig->vSetKey("flash_size", 128);
|
||||
}
|
||||
|
||||
m_poWindow->vApplyConfigGBAFlashSize();
|
||||
}
|
||||
|
||||
void GameBoyAdvanceConfigDialog::vOnUseBiosChanged()
|
||||
{
|
||||
bool bUseBios = m_poBiosCheckButton->get_active();
|
||||
m_poConfig->vSetKey("use_bios_file", bUseBios);
|
||||
m_poBiosFileChooserButton->set_sensitive(bUseBios);
|
||||
}
|
||||
|
||||
void GameBoyAdvanceConfigDialog::vOnBiosSelectionChanged()
|
||||
{
|
||||
std::string sBios = m_poBiosFileChooserButton->get_filename();
|
||||
m_poConfig->vSetKey("bios_file", sBios);
|
||||
}
|
||||
|
||||
} // namespace VBA
|
|
@ -0,0 +1,55 @@
|
|||
// -*- 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_GAMEBOYADVANCECONFIG_H__
|
||||
#define __VBA_GAMEBOYADVANCECONFIG_H__
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
#include "configfile.h"
|
||||
#include "window.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
|
||||
class GameBoyAdvanceConfigDialog : public Gtk::Dialog
|
||||
{
|
||||
public:
|
||||
GameBoyAdvanceConfigDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder);
|
||||
|
||||
void vSetConfig(Config::Section * _poConfig, VBA::Window * _poWindow);
|
||||
|
||||
private:
|
||||
void vOnSaveTypeChanged();
|
||||
void vOnFlashSizeChanged();
|
||||
void vOnUseBiosChanged();
|
||||
void vOnBiosSelectionChanged();
|
||||
|
||||
VBA::Window * m_poWindow;
|
||||
|
||||
Config::Section * m_poConfig;
|
||||
Gtk::ComboBox * m_poSaveTypeComboBox;
|
||||
Gtk::ComboBox * m_poFlashSizeComboBox;
|
||||
Gtk::CheckButton * m_poBiosCheckButton;
|
||||
Gtk::FileChooserButton * m_poBiosFileChooserButton;
|
||||
};
|
||||
|
||||
} // namespace VBA
|
||||
|
||||
|
||||
#endif // __VBA_GAMEBOYADVANCECONFIG_H__
|
|
@ -0,0 +1,229 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--Generated with glade3 3.4.5 on Fri Jan 23 15:53:56 2009 -->
|
||||
<interface>
|
||||
<object class="GtkListStore" id="model1">
|
||||
<columns>
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0">64K</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0">128K</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkListStore" id="model2">
|
||||
<columns>
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0">Automatic</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0">EEPROM</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0">SRAM</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0">Flash</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0">EEPROM + Sensor</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0">None</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkDialog" id="GameBoyAdvanceConfigDialog">
|
||||
<property name="border_width">5</property>
|
||||
<property name="title" translatable="yes">Game Boy Advance settings</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>
|
||||
<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="GtkTable" id="table1">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">2</property>
|
||||
<property name="n_columns">2</property>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="FlashSizeComboBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="model">model1</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="SaveTypeComboBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="model">model2</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>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Flash size : </property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Save type : </property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</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>Cartridge</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<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="GtkVBox" id="vbox2">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="BiosCheckButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Use a bios file</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox2">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Bios file : </property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFileChooserButton" id="BiosFileChooserButton">
|
||||
<property name="visible">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="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Bios</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">2</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="0">button1</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
</interface>
|
|
@ -501,105 +501,6 @@
|
|||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="SaveTypeMenu">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Save type</property>
|
||||
<property name="use_underline">True</property>
|
||||
<child>
|
||||
<widget class="GtkMenu" id="SaveTypeMenu_menu">
|
||||
<child>
|
||||
<widget class="GtkRadioMenuItem" id="SaveTypeAutomatic">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Automatic</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkRadioMenuItem" id="SaveTypeEeprom">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">EEPROM</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="group">SaveTypeAutomatic</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkRadioMenuItem" id="SaveTypeSram">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">SRAM</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="group">SaveTypeAutomatic</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkRadioMenuItem" id="SaveTypeFlash">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Flash</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="group">SaveTypeAutomatic</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkRadioMenuItem" id="SaveTypeEepromSensor">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">EEPROM+Sensor</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="group">SaveTypeAutomatic</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkRadioMenuItem" id="SaveTypeNone">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">None</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="group">SaveTypeAutomatic</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkSeparatorMenuItem" id="separator10">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkRadioMenuItem" id="SaveTypeFlash64K">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Flash 64K</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkRadioMenuItem" id="SaveTypeFlash128K">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Flash 128K</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="group">SaveTypeFlash64K</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkSeparatorMenuItem" id="separator31">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="EmulatorSelectBios">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Select BIOS file...</property>
|
||||
<property name="use_underline">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckMenuItem" id="EmulatorUseBios">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Use BIOS file</property>
|
||||
<property name="use_underline">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
@ -611,6 +512,13 @@
|
|||
<property name="use_underline">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="GameBoyAdvanceConfigure">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Game Boy _Advance ...</property>
|
||||
<property name="use_underline">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="DisplayConfigure">
|
||||
<property name="visible">True</property>
|
||||
|
@ -628,7 +536,7 @@
|
|||
<child>
|
||||
<widget class="GtkMenuItem" id="DirectoriesConfigure">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Directories ...</property>
|
||||
<property name="label" translatable="yes">D_irectories ...</property>
|
||||
<property name="use_underline">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
|
|
@ -147,6 +147,8 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
|
|||
vApplyConfigGBSystem();
|
||||
vApplyConfigGBBorder();
|
||||
vApplyConfigGBPrinter();
|
||||
vApplyConfigGBASaveType();
|
||||
vApplyConfigGBAFlashSize();
|
||||
|
||||
Gtk::MenuItem * poMI;
|
||||
Gtk::CheckMenuItem * poCMI;
|
||||
|
@ -296,19 +298,6 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
|
|||
sigc::mem_fun(*this, &Window::vOnPauseWhenInactiveToggled),
|
||||
poCMI));
|
||||
|
||||
m_poUseBiosItem = dynamic_cast<Gtk::CheckMenuItem *>(_poXml->get_widget("EmulatorUseBios"));
|
||||
m_poUseBiosItem->set_active(m_poCoreConfig->oGetKey<bool>("use_bios_file"));
|
||||
if (m_poCoreConfig->sGetKey("bios_file") == "")
|
||||
{
|
||||
m_poUseBiosItem->set_sensitive(false);
|
||||
}
|
||||
m_poUseBiosItem->signal_toggled().connect(sigc::bind(
|
||||
sigc::mem_fun(*this, &Window::vOnUseBiosToggled),
|
||||
m_poUseBiosItem));
|
||||
|
||||
poMI = dynamic_cast<Gtk::MenuItem *>(_poXml->get_widget("EmulatorSelectBios"));
|
||||
poMI->signal_activate().connect(sigc::mem_fun(*this, &Window::vOnSelectBios));
|
||||
|
||||
// Show speed menu
|
||||
//
|
||||
struct
|
||||
|
@ -336,66 +325,14 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
|
|||
poCMI, astShowSpeed[i].m_eShowSpeed));
|
||||
}
|
||||
|
||||
// Save type menu
|
||||
//
|
||||
struct
|
||||
{
|
||||
const char * m_csName;
|
||||
const ESaveType m_eSaveType;
|
||||
}
|
||||
astSaveType[] =
|
||||
{
|
||||
{ "SaveTypeAutomatic", SaveAuto },
|
||||
{ "SaveTypeEeprom", SaveEEPROM },
|
||||
{ "SaveTypeSram", SaveSRAM },
|
||||
{ "SaveTypeFlash", SaveFlash },
|
||||
{ "SaveTypeEepromSensor", SaveEEPROMSensor },
|
||||
{ "SaveTypeNone", SaveNone }
|
||||
};
|
||||
ESaveType eDefaultSaveType = (ESaveType)m_poCoreConfig->oGetKey<int>("save_type");
|
||||
for (guint i = 0; i < G_N_ELEMENTS(astSaveType); i++)
|
||||
{
|
||||
poCMI = dynamic_cast<Gtk::CheckMenuItem *>(_poXml->get_widget(astSaveType[i].m_csName));
|
||||
if (astSaveType[i].m_eSaveType == eDefaultSaveType)
|
||||
{
|
||||
poCMI->set_active();
|
||||
vOnSaveTypeToggled(poCMI, eDefaultSaveType);
|
||||
}
|
||||
poCMI->signal_toggled().connect(sigc::bind(
|
||||
sigc::mem_fun(*this, &Window::vOnSaveTypeToggled),
|
||||
poCMI, astSaveType[i].m_eSaveType));
|
||||
}
|
||||
|
||||
// Flash size menu
|
||||
//
|
||||
struct
|
||||
{
|
||||
const char * m_csName;
|
||||
const int m_iFlashSize;
|
||||
}
|
||||
astFlashSize[] =
|
||||
{
|
||||
{ "SaveTypeFlash64K", 64 },
|
||||
{ "SaveTypeFlash128K", 128 }
|
||||
};
|
||||
int iDefaultFlashSize = m_poCoreConfig->oGetKey<int>("flash_size");
|
||||
for (guint i = 0; i < G_N_ELEMENTS(astFlashSize); i++)
|
||||
{
|
||||
poCMI = dynamic_cast<Gtk::CheckMenuItem *>(_poXml->get_widget(astFlashSize[i].m_csName));
|
||||
if (astFlashSize[i].m_iFlashSize == iDefaultFlashSize)
|
||||
{
|
||||
poCMI->set_active();
|
||||
vOnFlashSizeToggled(poCMI, iDefaultFlashSize);
|
||||
}
|
||||
poCMI->signal_toggled().connect(sigc::bind(
|
||||
sigc::mem_fun(*this, &Window::vOnFlashSizeToggled),
|
||||
poCMI, astFlashSize[i].m_iFlashSize));
|
||||
}
|
||||
|
||||
// Game Boy menu
|
||||
poMI = dynamic_cast<Gtk::MenuItem *>(_poXml->get_widget("GameBoyConfigure"));
|
||||
poMI->signal_activate().connect(sigc::mem_fun(*this, &Window::vOnGameBoyConfigure));
|
||||
|
||||
// Game Boy Advance menu
|
||||
poMI = dynamic_cast<Gtk::MenuItem *>(_poXml->get_widget("GameBoyAdvanceConfigure"));
|
||||
poMI->signal_activate().connect(sigc::mem_fun(*this, &Window::vOnGameBoyAdvanceConfigure));
|
||||
|
||||
// Display menu
|
||||
poMI = dynamic_cast<Gtk::MenuItem *>(_poXml->get_widget("DisplayConfigure"));
|
||||
poMI->signal_activate().connect(sigc::mem_fun(*this, &Window::vOnDisplayConfigure));
|
||||
|
@ -934,6 +871,24 @@ void Window::vApplyConfigGBPrinter()
|
|||
}
|
||||
}
|
||||
|
||||
void Window::vApplyConfigGBASaveType()
|
||||
{
|
||||
int iSaveType = m_poCoreConfig->oGetKey<int>("save_type");
|
||||
cpuSaveType = iSaveType;
|
||||
}
|
||||
|
||||
void Window::vApplyConfigGBAFlashSize()
|
||||
{
|
||||
int iFlashSize = m_poCoreConfig->oGetKey<int>("flash_size");
|
||||
if (iFlashSize == 64)
|
||||
{
|
||||
flashSetSize(0x10000);
|
||||
}
|
||||
else
|
||||
{
|
||||
flashSetSize(0x20000);
|
||||
}
|
||||
}
|
||||
|
||||
void Window::vHistoryAdd(const std::string & _rsFile)
|
||||
{
|
||||
|
|
|
@ -71,6 +71,16 @@ public:
|
|||
EmulatorSGB2
|
||||
};
|
||||
|
||||
enum ESaveType
|
||||
{
|
||||
SaveAuto,
|
||||
SaveEEPROM,
|
||||
SaveSRAM,
|
||||
SaveFlash,
|
||||
SaveEEPROMSensor,
|
||||
SaveNone
|
||||
};
|
||||
|
||||
// GB/GBA screen sizes
|
||||
const int m_iGBScreenWidth;
|
||||
const int m_iGBScreenHeight;
|
||||
|
@ -95,6 +105,8 @@ public:
|
|||
void vApplyConfigGBSystem();
|
||||
void vApplyConfigGBBorder();
|
||||
void vApplyConfigGBPrinter();
|
||||
void vApplyConfigGBASaveType();
|
||||
void vApplyConfigGBAFlashSize();
|
||||
void vUpdateScreen();
|
||||
|
||||
inline ECartridge eGetCartridge() const { return m_eCartridge; }
|
||||
|
@ -110,16 +122,6 @@ protected:
|
|||
ShowDetailed
|
||||
};
|
||||
|
||||
enum ESaveType
|
||||
{
|
||||
SaveAuto,
|
||||
SaveEEPROM,
|
||||
SaveSRAM,
|
||||
SaveFlash,
|
||||
SaveEEPROMSensor,
|
||||
SaveNone
|
||||
};
|
||||
|
||||
enum ESoundStatus
|
||||
{
|
||||
SoundOff,
|
||||
|
@ -151,15 +153,12 @@ protected:
|
|||
virtual void vOnVideoFullscreen();
|
||||
virtual void vOnDirectories();
|
||||
virtual void vOnPauseWhenInactiveToggled(Gtk::CheckMenuItem * _poCMI);
|
||||
virtual void vOnSelectBios();
|
||||
virtual void vOnUseBiosToggled(Gtk::CheckMenuItem * _poCMI);
|
||||
virtual void vOnShowSpeedToggled(Gtk::CheckMenuItem * _poCMI, int _iShowSpeed);
|
||||
virtual void vOnSaveTypeToggled(Gtk::CheckMenuItem * _poCMI, int _iSaveType);
|
||||
virtual void vOnFlashSizeToggled(Gtk::CheckMenuItem * _poCMI, int _iFlashSize);
|
||||
virtual void vOnJoypadConfigure();
|
||||
virtual void vOnDisplayConfigure();
|
||||
virtual void vOnSoundConfigure();
|
||||
virtual void vOnGameBoyConfigure();
|
||||
virtual void vOnGameBoyAdvanceConfigure();
|
||||
virtual void vOnHelpAbout();
|
||||
virtual bool bOnEmuIdle();
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "displayconfig.h"
|
||||
#include "soundconfig.h"
|
||||
#include "gameboyconfig.h"
|
||||
#include "gameboyadvanceconfig.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
|
@ -378,55 +379,6 @@ void Window::vOnPauseWhenInactiveToggled(Gtk::CheckMenuItem * _poCMI)
|
|||
m_poDisplayConfig->vSetKey("pause_when_inactive", _poCMI->get_active());
|
||||
}
|
||||
|
||||
void Window::vOnSelectBios()
|
||||
{
|
||||
Gtk::FileChooserDialog oDialog(*this, _("Select BIOS file"));
|
||||
oDialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
||||
oDialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
|
||||
|
||||
if (m_poCoreConfig->sGetKey("bios_file") != "")
|
||||
{
|
||||
oDialog.set_filename(m_poCoreConfig->sGetKey("bios_file"));
|
||||
}
|
||||
|
||||
const char * acsPattern[] =
|
||||
{
|
||||
"*.[bB][iI][nN]", "*.[aA][gG][bB]", "*.[gG][bB][aA]",
|
||||
"*.[bB][iI][oO][sS]", "*.[zZ][iI][pP]", "*.[zZ]", "*.[gG][zZ]"
|
||||
};
|
||||
|
||||
Gtk::FileFilter oAllFilter;
|
||||
oAllFilter.set_name(_("All files"));
|
||||
oAllFilter.add_pattern("*");
|
||||
|
||||
Gtk::FileFilter oBiosFilter;
|
||||
oBiosFilter.set_name(_("Gameboy Advance BIOS"));
|
||||
for (guint i = 0; i < G_N_ELEMENTS(acsPattern); i++)
|
||||
{
|
||||
oBiosFilter.add_pattern(acsPattern[i]);
|
||||
}
|
||||
|
||||
oDialog.add_filter(oAllFilter);
|
||||
oDialog.add_filter(oBiosFilter);
|
||||
|
||||
oDialog.set_filter(oBiosFilter);
|
||||
|
||||
while (oDialog.run() == Gtk::RESPONSE_OK)
|
||||
{
|
||||
if (Glib::file_test(oDialog.get_filename(), Glib::FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
m_poCoreConfig->vSetKey("bios_file", oDialog.get_filename());
|
||||
m_poUseBiosItem->set_sensitive();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Window::vOnUseBiosToggled(Gtk::CheckMenuItem * _poCMI)
|
||||
{
|
||||
m_poCoreConfig->vSetKey("use_bios_file", _poCMI->get_active());
|
||||
}
|
||||
|
||||
void Window::vOnShowSpeedToggled(Gtk::CheckMenuItem * _poCMI, int _iShowSpeed)
|
||||
{
|
||||
if (! _poCMI->get_active())
|
||||
|
@ -442,35 +394,6 @@ void Window::vOnShowSpeedToggled(Gtk::CheckMenuItem * _poCMI, int _iShowSpeed)
|
|||
m_poDisplayConfig->vSetKey("show_speed", _iShowSpeed);
|
||||
}
|
||||
|
||||
void Window::vOnSaveTypeToggled(Gtk::CheckMenuItem * _poCMI, int _iSaveType)
|
||||
{
|
||||
if (! _poCMI->get_active())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cpuSaveType = _iSaveType;
|
||||
m_poCoreConfig->vSetKey("save_type", _iSaveType);
|
||||
}
|
||||
|
||||
void Window::vOnFlashSizeToggled(Gtk::CheckMenuItem * _poCMI, int _iFlashSize)
|
||||
{
|
||||
if (! _poCMI->get_active())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_iFlashSize == 64)
|
||||
{
|
||||
flashSetSize(0x10000);
|
||||
}
|
||||
else
|
||||
{
|
||||
flashSetSize(0x20000);
|
||||
}
|
||||
m_poCoreConfig->vSetKey("flash_size", _iFlashSize);
|
||||
}
|
||||
|
||||
void Window::vOnJoypadConfigure()
|
||||
{
|
||||
JoypadConfigDialog oDialog(m_poInputConfig);
|
||||
|
@ -517,6 +440,20 @@ void Window::vOnGameBoyConfigure()
|
|||
poDialog->hide();
|
||||
}
|
||||
|
||||
void Window::vOnGameBoyAdvanceConfigure()
|
||||
{
|
||||
std::string sUiFile = sGetUiFilePath("gameboyadvance.ui");
|
||||
Glib::RefPtr<Gtk::Builder> poBuilder = Gtk::Builder::create_from_file(sUiFile);
|
||||
|
||||
GameBoyAdvanceConfigDialog * poDialog = 0;
|
||||
poBuilder->get_widget_derived("GameBoyAdvanceConfigDialog", poDialog);
|
||||
poDialog->vSetConfig(m_poCoreConfig, this);
|
||||
poDialog->set_transient_for(*this);
|
||||
poDialog->run();
|
||||
poDialog->hide();
|
||||
}
|
||||
|
||||
|
||||
void Window::vOnHelpAbout()
|
||||
{
|
||||
Gtk::AboutDialog oAboutDialog;
|
||||
|
|
Loading…
Reference in New Issue