[goffice] removed *-impl.h from canvas



commit 8d481af870e0e907a24944ee1b6ddee464bd51e5
Author: Jean Brefort <jean brefort normalesup org>
Date:   Tue Aug 11 19:27:16 2009 +0200

    removed *-impl.h from canvas

 ChangeLog                           |   10 +++++
 goffice/canvas/Makefile.am          |   35 +++++++----------
 goffice/canvas/goc-canvas-impl.h    |   46 -----------------------
 goffice/canvas/goc-canvas.h         |   15 +++++++
 goffice/canvas/goc-circle-impl.h    |   39 -------------------
 goffice/canvas/goc-circle.h         |    8 ++++
 goffice/canvas/goc-ellipse.c        |    9 ----
 goffice/canvas/goc-ellipse.h        |    9 ++++
 goffice/canvas/goc-graph.c          |    9 ----
 goffice/canvas/goc-graph.h          |    9 ++++
 goffice/canvas/goc-group-impl.h     |   44 ----------------------
 goffice/canvas/goc-group.h          |    9 ++++
 goffice/canvas/goc-item-impl.h      |   70 -----------------------------------
 goffice/canvas/goc-item.h           |   38 +++++++++++++++++++
 goffice/canvas/goc-line.c           |    9 ----
 goffice/canvas/goc-line.h           |    9 ++++
 goffice/canvas/goc-polygon-impl.h   |   42 ---------------------
 goffice/canvas/goc-polygon.h        |   10 +++++
 goffice/canvas/goc-rectangle-impl.h |   40 --------------------
 goffice/canvas/goc-rectangle.h      |    9 ++++
 goffice/canvas/goc-text.c           |   15 +------
 goffice/canvas/goc-text.h           |   13 ++++++
 goffice/canvas/goc-widget-impl.h    |   40 --------------------
 goffice/canvas/goc-widget.h         |    9 ++++
 goffice/canvas/goffice-canvas.h     |    7 ---
 goffice/goffice.h                   |    2 +-
 26 files changed, 166 insertions(+), 389 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d9cf5ce..8a73ef9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-08-11  Jean Brefort  <jean brefort normalesup org>
