Re: goocanvasmm status



On 2/24/07, Paul Davis <paul linuxaudiosystems com> wrote:
On Sat, 2007-02-24 at 08:21 -0600, Paul Davis wrote:

> Hey,
>
> I was the one that started that project.  I happened to have a bit of
> misfortune and ended up starting it just before some major api changes
> in goocanvas. Since then my priorities have changed a bit and I'm not
> working on any projects that I would want to use goocanvasmm for.
>
> If anyone wants to take over as the maintainer for it, let me know and
> I'll be glad to transfer ownership or whatever is required.  I'd quite
> like it in the future, but at the moment I just haven't got time to
> work on it.

i've been talking with damon chapin over on the cairo list. it is very
likely that Ardour will adopt goocanvas as our new canvas after we
release 2.0. if that happens, then i will be happy to take over the
maintainer role for the *mm wrappers, and thus add to the world's
confusion over our identity:

"Wait, I thought Paul Davis was the maintainer"
"No, not any more"
"Well who is"
"The other Paul Davis"

this won't happen for another couple of months at least, though.

ha, that's pretty good.

In any case, it turns out that I already have commit access to
libgoocanvasmm, even though I've never used it in the past.  I fixed
one tiny bug just now, and I'm attaching a larger patch that wraps the
GooCanvas object as Goocanvas::Canvas and makes changes to the simple
example to make it match the simple example shipped with goocanvas and
so that it will compile.  So I now have the simple example working in
my working copy.
It also fixes a minor API change for Goocanvas::Item that was made in
goocanvas on Feb 13 (2 days after murray updated to the new API
apparently).  I just updated the .defs file by hand, because I'm still
pretty clueless when it comes to this gmmproc .defs stuff.

Anybody object to me pushing this out?

