gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r9827: Minor cleanups, simplificatio


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9827: Minor cleanups, simplification and documentation of Gui class.
Date: Wed, 24 Sep 2008 10:35:29 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9827
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Wed 2008-09-24 10:35:29 +0200
message:
  Minor cleanups, simplification and documentation of Gui class.
modified:
  gui/fltk.cpp
  gui/gtk.cpp
  gui/gui.cpp
  gui/gui.h
  gui/kde.cpp
    ------------------------------------------------------------
    revno: 9825.1.2
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Wed 2008-09-24 09:44:50 +0200
    message:
      Remove menu_* proxy functions from the Gui base class. Call functions
      directly instead.
    modified:
      gui/fltk.cpp
      gui/gtk.cpp
      gui/gui.cpp
      gui/gui.h
      gui/kde.cpp
    ------------------------------------------------------------
    revno: 9825.1.3
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Wed 2008-09-24 09:56:37 +0200
    message:
      Drop unused member, document others.
    modified:
      gui/gui.h
    ------------------------------------------------------------
    revno: 9825.1.4
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Wed 2008-09-24 10:34:56 +0200
    message:
      Use std::exit.
    modified:
      gui/gui.h
=== modified file 'gui/fltk.cpp'
--- a/gui/fltk.cpp      2008-04-23 10:43:46 +0000
+++ b/gui/fltk.cpp      2008-09-24 07:44:50 +0000
@@ -312,35 +312,35 @@
 fltk_menu_quit(Widget*, void* ptr)
 {
     FltkGui* gui = static_cast<FltkGui*>(ptr);
-    gui->menu_quit();
+    gui->quit();
 }
 
 static void
 fltk_menu_play(Widget*, void* ptr)
 {
     FltkGui* gui = static_cast<FltkGui*>(ptr);
-    gui->menu_play();
+    gui->play();
 }
 
 static void
 fltk_menu_pause(Widget*, void* ptr)
 {
     FltkGui* gui = static_cast<FltkGui*>(ptr);
-    gui->menu_pause();
+    gui->pause();
 }
 
 static void
 fltk_menu_stop(Widget*, void* ptr)
 {
     FltkGui* gui = static_cast<FltkGui*>(ptr);
-    gui->menu_stop();
+    gui->stop();
 }
 
 static void
 fltk_menu_restart(Widget*, void* ptr)
 {
     FltkGui* gui = static_cast<FltkGui*>(ptr);
-    gui->menu_restart();
+    gui->restart();
 }
 
 static void
@@ -376,7 +376,7 @@
 fltk_menu_toggle_sound(Widget*, void* ptr)
 {
     FltkGui* gui = static_cast<FltkGui*>(ptr);
-    gui->menu_toggle_sound();
+    gui->toggleSound();
 }
 
 void

=== modified file 'gui/gtk.cpp'
--- a/gui/gtk.cpp       2008-09-22 07:31:37 +0000
+++ b/gui/gtk.cpp       2008-09-24 07:44:50 +0000
@@ -1606,7 +1606,7 @@
 {
 //    GNASH_REPORT_FUNCTION;
     Gui* gui = static_cast<Gui*>(data);
-    gui->menu_toggle_sound();
+    gui->toggleSound();
 }
 
 void
@@ -1624,7 +1624,7 @@
 {
     //GNASH_REPORT_FUNCTION;
     Gui* gui = static_cast<Gui*>(data);
-    gui->menu_restart();
+    gui->restart();
 }
 
 /// \brief quit complete, and close the application
@@ -1642,7 +1642,7 @@
 {
 //    GNASH_REPORT_FUNCTION;
     Gui* gui = static_cast<Gui*>(data);
-    gui->menu_play();
+    gui->play();
 }
 
 /// \brief toggle between playing or paused.
@@ -1651,7 +1651,7 @@
 {
 //    GNASH_REPORT_FUNCTION;
     Gui* gui = static_cast<Gui*>(data);
-    gui->menu_pause();
+    gui->pause();
 }
 
 /// \brief stop the movie that's playing.
@@ -1660,7 +1660,7 @@
 {
     GNASH_REPORT_FUNCTION;
     Gui* gui = static_cast<Gui*>(data);
-    gui->menu_stop();
+    gui->stop();
 }
 
 /// \brief step forward 1 frame

=== modified file 'gui/gui.cpp'
--- a/gui/gui.cpp       2008-09-12 21:18:45 +0000
+++ b/gui/gui.cpp       2008-09-24 07:44:50 +0000
@@ -215,7 +215,7 @@
 }
 
 void
-Gui::menu_restart()
+Gui::restart()
 {
        _stage->reset();
        _started = false;
@@ -411,29 +411,6 @@
        if ( _stage && _started ) display(_stage);
 }
 
