[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog gui/gtk.cpp gui/gui.cpp gui/gui.h
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog gui/gtk.cpp gui/gui.cpp gui/gui.h |
Date: |
Wed, 07 Mar 2007 23:52:14 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/03/07 23:52:14
Modified files:
. : ChangeLog
gui : gtk.cpp gui.cpp gui.h
Log message:
* gui/gui.{h,cpp}: add play(), pause() and stop() methods,
change implementation to be semantically correct and not
mess with sprites playstate; Changed menu_* to non-statics
to properly acces state. I'm sure this will break fltk but
fixing should be easy with men_fun and bind1st..
* gui/gtk.cpp: enable stop(), pause() and play() menu items.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2572&r2=1.2573
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk.cpp?cvsroot=gnash&r1=1.74&r2=1.75
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.66&r2=1.67
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.h?cvsroot=gnash&r1=1.45&r2=1.46
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2572
retrieving revision 1.2573
diff -u -b -r1.2572 -r1.2573
--- ChangeLog 7 Mar 2007 22:47:52 -0000 1.2572
+++ ChangeLog 7 Mar 2007 23:52:13 -0000 1.2573
@@ -1,5 +1,11 @@
2007-03-07 Sandro Santilli <address@hidden>
+ * gui/gui.{h,cpp}: add play(), pause() and stop() methods,
+ change implementation to be semantically correct and not
+ mess with sprites playstate; Changed menu_* to non-statics
+ to properly acces state. I'm sure this will break fltk but
+ fixing should be easy with men_fun and bind1st..
+ * gui/gtk.cpp: enable stop(), pause() and play() menu items.
* server/asobj/ContextMenu.cpp: Some more stubs.
* testsuite/actionscript.all/ContextMenu.as: Some more tests.
* server/as_value.cpp (to_bool) don't choke
Index: gui/gtk.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk.cpp,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -b -r1.74 -r1.75
--- gui/gtk.cpp 6 Mar 2007 18:06:13 -0000 1.74
+++ gui/gtk.cpp 7 Mar 2007 23:52:13 -0000 1.75
@@ -14,7 +14,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-/* $Id: gtk.cpp,v 1.74 2007/03/06 18:06:13 rsavoye Exp $ */
+/* $Id: gtk.cpp,v 1.75 2007/03/07 23:52:13 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -277,7 +277,7 @@
_drawbounds.clear();
- for (int rno=0; rno<ranges.size(); rno++) {
+ for (unsigned rno=0; rno<ranges.size(); rno++) {
geometry::Range2d<int> bounds = Intersection(
_renderer->world_to_pixel(ranges.getRange(rno)),
@@ -904,19 +904,21 @@
/// \brief Toggle the sound on or off
void
-GtkGui::menuitem_sound_callback(GtkMenuItem* /*menuitem*/, gpointer /*data*/)
+GtkGui::menuitem_sound_callback(GtkMenuItem* /*menuitem*/, gpointer data)
{
// GNASH_REPORT_FUNCTION;
- menu_toggle_sound();
+ Gui* gui = static_cast<Gui*>(data);
+ gui->menu_toggle_sound();
}
/// \brief restart the movie from the beginning
void
-GtkGui::menuitem_restart_callback(GtkMenuItem* /*menuitem*/, gpointer /*data*/)
+GtkGui::menuitem_restart_callback(GtkMenuItem* /*menuitem*/, gpointer data)
{
// GNASH_REPORT_FUNCTION;
- menu_restart();
+ Gui* gui = static_cast<Gui*>(data);
+ gui->menu_restart();
}
/// \brief quit complete, and close the application
@@ -930,62 +932,69 @@
/// \brief Start the movie playing from the current frame.
void
-GtkGui::menuitem_play_callback(GtkMenuItem* /*menuitem*/, gpointer /*data*/)
+GtkGui::menuitem_play_callback(GtkMenuItem* /*menuitem*/, gpointer data)
{
// GNASH_REPORT_FUNCTION;
- menu_play();
+ Gui* gui = static_cast<Gui*>(data);
+ gui->menu_play();
}
/// \brief toggle that's playing or paused.
void
-GtkGui::menuitem_pause_callback(GtkMenuItem* /*menuitem*/, gpointer /*data*/)
+GtkGui::menuitem_pause_callback(GtkMenuItem* /*menuitem*/, gpointer data)
{
// GNASH_REPORT_FUNCTION;
- menu_pause();
+ Gui* gui = static_cast<Gui*>(data);
+ gui->menu_pause();
}
/// \brief stop the movie that's playing.
void
-GtkGui::menuitem_stop_callback(GtkMenuItem* /*menuitem*/, gpointer /*data*/)
+GtkGui::menuitem_stop_callback(GtkMenuItem* /*menuitem*/, gpointer data)
{
-// GNASH_REPORT_FUNCTION;
- menu_stop();
+ GNASH_REPORT_FUNCTION;
+ Gui* gui = static_cast<Gui*>(data);
+ gui->menu_stop();
}
/// \brief step forward 1 frame
void
GtkGui::menuitem_step_forward_callback(GtkMenuItem* /*menuitem*/,
- gpointer /*data*/)
+ gpointer data)
{
// GNASH_REPORT_FUNCTION;
- menu_step_forward();
+ Gui* gui = static_cast<Gui*>(data);
+ gui->menu_step_forward();
}
/// \brief step backward 1 frame
void
GtkGui::menuitem_step_backward_callback(GtkMenuItem* /*menuitem*/,
- gpointer /*data*/)
+ gpointer data)
{
// GNASH_REPORT_FUNCTION;
- menu_step_backward();
+ Gui* gui = static_cast<Gui*>(data);
+ gui->menu_step_backward();
}
/// \brief jump forward 10 frames
void
GtkGui::menuitem_jump_forward_callback(GtkMenuItem* /*menuitem*/,
- gpointer /*data*/)
+ gpointer data)
{
// GNASH_REPORT_FUNCTION;
- menu_jump_forward();
+ Gui* gui = static_cast<Gui*>(data);
+ gui->menu_jump_forward();
}
/// \brief jump backward 10 frames
void
GtkGui::menuitem_jump_backward_callback(GtkMenuItem* /*menuitem*/,
- gpointer /*data*/)
+ gpointer data)
{
// GNASH_REPORT_FUNCTION;
- menu_jump_backward();
+ Gui* gui = static_cast<Gui*>(data);
+ gui->menu_jump_backward();
}
//
@@ -1145,10 +1154,12 @@
gboolean
GtkGui::key_press_event(GtkWidget *const /*widget*/,
GdkEventKey *const event,
- const gpointer /*data*/)
+ const gpointer data)
{
GNASH_REPORT_FUNCTION;
+ Gui* gui = static_cast<Gui*>(data);
+
/* Forward key event to gnash */
gnash::key::code c = gdk_to_gnash_key(event->keyval);
@@ -1168,14 +1179,14 @@
dbglogfile << "Got Control-key: " << key << endl;
switch(key) {
case 'r':
- menu_restart();
+ gui->menu_restart();
break;
case 'p':
- menu_pause();
+ gui->menu_pause();
break;
case 'q':
case 'w':
- menu_quit();
+ gui->menu_quit();
break;
default:
break;
@@ -1363,14 +1374,23 @@
GTK_MENU_ITEM(gtk_menu_item_new_with_label("Play Movie"));
gtk_menu_append(menu, GTK_WIDGET(menuitem_play));
gtk_widget_show(GTK_WIDGET(menuitem_play));
+ g_signal_connect ((gpointer) menuitem_play, "activate",
+ G_CALLBACK (&menuitem_play_callback), this);
+
GtkMenuItem *menuitem_pause =
GTK_MENU_ITEM(gtk_menu_item_new_with_label("Pause Movie"));
gtk_menu_append(menu, GTK_WIDGET(menuitem_pause));
gtk_widget_show(GTK_WIDGET(menuitem_pause));
+ g_signal_connect ((gpointer) menuitem_pause, "activate",
+ G_CALLBACK (&menuitem_pause_callback), this);
+
GtkMenuItem *menuitem_stop =
GTK_MENU_ITEM(gtk_menu_item_new_with_label("Stop Movie"));
gtk_menu_append(menu, GTK_WIDGET(menuitem_stop));
gtk_widget_show(GTK_WIDGET(menuitem_stop));
+ g_signal_connect ((gpointer) menuitem_stop, "activate",
+ G_CALLBACK (&menuitem_stop_callback), this);
+
GtkMenuItem *menuitem_restart =
GTK_MENU_ITEM(gtk_menu_item_new_with_label("Restart Movie"));
gtk_menu_append(menu, GTK_WIDGET(menuitem_restart));
Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -b -r1.66 -r1.67
--- gui/gui.cpp 6 Mar 2007 14:27:22 -0000 1.66
+++ gui/gui.cpp 7 Mar 2007 23:52:13 -0000 1.67
@@ -68,7 +68,8 @@
_depth(16),
_interval(0),
_renderer(NULL),
- _redraw_flag(true)
+ _redraw_flag(true),
+ _stopped(false)
{
// GNASH_REPORT_FUNCTION;
}
@@ -84,7 +85,8 @@
_depth(depth),
_interval(0),
_renderer(NULL),
- _redraw_flag(true)
+ _redraw_flag(true),
+ _stopped(false)
{
}
@@ -160,7 +162,8 @@
Gui::menu_play()
{
// GNASH_REPORT_FUNCTION;
- get_current_root()->set_play_state(gnash::sprite_instance::PLAY);
+ //get_current_root()->set_play_state(gnash::sprite_instance::PLAY);
+ play();
}
void
@@ -168,12 +171,13 @@
{
// GNASH_REPORT_FUNCTION;
- movie_root* m = get_current_root();
- if (m->get_play_state() == gnash::sprite_instance::STOP) {
- m->set_play_state(gnash::sprite_instance::PLAY);
- } else {
- m->set_play_state(gnash::sprite_instance::STOP);
- }
+ pause();
+// movie_root* m = get_current_root();
+// if (m->get_play_state() == gnash::sprite_instance::STOP) {
+// m->set_play_state(gnash::sprite_instance::PLAY);
+// } else {
+// m->set_play_state(gnash::sprite_instance::STOP);
+// }
}
@@ -181,7 +185,8 @@
Gui::menu_stop()
{
// GNASH_REPORT_FUNCTION;
- get_current_root()->set_play_state(gnash::sprite_instance::STOP);
+ //get_current_root()->set_play_state(gnash::sprite_instance::STOP);
+ stop();
}
void
@@ -390,6 +395,8 @@
{
assert(gui);
+ if ( gui->isStopped() ) return true;
+
// GNASH_REPORT_FUNCTION;
gnash::movie_root* m = gnash::get_current_root();
Index: gui/gui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- gui/gui.h 28 Feb 2007 17:25:25 -0000 1.45
+++ gui/gui.h 7 Mar 2007 23:52:13 -0000 1.46
@@ -188,21 +188,42 @@
/// interval specified in the call to setInterval().
static bool advance_movie(Gui* gui);
+ /// Put the application in "stop" mode
+ //
+ /// When in stop mode the application won't be advanced.
+ ///
+ void stop() { _stopped=true; }
+
+ /// Put the application in "play" mode
+ //
+ /// When in stop mode the application will be advanced as usual.
+ ///
+ void play() { _stopped=false; }
+
+ /// Toggle between "stop" and "play" mode
+ //
+ /// See stop() and play()
+ ///
+ void pause() { _stopped = !_stopped; }
+
+ /// See stop(), play() and pause()
+ bool isStopped() const { return _stopped; }
+
/** @name Menu callbacks
* These callbacks will be called when a menu item is clicked.
* @{
*/
- static void menu_restart();
- static void menu_quit();
- static void menu_about();
- static void menu_play();
- static void menu_pause();
- static void menu_stop();
- static void menu_step_forward();
- static void menu_step_backward();
- static void menu_jump_forward();
- static void menu_jump_backward();
- static void menu_toggle_sound();
+ void menu_restart();
+ void menu_quit();
+ void menu_about();
+ void menu_play();
+ void menu_pause();
+ void menu_stop();
+ void menu_step_forward();
+ void menu_step_backward();
+ void menu_jump_forward();
+ void menu_jump_backward();
+ void menu_toggle_sound();
/// @}
protected:
@@ -237,6 +258,8 @@
/// window size did change.
bool _redraw_flag;
+ bool _stopped;
+
private:
bool display(movie_root* m);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog gui/gtk.cpp gui/gui.cpp gui/gui.h,
Sandro Santilli <=