From a24c229a2866dc3186cc6903ee42aa7309d9d6bf Mon Sep 17 00:00:00 2001 From: bgk Date: Tue, 28 Oct 2008 09:20:13 +0000 Subject: [PATCH] GTK : Moved the video scale selection to the display config dialog --- src/gtk/displayconfig.cpp | 15 +++++++ src/gtk/displayconfig.h | 2 + src/gtk/ui/display.ui | 80 +++++++++++++++++++++++++++++++++++++ src/gtk/vba.glade | 59 --------------------------- src/gtk/window.cpp | 30 -------------- src/gtk/window.h | 3 +- src/gtk/windowcallbacks.cpp | 11 ----- 7 files changed, 98 insertions(+), 102 deletions(-) diff --git a/src/gtk/displayconfig.cpp b/src/gtk/displayconfig.cpp index dab7ec20..8170cc8d 100644 --- a/src/gtk/displayconfig.cpp +++ b/src/gtk/displayconfig.cpp @@ -35,12 +35,14 @@ DisplayConfigDialog::DisplayConfigDialog(GtkDialog* _pstDialog, const Glib::RefP { refBuilder->get_widget("FiltersComboBox", m_poFiltersComboBox); refBuilder->get_widget("IBFiltersComboBox", m_poIBFiltersComboBox); + refBuilder->get_widget("DefaultScaleComboBox", m_poDefaultScaleComboBox); refBuilder->get_widget("OutputOpenGL", m_poOutputOpenGLRadioButton); refBuilder->get_widget("OutputCairo", m_poOutputCairoRadioButton); refBuilder->get_widget("OutputXv", m_poOutputXvRadioButton); m_poFiltersComboBox->signal_changed().connect(sigc::mem_fun(*this, &DisplayConfigDialog::vOnFilterChanged)); m_poIBFiltersComboBox->signal_changed().connect(sigc::mem_fun(*this, &DisplayConfigDialog::vOnFilterIBChanged)); + m_poDefaultScaleComboBox->signal_changed().connect(sigc::mem_fun(*this, &DisplayConfigDialog::vOnScaleChanged)); m_poOutputOpenGLRadioButton->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &DisplayConfigDialog::vOnOutputChanged), VBA::Window::OutputOpenGL)); m_poOutputCairoRadioButton->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &DisplayConfigDialog::vOnOutputChanged), VBA::Window::OutputCairo)); m_poOutputXvRadioButton->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &DisplayConfigDialog::vOnOutputChanged), VBA::Window::OutputXvideo)); @@ -78,6 +80,9 @@ void DisplayConfigDialog::vSetConfig(Config::Section * _poConfig, VBA::Window * int iDefaultFilterIB = m_poConfig->oGetKey("filterIB"); m_poIBFiltersComboBox->set_active(iDefaultFilterIB); + int iDefaultScale = m_poConfig->oGetKey("scale"); + m_poDefaultScaleComboBox->set_active(iDefaultScale - 1); + // Set the default output module VBA::Window::EVideoOutput _eOutput = (VBA::Window::EVideoOutput)m_poConfig->oGetKey("output"); switch (_eOutput) @@ -126,4 +131,14 @@ void DisplayConfigDialog::vOnOutputChanged(VBA::Window::EVideoOutput _eOutput) m_poWindow->vApplyConfigScreenArea(); } +void DisplayConfigDialog::vOnScaleChanged() +{ + int iScale = m_poDefaultScaleComboBox->get_active_row_number() + 1; + if (iScale > 0) + { + m_poConfig->vSetKey("scale", iScale); + m_poWindow->vUpdateScreen(); + } +} + } // namespace VBA diff --git a/src/gtk/displayconfig.h b/src/gtk/displayconfig.h index 851cda46..18dbd5f8 100644 --- a/src/gtk/displayconfig.h +++ b/src/gtk/displayconfig.h @@ -40,12 +40,14 @@ private: void vOnFilterChanged(); void vOnFilterIBChanged(); void vOnOutputChanged(VBA::Window::EVideoOutput _eOutput); + void vOnScaleChanged(); VBA::Window * m_poWindow; Config::Section * m_poConfig; Gtk::ComboBox * m_poFiltersComboBox; Gtk::ComboBox * m_poIBFiltersComboBox; + Gtk::ComboBox * m_poDefaultScaleComboBox; Gtk::RadioButton * m_poOutputOpenGLRadioButton; Gtk::RadioButton * m_poOutputCairoRadioButton; Gtk::RadioButton * m_poOutputXvRadioButton; diff --git a/src/gtk/ui/display.ui b/src/gtk/ui/display.ui index 0cfb4c16..76caecf0 100644 --- a/src/gtk/ui/display.ui +++ b/src/gtk/ui/display.ui @@ -18,6 +18,31 @@ + + + + + + + 1x + + + 2x + + + 3x + + + 4x + + + 5x + + + 6x + + + 5 GTK_WIN_POS_CENTER_ON_PARENT @@ -91,6 +116,61 @@ 1 + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + + + True + + + True + 1 + Default scaling : + GTK_JUSTIFY_RIGHT + + + False + + + + + True + ScalingListStore + + + + 0 + + + + + 1 + + + + + + + + + True + <b>Zoom</b> + True + + + + + False + 2 + + True diff --git a/src/gtk/vba.glade b/src/gtk/vba.glade index e4135848..9c9b665d 100644 --- a/src/gtk/vba.glade +++ b/src/gtk/vba.glade @@ -452,65 +452,6 @@ - - - True - _Video - True - - - - - True - _1x - True - True - - - - - True - _2x - True - Video1x - - - - - True - _3x - True - Video1x - - - - - True - _4x - True - Video1x - - - - - True - _5x - True - Video1x - - - - - True - _6x - True - Video1x - - - - - - True diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index b75675a6..ee7ecf3c 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -281,36 +281,6 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr & _poXml) : poCMI, astFrameskip[i].m_iFrameskip)); } - // Video menu - // - struct - { - const char * m_csName; - const int m_iScale; - } - astVideoScale[] = - { - { "Video1x", 1 }, - { "Video2x", 2 }, - { "Video3x", 3 }, - { "Video4x", 4 }, - { "Video5x", 5 }, - { "Video6x", 6 } - }; - int iDefaultScale = m_poDisplayConfig->oGetKey("scale"); - for (guint i = 0; i < G_N_ELEMENTS(astVideoScale); i++) - { - poCMI = dynamic_cast(_poXml->get_widget(astVideoScale[i].m_csName)); - if (astVideoScale[i].m_iScale == iDefaultScale) - { - poCMI->set_active(); - vOnVideoScaleToggled(poCMI, iDefaultScale); - } - poCMI->signal_toggled().connect(sigc::bind( - sigc::mem_fun(*this, &Window::vOnVideoScaleToggled), - poCMI, astVideoScale[i].m_iScale)); - } - // Emulator menu // poMI = dynamic_cast(_poXml->get_widget("DirectoriesConfigure")); diff --git a/src/gtk/window.h b/src/gtk/window.h index 64187a88..411b56d9 100644 --- a/src/gtk/window.h +++ b/src/gtk/window.h @@ -78,6 +78,7 @@ public: void vApplyConfigFilter(); void vApplyConfigFilterIB(); void vApplyConfigScreenArea(); + void vUpdateScreen(); inline ECartridge eGetCartridge() const { return m_eCartridge; } @@ -148,7 +149,6 @@ protected: virtual void vOnFileExit(); virtual void vOnFrameskipToggled(Gtk::CheckMenuItem * _poCMI, int _iValue); virtual void vOnVideoFullscreen(); - virtual void vOnVideoScaleToggled(Gtk::CheckMenuItem * _poCMI, int _iScale); virtual void vOnDirectories(); virtual void vOnPauseWhenInactiveToggled(Gtk::CheckMenuItem * _poCMI); virtual void vOnSelectBios(); @@ -270,7 +270,6 @@ private: void vHistoryAdd(const std::string & _rsFile); void vApplyConfigJoypads(); void vSaveJoypadsToConfig(); - void vUpdateScreen(); void vDrawDefaultScreen(); void vSetDefaultTitle(); void vCreateFileOpenDialog(); diff --git a/src/gtk/windowcallbacks.cpp b/src/gtk/windowcallbacks.cpp index d0744f81..45fdeed3 100644 --- a/src/gtk/windowcallbacks.cpp +++ b/src/gtk/windowcallbacks.cpp @@ -363,17 +363,6 @@ void Window::vOnVideoFullscreen() vToggleFullscreen(); } -void Window::vOnVideoScaleToggled(Gtk::CheckMenuItem * _poCMI, int _iScale) -{ - if (! _poCMI->get_active()) - { - return; - } - - m_poDisplayConfig->vSetKey("scale", _iScale); - vUpdateScreen(); -} - void Window::vOnDirectories() { DirectoriesConfigDialog oDialog(m_poDirConfig);