gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog configure.ac gui/Makefile.am gu...


From: Bastiaan Jacques
Subject: [Gnash-commit] gnash ChangeLog configure.ac gui/Makefile.am gu...
Date: Wed, 10 Jan 2007 19:21:15 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Bastiaan Jacques <bjacques>     07/01/10 19:21:15

Modified files:
        .              : ChangeLog configure.ac 
        gui            : Makefile.am Player.cpp gtk.cpp gui.cpp gui.h 
Added files:
        gui            : fltk.cpp fltk_glue_agg.cpp fltk_glue_agg.h 
                         fltk_glue_cairo.cpp fltk_glue_cairo.h fltksup.h 

Log message:
                * gui/{fltk.cpp, fltksup.h}: Initial FLTK GUI implementation.
                * gui/{fltk_glue_agg.cpp, fltk_glue_agg.h}: Agg glue for the 
FLTK GUI. 
                * gui/{fltk_glue_cairo.cpp, fltk_glue_cairo.h}: Cairo glue for 
the
                FLTK GUI. 
                * configure.ac: Allow the FLTK/Agg combination. Detect the FLTK
                library when the FLTK GUI was selected.
                * gui/Makefile.am: Build the FLTK GUI when requested.
                * gui/Player.cpp: Enable the FLTK GUI.
                * gui/gtk.cpp: Use an anonymous namespace for dbglogfile to 
avoid
                symbol collisions.
                * gui/gtk.cpp, gui/gui{.h, .cpp}: Move 
GtkGui::menuitem_sound_callback
                to class Gui so other GUIs can use it.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2074&r2=1.2075
http://cvs.savannah.gnu.org/viewcvs/gnash/configure.ac?cvsroot=gnash&r1=1.229&r2=1.230
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Makefile.am?cvsroot=gnash&r1=1.54&r2=1.55
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.cpp?cvsroot=gnash&r1=1.39&r2=1.40
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk.cpp?cvsroot=gnash&r1=1.60&r2=1.61
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.55&r2=1.56
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.h?cvsroot=gnash&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/fltk.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/fltk_glue_agg.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/fltk_glue_agg.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/fltk_glue_cairo.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/fltk_glue_cairo.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/fltksup.h?cvsroot=gnash&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2074
retrieving revision 1.2075
diff -u -b -r1.2074 -r1.2075
--- ChangeLog   10 Jan 2007 17:28:49 -0000      1.2074
+++ ChangeLog   10 Jan 2007 19:21:14 -0000      1.2075
@@ -1,3 +1,18 @@
+2007-01-10 Bastiaan Jacques <address@hidden>
+
+       * gui/{fltk.cpp, fltksup.h}: Initial FLTK GUI implementation.
+       * gui/{fltk_glue_agg.cpp, fltk_glue_agg.h}: Agg glue for the FLTK GUI.
+       * gui/{fltk_glue_cairo.cpp, fltk_glue_cairo.h}: Cairo glue for the
+       FLTK GUI.
+       * configure.ac: Allow the FLTK/Agg combination. Detect the FLTK
+       library when the FLTK GUI was selected.
+       * gui/Makefile.am: Build the FLTK GUI when requested.
+       * gui/Player.cpp: Enable the FLTK GUI.
+       * gui/gtk.cpp: Use an anonymous namespace for dbglogfile to avoid
+       symbol collisions.
+       * gui/gtk.cpp, gui/gui{.h, .cpp}: Move GtkGui::menuitem_sound_callback
+       to class Gui so other GUIs can use it.
+
 2007-01-10 Sandro Santilli <address@hidden>
 
        * gui/Player.cpp, libbase/zlib_adapter.cpp, libbase/zlib_adapter.h,

Index: configure.ac
===================================================================
RCS file: /sources/gnash/gnash/configure.ac,v
retrieving revision 1.229
retrieving revision 1.230
diff -u -b -r1.229 -r1.230
--- configure.ac        9 Jan 2007 18:19:15 -0000       1.229
+++ configure.ac        10 Jan 2007 19:21:14 -0000      1.230
@@ -15,7 +15,7 @@
 dnl  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 dnl  
 
-dnl $Id: configure.ac,v 1.229 2007/01/09 18:19:15 bjacques Exp $
+dnl $Id: configure.ac,v 1.230 2007/01/10 19:21:14 bjacques Exp $
 
 AC_PREREQ(2.50)
 AC_INIT(gnash, cvs)
@@ -196,8 +196,8 @@
 AM_CONDITIONAL(USE_RENDERER_CAIRO, test x$renderer = xcairo)
 
 if test x$renderer = xagg; then
-  if test x"$gui" != xfb -a x"$gui" != xgtk -a x"$gui" != xsdl -a x"$gui" != 
xriscos; then
-    AC_MSG_ERROR([agg renderer is only supported by fb, gtk, riscos and sdl 
guis]);
+  if test x"$gui" != xfb -a x"$gui" != xgtk -a x"$gui" != xsdl -a x"$gui" != 
xriscos -a x"$gui" != xfltk; then
+    AC_MSG_ERROR([agg renderer is only supported by fb, gtk, riscos, sdl and 
fltk GUIs]);
   fi
   AC_DEFINE([RENDERER_AGG], [], [Use AntiGrain renderer])
 fi
