[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog gui/gtk.cpp gui/gtksup.h gui/gu...
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] gnash ChangeLog gui/gtk.cpp gui/gtksup.h gui/gu... |
Date: |
Sun, 27 Apr 2008 09:46:40 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Benjamin Wolsey <bwy> 08/04/27 09:46:39
Modified files:
. : ChangeLog
gui : gtk.cpp gtksup.h gui.cpp gui.h
Log message:
* gui/gui.{cpp,h}, gui/gtk{sup.h,.cpp}: add stopHook and
playHook for
startStopped (not pause). Implement in gtk with a massive
button to
click when starting in stopped mode.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6412&r2=1.6413
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk.cpp?cvsroot=gnash&r1=1.175&r2=1.176
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtksup.h?cvsroot=gnash&r1=1.74&r2=1.75
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.161&r2=1.162
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.h?cvsroot=gnash&r1=1.90&r2=1.91
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6412
retrieving revision 1.6413
diff -u -b -r1.6412 -r1.6413
--- ChangeLog 27 Apr 2008 09:12:36 -0000 1.6412
+++ ChangeLog 27 Apr 2008 09:46:37 -0000 1.6413
@@ -1,3 +1,9 @@
+2008-04-27 Robert Millan <address@hidden>
+
+ * gui/gui.{cpp,h}, gui/gtk{sup.h,.cpp}: add stopHook and playHook for
+ startStopped (not pause). Implement in gtk with a massive button to
+ click when starting in stopped mode.
+
2008-04-27 Benjamin Wolsey <address@hidden>
* libbase/rc.{h,cpp}: use boost tokenizer more, parseList doesn't
Index: gui/gtk.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk.cpp,v
retrieving revision 1.175
retrieving revision 1.176
diff -u -b -r1.175 -r1.176
--- gui/gtk.cpp 26 Apr 2008 19:08:40 -0000 1.175
+++ gui/gtk.cpp 27 Apr 2008 09:46:38 -0000 1.176
@@ -97,6 +97,7 @@
,_hildon_program(0)
#endif
,_window(0)
+ ,_resumeButton(0)
,_overlay(0)
,_drawingArea(0)
,_popup_menu(0)
@@ -151,6 +152,19 @@
_drawingArea = gtk_drawing_area_new();
+ // Increase reference count to prevent its destruction (which could happen
+ // later if we remove it from its container).
+ g_object_ref(G_OBJECT(_drawingArea));
+
+ _resumeButton = gtk_button_new();
+ gtk_container_add(GTK_CONTAINER(_resumeButton), gtk_label_new(_("Click to
play")));
+
+ // Same here.
+ g_object_ref(G_OBJECT(_resumeButton));
+
+ // This callback indirectly results in playHook() being called.
+ g_signal_connect(G_OBJECT(_resumeButton), "clicked", G_CALLBACK
(menuitem_play_callback), this);
+
// If we don't set this flag we won't be able to grab focus
// ( grabFocus() would be a no-op )
GTK_WIDGET_SET_FLAGS (GTK_WIDGET(_drawingArea), GTK_CAN_FOCUS);
@@ -235,6 +249,10 @@
g_timeout_add_full (G_PRIORITY_LOW, _interval, (GSourceFunc)advance_movie,
this, NULL);
+ // The first time stop() was called, stopHook() might not have had a chance
+ // to do anything, because GTK+ wasn't garanteed to be initialised.
+ if (isStopped()) stopHook();
+
gtk_main();
return true;
}
@@ -2254,5 +2272,47 @@
return true;
}
+
+void
+GtkGui::stopHook()
+{
+ // FIXME: this can't work for the stand-alone player, because _drawingArea
is
+ // packed into a vbox.
+ if (! _xid) return;
+
+ // Assert they're either both initialised or both uninitialised
+ assert ((_resumeButton && _drawingArea) || !(_resumeButton ||
_drawingArea));
+
+ if (_drawingArea) {
+ gtk_container_remove(GTK_CONTAINER(_window), _drawingArea);
+ }
+
+ if (_resumeButton) {
+ gtk_container_add(GTK_CONTAINER(_window), _resumeButton);
+ }
+
+ gtk_widget_show_all(_resumeButton);
+}
+
+void
+GtkGui::playHook()
+{
+ // FIXME: this can't work for the stand-alone player, because _drawingArea
is
+ // packed into a vbox.
+ if (! _xid) return;
+
+ // Assert they're either both initialised or both uninitialised
+ assert ((_resumeButton && _drawingArea) || !(_resumeButton ||
_drawingArea));
+
+ if (_resumeButton) {
+ gtk_container_remove(GTK_CONTAINER(_window), _resumeButton);
+ }
+ if (_drawingArea) {
+ gtk_container_add(GTK_CONTAINER(_window), _drawingArea);
+ }
+
+ gtk_widget_show(_drawingArea);
+}
+
} // end of namespace gnash
Index: gui/gtksup.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gtksup.h,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -b -r1.74 -r1.75
--- gui/gtksup.h 14 Apr 2008 08:55:29 -0000 1.74
+++ gui/gtksup.h 27 Apr 2008 09:46:39 -0000 1.75
@@ -200,6 +200,7 @@
HildonProgram *_hildon_program;
#endif
GtkWidget *_window;
+ GtkWidget *_resumeButton;
// A window only for rendering the plugin as fullscreen.
GtkWidget *_overlay;
@@ -267,6 +268,8 @@
static void handlePrefs(GtkWidget* widget, gint response, gpointer data);
static void openFile(GtkWidget* dialog, gpointer data);
+ void stopHook();
+ void playHook();
};
// end of namespace gnash
Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.161
retrieving revision 1.162
diff -u -b -r1.161 -r1.162
--- gui/gui.cpp 25 Apr 2008 15:07:46 -0000 1.161
+++ gui/gui.cpp 27 Apr 2008 09:46:39 -0000 1.162
@@ -842,6 +842,8 @@
_stopped = false;
if ( ! _started ) start();
+
+ playHook ();
}
void
@@ -850,6 +852,8 @@
if ( _stopped ) return;
_stopped = true;
+
+ stopHook ();
}
void
Index: gui/gui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.h,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -b -r1.90 -r1.91
--- gui/gui.h 23 Apr 2008 14:55:28 -0000 1.90
+++ gui/gui.h 27 Apr 2008 09:46:39 -0000 1.91
@@ -412,6 +412,12 @@
// Maximum number of advances before exit; 0 for no limit.
unsigned long _maxAdvances;
+ /// Called by Gui::stop(). This can be used by GUIs to implement pause
+ /// widgets (so that resuming a stopped animation is more user-friendly)
+ virtual void stopHook() {}
+ /// Called by Gui::play().
+ virtual void playHook() {}
+
private:
/// Width of a window pixel, in stage pseudopixel units.