From: S?bastien G. <kx...@us...> - 2004-04-27 23:16:42
|
Update of /cvsroot/vba/VisualBoyAdvance/src/gtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1856 Modified Files: vba.glade window.cpp window.h Log Message: Added directories support with a few other things. Index: vba.glade =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gtk/vba.glade,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** vba.glade 26 Apr 2004 23:42:27 -0000 1.6 --- vba.glade 27 Apr 2004 23:16:31 -0000 1.7 *************** *** 31,35 **** <child> ! <widget class="GtkMenuBar" id="menubar1"> <property name="visible">True</property> --- 31,35 ---- <child> ! <widget class="GtkMenuBar" id="MenuBar"> <property name="visible">True</property> *************** *** 51,55 **** <child internal-child="image"> ! <widget class="GtkImage" id="image80"> <property name="visible">True</property> <property name="stock">gtk-open</property> --- 51,55 ---- <child internal-child="image"> ! <widget class="GtkImage" id="image90"> <property name="visible">True</property> <property name="stock">gtk-open</property> *************** *** 200,204 **** <child internal-child="image"> ! <widget class="GtkImage" id="image81"> <property name="visible">True</property> <property name="stock">gtk-close</property> --- 200,204 ---- <child internal-child="image"> ! <widget class="GtkImage" id="image91"> <property name="visible">True</property> <property name="stock">gtk-close</property> *************** *** 221,225 **** <child internal-child="image"> ! <widget class="GtkImage" id="image82"> <property name="visible">True</property> <property name="stock">gtk-quit</property> --- 221,225 ---- <child internal-child="image"> ! <widget class="GtkImage" id="image92"> <property name="visible">True</property> <property name="stock">gtk-quit</property> *************** *** 638,641 **** --- 638,658 ---- <child> + <widget class="GtkMenuItem" id="EmulatorDirectories"> + <property name="visible">True</property> + <property name="label" translatable="yes">Directories...</property> + <property name="use_underline">True</property> + </widget> + </child> + + <child> + <widget class="GtkCheckMenuItem" id="EmulatorPauseWhenInactive"> + <property name="visible">True</property> + <property name="label" translatable="yes">Pause when inactive window</property> + <property name="use_underline">True</property> + <property name="active">False</property> + </widget> + </child> + + <child> <widget class="GtkMenuItem" id="ShowSpeedMenu"> <property name="visible">True</property> *************** *** 777,793 **** <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> - <property name="active">False</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> --- 794,810 ---- <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> + <property name="active">False</property> </widget> </child> *************** *** 1909,1911 **** --- 1926,2522 ---- </widget> + <widget class="GtkDialog" id="DirectoriesDialog"> + <property name="visible">True</property> + <property name="title" translatable="yes">Directories</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> + <property name="modal">False</property> + <property name="resizable">True</property> + <property name="destroy_with_parent">True</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">False</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + <property name="has_separator">True</property> + + <child internal-child="vbox"> + <widget class="GtkVBox" id="dialog-vbox3"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child internal-child="action_area"> + <widget class="GtkHButtonBox" id="dialog-action_area3"> + <property name="visible">True</property> + <property name="layout_style">GTK_BUTTONBOX_END</property> + + <child> + <widget class="GtkButton" id="cancelbutton2"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-cancel</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="response_id">-6</property> + </widget> + </child> + + <child> + <widget class="GtkButton" id="okbutton2"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-ok</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="response_id">-5</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + + <child> + <widget class="GtkTable" id="table1"> + <property name="visible">True</property> + <property name="n_rows">5</property> + <property name="n_columns">4</property> + <property name="homogeneous">False</property> + <property name="row_spacing">0</property> + <property name="column_spacing">0</property> + + <child> + <widget class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="label" translatable="yes">GBA roms : </property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">1</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options">expand</property> + </packing> + </child> + + <child> + <widget class="GtkEntry" id="GBARomsDirEntry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char" translatable="yes">*</property> + <property name="activates_default">False</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="y_options">expand</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="GBARomsDirResetButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NONE</property> + <property name="focus_on_click">True</property> + + <child> + <widget class="GtkImage" id="image83"> + <property name="visible">True</property> + <property name="stock">gtk-cancel</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + </child> + </widget> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options">expand</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="GBARomsDirSelectButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NONE</property> + <property name="focus_on_click">True</property> + + <child> + <widget class="GtkImage" id="image84"> + <property name="visible">True</property> + <property name="stock">gtk-open</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + </child> + </widget> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options">expand</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label7"> + <property name="visible">True</property> + <property name="label" translatable="yes">GB roms : </property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">1</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options">expand</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="GBRomsDirSelectButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NONE</property> + <property name="focus_on_click">True</property> + + <child> + <widget class="GtkImage" id="image94"> + <property name="visible">True</property> + <property name="stock">gtk-open</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + </child> + </widget> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options">expand</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label8"> + <property name="visible">True</property> + <property name="label" translatable="yes">Batteries : </property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">1</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options">expand</property> + </packing> + </child> + + <child> + <widget class="GtkEntry" id="BatteriesDirEntry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char" translatable="yes">*</property> + <property name="activates_default">False</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="y_options">expand</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="BatteriesDirSelectButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NONE</property> + <property name="focus_on_click">True</property> + + <child> + <widget class="GtkImage" id="image98"> + <property name="visible">True</property> + <property name="stock">gtk-open</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + </child> + </widget> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options">expand</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="BatteriesDirResetButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NONE</property> + <property name="focus_on_click">True</property> + + <child> + <widget class="GtkImage" id="image95"> + <property name="visible">True</property> + <property name="stock">gtk-cancel</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + </child> + </widget> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options">expand</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label9"> + <property name="visible">True</property> + <property name="label" translatable="yes">Saves : </property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">1</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">fill</property> + <property name="y_options">expand</property> + </packing> + </child> + + <child> + <widget class="GtkEntry" id="SavesDirEntry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char" translatable="yes">*</property> + <property name="activates_default">False</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="y_options">expand</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="SavesDirResetButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NONE</property> + <property name="focus_on_click">True</property> + + <child> + <widget class="GtkImage" id="image96"> + <property name="visible">True</property> + <property name="stock">gtk-cancel</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + </child> + </widget> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">fill</property> + <property name="y_options">expand</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="SavesDirSelectButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NONE</property> + <property name="focus_on_click">True</property> + + <child> + <widget class="GtkImage" id="image99"> + <property name="visible">True</property> + <property name="stock">gtk-open</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + </child> + </widget> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">fill</property> + <property name="y_options">expand</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label10"> + <property name="visible">True</property> + <property name="label" translatable="yes">Captures : </property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">1</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + <property name="x_options">fill</property> + <property name="y_options">expand</property> + </packing> + </child> + + <child> + <widget class="GtkEntry" id="CapturesDirEntry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char" translatable="yes">*</property> + <property name="activates_default">False</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + <property name="y_options">expand</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="CapturesDirResetButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NONE</property> + <property name="focus_on_click">True</property> + + <child> + <widget class="GtkImage" id="image97"> + <property name="visible">True</property> + <property name="stock">gtk-cancel</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + </child> + </widget> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + <property name="x_options">fill</property> + <property name="y_options">expand</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="CapturesDirSelectButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NONE</property> + <property name="focus_on_click">True</property> + + <child> + <widget class="GtkImage" id="image100"> + <property name="visible">True</property> + <property name="stock">gtk-open</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + </child> + </widget> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + <property name="x_options">fill</property> + <property name="y_options">expand</property> + </packing> + </child> + + <child> + <widget class="GtkEntry" id="GBRomsDirEntry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char" translatable="yes">*</property> + <property name="activates_default">False</property> + </widget> + <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> + <property name="y_options">expand</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="GBRomsDirResetButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NONE</property> + <property name="focus_on_click">True</property> + + <child> + <widget class="GtkImage" id="image101"> + <property name="visible">True</property> + <property name="stock">gtk-cancel</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + </child> + </widget> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options">expand</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> + </widget> + </glade-interface> Index: window.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gtk/window.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** window.h 26 Apr 2004 23:42:28 -0000 1.9 --- window.h 27 Apr 2004 23:16:32 -0000 1.10 *************** *** 130,135 **** virtual void vOnVideoScaleToggled(Gtk::CheckMenuItem * _poCMI, int _iScale); virtual void vOnLayerToggled(Gtk::CheckMenuItem * _poCMI, int _iLayer); ! virtual void vOnUseBiosToggled(Gtk::CheckMenuItem * _poCMI); virtual void vOnSelectBios(); virtual void vOnShowSpeedToggled(Gtk::CheckMenuItem * _poCMI, int _iShowSpeed); virtual void vOnSaveTypeToggled(Gtk::CheckMenuItem * _poCMI, int _iSaveType); --- 130,139 ---- virtual void vOnVideoScaleToggled(Gtk::CheckMenuItem * _poCMI, int _iScale); virtual void vOnLayerToggled(Gtk::CheckMenuItem * _poCMI, int _iLayer); ! virtual void vOnDirectories(); ! virtual void vOnDirectoryReset(Gtk::Entry * _poEntry); ! virtual void vOnDirectorySelect(Gtk::Entry * _poEntry); ! 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); *************** *** 153,156 **** --- 157,162 ---- virtual bool bOnEmuIdle(); + virtual bool on_focus_in_event(GdkEventFocus * _pstEvent); + virtual bool on_focus_out_event(GdkEventFocus * _pstEvent); virtual bool on_key_press_event(GdkEventKey * _pstEvent); virtual bool on_key_release_event(GdkEventKey * _pstEvent); *************** *** 189,192 **** --- 195,199 ---- std::string m_sConfigFile; Config::File m_oConfig; + Config::Section * m_poDirConfig; Config::Section * m_poCoreConfig; Config::Section * m_poDisplayConfig; *************** *** 209,212 **** --- 216,220 ---- Keymap m_oKeymap; u32 m_uiJoypadState; + bool m_bPaused; bool m_bWasEmulating; bool m_bAutoFrameskip; Index: window.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gtk/window.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** window.cpp 26 Apr 2004 23:42:27 -0000 1.9 --- window.cpp 27 Apr 2004 23:16:32 -0000 1.10 *************** *** 135,138 **** --- 135,140 ---- m_poFilePauseItem = dynamic_cast<Gtk::CheckMenuItem *>(_poXml->get_widget("FilePause")); m_poFilePauseItem->set_active(false); + m_poFilePauseItem->set_sensitive(false); + vOnFilePauseToggled(m_poFilePauseItem); m_poFilePauseItem->signal_toggled().connect(SigC::bind<Gtk::CheckMenuItem *>( SigC::slot(*this, &Window::vOnFilePauseToggled), *************** *** 279,282 **** --- 281,294 ---- // Emulator menu // + poMI = dynamic_cast<Gtk::MenuItem *>(_poXml->get_widget("EmulatorDirectories")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnDirectories)); + + poCMI = dynamic_cast<Gtk::CheckMenuItem *>(_poXml->get_widget("EmulatorPauseWhenInactive")); + poCMI->set_active(m_poDisplayConfig->oGetKey<bool>("pause_when_inactive")); + vOnPauseWhenInactiveToggled(poCMI); + poCMI->signal_toggled().connect(SigC::bind<Gtk::CheckMenuItem *>( + SigC::slot(*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")); *************** *** 738,741 **** --- 750,762 ---- m_oConfig.vClear(); + // Directories section + // + m_poDirConfig = m_oConfig.poAddSection("Directories"); + m_poDirConfig->vSetKey("gb_roms", "" ); + m_poDirConfig->vSetKey("gba_roms", "" ); + m_poDirConfig->vSetKey("batteries", "" ); + m_poDirConfig->vSetKey("saves", "" ); + m_poDirConfig->vSetKey("captures", "" ); + // Core section // *************** *** 762,771 **** // m_poDisplayConfig = m_oConfig.poAddSection("Display"); ! m_poDisplayConfig->vSetKey("scale", 1 ); ! m_poDisplayConfig->vSetKey("show_speed", ShowPercentage ); ! m_poDisplayConfig->vSetKey("filter2x", FilterNone ); ! m_poDisplayConfig->vSetKey("filterIB", FilterIBNone ); #ifdef MMX ! m_poDisplayConfig->vSetKey("filter_disable_mmx", false ); #endif // MMX --- 783,793 ---- // 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 MMX ! m_poDisplayConfig->vSetKey("filter_disable_mmx", false ); #endif // MMX *************** *** 793,796 **** --- 815,846 ---- std::string sValue; + // Directories section + // + sValue = m_poDirConfig->sGetKey("gb_roms"); + if (sValue != "" && ! Glib::file_test(sValue, Glib::FILE_TEST_IS_DIR)) + { + m_poDirConfig->vSetKey("gb_roms", ""); + } + sValue = m_poDirConfig->sGetKey("gba_roms"); + if (sValue != "" && ! Glib::file_test(sValue, Glib::FILE_TEST_IS_DIR)) + { + m_poDirConfig->vSetKey("gba_roms", ""); + } + sValue = m_poDirConfig->sGetKey("batteries"); + if (sValue != "" && ! Glib::file_test(sValue, Glib::FILE_TEST_IS_DIR)) + { + m_poDirConfig->vSetKey("batteries", ""); + } + sValue = m_poDirConfig->sGetKey("saves"); + if (sValue != "" && ! Glib::file_test(sValue, Glib::FILE_TEST_IS_DIR)) + { + m_poDirConfig->vSetKey("saves", ""); + } + sValue = m_poDirConfig->sGetKey("captures"); + if (sValue != "" && ! Glib::file_test(sValue, Glib::FILE_TEST_IS_DIR)) + { + m_poDirConfig->vSetKey("captures", ""); + } + // Core section // *************** *** 1199,1210 **** } ! if (m_poFilePauseItem->get_active()) ! { ! m_poFilePauseItem->set_active(false); ! } ! else ! { ! vStartEmu(); ! } return true; --- 1249,1255 ---- } ! m_poFilePauseItem->set_sensitive(); ! ! vStartEmu(); return true; *************** *** 1213,1219 **** void Window::vLoadBattery() { ! // TODO : from battery dir - std::string sBattery = sCutSuffix(m_sRomFile) + ".sav"; if (m_stEmulator.emuReadBattery(sBattery.c_str())) { --- 1258,1272 ---- void Window::vLoadBattery() { ! std::string sBattery; ! std::string sDir = m_poDirConfig->sGetKey("batteries"); ! if (sDir == "") ! { ! sBattery = sCutSuffix(m_sRomFile) + ".sav"; ! } ! else ! { ! sBattery = sDir + "/" + sCutSuffix(Glib::path_get_basename(m_sRomFile)) + ".sav"; ! } if (m_stEmulator.emuReadBattery(sBattery.c_str())) { *************** *** 1224,1230 **** void Window::vSaveBattery() { ! // TODO : from battery dir - std::string sBattery = sCutSuffix(m_sRomFile) + ".sav"; if (m_stEmulator.emuWriteBattery(sBattery.c_str())) { --- 1277,1291 ---- void Window::vSaveBattery() { ! std::string sBattery; ! std::string sDir = m_poDirConfig->sGetKey("batteries"); ! if (sDir == "") ! { ! sBattery = sCutSuffix(m_sRomFile) + ".sav"; ! } ! else ! { ! sBattery = sDir + "/" + sCutSuffix(Glib::path_get_basename(m_sRomFile)) + ".sav"; ! } if (m_stEmulator.emuWriteBattery(sBattery.c_str())) { *************** *** 1299,1302 **** --- 1360,1369 ---- m_poFileOpenDialog = new Gtk::FileSelection(_("Open")); m_poFileOpenDialog->set_transient_for(*this); + + std::string sDir = m_poDirConfig->sGetKey("gba_roms"); + if (sDir != "") + { + m_poFileOpenDialog->set_filename(sDir + "/"); + } } *************** *** 1313,1325 **** void Window::vOnFilePauseToggled(Gtk::CheckMenuItem * _poCMI) { if (emulating) { ! if (_poCMI->get_active()) { vStopEmu(); } else { vStartEmu(); } } --- 1380,1395 ---- void Window::vOnFilePauseToggled(Gtk::CheckMenuItem * _poCMI) { + m_bPaused = _poCMI->get_active(); if (emulating) { ! if (m_bPaused) { vStopEmu(); + soundPause(); } else { vStartEmu(); + soundResume(); } } *************** *** 1338,1341 **** --- 1408,1412 ---- if (emulating) { + soundPause(); vStopEmu(); vSetDefaultTitle(); *************** *** 1345,1348 **** --- 1416,1421 ---- m_eCartridge = CartridgeNone; emulating = 0; + + m_poFilePauseItem->set_sensitive(false); } } *************** *** 1463,1469 **** } ! void Window::vOnUseBiosToggled(Gtk::CheckMenuItem * _poCMI) { ! m_poCoreConfig->vSetKey("use_bios_file", _poCMI->get_active()); } --- 1536,1627 ---- } ! void Window::vOnDirectories() { ! Glib::RefPtr<Xml> poXml; ! poXml = Xml::create(PKGDATADIR "/vba.glade", "DirectoriesDialog"); ! ! struct ! { ! const char * m_csKey; ! const char * m_csEntry; ! const char * m_csResetButton; ! const char * m_csSelectButton; ! } ! astRow[] = ! { ! { "gba_roms", "GBARomsDirEntry", "GBARomsDirResetButton", "GBARomsDirSelectButton" }, ! { "gb_roms", "GBRomsDirEntry", "GBRomsDirResetButton", "GBRomsDirSelectButton" }, ! { "batteries", "BatteriesDirEntry", "BatteriesDirResetButton", "BatteriesDirSelectButton" }, ! { "saves", "SavesDirEntry", "SavesDirResetButton", "SavesDirSelectButton" }, ! { "captures", "CapturesDirEntry", "CapturesDirResetButton", "CapturesDirSelectButton" } ! }; ! ! for (guint i = 0; i < sizeof(astRow) / sizeof(astRow[0]); i++) ! { ! Gtk::Entry * poEntry = dynamic_cast<Gtk::Entry *>(poXml->get_widget(astRow[i].m_csEntry)); ! Gtk::Button * poReset = dynamic_cast<Gtk::Button *>(poXml->get_widget(astRow[i].m_csResetButton)); ! Gtk::Button * poSelect = dynamic_cast<Gtk::Button *>(poXml->get_widget(astRow[i].m_csSelectButton)); ! ! poEntry->set_text(m_poDirConfig->sGetKey(astRow[i].m_csKey)); ! ! poReset->signal_clicked().connect(SigC::bind<Gtk::Entry *>( ! SigC::slot(*this, &Window::vOnDirectoryReset), ! poEntry)); ! poSelect->signal_clicked().connect(SigC::bind<Gtk::Entry *>( ! SigC::slot(*this, &Window::vOnDirectorySelect), ! poEntry)); ! } ! ! Gtk::Dialog * poDialog = dynamic_cast<Gtk::Dialog *>(poXml->get_widget("DirectoriesDialog")); ! poDialog->set_transient_for(*this); ! ! if (poDialog->run() == Gtk::RESPONSE_OK) ! { ! for (guint i = 0; i < sizeof(astRow) / sizeof(astRow[0]); i++) ! { ! Gtk::Entry * poEntry = dynamic_cast<Gtk::Entry *>(poXml->get_widget(astRow[i].m_csEntry)); ! Glib::ustring sDir = poEntry->get_text(); ! if (! Glib::file_test(sDir, Glib::FILE_TEST_IS_DIR)) ! { ! sDir = ""; ! } ! m_poDirConfig->vSetKey(astRow[i].m_csKey, sDir); ! } ! } ! ! delete poDialog; ! } ! ! void Window::vOnDirectoryReset(Gtk::Entry * _poEntry) ! { ! _poEntry->set_text(""); ! } ! ! void Window::vOnDirectorySelect(Gtk::Entry * _poEntry) ! { ! Gtk::FileSelection * poDialog = new Gtk::FileSelection(_("Select directory")); ! poDialog->set_transient_for(*this); ! ! if (_poEntry->get_text() != "") ! { ! poDialog->set_filename(_poEntry->get_text() + "/"); ! } ! ! if (poDialog->run() == Gtk::RESPONSE_OK) ! { ! std::string sFile = poDialog->get_filename(); ! if (! Glib::file_test(sFile, Glib::FILE_TEST_IS_DIR)) ! { ! sFile = Glib::path_get_dirname(sFile); ! } ! _poEntry->set_text(sFile); ! } ! ! delete poDialog; ! } ! ! void Window::vOnPauseWhenInactiveToggled(Gtk::CheckMenuItem * _poCMI) ! { ! m_poDisplayConfig->vSetKey("pause_when_inactive", _poCMI->get_active()); } *************** *** 1491,1494 **** --- 1649,1657 ---- } + void Window::vOnUseBiosToggled(Gtk::CheckMenuItem * _poCMI) + { + m_poCoreConfig->vSetKey("use_bios_file", _poCMI->get_active()); + } + void Window::vOnShowSpeedToggled(Gtk::CheckMenuItem * _poCMI, int _iShowSpeed) { *************** *** 1756,1759 **** --- 1919,1946 ---- } + bool Window::on_focus_in_event(GdkEventFocus * _pstEvent) + { + if (emulating + && ! m_bPaused + && m_poDisplayConfig->oGetKey<bool>("pause_when_inactive")) + { + vStartEmu(); + soundResume(); + } + return false; + } + + bool Window::on_focus_out_event(GdkEventFocus * _pstEvent) + { + if (emulating + && ! m_bPaused + && m_poDisplayConfig->oGetKey<bool>("pause_when_inactive")) + { + vStopEmu(); + soundPause(); + } + return false; + } + bool Window::on_key_press_event(GdkEventKey * _pstEvent) { |