@@ -668,7 +668,13 @@
 AM_CONDITIONAL(HAVE_GST, test x$sound_handler = xgst)
 
 if test x$gui = xfltk; then
-       GNASH_PKG_FIND(fltk, [FL_API.h], [fltk library], fl_xmap, [], 
[-lfltk_gl])
+  dnl Because the fltk2 include directory is called fltk, whereas the library
+  dnl is called libfltk2, we call the PKG macros separately.
+  GNASH_PKG_INCLUDES(fltk, [FL_API.h], [Fast Light Toolkit])
+  GNASH_PKG_LIBS(fltk2, fl_window_flush, [Fast Light Toolkit])
+
+  FLTK_LIBS="$FLTK2_LIBS"
+  AC_SUBST(FLTK_LIBS)
 fi
 
 AM_CONDITIONAL(HAS_FLTK, [ test x$has_fltk = xyes ])

Index: gui/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/gui/Makefile.am,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- gui/Makefile.am     9 Jan 2007 00:43:42 -0000       1.54
+++ gui/Makefile.am     10 Jan 2007 19:21:14 -0000      1.55
@@ -17,7 +17,7 @@
 
 # 
 
-# $Id: Makefile.am,v 1.54 2007/01/09 00:43:42 rsavoye Exp $
+# $Id: Makefile.am,v 1.55 2007/01/10 19:21:14 bjacques Exp $
 
 AUTOMAKE_OPTIONS = 
 
@@ -93,11 +93,13 @@
  GTK_CAIRO_SRCS = gtk_glue_cairo.cpp gtk_glue_cairo.h
  KDE_CAIRO_SRCS = #kde_glue_cairo.cpp kde_glue_cairo.h
  SDL_CAIRO_SRCS = sdl_cairo_glue.cpp sdl_cairo_glue.h
+ FLTK_CAIRO_SRCS = fltk_glue_cairo.cpp fltk_glue_cairo.h
  AM_CPPFLAGS += $(CAIRO_CFLAGS)
 else
  GTK_CAIRO_SRCS =
  KDE_CAIRO_SRCS =
  SDL_CAIRO_SRCS =
+ FLTK_CAIRO_SRCS =
 endif
 
 if USE_RENDERER_AGG
@@ -106,10 +108,12 @@
   GTK_AGG_SRCS = gtk_glue_agg.cpp gtk_glue_agg.h
   RISCOS_AGG_SRCS = riscos_glue_agg.cpp riscos_glue_agg.h
   SDL_AGG_SRCS = sdl_agg_glue.cpp sdl_agg_glue.h
+  FLTK_AGG_SRCS = fltk_glue_agg.cpp fltk_glue_agg.h
 else
   GTK_AGG_SRCS =
   RISCOS_AGG_SRCS =
   SDL_AGG_SRCS =
+  FLTK_AGG_SRCS =
 endif
 
 if USE_GUI_GTK
@@ -160,12 +164,13 @@
 endif
 
 
-#if USE_GUI_FLTK
-# FLTK_SRCS = fltk.cpp fltksup.h
-# AM_CPPFLAGS += $(FLTK_INCLS) 
-#else
-# FLTK_SRCS = 
-#endif
+if USE_GUI_FLTK
+ FLTK_SRCS = fltk.cpp fltksup.h $(FLTK_AGG_SRCS) $(FLTK_CAIRO_SRCS)
+ AM_CPPFLAGS += $(FLTK_CFLAGS) 
+ AM_LDFLAGS += $(FLTK_LIBS)
+else
+ FLTK_SRCS = 
+endif
 
 
 AM_CPPFLAGS += -DPKGDATADIR=\"$(pkgdatadir)\"

Index: gui/Player.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- gui/Player.cpp      10 Jan 2007 17:28:49 -0000      1.39
+++ gui/Player.cpp      10 Jan 2007 19:21:14 -0000      1.40
@@ -32,6 +32,9 @@
 # elif defined(GUI_RISCOS)
 #  include "riscossup.h"
 #  define GUI_CLASS RiscosGui
+# elif defined(GUI_FLTK)
+#  include "fltksup.h"
+#  define GUI_CLASS FltkGui
 # endif
 #else
 # ifdef HAVE_KDE

Index: gui/gtk.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- gui/gtk.cpp 10 Jan 2007 14:17:34 -0000      1.60
+++ gui/gtk.cpp 10 Jan 2007 19:21:14 -0000      1.61
@@ -17,7 +17,7 @@
 // 
 //
 