Also, does anybody object to me getting rid of the patched copy of
goocanvas in the goocanvasmm repository and re-arranging things a bit
so that what's now in trunk/libgoocanvasmm is just in trunk/?  It
doesn't appear that the patched version of goocanvas is necessary
anymore (I didn't use it when doing these changes).

Also, just to make this clear, I'm not volunteering for maintainership
of this library, i'm still just playing around -- I don't know whether
I'll end up using it or not :)

--
jonner
Index: libgoocanvas/src/item.hg
===================================================================
--- libgoocanvas/src/item.hg	(revision 32)
+++ libgoocanvas/src/item.hg	(working copy)
@@ -65,7 +65,7 @@
 		_WRAP_METHOD(void skew_x( double degrees, double cx, double cy ),goo_canvas_item_skew_x)
 		_WRAP_METHOD(void skew_y( double degrees, double cx, double cy ),goo_canvas_item_skew_y)
 
-		_WRAP_METHOD(void animate( double x, double y, double scale, double degrees, int duration, int step_time, GooCanvasAnimateType type ),goo_canvas_item_animate)
+		_WRAP_METHOD(void animate( double x, double y, double scale, double degrees, bool absolute, int duration, int step_time, GooCanvasAnimateType type ),goo_canvas_item_animate)
 		_WRAP_METHOD(void stop_animation(),goo_canvas_item_stop_animation)
 
 		//TODO: Hand-code the .defs for these:
Index: libgoocanvas/src/libgoocanvas_methods.defs
===================================================================
--- libgoocanvas/src/libgoocanvas_methods.defs	(revision 32)
+++ libgoocanvas/src/libgoocanvas_methods.defs	(working copy)
@@ -934,6 +934,7 @@
     '("gdouble" "y")
     '("gdouble" "scale")
     '("gdouble" "degrees")
+    '("gboolean" "absolute")
     '("gint" "duration")
     '("gint" "step_time")
     '("GooCanvasAnimateType" "type")
Index: libgoocanvas/src/Makefile_list_of_hg.am_fragment
===================================================================
--- libgoocanvas/src/Makefile_list_of_hg.am_fragment	(revision 32)
+++ libgoocanvas/src/Makefile_list_of_hg.am_fragment	(working copy)
@@ -12,6 +12,5 @@
 polyline.hg \
 rect.hg \
 style.hg \
-text.hg
-
-
+text.hg \
+canvas.hg
Index: libgoocanvas/src/canvas.ccg
===================================================================
--- libgoocanvas/src/canvas.ccg	(revision 0)
+++ libgoocanvas/src/canvas.ccg	(revision 0)
@@ -0,0 +1,20 @@
+/* Copyright (C) 1998-2006 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#include <goocanvas.h>
+#include <libgoocanvasmm/item.h>
+#include <glibmm/wrap.h>
+#include <gdkmm/cursor.h>
Index: libgoocanvas/src/canvas.hg
===================================================================
--- libgoocanvas/src/canvas.hg	(revision 0)
+++ libgoocanvas/src/canvas.hg	(revision 0)
@@ -0,0 +1,89 @@
+/* Copyright (C) 2007 The goocanvasmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+_DEFS(libgoocanvasmm,libgoocanvas)
+_PINCLUDE(gtkmm/private/container_p.h)
+#include <gtkmm/container.h>
+#include <cairomm/refptr.h>
+#include <gdkmm/event.h>
+#include <libgoocanvasmm/types.h>
+
+namespace Gdk
+{
+    class Cursor;
+}
+
+namespace Cairo
+{
+    class Context;
+}
+
+namespace Goocanvas
+{
+
+class Item;
+
+class Canvas : public Gtk::Container
+{
+    _CLASS_GTKOBJECT(Canvas, GooCanvas, GOO_CANVAS, Gtk::Container, GtkContainer)
+
+    public:
+        _CTOR_DEFAULT
+        _WRAP_METHOD(Glib::RefPtr<Item> get_root_item(), goo_canvas_get_root_item,refreturn)
+        _WRAP_METHOD(Glib::RefPtr<const Item> get_root_item() const, goo_canvas_get_root_item,refreturn,constversion)
+        _WRAP_METHOD(void set_root_item(const Glib::RefPtr<Item>& item), goo_canvas_set_root_item)
+        // We don't seem to have ItemModel wrapped yet
+        //_WRAP_METHOD(ItemModel* get_root_item_model(), goo_canvas_get_root_item_model);
+        //_WRAP_METHOD(void set_root_item_model(const ItemModel* model), goo_canvas_set_root_item_model);
+        _WRAP_METHOD(void get_bounds(double& left, double& top, double& right, double& bottom) const, goo_canvas_get_bounds)
+        _WRAP_METHOD(void set_bounds(double left, double top, double right, double bottom), goo_canvas_set_bounds)
+        _WRAP_METHOD(gdouble get_scale() const, goo_canvas_get_scale)
+        _WRAP_METHOD(void set_scale(double scale), goo_canvas_set_scale)
+        //_WRAP_METHOD(Glib::RefPtr<Item> get_item(const Glib::RefPtr<Model>& model), goo_canvas_get_item,refreturn)
+        //_WRAP_METHOD(Glib::RefPtr<const Item> get_item(const Glib::RefPtr<Model>& model) const, goo_canvas_get_item,constversion,refreturn)
+        _WRAP_METHOD(Glib::RefPtr<Item> get_item_at(double x, double y, bool is_pointer_event), goo_canvas_get_item_at,refreturn)
+        _WRAP_METHOD(Glib::RefPtr<const Item> get_item_at(double x, double y, bool is_pointer_event) const, goo_canvas_get_item_at,constversion,refreturn)
+        _WRAP_METHOD(void scroll_to(double left, double top), goo_canvas_scroll_to)
+#m4 _CONVERSION(Bounds&,GooCanvasBounds*,static_cast<GooCanvasBounds*>((&$3)))
+        _WRAP_METHOD(void render(const Cairo::RefPtr<Cairo::Context>& cr, Bounds& bounds, double scale), goo_canvas_render)
+        _WRAP_METHOD(void convert_to_pixels(double& x, double& y), goo_canvas_convert_to_pixels)
+        _WRAP_METHOD(void convert_from_pixels(double& x, double& y), goo_canvas_convert_from_pixels)
+        _WRAP_METHOD(void convert_to_item_space(const Glib::RefPtr<Item>& item, double& x, double& y), goo_canvas_convert_to_item_space)
+        _WRAP_METHOD(void convert_from_item_space(const Glib::RefPtr<Item>& item, double& x, double& y), goo_canvas_convert_from_item_space)
+
+        // I just copied the following line from gdk/src/window.hg.  Can this
+        // conversion be reused by including a file from somewhere instead of
+        // redefining it here?
+#m4 _CONVERSION(const Gdk::Cursor&,GdkCursor*,const_cast<GdkCursor*>(($3).gobj()))
+        _WRAP_METHOD(GdkGrabStatus pointer_grab(const Glib::RefPtr<Item>& item, Gdk::EventMask event_mask, const Gdk::Cursor& cursor, guint32 time), goo_canvas_pointer_grab)
+        _WRAP_METHOD(void pointer_ungrab(const Glib::RefPtr<Item>& item, guint32 time), goo_canvas_pointer_ungrab)
+        _WRAP_METHOD(void grab_focus(const Glib::RefPtr<Item>& item), goo_canvas_grab_focus)
+        _WRAP_METHOD(GdkGrabStatus keyboard_grab(const Glib::RefPtr<Item>& item, bool owner_events, guint32 time), goo_canvas_keyboard_grab)
+        _WRAP_METHOD(void keyboard_ungrab(const Glib::RefPtr<Item>& item, guint32 time), goo_canvas_keyboard_ungrab)
+        // we don't seem to have GooCanvasItemModel wrapped
+        //_WRAP_METHOD(Glib::RefPtr<Item> create_item(ItemModel model), goo_canvas_create_item,refreturn)
+        //_WRAP_METHOD(void unregister_item(const ItemModel& model), goo_canvas_unregister_item)
+        // we don't seem to have GooCanvasWidget wrapped
+        //_WRAP_METHOD(void register_widget_item(const Widget& witem), goo_canvas_register_widget_item)
+        //_WRAP_METHOD(void unregister_widget_item(const Widget& witem), goo_canvas_unregister_widget_item)
+        _WRAP_METHOD(void update(), goo_canvas_update)
+        _WRAP_METHOD(void request_update(), goo_canvas_request_update)
+        _WRAP_METHOD(void request_redraw(Bounds& bounds), goo_canvas_request_redraw)
+        _WRAP_METHOD(double get_default_line_width(), goo_canvas_get_default_line_width)
+} ;
+
+}
Index: libgoocanvas/libgoocanvasmm.h
===================================================================
--- libgoocanvas/libgoocanvasmm.h	(revision 32)
+++ libgoocanvas/libgoocanvasmm.h	(working copy)
@@ -33,6 +33,7 @@
 #include <glibmm.h>
 
 #include <libgoocanvasmm/init.h>
+#include <libgoocanvasmm/canvas.h>
 #include <libgoocanvasmm/ellipse.h>
 #include <libgoocanvasmm/group.h>
 #include <libgoocanvasmm/image.h>
Index: examples/simple/window.hh
===================================================================
--- examples/simple/window.hh	(revision 32)
+++ examples/simple/window.hh	(working copy)
@@ -9,11 +9,9 @@
 
 	private:
 
-		Goocanvas::View*					_view ;
-
-		Goocanvas::Style*					_style ;
 		Glib::RefPtr<Goocanvas::Rect>		_rect ;
+        Goocanvas::Canvas canvas;
 
-		bool on_rect_button_press( const Glib::RefPtr<Goocanvas::ItemView>& target, GdkEventButton* event ) ;
+		bool on_rect_button_press( const Glib::RefPtr<Goocanvas::Item>& target, GdkEventButton* event ) ;
 } ;
 
Index: examples/simple/window.cc
===================================================================
--- examples/simple/window.cc	(revision 32)
+++ examples/simple/window.cc	(working copy)
@@ -1,54 +1,43 @@
-
 #include <iostream>
-
 #include "window.hh"
 
 SimpleWindow::SimpleWindow()
 {
-	set_title( "libgoocanvasmm - Simple Example" ) ;
+    set_title( "libgoocanvasmm - Simple Example" ) ;
 
-	_view = Gtk::manage( new Goocanvas::View() ) ;
-	_view->set_size_request( 640, 480 ) ;
-	_view->set_bounds( 0, 0, 1000, 1000 ) ;
+    canvas.set_size_request(600, 450);
+    canvas.set_bounds( 0, 0, 1000, 1000 ) ;
 
-	Glib::RefPtr<Goocanvas::ModelSimple> model = Goocanvas::ModelSimple::create() ;	
-	Glib::RefPtr<Goocanvas::Item> root = model->get_root_item() ;
+    Glib::RefPtr<Goocanvas::Item> root = canvas.get_root_item();
 
-	Glib::RefPtr<Goocanvas::Rect> rect = Goocanvas::Rect::create( root, 100, 100, 400, 400 ) ;
-	rect->property_line_width().set_value( 10.0 ) ;
-	rect->property_radius_x().set_value( 20.0 ) ;
-	rect->property_radius_y().set_value( 20.0 ) ;
-	rect->property_stroke_color().set_value( "yellow" ) ;
-	rect->property_fill_color().set_value( "red" ) ;
+    Glib::RefPtr<Goocanvas::Rect> rect = Goocanvas::Rect::create( root, 100, 100, 400, 400 ) ;
+    rect->property_line_width().set_value( 10.0 ) ;
+    rect->property_radius_x().set_value( 20.0 ) ;
+    rect->property_radius_y().set_value( 20.0 ) ;
+    rect->property_stroke_color().set_value( "yellow" ) ;
+    rect->property_fill_color().set_value( "red" ) ;
 
-	Glib::RefPtr<Goocanvas::Text> text = Goocanvas::Text::create( root, "Hello World", 300, 300, -1, GTK_ANCHOR_CENTER ) ;
-	text->property_font().set_value( "Sans 24" ) ;
-	text->rotate( 45, 300, 300 ) ;
+    Glib::RefPtr<Goocanvas::Text> text = Goocanvas::Text::create(
+            root,
+            "Hello World",
+            300, 300, -1,
+            GTK_ANCHOR_CENTER ) ;
+    text->property_font().set_value( "Sans 24" ) ;
+    text->rotate( 45, 300, 300 ) ;
 
-	Goocanvas::Style style ;
-	style.set_mask( Goocanvas::CANVAS_STYLE_LINE_WIDTH | Goocanvas::CANVAS_STYLE_LINE_JOIN ) ;
-	style.set_line_width( 4 ) ;
-	style.set_line_join( CAIRO_LINE_JOIN_ROUND ) ;
+    //_rect->signal_button_release_event().connect( sigc::mem_fun( *this, &SimpleWindow::on_rect_button_press ) ) ;
 
-	Glib::RefPtr<Goocanvas::Rect> outside = Goocanvas::Rect::create( root, 50, 50, 500, 500 ) ;
-	outside->set_style( &style ) ;
-
-	_view->set_model( model ) ;
-
-	Glib::RefPtr<Goocanvas::ItemView> iview = _view->get_item_view( rect ) ;
-	iview->signal_button_release_event().connect( sigc::mem_fun( *this, &SimpleWindow::on_rect_button_press ) ) ;
-
-	Gtk::ScrolledWindow* sw = Gtk::manage( new Gtk::ScrolledWindow() ) ;
-	sw->add( *_view ) ;
-	add( *sw ) ;
-
-	show_all_children() ;
+    Gtk::ScrolledWindow* sw = Gtk::manage( new Gtk::ScrolledWindow() ) ;
+    sw->add(canvas) ;
+    add( *sw ) ;
+    show_all_children() ;
 }
 
-bool
-SimpleWindow::on_rect_button_press( const Glib::RefPtr<Goocanvas::ItemView>& item, GdkEventButton* event )
+    bool
+SimpleWindow::on_rect_button_press( const Glib::RefPtr<Goocanvas::Item>& target, GdkEventButton* event )
 {
-	std::cout << "You clicked the rectangle!" << std::endl ;
-	return true ;
+    std::cout << "You clicked the rectangle!" << std::endl ;
+    return true ;
 }
 
+


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