[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: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog gui/gtk.cpp gui/gtksup.h gui/gu... |
Date: |
Sat, 18 Aug 2007 13:08:15 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/08/18 13:08:15
Modified files:
. : ChangeLog
gui : gtk.cpp gtksup.h gui.cpp gui.h
Log message:
* gui/gui.{cpp,h}: add a getMovieInfo() function as a quick hack
to print movie information.
* gui/: gtk.cpp, gtksup.h: add a View->movieInfo menu item.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4026&r2=1.4027
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk.cpp?cvsroot=gnash&r1=1.102&r2=1.103
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtksup.h?cvsroot=gnash&r1=1.48&r2=1.49
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.90&r2=1.91
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.h?cvsroot=gnash&r1=1.58&r2=1.59
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4026
retrieving revision 1.4027
diff -u -b -r1.4026 -r1.4027
--- ChangeLog 18 Aug 2007 12:24:40 -0000 1.4026
+++ ChangeLog 18 Aug 2007 13:08:15 -0000 1.4027
@@ -1,3 +1,9 @@
+2007-08-18 Sandro Santilli <address@hidden>
+
+ * gui/gui.{cpp,h}: add a getMovieInfo() function as a quick hack
+ to print movie information.
+ * gui/: gtk.cpp, gtksup.h: add a View->movieInfo menu item.
+
2007-08-18 Benjamin Wolsey <address@hidden>
* configure.ac: define flash player version macros
Index: gui/gtk.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk.cpp,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -b -r1.102 -r1.103
--- gui/gtk.cpp 1 Aug 2007 13:16:39 -0000 1.102
+++ gui/gtk.cpp 18 Aug 2007 13:08:15 -0000 1.103
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: gtk.cpp,v 1.102 2007/08/01 13:16:39 udog Exp $ */
+/* $Id: gtk.cpp,v 1.103 2007/08/18 13:08:15 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -31,6 +31,7 @@
#include "sound_handler.h"
#include "gnash.h" // for get_sound_handler
#include "render_handler.h"
+#include "VM.h"
#include <iostream>
#include <X11/keysym.h>
@@ -162,6 +163,7 @@
createFileMenu(_menubar);
createEditMenu(_menubar);
+ createViewMenu(_menubar);
createControlMenu(_menubar);
createHelpMenu(_menubar);
@@ -391,6 +393,7 @@
#ifdef USE_MENUS
createFileMenu(GTK_WIDGET(_popup_menu));
createEditMenu(GTK_WIDGET(_popup_menu));
+ createViewMenu(GTK_WIDGET(_popup_menu));
createControlMenu(GTK_WIDGET(_popup_menu));
#endif
createHelpMenu(GTK_WIDGET(_popup_menu));
@@ -939,6 +942,71 @@
NULL);
}
+void
+GtkGui::menuitem_movieinfo_callback(GtkMenuItem* /*menuitem*/, gpointer data)
+{
+// GNASH_REPORT_FUNCTION;
+
+ Gui* gui = static_cast<Gui*>(data);
+ assert(gui);
+
+ GtkWidget* label;
+
+ GtkWidget* window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title (GTK_WINDOW (window), _("Movie info"));
+ gtk_widget_show (window);
+
+ std::auto_ptr<InfoTable> infoptr = gui->getMovieInfo();
+ if ( ! infoptr.get() )
+ {
+ label = gtk_label_new (_("VM not initialized yet"));
+ gtk_widget_show (label);
+ gtk_table_attach_defaults (GTK_TABLE (window), label, 0, 1, 0, 1);
+ return;
+ }
+
+ InfoTable& info = *infoptr;
+
+#if 1
+ size_t size = info.size();
+ GtkWidget* table1 = gtk_table_new (size, 2, TRUE);
+ gtk_widget_show (table1);
+ gtk_container_add (GTK_CONTAINER (window), table1);
+
+ for (InfoTable::reverse_iterator i=info.rbegin(), e=info.rend(); i!=e; ++i)
+ {
+ StringPair& p = *i;
+ guint up = size;
+ guint bot = size-1;
+
+ label = gtk_label_new (p.first.c_str());
+ gtk_widget_show (label);
+ gtk_table_attach_defaults (GTK_TABLE (table1), label, 0, 1, bot, up);
+
+ label = gtk_label_new (p.second.c_str());
+ gtk_widget_show (label);
+ gtk_table_attach_defaults (GTK_TABLE (table1), label, 1, 2, bot, up);
+
+ --size;
+ }
+#else
+ GtkWidget* box = gtk_vbox_new (FALSE, 2);
+ gtk_widget_show (box);
+ gtk_container_add (GTK_CONTAINER (window), box);
+
+ for (InfoTable::reverse_iterator i=info.rbegin(), e=info.rend(); i!=e; ++i)
+ {
+ StringPair& p = *i;
+
+ string text = p.first + string(" = ") + p.second;
+ label = gtk_label_new (text.c_str());
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX (box), label, TRUE, FALSE, 3);
+ }
+#endif
+
+}
+
// This pops up the menu when the right mouse button is clicked
gint
@@ -1405,6 +1473,27 @@
this);
}
+// Create a View menu that can be used from the menu bar or the popup.
+void
+GtkGui::createViewMenu(GtkWidget *obj)
+{
+// GNASH_REPORT_FUNCTION;
+ GtkWidget *menuitem = gtk_menu_item_new_with_label (_("View"));
+ gtk_widget_show (menuitem);
+ gtk_container_add (GTK_CONTAINER (obj), menuitem);
+
+ GtkWidget *menu = gtk_menu_new ();
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
+
+ GtkMenuItem *menuitem_movieinfo =
+ GTK_MENU_ITEM(gtk_menu_item_new_with_label(_("Movie info")));
+ gtk_menu_append(menu, GTK_WIDGET(menuitem_movieinfo));
+ gtk_widget_show(GTK_WIDGET(menuitem_movieinfo));
+ g_signal_connect ((gpointer) menuitem_movieinfo, "activate",
+ G_CALLBACK (&menuitem_movieinfo_callback),
+ this);
+}
+
// Create a Help menu that can be used from the menu bar or the popup.
void
GtkGui::createControlMenu(GtkWidget *obj)
Index: gui/gtksup.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gtksup.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- gui/gtksup.h 1 Aug 2007 13:16:40 -0000 1.48
+++ gui/gtksup.h 18 Aug 2007 13:08:15 -0000 1.49
@@ -63,6 +63,7 @@
bool createMenuBar();
void createFileMenu(GtkWidget *obj);
void createEditMenu(GtkWidget *obj);
+ void createViewMenu(GtkWidget *obj);
void createHelpMenu(GtkWidget *obj);
void createControlMenu(GtkWidget *obj);
@@ -95,6 +96,10 @@
static void menuitem_preferences_callback(GtkMenuItem *menuitem,
gpointer instance);
+ /// Show info about the movie currently being played
+ static void menuitem_movieinfo_callback(GtkMenuItem *menuitem,
+ gpointer instance);
+
// GTK Event handlers
static gboolean unrealize_event(GtkWidget *widget, GdkEvent *event,
gpointer data);
Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -b -r1.90 -r1.91
--- gui/gui.cpp 1 Aug 2007 13:16:40 -0000 1.90
+++ gui/gui.cpp 18 Aug 2007 13:08:15 -0000 1.91
@@ -571,6 +571,38 @@
setInvalidatedRegion(bounds);
}
+std::auto_ptr<Gui::InfoTable>
+Gui::getMovieInfo() const
+{
+ std::auto_ptr<InfoTable> ret;
+
+ if ( ! VM::isInitialized() )
+ {
+ return ret;
+ }
+
+ ret.reset(new InfoTable());
+
+ VM& vm = VM::get();
+
+ // Print VM version
+ int vmSWFVersion = vm.getSWFVersion();
+ char buf[16];
+ snprintf(buf, 16, "SWF%d", vmSWFVersion); buf[15] = '\0';
+ ret->push_back(StringPair("VM", buf));
+
+ // Print info about levels (only level0 for now, then will be extended)
+ movie_root& stage = vm.getRoot();
+ boost::intrusive_ptr<movie_instance> level0 = stage.getLevel(0);
+ movie_definition* def0 = level0->get_movie_definition();
+ assert(def0);
+ snprintf(buf, 16, "SWF%d", def0->get_version()); buf[15] = '\0';
+ ret->push_back(StringPair("_level0 SWFVersion", string(buf)));
+ ret->push_back(StringPair("_level0 URL", def0->get_url()));
+
+ return ret;
+}
+
#ifdef GNASH_FPS_DEBUG
void
Gui::fpsCounterTick()
Index: gui/gui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.h,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -b -r1.58 -r1.59
--- gui/gui.h 1 Aug 2007 13:16:40 -0000 1.58
+++ gui/gui.h 18 Aug 2007 13:08:15 -0000 1.59
@@ -245,6 +245,16 @@
}
#endif // def GNASH_FPS_DEBUG
+ // TODO: use a tree-like structure (tree.hh?)
+ typedef std::pair<std::string,std::string> StringPair;
+ typedef std::vector<StringPair> InfoTable;
+
+ /// \brief
+ /// Return a table containing informations about the movie
+ /// currently being played (or NULL, if the VM isn't initialized yet)
+ ///
+ std::auto_ptr<InfoTable> getMovieInfo() const;
+
protected:
/// Default constructor. Initialises members to safe defaults.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog gui/gtk.cpp gui/gtksup.h gui/gu...,
Sandro Santilli <=