-/* $Id: gtk.cpp,v 1.60 2007/01/10 14:17:34 bjacques Exp $ */
+/* $Id: gtk.cpp,v 1.61 2007/01/10 19:21:14 bjacques Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -43,7 +43,7 @@
 
 using namespace std;
 
-namespace gnash {
+namespace {
 LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
 }
 
@@ -885,17 +885,7 @@
 GtkGui::menuitem_sound_callback(GtkMenuItem* /*menuitem*/, gpointer /*data*/)
 {
 //    GNASH_REPORT_FUNCTION;
-
-    sound_handler* snd_handler = get_sound_handler();
-
-    if (!snd_handler)
-       return;
-    
-    if (snd_handler->is_muted()) {
-       snd_handler->unmute();
-    } else {
-       snd_handler->mute();
-    }
+    menu_toggle_sound();
 }
 
 

Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- gui/gui.cpp 6 Dec 2006 15:18:51 -0000       1.55
+++ gui/gui.cpp 10 Jan 2007 19:21:14 -0000      1.56
@@ -208,6 +208,23 @@
 }
 
 void
+Gui::menu_toggle_sound()
+{
+//    GNASH_REPORT_FUNCTION;
+    sound_handler* snd_handler = get_sound_handler();
+
+    if (!snd_handler)
+       return;
+
+    if (snd_handler->is_muted()) {
+       snd_handler->unmute();
+    } else {
+       snd_handler->mute();
+    }
+}
+
+
+void
 Gui::notify_mouse_moved(int x, int y) 
 {
        movie_root* m = get_current_root();

Index: gui/gui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- gui/gui.h   17 Dec 2006 01:49:49 -0000      1.42
+++ gui/gui.h   10 Jan 2007 19:21:15 -0000      1.43
@@ -174,6 +174,7 @@
     static void menu_step_backward();
     static void menu_jump_forward();
     static void menu_jump_backward();
+    static void menu_toggle_sound();
     /// @}
  
     /// Mouse notification callback to be called when the mouse is moved.

Index: gui/fltk.cpp
===================================================================
RCS file: gui/fltk.cpp
diff -N gui/fltk.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gui/fltk.cpp        10 Jan 2007 19:21:14 -0000      1.1
@@ -0,0 +1,352 @@
+// 
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// Linking Gnash statically or dynamically with other modules is making a
+// combined work based on Gnash. Thus, the terms and conditions of the GNU
+// General Public License cover the whole combination.
+//
+// As a special exception, the copyright holders of Gnash give you
+// permission to combine Gnash with free software programs or libraries
+// that are released under the GNU LGPL and with code included in any
+// release of Talkback distributed by the Mozilla Foundation. You may
+// copy and distribute such a system following the terms of the GNU GPL
+// for all but the LGPL-covered parts and Talkback, and following the
+// LGPL for the LGPL-covered parts.
+//
+// Note that people who make modified versions of Gnash are not obligated
+// to grant this special exception for their modified versions; it is their
+// choice whether to do so. The GNU General Public License gives permission
+// to release a modified version without this exception; this exception
+// also makes it possible to release a modified version which carries
+// forward this exception.
+// 
+//
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <fltk/Item.h>
+#include <fltk/ItemGroup.h>
+#include <fltk/PopupMenu.h>
+#include <fltk/Widget.h>
+#include <fltk/ask.h>
+#include <fltk/events.h>
+#include <fltk/run.h>
+#include <fltk/visual.h>
+#include <fltk/Window.h>
+#include <fltk/draw.h>
+#include <fltk/x.h>
+#include <fltk/damage.h>
+#include <fltk/layout.h>
+#include <fltk/Cursor.h>
+
+
+
+
+
+#include "fltksup.h"
+#include "gnash.h"
+#include "log.h"
+#include "gui.h"
+#include "VM.h"
+
+#include "render_handler.h"
+
+using namespace std;
+using namespace fltk;
+
+namespace gnash 
+{
+
+
+FltkGui::FltkGui(unsigned long xid, float scale, bool loop, unsigned int depth)
+  : Window(100,100,"Gnash"),
+    Gui(xid, scale, loop, depth)
+{
+}
+
+FltkGui::~FltkGui()
+{
+    GNASH_REPORT_FUNCTION;
+
+    delete _popup_menu;
+}
+
+
+void
+FltkGui::renderBuffer()
+{
+    GNASH_REPORT_FUNCTION;
+    _glue.draw();
+    redraw();
+}
+
+void
+FltkGui::draw()
+{
+   GNASH_REPORT_FUNCTION;
+#if 0
+    if (! (damage() & DAMAGE_EXPOSE) || damage) {
+      return;
+    }
+#endif
+    rect draw_bounds(-1e10f, -1e10f, +1e10f, +1e10f);
+
+    set_invalidated_region(draw_bounds);
+
+    renderBuffer();
+}
+
+int
+FltkGui::handle(int event)
+{
+    GNASH_REPORT_FUNCTION;
+
+    switch (event) {
+      case TIMEOUT:
+        advance_movie(this);
+        repeat_timeout(_interval);
+        return true;
+      case PUSH:
+        Window::handle(event);
+        notify_mouse_clicked(true, 1);
+        return true;
+      case RELEASE:
+        Window::handle(event);
+        notify_mouse_clicked(false, 1);
+        return true;
+      case MOVE:
+      {
+        int x = event_x() / _xscale;
+        int y = event_y() / _yscale;
+        notify_mouse_moved(x, y);
+        return true;
+      }
+      case KEY:
+        handleKey(event_key());
+        return true;
+      default:
+       // cout << "Captured unknown event: " << event << std::endl;
+        return true; //Window::handle(event);
+    }
+}
+
+void
+FltkGui::handleKey(unsigned key)
+{
+    // TODO: there are more keys
+    struct {
+      unsigned              fltkKey;
+      gnash::key::code      gnashKey;
+    } table[] = {
+      { BackSpaceKey,       gnash::key::BACKSPACE },
+      { TabKey,             gnash::key::TAB },
+      { ClearKey,           gnash::key::CLEAR },
+      { ReturnKey,          gnash::key::ENTER },
+      { LeftShiftKey,       gnash::key::SHIFT },
+      { RightShiftKey,      gnash::key::SHIFT },
+      { LeftCtrlKey,        gnash::key::CONTROL },
+      { RightCtrlKey,       gnash::key::CONTROL },
+      { LeftAltKey,         gnash::key::ALT },
+      { RightAltKey,        gnash::key::ALT },
+      { CapsLockKey,        gnash::key::CAPSLOCK },
+      { EscapeKey,          gnash::key::ESCAPE },
+      { SpaceKey,           gnash::key::SPACE },
+      { PageDownKey,        gnash::key::PGDN },
+      { PageUpKey,          gnash::key::PGUP },
+      { HomeKey,            gnash::key::HOME },
+      { EndKey,             gnash::key::END },
+      { LeftKey,            gnash::key::LEFT },
+      { UpKey,              gnash::key::UP },
+      { RightKey,           gnash::key::RIGHT },
+      { DownKey,            gnash::key::DOWN },
+      { InsertKey,          gnash::key::INSERT },
+      { DeleteKey,          gnash::key::DELETEKEY },
+      { HelpKey,            gnash::key::HELP },
+      { NumLockKey,         gnash::key::NUM_LOCK },
+      { SubtractKey,        gnash::key::MINUS },
+      { DivideKey,          gnash::key::SLASH },
+      { 0,                  gnash::key::INVALID } // Terminator
+#if 0
+            // These appear to be unavailable in fltk
+            { bracketleft, gnash::key::LEFT_BRACKET },
+            { backslash, gnash::key::BACKSLASH },
+            { bracketright, gnash::key::RIGHT_BRACKET },
+            { quotedbl, gnash::key::QUOTE },
+            { VoidSymbol, gnash::key::INVALID }
+            { SemicolonKey, gnash::key::SEMICOLON },
+            { equalKey, gnash::key::EQUALS },
+#endif
+    };
+
+    for (int i = 0; table[i].fltkKey; i++) {
+        if (key == table[i].fltkKey) {
+            gnash::notify_key_event(table[i].gnashKey, true);
+            break;
+        }
+    }
+}
+
+bool
+FltkGui::run()
+{
+    GNASH_REPORT_FUNCTION;
+
+    fltk::run();
+
+    return false;
+}
+
+bool
+FltkGui::init(int argc, char **argv[])
+{
+    GNASH_REPORT_FUNCTION;
+
+    _renderer = _glue.createRenderHandler();
+    set_render_handler(_renderer);
+
+    return true;
+}
+
+void
+FltkGui::setInterval(unsigned int time)
+{
+    _interval = time / 1000.0;
+    add_timeout (_interval);
+}
+
+void
+FltkGui::create()
+{
+    // XXX ensure _xid is set before this function is called
+    if (_xid) {
+      CreatedWindow::set_xid(this, _xid);
+    } else {
+      Window::create();
+    }
+}
+
+bool
+FltkGui::createWindow(const char* title, int width, int height)
+{
+    GNASH_REPORT_FUNCTION;
+
+    resize(width, height);
+
+    _glue.initBuffer(width, height);
+
+    label(title);
+    begin();
+    createMenu();
+    end();
+
+    size_range (1, 1); // XXX
+
+    show();
+
+    return true;
+}
+
+bool
+FltkGui::createMenu()
+{
+    GNASH_REPORT_FUNCTION;
+
+    _popup_menu = new PopupMenu(0, 0, w(), h());
+    _popup_menu->type(PopupMenu::POPUP3);
+
+    _popup_menu->begin();
+    new Item("Play Movie", 0, reinterpret_cast<Callback*>(menu_play));
+    new Item("Pause Movie", 0, reinterpret_cast<Callback*>(menu_pause));
+    new Item("Stop Movie", 0, reinterpret_cast<Callback*>(menu_stop));
+    new Item("Restart Movie", 0,
+                   reinterpret_cast<Callback*>(menu_restart));
+    new Item("Step Forward Frame", 0,
+                   reinterpret_cast<Callback*>(menu_step_forward));
+    new Item("Step Backward Frame", 0,
+                   reinterpret_cast<Callback*>(menu_step_backward));
+    new Item("Jump Forward 10 Frames", 0,
+                   reinterpret_cast<Callback*>(menu_jump_forward));
+    new Item("Jump Backward 10 Frames", 0,
+                   reinterpret_cast<Callback*>(menu_jump_backward));
+    new Item("Toggle Sound", 0,
+                   reinterpret_cast<Callback*>(menu_toggle_sound));
+    new Item("Quit", 0, reinterpret_cast<Callback*>(menu_quit));
+    _popup_menu->end();
+
+    return true;
+}
+
+void
+FltkGui::layout()
+{
+    GNASH_REPORT_FUNCTION;
+    if (!(layout_damage() & ~LAYOUT_WH)) {
+      // We're only interested in size changes.
+      //  return;
+    }
+#if 0
+    if (!get_current_root()) {
+      
+      return;
+    }
+#endif
+    if (!VM::isInitialized()) {
+      // No movie yet; don't bother resizing anything.
+      return;
+    }
+
+    Window::layout();
+
+    _glue.resize(w(), h());
+    resize_view(w(), h());
+
+    redraw();
+
+}
+
+void 
+FltkGui::setCursor(gnash_cursor_type newcursor)
+{
+    //GNASH_REPORT_FUNCTION;
+
+    fltk::Cursor* cursortype;
+
+    switch(newcursor) {
+      case gnash::CURSOR_HAND:
+        cursortype = fltk::CURSOR_HAND;
+        break;
+      case gnash::CURSOR_INPUT:
+        cursortype = fltk::CURSOR_INSERT;
+        break;
+      default:
+        cursortype = fltk::CURSOR_DEFAULT;
+    }
+
+    cursor(cursortype);
+}
+
+void
+FltkGui::set_invalidated_region(const rect& bounds)
+{
+    _glue.invalidateRegion(bounds);
+}
+
+
+// end of namespace
+}
+

Index: gui/fltk_glue_agg.cpp
===================================================================
RCS file: gui/fltk_glue_agg.cpp
diff -N gui/fltk_glue_agg.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gui/fltk_glue_agg.cpp       10 Jan 2007 19:21:14 -0000      1.1
@@ -0,0 +1,160 @@
+//
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// Linking Gnash statically or dynamically with other modules is making a
+// combined work based on Gnash. Thus, the terms and conditions of the GNU
+// General Public License cover the whole combination.
+//
+// As a special exception, the copyright holders of Gnash give you
+// permission to combine Gnash with free software programs or libraries
+// that are released under the GNU LGPL and with code included in any
+// release of Talkback distributed by the Mozilla Foundation. You may
+// copy and distribute such a system following the terms of the GNU GPL
+// for all but the LGPL-covered parts and Talkback, and following the
+// LGPL for the LGPL-covered parts.
+//
+// Note that people who make modified versions of Gnash are not obligated
+// to grant this special exception for their modified versions; it is their
+// choice whether to do so. The GNU General Public License gives permission
+// to release a modified version without this exception; this exception
+// also makes it possible to release a modified version which carries
+// forward this exception.
+//
+//
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <fltk/Item.h>
+#include <fltk/ItemGroup.h>
+#include <fltk/PopupMenu.h>
+#include <fltk/Widget.h>
+#include <fltk/ask.h>
+#include <fltk/events.h>
+#include <fltk/run.h>
+#include <fltk/visual.h>
+#include <fltk/Window.h>
+#include <fltk/draw.h>
+#include <fltk/x.h>
+#include <fltk/damage.h>
+#include <fltk/layout.h>
+#include <fltk/Cursor.h>
+
+
+
+
+#include "fltksup.h"
+#include "fltk_glue_agg.h"
+#include "gnash.h"
+#include "log.h"
+#include "gui.h"
+
+#include "render_handler.h"
+#include "render_handler_agg.h"
+
+using namespace std;
+//using namespace fltk;
+
+namespace gnash {
+
+FltkAggGlue::FltkAggGlue()
+ : _offscreenbuf(NULL)
+{
+}
+
+FltkAggGlue::~FltkAggGlue()
+{
+}
+
+render_handler*
+FltkAggGlue::createRenderHandler()
+{
+    _renderer = create_render_handler_agg("RGB24");
+    return _renderer;
+}
+
+void
+FltkAggGlue::initBuffer(int width, int height)
+{
+    assert(_renderer);
+
+    int _bpp = 24;
+    int depth_bytes = _bpp / 8;
+
+    assert(_bpp % 8 == 0);
+
+    _stride = width * depth_bytes;
+
+#define CHUNK_SIZE (100 * 100 * depth_bytes)
+
+    //int bufsize = static_cast<int>(width * height * depth_bytes / CHUNK_SIZE 
+ 1) * CHUNK_SIZE;
+    int bufsize = height * _stride;
+
+    _offscreenbuf = new unsigned char[bufsize];
+
+    // Only the AGG renderer has the function init_buffer, which is *not* part 
of
+    // the renderer api. It allows us to change the renderers movie size (and 
buffer
+    // address) during run-time.
+    render_handler_agg_base * renderer =
+      static_cast<render_handler_agg_base *>(_renderer);
+    renderer->init_buffer(_offscreenbuf, bufsize, width, height);
+
+    _width = width;
+    _height = height;
+
+    _validbounds.setTo(0, 0, _width-1, _height-1);
+    _drawbounds = _validbounds;
+
+}
+
+void
+FltkAggGlue::draw()
+{
+    // Calculate the position of the first pixel within the invalidated
+    // rectangle in _offscreenbuf.
+    ptrdiff_t offset = _drawbounds.getMinY() * _stride + _drawbounds.getMinX() 
* 3;
+
+    Rectangle bounds(_drawbounds.getMinX(), _drawbounds.getMinY(), 
_drawbounds.width(), _drawbounds.height());
+
+    fltk::drawimage(_offscreenbuf + offset, fltk::RGB, bounds, _stride);
+}
+//miny*(_width*(_bpp/8)) + minx*(_bpp/8)
+void
+FltkAggGlue::resize(int width, int height)
+{
+    GNASH_REPORT_FUNCTION;
+    if (!_offscreenbuf) {
+      // If initialisation has not taken place yet, we don't want to touch 
this.
+      return;
+    }
+
+    delete [] _offscreenbuf;
+    initBuffer(width, height);
+}
+
+void
+FltkAggGlue::invalidateRegion(const rect& bounds)
+{
+    _renderer->set_invalidated_region(bounds);
+
+    _drawbounds = Intersection(
+                       // add two pixels because of anti-aliasing...
+                       _renderer->world_to_pixel(bounds).growBy(2),
+                       _validbounds);
+}
+
+} // namespace gnash