+
+	* goffice/canvas/*: removed *-impl.h files
+	* goffice/goffice.h: changed include order.
+	* goffice/gtk/go-3d-rotation-sel.c (cb_rotation_changed): removed unused variable.
+
+2009-08-11  Jean Brefort  <jean brefort normalesup org>
+
+	* All: add and use a new cairo based canvas.
+
 2009-08-07  Morten Welinder  <terra gnome org>
 
 	* goffice/graph/gog-axis.c (map_log_calc_ticks): Improve minor
diff --git a/goffice/canvas/Makefile.am b/goffice/canvas/Makefile.am
index 4bb3125..742fea4 100644
--- a/goffice/canvas/Makefile.am
+++ b/goffice/canvas/Makefile.am
@@ -1,45 +1,38 @@
 noinst_LTLIBRARIES = libgoffice-canvas.la
 
-libgoffice_canvas_la_SOURCES = \
+libgoffice_canvas_la_SOURCES =	\
 	goc-canvas.c		\
 	goc-circle.c		\
 	goc-ellipse.c		\
-	goc-graph.c			\
-	goc-group.c			\
-	goc-item.c			\
-	goc-line.c			\
+	goc-graph.c		\
+	goc-group.c		\
+	goc-item.c		\
+	goc-line.c		\
 	goc-pixbuf.c		\
 	goc-polygon.c		\
 	goc-rectangle.c		\
 	goc-styled-item.c	\
-	goc-text.c			\
-	goc-utils.c			\
+	goc-text.c		\
+	goc-utils.c		\
 	goc-widget.c
 
 libgoffice_canvas_ladir = $(goffice_include_dir)/canvas
-libgoffice_canvas_la_HEADERS = \
+libgoffice_canvas_la_HEADERS =	\
 	goc-canvas.h		\
-	goc-canvas-impl.h	\
 	goc-circle.h		\
-	goc-circle-impl.h	\
 	goc-ellipse.h		\
-	goc-graph.h			\
-	goc-group.h			\
-	goc-group-impl.h	\
-	goc-item.h			\
-	goc-item-impl.h		\
-	goc-line.h			\
+	goc-graph.h		\
+	goc-group.h		\
+	goc-item.h		\
+	goc-line.h		\
 	goc-pixbuf.h		\
 	goc-polygon.h		\
-	goc-polygon-impl.h  \
 	goc-rectangle.h		\
-	goc-rectangle-impl.h\
 	goc-structs.h		\
 	goc-styled-item.h	\
-	goc-text.h			\
-	goc-utils.h			\
+	goc-text.h		\
+	goc-utils.h		\
 	goc-widget.h		\
-	goc-widget-impl.h	\
 	goffice-canvas.h
 
 include $(top_srcdir)/goffice.mk
diff --git a/goffice/canvas/goc-canvas.h b/goffice/canvas/goc-canvas.h
index 7083cc8..c9143b5 100644
--- a/goffice/canvas/goc-canvas.h
+++ b/goffice/canvas/goc-canvas.h
@@ -28,6 +28,21 @@
 
 G_BEGIN_DECLS
 
+struct _GocCanvas {
+	GtkLayout base;
+	double scroll_x1, scroll_y1;
+	double pixels_per_unit;
+	double width, height;
+	int wwidth, wheight;
+	GocGroup *root;
+	GocItem *grabbed_item;
+	GocItem	*last_item;
+	GODoc *document;
+	GdkEvent *cur_event;
+};
+
+typedef GtkLayoutClass GocCanvasClass;
+
 #define GOC_TYPE_CANVAS	(goc_canvas_get_type ())
 #define GOC_CANVAS(o)	(G_TYPE_CHECK_INSTANCE_CAST ((o), GOC_TYPE_CANVAS, GocCanvas))
 #define GOC_IS_CANVAS(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), GOC_TYPE_CANVAS))
diff --git a/goffice/canvas/goc-circle.h b/goffice/canvas/goc-circle.h
index e88e707..9c3f7e9 100644
--- a/goffice/canvas/goc-circle.h
+++ b/goffice/canvas/goc-circle.h
@@ -27,6 +27,14 @@
 
 G_BEGIN_DECLS
 
+struct _GocCircle {
+	GocStyledItem base;
+
+	double x, y, radius;
+};
+
+typedef GocStyledItemClass GocCircleClass;
+
 #define GOC_TYPE_CIRCLE	(goc_circle_get_type ())
 #define GOC_CIRCLE(o)	(G_TYPE_CHECK_INSTANCE_CAST ((o), GOC_TYPE_CIRCLE, GocCircle))
 #define GOC_IS_CIRCLE(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), GOC_TYPE_CIRCLE))
diff --git a/goffice/canvas/goc-ellipse.c b/goffice/canvas/goc-ellipse.c
index c27e0bd..497a520 100644
--- a/goffice/canvas/goc-ellipse.c
+++ b/goffice/canvas/goc-ellipse.c
@@ -26,15 +26,6 @@
 #include <glib/gi18n-lib.h>
 #include <gsf/gsf-impl-utils.h>
 
-struct _GocEllipse {
-	GocStyledItem base;
-
-	double rotation; /* rotation around the center in radians */
-	double x, y, width, height;
-};
-
-typedef GocStyledItemClass GocEllipseClass;
-
 enum {
 	ELLIPSE_PROP_0,
 	ELLIPSE_PROP_X,
diff --git a/goffice/canvas/goc-ellipse.h b/goffice/canvas/goc-ellipse.h
index 9d7ac91..ec44486 100644
--- a/goffice/canvas/goc-ellipse.h
+++ b/goffice/canvas/goc-ellipse.h
@@ -27,6 +27,15 @@
 
 G_BEGIN_DECLS
 
+struct _GocEllipse {
+	GocStyledItem base;
+
+	double rotation; /* rotation around the center in radians */
+	double x, y, width, height;
+};
+
+typedef GocStyledItemClass GocEllipseClass;
+
 #define GOC_TYPE_ELLIPSE	(goc_ellipse_get_type ())
 #define GOC_ELLIPSE(o)	(G_TYPE_CHECK_INSTANCE_CAST ((o), GOC_TYPE_ELLIPSE, GocEllipse))
 #define GOC_IS_ELLIPSE(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), GOC_TYPE_ELLIPSE))
diff --git a/goffice/canvas/goc-graph.c b/goffice/canvas/goc-graph.c
index a5bd038..3995abb 100644
--- a/goffice/canvas/goc-graph.c
+++ b/goffice/canvas/goc-graph.c
@@ -27,15 +27,6 @@
 
 #include <math.h>
 
-struct _GocGraph {
-	GocItem base;
-
-	double x, y, w, h;
-	GogRenderer *renderer;
-};
-
-typedef GocItemClass GocGraphClass;
-
 static GObjectClass *parent_klass;
 
 enum {
diff --git a/goffice/canvas/goc-graph.h b/goffice/canvas/goc-graph.h
index dd434af..3b0583c 100644
--- a/goffice/canvas/goc-graph.h
+++ b/goffice/canvas/goc-graph.h
@@ -26,6 +26,15 @@
 
 G_BEGIN_DECLS
 
+struct _GocGraph {
+	GocItem base;
+
+	double x, y, w, h;
+	GogRenderer *renderer;
+};
+
+typedef GocItemClass GocGraphClass;
+
 #define GOC_TYPE_GRAPH	(goc_graph_get_type ())
 #define GOC_GRAPH(o)	(G_TYPE_CHECK_INSTANCE_CAST ((o), GOC_TYPE_GRAPH, GocGraph))
 #define GOC_IS_GRAPH(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), GOC_TYPE_GRAPH))
diff --git a/goffice/canvas/goc-group.h b/goffice/canvas/goc-group.h
index c227377..53796b9 100644
--- a/goffice/canvas/goc-group.h
+++ b/goffice/canvas/goc-group.h
@@ -27,6 +27,15 @@
 
 G_BEGIN_DECLS
 
+struct _GocGroup {
+	GocItem			 base;
+
+	double			 x, y;  /* group offset */
+	GList			*children;
+};
+
+typedef GocItemClass GocGroupClass;
+
 #define GOC_TYPE_GROUP	(goc_group_get_type ())
 #define GOC_GROUP(o)	(G_TYPE_CHECK_INSTANCE_CAST ((o), GOC_TYPE_GROUP, GocGroup))
 #define GOC_IS_GROUP(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), GOC_TYPE_GROUP))
diff --git a/goffice/canvas/goc-item.h b/goffice/canvas/goc-item.h
index e75cd93..4447301 100644
--- a/goffice/canvas/goc-item.h
+++ b/goffice/canvas/goc-item.h
@@ -26,6 +26,44 @@
 
 G_BEGIN_DECLS
 
+struct _GocItem {
+	GObject			 base;
+
+	GocCanvas		*canvas;
+	GocGroup		*parent;
+	gboolean		 cached_bounds;
+	gboolean		 needs_redraw;
+	gboolean		 visible;
+	double			 x0, y0, x1, y1; /* the bounds */
+};
+
+typedef struct {
+	GObjectClass	 base;
+
+	double			(*distance) (GocItem *item,
+								 double x, double y, GocItem **near_item);
+	void			(*draw) (GocItem const *item, cairo_t *cr);
+	gboolean		(*draw_region) (GocItem const *item, cairo_t *cr,
+									double x0, double y0, double x1, double y1);
+	void			(*move) (GocItem *item, double x, double y);
+	void			(*update_bounds) (GocItem *item);
+	void			(*parent_changed) (GocItem *item);
+	cairo_operator_t
+					(*get_operator) (GocItem *item);
+	// events related functions
+	gboolean		(*button_pressed) (GocItem *item, int button, double x, double y);
+	gboolean		(*button2_pressed) (GocItem *item, int button, double x, double y);
+	gboolean		(*button_released) (GocItem *item, int button, double x, double y);
+	gboolean		(*motion) (GocItem *item, double x, double y);
+	gboolean		(*enter_notify) (GocItem *item, double x, double y);
+	gboolean		(*leave_notify) (GocItem *item, double x, double y);
+	void			(*realize) (GocItem *item);
+	void			(*unrealize) (GocItem *item);
+	gboolean		(*key_pressed) (GocItem *item, GdkEventKey* ev);
+	gboolean		(*key_released) (GocItem *item, GdkEventKey* ev);
+	void			(*notify_scrolled) (GocItem *item);
+} GocItemClass ;
+
 #define GOC_TYPE_ITEM	(goc_item_get_type ())
 #define GOC_ITEM(o)	(G_TYPE_CHECK_INSTANCE_CAST ((o), GOC_TYPE_ITEM, GocItem))
 #define GOC_IS_ITEM(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), GOC_TYPE_ITEM))
diff --git a/goffice/canvas/goc-line.c b/goffice/canvas/goc-line.c
index 227b8c5..993a170 100644
--- a/goffice/canvas/goc-line.c
+++ b/goffice/canvas/goc-line.c
@@ -33,15 +33,6 @@ enum {
 	LINE_PROP_Y1
 };
 
-struct _GocLine {
-	GocStyledItem base;
-
-	/* using these to avoid confusion with x0 and others in GocItem */
-	double startx, starty, endx, endy;
-};
-
-typedef GocStyledItemClass GocLineClass;
-
 static void
 goc_line_set_property (GObject *gobject, guint param_id,
 				    GValue const *value, GParamSpec *pspec)
diff --git a/goffice/canvas/goc-line.h b/goffice/canvas/goc-line.h
index 5ededc9..08090c1 100644
--- a/goffice/canvas/goc-line.h
+++ b/goffice/canvas/goc-line.h
@@ -27,6 +27,15 @@
 
 G_BEGIN_DECLS
 
+struct _GocLine {
+	GocStyledItem base;
+
+	/* using these to avoid confusion with x0 and others in GocItem */
+	double startx, starty, endx, endy;
+};
+
+typedef GocStyledItemClass GocLineClass;
+
 #define GOC_TYPE_LINE	(goc_line_get_type ())
 #define GOC_LINE(o)	(G_TYPE_CHECK_INSTANCE_CAST ((o), GOC_TYPE_LINE, GocLine))
 #define GOC_IS_LINE(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), GOC_TYPE_LINE))
diff --git a/goffice/canvas/goc-polygon.h b/goffice/canvas/goc-polygon.h
index 5b4b435..6d2aa5c 100644
--- a/goffice/canvas/goc-polygon.h
+++ b/goffice/canvas/goc-polygon.h
@@ -27,6 +27,16 @@
 
 G_BEGIN_DECLS
 
+typedef GocStyledItemClass GocPolygonClass;
+
+struct _GocPolygon {
+	GocStyledItem base;
+
+	GocPoint *points;
+	unsigned nb_points;
+	gboolean use_spline;
+};
+
 #define GOC_TYPE_POLYGON	(goc_polygon_get_type ())
 #define GOC_POLYGON(o)	(G_TYPE_CHECK_INSTANCE_CAST ((o), GOC_TYPE_POLYGON, GocPolygon))
 #define GOC_IS_POLYGON(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), GOC_TYPE_POLYGON))
diff --git a/goffice/canvas/goc-rectangle.h b/goffice/canvas/goc-rectangle.h
index 725ba61..bb94bac 100644
--- a/goffice/canvas/goc-rectangle.h
+++ b/goffice/canvas/goc-rectangle.h
@@ -27,6 +27,15 @@
 
 G_BEGIN_DECLS
 
+struct _GocRectangle {
+	GocStyledItem base;
+
+	double rotation; /* rotation around the center in radians */
+	double x, y, width, height;
+};
+
+typedef GocStyledItemClass GocRectangleClass;
+
 #define GOC_TYPE_RECTANGLE	(goc_rectangle_get_type ())
 #define GOC_RECTANGLE(o)	(G_TYPE_CHECK_INSTANCE_CAST ((o), GOC_TYPE_RECTANGLE, GocRectangle))
 #define GOC_IS_RECTANGLE(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), GOC_TYPE_RECTANGLE))
diff --git a/goffice/canvas/goc-text.c b/goffice/canvas/goc-text.c
index ef61e1d..4708fdc 100644
--- a/goffice/canvas/goc-text.c
+++ b/goffice/canvas/goc-text.c
@@ -35,18 +35,6 @@ enum {
 	TEXT_PROP_ATTRIBUTES
 };
 
-struct _GocText {
-	GocStyledItem base;
-
-	double rotation; /* rotation around the center in radians */
-	double x, y, w, h;
-	char *text;
-	GtkAnchorType anchor;
-	PangoAttrList *attributes;
-	PangoLayout *layout;
-};
-
-typedef GocStyledItemClass GocTextClass;
 static GocItemClass *parent_class;
 
 static void
@@ -254,6 +242,8 @@ goc_text_draw (GocItem const *item, cairo_t *cr)
 	GocText *text = GOC_TEXT (item);
 	double x = text->x, y = text->y;
 	PangoLayout *pl = pango_cairo_create_layout (cr);
+	GOStyle *style = go_styled_object_get_style (GO_STYLED_OBJECT (item));
+	pango_layout_set_font_description (pl, style->font.font->desc);
 	pango_layout_set_text (pl, text->text, -1);
 	if (text->attributes)
 		pango_layout_set_attributes (pl, text->attributes);
@@ -297,6 +287,7 @@ goc_text_draw (GocItem const *item, cairo_t *cr)
 		break;
 	}
 	cairo_save (cr);
+	cairo_set_source_rgb (cr, 0., 0., 0.);
 	goc_group_cairo_transform (item->parent, cr, x, y);
 	cairo_move_to (cr, 0., 0.);
 	pango_cairo_show_layout (cr, pl);
diff --git a/goffice/canvas/goc-text.h b/goffice/canvas/goc-text.h
index 7822b71..c15a87c 100644
--- a/goffice/canvas/goc-text.h
+++ b/goffice/canvas/goc-text.h
@@ -27,6 +27,19 @@
 
 G_BEGIN_DECLS
 
+struct _GocText {
+	GocStyledItem base;
+
+	double rotation; /* rotation around the center in radians */
+	double x, y, w, h;
+	char *text;
+	GtkAnchorType anchor;
+	PangoAttrList *attributes;
+	PangoLayout *layout;
+};
+
+typedef GocStyledItemClass GocTextClass;
+
 #define GOC_TYPE_TEXT	(goc_text_get_type ())
 #define GOC_TEXT(o)	(G_TYPE_CHECK_INSTANCE_CAST ((o), GOC_TYPE_TEXT, GocText))
 #define GOC_IS_TEXT(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), GOC_TYPE_TEXT))
diff --git a/goffice/canvas/goc-widget.h b/goffice/canvas/goc-widget.h
index ddaefd9..9488737 100644
--- a/goffice/canvas/goc-widget.h
+++ b/goffice/canvas/goc-widget.h
@@ -26,6 +26,15 @@
 
 G_BEGIN_DECLS
 
+struct _GocWidget {
+	GocItem base;
+
+	double x, y, w, h;
+	GtkWidget *widget;
+};
+
+typedef GocItemClass GocWidgetClass;
+
 #define GOC_TYPE_WIDGET	(goc_widget_get_type ())
 #define GOC_WIDGET(o)	(G_TYPE_CHECK_INSTANCE_CAST ((o), GOC_TYPE_WIDGET, GocWidget))
 #define GOC_IS_WIDGET(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), GOC_TYPE_WIDGET))
diff --git a/goffice/canvas/goffice-canvas.h b/goffice/canvas/goffice-canvas.h
index 3052bfb..ca00fbf 100644
--- a/goffice/canvas/goffice-canvas.h
+++ b/goffice/canvas/goffice-canvas.h
@@ -47,27 +47,20 @@ G_END_DECLS
 #include <goffice/goffice.h>
 
 #include <goffice/canvas/goc-canvas.h>
-#include <goffice/canvas/goc-canvas-impl.h>
-#include <goffice/canvas/goc-item-impl.h>
 #include <goffice/canvas/goc-item.h>
 #include <goffice/canvas/goc-styled-item.h>
 #include <goffice/canvas/goc-structs.h>
 #include <goffice/canvas/goc-utils.h>
 
 #include <goffice/canvas/goc-circle.h>
-#include <goffice/canvas/goc-circle-impl.h>
 #include <goffice/canvas/goc-ellipse.h>
 #include <goffice/canvas/goc-graph.h>
 #include <goffice/canvas/goc-group.h>
-#include <goffice/canvas/goc-group-impl.h>
 #include <goffice/canvas/goc-line.h>
 #include <goffice/canvas/goc-pixbuf.h>
 #include <goffice/canvas/goc-polygon.h>
-#include <goffice/canvas/goc-polygon-impl.h>
 #include <goffice/canvas/goc-rectangle.h>
-#include <goffice/canvas/goc-rectangle-impl.h>
 #include <goffice/canvas/goc-text.h>
 #include <goffice/canvas/goc-widget.h>
-#include <goffice/canvas/goc-widget-impl.h>
 
 #endif  /* GOFFICE_CANVAS_H */
diff --git a/goffice/goffice.h b/goffice/goffice.h
index 7e23670..8beba2d 100644
--- a/goffice/goffice.h
+++ b/goffice/goffice.h
@@ -46,11 +46,11 @@
 #include <goffice/utils/goffice-utils.h>
 #include <goffice/data/goffice-data.h>
 #include <goffice/math/goffice-math.h>
+#include <goffice/graph/goffice-graph.h>
 #ifdef GOFFICE_WITH_GTK
 #include <goffice/gtk/goffice-gtk.h>
 #include <goffice/canvas/goffice-canvas.h>
 #endif
-#include <goffice/graph/goffice-graph.h>
 
 G_BEGIN_DECLS
 



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