-void
-Gui::menu_quit()
-{
-    quit();
-}
-
-void
-Gui::menu_play()
-{
-    play();
-}
-
-void
-Gui::menu_pause()
-{
-    pause();
-}
-
-void
-Gui::menu_stop()
-{
-    stop();
-}
 
 void
 Gui::menu_step_forward()
@@ -464,7 +441,7 @@
 }
 
 void
-Gui::menu_toggle_sound()
+Gui::toggleSound()
 {
 
     media::sound_handler* s = get_sound_handler();
@@ -588,11 +565,11 @@
                        {
                                case gnash::key::r:
                                case gnash::key::R:
-                                       menu_restart();
+                                       restart();
                                        break;
                                case gnash::key::p:
                                case gnash::key::P:
-                                       menu_pause();
+                                       pause();
                                        break;
                                case gnash::key::l:
                                case gnash::key::L:
@@ -602,7 +579,7 @@
                                case gnash::key::Q:
                                case gnash::key::w:
                                case gnash::key::W:
-                                       menu_quit();
+                                       quit();
                                        break;
                                case gnash::key::f:
                                case gnash::key::F:

=== modified file 'gui/gui.h'
--- a/gui/gui.h 2008-09-14 11:24:32 +0000
+++ b/gui/gui.h 2008-09-24 08:34:56 +0000
@@ -31,6 +31,7 @@
 #include "tree.hh" // for tree
 #endif
 
+#include <cstdlib> // exit
 #include <string>
 #include <map>
 
@@ -120,7 +121,7 @@
     /// The default implementation calls exit(0), which isn't nice.
     /// Please implement the proper main loop quitter in the subclasses.
     ///
-    virtual void quit()  { exit(0); }
+    virtual void quit()  { std::exit(0); }
 
     /// Render the current buffer.
     /// For OpenGL, this means that the front and back buffers are swapped.
@@ -302,28 +303,26 @@
     
     /// Whether gnash is is running as a plugin
     bool isPlugin() const { return (( _xid )); }
-    
-    void setMaxAdvances(unsigned long ul) { if (ul > 0) _maxAdvances = ul; }
+
+    /// Set the maximum number of frame advances before Gnash exits.
+    void setMaxAdvances(unsigned long ul) { if (ul) _maxAdvances = ul; }
     
     void showUpdatedRegions(bool x) { _showUpdatedRegions = x; }
     bool showUpdatedRegions() { return _showUpdatedRegions; }
 
-    /** @name Menu callbacks
-     *  These callbacks will be called when a menu item is clicked.
-     *  @{
-     */
-    void menu_restart();
-    void menu_quit();
-    void menu_about();
-    void menu_play();
-    void menu_pause();
-    void menu_stop();
+    /// Instruct the core to restart the movie and
+    /// set state to play(). This does not change pause
+    /// state.
+    void restart();
+
     void menu_step_forward();
     void menu_step_backward();
     void menu_jump_forward();
     void menu_jump_backward();
-    void menu_toggle_sound();
-    /// @}
+
+    /// Toggle sound state between muted and unmuted. If
+    /// there is no active sound handler this does nothing.
+    void toggleSound();
 
 #ifdef GNASH_FPS_DEBUG
     /// Set the interval between FPS debugging prints

=== modified file 'gui/kde.cpp'
--- a/gui/kde.cpp       2008-06-17 05:19:06 +0000
+++ b/gui/kde.cpp       2008-09-24 07:44:50 +0000
@@ -336,7 +336,7 @@
 qwidget::menuitem_restart_callback()
 {
 //    GNASH_REPORT_FUNCTION;
-    _godfather->menu_restart();
+    _godfather->restart();
 }
 
 /// \brief force redraw of current frame
@@ -360,7 +360,7 @@
 qwidget::menuitem_play_callback()
 {
 //    GNASH_REPORT_FUNCTION;
-    _godfather->menu_play();
+    _godfather->play();
 }
 
 /// \brief toggle that's playing or paused.
@@ -368,7 +368,7 @@
 qwidget::menuitem_pause_callback()
 {
 //    GNASH_REPORT_FUNCTION;
-    _godfather->menu_pause();
+    _godfather->pause();
 }
 
 /// \brief stop the movie that's playing.
@@ -376,7 +376,7 @@
 qwidget::menuitem_stop_callback()
 {
 //    GNASH_REPORT_FUNCTION;
-    _godfather->menu_stop();
+    _godfather->stop();
 }
 
 /// \brief step forward 1 frame


reply via email to

[Prev in Thread] Current Thread [Next in Thread]