Index: gui/fltk_glue_agg.h
===================================================================
RCS file: gui/fltk_glue_agg.h
diff -N gui/fltk_glue_agg.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gui/fltk_glue_agg.h 10 Jan 2007 19:21:14 -0000      1.1
@@ -0,0 +1,101 @@
+//
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// Linking Gnash statically or dynamically with other modules is making a
+// combined work based on Gnash. Thus, the terms and conditions of the GNU
+// General Public License cover the whole combination.
+//
+// As a special exception, the copyright holders of Gnash give you
+// permission to combine Gnash with free software programs or libraries
+// that are released under the GNU LGPL and with code included in any
+// release of Talkback distributed by the Mozilla Foundation. You may
+// copy and distribute such a system following the terms of the GNU GPL
+// for all but the LGPL-covered parts and Talkback, and following the
+// LGPL for the LGPL-covered parts.
+//
+// Note that people who make modified versions of Gnash are not obligated
+// to grant this special exception for their modified versions; it is their
+// choice whether to do so. The GNU General Public License gives permission
+// to release a modified version without this exception; this exception
+// also makes it possible to release a modified version which carries
+// forward this exception.
+//
+//
+
+#ifndef FLTK_GLUE_AGG_H
+#define FLTK_GLUE_AGG_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <fltk/Item.h>
+#include <fltk/ItemGroup.h>
+#include <fltk/PopupMenu.h>
+#include <fltk/Widget.h>
+#include <fltk/ask.h>
+#include <fltk/events.h>
+#include <fltk/run.h>
+#include <fltk/visual.h>
+#include <fltk/Window.h>
+#include <fltk/draw.h>
+#include <fltk/x.h>
+#include <fltk/damage.h>
+#include <fltk/layout.h>
+#include <fltk/Cursor.h>
+
+
+
+
+#include "fltksup.h"
+#include "gnash.h"
+#include "log.h"
+#include "gui.h"
+
+#include "render_handler.h"
+#include "render_handler_agg.h"
+
+using namespace std;
+using namespace fltk;
+
+namespace gnash {
+
+class FltkAggGlue
+{
+    public:
+      FltkAggGlue();
+      ~FltkAggGlue();
+     // resize(int width, int height);
+      void draw();
+      render_handler* createRenderHandler();
+      void initBuffer(int width, int height);
+      void resize(int width, int height);
+      void invalidateRegion(const rect& bounds);
+
+    private:
+      int _width;
+      int _height;
+      int _stride;
+      unsigned char* _offscreenbuf;
+      render_handler* _renderer;
+      //Rectangle _bounds;
+      geometry::Range2d<int> _drawbounds;
+      geometry::Range2d<int> _validbounds;
+};
+
+} // namespace gnash
+
+#endif //FLTK_GLUE_AGG_H

Index: gui/fltk_glue_cairo.cpp
===================================================================
RCS file: gui/fltk_glue_cairo.cpp
diff -N gui/fltk_glue_cairo.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gui/fltk_glue_cairo.cpp     10 Jan 2007 19:21:14 -0000      1.1
@@ -0,0 +1,157 @@
+//
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// Linking Gnash statically or dynamically with other modules is making a
+// combined work based on Gnash. Thus, the terms and conditions of the GNU
+// General Public License cover the whole combination.
+//
+// As a special exception, the copyright holders of Gnash give you
+// permission to combine Gnash with free software programs or libraries
+// that are released under the GNU LGPL and with code included in any
+// release of Talkback distributed by the Mozilla Foundation. You may
+// copy and distribute such a system following the terms of the GNU GPL
+// for all but the LGPL-covered parts and Talkback, and following the
+// LGPL for the LGPL-covered parts.
+//
+// Note that people who make modified versions of Gnash are not obligated
+// to grant this special exception for their modified versions; it is their
+// choice whether to do so. The GNU General Public License gives permission
+// to release a modified version without this exception; this exception
+// also makes it possible to release a modified version which carries
+// forward this exception.
+//
+//
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <fltk/Item.h>
+#include <fltk/ItemGroup.h>
+#include <fltk/PopupMenu.h>
+#include <fltk/Widget.h>
+#include <fltk/ask.h>
+#include <fltk/events.h>
+#include <fltk/run.h>
+#include <fltk/visual.h>
+#include <fltk/Window.h>
+#include <fltk/draw.h>
+#include <fltk/x.h>
+#include <fltk/damage.h>
+#include <fltk/layout.h>
+#include <fltk/Cursor.h>
+
+#include "render_handler.h"
+#include "render_handler_cairo.h"
+
+#include "fltksup.h"
+#include "fltk_glue_cairo.h"
+#include "gnash.h"
+#include "log.h"
+#include "gui.h"
+
+//#include "render_handler.h"
+
+using namespace std;
+//using namespace fltk;
+
+namespace gnash {
+
+FltkCairoGlue::FltkCairoGlue()
+ : _offscreenbuf(NULL)
+{
+}
+
+FltkCairoGlue::~FltkCairoGlue()
+{
+    cairo_surface_destroy(_cairo_surface);
+    cairo_destroy (_cairo_handle);
+    delete [] _offscreenbuf;
+}
+
+render_handler*
+FltkCairoGlue::createRenderHandler()
+{
+    _renderer = renderer::cairo::create_handler();
+    return _renderer;
+}
+
+void
+FltkCairoGlue::initBuffer(int width, int height)
+{
+    static bool firstTime = true;
+
+    int _bpp = 32;
+    int depth_bytes = _bpp / 8;
+
+    assert(_bpp % 8 == 0);
+
+    _stride = width * depth_bytes;
+
+#define CHUNK_SIZE (100 * 100 * depth_bytes)
+
+    //int bufsize = static_cast<int>(width * height * depth_bytes / CHUNK_SIZE 
+ 1) * CHUNK_SIZE;
+
+    int bufsize = height * _stride;
+
+    _offscreenbuf = new unsigned char[bufsize];
+
+    // CAIRO_FORMAT_RGB24 actualy means a 32-bit RGB word with the upper 8 bits
+    // unused. Therefore we have allocated a 32-bit buffer.
+
+    _cairo_surface =
+      cairo_image_surface_create_for_data (_offscreenbuf, CAIRO_FORMAT_RGB24,
+                                           width, height, _stride);
+
+    _cairo_handle = cairo_create(_cairo_surface);
+
+    renderer::cairo::set_handle(_cairo_handle);
+
+    if (firstTime) {
+      set_render_handler(_renderer);
+      firstTime = false;
+    }
+
+    _width = width;
+    _height = height;
+}
+
+void
+FltkCairoGlue::draw()
+{
+    fltk::Rectangle area(0, 0, _width, _height);
+
+    // CAIRO_FORMAT_RGB24 == fltk::RGB32
+    fltk::drawimage(_offscreenbuf, fltk::RGB32, area);
+}
+
+void
+FltkCairoGlue::invalidateRegion(const rect& bounds)
+{
+    return;
+}
+
+void
+FltkCairoGlue::resize(int width, int height)
+{
+    GNASH_REPORT_FUNCTION;
+    cairo_surface_destroy(_cairo_surface);
+    cairo_destroy (_cairo_handle);
+    delete [] _offscreenbuf;
+    initBuffer(width, height);
+}
+
+} // namespace gnash

Index: gui/fltk_glue_cairo.h
===================================================================
RCS file: gui/fltk_glue_cairo.h
diff -N gui/fltk_glue_cairo.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gui/fltk_glue_cairo.h       10 Jan 2007 19:21:14 -0000      1.1
@@ -0,0 +1,94 @@
+//
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// Linking Gnash statically or dynamically with other modules is making a
+// combined work based on Gnash. Thus, the terms and conditions of the GNU
+// General Public License cover the whole combination.
+//
+// As a special exception, the copyright holders of Gnash give you
+// permission to combine Gnash with free software programs or libraries
+// that are released under the GNU LGPL and with code included in any
+// release of Talkback distributed by the Mozilla Foundation. You may
+// copy and distribute such a system following the terms of the GNU GPL
+// for all but the LGPL-covered parts and Talkback, and following the
+// LGPL for the LGPL-covered parts.
+//
+// Note that people who make modified versions of Gnash are not obligated
+// to grant this special exception for their modified versions; it is their
+// choice whether to do so. The GNU General Public License gives permission
+// to release a modified version without this exception; this exception
+// also makes it possible to release a modified version which carries
+// forward this exception.
+//
+//
+
+#ifndef FLTK_GLUE_CAIRO_H
+#define FLTK_GLUE_CAIRO_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <fltk/Item.h>
+#include <fltk/ItemGroup.h>
+#include <fltk/PopupMenu.h>
+#include <fltk/Widget.h>
+#include <fltk/ask.h>
+#include <fltk/events.h>
+#include <fltk/run.h>
+#include <fltk/visual.h>
+#include <fltk/Window.h>
+#include <fltk/draw.h>
+#include <fltk/x.h>
+#include <fltk/damage.h>
+#include <fltk/layout.h>
+#include <fltk/Cursor.h>
+
+
+
+
+#include "fltksup.h"
+#include <cairo.h>
+
+using namespace std;
+using namespace fltk;
+
+namespace gnash {
+
+class FltkCairoGlue
+{
+    public:
+      FltkCairoGlue();
+      ~FltkCairoGlue();
+     // resize(int width, int height);
+      void draw();
+      render_handler* createRenderHandler();
+      void initBuffer(int width, int height);
+      void resize(int width, int height);
+      void invalidateRegion(const rect& bounds);
+    private:
+      int _width;
+      int _height;
+      int _stride;
+      unsigned char* _offscreenbuf;
+      render_handler* _renderer;
+      cairo_surface_t *_cairo_surface;
+      cairo_t         *_cairo_handle;
+};
+
+} // namespace gnash
+
+#endif //FLTK_GLUE_CAIRO_H

Index: gui/fltksup.h
===================================================================
RCS file: gui/fltksup.h
diff -N gui/fltksup.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gui/fltksup.h       10 Jan 2007 19:21:14 -0000      1.1
@@ -0,0 +1,114 @@
+// 
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// Linking Gnash statically or dynamically with other modules is making a
+// combined work based on Gnash. Thus, the terms and conditions of the GNU
+// General Public License cover the whole combination.
+//
+// As a special exception, the copyright holders of Gnash give you
+// permission to combine Gnash with free software programs or libraries
+// that are released under the GNU LGPL and with code included in any
+// release of Talkback distributed by the Mozilla Foundation. You may
+// copy and distribute such a system following the terms of the GNU GPL
+// for all but the LGPL-covered parts and Talkback, and following the
+// LGPL for the LGPL-covered parts.
+//
+// Note that people who make modified versions of Gnash are not obligated
+// to grant this special exception for their modified versions; it is their
+// choice whether to do so. The GNU General Public License gives permission
+// to release a modified version without this exception; this exception
+// also makes it possible to release a modified version which carries
+// forward this exception.
+// 
+//
+
+#ifndef __FLTKSUP_H__
+#define __FLTKSUP_H__
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+
+#include "log.h"
+#include "gui.h"
+
+#if 0
+#include <FL/Fl.H>
+#include <FL/gl.h>
+#include <FL/x.H>
+#include <FL/Fl_Window.H>
+#endif
+
+#include <fltk/Item.h>
+#include <fltk/Menu.h>
+#include <fltk/Window.h>
+#include <fltk/PopupMenu.h>
+#include <fltk/Widget.h>
+#include <fltk/gl.h>
+#include <fltk/visual.h>
+#include <fltk/GlWindow.h>
+
+#ifdef RENDERER_AGG
+# include "fltk_glue_agg.h"
+#elif defined(RENDERER_CAIRO)
+# include "fltk_glue_cairo.h"
+#endif
+
+namespace gnash
+{
+
+class FltkGui : public fltk::Window, public Gui
+{
+public:
+    FltkGui(unsigned long xid, float scale, bool loop, unsigned int depth);
+
+    virtual ~FltkGui();
+    virtual bool init(int argc, char **argv[]);
+
+    virtual void setInterval(unsigned int);
+    virtual void setTimeout(unsigned int) { }
+    virtual bool createWindow(const char* title, int width, int height);
+    virtual void renderBuffer();
+
+    virtual bool run();
+    virtual bool createMenu();
+    virtual void setCursor(gnash_cursor_type newcursor);
+    virtual bool setupEvents() { return true;}
+
+    void set_invalidated_region(const rect& bounds);
+
+    void create();
+    void draw();
+    int handle(int event);
+    void layout();
+ private:
+    void handleKey(unsigned key);
+
+    fltk::PopupMenu  *_popup_menu;
+    float _interval;
+#ifdef RENDERER_AGG
+    FltkAggGlue _glue;
+#elif defined(RENDERER_CAIRO)
+    FltkCairoGlue _glue;
+#endif
+};
+ 
+// end of namespace gnash 
+}
+
+// end of __FLTKSUP_H__
+#endif




reply via email to

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