diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-06-20 18:56:06 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-06-20 20:06:19 +0800 |
commit | 5d0878967ee21a039ef599222b1cf3eb606354d4 (patch) | |
tree | 790cfcbf63fea7292740f182dd612ab20244f6e8 /libgnomecanvas | |
parent | f5f2132d60cdd1884c6343f759aadfd38a159e04 (diff) | |
download | gsoc2013-evolution-5d0878967ee21a039ef599222b1cf3eb606354d4.tar.gz gsoc2013-evolution-5d0878967ee21a039ef599222b1cf3eb606354d4.tar.zst gsoc2013-evolution-5d0878967ee21a039ef599222b1cf3eb606354d4.zip |
Coding style and whitespace cleanup.
Diffstat (limited to 'libgnomecanvas')
41 files changed, 1059 insertions, 1080 deletions
diff --git a/libgnomecanvas/gailcanvas.c b/libgnomecanvas/gailcanvas.c index 02abd10deb..fb64204a65 100644 --- a/libgnomecanvas/gailcanvas.c +++ b/libgnomecanvas/gailcanvas.c @@ -84,9 +84,9 @@ gail_canvas_get_type (void) if (!type) { - GType parent_type = g_type_parent (GNOME_TYPE_CANVAS); + GType parent_type = g_type_parent (GNOME_TYPE_CANVAS); AtkObjectFactory *factory = atk_registry_get_factory ( - atk_get_default_registry (), + atk_get_default_registry (), parent_type); GType atkobject_parent_type = atk_object_factory_get_accessible_type (factory); GTypeQuery query; @@ -118,28 +118,28 @@ gail_canvas_get_type (void) static AtkObjectClass *parent_atk_object_class; /** - * Tell ATK how to create the appropriate AtkObject peers + * Tell ATK how to create the appropriate AtkObject peers **/ void gail_canvas_init (void) { atk_registry_set_factory_type (atk_get_default_registry (), - GNOME_TYPE_CANVAS, + GNOME_TYPE_CANVAS, gail_canvas_factory_get_type ()); atk_registry_set_factory_type (atk_get_default_registry (), - GNOME_TYPE_CANVAS_GROUP, + GNOME_TYPE_CANVAS_GROUP, gail_canvas_group_factory_get_type ()); atk_registry_set_factory_type (atk_get_default_registry (), - GNOME_TYPE_CANVAS_TEXT, + GNOME_TYPE_CANVAS_TEXT, gail_canvas_text_factory_get_type ()); atk_registry_set_factory_type (atk_get_default_registry (), - GNOME_TYPE_CANVAS_RICH_TEXT, + GNOME_TYPE_CANVAS_RICH_TEXT, gail_canvas_text_factory_get_type ()); atk_registry_set_factory_type (atk_get_default_registry (), GNOME_TYPE_CANVAS_WIDGET, gail_canvas_widget_factory_get_type()); atk_registry_set_factory_type (atk_get_default_registry (), - GNOME_TYPE_CANVAS_ITEM, + GNOME_TYPE_CANVAS_ITEM, gail_canvas_item_factory_get_type ()); } @@ -154,7 +154,7 @@ gail_canvas_class_init (GailCanvasClass *klass) class->initialize = gail_canvas_real_initialize; } -AtkObject* +AtkObject* gail_canvas_new (GtkWidget *widget) { GObject *object; @@ -170,7 +170,6 @@ gail_canvas_new (GtkWidget *widget) return accessible; } - static void gail_canvas_real_initialize (AtkObject *obj, gpointer data) @@ -197,7 +196,7 @@ gail_canvas_real_initialize (AtkObject *obj, obj->role = ATK_ROLE_LAYERED_PANE; } -static gint +static gint gail_canvas_get_n_children (AtkObject* obj) { GtkAccessible *accessible; @@ -221,7 +220,7 @@ gail_canvas_get_n_children (AtkObject* obj) return 1; } -static AtkObject* +static AtkObject* gail_canvas_ref_child (AtkObject *obj, gint i) { diff --git a/libgnomecanvas/gailcanvas.h b/libgnomecanvas/gailcanvas.h index 46cd7b7187..946ddc338a 100644 --- a/libgnomecanvas/gailcanvas.h +++ b/libgnomecanvas/gailcanvas.h @@ -1,4 +1,4 @@ -/* gailcanvas.h - code from GAIL, the +/* gailcanvas.h - code from GAIL, the * Gnome Accessibility Implementation Library * Copyright 2001-2006 Sun Microsystems Inc. * @@ -56,7 +56,6 @@ struct _GailCanvasFactoryClass AtkObjectFactoryClass parent_class; }; - GType gail_canvas_get_type (void); struct _GailCanvas; diff --git a/libgnomecanvas/gailcanvasgroup.c b/libgnomecanvas/gailcanvasgroup.c index 1750f679c2..8f0ee238ad 100644 --- a/libgnomecanvas/gailcanvasgroup.c +++ b/libgnomecanvas/gailcanvasgroup.c @@ -73,7 +73,6 @@ gail_canvas_group_get_n_children (AtkObject *obj) return g_list_length (group->item_list); } - static AtkObject * gail_canvas_group_ref_child (AtkObject *obj, gint i) diff --git a/libgnomecanvas/gailcanvasgroupfactory.c b/libgnomecanvas/gailcanvasgroupfactory.c index 10a7d2e056..79b687584f 100644 --- a/libgnomecanvas/gailcanvasgroupfactory.c +++ b/libgnomecanvas/gailcanvasgroupfactory.c @@ -32,7 +32,7 @@ gail_canvas_group_factory_get_type (void) { static GType type = 0; - if (!type) + if (!type) { static const GTypeInfo tinfo = { @@ -48,14 +48,14 @@ gail_canvas_group_factory_get_type (void) NULL /* value table */ }; type = g_type_register_static ( - ATK_TYPE_OBJECT_FACTORY, + ATK_TYPE_OBJECT_FACTORY, "GailCanvasGroupFactory" , &tinfo, 0); } return type; } -static void +static void gail_canvas_group_factory_class_init (GailCanvasGroupFactoryClass *klass) { AtkObjectFactoryClass *class = ATK_OBJECT_FACTORY_CLASS (klass); @@ -64,7 +64,7 @@ gail_canvas_group_factory_class_init (GailCanvasGroupFactoryClass *klass) class->get_accessible_type = gail_canvas_group_factory_get_accessible_type; } -static AtkObject* +static AtkObject* gail_canvas_group_factory_create_accessible (GObject *obj) { return gail_canvas_group_new (obj); diff --git a/libgnomecanvas/gailcanvasgroupfactory.h b/libgnomecanvas/gailcanvasgroupfactory.h index 7ba4014eb6..9c382aeabd 100644 --- a/libgnomecanvas/gailcanvasgroupfactory.h +++ b/libgnomecanvas/gailcanvasgroupfactory.h @@ -31,7 +31,6 @@ G_BEGIN_DECLS #define GAIL_IS_CANVAS_GROUP_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_CANVAS_GROUP_FACTORY)) #define GAIL_CANVAS_GROUP_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_CANVAS_GROUP_FACTORY, GailCanvasGroupFactoryClass)) - typedef struct _GailCanvasGroupFactory GailCanvasGroupFactory; typedef struct _GailCanvasGroupFactoryClass GailCanvasGroupFactoryClass; diff --git a/libgnomecanvas/gailcanvasitem.c b/libgnomecanvas/gailcanvasitem.c index 5ae7c8bee3..6fb5c7d316 100644 --- a/libgnomecanvas/gailcanvasitem.c +++ b/libgnomecanvas/gailcanvasitem.c @@ -25,35 +25,35 @@ #include <libgail-util/gailmisc.h> static void gail_canvas_item_initialize (AtkObject *obj, - gpointer data); + gpointer data); static AtkObject* gail_canvas_item_get_parent (AtkObject *obj); static gint gail_canvas_item_get_index_in_parent (AtkObject *obj); static AtkStateSet* gail_canvas_item_ref_state_set (AtkObject *obj); static void gail_canvas_item_component_interface_init (AtkComponentIface *iface); static guint gail_canvas_item_add_focus_handler (AtkComponent *component, - AtkFocusHandler handler); + AtkFocusHandler handler); static void gail_canvas_item_get_extents (AtkComponent *component, - gint *x, - gint *y, - gint *width, - gint *height, - AtkCoordType coord_type); + gint *x, + gint *y, + gint *width, + gint *height, + AtkCoordType coord_type); static gint gail_canvas_item_get_mdi_zorder (AtkComponent *component); static gboolean gail_canvas_item_grab_focus (AtkComponent *component); static void gail_canvas_item_remove_focus_handler (AtkComponent *component, - guint handler_id); + guint handler_id); static gboolean is_item_on_screen (GnomeCanvasItem *item); static void get_item_extents (GnomeCanvasItem *item, - gint *x, - gint *y, - gint *width, - gint *height); + gint *x, + gint *y, + gint *width, + gint *height); static gboolean is_item_in_window (GnomeCanvasItem *item, - gint x, - gint y, - gint width, - gint height); + gint x, + gint y, + gint width, + gint height); static AtkGObjectAccessibleClass *parent_class = NULL; @@ -85,7 +85,7 @@ gail_canvas_item_new (GObject *obj) static void gail_canvas_item_initialize (AtkObject *obj, - gpointer data) + gpointer data) { ATK_OBJECT_CLASS (parent_class)->initialize (obj, data); @@ -280,7 +280,7 @@ gail_canvas_item_get_extents (AtkComponent *component, atk_gobj = ATK_GOBJECT_ACCESSIBLE (component); obj = atk_gobject_accessible_get_object (atk_gobj); - if (obj == NULL) + if (obj == NULL) /* item is defunct */ return; @@ -290,7 +290,7 @@ gail_canvas_item_get_extents (AtkComponent *component, /* If this item has no parent canvas, something's broken */ g_return_if_fail (GTK_IS_WIDGET (item->canvas)); - get_item_extents (item, &local_x, &local_y, width, height); + get_item_extents (item, &local_x, &local_y, width, height); if (!is_item_in_window (item, local_x, local_y, *width, *height)) { *x = G_MININT; @@ -315,7 +315,7 @@ gail_canvas_item_get_extents (AtkComponent *component, static gint gail_canvas_item_get_mdi_zorder (AtkComponent *component) { - g_return_val_if_fail (ATK_OBJECT (component), -1); + g_return_val_if_fail (ATK_OBJECT (component), -1); return gail_canvas_item_get_index_in_parent (ATK_OBJECT (component)); } @@ -353,11 +353,11 @@ gail_canvas_item_remove_focus_handler (AtkComponent *component, g_signal_handler_disconnect (ATK_OBJECT (component), handler_id); } -static gboolean +static gboolean is_item_on_screen (GnomeCanvasItem *item) { gint x, y, width, height; - + get_item_extents (item, &x, &y, &width, &height); return is_item_in_window (item, x, y, width, height); } @@ -369,14 +369,14 @@ get_item_extents (GnomeCanvasItem *item, gint *width, gint *height) { - double bx1, by1, bx2, by2; - double i2c[6]; + gdouble bx1, by1, bx2, by2; + gdouble i2c[6]; ArtPoint p1, p2, p3, p4; ArtPoint q1, q2, q3, q4; - double min_x1, min_y1, min_x2, min_y2; - double max_x1, max_y1, max_x2, max_y2; - int x1, y1, x2, y2; - int scroll_x, scroll_y; + gdouble min_x1, min_y1, min_x2, min_y2; + gdouble max_x1, max_y1, max_x2, max_y2; + gint x1, y1, x2, y2; + gint scroll_x, scroll_y; /* Get the bounding box in item-relative coordinates */ @@ -392,7 +392,7 @@ get_item_extents (GnomeCanvasItem *item, /* Convert the bounding box to canvas pixel coordinates and find its minimum * surrounding rectangle. */ - + p1.x = p2.x = bx1; p1.y = p4.y = by1; p3.x = p4.x = bx2; @@ -489,9 +489,9 @@ is_item_in_window (GnomeCanvasItem *item, window = gtk_widget_get_window (widget); if (window) { - int window_width, window_height; - - gdk_window_get_geometry (window, NULL, NULL, + gint window_width, window_height; + + gdk_window_get_geometry (window, NULL, NULL, &window_width, &window_height, NULL); /* * Check whether rectangles intersect diff --git a/libgnomecanvas/gailcanvasitemfactory.c b/libgnomecanvas/gailcanvasitemfactory.c index 5f59ef2823..376e9178df 100644 --- a/libgnomecanvas/gailcanvasitemfactory.c +++ b/libgnomecanvas/gailcanvasitemfactory.c @@ -35,7 +35,7 @@ gail_canvas_item_factory_init (GailCanvasItemFactory *foo) ; } -static void +static void gail_canvas_item_factory_class_init (GailCanvasItemFactoryClass *klass) { AtkObjectFactoryClass *class = ATK_OBJECT_FACTORY_CLASS (klass); @@ -44,7 +44,7 @@ gail_canvas_item_factory_class_init (GailCanvasItemFactoryClass *klass) class->get_accessible_type = gail_canvas_item_factory_get_accessible_type; } -static AtkObject* +static AtkObject* gail_canvas_item_factory_create_accessible (GObject *obj) { return gail_canvas_item_new (obj); diff --git a/libgnomecanvas/gailcanvasitemfactory.h b/libgnomecanvas/gailcanvasitemfactory.h index dd55815cbe..b5bea16d5a 100644 --- a/libgnomecanvas/gailcanvasitemfactory.h +++ b/libgnomecanvas/gailcanvasitemfactory.h @@ -31,7 +31,6 @@ G_BEGIN_DECLS #define GAIL_IS_CANVAS_ITEM_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_CANVAS_ITEM_FACTORY)) #define GAIL_CANVAS_ITEM_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_CANVAS_ITEM_FACTORY, GailCanvasItemFactoryClass)) - typedef struct _GailCanvasItemFactory GailCanvasItemFactory; typedef struct _GailCanvasItemFactoryClass GailCanvasItemFactoryClass; diff --git a/libgnomecanvas/gailcanvastext.c b/libgnomecanvas/gailcanvastext.c index 542683c6c3..98ace2d938 100644 --- a/libgnomecanvas/gailcanvastext.c +++ b/libgnomecanvas/gailcanvastext.c @@ -30,27 +30,27 @@ struct _GailCanvasText }; static void gail_canvas_text_text_interface_init (AtkTextIface *iface); -static gchar* gail_canvas_text_get_text (AtkText *text, +static gchar * gail_canvas_text_get_text (AtkText *text, gint start_offset, gint end_offset); -static gchar* gail_canvas_text_get_text_after_offset +static gchar * gail_canvas_text_get_text_after_offset (AtkText *text, gint offset, AtkTextBoundary boundary_type, gint *start_offset, gint *end_offset); -static gchar* gail_canvas_text_get_text_at_offset (AtkText *text, +static gchar * gail_canvas_text_get_text_at_offset (AtkText *text, gint offset, AtkTextBoundary boundary_type, gint *start_offset, gint *end_offset); -static gchar* gail_canvas_text_get_text_before_offset +static gchar * gail_canvas_text_get_text_before_offset (AtkText *text, gint offset, AtkTextBoundary boundary_type, gint *start_offset, gint *end_offset); -static gunichar gail_canvas_text_get_character_at_offset +static gunichar gail_canvas_text_get_character_at_offset (AtkText *text, gint offset); static gint gail_canvas_text_get_character_count (AtkText *text); @@ -60,7 +60,7 @@ static gboolean gail_canvas_text_set_caret_offset (AtkText static gint gail_canvas_text_get_offset_at_point (AtkText *text, gint x, gint y, - AtkCoordType coords); + AtkCoordType coords); static void gail_canvas_text_get_character_extents (AtkText *text, gint offset, gint *x, @@ -68,15 +68,15 @@ static void gail_canvas_text_get_character_extents (AtkText gint *width, gint *height, AtkCoordType coords); -static AtkAttributeSet* +static AtkAttributeSet* gail_canvas_text_get_run_attributes (AtkText *text, gint offset, gint *start_offset, gint *end_offset); -static AtkAttributeSet* +static AtkAttributeSet* gail_canvas_text_get_default_attributes (AtkText *text); static gint gail_canvas_text_get_n_selections (AtkText *text); -static gchar* gail_canvas_text_get_selection (AtkText *text, +static gchar * gail_canvas_text_get_selection (AtkText *text, gint selection_num, gint *start_pos, gint *end_pos); @@ -89,16 +89,16 @@ static gboolean gail_canvas_text_set_selection (AtkText gint selection_num, gint start_pos, gint end_pos); -static gchar* get_text_near_offset (AtkText *text, +static gchar * get_text_near_offset (AtkText *text, GailOffsetType function, AtkTextBoundary boundary_type, gint offset, gint *start_offset, gint *end_offset); -G_DEFINE_TYPE_WITH_CODE(GailCanvasText, - gail_canvas_text, - GAIL_TYPE_CANVAS_ITEM, +G_DEFINE_TYPE_WITH_CODE(GailCanvasText, + gail_canvas_text, + GAIL_TYPE_CANVAS_ITEM, G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, gail_canvas_text_text_interface_init);) @@ -167,7 +167,7 @@ gail_canvas_text_text_interface_init (AtkTextIface *iface) iface->get_default_attributes = gail_canvas_text_get_default_attributes; } -static gchar* +static gchar * gail_canvas_text_get_text (AtkText *text, gint start_offset, gint end_offset) @@ -187,7 +187,7 @@ gail_canvas_text_get_text (AtkText *text, return gtk_text_buffer_get_text (buffer, &start, &end, FALSE); } -static gchar* +static gchar * gail_canvas_text_get_text_after_offset (AtkText *text, gint offset, AtkTextBoundary boundary_type, @@ -195,11 +195,11 @@ gail_canvas_text_get_text_after_offset (AtkText *text, gint *end_offset) { return get_text_near_offset (text, GAIL_AFTER_OFFSET, - boundary_type, offset, + boundary_type, offset, start_offset, end_offset); } -static gchar* +static gchar * gail_canvas_text_get_text_at_offset (AtkText *text, gint offset, AtkTextBoundary boundary_type, @@ -207,11 +207,11 @@ gail_canvas_text_get_text_at_offset (AtkText *text, gint *end_offset) { return get_text_near_offset (text, GAIL_AT_OFFSET, - boundary_type, offset, + boundary_type, offset, start_offset, end_offset); } -static gchar* +static gchar * gail_canvas_text_get_text_before_offset (AtkText *text, gint offset, AtkTextBoundary boundary_type, @@ -219,7 +219,7 @@ gail_canvas_text_get_text_before_offset (AtkText *text, gint *end_offset) { return get_text_near_offset (text, GAIL_BEFORE_OFFSET, - boundary_type, offset, + boundary_type, offset, start_offset, end_offset); } @@ -352,7 +352,7 @@ gail_canvas_text_get_n_selections (AtkText *text) gail_text = GAIL_CANVAS_TEXT (text); g_return_val_if_fail (gail_text->textutil, -1); buffer = gail_text->textutil->buffer; - + gtk_text_buffer_get_selection_bounds (buffer, &start, &end); select_start = gtk_text_iter_get_offset (&start); select_end = gtk_text_iter_get_offset (&end); @@ -363,7 +363,7 @@ gail_canvas_text_get_n_selections (AtkText *text) return 0; } -static gchar* +static gchar * gail_canvas_text_get_selection (AtkText *text, gint selection_num, gint *start_pos, @@ -467,8 +467,6 @@ gail_canvas_text_remove_selection (AtkText *text, return FALSE; } - - static gboolean gail_canvas_text_set_selection (AtkText *text, gint selection_num, @@ -508,7 +506,7 @@ gail_canvas_text_set_selection (AtkText *text, return FALSE; } -static gchar* +static gchar * get_text_near_offset (AtkText *text, GailOffsetType function, AtkTextBoundary boundary_type, @@ -517,6 +515,6 @@ get_text_near_offset (AtkText *text, gint *end_offset) { return gail_text_util_get_text (GAIL_CANVAS_TEXT (text)->textutil, NULL, - function, boundary_type, offset, + function, boundary_type, offset, start_offset, end_offset); } diff --git a/libgnomecanvas/gailcanvastextfactory.c b/libgnomecanvas/gailcanvastextfactory.c index 987e385530..2cbb97c7bc 100644 --- a/libgnomecanvas/gailcanvastextfactory.c +++ b/libgnomecanvas/gailcanvastextfactory.c @@ -35,7 +35,7 @@ gail_canvas_text_factory_init (GailCanvasTextFactory *foo) ; } -static void +static void gail_canvas_text_factory_class_init (GailCanvasTextFactoryClass *klass) { AtkObjectFactoryClass *class = ATK_OBJECT_FACTORY_CLASS (klass); @@ -44,7 +44,7 @@ gail_canvas_text_factory_class_init (GailCanvasTextFactoryClass *klass) class->get_accessible_type = gail_canvas_text_factory_get_accessible_type; } -static AtkObject* +static AtkObject* gail_canvas_text_factory_create_accessible (GObject *obj) { return gail_canvas_text_new (obj); diff --git a/libgnomecanvas/gailcanvastextfactory.h b/libgnomecanvas/gailcanvastextfactory.h index 3d99f778e5..b568151476 100644 --- a/libgnomecanvas/gailcanvastextfactory.h +++ b/libgnomecanvas/gailcanvastextfactory.h @@ -31,7 +31,6 @@ G_BEGIN_DECLS #define GAIL_IS_CANVAS_TEXT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_CANVAS_TEXT_FACTORY)) #define GAIL_CANVAS_TEXT_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_CANVAS_TEXT_FACTORY, GailCanvasTextFactoryClass)) - typedef struct _GailCanvasTextFactory GailCanvasTextFactory; typedef struct _GailCanvasTextFactoryClass GailCanvasTextFactoryClass; diff --git a/libgnomecanvas/gailcanvaswidget.c b/libgnomecanvas/gailcanvaswidget.c index c3d38f0699..7b49563322 100644 --- a/libgnomecanvas/gailcanvaswidget.c +++ b/libgnomecanvas/gailcanvaswidget.c @@ -59,7 +59,7 @@ gail_canvas_widget_class_init (GailCanvasWidgetClass *klass) class->ref_child = gail_canvas_widget_ref_child; } -static gint +static gint gail_canvas_widget_get_n_children (AtkObject *obj) { AtkGObjectAccessible *atk_gobj; diff --git a/libgnomecanvas/gailcanvaswidgetfactory.c b/libgnomecanvas/gailcanvaswidgetfactory.c index 5923c165d2..fa799c3642 100644 --- a/libgnomecanvas/gailcanvaswidgetfactory.c +++ b/libgnomecanvas/gailcanvaswidgetfactory.c @@ -34,7 +34,7 @@ gail_canvas_widget_factory_init (GailCanvasWidgetFactory *foo) ; } -static void +static void gail_canvas_widget_factory_class_init (GailCanvasWidgetFactoryClass *klass) { AtkObjectFactoryClass *class = ATK_OBJECT_FACTORY_CLASS (klass); @@ -43,7 +43,7 @@ gail_canvas_widget_factory_class_init (GailCanvasWidgetFactoryClass *klass) class->get_accessible_type = gail_canvas_widget_factory_get_accessible_type; } -static AtkObject* +static AtkObject* gail_canvas_widget_factory_create_accessible (GObject *obj) { return gail_canvas_widget_new (obj); diff --git a/libgnomecanvas/gailcanvaswidgetfactory.h b/libgnomecanvas/gailcanvaswidgetfactory.h index caca8131a2..6edf8cc888 100644 --- a/libgnomecanvas/gailcanvaswidgetfactory.h +++ b/libgnomecanvas/gailcanvaswidgetfactory.h @@ -31,7 +31,6 @@ G_BEGIN_DECLS #define GAIL_IS_CANVAS_WIDGET_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_CANVAS_WIDGET_FACTORY)) #define GAIL_CANVAS_WIDGET_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_CANVAS_WIDGET_FACTORY, GailCanvasWidgetFactoryClass)) - typedef struct _GailCanvasWidgetFactory GailCanvasWidgetFactory; typedef struct _GailCanvasWidgetFactoryClass GailCanvasWidgetFactoryClass; diff --git a/libgnomecanvas/gnome-canvas-bpath.c b/libgnomecanvas/gnome-canvas-bpath.c index f7f564a94d..a63500304b 100644 --- a/libgnomecanvas/gnome-canvas-bpath.c +++ b/libgnomecanvas/gnome-canvas-bpath.c @@ -45,8 +45,7 @@ static void gnome_canvas_bpath_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void gnome_canvas_bpath_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags); - +static void gnome_canvas_bpath_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags); static GnomeCanvasShapeClass *parent_class; @@ -145,7 +144,6 @@ gnome_canvas_bpath_set_property (GObject *object, } } - static void gnome_canvas_bpath_get_property (GObject *object, guint param_id, @@ -167,9 +165,9 @@ gnome_canvas_bpath_get_property (GObject *object, } static void -gnome_canvas_bpath_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +gnome_canvas_bpath_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags) { - if(GNOME_CANVAS_ITEM_CLASS(parent_class)->update) { + if (GNOME_CANVAS_ITEM_CLASS(parent_class)->update) { (* GNOME_CANVAS_ITEM_CLASS(parent_class)->update)(item, affine, clip_path, flags); } } diff --git a/libgnomecanvas/gnome-canvas-bpath.h b/libgnomecanvas/gnome-canvas-bpath.h index 42a06a8d19..b6488ffe1f 100644 --- a/libgnomecanvas/gnome-canvas-bpath.h +++ b/libgnomecanvas/gnome-canvas-bpath.h @@ -20,7 +20,6 @@ G_BEGIN_DECLS - /* Bpath item for the canvas. * * The following object arguments are available: @@ -38,21 +37,19 @@ G_BEGIN_DECLS #define GNOME_IS_CANVAS_BPATH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_CANVAS_BPATH)) #define GNOME_IS_CANVAS_BPATH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_BPATH)) - typedef struct _GnomeCanvasBpath GnomeCanvasBpath; typedef struct _GnomeCanvasBpathPriv GnomeCanvasBpathPriv; typedef struct _GnomeCanvasBpathClass GnomeCanvasBpathClass; struct _GnomeCanvasBpath { GnomeCanvasShape item; - + }; struct _GnomeCanvasBpathClass { GnomeCanvasShapeClass parent_class; }; - /* Standard Gtk function */ GType gnome_canvas_bpath_get_type (void) G_GNUC_CONST; diff --git a/libgnomecanvas/gnome-canvas-clipgroup.c b/libgnomecanvas/gnome-canvas-clipgroup.c index adfc749e47..6019d1cdf6 100644 --- a/libgnomecanvas/gnome-canvas-clipgroup.c +++ b/libgnomecanvas/gnome-canvas-clipgroup.c @@ -54,9 +54,9 @@ static void gnome_canvas_clipgroup_get_property (GObject *o GValue *value, GParamSpec *pspec); static void gnome_canvas_clipgroup_update (GnomeCanvasItem *item, - double *affine, + gdouble *affine, ArtSVP *clip_path, - int flags); + gint flags); /* * Generic clipping stuff @@ -166,7 +166,7 @@ gnome_canvas_clipgroup_destroy (GtkObject *object) gnome_canvas_path_def_unref (clipgroup->path); clipgroup->path = NULL; } - + if (clipgroup->svp) { art_svp_free (clipgroup->svp); clipgroup->svp = NULL; @@ -176,7 +176,6 @@ gnome_canvas_clipgroup_destroy (GtkObject *object) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } - static void gnome_canvas_clipgroup_set_property (GObject *object, guint param_id, @@ -235,13 +234,13 @@ gnome_canvas_clipgroup_get_property (GObject *object, break; default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); break; } } static void -gnome_canvas_clipgroup_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +gnome_canvas_clipgroup_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags) { GnomeCanvasClipgroup *clipgroup; ArtSvpWriter *swr; @@ -266,13 +265,13 @@ gnome_canvas_clipgroup_update (GnomeCanvasItem *item, double *affine, ArtSVP *cl svp1 = art_svp_from_vpath (vpath); art_free (vpath); - + swr = art_svp_writer_rewind_new (clipgroup->wind); art_svp_intersector (svp1, swr); svp2 = art_svp_writer_rewind_reap (swr); art_svp_free (svp1); - + if (clip_path != NULL) { svp = art_svp_intersect (svp2, clip_path); art_svp_free (svp2); diff --git a/libgnomecanvas/gnome-canvas-clipgroup.h b/libgnomecanvas/gnome-canvas-clipgroup.h index e424497daa..292812d6b9 100644 --- a/libgnomecanvas/gnome-canvas-clipgroup.h +++ b/libgnomecanvas/gnome-canvas-clipgroup.h @@ -24,14 +24,12 @@ G_BEGIN_DECLS - #define GNOME_TYPE_CANVAS_CLIPGROUP (gnome_canvas_clipgroup_get_type ()) #define GNOME_CANVAS_CLIPGROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS_CLIPGROUP, GnomeCanvasClipgroup)) #define GNOME_CANVAS_CLIPGROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_CLIPGROUP, GnomeCanvasClipgroupClass)) #define GNOME_IS_CANVAS_CLIPGROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_CANVAS_CLIPGROUP)) #define GNOME_IS_CANVAS_CLIPGROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_CLIPGROUP)) - typedef struct _GnomeCanvasClipgroup GnomeCanvasClipgroup; typedef struct _GnomeCanvasClipgroupClass GnomeCanvasClipgroupClass; @@ -48,11 +46,9 @@ struct _GnomeCanvasClipgroupClass { GnomeCanvasGroupClass parent_class; }; - /* Standard Gtk function */ GType gnome_canvas_clipgroup_get_type (void) G_GNUC_CONST; - G_END_DECLS #endif diff --git a/libgnomecanvas/gnome-canvas-i18n.h b/libgnomecanvas/gnome-canvas-i18n.h index a768438c5f..b324c05c8f 100644 --- a/libgnomecanvas/gnome-canvas-i18n.h +++ b/libgnomecanvas/gnome-canvas-i18n.h @@ -42,7 +42,7 @@ G_BEGIN_DECLS # ifdef GNOME_EXPLICIT_TRANSLATION_DOMAIN # undef _ # define _(String) dgettext (GNOME_EXPLICIT_TRANSLATION_DOMAIN, String) -# else +# else # define _(String) gettext (String) # endif # ifdef gettext_noop diff --git a/libgnomecanvas/gnome-canvas-line.c b/libgnomecanvas/gnome-canvas-line.c index fa7c74ccc1..563758b277 100644 --- a/libgnomecanvas/gnome-canvas-line.c +++ b/libgnomecanvas/gnome-canvas-line.c @@ -47,7 +47,6 @@ #define NUM_ARROW_POINTS 6 /* number of points in an arrowhead */ #define NUM_STATIC_POINTS 256 /* number of static points to use to avoid allocating arrays */ - #define GROW_BOUNDS(bx1, by1, bx2, by2, x, y) { \ if (x < bx1) \ bx1 = x; \ @@ -62,7 +61,6 @@ by2 = y; \ } - enum { PROP_0, PROP_POINTS, @@ -84,7 +82,6 @@ enum { PROP_ARROW_SHAPE_C }; - static void gnome_canvas_line_class_init (GnomeCanvasLineClass *class); static void gnome_canvas_line_init (GnomeCanvasLine *line); static void gnome_canvas_line_destroy (GtkObject *object); @@ -97,20 +94,18 @@ static void gnome_canvas_line_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void gnome_canvas_line_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags); +static void gnome_canvas_line_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags); static void gnome_canvas_line_realize (GnomeCanvasItem *item); static void gnome_canvas_line_unrealize (GnomeCanvasItem *item); static void gnome_canvas_line_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); -static double gnome_canvas_line_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, GnomeCanvasItem **actual_item); -static void gnome_canvas_line_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2); + gint x, gint y, gint width, gint height); +static gdouble gnome_canvas_line_point (GnomeCanvasItem *item, gdouble x, gdouble y, + gint cx, gint cy, GnomeCanvasItem **actual_item); +static void gnome_canvas_line_bounds (GnomeCanvasItem *item, gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2); static void gnome_canvas_line_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf); - static GnomeCanvasItemClass *parent_class; - GType gnome_canvas_line_get_type (void) { @@ -332,18 +327,18 @@ gnome_canvas_line_destroy (GtkObject *object) * points in the line is not zero. */ static void -get_bounds (GnomeCanvasLine *line, double *bx1, double *by1, double *bx2, double *by2) +get_bounds (GnomeCanvasLine *line, gdouble *bx1, gdouble *by1, gdouble *bx2, gdouble *by2) { - double *coords; - double x1, y1, x2, y2; - double width; - int i; + gdouble *coords; + gdouble x1, y1, x2, y2; + gdouble width; + gint i; if (!line->coords) { *bx1 = *by1 = *bx2 = *by2 = 0.0; return; } - + /* Find bounding box of line's points */ x1 = x2 = line->coords[0]; @@ -370,7 +365,7 @@ get_bounds (GnomeCanvasLine *line, double *bx1, double *by1, double *bx2, double if (line->join == GDK_JOIN_MITER) for (i = line->num_points, coords = line->coords; i >= 3; i--, coords += 2) { - double mx1, my1, mx2, my2; + gdouble mx1, my1, mx2, my2; if (gnome_canvas_get_miter_points (coords[0], coords[1], coords[2], coords[3], @@ -404,7 +399,7 @@ get_bounds (GnomeCanvasLine *line, double *bx1, double *by1, double *bx2, double * not zero. Affine is the i2c transformation. */ static void -get_bounds_canvas (GnomeCanvasLine *line, double *bx1, double *by1, double *bx2, double *by2, double affine[6]) +get_bounds_canvas (GnomeCanvasLine *line, gdouble *bx1, gdouble *by1, gdouble *bx2, gdouble *by2, gdouble affine[6]) { /* It would be possible to tighten the bounds somewhat by transforming the individual points before aggregating them into the bbox. But it hardly seems worth it. */ @@ -425,15 +420,15 @@ get_bounds_canvas (GnomeCanvasLine *line, double *bx1, double *by1, double *bx2, static void reconfigure_arrows (GnomeCanvasLine *line) { - double *poly, *coords; - double dx, dy, length; - double sin_theta, cos_theta, tmp; - double frac_height; /* Line width as fraction of arrowhead width */ - double backup; /* Distance to backup end points so the line ends in the middle of the arrowhead */ - double vx, vy; /* Position of arrowhead vertex */ - double shape_a, shape_b, shape_c; - double width; - int i; + gdouble *poly, *coords; + gdouble dx, dy, length; + gdouble sin_theta, cos_theta, tmp; + gdouble frac_height; /* Line width as fraction of arrowhead width */ + gdouble backup; /* Distance to backup end points so the line ends in the middle of the arrowhead */ + gdouble vx, vy; /* Position of arrowhead vertex */ + gdouble shape_a, shape_b, shape_c; + gdouble width; + gint i; if (line->num_points == 0) return; @@ -600,15 +595,15 @@ set_line_gc_foreground (GnomeCanvasLine *line) static void set_line_gc_width (GnomeCanvasLine *line) { - int width; + gint width; if (!line->gc) return; if (line->width_pixels) - width = (int) line->width; + width = (gint) line->width; else - width = (int) (line->width * line->item.canvas->pixels_per_unit + 0.5); + width = (gint) (line->width * line->item.canvas->pixels_per_unit + 0.5); gdk_gc_set_line_attributes (line->gc, width, @@ -619,7 +614,7 @@ set_line_gc_width (GnomeCanvasLine *line) /* Sets the stipple pattern for the line */ static void -set_stipple (GnomeCanvasLine *line, GdkBitmap *stipple, int reconfigure) +set_stipple (GnomeCanvasLine *line, GdkBitmap *stipple, gint reconfigure) { if (line->stipple && !reconfigure) g_object_unref (line->stipple); @@ -649,7 +644,7 @@ gnome_canvas_line_set_property (GObject *object, GdkColor color = { 0, 0, 0, 0, }; GdkColor *pcolor; gboolean color_changed; - int have_pixel; + gint have_pixel; g_return_if_fail (object != NULL); g_return_if_fail (GNOME_IS_CANVAS_LINE (object)); @@ -674,7 +669,7 @@ gnome_canvas_line_set_property (GObject *object, else { line->num_points = points->num_points; line->coords = g_new (double, 2 * line->num_points); - memcpy (line->coords, points->coords, 2 * line->num_points * sizeof (double)); + memcpy (line->coords, points->coords, 2 * line->num_points * sizeof (gdouble)); } /* Drop the arrowhead polygons if they exist -- they will be regenerated */ @@ -814,10 +809,10 @@ gnome_canvas_line_set_property (GObject *object, gnome_canvas_item_request_redraw_svp (item, line->fill_svp); - if (line->first_svp) + if (line->first_svp) gnome_canvas_item_request_redraw_svp (item, line->first_svp); - if (line->last_svp) + if (line->last_svp) gnome_canvas_item_request_redraw_svp (item, line->last_svp); } @@ -830,7 +825,7 @@ static GnomeCanvasPoints * get_points (GnomeCanvasLine *line) { GnomeCanvasPoints *points; - int start_ofs, end_ofs; + gint start_ofs, end_ofs; if (line->num_points == 0) return NULL; @@ -859,7 +854,7 @@ get_points (GnomeCanvasLine *line) memcpy (points->coords + 2 * start_ofs, line->coords + 2 * start_ofs, - 2 * (line->num_points - (start_ofs + end_ofs)) * sizeof (double)); + 2 * (line->num_points - (start_ofs + end_ofs)) * sizeof (gdouble)); return points; } @@ -912,11 +907,11 @@ gnome_canvas_line_get_property (GObject *object, case PROP_WIDTH_PIXELS: g_value_set_uint (value, line->width); break; - + case PROP_WIDTH_UNITS: g_value_set_double (value, line->width); break; - + case PROP_CAP_STYLE: g_value_set_enum (value, line->cap); break; @@ -981,14 +976,13 @@ gnome_canvas_line_render (GnomeCanvasItem *item, gnome_canvas_render_svp (buf, line->last_svp, line->fill_rgba); } - static ArtSVP * -svp_from_points (const double *item_coords, int num_points, const double affine[6]) +svp_from_points (const gdouble *item_coords, gint num_points, const gdouble affine[6]) { ArtVpath *vpath; ArtSVP *svp; - double x, y; - int i; + gdouble x, y; + gint i; vpath = art_new (ArtVpath, num_points + 2); @@ -1017,15 +1011,15 @@ svp_from_points (const double *item_coords, int num_points, const double affine[ } static void -gnome_canvas_line_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +gnome_canvas_line_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags) { GnomeCanvasLine *line; - int i; + gint i; ArtVpath *vpath; ArtPoint pi, pc; - double width; + gdouble width; ArtSVP *svp; - double x1, y1, x2, y2; + gdouble x1, y1, x2, y2; line = GNOME_CANVAS_LINE (item); @@ -1071,18 +1065,16 @@ gnome_canvas_line_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_pa if (line->first_arrow && line->first_coords) { svp = svp_from_points (line->first_coords, NUM_ARROW_POINTS, affine); - gnome_canvas_item_update_svp_clip (item, + gnome_canvas_item_update_svp_clip (item, &line->first_svp, svp, clip_path); } - if (line->last_arrow && line->last_coords) { svp = svp_from_points (line->last_coords, NUM_ARROW_POINTS, affine); - gnome_canvas_item_update_svp_clip (item, + gnome_canvas_item_update_svp_clip (item, &line->last_svp, svp, clip_path); } - } else { set_line_gc_foreground (line); set_line_gc_width (line); @@ -1129,17 +1121,17 @@ gnome_canvas_line_unrealize (GnomeCanvasItem *item) } static void -item_to_canvas (GnomeCanvas *canvas, double *item_coords, GdkPoint *canvas_coords, int num_points, - int *num_drawn_points, double i2c[6], int x, int y) +item_to_canvas (GnomeCanvas *canvas, gdouble *item_coords, GdkPoint *canvas_coords, gint num_points, + gint *num_drawn_points, gdouble i2c[6], gint x, gint y) { - int i; - int old_cx, old_cy; - int cx, cy; + gint i; + gint old_cx, old_cy; + gint cx, cy; ArtPoint pi, pc; #ifdef VERBOSE { - char str[128]; + gchar str[128]; art_affine_to_string (str, i2c); g_print ("line item_to_canvas %s\n", str); } @@ -1178,13 +1170,13 @@ item_to_canvas (GnomeCanvas *canvas, double *item_coords, GdkPoint *canvas_coord static void gnome_canvas_line_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height) + gint x, gint y, gint width, gint height) { GnomeCanvasLine *line; GdkPoint static_points[NUM_STATIC_POINTS]; GdkPoint *points; - int actual_num_points_drawn; - double i2c[6]; + gint actual_num_points_drawn; + gdouble i2c[6]; line = GNOME_CANVAS_LINE (item); @@ -1198,7 +1190,6 @@ gnome_canvas_line_draw (GnomeCanvasItem *item, GdkDrawable *drawable, else points = g_new (GdkPoint, line->num_points); - gnome_canvas_item_i2c_affine (item, i2c); item_to_canvas (item->canvas, line->coords, points, line->num_points, @@ -1230,18 +1221,18 @@ gnome_canvas_line_draw (GnomeCanvasItem *item, GdkDrawable *drawable, } static double -gnome_canvas_line_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, GnomeCanvasItem **actual_item) +gnome_canvas_line_point (GnomeCanvasItem *item, gdouble x, gdouble y, + gint cx, gint cy, GnomeCanvasItem **actual_item) { GnomeCanvasLine *line; - double *line_points = NULL, *coords; - double static_points[2 * NUM_STATIC_POINTS]; - double poly[10]; - double best, dist; - double dx, dy; - double width; - int num_points = 0, i; - int changed_miter_to_bevel; + gdouble *line_points = NULL, *coords; + gdouble static_points[2 * NUM_STATIC_POINTS]; + gdouble poly[10]; + gdouble best, dist; + gdouble dx, dy; + gdouble width; + gint num_points = 0, i; + gint changed_miter_to_bevel; #ifdef VERBOSE g_print ("gnome_canvas_line_point x, y = (%g, %g); cx, cy = (%d, %d)\n", x, y, cx, cy); @@ -1412,7 +1403,7 @@ done: } static void -gnome_canvas_line_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) +gnome_canvas_line_bounds (GnomeCanvasItem *item, gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2) { GnomeCanvasLine *line; diff --git a/libgnomecanvas/gnome-canvas-line.h b/libgnomecanvas/gnome-canvas-line.h index 4ab6cfa62d..f2a53c487c 100644 --- a/libgnomecanvas/gnome-canvas-line.h +++ b/libgnomecanvas/gnome-canvas-line.h @@ -35,13 +35,10 @@ #ifndef GNOME_CANVAS_LINE_H #define GNOME_CANVAS_LINE_H - #include <libgnomecanvas/gnome-canvas.h> - G_BEGIN_DECLS - /* Line item for the canvas. This is a polyline with configurable width, cap/join styles, and arrowheads. * If arrowheads are enabled, then three values are used to specify their shape: * @@ -64,7 +61,7 @@ G_BEGIN_DECLS * fill_stipple GdkBitmap* RW Stipple pattern for the line * width_pixels uint R Width of the line in pixels. The line width * will not be scaled when the canvas zoom factor changes. - * width_units double R Width of the line in canvas units. The line width + * width_units gdouble R Width of the line in canvas units. The line width * will be scaled when the canvas zoom factor changes. * cap_style GdkCapStyle RW Cap ("endpoint") style for the line. * join_style GdkJoinStyle RW Join ("vertex") style for the line. @@ -76,12 +73,11 @@ G_BEGIN_DECLS * smooth boolean RW Specifies whether to smooth the line using * parabolic splines. * spline_steps uint RW Specifies the number of steps to use when rendering curves. - * arrow_shape_a double RW First arrow shape specifier. - * arrow_shape_b double RW Second arrow shape specifier. - * arrow_shape_c double RW Third arrow shape specifier. + * arrow_shape_a gdouble RW First arrow shape specifier. + * arrow_shape_b gdouble RW Second arrow shape specifier. + * arrow_shape_c gdouble RW Third arrow shape specifier. */ - #define GNOME_TYPE_CANVAS_LINE (gnome_canvas_line_get_type ()) #define GNOME_CANVAS_LINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS_LINE, GnomeCanvasLine)) #define GNOME_CANVAS_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_LINE, GnomeCanvasLineClass)) @@ -89,14 +85,13 @@ G_BEGIN_DECLS #define GNOME_IS_CANVAS_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_LINE)) #define GNOME_CANVAS_LINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_LINE, GnomeCanvasLineClass)) - typedef struct _GnomeCanvasLine GnomeCanvasLine; typedef struct _GnomeCanvasLineClass GnomeCanvasLineClass; struct _GnomeCanvasLine { GnomeCanvasItem item; - double *coords; /* Array of coordinates for the line's points. X coords are in the + gdouble *coords; /* Array of coordinates for the line's points. X coords are in the * even indices, Y coords are in the odd indices. If the line has * arrowheads then the first and last points have been adjusted to * refer to the necks of the arrowheads rather than their tips. The @@ -104,8 +99,8 @@ struct _GnomeCanvasLine { * arrays, if they exist. */ - double *first_coords; /* Array of points describing polygon for the first arrowhead */ - double *last_coords; /* Array of points describing polygon for the last arrowhead */ + gdouble *first_coords; /* Array of points describing polygon for the first arrowhead */ + gdouble *last_coords; /* Array of points describing polygon for the last arrowhead */ GdkGC *gc; /* GC for drawing line */ @@ -115,11 +110,11 @@ struct _GnomeCanvasLine { ArtSVP *first_svp; /* The SVP for the first arrow */ /*AA*/ ArtSVP *last_svp; /* The SVP for the last arrow */ /*AA*/ - double width; /* Width of the line */ + gdouble width; /* Width of the line */ - double shape_a; /* Distance from tip of arrowhead to center */ - double shape_b; /* Distance from tip of arrowhead to trailing point, measured along shaft */ - double shape_c; /* Distance of trailing points from outside edge of shaft */ + gdouble shape_a; /* Distance from tip of arrowhead to center */ + gdouble shape_b; /* Distance from tip of arrowhead to trailing point, measured along shaft */ + gdouble shape_c; /* Distance of trailing points from outside edge of shaft */ GdkCapStyle cap; /* Cap style for line */ GdkJoinStyle join; /* Join style for line */ @@ -129,10 +124,10 @@ struct _GnomeCanvasLine { guint32 fill_rgba; /* RGBA color for outline */ /*AA*/ - int num_points; /* Number of points in the line */ + gint num_points; /* Number of points in the line */ guint fill_color; /* Fill color, RGBA */ - int spline_steps; /* Number of steps in each spline segment */ + gint spline_steps; /* Number of steps in each spline segment */ guint width_pixels : 1; /* Is the width specified in pixels or units? */ guint first_arrow : 1; /* Draw first arrowhead? */ @@ -144,11 +139,9 @@ struct _GnomeCanvasLineClass { GnomeCanvasItemClass parent_class; }; - /* Standard Gtk function */ GType gnome_canvas_line_get_type (void) G_GNUC_CONST; - G_END_DECLS #endif diff --git a/libgnomecanvas/gnome-canvas-path-def.c b/libgnomecanvas/gnome-canvas-path-def.c index 11b0924689..02ff22b957 100644 --- a/libgnomecanvas/gnome-canvas-path-def.c +++ b/libgnomecanvas/gnome-canvas-path-def.c @@ -66,10 +66,10 @@ gnome_canvas_path_def_get_type (void) /** * gnome_canvas_path_def_new: - * + * * This function creates a new empty #gnome_canvas_path_def. * - * Returns: the new canvas path definition. + * Returns: the new canvas path definition. */ GnomeCanvasPathDef * gnome_canvas_path_def_new (void) @@ -289,7 +289,7 @@ gnome_canvas_path_def_ensure_space (GnomeCanvasPathDef * path, gint space) * array is freed and @dest is marked as non-static (editable), * regardless of the status of @src. */ -void +void gnome_canvas_path_def_copy (GnomeCanvasPathDef * dst, const GnomeCanvasPathDef * src) { g_return_if_fail (dst != NULL); @@ -305,7 +305,6 @@ gnome_canvas_path_def_copy (GnomeCanvasPathDef * dst, const GnomeCanvasPathDef * dst->sbpath = FALSE; } - /** * gnome_canvas_path_def_duplicate: * @path: a GnomeCanvasPathDef to duplicate @@ -407,7 +406,9 @@ gnome_canvas_path_def_split (const GnomeCanvasPathDef * path) while (p < path->end) { i = 1; - while ((path->bpath[p + i].code == ART_LINETO) || (path->bpath[p + i].code == ART_CURVETO)) i++; + while ((path->bpath[p + i].code == ART_LINETO) || + (path->bpath[p + i].code == ART_CURVETO)) + i++; new = gnome_canvas_path_def_new_sized (i + 1); memcpy (new->bpath, path->bpath + p, i * sizeof (ArtBpath)); new->end = i; @@ -424,7 +425,7 @@ gnome_canvas_path_def_split (const GnomeCanvasPathDef * path) /** * gnome_canvas_path_def_open_parts: * @path: a GnomeCanvasPathDef - * + * * This function creates a new GnomeCanvasPathDef that contains all of * the open segments on the passed @path. * @@ -496,7 +497,7 @@ gnome_canvas_path_def_open_parts (const GnomeCanvasPathDef * path) /** * gnome_canvas_path_def_closed_parts: * @path: a GnomeCanvasPathDef - * + * * This function returns a new GnomeCanvasPathDef that contains the * all of close parts of passed @path. * @@ -668,7 +669,6 @@ gnome_canvas_path_def_unref (GnomeCanvasPathDef * path) } } - /* Methods */ /** * gnome_canvas_path_def_reset: @@ -781,7 +781,6 @@ gnome_canvas_path_def_lineto (GnomeCanvasPathDef * path, gdouble x, gdouble y) path->end++; } - /** * gnome_canvas_path_def_lineto_moving: * @path: a GnomeCanvasPathDef @@ -793,7 +792,7 @@ gnome_canvas_path_def_lineto (GnomeCanvasPathDef * path, gdouble x, gdouble y) * can change the coordinates of loose endpoint as many times as you want, * the last ones set will be fixed, if you continue line. This is useful * for handling drawing with mouse. - */ + */ void gnome_canvas_path_def_lineto_moving (GnomeCanvasPathDef * path, gdouble x, gdouble y) { @@ -860,9 +859,15 @@ gnome_canvas_path_def_lineto_moving (GnomeCanvasPathDef * path, gdouble x, gdoub * * This function adds a bezier curve segment to the path definition. */ - + void -gnome_canvas_path_def_curveto (GnomeCanvasPathDef * path, gdouble x0, gdouble y0, gdouble x1, gdouble y1, gdouble x2, gdouble y2) +gnome_canvas_path_def_curveto (GnomeCanvasPathDef * path, + gdouble x0, + gdouble y0, + gdouble x1, + gdouble y1, + gdouble x2, + gdouble y2) { ArtBpath * bp; @@ -1073,7 +1078,7 @@ gnome_canvas_path_def_currentpoint (const GnomeCanvasPathDef * path, ArtPoint * } else { p->x = (path->bpath + path->end - 1)->x3; p->y = (path->bpath + path->end - 1)->y3; - } + } } /** @@ -1223,7 +1228,9 @@ sp_bpath_check_subpath (ArtBpath * bpath) len = 0; - for (i = 1; (bpath[i].code != ART_END) && (bpath[i].code != ART_MOVETO) && (bpath[i].code != ART_MOVETO_OPEN); i++) { + for (i = 1; (bpath[i].code != ART_END) && + (bpath[i].code != ART_MOVETO) && + (bpath[i].code != ART_MOVETO_OPEN); i++) { switch (bpath[i].code) { case ART_LINETO: case ART_CURVETO: @@ -1251,7 +1258,7 @@ sp_bpath_length (const ArtBpath * bpath) g_return_val_if_fail (bpath != NULL, FALSE); - for (l = 0; bpath[l].code != ART_END; l++) ; + for (l = 0; bpath[l].code != ART_END; l++); l++; @@ -1284,4 +1291,3 @@ sp_bpath_all_open (const ArtBpath * bpath) return TRUE; } - diff --git a/libgnomecanvas/gnome-canvas-pixbuf.c b/libgnomecanvas/gnome-canvas-pixbuf.c index 9619e86df8..6a3d433c07 100644 --- a/libgnomecanvas/gnome-canvas-pixbuf.c +++ b/libgnomecanvas/gnome-canvas-pixbuf.c @@ -35,16 +35,16 @@ typedef struct { GdkPixbuf *pixbuf; /* Width value */ - double width; + gdouble width; /* Height value */ - double height; + gdouble height; /* X translation */ - double x; + gdouble x; /* Y translation */ - double y; + gdouble y; /* Whether dimensions are set and whether they are in pixels or units */ guint width_set : 1; @@ -53,7 +53,7 @@ typedef struct { guint height_in_pixels : 1; guint x_in_pixels : 1; guint y_in_pixels : 1; - + /* Whether the pixbuf has changed */ guint need_pixbuf_update : 1; @@ -93,15 +93,19 @@ static void gnome_canvas_pixbuf_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void gnome_canvas_pixbuf_update (GnomeCanvasItem *item, double *affine, - ArtSVP *clip_path, int flags); +static void gnome_canvas_pixbuf_update (GnomeCanvasItem *item, gdouble *affine, + ArtSVP *clip_path, gint flags); static void gnome_canvas_pixbuf_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); + gint x, gint y, gint width, gint height); static void gnome_canvas_pixbuf_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf); -static double gnome_canvas_pixbuf_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, +static gdouble gnome_canvas_pixbuf_point (GnomeCanvasItem *item, + gdouble x, + gdouble y, + gint cx, + gint cy, GnomeCanvasItem **actual_item); static void gnome_canvas_pixbuf_bounds (GnomeCanvasItem *item, - double *x1, double *y1, double *x2, double *y2); + gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2); static GnomeCanvasItemClass *parent_class; @@ -276,7 +280,8 @@ gnome_canvas_pixbuf_destroy (GtkObject *object) /* remember, destroy can be run multiple times! */ if (priv) { - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); + gnome_canvas_request_redraw ( + item->canvas, item->x1, item->y1, item->x2, item->y2); if (priv->pixbuf) g_object_unref (priv->pixbuf); @@ -302,7 +307,7 @@ gnome_canvas_pixbuf_set_property (GObject *object, GnomeCanvasPixbuf *gcp; PixbufPrivate *priv; GdkPixbuf *pixbuf; - double val; + gdouble val; g_return_if_fail (object != NULL); g_return_if_fail (GNOME_IS_CANVAS_PIXBUF (object)); @@ -495,7 +500,7 @@ gnome_canvas_pixbuf_get_property (GObject *object, * scaled by an affine transformation. */ static void -compute_xform_scaling (double *affine, ArtPoint *i_c, ArtPoint *j_c) +compute_xform_scaling (gdouble *affine, ArtPoint *i_c, ArtPoint *j_c) { ArtPoint orig, orig_c; ArtPoint i, j; @@ -526,16 +531,18 @@ compute_xform_scaling (double *affine, ArtPoint *i_c, ArtPoint *j_c) * args */ static void -compute_viewport_affine (GnomeCanvasPixbuf *gcp, double *viewport_affine, double *i2c) +compute_viewport_affine (GnomeCanvasPixbuf *gcp, + gdouble *viewport_affine, + gdouble *i2c) { PixbufPrivate *priv; ArtPoint i_c, j_c; - double i_len, j_len; - double si_len, sj_len; - double ti_len, tj_len; - double scale[6], translate[6]; - double w, h; - double x, y; + gdouble i_len, j_len; + gdouble si_len, sj_len; + gdouble ti_len, tj_len; + gdouble scale[6], translate[6]; + gdouble w, h; + gdouble x, y; priv = gcp->priv; @@ -628,7 +635,7 @@ compute_viewport_affine (GnomeCanvasPixbuf *gcp, double *viewport_affine, double case GTK_ANCHOR_NE: tj_len *= y; break; - + case GTK_ANCHOR_W: case GTK_ANCHOR_CENTER: case GTK_ANCHOR_E: @@ -649,7 +656,7 @@ compute_viewport_affine (GnomeCanvasPixbuf *gcp, double *viewport_affine, double art_affine_scale (scale, si_len, sj_len); art_affine_translate (translate, ti_len, tj_len); - art_affine_multiply (viewport_affine, scale, translate); + art_affine_multiply (viewport_affine, scale, translate); } /* Computes the affine transformation with which the pixbuf needs to be @@ -658,9 +665,9 @@ compute_viewport_affine (GnomeCanvasPixbuf *gcp, double *viewport_affine, double * by some other amount. */ static void -compute_render_affine (GnomeCanvasPixbuf *gcp, double *ra, double *i2c) +compute_render_affine (GnomeCanvasPixbuf *gcp, gdouble *ra, gdouble *i2c) { - double va[6]; + gdouble va[6]; compute_viewport_affine (gcp, va, i2c); #ifdef GNOME_CANVAS_PIXBUF_VERBOSE @@ -681,7 +688,7 @@ recompute_bounding_box (GnomeCanvasPixbuf *gcp, gdouble *i2c) { GnomeCanvasItem *item; PixbufPrivate *priv; - double ra[6]; + gdouble ra[6]; ArtDRect rect; item = GNOME_CANVAS_ITEM (gcp); @@ -723,7 +730,10 @@ recompute_bounding_box (GnomeCanvasPixbuf *gcp, gdouble *i2c) /* Update handler for the pixbuf canvas item */ static void -gnome_canvas_pixbuf_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +gnome_canvas_pixbuf_update (GnomeCanvasItem *item, + gdouble *affine, + ArtSVP *clip_path, + gint flags) { GnomeCanvasPixbuf *gcp; PixbufPrivate *priv; @@ -765,9 +775,11 @@ gnome_canvas_pixbuf_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_ priv->need_xform_update = FALSE; } #else /* ordinary update logic */ - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); + gnome_canvas_request_redraw ( + item->canvas, item->x1, item->y1, item->x2, item->y2); recompute_bounding_box (gcp, affine); - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); + gnome_canvas_request_redraw ( + item->canvas, item->x1, item->y1, item->x2, item->y2); priv->need_pixbuf_update = FALSE; priv->need_xform_update = FALSE; #endif @@ -778,21 +790,31 @@ gnome_canvas_pixbuf_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_ /* Rendering */ /* This is private to libart, but we need it. Sigh. */ -extern void art_rgb_affine_run (int *p_x0, int *p_x1, int y, int src_width, int src_height, - const double affine[6]); +extern void art_rgb_affine_run (gint *p_x0, + gint *p_x1, + gint y, + gint src_width, + gint src_height, + const gdouble affine[6]); /* Fills the specified buffer with the transformed version of a pixbuf */ static void -transform_pixbuf (guchar *dest, int x, int y, int width, int height, int rowstride, - GdkPixbuf *pixbuf, double *affine) +transform_pixbuf (guchar *dest, + gint x, + gint y, + gint width, + gint height, + gint rowstride, + GdkPixbuf *pixbuf, + gdouble *affine) { - int xx, yy; - double inv[6]; + gint xx, yy; + gdouble inv[6]; guchar *src, *d; ArtPoint src_p, dest_p; - int run_x1, run_x2; - int src_x, src_y; - int i; + gint run_x1, run_x2; + gint src_x, src_y; + gint i; art_affine_invert (inv, affine); @@ -831,15 +853,15 @@ transform_pixbuf (guchar *dest, int x, int y, int width, int height, int rowstri /* Draw handler for the pixbuf canvas item */ static void gnome_canvas_pixbuf_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height) + gint x, gint y, gint width, gint height) { GnomeCanvasPixbuf *gcp; PixbufPrivate *priv; - double i2c[6], render_affine[6]; + gdouble i2c[6], render_affine[6]; guchar *buf; GdkPixbuf *pixbuf; ArtIRect p_rect, a_rect, d_rect; - int w, h; + gint w, h; gcp = GNOME_CANVAS_PIXBUF (item); priv = gcp->priv; @@ -901,7 +923,7 @@ gnome_canvas_pixbuf_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) { GnomeCanvasPixbuf *gcp; PixbufPrivate *priv; - double i2c[6], render_affine[6]; + gdouble i2c[6], render_affine[6]; gcp = GNOME_CANVAS_PIXBUF (item); priv = gcp->priv; @@ -913,14 +935,13 @@ gnome_canvas_pixbuf_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) compute_render_affine (gcp, render_affine, i2c); gnome_canvas_buf_ensure_buf (buf); - if ((fabs (render_affine[1]) < GNOME_CANVAS_EPSILON) && (fabs (render_affine[2]) < GNOME_CANVAS_EPSILON) && render_affine[0] > 0.0 && render_affine[3] > 0.0) { GdkPixbuf *dest_pixbuf; - int x0, y0, x1, y1; + gint x0, y0, x1, y1; dest_pixbuf = gdk_pixbuf_new_from_data (buf->buf, GDK_COLORSPACE_RGB, @@ -931,7 +952,6 @@ gnome_canvas_pixbuf_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) buf->buf_rowstride, NULL, NULL); - x0 = floor (render_affine[4] - buf->rect.x0 + 0.5); y0 = floor (render_affine[5] - buf->rect.y0 + 0.5); @@ -942,12 +962,12 @@ gnome_canvas_pixbuf_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) x0 = MIN (x0, buf->rect.x1 - buf->rect.x0); y0 = MAX (y0, 0); y0 = MIN (y0, buf->rect.y1 - buf->rect.y0); - + x1 = MAX (x1, 0); x1 = MIN (x1, buf->rect.x1 - buf->rect.x0); y1 = MAX (y1, 0); y1 = MIN (y1, buf->rect.y1 - buf->rect.y0); - + gdk_pixbuf_composite (priv->pixbuf, dest_pixbuf, x0, y0, @@ -991,15 +1011,19 @@ gnome_canvas_pixbuf_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) /* Point handler for the pixbuf canvas item */ static double -gnome_canvas_pixbuf_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, - GnomeCanvasItem **actual_item) +gnome_canvas_pixbuf_point (GnomeCanvasItem *item, + gdouble x, + gdouble y, + gint cx, + gint cy, + GnomeCanvasItem **actual_item) { GnomeCanvasPixbuf *gcp; PixbufPrivate *priv; - double i2c[6], render_affine[6], inv[6]; + gdouble i2c[6], render_affine[6], inv[6]; ArtPoint c, p; - int px, py; - double no_hit; + gint px, py; + gdouble no_hit; guchar *src; GdkPixbuf *pixbuf; @@ -1045,11 +1069,15 @@ gnome_canvas_pixbuf_point (GnomeCanvasItem *item, double x, double y, int cx, in /* Bounds handler for the pixbuf canvas item */ static void -gnome_canvas_pixbuf_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) +gnome_canvas_pixbuf_bounds (GnomeCanvasItem *item, + gdouble *x1, + gdouble *y1, + gdouble *x2, + gdouble *y2) { GnomeCanvasPixbuf *gcp; PixbufPrivate *priv; - double i2c[6], viewport_affine[6]; + gdouble i2c[6], viewport_affine[6]; ArtDRect rect; gcp = GNOME_CANVAS_PIXBUF (item); diff --git a/libgnomecanvas/gnome-canvas-pixbuf.h b/libgnomecanvas/gnome-canvas-pixbuf.h index 0554ab8624..f8f4d72ad4 100644 --- a/libgnomecanvas/gnome-canvas-pixbuf.h +++ b/libgnomecanvas/gnome-canvas-pixbuf.h @@ -23,7 +23,6 @@ #ifndef GNOME_CANVAS_PIXBUF_H #define GNOME_CANVAS_PIXBUF_H - #include <libgnomecanvas/gnome-canvas.h> G_BEGIN_DECLS @@ -37,7 +36,6 @@ G_BEGIN_DECLS #define GNOME_IS_CANVAS_PIXBUF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_PIXBUF)) #define GNOME_CANVAS_PIXBUF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_PIXBUF, GnomeCanvasPixbufClass)) - typedef struct _GnomeCanvasPixbuf GnomeCanvasPixbuf; typedef struct _GnomeCanvasPixbufClass GnomeCanvasPixbufClass; @@ -52,7 +50,6 @@ struct _GnomeCanvasPixbufClass { GnomeCanvasItemClass parent_class; }; - GType gnome_canvas_pixbuf_get_type (void) G_GNUC_CONST; diff --git a/libgnomecanvas/gnome-canvas-polygon.c b/libgnomecanvas/gnome-canvas-polygon.c index 53c7965a88..e805a652e4 100644 --- a/libgnomecanvas/gnome-canvas-polygon.c +++ b/libgnomecanvas/gnome-canvas-polygon.c @@ -61,7 +61,7 @@ static void gnome_canvas_polygon_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void gnome_canvas_polygon_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags); +static void gnome_canvas_polygon_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags); static GnomeCanvasItemClass *parent_class; @@ -137,12 +137,11 @@ gnome_canvas_polygon_destroy (GtkObject *object) /* remember, destroy can be run multiple times! */ - if(poly->path_def) + if (poly->path_def) gnome_canvas_path_def_unref(poly->path_def); poly->path_def = NULL; - if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } @@ -150,8 +149,7 @@ gnome_canvas_polygon_destroy (GtkObject *object) static void set_points (GnomeCanvasPolygon *poly, GnomeCanvasPoints *points) { - int i; - + gint i; if (poly->path_def) gnome_canvas_path_def_unref(poly->path_def); @@ -162,7 +160,6 @@ set_points (GnomeCanvasPolygon *poly, GnomeCanvasPoints *points) return; } - /* Optomize the path def to the number of points */ poly->path_def = gnome_canvas_path_def_new_sized(points->num_points+1); @@ -173,9 +170,8 @@ set_points (GnomeCanvasPolygon *poly, GnomeCanvasPoints *points) || (points->coords[1] != points->coords[2 * points->num_points - 1])); #endif - gnome_canvas_path_def_moveto (poly->path_def, points->coords[0], points->coords[1]); - + for (i = 1; i < points->num_points; i++) { gnome_canvas_path_def_lineto(poly->path_def, points->coords[i * 2], points->coords[(i * 2) + 1]); } @@ -185,7 +181,6 @@ set_points (GnomeCanvasPolygon *poly, GnomeCanvasPoints *points) gnome_canvas_shape_set_path_def (GNOME_CANVAS_SHAPE (poly), poly->path_def); } - static void gnome_canvas_polygon_set_property (GObject *object, guint param_id, @@ -210,13 +205,12 @@ gnome_canvas_polygon_set_property (GObject *object, gnome_canvas_item_request_update (item); break; - default: + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); break; } } - static void gnome_canvas_polygon_get_property (GObject *object, guint param_id, @@ -235,9 +229,8 @@ gnome_canvas_polygon_get_property (GObject *object, } } - static void -gnome_canvas_polygon_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +gnome_canvas_polygon_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags) { /* Since the path has already been defined just pass the update up. */ diff --git a/libgnomecanvas/gnome-canvas-polygon.h b/libgnomecanvas/gnome-canvas-polygon.h index 738f0f453d..36233aedc9 100644 --- a/libgnomecanvas/gnome-canvas-polygon.h +++ b/libgnomecanvas/gnome-canvas-polygon.h @@ -35,14 +35,12 @@ #ifndef GNOME_CANVAS_POLYGON_H #define GNOME_CANVAS_POLYGON_H - #include <libgnomecanvas/gnome-canvas.h> #include <libgnomecanvas/gnome-canvas-shape.h> #include <libgnomecanvas/gnome-canvas-path-def.h> G_BEGIN_DECLS - /* Polygon item for the canvas. A polygon is a bit different from rectangles and ellipses in that * points inside it will always be considered "inside", even if the fill color is not set. If you * want to have a hollow polygon, use a line item instead. @@ -66,7 +64,6 @@ G_BEGIN_DECLS #define GNOME_IS_CANVAS_POLYGON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_POLYGON)) #define GNOME_CANVAS_POLYGON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_POLYGON, GnomeCanvasPolygonClass)) - typedef struct _GnomeCanvasPolygon GnomeCanvasPolygon; typedef struct _GnomeCanvasPolygonClass GnomeCanvasPolygonClass; @@ -80,7 +77,6 @@ struct _GnomeCanvasPolygonClass { GnomeCanvasShapeClass parent_class; }; - /* Standard Gtk function */ GType gnome_canvas_polygon_get_type (void) G_GNUC_CONST; diff --git a/libgnomecanvas/gnome-canvas-rect-ellipse.c b/libgnomecanvas/gnome-canvas-rect-ellipse.c index 10136866ef..bf318506ab 100644 --- a/libgnomecanvas/gnome-canvas-rect-ellipse.c +++ b/libgnomecanvas/gnome-canvas-rect-ellipse.c @@ -38,7 +38,6 @@ #include "gnome-canvas-util.h" #include "gnome-canvas-shape.h" - #include <libart_lgpl/art_vpath.h> #include <libart_lgpl/art_svp.h> #include <libart_lgpl/art_svp_vpath.h> @@ -56,7 +55,6 @@ enum { PROP_Y2 }; - static void gnome_canvas_re_class_init (GnomeCanvasREClass *class); static void gnome_canvas_re_init (GnomeCanvasRE *re); static void gnome_canvas_re_destroy (GtkObject *object); @@ -69,12 +67,11 @@ static void gnome_canvas_re_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void gnome_canvas_rect_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags); -static void gnome_canvas_ellipse_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags); +static void gnome_canvas_rect_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags); +static void gnome_canvas_ellipse_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags); static GnomeCanvasItemClass *re_parent_class; - GType gnome_canvas_re_get_type (void) { @@ -248,8 +245,6 @@ gnome_canvas_re_get_property (GObject *object, /* Rectangle item */ static void gnome_canvas_rect_class_init (GnomeCanvasRectClass *class); - - GType gnome_canvas_rect_get_type (void) { @@ -287,22 +282,22 @@ gnome_canvas_rect_class_init (GnomeCanvasRectClass *class) } static void -gnome_canvas_rect_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gint flags) -{ GnomeCanvasRE *re; +gnome_canvas_rect_update (GnomeCanvasItem *item, gdouble affine[6], ArtSVP *clip_path, gint flags) +{ GnomeCanvasRE *re; GnomeCanvasPathDef *path_def; re = GNOME_CANVAS_RE(item); - if (re->path_dirty) { + if (re->path_dirty) { path_def = gnome_canvas_path_def_new (); - + gnome_canvas_path_def_moveto(path_def, re->x1, re->y1); gnome_canvas_path_def_lineto(path_def, re->x2, re->y1); gnome_canvas_path_def_lineto(path_def, re->x2, re->y2); gnome_canvas_path_def_lineto(path_def, re->x1, re->y2); - gnome_canvas_path_def_lineto(path_def, re->x1, re->y1); - gnome_canvas_path_def_closepath_current(path_def); + gnome_canvas_path_def_lineto(path_def, re->x1, re->y1); + gnome_canvas_path_def_closepath_current(path_def); gnome_canvas_shape_set_path_def (GNOME_CANVAS_SHAPE (item), path_def); gnome_canvas_path_def_unref(path_def); re->path_dirty = 0; @@ -314,10 +309,8 @@ gnome_canvas_rect_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_ /* Ellipse item */ - static void gnome_canvas_ellipse_class_init (GnomeCanvasEllipseClass *class); - GType gnome_canvas_ellipse_get_type (void) { @@ -357,7 +350,7 @@ gnome_canvas_ellipse_class_init (GnomeCanvasEllipseClass *class) #define N_PTS 90 static void -gnome_canvas_ellipse_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gint flags) { +gnome_canvas_ellipse_update (GnomeCanvasItem *item, gdouble affine[6], ArtSVP *clip_path, gint flags) { GnomeCanvasPathDef *path_def; GnomeCanvasRE *re; @@ -401,7 +394,7 @@ gnome_canvas_ellipse_update (GnomeCanvasItem *item, double affine[6], ArtSVP *cl cx - mx - dx2, cy - my + dy2, cx - rx, cy - dy1, cx - rx, cy); - + gnome_canvas_path_def_curveto (path_def, cx - rx, cy + dy1, cx - mx - dx2, cy + my - dy2, @@ -418,9 +411,9 @@ gnome_canvas_ellipse_update (GnomeCanvasItem *item, double affine[6], ArtSVP *cl cx + mx + dx2, cy + my - dy2, cx + rx, cy + dy1, cx + rx, cy); - + gnome_canvas_path_def_closepath_current(path_def); - + gnome_canvas_shape_set_path_def (GNOME_CANVAS_SHAPE (item), path_def); gnome_canvas_path_def_unref(path_def); re->path_dirty = 0; diff --git a/libgnomecanvas/gnome-canvas-rect-ellipse.h b/libgnomecanvas/gnome-canvas-rect-ellipse.h index 494e6cf485..27f14be4c7 100644 --- a/libgnomecanvas/gnome-canvas-rect-ellipse.h +++ b/libgnomecanvas/gnome-canvas-rect-ellipse.h @@ -34,7 +34,6 @@ #ifndef GNOME_CANVAS_RECT_ELLIPSE_H #define GNOME_CANVAS_RECT_ELLIPSE_H - #include <libgnomecanvas/gnome-canvas.h> #include <libgnomecanvas/gnome-canvas-shape.h> @@ -43,16 +42,15 @@ G_BEGIN_DECLS - /* Base class for rectangle and ellipse item types. These are defined by their top-left and * bottom-right corners. Rectangles and ellipses share the following arguments: * * name type read/write description * ------------------------------------------------------------------------------------------ - * x1 double RW Leftmost coordinate of rectangle or ellipse - * y1 double RW Topmost coordinate of rectangle or ellipse - * x2 double RW Rightmost coordinate of rectangle or ellipse - * y2 double RW Bottommost coordinate of rectangle or ellipse + * x1 gdouble RW Leftmost coordinate of rectangle or ellipse + * y1 gdouble RW Topmost coordinate of rectangle or ellipse + * x2 gdouble RW Rightmost coordinate of rectangle or ellipse + * y2 gdouble RW Bottommost coordinate of rectangle or ellipse * fill_color string W X color specification for fill color, * or NULL pointer for no color (transparent) * fill_color_gdk GdkColor* RW Allocated GdkColor for fill @@ -63,11 +61,10 @@ G_BEGIN_DECLS * outline_stipple GdkBitmap* RW Stipple pattern for outline * width_pixels uint RW Width of the outline in pixels. The outline will * not be scaled when the canvas zoom factor is changed. - * width_units double RW Width of the outline in canvas units. The outline + * width_units gdouble RW Width of the outline in canvas units. The outline * will be scaled when the canvas zoom factor is changed. */ - #define GNOME_TYPE_CANVAS_RE (gnome_canvas_re_get_type ()) #define GNOME_CANVAS_RE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS_RE, GnomeCanvasRE)) #define GNOME_CANVAS_RE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_RE, GnomeCanvasREClass)) @@ -75,32 +72,28 @@ G_BEGIN_DECLS #define GNOME_IS_CANVAS_RE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_RE)) #define GNOME_CANVAS_RE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_RE, GnomeCanvasREClass)) - typedef struct _GnomeCanvasRE GnomeCanvasRE; typedef struct _GnomeCanvasREClass GnomeCanvasREClass; struct _GnomeCanvasRE { GnomeCanvasShape item; - double x1, y1, x2, y2; /* Corners of item */ + gdouble x1, y1, x2, y2; /* Corners of item */ - unsigned int path_dirty : 1; + guint path_dirty : 1; }; struct _GnomeCanvasREClass { GnomeCanvasShapeClass parent_class; }; - /* Standard Gtk function */ GType gnome_canvas_re_get_type (void) G_GNUC_CONST; - /* Rectangle item. No configurable or queryable arguments are available (use those in * GnomeCanvasRE). */ - #define GNOME_TYPE_CANVAS_RECT (gnome_canvas_rect_get_type ()) #define GNOME_CANVAS_RECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS_RECT, GnomeCanvasRect)) #define GNOME_CANVAS_RECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_RECT, GnomeCanvasRectClass)) @@ -108,7 +101,6 @@ GType gnome_canvas_re_get_type (void) G_GNUC_CONST; #define GNOME_IS_CANVAS_RECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_RECT)) #define GNOME_CANVAS_RECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_RECT, GnomeCanvasRectClass)) - typedef struct _GnomeCanvasRect GnomeCanvasRect; typedef struct _GnomeCanvasRectClass GnomeCanvasRectClass; @@ -120,16 +112,13 @@ struct _GnomeCanvasRectClass { GnomeCanvasREClass parent_class; }; - /* Standard Gtk function */ GType gnome_canvas_rect_get_type (void) G_GNUC_CONST; - /* Ellipse item. No configurable or queryable arguments are available (use those in * GnomeCanvasRE). */ - #define GNOME_TYPE_CANVAS_ELLIPSE (gnome_canvas_ellipse_get_type ()) #define GNOME_CANVAS_ELLIPSE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS_ELLIPSE, GnomeCanvasEllipse)) #define GNOME_CANVAS_ELLIPSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_ELLIPSE, GnomeCanvasEllipseClass)) @@ -137,7 +126,6 @@ GType gnome_canvas_rect_get_type (void) G_GNUC_CONST; #define GNOME_IS_CANVAS_ELLIPSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_ELLIPSE)) #define GNOME_CANVAS_ELLIPSE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_ELLIPSE, GnomeCanvasEllipseClass)) - typedef struct _GnomeCanvasEllipse GnomeCanvasEllipse; typedef struct _GnomeCanvasEllipseClass GnomeCanvasEllipseClass; @@ -149,11 +137,9 @@ struct _GnomeCanvasEllipseClass { GnomeCanvasREClass parent_class; }; - /* Standard Gtk function */ GType gnome_canvas_ellipse_get_type (void) G_GNUC_CONST; - G_END_DECLS #endif diff --git a/libgnomecanvas/gnome-canvas-rich-text.c b/libgnomecanvas/gnome-canvas-rich-text.c index 28bb2c50b6..b8fbae962d 100644 --- a/libgnomecanvas/gnome-canvas-rich-text.c +++ b/libgnomecanvas/gnome-canvas-rich-text.c @@ -38,14 +38,14 @@ struct _GnomeCanvasRichTextPrivate { GtkTextLayout *layout; GtkTextBuffer *buffer; - char *text; + gchar *text; /* Position at anchor */ - double x, y; + gdouble x, y; /* Dimensions */ - double width, height; + gdouble width, height; /* Top-left canvas coordinates for text */ - int cx, cy; + gint cx, cy; gboolean cursor_visible; gboolean cursor_blink; @@ -56,12 +56,12 @@ struct _GnomeCanvasRichTextPrivate { GtkJustification justification; GtkTextDirection direction; GtkAnchorType anchor; - int pixels_above_lines; - int pixels_below_lines; - int pixels_inside_wrap; - int left_margin; - int right_margin; - int indent; + gint pixels_above_lines; + gint pixels_below_lines; + gint pixels_inside_wrap; + gint left_margin; + gint right_margin; + gint indent; guint preblink_timeout; guint blink_timeout; @@ -73,7 +73,7 @@ struct _GnomeCanvasRichTextPrivate { gboolean just_selected_element; - int clicks; + gint clicks; guint click_timeout; }; @@ -115,35 +115,35 @@ static void gnome_canvas_rich_text_set_property(GObject *object, guint property_ const GValue *value, GParamSpec *pspec); static void gnome_canvas_rich_text_get_property(GObject *object, guint property_id, GValue *value, GParamSpec *pspec); -static void gnome_canvas_rich_text_update(GnomeCanvasItem *item, double *affine, - ArtSVP *clip_path, int flags); +static void gnome_canvas_rich_text_update(GnomeCanvasItem *item, gdouble *affine, + ArtSVP *clip_path, gint flags); static void gnome_canvas_rich_text_realize(GnomeCanvasItem *item); static void gnome_canvas_rich_text_unrealize(GnomeCanvasItem *item); -static double gnome_canvas_rich_text_point(GnomeCanvasItem *item, - double x, double y, - int cx, int cy, +static gdouble gnome_canvas_rich_text_point(GnomeCanvasItem *item, + gdouble x, gdouble y, + gint cx, gint cy, GnomeCanvasItem **actual_item); -static void gnome_canvas_rich_text_draw(GnomeCanvasItem *item, +static void gnome_canvas_rich_text_draw(GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); + gint x, gint y, gint width, gint height); static void gnome_canvas_rich_text_render(GnomeCanvasItem *item, GnomeCanvasBuf *buf); -static gint gnome_canvas_rich_text_event(GnomeCanvasItem *item, +static gint gnome_canvas_rich_text_event(GnomeCanvasItem *item, GdkEvent *event); -static void gnome_canvas_rich_text_get_bounds(GnomeCanvasItem *text, double *px1, double *py1, - double *px2, double *py2); +static void gnome_canvas_rich_text_get_bounds(GnomeCanvasItem *text, + gdouble *px1, gdouble *py1, + gdouble *px2, gdouble *py2); static void gnome_canvas_rich_text_ensure_layout(GnomeCanvasRichText *text); static void gnome_canvas_rich_text_destroy_layout(GnomeCanvasRichText *text); -static void gnome_canvas_rich_text_start_cursor_blink(GnomeCanvasRichText *text, gboolean delay); +static void gnome_canvas_rich_text_start_cursor_blink(GnomeCanvasRichText *text, + gboolean delay); static void gnome_canvas_rich_text_stop_cursor_blink(GnomeCanvasRichText *text); static void gnome_canvas_rich_text_move_cursor(GnomeCanvasRichText *text, GtkMovementStep step, gint count, gboolean extend_selection); - - static GtkTextBuffer *get_buffer(GnomeCanvasRichText *text); static gint blink_cb(gpointer data); @@ -170,8 +170,9 @@ gnome_canvas_rich_text_get_type(void) NULL /* value_table */ }; - rich_text_type = g_type_register_static (GNOME_TYPE_CANVAS_ITEM, "GnomeCanvasRichText", - &object_info, 0); + rich_text_type = g_type_register_static ( + GNOME_TYPE_CANVAS_ITEM, "GnomeCanvasRichText", + &object_info, 0); } return rich_text_type; @@ -197,7 +198,7 @@ gnome_canvas_rich_text_class_init(GnomeCanvasRichTextClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS(klass); GtkObjectClass *object_class = GTK_OBJECT_CLASS(klass); GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS(klass); - + parent_class = g_type_class_peek_parent (klass); gobject_class->set_property = gnome_canvas_rich_text_set_property; @@ -417,7 +418,7 @@ gnome_canvas_rich_text_init(GnomeCanvasRichText *text) text->_priv->justification = GTK_JUSTIFY_LEFT; text->_priv->direction = gtk_widget_get_default_direction(); text->_priv->anchor = GTK_ANCHOR_NW; - + text->_priv->blink_timeout = 0; text->_priv->preblink_timeout = 0; @@ -506,7 +507,7 @@ gnome_canvas_rich_text_set_property (GObject *object, guint property_id, text->_priv->wrap_mode = g_value_get_enum (value); if (text->_priv->layout) { - text->_priv->layout->default_style->wrap_mode = + text->_priv->layout->default_style->wrap_mode = text->_priv->wrap_mode; gtk_text_layout_default_style_changed(text->_priv->layout); } @@ -534,7 +535,7 @@ gnome_canvas_rich_text_set_property (GObject *object, guint property_id, break; case PROP_PIXELS_ABOVE_LINES: text->_priv->pixels_above_lines = g_value_get_int (value); - + if (text->_priv->layout) { text->_priv->layout->default_style->pixels_above_lines = text->_priv->pixels_above_lines; @@ -543,7 +544,7 @@ gnome_canvas_rich_text_set_property (GObject *object, guint property_id, break; case PROP_PIXELS_BELOW_LINES: text->_priv->pixels_below_lines = g_value_get_int (value); - + if (text->_priv->layout) { text->_priv->layout->default_style->pixels_below_lines = text->_priv->pixels_below_lines; @@ -552,7 +553,7 @@ gnome_canvas_rich_text_set_property (GObject *object, guint property_id, break; case PROP_PIXELS_INSIDE_WRAP: text->_priv->pixels_inside_wrap = g_value_get_int (value); - + if (text->_priv->layout) { text->_priv->layout->default_style->pixels_inside_wrap = text->_priv->pixels_inside_wrap; @@ -561,7 +562,7 @@ gnome_canvas_rich_text_set_property (GObject *object, guint property_id, break; case PROP_LEFT_MARGIN: text->_priv->left_margin = g_value_get_int (value); - + if (text->_priv->layout) { text->_priv->layout->default_style->left_margin = text->_priv->left_margin; @@ -570,7 +571,7 @@ gnome_canvas_rich_text_set_property (GObject *object, guint property_id, break; case PROP_RIGHT_MARGIN: text->_priv->right_margin = g_value_get_int (value); - + if (text->_priv->layout) { text->_priv->layout->default_style->right_margin = text->_priv->right_margin; @@ -579,13 +580,13 @@ gnome_canvas_rich_text_set_property (GObject *object, guint property_id, break; case PROP_INDENT: text->_priv->pixels_above_lines = g_value_get_int (value); - + if (text->_priv->layout) { text->_priv->layout->default_style->indent = text->_priv->indent; gtk_text_layout_default_style_changed(text->_priv->layout); } break; - + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -724,7 +725,7 @@ gnome_canvas_rich_text_move_cursor(GnomeCanvasRichText *text, GtkTextIter insert, newplace; gtk_text_buffer_get_iter_at_mark( - get_buffer(text), &insert, + get_buffer(text), &insert, gtk_text_buffer_get_mark(get_buffer(text), "insert")); newplace = insert; @@ -747,7 +748,7 @@ gnome_canvas_rich_text_move_cursor(GnomeCanvasRichText *text, gnome_canvas_rich_text_move_iter_by_lines( text, &newplace, count); gtk_text_layout_move_iter_to_x( - text->_priv->layout, &newplace, + text->_priv->layout, &newplace, gnome_canvas_rich_text_get_cursor_x_position(text)); break; case GTK_MOVEMENT_DISPLAY_LINE_ENDS: @@ -759,7 +760,7 @@ gnome_canvas_rich_text_move_cursor(GnomeCanvasRichText *text, gnome_canvas_rich_text_move_iter_by_lines( text, &newplace, ++count); } - + if (count != 0) { gtk_text_layout_move_iter_to_line_end( text->_priv->layout, &newplace, count); @@ -842,7 +843,7 @@ gnome_canvas_rich_text_delete_from_cursor(GnomeCanvasRichText *text, /* Special case: If the user wants to delete a character and there is a selection, then delete the selection and return */ if (type == GTK_DELETE_CHARS) { - if (gtk_text_buffer_delete_selection(get_buffer(text), TRUE, + if (gtk_text_buffer_delete_selection(get_buffer(text), TRUE, text->_priv->editable)) return; } @@ -915,15 +916,15 @@ selection_motion_event_handler(GnomeCanvasRichText *text, GdkEvent *event, { GtkTextIter newplace; GtkTextMark *mark; - double newx, newy; + gdouble newx, newy; /* We only want to handle motion events... */ if (event->type != GDK_MOTION_NOTIFY) return FALSE; - newx = (event->motion.x - text->_priv->x) * + newx = (event->motion.x - text->_priv->x) * GNOME_CANVAS_ITEM(text)->canvas->pixels_per_unit; - newy = (event->motion.y - text->_priv->y) * + newy = (event->motion.y - text->_priv->y) * GNOME_CANVAS_ITEM(text)->canvas->pixels_per_unit; gtk_text_layout_get_iter_at_pixel(text->_priv->layout, &newplace, newx, newy); @@ -979,9 +980,9 @@ gnome_canvas_rich_text_emit_tag_changed(GnomeCanvasRichText *text, { g_signal_emit(G_OBJECT(text), signals[TAG_CHANGED], 0, tag); } /* gnome_canvas_rich_text_emit_tag_changed */ - + static gint -gnome_canvas_rich_text_key_press_event(GnomeCanvasItem *item, +gnome_canvas_rich_text_key_press_event(GnomeCanvasItem *item, GdkEventKey *event) { GnomeCanvasRichText *text = GNOME_CANVAS_RICH_TEXT(item); @@ -1018,7 +1019,7 @@ gnome_canvas_rich_text_key_press_event(GnomeCanvasItem *item, case GDK_Right: if (event->state & GDK_CONTROL_MASK) { gnome_canvas_rich_text_move_cursor( - text, GTK_MOVEMENT_WORDS, 1, + text, GTK_MOVEMENT_WORDS, 1, extend_selection); handled = TRUE; } @@ -1211,12 +1212,12 @@ gnome_canvas_rich_text_key_press_event(GnomeCanvasItem *item, } gnome_canvas_rich_text_start_cursor_blink(text, TRUE); - + return TRUE; } /* gnome_canvas_rich_text_key_press_event */ static gint -gnome_canvas_rich_text_key_release_event(GnomeCanvasItem *item, +gnome_canvas_rich_text_key_release_event(GnomeCanvasItem *item, GdkEventKey *event) { return FALSE; @@ -1240,11 +1241,11 @@ gnome_canvas_rich_text_button_press_event(GnomeCanvasItem *item, GnomeCanvasRichText *text = GNOME_CANVAS_RICH_TEXT(item); GtkTextIter iter; GdkEventType event_type; - double newx, newy; + gdouble newx, newy; newx = (event->x - text->_priv->x) * item->canvas->pixels_per_unit; newy = (event->y - text->_priv->y) * item->canvas->pixels_per_unit; - + gtk_text_layout_get_iter_at_pixel(text->_priv->layout, &iter, newx, newy); /* The canvas doesn't give us double- or triple-click events, so @@ -1289,7 +1290,7 @@ gnome_canvas_rich_text_button_press_event(GnomeCanvasItem *item, #if 0 printf("double-click\n"); #endif - + gnome_canvas_rich_text_end_selection_drag(text, event); start = iter; @@ -1298,7 +1299,7 @@ gnome_canvas_rich_text_button_press_event(GnomeCanvasItem *item, if (gtk_text_iter_inside_word(&start)) { if (!gtk_text_iter_starts_word(&start)) gtk_text_iter_backward_word_start(&start); - + if (!gtk_text_iter_ends_word(&end)) gtk_text_iter_forward_word_end(&end); } @@ -1360,7 +1361,7 @@ gnome_canvas_rich_text_button_press_event(GnomeCanvasItem *item, gtk_clipboard_get (GDK_SELECTION_PRIMARY), &iter, text->_priv->editable); } - + return FALSE; } /* gnome_canvas_rich_text_button_press_event */ @@ -1369,11 +1370,11 @@ gnome_canvas_rich_text_button_release_event(GnomeCanvasItem *item, GdkEventButton *event) { GnomeCanvasRichText *text = GNOME_CANVAS_RICH_TEXT(item); - double newx, newy; + gdouble newx, newy; newx = (event->x - text->_priv->x) * item->canvas->pixels_per_unit; newy = (event->y - text->_priv->y) * item->canvas->pixels_per_unit; - + if (event->button == 1) { if (text->_priv->drag_start_x >= 0) { text->_priv->drag_start_x = -1; @@ -1433,7 +1434,7 @@ static gboolean get_event_coordinates(GdkEvent *event, gint *x, gint *y) { g_return_val_if_fail(event, FALSE); - + switch (event->type) { case GDK_MOTION_NOTIFY: *x = event->motion.x; @@ -1453,12 +1454,12 @@ get_event_coordinates(GdkEvent *event, gint *x, gint *y) } /* get_event_coordinates */ static void -emit_event_on_tags(GnomeCanvasRichText *text, GdkEvent *event, +emit_event_on_tags(GnomeCanvasRichText *text, GdkEvent *event, GtkTextIter *iter) { GSList *tags; GSList *i; - + tags = gtk_text_iter_get_tags(iter); i = tags; @@ -1469,7 +1470,7 @@ emit_event_on_tags(GnomeCanvasRichText *text, GdkEvent *event, /* The cursor has been moved to within this tag. Emit the tag_changed signal */ - if (event->type == GDK_BUTTON_RELEASE || + if (event->type == GDK_BUTTON_RELEASE || event->type == GDK_KEY_PRESS || event->type == GDK_KEY_RELEASE) { gnome_canvas_rich_text_emit_tag_changed( @@ -1486,7 +1487,7 @@ static gint gnome_canvas_rich_text_event(GnomeCanvasItem *item, GdkEvent *event) { GnomeCanvasRichText *text = GNOME_CANVAS_RICH_TEXT(item); - int x, y; + gint x, y; if (get_event_coordinates(event, &x, &y)) { GtkTextIter iter; @@ -1549,7 +1550,7 @@ gnome_canvas_rich_text_event(GnomeCanvasItem *item, GdkEvent *event) /** * gnome_canvas_rich_text_cut_clipboard: * @text: a #GnomeCanvasRichText. - * + * * Copies the currently selected @text to clipboard, then deletes said text * if it's editable. **/ @@ -1564,7 +1565,6 @@ gnome_canvas_rich_text_cut_clipboard(GnomeCanvasRichText *text) text->_priv->editable); } /* gnome_canvas_rich_text_cut_clipboard */ - /** * gnome_canvas_rich_text_copy_clipboard: * @text: a #GnomeCanvasRichText. @@ -1581,7 +1581,6 @@ gnome_canvas_rich_text_copy_clipboard(GnomeCanvasRichText *text) gtk_clipboard_get (GDK_SELECTION_PRIMARY)); } /* gnome_canvas_rich_text_cut_clipboard */ - /** * gnome_canvas_rich_text_paste_clipboard: * @text: a #GnomeCanvasRichText. @@ -1721,12 +1720,12 @@ scale_fonts(GtkTextTag *tag, gpointer data) #endif g_object_set( - G_OBJECT(tag), "scale", + G_OBJECT(tag), "scale", text->_priv->layout->default_style->font_scale, NULL); } /* scale_fonts */ static void -changed_handler(GtkTextLayout *layout, gint start_y, +changed_handler(GtkTextLayout *layout, gint start_y, gint old_height, gint new_height, gpointer data) { GnomeCanvasRichText *text = GNOME_CANVAS_RICH_TEXT(data); @@ -1735,11 +1734,11 @@ changed_handler(GtkTextLayout *layout, gint start_y, printf("Layout %p is being changed.\n", text->_priv->layout); #endif - if (text->_priv->layout->default_style->font_scale != + if (text->_priv->layout->default_style->font_scale != GNOME_CANVAS_ITEM(text)->canvas->pixels_per_unit) { GtkTextTagTable *tag_table; - text->_priv->layout->default_style->font_scale = + text->_priv->layout->default_style->font_scale = GNOME_CANVAS_ITEM(text)->canvas->pixels_per_unit; tag_table = gtk_text_buffer_get_tag_table(get_buffer(text)); @@ -1749,7 +1748,7 @@ changed_handler(GtkTextLayout *layout, gint start_y, } if (text->_priv->grow_height) { - int width, height; + gint width, height; gtk_text_layout_get_size(text->_priv->layout, &width, &height); @@ -1762,16 +1761,15 @@ changed_handler(GtkTextLayout *layout, gint start_y, g_idle_add(request_update, text); } /* changed_handler */ - /** * gnome_canvas_rich_text_set_buffer: * @text: a #GnomeCanvasRichText. * @buffer: a #GtkTextBuffer. * - * Sets the buffer field of the @text to @buffer. - **/ + * Sets the buffer field of the @text to @buffer. + **/ void -gnome_canvas_rich_text_set_buffer(GnomeCanvasRichText *text, +gnome_canvas_rich_text_set_buffer(GnomeCanvasRichText *text, GtkTextBuffer *buffer) { g_return_if_fail(GNOME_IS_CANVAS_RICH_TEXT(text)); @@ -1810,7 +1808,6 @@ get_buffer(GnomeCanvasRichText *text) return text->_priv->buffer; } /* get_buffer */ - /** * gnome_canvas_rich_text_get_buffer: * @text: a #GnomeCanvasRichText. @@ -1828,7 +1825,6 @@ gnome_canvas_rich_text_get_buffer(GnomeCanvasRichText *text) return get_buffer(text); } /* gnome_canvas_rich_text_get_buffer */ - /** * gnome_canvas_rich_text_get_iter_location: * @text: a #GnomeCanvasRichText. @@ -1848,7 +1844,6 @@ gnome_canvas_rich_text_get_iter_location (GnomeCanvasRichText *text, gtk_text_layout_get_iter_location (text->_priv->layout, iter, location); } - /** * gnome_canvas_rich_text_get_iter_at_location: * @text: a #GnomeCanvasRichText. @@ -1856,8 +1851,8 @@ gnome_canvas_rich_text_get_iter_location (GnomeCanvasRichText *text, * @x: x position, in buffer coordinates. * @y: y position, in buffer coordinates. * - * Retrieves the iterator at the buffer coordinates x and y. - **/ + * Retrieves the iterator at the buffer coordinates x and y. + **/ void gnome_canvas_rich_text_get_iter_at_location (GnomeCanvasRichText *text, GtkTextIter *iter, @@ -1874,7 +1869,6 @@ gnome_canvas_rich_text_get_iter_at_location (GnomeCanvasRichText *text, y); } - static void gnome_canvas_rich_text_set_attributes_from_style(GnomeCanvasRichText *text, GtkTextAttributes *values, @@ -1882,7 +1876,7 @@ gnome_canvas_rich_text_set_attributes_from_style(GnomeCanvasRichText *text, { values->appearance.bg_color = style->base[GTK_STATE_NORMAL]; values->appearance.fg_color = style->fg[GTK_STATE_NORMAL]; - + if (values->font) pango_font_description_free (values->font); @@ -1974,9 +1968,9 @@ gnome_canvas_rich_text_destroy_layout(GnomeCanvasRichText *text) } /* gnome_canvas_rich_text_destroy_layout */ static void -adjust_for_anchors(GnomeCanvasRichText *text, double *ax, double *ay) +adjust_for_anchors(GnomeCanvasRichText *text, gdouble *ax, gdouble *ay) { - double x, y; + gdouble x, y; x = text->_priv->x; y = text->_priv->y; @@ -2033,13 +2027,13 @@ adjust_for_anchors(GnomeCanvasRichText *text, double *ax, double *ay) } /* adjust_for_anchors */ static void -get_bounds(GnomeCanvasRichText *text, double *px1, double *py1, - double *px2, double *py2) +get_bounds(GnomeCanvasRichText *text, gdouble *px1, gdouble *py1, + gdouble *px2, gdouble *py2) { GnomeCanvasItem *item = GNOME_CANVAS_ITEM(text); - double x, y; - double x1, x2, y1, y2; - int cx1, cx2, cy1, cy2; + gdouble x, y; + gdouble x1, x2, y1, y2; + gint cx1, cx2, cy1, cy2; adjust_for_anchors(text, &x, &y); @@ -2059,19 +2053,23 @@ get_bounds(GnomeCanvasRichText *text, double *px1, double *py1, *py2 = cy2; } /* get_bounds */ -static void gnome_canvas_rich_text_get_bounds(GnomeCanvasItem *item, double *px1, double *py1, - double *px2, double *py2) +static void +gnome_canvas_rich_text_get_bounds (GnomeCanvasItem *item, + gdouble *px1, + gdouble *py1, + gdouble *px2, + gdouble *py2) { GnomeCanvasRichText *text = GNOME_CANVAS_RICH_TEXT(item); get_bounds (text, px1, py1, px2, py2); } static void -gnome_canvas_rich_text_update(GnomeCanvasItem *item, double *affine, - ArtSVP *clip_path, int flags) +gnome_canvas_rich_text_update(GnomeCanvasItem *item, gdouble *affine, + ArtSVP *clip_path, gint flags) { GnomeCanvasRichText *text = GNOME_CANVAS_RICH_TEXT(item); - double x1, y1, x2, y2; + gdouble x1, y1, x2, y2; GtkTextIter start; (* GNOME_CANVAS_ITEM_CLASS(parent_class)->update)( @@ -2086,15 +2084,15 @@ gnome_canvas_rich_text_update(GnomeCanvasItem *item, double *affine, gnome_canvas_update_bbox(item, x1, y1, x2, y2); } /* gnome_canvas_rich_text_update */ - + static double -gnome_canvas_rich_text_point(GnomeCanvasItem *item, double x, double y, - int cx, int cy, GnomeCanvasItem **actual_item) +gnome_canvas_rich_text_point(GnomeCanvasItem *item, gdouble x, gdouble y, + gint cx, gint cy, GnomeCanvasItem **actual_item) { GnomeCanvasRichText *text = GNOME_CANVAS_RICH_TEXT(item); - double ax, ay; - double x1, x2, y1, y2; - double dx, dy; + gdouble ax, ay; + gdouble x1, x2, y1, y2; + gdouble dx, dy; *actual_item = item; @@ -2129,14 +2127,14 @@ gnome_canvas_rich_text_point(GnomeCanvasItem *item, double x, double y, static void gnome_canvas_rich_text_draw(GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height) + gint x, gint y, gint width, gint height) { GnomeCanvasRichText *text = GNOME_CANVAS_RICH_TEXT(item); GtkStyle *style; GtkWidget *widget; - double i2w[6], w2c[6], i2c[6]; - double ax, ay; - int x1, y1, x2, y2; + gdouble i2w[6], w2c[6], i2c[6]; + gdouble ax, ay; + gint x1, y1, x2, y2; ArtPoint i1, i2; ArtPoint c1, c2; @@ -2182,9 +2180,9 @@ gnome_canvas_rich_text_render(GnomeCanvasItem *item, GnomeCanvasBuf *buf) #if 0 static GtkTextTag * -gnome_canvas_rich_text_add_tag(GnomeCanvasRichText *text, char *tag_name, - int start_offset, int end_offset, - const char *first_property_name, ...) +gnome_canvas_rich_text_add_tag(GnomeCanvasRichText *text, gchar *tag_name, + gint start_offset, gint end_offset, + const gchar *first_property_name, ...) { GtkTextTag *tag; GtkTextIter start, end; diff --git a/libgnomecanvas/gnome-canvas-shape-private.h b/libgnomecanvas/gnome-canvas-shape-private.h index ffdd3ce24b..089b95c9a6 100644 --- a/libgnomecanvas/gnome-canvas-shape-private.h +++ b/libgnomecanvas/gnome-canvas-shape-private.h @@ -80,7 +80,7 @@ struct _GnomeCanvasShapePriv { guint outline_set : 1; /* Is outline color set? */ guint width_pixels : 1; /* Is outline width specified in pixels or units? */ - double width; /* Width of outline, in user coords */ + gdouble width; /* Width of outline, in user coords */ guint32 fill_rgba; /* Fill color, RGBA */ guint32 outline_rgba; /* Outline color, RGBA */ @@ -88,7 +88,7 @@ struct _GnomeCanvasShapePriv { GdkCapStyle cap; /* Cap style for line */ GdkJoinStyle join; /* Join style for line */ ArtWindRule wind; /* Winding rule */ - double miterlimit; /* Miter limit */ + gdouble miterlimit; /* Miter limit */ ArtVpathDash dash; /* Dashing pattern */ diff --git a/libgnomecanvas/gnome-canvas-shape.c b/libgnomecanvas/gnome-canvas-shape.c index b951cbc014..2b606c1e5b 100644 --- a/libgnomecanvas/gnome-canvas-shape.c +++ b/libgnomecanvas/gnome-canvas-shape.c @@ -72,23 +72,23 @@ static void gnome_canvas_shape_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void gnome_canvas_shape_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags); +static void gnome_canvas_shape_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags); static void gnome_canvas_shape_realize (GnomeCanvasItem *item); static void gnome_canvas_shape_unrealize (GnomeCanvasItem *item); static void gnome_canvas_shape_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); -static double gnome_canvas_shape_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, GnomeCanvasItem **actual_item); + gint x, gint y, gint width, gint height); +static gdouble gnome_canvas_shape_point (GnomeCanvasItem *item, gdouble x, gdouble y, + gint cx, gint cy, GnomeCanvasItem **actual_item); static void gnome_canvas_shape_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf); static void gnome_canvas_shape_bounds (GnomeCanvasItem *item, - double *x1, double *y1, double *x2, double *y2); + gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2); static gulong get_pixel_from_rgba (GnomeCanvasItem *item, guint32 rgba_color); static guint32 get_rgba_from_color (GdkColor * color); static void set_gc_foreground (GdkGC *gc, gulong pixel); static void gcbp_ensure_gdk (GnomeCanvasShape * bpath); static void gcbp_destroy_gdk (GnomeCanvasShape * bpath); -static void set_stipple (GdkGC *gc, GdkBitmap **internal_stipple, GdkBitmap *stipple, int reconfigure); +static void set_stipple (GdkGC *gc, GdkBitmap **internal_stipple, GdkBitmap *stipple, gint reconfigure); static void gcbp_ensure_mask (GnomeCanvasShape * bpath, gint width, gint height); static void gcbp_draw_ctx_unref (GCBPDrawCtx * ctx); @@ -140,8 +140,6 @@ gnome_canvas_shape_class_init (GnomeCanvasShapeClass *class) gobject_class->set_property = gnome_canvas_shape_set_property; gobject_class->get_property = gnome_canvas_shape_get_property; - - g_object_class_install_property (gobject_class, PROP_FILL_COLOR, g_param_spec_string ("fill_color", NULL, NULL, @@ -282,9 +280,9 @@ gnome_canvas_shape_destroy (GtkObject *object) if (priv->dash.dash) g_free (priv->dash.dash); if (priv->fill_svp) art_svp_free (priv->fill_svp); if (priv->outline_svp) art_svp_free (priv->outline_svp); - + g_free (shape->priv); - shape->priv = NULL; + shape->priv = NULL; } if (GTK_OBJECT_CLASS (parent_class)->destroy) @@ -294,16 +292,16 @@ gnome_canvas_shape_destroy (GtkObject *object) /** * gnome_canvas_shape_set_path_def: * @shape: a GnomeCanvasShape - * @def: a GnomeCanvasPathDef + * @def: a GnomeCanvasPathDef * * This function sets the the GnomeCanvasPathDef used by the * GnomeCanvasShape. Notice, that it does not request updates, as * it is meant to be used from item implementations, from inside * update queue. */ - + void -gnome_canvas_shape_set_path_def (GnomeCanvasShape *shape, GnomeCanvasPathDef *def) +gnome_canvas_shape_set_path_def (GnomeCanvasShape *shape, GnomeCanvasPathDef *def) { GnomeCanvasShapePriv *priv; @@ -470,7 +468,7 @@ gnome_canvas_shape_set_property (GObject *object, priv->join = g_value_get_enum (value); gnome_canvas_item_request_update (item); break; - + case PROP_MITERLIMIT: priv->miterlimit = g_value_get_double (value); gnome_canvas_item_request_update (item); @@ -486,7 +484,7 @@ gnome_canvas_shape_set_property (GObject *object, priv->dash.n_dash = dash->n_dash; if (dash->dash != NULL) { priv->dash.dash = g_new (double, dash->n_dash); - memcpy (priv->dash.dash, dash->dash, dash->n_dash * sizeof (double)); + memcpy (priv->dash.dash, dash->dash, dash->n_dash * sizeof (gdouble)); } } gnome_canvas_item_request_update (item); @@ -498,7 +496,7 @@ gnome_canvas_shape_set_property (GObject *object, } /* Allocates a GdkColor structure filled with the specified pixel, and - * puts it into the specified value for returning it in the get_property + * puts it into the specified value for returning it in the get_property * method. */ @@ -524,12 +522,12 @@ get_color_value (GnomeCanvasShape *shape, gulong pixel, GValue *value) * * Returns: a #GnomeCanvasPathDef or NULL if none is set for the shape. */ - + GnomeCanvasPathDef * gnome_canvas_shape_get_path_def (GnomeCanvasShape *shape) { GnomeCanvasShapePriv *priv; - + g_return_val_if_fail (shape != NULL, NULL); g_return_val_if_fail (GNOME_IS_CANVAS_SHAPE (shape), NULL); @@ -539,7 +537,7 @@ gnome_canvas_shape_get_path_def (GnomeCanvasShape *shape) gnome_canvas_path_def_ref (priv->path); return priv->path; } - + return NULL; } @@ -570,7 +568,7 @@ gnome_canvas_shape_get_property (GObject *object, get_color_value (shape, 0, value); } break; - + case PROP_OUTLINE_COLOR_GDK: if (gdk) { get_color_value (shape, gdk->outline_pixel, value); @@ -630,7 +628,7 @@ gnome_canvas_shape_get_property (GObject *object, case PROP_DASH: g_value_set_pointer (value, &priv->dash); break; - + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); break; @@ -706,10 +704,10 @@ gnome_canvas_shape_render (GnomeCanvasItem *item, static void gnome_canvas_shape_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, - int y, - int width, - int height) + gint x, + gint y, + gint width, + gint height) { static GdkPoint * dpoints = NULL; static gint num_dpoints = 0; @@ -836,14 +834,14 @@ gnome_canvas_shape_ensure_gdk_points (GnomeCanvasShapePrivGdk *gdk, gint num) } static void -gnome_canvas_shape_update_gdk (GnomeCanvasShape * shape, double * affine, ArtSVP * clip, int flags) +gnome_canvas_shape_update_gdk (GnomeCanvasShape * shape, gdouble * affine, ArtSVP * clip, gint flags) { GnomeCanvasShapePriv * priv; GnomeCanvasShapePrivGdk * gdk; - int x1 = 0, y1 = 0, x2 = 0, y2 = 0; + gint x1 = 0, y1 = 0, x2 = 0, y2 = 0; gboolean bbox_set = FALSE; gint width = 0; /* silence gcc */ - + g_assert (!((GnomeCanvasItem *) shape)->canvas->aa); priv = shape->priv; @@ -854,14 +852,14 @@ gnome_canvas_shape_update_gdk (GnomeCanvasShape * shape, double * affine, ArtSVP GdkLineStyle style; if (priv->width_pixels) { - width = (int) floor (priv->width + 0.5); + width = (gint) floor (priv->width + 0.5); /* Never select 0 pixels unless the user asked for it, * since that is the X11 zero width lines are non-specified */ if (priv->width_pixels != 0 && width == 0) { width = 1; } } else { - width = (int) floor ((priv->width * priv->scale) + 0.5); + width = (gint) floor ((priv->width * priv->scale) + 0.5); /* Never select 0 pixels unless the user asked for it, * since that is the X11 zero width lines are non-speciifed */ if (priv->width != 0 && width == 0) { @@ -894,14 +892,14 @@ gnome_canvas_shape_update_gdk (GnomeCanvasShape * shape, double * affine, ArtSVP } /* Set line width, cap, join */ - if(gdk->outline_gc) { - + if (gdk->outline_gc) { + gdk_gc_set_line_attributes (gdk->outline_gc, width, style, priv->cap, priv->join); - + /* Colors and stipples */ set_gc_foreground (gdk->outline_gc, gdk->outline_pixel); set_stipple (gdk->outline_gc, &gdk->outline_stipple, gdk->outline_stipple, TRUE); @@ -911,7 +909,7 @@ gnome_canvas_shape_update_gdk (GnomeCanvasShape * shape, double * affine, ArtSVP if (priv->fill_set) { /* Colors and stipples */ - if(gdk->fill_gc) { + if (gdk->fill_gc) { set_gc_foreground (gdk->fill_gc, gdk->fill_pixel); set_stipple (gdk->fill_gc, &gdk->fill_stipple, gdk->fill_stipple, TRUE); } @@ -978,7 +976,7 @@ gnome_canvas_shape_update_gdk (GnomeCanvasShape * shape, double * affine, ArtSVP path = (GnomeCanvasPathDef *) clist->data; bpath = gnome_canvas_path_def_bpath (path); vpath = art_bez_path_to_vec (bpath, 0.1); - for (len = 0; vpath[len].code != ART_END; len++) ; + for (len = 0; vpath[len].code != ART_END; len++); gnome_canvas_shape_ensure_gdk_points (gdk, len); for (i = 0; i < len; i++) { @@ -1020,13 +1018,13 @@ gnome_canvas_shape_update_gdk (GnomeCanvasShape * shape, double * affine, ArtSVP path = (GnomeCanvasPathDef *) olist->data; bpath = gnome_canvas_path_def_bpath (path); vpath = art_bez_path_to_vec (bpath, 0.1); - for (len = 0; vpath[len].code != ART_END; len++) ; + for (len = 0; vpath[len].code != ART_END; len++); gnome_canvas_shape_ensure_gdk_points (gdk, len); for (i = 0; i < len; i++) { gdk->points[pos + i].x = (gint) floor (vpath[i].x + 0.5); gdk->points[pos + i].y = (gint) floor (vpath[i].y + 0.5); - + if (bbox_set) { x1 = MIN (x1, gdk->points[pos + i].x); x2 = MAX (x2, gdk->points[pos + i].x); @@ -1055,7 +1053,7 @@ gnome_canvas_shape_update_gdk (GnomeCanvasShape * shape, double * affine, ArtSVP if (bbox_set) { if (priv->outline_set) { - int stroke_border = (priv->join == GDK_JOIN_MITER) + gint stroke_border = (priv->join == GDK_JOIN_MITER) ? ceil (10.43*width/2) /* 10.43 is the miter limit for X11 */ : ceil (width/2); x1 -= stroke_border; @@ -1063,16 +1061,16 @@ gnome_canvas_shape_update_gdk (GnomeCanvasShape * shape, double * affine, ArtSVP y1 -= stroke_border; y2 += stroke_border; } - + gnome_canvas_update_bbox (GNOME_CANVAS_ITEM (shape), x1, y1, x2 + 1, y2 + 1); } - + } static void -gnome_canvas_shape_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +gnome_canvas_shape_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags) { GnomeCanvasShape * shape; GnomeCanvasShapePriv * priv; @@ -1094,7 +1092,7 @@ gnome_canvas_shape_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_p if (item->canvas->aa) { gnome_canvas_item_reset_bounds (item); } - + /* Clipped fill SVP */ if ((priv->fill_set) && (priv->path) && (gnome_canvas_path_def_any_closed (priv->path))) { @@ -1152,9 +1150,9 @@ gnome_canvas_shape_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_p } else { width = priv->width * priv->scale; } - + if (width < 0.5) width = 0.5; - + /* Render full path until vpath */ abp = art_bpath_affine_transform (gnome_canvas_path_def_bpath (priv->path), affine); @@ -1167,11 +1165,11 @@ gnome_canvas_shape_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_p if (priv->dash.dash != NULL) { ArtVpath *old = vpath; - + vpath = art_vpath_dash (old, &priv->dash); art_free (old); } - + /* Stroke vpath to SVP */ svp = art_svp_vpath_stroke (vpath, @@ -1196,19 +1194,19 @@ gnome_canvas_shape_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_p } /* Gdk requires additional handling */ - + if (!item->canvas->aa) { gnome_canvas_shape_update_gdk (shape, affine, clip_path, flags); } } static double -gnome_canvas_shape_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, GnomeCanvasItem **actual_item) +gnome_canvas_shape_point (GnomeCanvasItem *item, gdouble x, gdouble y, + gint cx, gint cy, GnomeCanvasItem **actual_item) { GnomeCanvasShape *shape; - double dist; - int wind; + gdouble dist; + gint wind; #if 0 /* fixme: This is just for debugging, canvas should ensure that */ @@ -1288,7 +1286,7 @@ set_gc_foreground (GdkGC *gc, gulong pixel) /* Sets the stipple pattern for the specified gc */ static void -set_stipple (GdkGC *gc, GdkBitmap **internal_stipple, GdkBitmap *stipple, int reconfigure) +set_stipple (GdkGC *gc, GdkBitmap **internal_stipple, GdkBitmap *stipple, gint reconfigure) { if (*internal_stipple && !reconfigure) g_object_unref (*internal_stipple); @@ -1471,14 +1469,14 @@ gcbp_draw_ctx_unref (GCBPDrawCtx * ctx) g_object_unref (ctx->mask); if (ctx->clip) g_object_unref (ctx->clip); - + g_object_set_data (G_OBJECT (ctx->canvas), "BpathDrawCtx", NULL); g_free (ctx); } } static void -gnome_canvas_shape_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) +gnome_canvas_shape_bounds (GnomeCanvasItem *item, gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2) { GnomeCanvasShape * shape; GnomeCanvasShapePriv * priv; @@ -1505,9 +1503,9 @@ gnome_canvas_shape_bounds (GnomeCanvasItem *item, double *x1, double *y1, double } else { width = priv->width * priv->scale; } - + if (width < 0.5) width = 0.5; - + /* Render full path until vpath */ vpath = art_bez_path_to_vec (gnome_canvas_path_def_bpath (priv->path), 0.1); @@ -1517,11 +1515,11 @@ gnome_canvas_shape_bounds (GnomeCanvasItem *item, double *x1, double *y1, double if (priv->dash.dash != NULL) { ArtVpath *old = vpath; - + vpath = art_vpath_dash (old, &priv->dash); art_free (old); } - + /* Stroke vpath to SVP */ svp = art_svp_vpath_stroke (vpath, @@ -1547,13 +1545,13 @@ gnome_canvas_shape_bounds (GnomeCanvasItem *item, double *x1, double *y1, double svp = art_svp_from_vpath (vpath); art_free (vpath); - + swr = art_svp_writer_rewind_new (shape->priv->wind); art_svp_intersector (svp, swr); - + svp2 = art_svp_writer_rewind_reap (swr); art_svp_free (svp); - + art_drect_svp (&bbox, svp2); art_svp_free (svp2); } diff --git a/libgnomecanvas/gnome-canvas-shape.h b/libgnomecanvas/gnome-canvas-shape.h index b91578ba6b..5defd38ca4 100644 --- a/libgnomecanvas/gnome-canvas-shape.h +++ b/libgnomecanvas/gnome-canvas-shape.h @@ -19,7 +19,6 @@ G_BEGIN_DECLS - /* Shape item for the canvas. * * The following object arguments are available: @@ -36,13 +35,13 @@ G_BEGIN_DECLS * outline_stipple GdkBitmap* RW Stipple pattern for outline * width_pixels uint RW Width of the outline in pixels. The outline will * not be scaled when the canvas zoom factor is changed. - * width_units double RW Width of the outline in canvas units. The outline + * width_units gdouble RW Width of the outline in canvas units. The outline * will be scaled when the canvas zoom factor is changed. * cap_style GdkCapStyle RW Cap ("endpoint") style for the bpath. * join_style GdkJoinStyle RW Join ("vertex") style for the bpath. * wind ArtWindRule RW Winding rule for the bpath. * dash ArtVpathDash RW Dashing pattern - * miterlimit double RW Minimum angle between segments, where miter join + * miterlimit gdouble RW Minimum angle between segments, where miter join * rule is applied. */ @@ -52,7 +51,6 @@ G_BEGIN_DECLS #define GNOME_IS_CANVAS_SHAPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_CANVAS_SHAPE)) #define GNOME_IS_CANVAS_SHAPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_SHAPE)) - typedef struct _GnomeCanvasShape GnomeCanvasShape; typedef struct _GnomeCanvasShapePriv GnomeCanvasShapePriv; typedef struct _GnomeCanvasShapeClass GnomeCanvasShapeClass; @@ -67,7 +65,6 @@ struct _GnomeCanvasShapeClass { GnomeCanvasItemClass parent_class; }; - /* WARNING! These are not usable from modifying shapes from user programs */ /* These are meant, to set master shape from subclass ::update method */ void gnome_canvas_shape_set_path_def (GnomeCanvasShape *shape, GnomeCanvasPathDef *def); diff --git a/libgnomecanvas/gnome-canvas-text.c b/libgnomecanvas/gnome-canvas-text.c index d54dee84ba..f1d0238099 100644 --- a/libgnomecanvas/gnome-canvas-text.c +++ b/libgnomecanvas/gnome-canvas-text.c @@ -64,7 +64,7 @@ enum { PROP_FONT, PROP_FONT_DESC, PROP_FAMILY, PROP_FAMILY_SET, - + /* Style */ PROP_ATTRIBUTES, PROP_STYLE, PROP_STYLE_SET, @@ -103,7 +103,6 @@ struct _GnomeCanvasTextPrivate { FT_Bitmap bitmap; }; - static void gnome_canvas_text_class_init (GnomeCanvasTextClass *class); static void gnome_canvas_text_init (GnomeCanvasText *text); static void gnome_canvas_text_destroy (GtkObject *object); @@ -116,23 +115,27 @@ static void gnome_canvas_text_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void gnome_canvas_text_update (GnomeCanvasItem *item, double *affine, - ArtSVP *clip_path, int flags); +static void gnome_canvas_text_update (GnomeCanvasItem *item, gdouble *affine, + ArtSVP *clip_path, gint flags); static void gnome_canvas_text_realize (GnomeCanvasItem *item); static void gnome_canvas_text_unrealize (GnomeCanvasItem *item); static void gnome_canvas_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); -static double gnome_canvas_text_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, + gint x, gint y, gint width, gint height); +static gdouble gnome_canvas_text_point (GnomeCanvasItem *item, + gdouble x, + gdouble y, + gint cx, + gint cy, GnomeCanvasItem **actual_item); static void gnome_canvas_text_bounds (GnomeCanvasItem *item, - double *x1, double *y1, double *x2, double *y2); + gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2); static void gnome_canvas_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf); static void gnome_canvas_text_set_markup (GnomeCanvasText *textitem, const gchar *markup); static void gnome_canvas_text_set_font_desc (GnomeCanvasText *textitem, - PangoFontDescription *font_desc); + PangoFontDescription *font_desc); static void gnome_canvas_text_apply_font_desc (GnomeCanvasText *textitem); static void gnome_canvas_text_apply_attributes (GnomeCanvasText *textitem); @@ -146,11 +149,11 @@ static GnomeCanvasItemClass *parent_class; /** * gnome_canvas_text_get_type: - * @void: - * + * @void: + * * Registers the &GnomeCanvasText class if necessary, and returns the type ID * associated to it. - * + * * Return value: The type ID of the &GnomeCanvasText class. **/ GType @@ -230,7 +233,6 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - /* Font */ g_object_class_install_property (gobject_class, @@ -240,7 +242,7 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) "Font description as a string", NULL, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_FONT_DESC, @@ -258,7 +260,7 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) "Name of the font family, e.g. Sans, Helvetica, Times, Monospace", NULL, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + /* Style */ g_object_class_install_property (gobject_class, @@ -266,7 +268,7 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) g_param_spec_boxed ("attributes", NULL, NULL, PANGO_TYPE_ATTR_LIST, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_STYLE, @@ -276,7 +278,7 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) PANGO_TYPE_STYLE, PANGO_STYLE_NORMAL, G_PARAM_READABLE | G_PARAM_WRITABLE)); - + g_object_class_install_property (gobject_class, PROP_VARIANT, @@ -286,7 +288,7 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) PANGO_TYPE_VARIANT, PANGO_VARIANT_NORMAL, G_PARAM_READABLE | G_PARAM_WRITABLE)); - + g_object_class_install_property (gobject_class, PROP_WEIGHT, @@ -297,8 +299,7 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) G_MAXINT, PANGO_WEIGHT_NORMAL, G_PARAM_READABLE | G_PARAM_WRITABLE)); - - + g_object_class_install_property (gobject_class, PROP_STRETCH, @@ -308,18 +309,19 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) PANGO_TYPE_STRETCH, PANGO_STRETCH_NORMAL, G_PARAM_READABLE | G_PARAM_WRITABLE)); - + g_object_class_install_property (gobject_class, PROP_SIZE, g_param_spec_int ("size", "Font size", - "Font size (as a multiple of PANGO_SCALE, eg. 12*PANGO_SCALE for a 12pt font size)", + "Font size (as a multiple of PANGO_SCALE, " + "eg. 12*PANGO_SCALE for a 12pt font size)", 0, G_MAXINT, 0, G_PARAM_READABLE | G_PARAM_WRITABLE)); - + g_object_class_install_property (gobject_class, PROP_SIZE_POINTS, @@ -329,8 +331,8 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READABLE | G_PARAM_WRITABLE)); - + G_PARAM_READABLE | G_PARAM_WRITABLE)); + g_object_class_install_property (gobject_class, PROP_RISE, @@ -341,7 +343,7 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) G_MAXINT, 0, G_PARAM_READABLE | G_PARAM_WRITABLE)); - + g_object_class_install_property (gobject_class, PROP_STRIKETHROUGH, @@ -350,7 +352,7 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) "Whether to strike through the text", FALSE, G_PARAM_READABLE | G_PARAM_WRITABLE)); - + g_object_class_install_property (gobject_class, PROP_UNDERLINE, @@ -370,8 +372,8 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) 0.0, G_MAXDOUBLE, 1.0, - G_PARAM_READABLE | G_PARAM_WRITABLE)); - + G_PARAM_READABLE | G_PARAM_WRITABLE)); + g_object_class_install_property (gobject_class, PROP_ANCHOR, @@ -464,40 +466,43 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) G_PARAM_READABLE)); /* Style props are set (explicitly applied) or not */ -#define ADD_SET_PROP(propname, propval, nick, blurb) g_object_class_install_property (gobject_class, propval, g_param_spec_boolean (propname, nick, blurb, FALSE, G_PARAM_READABLE | G_PARAM_WRITABLE)) +#define ADD_SET_PROP(propname, propval, nick, blurb) \ + g_object_class_install_property ( \ + gobject_class, propval, g_param_spec_boolean ( \ + propname, nick, blurb, FALSE, G_PARAM_READABLE | G_PARAM_WRITABLE)) ADD_SET_PROP ("family_set", PROP_FAMILY_SET, "Font family set", - "Whether this tag affects the font family"); - + "Whether this tag affects the font family"); + ADD_SET_PROP ("style_set", PROP_STYLE_SET, "Font style set", "Whether this tag affects the font style"); - + ADD_SET_PROP ("variant_set", PROP_VARIANT_SET, "Font variant set", "Whether this tag affects the font variant"); - + ADD_SET_PROP ("weight_set", PROP_WEIGHT_SET, "Font weight set", "Whether this tag affects the font weight"); - + ADD_SET_PROP ("stretch_set", PROP_STRETCH_SET, "Font stretch set", "Whether this tag affects the font stretch"); - + ADD_SET_PROP ("size_set", PROP_SIZE_SET, "Font size set", "Whether this tag affects the font size"); - + ADD_SET_PROP ("rise_set", PROP_RISE_SET, "Rise set", "Whether this tag affects the rise"); - + ADD_SET_PROP ("strikethrough_set", PROP_STRIKETHROUGH_SET, "Strikethrough set", "Whether this tag affects strikethrough"); - + ADD_SET_PROP ("underline_set", PROP_UNDERLINE_SET, "Underline set", "Whether this tag affects underlining"); @@ -506,7 +511,7 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) "Scale set", "Whether this tag affects font scaling"); #undef ADD_SET_PROP - + object_class->destroy = gnome_canvas_text_destroy; item_class->update = gnome_canvas_text_update; @@ -533,15 +538,15 @@ gnome_canvas_text_init (GnomeCanvasText *text) text->layout = NULL; text->font_desc = NULL; - + text->underline = PANGO_UNDERLINE_NONE; text->strikethrough = FALSE; text->rise = 0; - + text->underline_set = FALSE; text->strike_set = FALSE; text->rise_set = FALSE; - + text->priv = g_new (GnomeCanvasTextPrivate, 1); text->priv->bitmap.buffer = NULL; text->priv->render_dirty = 1; @@ -565,7 +570,7 @@ gnome_canvas_text_destroy (GtkObject *object) if (text->layout) g_object_unref (G_OBJECT (text->layout)); text->layout = NULL; - + if (text->font_desc) { pango_font_description_free (text->font_desc); text->font_desc = NULL; @@ -574,36 +579,41 @@ gnome_canvas_text_destroy (GtkObject *object) if (text->attr_list) pango_attr_list_unref (text->attr_list); text->attr_list = NULL; - + if (text->stipple) g_object_unref (text->stipple); text->stipple = NULL; if (text->priv && text->priv->bitmap.buffer) { - g_free (text->priv->bitmap.buffer); + g_free (text->priv->bitmap.buffer); } g_free (text->priv); text->priv = NULL; - + if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } static void -get_bounds (GnomeCanvasText *text, double *px1, double *py1, double *px2, double *py2) +get_bounds (GnomeCanvasText *text, + gdouble *px1, + gdouble *py1, + gdouble *px2, + gdouble *py2) { GnomeCanvasItem *item; - double wx, wy; + gdouble wx, wy; item = GNOME_CANVAS_ITEM (text); /* Get canvas pixel coordinates for text position */ - wx = text->x; wy = text->y; gnome_canvas_item_i2w (item, &wx, &wy); - gnome_canvas_w2c (item->canvas, wx + text->xofs, wy + text->yofs, &text->cx, &text->cy); + gnome_canvas_w2c ( + item->canvas, wx + text->xofs, wy + text->yofs, + &text->cx, &text->cy); /* Get canvas pixel coordinates for clip rectangle position */ @@ -691,7 +701,7 @@ set_text_gc_foreground (GnomeCanvasText *text) /* Sets the stipple pattern for the text */ static void -set_stipple (GnomeCanvasText *text, GdkBitmap *stipple, int reconfigure) +set_stipple (GnomeCanvasText *text, GdkBitmap *stipple, gint reconfigure) { if (text->stipple && !reconfigure) g_object_unref (text->stipple); @@ -750,7 +760,7 @@ gnome_canvas_text_set_property (GObject *object, GdkColor color = { 0, 0, 0, 0, }; GdkColor *pcolor; gboolean color_changed; - int have_pixel; + gint have_pixel; PangoAlignment align; g_return_if_fail (object != NULL); @@ -761,27 +771,26 @@ gnome_canvas_text_set_property (GObject *object, color_changed = FALSE; have_pixel = FALSE; - if (!text->layout) { - PangoContext *gtk_context, *context; + PangoContext *gtk_context, *context; gtk_context = gtk_widget_get_pango_context (GTK_WIDGET (item->canvas)); - - if (item->canvas->aa) { + + if (item->canvas->aa) { PangoFontMap *fontmap; PangoLanguage *language; gint pixels, mm; - double dpi_x; - double dpi_y; - + gdouble dpi_x; + gdouble dpi_y; + pixels = gdk_screen_width (); mm = gdk_screen_width_mm (); - dpi_x = (((double) pixels * 25.4) / (double) mm); - + dpi_x = (((gdouble) pixels * 25.4) / (gdouble) mm); + pixels = gdk_screen_height (); mm = gdk_screen_height_mm (); - dpi_y = (((double) pixels * 25.4) / (double) mm); + dpi_y = (((gdouble) pixels * 25.4) / (gdouble) mm); /* XXX This used to call pango_ft2_get_context(). * Is there a better way to do this? */ @@ -795,15 +804,14 @@ gnome_canvas_text_set_property (GObject *object, pango_context_get_base_dir (gtk_context)); pango_context_set_font_description (context, pango_context_get_font_description (gtk_context)); - + } else context = gtk_context; - text->layout = pango_layout_new (context); - - if (item->canvas->aa) - g_object_unref (G_OBJECT (context)); + + if (item->canvas->aa) + g_object_unref (G_OBJECT (context)); } switch (param_id) { @@ -831,7 +839,7 @@ gnome_canvas_text_set_property (GObject *object, break; case PROP_FONT: { - const char *font_name; + const gchar *font_name; PangoFontDescription *font_desc; font_name = g_value_get_string (value); @@ -839,7 +847,7 @@ gnome_canvas_text_set_property (GObject *object, font_desc = pango_font_description_from_string (font_name); else font_desc = NULL; - + gnome_canvas_text_set_font_desc (text, font_desc); if (font_desc) pango_font_description_free (font_desc); @@ -891,7 +899,7 @@ gnome_canvas_text_set_property (GObject *object, g_value_get_double (value) * PANGO_SCALE); break; } - + gnome_canvas_text_apply_font_desc (text); text->priv->render_dirty = 1; break; @@ -910,29 +918,29 @@ gnome_canvas_text_set_property (GObject *object, case PROP_SCALE: text->scale = g_value_get_double (value); text->scale_set = TRUE; - + gnome_canvas_text_apply_font_desc (text); text->priv->render_dirty = 1; break; - + case PROP_SCALE_SET: text->scale_set = g_value_get_boolean (value); - + gnome_canvas_text_apply_font_desc (text); text->priv->render_dirty = 1; - break; - + break; + case PROP_UNDERLINE: text->underline = g_value_get_enum (value); text->underline_set = TRUE; - + gnome_canvas_text_apply_attributes (text); text->priv->render_dirty = 1; break; case PROP_UNDERLINE_SET: text->underline_set = g_value_get_boolean (value); - + gnome_canvas_text_apply_attributes (text); text->priv->render_dirty = 1; break; @@ -940,14 +948,14 @@ gnome_canvas_text_set_property (GObject *object, case PROP_STRIKETHROUGH: text->strikethrough = g_value_get_boolean (value); text->strike_set = TRUE; - + gnome_canvas_text_apply_attributes (text); text->priv->render_dirty = 1; break; case PROP_STRIKETHROUGH_SET: text->strike_set = g_value_get_boolean (value); - + gnome_canvas_text_apply_attributes (text); text->priv->render_dirty = 1; break; @@ -955,14 +963,14 @@ gnome_canvas_text_set_property (GObject *object, case PROP_RISE: text->rise = g_value_get_int (value); text->rise_set = TRUE; - + gnome_canvas_text_apply_attributes (text); text->priv->render_dirty = 1; break; case PROP_RISE_SET: text->rise_set = TRUE; - + gnome_canvas_text_apply_attributes (text); text->priv->render_dirty = 1; break; @@ -973,7 +981,7 @@ gnome_canvas_text_set_property (GObject *object, text->attr_list = g_value_peek_pointer (value); pango_attr_list_ref (text->attr_list); - + gnome_canvas_text_apply_attributes (text); text->priv->render_dirty = 1; break; @@ -987,31 +995,31 @@ gnome_canvas_text_set_property (GObject *object, switch (text->justification) { case GTK_JUSTIFY_LEFT: - align = PANGO_ALIGN_LEFT; + align = PANGO_ALIGN_LEFT; break; case GTK_JUSTIFY_CENTER: - align = PANGO_ALIGN_CENTER; + align = PANGO_ALIGN_CENTER; break; case GTK_JUSTIFY_RIGHT: - align = PANGO_ALIGN_RIGHT; + align = PANGO_ALIGN_RIGHT; break; default: - /* GTK_JUSTIFY_FILL isn't supported yet. */ - align = PANGO_ALIGN_LEFT; + /* GTK_JUSTIFY_FILL isn't supported yet. */ + align = PANGO_ALIGN_LEFT; break; - } + } pango_layout_set_alignment (text->layout, align); - text->priv->render_dirty = 1; + text->priv->render_dirty = 1; break; case PROP_CLIP_WIDTH: text->clip_width = fabs (g_value_get_double (value)); - text->priv->render_dirty = 1; + text->priv->render_dirty = 1; break; case PROP_CLIP_HEIGHT: text->clip_height = fabs (g_value_get_double (value)); - text->priv->render_dirty = 1; + text->priv->render_dirty = 1; break; case PROP_CLIP: @@ -1028,7 +1036,7 @@ gnome_canvas_text_set_property (GObject *object, break; case PROP_FILL_COLOR: { - const char *color_name; + const gchar *color_name; color_name = g_value_get_string (value); if (color_name) { @@ -1090,14 +1098,14 @@ gnome_canvas_text_set_property (GObject *object, /* Calculate text dimensions */ if (text->layout) - pango_layout_get_pixel_size (text->layout, + pango_layout_get_pixel_size (text->layout, &text->max_width, &text->height); else { text->max_width = 0; text->height = 0; } - + gnome_canvas_item_request_update (item); } @@ -1138,7 +1146,7 @@ gnome_canvas_text_get_property (GObject *object, case PROP_SIZE: case PROP_SIZE_POINTS: ensure_font (text); - + switch (param_id) { case PROP_FONT: { @@ -1146,14 +1154,14 @@ gnome_canvas_text_get_property (GObject *object, * here, we could just hand off string ownership */ gchar *str; - + str = pango_font_description_to_string (text->font_desc); g_value_set_string (value, str); g_free (str); break; } - + case PROP_FONT_DESC: g_value_set_boxed (value, text->font_desc); break; @@ -1161,29 +1169,32 @@ gnome_canvas_text_get_property (GObject *object, case PROP_FAMILY: g_value_set_string (value, pango_font_description_get_family (text->font_desc)); break; - + case PROP_STYLE: g_value_set_enum (value, pango_font_description_get_style (text->font_desc)); break; - + case PROP_VARIANT: g_value_set_enum (value, pango_font_description_get_variant (text->font_desc)); break; - + case PROP_WEIGHT: g_value_set_int (value, pango_font_description_get_weight (text->font_desc)); break; - + case PROP_STRETCH: g_value_set_enum (value, pango_font_description_get_stretch (text->font_desc)); break; - + case PROP_SIZE: g_value_set_int (value, pango_font_description_get_size (text->font_desc)); break; - + case PROP_SIZE_POINTS: - g_value_set_double (value, ((double)pango_font_description_get_size (text->font_desc)) / (double)PANGO_SCALE); + g_value_set_double ( + value, ((gdouble) + pango_font_description_get_size (text->font_desc)) / + (gdouble)PANGO_SCALE); break; } break; @@ -1195,7 +1206,8 @@ gnome_canvas_text_get_property (GObject *object, case PROP_STRETCH_SET: case PROP_SIZE_SET: { - PangoFontMask set_mask = text->font_desc ? pango_font_description_get_set_fields (text->font_desc) : 0; + PangoFontMask set_mask = text->font_desc ? + pango_font_description_get_set_fields (text->font_desc) : 0; PangoFontMask test_mask = get_property_font_set_mask (param_id); g_value_set_boolean (value, (set_mask & test_mask) != 0); @@ -1208,28 +1220,28 @@ gnome_canvas_text_get_property (GObject *object, case PROP_SCALE_SET: g_value_set_boolean (value, text->scale_set); break; - + case PROP_UNDERLINE: g_value_set_enum (value, text->underline); break; case PROP_UNDERLINE_SET: g_value_set_boolean (value, text->underline_set); break; - + case PROP_STRIKETHROUGH: g_value_set_boolean (value, text->strikethrough); break; case PROP_STRIKETHROUGH_SET: g_value_set_boolean (value, text->strike_set); break; - + case PROP_RISE: g_value_set_int (value, text->rise); break; case PROP_RISE_SET: g_value_set_boolean (value, text->rise_set); break; - + case PROP_ATTRIBUTES: g_value_set_boxed (value, text->attr_list); break; @@ -1340,14 +1352,14 @@ gnome_canvas_text_apply_attributes (GnomeCanvasText *text) attr_list = pango_attr_list_copy (text->attr_list); else attr_list = pango_attr_list_new (); - + if (text->underline_set) add_attr (attr_list, pango_attr_underline_new (text->underline)); if (text->strike_set) add_attr (attr_list, pango_attr_strikethrough_new (text->strikethrough)); if (text->rise_set) add_attr (attr_list, pango_attr_rise_new (text->rise)); - + pango_layout_set_attributes (text->layout, attr_list); pango_attr_list_unref (attr_list); } @@ -1402,10 +1414,13 @@ gnome_canvas_text_set_markup (GnomeCanvasText *textitem, /* Update handler for the text item */ static void -gnome_canvas_text_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +gnome_canvas_text_update (GnomeCanvasItem *item, + gdouble *affine, + ArtSVP *clip_path, + gint flags) { GnomeCanvasText *text; - double x1, y1, x2, y2; + gdouble x1, y1, x2, y2; text = GNOME_CANVAS_TEXT (item); @@ -1458,7 +1473,7 @@ gnome_canvas_text_unrealize (GnomeCanvasItem *item) /* Draw handler for the text item */ static void gnome_canvas_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height) + gint x, gint y, gint width, gint height) { GnomeCanvasText *text; GdkRectangle rect; @@ -1480,29 +1495,27 @@ gnome_canvas_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, if (text->stipple) gnome_canvas_set_stipple_origin (item->canvas, text->gc); - gdk_draw_layout (drawable, text->gc, text->cx - x, text->cy - y, text->layout); if (text->clip) gdk_gc_set_clip_rectangle (text->gc, NULL); } - /* Render handler for the text item */ static void gnome_canvas_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) { GnomeCanvasText *text; guint32 fg_color; - int render_x = 0, render_y = 0; /* offsets for text rendering, + gint render_x = 0, render_y = 0; /* offsets for text rendering, * for clipping rectangles */ - int x, y; - int w, h; + gint x, y; + gint w, h; guchar *dst, *src; - int src_dx, src_dy; - int i, alpha; - int bm_rows, bm_width; - + gint src_dx, src_dy; + gint i, alpha; + gint bm_rows, bm_width; + text = GNOME_CANVAS_TEXT (item); if (!text->text) @@ -1514,16 +1527,17 @@ gnome_canvas_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) bm_rows = (text->clip) ? text->clip_cheight : text->height; bm_width = (text->clip) ? text->clip_cwidth : text->max_width; - if(text->priv->render_dirty || + if (text->priv->render_dirty || bm_rows != text->priv->bitmap.rows || - bm_width != text->priv->bitmap.width) { - if(text->priv->bitmap.buffer) { + bm_width != text->priv->bitmap.width) { + if (text->priv->bitmap.buffer) { g_free(text->priv->bitmap.buffer); } text->priv->bitmap.rows = bm_rows; text->priv->bitmap.width = bm_width; text->priv->bitmap.pitch = (text->priv->bitmap.width+3)&~3; - text->priv->bitmap.buffer = g_malloc0 (text->priv->bitmap.rows * text->priv->bitmap.pitch); + text->priv->bitmap.buffer = g_malloc0 ( + text->priv->bitmap.rows * text->priv->bitmap.pitch); text->priv->bitmap.num_grays = 256; text->priv->bitmap.pixel_mode = ft_pixel_mode_grays; @@ -1536,7 +1550,7 @@ gnome_canvas_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) if the glyph falls in the bounding box before rasterizing it. */ - if(text->clip) { + if (text->clip) { render_x = text->cx - text->clip_cx; render_y = text->cy - text->clip_cy; } @@ -1553,16 +1567,16 @@ gnome_canvas_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) x = text->cx - buf->rect.x0; y = text->cy - buf->rect.y0; } - + w = text->priv->bitmap.width; h = text->priv->bitmap.rows; src_dx = src_dy = 0; - + if (x + w > buf->rect.x1 - buf->rect.x0) { w = buf->rect.x1 - buf->rect.x0 - x; } - + if (y + h > buf->rect.y1 - buf->rect.y0) { h = buf->rect.y1 - buf->rect.y0 - y; } @@ -1572,13 +1586,13 @@ gnome_canvas_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) src_dx += - x; x = 0; } - + if (y < 0) { h -= -y; src_dy += - y; y = 0; } - + dst = buf->buf + y * buf->buf_rowstride + x * 3; src = text->priv->bitmap.buffer + src_dy * text->priv->bitmap.pitch + src_dx; @@ -1596,21 +1610,21 @@ gnome_canvas_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) dst += buf->buf_rowstride - w*3; src += text->priv->bitmap.pitch - w; } - + buf->is_bg = 0; return; } /* Point handler for the text item */ static double -gnome_canvas_text_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, GnomeCanvasItem **actual_item) +gnome_canvas_text_point (GnomeCanvasItem *item, gdouble x, gdouble y, + gint cx, gint cy, GnomeCanvasItem **actual_item) { GnomeCanvasText *text; PangoLayoutIter *iter; - int x1, y1, x2, y2; - int dx, dy; - double dist, best; + gint x1, y1, x2, y2; + gint dx, dy; + gdouble dist, best; text = GNOME_CANVAS_TEXT (item); @@ -1626,10 +1640,10 @@ gnome_canvas_text_point (GnomeCanvasItem *item, double x, double y, iter = pango_layout_get_iter (text->layout); do { - PangoRectangle log_rect; + PangoRectangle log_rect; pango_layout_iter_get_line_extents (iter, NULL, &log_rect); - + x1 = text->cx + PANGO_PIXELS (log_rect.x); y1 = text->cy + PANGO_PIXELS (log_rect.y); x2 = x1 + PANGO_PIXELS (log_rect.width); @@ -1676,20 +1690,24 @@ gnome_canvas_text_point (GnomeCanvasItem *item, double x, double y, dist = sqrt (dx * dx + dy * dy); if (dist < best) best = dist; - + } while (pango_layout_iter_next_line(iter)); pango_layout_iter_free(iter); - + return best / item->canvas->pixels_per_unit; } /* Bounds handler for the text item */ static void -gnome_canvas_text_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) +gnome_canvas_text_bounds (GnomeCanvasItem *item, + gdouble *x1, + gdouble *y1, + gdouble *x2, + gdouble *y2) { GnomeCanvasText *text; - double width, height; + gdouble width, height; text = GNOME_CANVAS_TEXT (item); @@ -1749,5 +1767,5 @@ gnome_canvas_text_bounds (GnomeCanvasItem *item, double *x1, double *y1, double } *x2 = *x1 + width; - *y2 = *y1 + height; + *y2 = *y1 + height; } diff --git a/libgnomecanvas/gnome-canvas-text.h b/libgnomecanvas/gnome-canvas-text.h index ed86633371..64eda6a9d4 100644 --- a/libgnomecanvas/gnome-canvas-text.h +++ b/libgnomecanvas/gnome-canvas-text.h @@ -36,13 +36,10 @@ #ifndef GNOME_CANVAS_TEXT_H #define GNOME_CANVAS_TEXT_H - #include <libgnomecanvas/gnome-canvas.h> - G_BEGIN_DECLS - /* Text item for the canvas. Text items are positioned by an anchor point and an anchor direction. * * A clipping rectangle may be specified for the text. The rectangle is anchored at the text's anchor @@ -64,34 +61,34 @@ G_BEGIN_DECLS * text string RW The string of the text label * markup string W A Pango markup string for the text label * - * x double RW X coordinate of anchor point - * y double RW Y coordinate of anchor point + * x gdouble RW X coordinate of anchor point + * y gdouble RW Y coordinate of anchor point * * font string W A string describing the font - * font_desc PangoFontDescription* RW Pointer to a PangoFontDescriptor + * font_desc PangoFontDescription* RW Pointer to a PangoFontDescriptor * attributes PangoAttrList* RW Pointer to a Pango attribute list * style PangoStyle RW Pango style of font to use [*] * variant PangoVariant RW Pango variant of font to use [*] - * weight int RW Pango weight of font to use [*] + * weight gint RW Pango weight of font to use [*] * stretch PangoStretch RW Pango stretch of font to use [*] - * size int RW Size (in pixels) of font [*] - * size_points double RW Size (in points) of font - * scale double RW Ratio to scale font [*] + * size gint RW Size (in pixels) of font [*] + * size_points gdouble RW Size (in points) of font + * scale gdouble RW Ratio to scale font [*] * * anchor GtkAnchorType RW Anchor side for the text * justification GtkJustification RW Justification for multiline text - * clip_width double RW Width of clip rectangle - * clip_height double RW Height of clip rectangle + * clip_width gdouble RW Width of clip rectangle + * clip_height gdouble RW Height of clip rectangle * clip boolean RW Use clipping rectangle? - * x_offset double RW Horizontal offset distance from anchor position - * y_offset double RW Vertical offset distance from anchor position + * x_offset gdouble RW Horizontal offset distance from anchor position + * y_offset gdouble RW Vertical offset distance from anchor position * - * text_width double R Used to query the width of the rendered text - * text_height double R Used to query the rendered height of the text + * text_width gdouble R Used to query the width of the rendered text + * text_height gdouble R Used to query the rendered height of the text * * fill_color string W X color specification for text * fill_color_gdk GdkColor* RW Pointer to an allocated GdkColor - * fill_color_rgba guint RW RGBA value used for AA color. + * fill_color_rgba guint RW RGBA value used for AA color. * fill_stipple GdkBitmap* RW Stipple pattern for filling the text */ @@ -102,7 +99,6 @@ G_BEGIN_DECLS #define GNOME_IS_CANVAS_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_TEXT)) #define GNOME_CANVAS_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_TEXT, GnomeCanvasTextClass)) - typedef struct _GnomeCanvasText GnomeCanvasText; typedef struct _GnomeCanvasTextClass GnomeCanvasTextClass; @@ -115,33 +111,33 @@ struct _GnomeCanvasText { PangoAttrList *attr_list; /* Attribute list of the text (caching) */ PangoUnderline underline; gboolean strikethrough; - int rise; - double scale; - - char *text; /* Text to display */ + gint rise; + gdouble scale; + + gchar *text; /* Text to display */ GdkBitmap *stipple; /* Stipple for text */ GdkGC *gc; /* GC for drawing text */ PangoLayout *layout; /* The PangoLayout containing the text */ gulong pixel; /* Fill color */ - double x, y; /* Position at anchor */ + gdouble x, y; /* Position at anchor */ - double clip_width; /* Width of optional clip rectangle */ - double clip_height; /* Height of optional clip rectangle */ + gdouble clip_width; /* Width of optional clip rectangle */ + gdouble clip_height; /* Height of optional clip rectangle */ - double xofs, yofs; /* Text offset distance from anchor position */ + gdouble xofs, yofs; /* Text offset distance from anchor position */ - double affine[6]; /* The item -> canvas affine */ /*AA*/ + gdouble affine[6]; /* The item -> canvas affine */ /*AA*/ GtkAnchorType anchor; /* Anchor side for text */ GtkJustification justification; /* Justification for text */ - int cx, cy; /* Top-left canvas coordinates for text */ - int clip_cx, clip_cy; /* Top-left canvas coordinates for clip rectangle */ - int clip_cwidth, clip_cheight; /* Size of clip rectangle in pixels */ - int max_width; /* Maximum width of text lines */ - int height; /* Rendered text height in pixels */ + gint cx, cy; /* Top-left canvas coordinates for text */ + gint clip_cx, clip_cy; /* Top-left canvas coordinates for clip rectangle */ + gint clip_cwidth, clip_cheight; /* Size of clip rectangle in pixels */ + gint max_width; /* Maximum width of text lines */ + gint height; /* Rendered text height in pixels */ guint32 rgba; /* RGBA color for text */ /*AA*/ @@ -153,18 +149,16 @@ struct _GnomeCanvasText { guint scale_set : 1; /* Apply specified font scaling ratio? */ - GnomeCanvasTextPrivate *priv; + GnomeCanvasTextPrivate *priv; }; struct _GnomeCanvasTextClass { GnomeCanvasItemClass parent_class; }; - /* Standard Gtk function */ GType gnome_canvas_text_get_type (void) G_GNUC_CONST; - G_END_DECLS #endif diff --git a/libgnomecanvas/gnome-canvas-util.c b/libgnomecanvas/gnome-canvas-util.c index d306292144..3df31e0766 100644 --- a/libgnomecanvas/gnome-canvas-util.c +++ b/libgnomecanvas/gnome-canvas-util.c @@ -54,15 +54,15 @@ /** * gnome_canvas_points_new: * @num_points: The number of points to allocate space for in the array. - * + * * Creates a structure that should be used to pass an array of points to * items. - * + * * Return value: A newly-created array of points. It should be filled in * by the user. **/ GnomeCanvasPoints * -gnome_canvas_points_new (int num_points) +gnome_canvas_points_new (gint num_points) { GnomeCanvasPoints *points; @@ -79,9 +79,9 @@ gnome_canvas_points_new (int num_points) /** * gnome_canvas_points_ref: * @points: A canvas points structure. - * + * * Increases the reference count of the specified points structure. - * + * * Return value: The canvas points structure itself. **/ GnomeCanvasPoints * @@ -96,7 +96,7 @@ gnome_canvas_points_ref (GnomeCanvasPoints *points) /** * gnome_canvas_points_free: * @points: A canvas points structure. - * + * * Decreases the reference count of the specified points structure. If it * reaches zero, then the structure is freed. **/ @@ -125,26 +125,26 @@ gnome_canvas_points_free (GnomeCanvasPoints *points) * @my1: The Y coordinate of the first miter point is returned here. * @mx2: The X coordinate of the second miter point is returned here. * @my2: The Y coordinate of the second miter point is returned here. - * + * * Given three points forming an angle, computes the coordinates of the inside * and outside points of the mitered corner formed by a line of a given width at * that angle. - * + * * Return value: FALSE if the angle is less than 11 degrees (this is the same * threshold as X uses. If this occurs, the return points are not modified. * Otherwise, returns TRUE. **/ -int -gnome_canvas_get_miter_points (double x1, double y1, double x2, double y2, double x3, double y3, - double width, - double *mx1, double *my1, double *mx2, double *my2) +gint +gnome_canvas_get_miter_points (gdouble x1, gdouble y1, gdouble x2, gdouble y2, gdouble x3, gdouble y3, + gdouble width, + gdouble *mx1, gdouble *my1, gdouble *mx2, gdouble *my2) { - double theta1; /* angle of segment p2-p1 */ - double theta2; /* angle of segment p2-p3 */ - double theta; /* angle between line segments */ - double theta3; /* angle that bisects theta1 and theta2 and points to p1 */ - double dist; /* distance of miter points from p2 */ - double dx, dy; /* x and y offsets corresponding to dist */ + gdouble theta1; /* angle of segment p2-p1 */ + gdouble theta2; /* angle of segment p2-p3 */ + gdouble theta; /* angle between line segments */ + gdouble theta3; /* angle that bisects theta1 and theta2 and points to p1 */ + gdouble dist; /* distance of miter points from p2 */ + gdouble dx, dy; /* x and y offsets corresponding to dist */ #define ELEVEN_DEGREES (11.0 * G_PI / 180.0) @@ -203,16 +203,16 @@ gnome_canvas_get_miter_points (double x1, double y1, double x2, double y2, doubl * @by1: Y coordinate of first butt point is returned here * @bx2: X coordinate of second butt point is returned here * @by2: Y coordinate of second butt point is returned here - * + * * Computes the butt points of a line segment. **/ void -gnome_canvas_get_butt_points (double x1, double y1, double x2, double y2, - double width, int project, - double *bx1, double *by1, double *bx2, double *by2) +gnome_canvas_get_butt_points (gdouble x1, gdouble y1, gdouble x2, gdouble y2, + gdouble width, gint project, + gdouble *bx1, gdouble *by1, gdouble *bx2, gdouble *by2) { - double length; - double dx, dy; + gdouble length; + gdouble dx, dy; width *= 0.5; dx = x2 - x1; @@ -247,20 +247,20 @@ gnome_canvas_get_butt_points (double x1, double y1, double x2, double y2, * @num_points: Number of points in the polygon * @x: X coordinate of the point * @y: Y coordinate of the point - * + * * Computes the distance between a point and a polygon. - * + * * Return value: The distance from the point to the polygon, or zero if the * point is inside the polygon. **/ -double -gnome_canvas_polygon_to_point (double *poly, int num_points, double x, double y) +gdouble +gnome_canvas_polygon_to_point (gdouble *poly, gint num_points, gdouble x, gdouble y) { - double best; - int intersections; - int i; - double *p; - double dx, dy; + gdouble best; + gint intersections; + gint i; + gdouble *p; + gdouble dx, dy; /* Iterate through all the edges in the polygon, updating best and intersections. * @@ -273,7 +273,7 @@ gnome_canvas_polygon_to_point (double *poly, int num_points, double x, double y) intersections = 0; for (i = num_points, p = poly; i > 1; i--, p += 2) { - double px, py, dist; + gdouble px, py, dist; /* Compute the point on the current edge closest to the point and update the * intersection count. This must be done separately for vertical edges, horizontal @@ -311,8 +311,8 @@ gnome_canvas_polygon_to_point (double *poly, int num_points, double x, double y) intersections++; } } else { - double m1, b1, m2, b2; - int lower; + gdouble m1, b1, m2, b2; + gint lower; /* Diagonal edge. Convert the edge to a line equation (y = m1*x + b1), then * compute a line perpendicular to this edge but passing through the point, @@ -385,7 +385,7 @@ void gnome_canvas_render_svp (GnomeCanvasBuf *buf, ArtSVP *svp, guint32 rgba) { guint32 fg_color, bg_color; - int alpha; + gint alpha; if (buf->is_bg) { bg_color = buf->bg_color; @@ -394,9 +394,9 @@ gnome_canvas_render_svp (GnomeCanvasBuf *buf, ArtSVP *svp, guint32 rgba) fg_color = rgba >> 8; else { /* composite over background color */ - int bg_r, bg_g, bg_b; - int fg_r, fg_g, fg_b; - int tmp; + gint bg_r, bg_g, bg_b; + gint fg_r, fg_g, fg_b; + gint tmp; bg_r = (bg_color >> 16) & 0xff; fg_r = (rgba >> 24) & 0xff; @@ -506,7 +506,7 @@ gnome_canvas_update_svp_clip (GnomeCanvas *canvas, ArtSVP **p_svp, ArtSVP *new_s /** * gnome_canvas_item_reset_bounds: * @item: A canvas item - * + * * Resets the bounding box of a canvas item to an empty rectangle. **/ void @@ -579,7 +579,7 @@ gnome_canvas_item_update_svp_clip (GnomeCanvasItem *item, ArtSVP **p_svp, ArtSVP * @svp: the svp that needs to be redrawn * * Request redraw of the svp if in aa mode, or the entire item in in xlib mode. - **/ + **/ void gnome_canvas_item_request_redraw_svp (GnomeCanvasItem *item, const ArtSVP *svp) { @@ -593,7 +593,7 @@ gnome_canvas_item_request_redraw_svp (GnomeCanvasItem *item, const ArtSVP *svp) gnome_canvas_request_redraw_uta (canvas, uta); } } else { - gnome_canvas_request_redraw (canvas, item->x1, item->y1, item->x2, item->y2); + gnome_canvas_request_redraw (canvas, item->x1, item->y1, item->x2, item->y2); } } @@ -608,7 +608,7 @@ gnome_canvas_item_request_redraw_svp (GnomeCanvasItem *item, const ArtSVP *svp) * Sets the bbox to the new value, requesting full repaint. **/ void -gnome_canvas_update_bbox (GnomeCanvasItem *item, int x1, int y1, int x2, int y2) +gnome_canvas_update_bbox (GnomeCanvasItem *item, gint x1, gint y1, gint x2, gint y2) { gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); item->x1 = x1; @@ -628,7 +628,7 @@ void gnome_canvas_buf_ensure_buf (GnomeCanvasBuf *buf) { guchar *bufptr; - int y; + gint y; if (!buf->is_buf) { bufptr = buf->buf; diff --git a/libgnomecanvas/gnome-canvas-util.h b/libgnomecanvas/gnome-canvas-util.h index cfd32c336e..5ba0481399 100644 --- a/libgnomecanvas/gnome-canvas-util.h +++ b/libgnomecanvas/gnome-canvas-util.h @@ -39,7 +39,6 @@ #include <libart_lgpl/art_vpath.h> #include <libart_lgpl/art_svp_vpath_stroke.h> - G_BEGIN_DECLS typedef struct _GnomeCanvasPoints GnomeCanvasPoints; @@ -49,14 +48,13 @@ typedef struct _GnomeCanvasPoints GnomeCanvasPoints; * number of points, so the array is 2*num_points elements big. */ struct _GnomeCanvasPoints { - double *coords; - int num_points; - int ref_count; + gdouble *coords; + gint num_points; + gint ref_count; }; - /* Allocate a new GnomeCanvasPoints structure with enough space for the specified number of points */ -GnomeCanvasPoints *gnome_canvas_points_new (int num_points); +GnomeCanvasPoints *gnome_canvas_points_new (gint num_points); /* Increate ref count */ GnomeCanvasPoints *gnome_canvas_points_ref (GnomeCanvasPoints *points); @@ -71,9 +69,9 @@ void gnome_canvas_points_free (GnomeCanvasPoints *points); * If the angle is less than 11 degrees, then FALSE is returned and the return points are not * modified. Otherwise, TRUE is returned. */ -int gnome_canvas_get_miter_points (double x1, double y1, double x2, double y2, double x3, double y3, - double width, - double *mx1, double *my1, double *mx2, double *my2); +gint gnome_canvas_get_miter_points (gdouble x1, gdouble y1, gdouble x2, gdouble y2, gdouble x3, gdouble y3, + gdouble width, + gdouble *mx1, gdouble *my1, gdouble *mx2, gdouble *my2); /* Compute the butt points of a line segment. If project is FALSE, then the results are as follows: * @@ -92,15 +90,14 @@ int gnome_canvas_get_miter_points (double x1, double y1, double x2, double y2, d * | * -------------------* (bx2, by2) */ -void gnome_canvas_get_butt_points (double x1, double y1, double x2, double y2, - double width, int project, - double *bx1, double *by1, double *bx2, double *by2); +void gnome_canvas_get_butt_points (gdouble x1, gdouble y1, gdouble x2, gdouble y2, + gdouble width, gint project, + gdouble *bx1, gdouble *by1, gdouble *bx2, gdouble *by2); /* Calculate the distance from a polygon to a point. The polygon's X coordinates are in the even * indices of the poly array, and the Y coordinates are in the odd indices. */ -double gnome_canvas_polygon_to_point (double *poly, int num_points, double x, double y); - +gdouble gnome_canvas_polygon_to_point (gdouble *poly, gint num_points, gdouble x, gdouble y); /* Render the svp over the buf. */ void gnome_canvas_render_svp (GnomeCanvasBuf *buf, ArtSVP *svp, guint32 rgba); @@ -139,7 +136,7 @@ void gnome_canvas_item_update_svp_clip (GnomeCanvasItem *item, ArtSVP **p_svp, A void gnome_canvas_item_request_redraw_svp (GnomeCanvasItem *item, const ArtSVP *svp); /* Sets the bbox to the new value, requesting full repaint. */ -void gnome_canvas_update_bbox (GnomeCanvasItem *item, int x1, int y1, int x2, int y2); +void gnome_canvas_update_bbox (GnomeCanvasItem *item, gint x1, gint y1, gint x2, gint y2); /* Ensure that the buffer is in RGB format, suitable for compositing. */ void gnome_canvas_buf_ensure_buf (GnomeCanvasBuf *buf); diff --git a/libgnomecanvas/gnome-canvas-widget.c b/libgnomecanvas/gnome-canvas-widget.c index d94942c8a5..f47180ff98 100644 --- a/libgnomecanvas/gnome-canvas-widget.c +++ b/libgnomecanvas/gnome-canvas-widget.c @@ -47,7 +47,6 @@ enum { PROP_SIZE_PIXELS }; - static void gnome_canvas_widget_class_init (GnomeCanvasWidgetClass *class); static void gnome_canvas_widget_init (GnomeCanvasWidget *witem); static void gnome_canvas_widget_destroy (GtkObject *object); @@ -60,21 +59,20 @@ static void gnome_canvas_widget_set_property (GObject *object, const GValue *value, GParamSpec *pspec); -static void gnome_canvas_widget_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags); -static double gnome_canvas_widget_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, GnomeCanvasItem **actual_item); -static void gnome_canvas_widget_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2); +static void gnome_canvas_widget_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags); +static gdouble gnome_canvas_widget_point (GnomeCanvasItem *item, gdouble x, gdouble y, + gint cx, gint cy, GnomeCanvasItem **actual_item); +static void gnome_canvas_widget_bounds (GnomeCanvasItem *item, gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2); static void gnome_canvas_widget_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf); static void gnome_canvas_widget_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, - int width, int height); + gint x, gint y, + gint width, gint height); static GnomeCanvasItemClass *parent_class; - GType gnome_canvas_widget_get_type (void) { @@ -205,7 +203,7 @@ static void recalc_bounds (GnomeCanvasWidget *witem) { GnomeCanvasItem *item; - double wx, wy; + gdouble wx, wy; item = GNOME_CANVAS_ITEM (witem); @@ -299,8 +297,8 @@ gnome_canvas_widget_set_property (GObject *object, GnomeCanvasItem *item; GnomeCanvasWidget *witem; GObject *obj; - int update; - int calc_bounds; + gint update; + gint calc_bounds; g_return_if_fail (object != NULL); g_return_if_fail (GNOME_IS_CANVAS_WIDGET (object)); @@ -333,49 +331,49 @@ gnome_canvas_widget_set_property (GObject *object, break; case PROP_X: - if (witem->x != g_value_get_double (value)) + if (witem->x != g_value_get_double (value)) { - witem->x = g_value_get_double (value); + witem->x = g_value_get_double (value); calc_bounds = TRUE; } break; case PROP_Y: - if (witem->y != g_value_get_double (value)) + if (witem->y != g_value_get_double (value)) { - witem->y = g_value_get_double (value); + witem->y = g_value_get_double (value); calc_bounds = TRUE; } break; case PROP_WIDTH: - if (witem->width != fabs (g_value_get_double (value))) + if (witem->width != fabs (g_value_get_double (value))) { - witem->width = fabs (g_value_get_double (value)); + witem->width = fabs (g_value_get_double (value)); update = TRUE; } break; case PROP_HEIGHT: - if (witem->height != fabs (g_value_get_double (value))) + if (witem->height != fabs (g_value_get_double (value))) { - witem->height = fabs (g_value_get_double (value)); + witem->height = fabs (g_value_get_double (value)); update = TRUE; } break; case PROP_ANCHOR: - if (witem->anchor != g_value_get_enum (value)) + if (witem->anchor != g_value_get_enum (value)) { - witem->anchor = g_value_get_enum (value); + witem->anchor = g_value_get_enum (value); update = TRUE; } break; case PROP_SIZE_PIXELS: - if (witem->size_pixels != g_value_get_boolean (value)) + if (witem->size_pixels != g_value_get_boolean (value)) { - witem->size_pixels = g_value_get_boolean (value); + witem->size_pixels = g_value_get_boolean (value); update = TRUE; } break; @@ -441,7 +439,7 @@ gnome_canvas_widget_get_property (GObject *object, } static void -gnome_canvas_widget_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +gnome_canvas_widget_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags) { GnomeCanvasWidget *witem; @@ -452,11 +450,11 @@ gnome_canvas_widget_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_ if (witem->widget) { if (witem->size_pixels) { - witem->cwidth = (int) (witem->width + 0.5); - witem->cheight = (int) (witem->height + 0.5); + witem->cwidth = (gint) (witem->width + 0.5); + witem->cheight = (gint) (witem->height + 0.5); } else { - witem->cwidth = (int) (witem->width * item->canvas->pixels_per_unit + 0.5); - witem->cheight = (int) (witem->height * item->canvas->pixels_per_unit + 0.5); + witem->cwidth = (gint) (witem->width * item->canvas->pixels_per_unit + 0.5); + witem->cheight = (gint) (witem->height * item->canvas->pixels_per_unit + 0.5); } gtk_widget_set_size_request (witem->widget, witem->cwidth, witem->cheight); @@ -477,7 +475,7 @@ gnome_canvas_widget_render (GnomeCanvasItem *item, witem = GNOME_CANVAS_WIDGET (item); - if (witem->widget) + if (witem->widget) gtk_widget_queue_draw (witem->widget); #endif @@ -486,8 +484,8 @@ gnome_canvas_widget_render (GnomeCanvasItem *item, static void gnome_canvas_widget_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, - int width, int height) + gint x, gint y, + gint width, gint height) { #if 0 GnomeCanvasWidget *witem; @@ -500,12 +498,12 @@ gnome_canvas_widget_draw (GnomeCanvasItem *item, } static double -gnome_canvas_widget_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, GnomeCanvasItem **actual_item) +gnome_canvas_widget_point (GnomeCanvasItem *item, gdouble x, gdouble y, + gint cx, gint cy, GnomeCanvasItem **actual_item) { GnomeCanvasWidget *witem; - double x1, y1, x2, y2; - double dx, dy; + gdouble x1, y1, x2, y2; + gdouble dx, dy; witem = GNOME_CANVAS_WIDGET (item); @@ -541,7 +539,7 @@ gnome_canvas_widget_point (GnomeCanvasItem *item, double x, double y, } static void -gnome_canvas_widget_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) +gnome_canvas_widget_bounds (GnomeCanvasItem *item, gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2) { GnomeCanvasWidget *witem; diff --git a/libgnomecanvas/gnome-canvas-widget.h b/libgnomecanvas/gnome-canvas-widget.h index f7517c3832..32514aad6e 100644 --- a/libgnomecanvas/gnome-canvas-widget.h +++ b/libgnomecanvas/gnome-canvas-widget.h @@ -34,23 +34,20 @@ #ifndef GNOME_CANVAS_WIDGET_H #define GNOME_CANVAS_WIDGET_H - #include <libgnomecanvas/gnome-canvas.h> - G_BEGIN_DECLS - /* Widget item for canvas. The widget is positioned with respect to an anchor point. * The following object arguments are available: * * name type read/write description * ------------------------------------------------------------------------------------------ * widget GtkWidget* RW Pointer to the widget - * x double RW X coordinate of anchor point - * y double RW Y coordinate of anchor point - * width double RW Width of widget (see below) - * height double RW Height of widget (see below) + * x gdouble RW X coordinate of anchor point + * y gdouble RW Y coordinate of anchor point + * width gdouble RW Width of widget (see below) + * height gdouble RW Height of widget (see below) * anchor GtkAnchorType RW Anchor side for widget * size_pixels boolean RW Specifies whether the widget size * is specified in pixels or canvas units. @@ -59,7 +56,6 @@ G_BEGIN_DECLS * Otherwise, it will be scaled. */ - #define GNOME_TYPE_CANVAS_WIDGET (gnome_canvas_widget_get_type ()) #define GNOME_CANVAS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS_WIDGET, GnomeCanvasWidget)) #define GNOME_CANVAS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_WIDGET, GnomeCanvasWidgetClass)) @@ -67,7 +63,6 @@ G_BEGIN_DECLS #define GNOME_IS_CANVAS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_WIDGET)) #define GNOME_CANVAS_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_WIDGET, GnomeCanvasWidgetClass)) - typedef struct _GnomeCanvasWidget GnomeCanvasWidget; typedef struct _GnomeCanvasWidgetClass GnomeCanvasWidgetClass; @@ -76,12 +71,12 @@ struct _GnomeCanvasWidget { GtkWidget *widget; /* The child widget */ - double x, y; /* Position at anchor */ - double width, height; /* Dimensions of widget */ + gdouble x, y; /* Position at anchor */ + gdouble width, height; /* Dimensions of widget */ GtkAnchorType anchor; /* Anchor side for widget */ - int cx, cy; /* Top-left canvas coordinates for widget */ - int cwidth, cheight; /* Size of widget in pixels */ + gint cx, cy; /* Top-left canvas coordinates for widget */ + gint cwidth, cheight; /* Size of widget in pixels */ guint destroy_id; /* Signal connection id for destruction of child widget */ @@ -93,11 +88,9 @@ struct _GnomeCanvasWidgetClass { GnomeCanvasItemClass parent_class; }; - /* Standard Gtk function */ GType gnome_canvas_widget_get_type (void) G_GNUC_CONST; - G_END_DECLS #endif diff --git a/libgnomecanvas/gnome-canvas.c b/libgnomecanvas/gnome-canvas.c index 4f8f24b7dc..1ca6e5f32f 100644 --- a/libgnomecanvas/gnome-canvas.c +++ b/libgnomecanvas/gnome-canvas.c @@ -26,8 +26,9 @@ /* * GnomeCanvas widget - Tk-like canvas widget for Gnome * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent canvas widget. Tk is - * copyrighted by the Regents of the University of California, Sun Microsystems, and other parties. + * GnomeCanvas is basically a port of the Tk toolkit's most excellent canvas + * widget. Tk is copyrighted by the Regents of the University of California, + * Sun Microsystems, and other parties. * * * Authors: Federico Mena <federico@nuclecu.unam.mx> @@ -37,17 +38,20 @@ /* * TO-DO list for the canvas: * - * - Allow to specify whether GnomeCanvasImage sizes are in units or pixels (scale or don't scale). + * - Allow to specify whether GnomeCanvasImage sizes are in units or pixels + * (scale or don't scale). * - * - Implement a flag for gnome_canvas_item_reparent() that tells the function to keep the item - * visually in the same place, that is, to keep it in the same place with respect to the canvas - * origin. + * - Implement a flag for gnome_canvas_item_reparent() that tells the function + * to keep the item visually in the same place, that is, to keep it in the + * same place with respect to the canvas origin. * * - GC put functions for items. * * - Widget item (finish it). * - * - GList *gnome_canvas_gimme_all_items_contained_in_this_area (GnomeCanvas *canvas, Rectangle area); + * - GList * + * gnome_canvas_gimme_all_items_contained_in_this_area (GnomeCanvas *canvas, + * Rectangle area); * * - Retrofit all the primitive items with microtile support. * @@ -95,7 +99,6 @@ /* We must run our idle update handler *before* GDK wants to redraw. */ #define CANVAS_IDLE_PRIORITY (GDK_PRIORITY_REDRAW - 5) - static void gnome_canvas_request_update (GnomeCanvas *canvas); static void group_add (GnomeCanvasGroup *group, GnomeCanvasItem *item); @@ -103,13 +106,18 @@ static void group_remove (GnomeCanvasGroup *group, GnomeCanvasItem *item); static void add_idle (GnomeCanvas *canvas); - /*** GnomeCanvasItem ***/ /* Some convenience stuff */ -#define GCI_UPDATE_MASK (GNOME_CANVAS_UPDATE_REQUESTED | GNOME_CANVAS_UPDATE_AFFINE | GNOME_CANVAS_UPDATE_CLIP | GNOME_CANVAS_UPDATE_VISIBILITY) +#define GCI_UPDATE_MASK \ + (GNOME_CANVAS_UPDATE_REQUESTED | \ + GNOME_CANVAS_UPDATE_AFFINE | \ + GNOME_CANVAS_UPDATE_CLIP | \ + GNOME_CANVAS_UPDATE_VISIBILITY) #define GCI_EPSILON 1e-18 -#define GCI_PRINT_MATRIX(s,a) g_print ("%s %g %g %g %g %g %g\n", s, (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]) +#define GCI_PRINT_MATRIX(s,a) \ + g_print ("%s %g %g %g %g %g %g\n", \ + s, (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]) enum { ITEM_PROP_0, @@ -123,13 +131,12 @@ enum { static void gnome_canvas_item_class_init (GnomeCanvasItemClass *class); static void gnome_canvas_item_init (GnomeCanvasItem *item); -static int emit_event (GnomeCanvas *canvas, GdkEvent *event); +static gint emit_event (GnomeCanvas *canvas, GdkEvent *event); static guint item_signals[ITEM_LAST_SIGNAL]; static GtkObjectClass *item_parent_class; - /** * gnome_canvas_item_get_type: * @@ -191,7 +198,9 @@ gnome_canvas_item_init (GnomeCanvasItem *item) * Return value: The newly-created item. **/ GnomeCanvasItem * -gnome_canvas_item_new (GnomeCanvasGroup *parent, GType type, const gchar *first_arg_name, ...) +gnome_canvas_item_new (GnomeCanvasGroup *parent, + GType type, + const gchar *first_arg_name, ...) { GnomeCanvasItem *item; va_list args; @@ -208,7 +217,6 @@ gnome_canvas_item_new (GnomeCanvasGroup *parent, GType type, const gchar *first_ return item; } - /* Performs post-creation operations on a canvas item (adding it to its parent * group, etc.) */ @@ -217,7 +225,8 @@ item_post_create_setup (GnomeCanvasItem *item) { group_add (GNOME_CANVAS_GROUP (item->parent), item); - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2 + 1, item->y2 + 1); + gnome_canvas_request_redraw ( + item->canvas, item->x1, item->y1, item->x2 + 1, item->y2 + 1); item->canvas->need_repick = TRUE; } @@ -295,13 +304,14 @@ gnome_canvas_item_construct (GnomeCanvasItem *item, GnomeCanvasGroup *parent, item_post_create_setup (item); } - /* If the item is visible, requests a redraw of it. */ static void redraw_if_visible (GnomeCanvasItem *item) { if (item->flags & GNOME_CANVAS_ITEM_VISIBLE) - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2 + 1, item->y2 + 1); + gnome_canvas_request_redraw ( + item->canvas, item->x1, item->y1, + item->x2 + 1, item->y2 + 1); } /* Standard object dispose function for canvas items */ @@ -389,7 +399,10 @@ gnome_canvas_item_unmap (GnomeCanvasItem *item) /* Update handler for canvas items */ static void -gnome_canvas_item_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +gnome_canvas_item_update (GnomeCanvasItem *item, + gdouble *affine, + ArtSVP *clip_path, + gint flags) { item->flags &= ~GNOME_CANVAS_ITEM_NEED_UPDATE; item->flags &= ~GNOME_CANVAS_ITEM_NEED_AFFINE; @@ -413,13 +426,16 @@ gnome_canvas_item_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_pa */ static void -gnome_canvas_item_invoke_update (GnomeCanvasItem *item, double *p2cpx, ArtSVP *clip_path, int flags) +gnome_canvas_item_invoke_update (GnomeCanvasItem *item, + gdouble *p2cpx, + ArtSVP *clip_path, + gint flags) { - int child_flags; + gint child_flags; gdouble i2cpx[6]; #ifdef HACKISH_AFFINE - double i2w[6], w2c[6], i2c[6]; + gdouble i2w[6], w2c[6], i2c[6]; #endif child_flags = flags; @@ -481,7 +497,12 @@ gnome_canvas_item_invoke_update (GnomeCanvasItem *item, double *p2cpx, ArtSVP *c */ static double -gnome_canvas_item_invoke_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, GnomeCanvasItem **actual_item) +gnome_canvas_item_invoke_point (GnomeCanvasItem *item, + gdouble x, + gdouble y, + gint cx, + gint cy, + GnomeCanvasItem **actual_item) { /* Calculate x & y in item local coordinates */ @@ -501,7 +522,7 @@ gnome_canvas_item_invoke_point (GnomeCanvasItem *item, double x, double y, int c } #ifdef HACKISH_AFFINE - double i2w[6], w2c[6], i2c[6], c2i[6]; + gdouble i2w[6], w2c[6], i2c[6], c2i[6]; ArtPoint c, i; #endif @@ -526,11 +547,12 @@ gnome_canvas_item_invoke_point (GnomeCanvasItem *item, double x, double y, int c /** * gnome_canvas_item_set: * @item: A canvas item. - * @first_arg_name: The list of object argument name/value pairs used to configure the item. + * @first_arg_name: The list of object argument name/value pairs used to + * configure the item. * @Varargs: * - * Configures a canvas item. The arguments in the item are set to the specified - * values, and the item is repainted as appropriate. + * Configures a canvas item. The arguments in the item are set to the + * specified values, and the item is repainted as appropriate. **/ void gnome_canvas_item_set (GnomeCanvasItem *item, const gchar *first_arg_name, ...) @@ -542,7 +564,6 @@ gnome_canvas_item_set (GnomeCanvasItem *item, const gchar *first_arg_name, ...) va_end (args); } - /** * gnome_canvas_item_set_valist: * @item: A canvas item. @@ -553,21 +574,17 @@ gnome_canvas_item_set (GnomeCanvasItem *item, const gchar *first_arg_name, ...) * values, and the item is repainted as appropriate. **/ void -gnome_canvas_item_set_valist (GnomeCanvasItem *item, const gchar *first_arg_name, va_list args) +gnome_canvas_item_set_valist (GnomeCanvasItem *item, + const gchar *first_arg_name, + va_list args) { g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); g_object_set_valist (G_OBJECT (item), first_arg_name, args); -#if 0 - /* I commented this out, because item implementations have to schedule update/redraw */ - redraw_if_visible (item); -#endif - item->canvas->need_repick = TRUE; } - /** * gnome_canvas_item_affine_relative: * @item: A canvas item. @@ -578,7 +595,7 @@ gnome_canvas_item_set_valist (GnomeCanvasItem *item, const gchar *first_arg_name **/ #define GCIAR_EPSILON 1e-6 void -gnome_canvas_item_affine_relative (GnomeCanvasItem *item, const double affine[6]) +gnome_canvas_item_affine_relative (GnomeCanvasItem *item, const gdouble affine[6]) { gdouble i2p[6]; @@ -615,7 +632,7 @@ gnome_canvas_item_affine_relative (GnomeCanvasItem *item, const double affine[6] * matrix. NULL affine is treated as identity. **/ void -gnome_canvas_item_affine_absolute (GnomeCanvasItem *item, const double i2p[6]) +gnome_canvas_item_affine_absolute (GnomeCanvasItem *item, const gdouble i2p[6]) { g_return_if_fail (item != NULL); g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); @@ -656,7 +673,6 @@ gnome_canvas_item_affine_absolute (GnomeCanvasItem *item, const double i2p[6]) item->canvas->need_repick = TRUE; } - /** * gnome_canvas_item_move: * @item: A canvas item. @@ -669,9 +685,9 @@ gnome_canvas_item_affine_absolute (GnomeCanvasItem *item, const double i2p[6]) * most probably does not do, what you want. **/ void -gnome_canvas_item_move (GnomeCanvasItem *item, double dx, double dy) +gnome_canvas_item_move (GnomeCanvasItem *item, gdouble dx, gdouble dy) { - double translate[6]; + gdouble translate[6]; g_return_if_fail (item != NULL); g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); @@ -733,7 +749,6 @@ put_item_after (GList *link, GList *before) return TRUE; } - /** * gnome_canvas_item_raise: * @item: A canvas item. @@ -744,7 +759,7 @@ put_item_after (GList *link, GList *before) * stack, then the item is put at the top. **/ void -gnome_canvas_item_raise (GnomeCanvasItem *item, int positions) +gnome_canvas_item_raise (GnomeCanvasItem *item, gint positions) { GList *link, *before; GnomeCanvasGroup *parent; @@ -771,7 +786,6 @@ gnome_canvas_item_raise (GnomeCanvasItem *item, int positions) } } - /** * gnome_canvas_item_lower: * @item: A canvas item. @@ -782,7 +796,7 @@ gnome_canvas_item_raise (GnomeCanvasItem *item, int positions) * stack, then the item is put at the bottom. **/ void -gnome_canvas_item_lower (GnomeCanvasItem *item, int positions) +gnome_canvas_item_lower (GnomeCanvasItem *item, gint positions) { GList *link, *before; GnomeCanvasGroup *parent; @@ -809,7 +823,6 @@ gnome_canvas_item_lower (GnomeCanvasItem *item, int positions) } } - /** * gnome_canvas_item_raise_to_top: * @item: A canvas item. @@ -837,7 +850,6 @@ gnome_canvas_item_raise_to_top (GnomeCanvasItem *item) } } - /** * gnome_canvas_item_lower_to_bottom: * @item: A canvas item. @@ -865,7 +877,6 @@ gnome_canvas_item_lower_to_bottom (GnomeCanvasItem *item) } } - /** * gnome_canvas_item_show: * @item: A canvas item. @@ -879,12 +890,13 @@ gnome_canvas_item_show (GnomeCanvasItem *item) if (!(item->flags & GNOME_CANVAS_ITEM_VISIBLE)) { item->flags |= GNOME_CANVAS_ITEM_VISIBLE; - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2 + 1, item->y2 + 1); + gnome_canvas_request_redraw ( + item->canvas, item->x1, item->y1, + item->x2 + 1, item->y2 + 1); item->canvas->need_repick = TRUE; } } - /** * gnome_canvas_item_hide: * @item: A canvas item. @@ -899,12 +911,13 @@ gnome_canvas_item_hide (GnomeCanvasItem *item) if (item->flags & GNOME_CANVAS_ITEM_VISIBLE) { item->flags &= ~GNOME_CANVAS_ITEM_VISIBLE; - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2 + 1, item->y2 + 1); + gnome_canvas_request_redraw ( + item->canvas, item->x1, item->y1, + item->x2 + 1, item->y2 + 1); item->canvas->need_repick = TRUE; } } - /** * gnome_canvas_item_grab: * @item: A canvas item. @@ -918,20 +931,26 @@ gnome_canvas_item_hide (GnomeCanvasItem *item) * If @cursor is not NULL, then that cursor is used while the grab is active. * The @etime parameter is the timestamp required for grabbing the mouse. * - * Return value: If an item was already grabbed, it returns %GDK_GRAB_ALREADY_GRABBED. If - * the specified item was hidden by calling gnome_canvas_item_hide(), then it - * returns %GDK_GRAB_NOT_VIEWABLE. Else, it returns the result of calling - * gdk_pointer_grab(). + * Return value: If an item was already grabbed, it returns + * %GDK_GRAB_ALREADY_GRABBED. If the specified item was hidden by calling + * gnome_canvas_item_hide(), then it returns %GDK_GRAB_NOT_VIEWABLE. Else, + * it returns the result of calling gdk_pointer_grab(). **/ -int -gnome_canvas_item_grab (GnomeCanvasItem *item, guint event_mask, GdkCursor *cursor, guint32 etime) +gint +gnome_canvas_item_grab (GnomeCanvasItem *item, + guint event_mask, + GdkCursor *cursor, + guint32 etime) { GtkLayout *layout; GdkWindow *bin_window; - int retval; + gint retval; - g_return_val_if_fail (GNOME_IS_CANVAS_ITEM (item), GDK_GRAB_NOT_VIEWABLE); - g_return_val_if_fail (gtk_widget_get_mapped (GTK_WIDGET (item->canvas)), GDK_GRAB_NOT_VIEWABLE); + g_return_val_if_fail ( + GNOME_IS_CANVAS_ITEM (item), GDK_GRAB_NOT_VIEWABLE); + g_return_val_if_fail ( + gtk_widget_get_mapped (GTK_WIDGET (item->canvas)), + GDK_GRAB_NOT_VIEWABLE); if (item->canvas->grabbed_item) return GDK_GRAB_ALREADY_GRABBED; @@ -959,7 +978,6 @@ gnome_canvas_item_grab (GnomeCanvasItem *item, guint event_mask, GdkCursor *curs return retval; } - /** * gnome_canvas_item_ungrab: * @item: A canvas item that holds a grab. @@ -981,7 +999,6 @@ gnome_canvas_item_ungrab (GnomeCanvasItem *item, guint32 etime) gdk_pointer_ungrab (etime); } - /** * gnome_canvas_item_i2w_affine: * @item: A canvas item @@ -991,7 +1008,7 @@ gnome_canvas_item_ungrab (GnomeCanvasItem *item, guint32 etime) * world coordinates. **/ void -gnome_canvas_item_i2w_affine (GnomeCanvasItem *item, double affine[6]) +gnome_canvas_item_i2w_affine (GnomeCanvasItem *item, gdouble affine[6]) { g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); g_return_if_fail (affine != NULL); @@ -1022,9 +1039,9 @@ gnome_canvas_item_i2w_affine (GnomeCanvasItem *item, double affine[6]) * coordinates. **/ void -gnome_canvas_item_w2i (GnomeCanvasItem *item, double *x, double *y) +gnome_canvas_item_w2i (GnomeCanvasItem *item, gdouble *x, gdouble *y) { - double affine[6], inv[6]; + gdouble affine[6], inv[6]; ArtPoint w, i; g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); @@ -1040,7 +1057,6 @@ gnome_canvas_item_w2i (GnomeCanvasItem *item, double *x, double *y) *y = i.y; } - /** * gnome_canvas_item_i2w: * @item: A canvas item. @@ -1051,9 +1067,9 @@ gnome_canvas_item_w2i (GnomeCanvasItem *item, double *x, double *y) * coordinates. **/ void -gnome_canvas_item_i2w (GnomeCanvasItem *item, double *x, double *y) +gnome_canvas_item_i2w (GnomeCanvasItem *item, gdouble *x, gdouble *y) { - double affine[6]; + gdouble affine[6]; ArtPoint w, i; g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); @@ -1077,9 +1093,9 @@ gnome_canvas_item_i2w (GnomeCanvasItem *item, double *x, double *y) * canvas pixel coordinates. **/ void -gnome_canvas_item_i2c_affine (GnomeCanvasItem *item, double affine[6]) +gnome_canvas_item_i2c_affine (GnomeCanvasItem *item, gdouble affine[6]) { - double i2w[6], w2c[6]; + gdouble i2w[6], w2c[6]; gnome_canvas_item_i2w_affine (item, i2w); gnome_canvas_w2c_affine (item->canvas, w2c); @@ -1087,7 +1103,7 @@ gnome_canvas_item_i2c_affine (GnomeCanvasItem *item, double affine[6]) } /* Returns whether the item is an inferior of or is equal to the parent. */ -static int +static gint is_descendant (GnomeCanvasItem *item, GnomeCanvasItem *parent) { for (; item; item = item->parent) @@ -1175,23 +1191,22 @@ gnome_canvas_item_grab_focus (GnomeCanvasItem *item) item->canvas->focused_item = item; gtk_widget_grab_focus (GTK_WIDGET (item->canvas)); - if (focused_item) { + if (focused_item) { GtkLayout *layout; GdkWindow *bin_window; layout = GTK_LAYOUT (item->canvas); bin_window = gtk_layout_get_bin_window (layout); - ev.focus_change.type = GDK_FOCUS_CHANGE; + ev.focus_change.type = GDK_FOCUS_CHANGE; ev.focus_change.window = bin_window; - ev.focus_change.send_event = FALSE; - ev.focus_change.in = TRUE; + ev.focus_change.send_event = FALSE; + ev.focus_change.in = TRUE; - emit_event (item->canvas, &ev); - } + emit_event (item->canvas, &ev); + } } - /** * gnome_canvas_item_get_bounds: * @item: A canvas item. @@ -1204,13 +1219,17 @@ gnome_canvas_item_grab_focus (GnomeCanvasItem *item) * coordinate system of the item's parent. **/ void -gnome_canvas_item_get_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) +gnome_canvas_item_get_bounds (GnomeCanvasItem *item, + gdouble *x1, + gdouble *y1, + gdouble *x2, + gdouble *y2) { - double tx1, ty1, tx2, ty2; + gdouble tx1, ty1, tx2, ty2; ArtPoint p1, p2, p3, p4; ArtPoint q1, q2, q3, q4; - double min_x1, min_y1, min_x2, min_y2; - double max_x1, max_y1, max_x2, max_y2; + gdouble min_x1, min_y1, min_x2, min_y2; + gdouble max_x1, max_y1, max_x2, max_y2; g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); @@ -1292,7 +1311,6 @@ gnome_canvas_item_get_bounds (GnomeCanvasItem *item, double *x1, double *y1, dou *y2 = ty2; } - /** * gnome_canvas_item_request_update * @item: A canvas item. @@ -1319,17 +1337,15 @@ gnome_canvas_item_request_update (GnomeCanvasItem *item) /*** GnomeCanvasGroup ***/ - enum { GROUP_PROP_0, GROUP_PROP_X, GROUP_PROP_Y }; - static void gnome_canvas_group_class_init (GnomeCanvasGroupClass *class); static void gnome_canvas_group_init (GnomeCanvasGroup *group); -static void gnome_canvas_group_set_property(GObject *object, +static void gnome_canvas_group_set_property(GObject *object, guint param_id, const GValue *value, GParamSpec *pspec); @@ -1340,26 +1356,28 @@ static void gnome_canvas_group_get_property(GObject *object, static void gnome_canvas_group_destroy (GtkObject *object); -static void gnome_canvas_group_update (GnomeCanvasItem *item, double *affine, - ArtSVP *clip_path, int flags); +static void gnome_canvas_group_update (GnomeCanvasItem *item, gdouble *affine, + ArtSVP *clip_path, gint flags); static void gnome_canvas_group_realize (GnomeCanvasItem *item); static void gnome_canvas_group_unrealize (GnomeCanvasItem *item); static void gnome_canvas_group_map (GnomeCanvasItem *item); static void gnome_canvas_group_unmap (GnomeCanvasItem *item); -static void gnome_canvas_group_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); -static double gnome_canvas_group_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, +static void gnome_canvas_group_draw (GnomeCanvasItem *item, + GdkDrawable *drawable, + gint x, gint y, + gint width, gint height); +static gdouble gnome_canvas_group_point (GnomeCanvasItem *item, + gdouble x, gdouble y, + gint cx, gint cy, GnomeCanvasItem **actual_item); -static void gnome_canvas_group_bounds (GnomeCanvasItem *item, double *x1, double *y1, - double *x2, double *y2); +static void gnome_canvas_group_bounds (GnomeCanvasItem *item, + gdouble *x1, gdouble *y1, + gdouble *x2, gdouble *y2); static void gnome_canvas_group_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf); - static GnomeCanvasItemClass *group_parent_class; - /** * gnome_canvas_group_get_type: * @@ -1387,8 +1405,9 @@ gnome_canvas_group_get_type (void) NULL /* value_table */ }; - canvas_group_type = g_type_register_static (GNOME_TYPE_CANVAS_ITEM, "GnomeCanvasGroup", - &object_info, 0); + canvas_group_type = g_type_register_static ( + GNOME_TYPE_CANVAS_ITEM, "GnomeCanvasGroup", + &object_info, 0); } return canvas_group_type; @@ -1450,7 +1469,7 @@ gnome_canvas_group_init (GnomeCanvasGroup *group) } /* Translate handler for canvas groups */ -static double * +static gdouble * gnome_canvas_ensure_translate (GnomeCanvasItem *item) { if (item->xform == NULL) { @@ -1472,7 +1491,7 @@ gnome_canvas_group_set_property (GObject *gobject, guint param_id, const GValue *value, GParamSpec *pspec) { GnomeCanvasItem *item; - double *xlat; + gdouble *xlat; g_return_if_fail (GNOME_IS_CANVAS_GROUP (gobject)); @@ -1552,7 +1571,10 @@ gnome_canvas_group_destroy (GtkObject *object) /* Update handler for canvas groups */ static void -gnome_canvas_group_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +gnome_canvas_group_update (GnomeCanvasItem *item, + gdouble *affine, + ArtSVP *clip_path, + gint flags) { GnomeCanvasGroup *group; GList *list; @@ -1668,7 +1690,7 @@ gnome_canvas_group_unmap (GnomeCanvasItem *item) /* Draw handler for canvas groups */ static void gnome_canvas_group_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height) + gint x, gint y, gint width, gint height) { GnomeCanvasGroup *group; GList *list; @@ -1697,16 +1719,20 @@ gnome_canvas_group_draw (GnomeCanvasItem *item, GdkDrawable *drawable, /* Point handler for canvas groups */ static double -gnome_canvas_group_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, - GnomeCanvasItem **actual_item) +gnome_canvas_group_point (GnomeCanvasItem *item, + gdouble x, + gdouble y, + gint cx, + gint cy, + GnomeCanvasItem **actual_item) { GnomeCanvasGroup *group; GList *list; GnomeCanvasItem *child, *point_item; - int x1, y1, x2, y2; - double gx, gy; - double dist, best; - int has_point; + gint x1, y1, x2, y2; + gdouble gx, gy; + gdouble dist, best; + gint has_point; group = GNOME_CANVAS_GROUP (item); @@ -1740,7 +1766,7 @@ gnome_canvas_group_point (GnomeCanvasItem *item, double x, double y, int cx, int if (has_point && point_item - && ((int) (dist * item->canvas->pixels_per_unit + 0.5) + && ((gint) (dist * item->canvas->pixels_per_unit + 0.5) <= item->canvas->close_enough)) { best = dist; *actual_item = point_item; @@ -1752,14 +1778,18 @@ gnome_canvas_group_point (GnomeCanvasItem *item, double x, double y, int cx, int /* Bounds handler for canvas groups */ static void -gnome_canvas_group_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) +gnome_canvas_group_bounds (GnomeCanvasItem *item, + gdouble *x1, + gdouble *y1, + gdouble *x2, + gdouble *y2) { GnomeCanvasGroup *group; GnomeCanvasItem *child; GList *list; - double tx1, ty1, tx2, ty2; - double minx, miny, maxx, maxy; - int set; + gdouble tx1, ty1, tx2, ty2; + gdouble minx, miny, maxx, maxy; + gint set; group = GNOME_CANVAS_GROUP (item); @@ -1900,10 +1930,8 @@ group_remove (GnomeCanvasGroup *group, GnomeCanvasItem *item) } } - /*** GnomeCanvas ***/ - enum { DRAW_BACKGROUND, RENDER_BACKGROUND, @@ -1936,11 +1964,10 @@ static gint gnome_canvas_focus_out (GtkWidget *widget, static void gnome_canvas_request_update_real (GnomeCanvas *canvas); static void gnome_canvas_draw_background (GnomeCanvas *canvas, GdkDrawable *drawable, - int x, - int y, - int width, - int height); - + gint x, + gint y, + gint width, + gint height); static GtkLayoutClass *canvas_parent_class; @@ -1986,7 +2013,7 @@ gnome_canvas_get_type (void) } static void -gnome_canvas_get_property (GObject *object, +gnome_canvas_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) @@ -2005,7 +2032,7 @@ gnome_canvas_get_property (GObject *object, } static void -gnome_canvas_set_property (GObject *object, +gnome_canvas_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) @@ -2071,7 +2098,7 @@ gnome_canvas_class_init (GnomeCanvasClass *klass) G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property (gobject_class, PROP_FOCUSED_ITEM, - g_param_spec_object ("focused_item", NULL, NULL, + g_param_spec_object ("focused_item", NULL, NULL, GNOME_TYPE_CANVAS_ITEM, (G_PARAM_READABLE | G_PARAM_WRITABLE))); @@ -2143,12 +2170,13 @@ gnome_canvas_init (GnomeCanvas *canvas) gtk_layout_set_hadjustment (GTK_LAYOUT (canvas), NULL); gtk_layout_set_vadjustment (GTK_LAYOUT (canvas), NULL); - /* Disable the gtk+ double buffering since the canvas uses it's own. */ + /* Disable the gtk+ gdouble buffering since the canvas uses it's own. */ gtk_widget_set_double_buffered (GTK_WIDGET (canvas), FALSE); - + /* Create the root item as a special case */ - canvas->root = GNOME_CANVAS_ITEM (g_object_new (gnome_canvas_group_get_type (), NULL)); + canvas->root = GNOME_CANVAS_ITEM ( + g_object_new (gnome_canvas_group_get_type (), NULL)); canvas->root->canvas = canvas; g_object_ref_sink (canvas->root); @@ -2242,7 +2270,7 @@ gnome_canvas_new (void) /** * gnome_canvas_new_aa: * - * Creates a new empty canvas in antialiased mode. + * Creates a new empty canvas in antialiased mode. * * Return value: A newly-created antialiased canvas. **/ @@ -2367,7 +2395,7 @@ gnome_canvas_unrealize (GtkWidget *widget) * keep as much as possible of the canvas scrolling region in view. */ static void -scroll_to (GnomeCanvas *canvas, int cx, int cy) +scroll_to (GnomeCanvas *canvas, gint cx, gint cy) { GtkWidget *widget; GtkLayout *layout; @@ -2375,10 +2403,10 @@ scroll_to (GnomeCanvas *canvas, int cx, int cy) GtkAdjustment *hadjustment; GtkAdjustment *vadjustment; guint layout_width, layout_height; - int scroll_width, scroll_height; - int right_limit, bottom_limit; - int old_zoom_xofs, old_zoom_yofs; - int canvas_width, canvas_height; + gint scroll_width, scroll_height; + gint right_limit, bottom_limit; + gint old_zoom_xofs, old_zoom_yofs; + gint canvas_width, canvas_height; widget = GTK_WIDGET (canvas); gtk_widget_get_allocation (widget, &allocation); @@ -2391,10 +2419,12 @@ scroll_to (GnomeCanvas *canvas, int cx, int cy) canvas_width = allocation.width; canvas_height = allocation.height; - scroll_width = floor ((canvas->scroll_x2 - canvas->scroll_x1) * canvas->pixels_per_unit - + 0.5); - scroll_height = floor ((canvas->scroll_y2 - canvas->scroll_y1) * canvas->pixels_per_unit - + 0.5); + scroll_width = + floor ((canvas->scroll_x2 - canvas->scroll_x1) * + canvas->pixels_per_unit + 0.5); + scroll_height = + floor ((canvas->scroll_y2 - canvas->scroll_y1) * + canvas->pixels_per_unit + 0.5); right_limit = scroll_width - canvas_width; bottom_limit = scroll_height - canvas_height; @@ -2455,8 +2485,8 @@ scroll_to (GnomeCanvas *canvas, int cx, int cy) if (vadjustment) gtk_adjustment_set_value (vadjustment, cy); - if ((scroll_width != (int) layout_width) - || (scroll_height != (int) layout_height)) + if ((scroll_width != (gint) layout_width) + || (scroll_height != (gint) layout_height)) gtk_layout_set_size (GTK_LAYOUT (canvas), scroll_width, scroll_height); } @@ -2501,7 +2531,7 @@ gnome_canvas_size_allocate (GtkWidget *widget, GtkAllocation *allocation) * item, or focused item, as appropriate. */ -static int +static gint emit_event (GnomeCanvas *canvas, GdkEvent *event) { GdkEvent *ev; @@ -2617,7 +2647,7 @@ emit_event (GnomeCanvas *canvas, GdkEvent *event) g_signal_emit (item, item_signals[ITEM_EVENT], 0, ev, &finished); - + parent = item->parent; g_object_unref (G_OBJECT (item)); @@ -2632,13 +2662,13 @@ emit_event (GnomeCanvas *canvas, GdkEvent *event) /* Re-picks the current item in the canvas, based on the event's coordinates. * Also emits enter/leave events for items as appropriate. */ -static int +static gint pick_current_item (GnomeCanvas *canvas, GdkEvent *event) { - int button_down; - double x, y; - int cx, cy; - int retval; + gint button_down; + gdouble x, y; + gint cx, cy; + gint retval; retval = FALSE; @@ -2707,8 +2737,8 @@ pick_current_item (GnomeCanvas *canvas, GdkEvent *event) /* canvas pixel coords */ - cx = (int) (x + 0.5); - cy = (int) (y + 0.5); + cx = (gint) (x + 0.5); + cy = (gint) (y + 0.5); /* world coords */ @@ -2777,8 +2807,8 @@ gnome_canvas_button (GtkWidget *widget, GdkEventButton *event) GnomeCanvas *canvas; GtkLayout *layout; GdkWindow *bin_window; - int mask; - int retval; + gint mask; + gint retval; g_return_val_if_fail (GNOME_IS_CANVAS (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); @@ -2878,12 +2908,12 @@ static gboolean gnome_canvas_key (GtkWidget *widget, GdkEventKey *event) { GnomeCanvas *canvas; - + g_return_val_if_fail (GNOME_IS_CANVAS (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); canvas = GNOME_CANVAS (widget); - + if (!emit_event (canvas, (GdkEvent *) event)) { GtkWidgetClass *widget_class; @@ -2903,7 +2933,6 @@ gnome_canvas_key (GtkWidget *widget, GdkEventKey *event) return TRUE; } - /* Crossing event handler for the canvas */ static gint gnome_canvas_crossing (GtkWidget *widget, GdkEventCrossing *event) @@ -3031,7 +3060,9 @@ gnome_canvas_paint_rect (GnomeCanvas *canvas, gint x0, gint y0, gint x1, gint y1 buf.rect.y1 = draw_y2; style = gtk_widget_get_style (widget); color = &style->bg[GTK_STATE_NORMAL]; - buf.bg_color = (((color->red & 0xff00) << 8) | (color->green & 0xff00) | (color->blue >> 8)); + buf.bg_color = + (((color->red & 0xff00) << 8) | + (color->green & 0xff00) | (color->blue >> 8)); buf.is_bg = 1; buf.is_buf = 0; @@ -3104,7 +3135,7 @@ gnome_canvas_expose (GtkWidget *widget, GdkEventExpose *event) GdkWindow *bin_window; GdkRectangle *rects; gint n_rects; - int i; + gint i; canvas = GNOME_CANVAS (widget); @@ -3225,7 +3256,7 @@ paint (GnomeCanvas *canvas) static void gnome_canvas_draw_background (GnomeCanvas *canvas, GdkDrawable *drawable, - int x, int y, int width, int height) + gint x, gint y, gint width, gint height) { GtkStyle *style; @@ -3317,7 +3348,7 @@ add_idle (GnomeCanvas *canvas) canvas, NULL); -/* canvas->idle_id = gtk_idle_add (idle_handler, canvas); */ +/* canvas->idle_id = gtk_idle_add (idle_handler, canvas); */ } /** @@ -3336,7 +3367,6 @@ gnome_canvas_root (GnomeCanvas *canvas) return GNOME_CANVAS_GROUP (canvas->root); } - /** * gnome_canvas_set_scroll_region: * @canvas: A canvas. @@ -3350,15 +3380,19 @@ gnome_canvas_root (GnomeCanvas *canvas) * is adjusted as appropriate to display as much of the new region as possible. **/ void -gnome_canvas_set_scroll_region (GnomeCanvas *canvas, double x1, double y1, double x2, double y2) +gnome_canvas_set_scroll_region (GnomeCanvas *canvas, + gdouble x1, + gdouble y1, + gdouble x2, + gdouble y2) { GtkLayout *layout; GtkAdjustment *hadjustment; GtkAdjustment *vadjustment; gdouble hadjustment_value; gdouble vadjustment_value; - double wxofs, wyofs; - int xofs, yofs; + gdouble wxofs, wyofs; + gint xofs, yofs; g_return_if_fail (GNOME_IS_CANVAS (canvas)); @@ -3398,7 +3432,6 @@ gnome_canvas_set_scroll_region (GnomeCanvas *canvas, double x1, double y1, doubl #endif } - /** * gnome_canvas_get_scroll_region: * @canvas: A canvas. @@ -3410,7 +3443,11 @@ gnome_canvas_set_scroll_region (GnomeCanvas *canvas, double x1, double y1, doubl * Queries the scrolling region of a canvas. **/ void -gnome_canvas_get_scroll_region (GnomeCanvas *canvas, double *x1, double *y1, double *x2, double *y2) +gnome_canvas_get_scroll_region (GnomeCanvas *canvas, + gdouble *x1, + gdouble *y1, + gdouble *x2, + gdouble *y2) { g_return_if_fail (GNOME_IS_CANVAS (canvas)); @@ -3432,14 +3469,15 @@ gnome_canvas_get_scroll_region (GnomeCanvas *canvas, double *x1, double *y1, dou * @canvas: A canvas. * @center_scroll_region: Whether to center the scrolling region in the canvas * window when it is smaller than the canvas' allocation. - * + * * When the scrolling region of the canvas is smaller than the canvas window, * e.g. the allocation of the canvas, it can be either centered on the window * or simply made to be on the upper-left corner on the window. This function * lets you configure this property. **/ void -gnome_canvas_set_center_scroll_region (GnomeCanvas *canvas, gboolean center_scroll_region) +gnome_canvas_set_center_scroll_region (GnomeCanvas *canvas, + gboolean center_scroll_region) { GtkLayout *layout; GtkAdjustment *hadjustment; @@ -3464,10 +3502,10 @@ gnome_canvas_set_center_scroll_region (GnomeCanvas *canvas, gboolean center_scro /** * gnome_canvas_get_center_scroll_region: * @canvas: A canvas. - * + * * Returns whether the canvas is set to center the scrolling region in the window * if the former is smaller than the canvas' allocation. - * + * * Return value: Whether the scroll region is being centered in the canvas window. **/ gboolean @@ -3495,14 +3533,14 @@ gnome_canvas_get_center_scroll_region (GnomeCanvas *canvas) * window is used as the anchor point. **/ void -gnome_canvas_set_pixels_per_unit (GnomeCanvas *canvas, double n) +gnome_canvas_set_pixels_per_unit (GnomeCanvas *canvas, gdouble n) { GtkLayout *layout; GtkAdjustment *hadjustment; GtkAdjustment *vadjustment; - double ax, ay; - int x1, y1; - int anchor_x, anchor_y; + gdouble ax, ay; + gint x1, y1; + gint anchor_x, anchor_y; g_return_if_fail (GNOME_IS_CANVAS (canvas)); g_return_if_fail (n > GNOME_CANVAS_EPSILON); @@ -3522,17 +3560,21 @@ gnome_canvas_set_pixels_per_unit (GnomeCanvas *canvas, double n) anchor_x = anchor_y = 0; /* Find the coordinates of the anchor point in units. */ - if(hadjustment) { + if (hadjustment) { gdouble value = gtk_adjustment_get_value (hadjustment); - ax = (value + anchor_x) / canvas->pixels_per_unit + canvas->scroll_x1 + canvas->zoom_xofs; + ax = (value + anchor_x) / canvas->pixels_per_unit + + canvas->scroll_x1 + canvas->zoom_xofs; } else { - ax = (0.0 + anchor_x) / canvas->pixels_per_unit + canvas->scroll_x1 + canvas->zoom_xofs; + ax = (0.0 + anchor_x) / canvas->pixels_per_unit + + canvas->scroll_x1 + canvas->zoom_xofs; } - if(vadjustment) { + if (vadjustment) { gdouble value = gtk_adjustment_get_value (vadjustment); - ay = (value + anchor_y) / canvas->pixels_per_unit + canvas->scroll_y1 + canvas->zoom_yofs; + ay = (value + anchor_y) / canvas->pixels_per_unit + + canvas->scroll_y1 + canvas->zoom_yofs; } else { - ay = (0.0 + anchor_y) / canvas->pixels_per_unit + canvas->scroll_y1 + canvas->zoom_yofs; + ay = (0.0 + anchor_y) / canvas->pixels_per_unit + + canvas->scroll_y1 + canvas->zoom_yofs; } /* Now calculate the new offset of the upper left corner. */ @@ -3563,7 +3605,7 @@ gnome_canvas_set_pixels_per_unit (GnomeCanvas *canvas, double n) * scrollbars to the canvas layout's scrolling adjusments. **/ void -gnome_canvas_scroll_to (GnomeCanvas *canvas, int cx, int cy) +gnome_canvas_scroll_to (GnomeCanvas *canvas, gint cx, gint cy) { g_return_if_fail (GNOME_IS_CANVAS (canvas)); @@ -3580,7 +3622,7 @@ gnome_canvas_scroll_to (GnomeCanvas *canvas, int cx, int cy) * pixel units. **/ void -gnome_canvas_get_scroll_offsets (GnomeCanvas *canvas, int *cx, int *cy) +gnome_canvas_get_scroll_offsets (GnomeCanvas *canvas, gint *cx, gint *cy) { GtkLayout *layout; GtkAdjustment *adjustment; @@ -3637,18 +3679,18 @@ gnome_canvas_update_now (GnomeCanvas *canvas) * coordinates. **/ GnomeCanvasItem * -gnome_canvas_get_item_at (GnomeCanvas *canvas, double x, double y) +gnome_canvas_get_item_at (GnomeCanvas *canvas, gdouble x, gdouble y) { GnomeCanvasItem *item; - double dist; - int cx, cy; + gdouble dist; + gint cx, cy; g_return_val_if_fail (GNOME_IS_CANVAS (canvas), NULL); gnome_canvas_w2c (canvas, x, y, &cx, &cy); dist = gnome_canvas_item_invoke_point (canvas->root, x, y, cx, cy, &item); - if ((int) (dist * canvas->pixels_per_unit + 0.5) <= canvas->close_enough) + if ((gint) (dist * canvas->pixels_per_unit + 0.5) <= canvas->close_enough) return item; else return NULL; @@ -3681,11 +3723,11 @@ uta_union_clip (ArtUta *uta1, ArtUta *uta2, ArtIRect *clip) { ArtUta *uta; ArtUtaBbox *utiles; - int clip_x1, clip_y1, clip_x2, clip_y2; - int union_x1, union_y1, union_x2, union_y2; - int new_x1, new_y1, new_x2, new_y2; - int x, y; - int ofs, ofs1, ofs2; + gint clip_x1, clip_y1, clip_x2, clip_y2; + gint union_x1, union_y1, union_x2, union_y2; + gint new_x1, new_y1, new_x2, new_y2; + gint x, y; + gint ofs, ofs1, ofs2; g_assert (clip != NULL); @@ -3872,7 +3914,6 @@ gnome_canvas_request_redraw_uta (GnomeCanvas *canvas, } } - /** * gnome_canvas_request_redraw: * @canvas: A canvas. @@ -3887,7 +3928,7 @@ gnome_canvas_request_redraw_uta (GnomeCanvas *canvas, * @x1 and @y1, but not @x2 and @y2. To be used only by item implementations. **/ void -gnome_canvas_request_redraw (GnomeCanvas *canvas, int x1, int y1, int x2, int y2) +gnome_canvas_request_redraw (GnomeCanvas *canvas, gint x1, gint y1, gint x2, gint y2) { ArtUta *uta; ArtIRect bbox; @@ -3914,7 +3955,6 @@ gnome_canvas_request_redraw (GnomeCanvas *canvas, int x1, int y1, int x2, int y2 } } - /** * gnome_canvas_w2c_affine: * @canvas: A canvas. @@ -3924,9 +3964,9 @@ gnome_canvas_request_redraw (GnomeCanvas *canvas, int x1, int y1, int x2, int y2 * pixel coordinates. **/ void -gnome_canvas_w2c_affine (GnomeCanvas *canvas, double affine[6]) +gnome_canvas_w2c_affine (GnomeCanvas *canvas, gdouble affine[6]) { - double zooom; + gdouble zooom; g_return_if_fail (GNOME_IS_CANVAS (canvas)); g_return_if_fail (affine != NULL); @@ -3952,9 +3992,9 @@ gnome_canvas_w2c_affine (GnomeCanvas *canvas, double affine[6]) * Converts world coordinates into canvas pixel coordinates. **/ void -gnome_canvas_w2c (GnomeCanvas *canvas, double wx, double wy, int *cx, int *cy) +gnome_canvas_w2c (GnomeCanvas *canvas, gdouble wx, gdouble wy, gint *cx, gint *cy) { - double affine[6]; + gdouble affine[6]; ArtPoint w, c; g_return_if_fail (GNOME_IS_CANVAS (canvas)); @@ -3982,9 +4022,13 @@ gnome_canvas_w2c (GnomeCanvas *canvas, double wx, double wy, int *cx, int *cy) * greater precision. **/ void -gnome_canvas_w2c_d (GnomeCanvas *canvas, double wx, double wy, double *cx, double *cy) +gnome_canvas_w2c_d (GnomeCanvas *canvas, + gdouble wx, + gdouble wy, + gdouble *cx, + gdouble *cy) { - double affine[6]; + gdouble affine[6]; ArtPoint w, c; g_return_if_fail (GNOME_IS_CANVAS (canvas)); @@ -3999,7 +4043,6 @@ gnome_canvas_w2c_d (GnomeCanvas *canvas, double wx, double wy, double *cx, doubl *cy = c.y; } - /** * gnome_canvas_c2w: * @canvas: A canvas. @@ -4011,9 +4054,9 @@ gnome_canvas_w2c_d (GnomeCanvas *canvas, double wx, double wy, double *cx, doubl * Converts canvas pixel coordinates to world coordinates. **/ void -gnome_canvas_c2w (GnomeCanvas *canvas, int cx, int cy, double *wx, double *wy) +gnome_canvas_c2w (GnomeCanvas *canvas, gint cx, gint cy, gdouble *wx, gdouble *wy) { - double affine[6], inv[6]; + gdouble affine[6], inv[6]; ArtPoint w, c; g_return_if_fail (GNOME_IS_CANVAS (canvas)); @@ -4029,7 +4072,6 @@ gnome_canvas_c2w (GnomeCanvas *canvas, int cx, int cy, double *wx, double *wy) *wy = w.y; } - /** * gnome_canvas_window_to_world: * @canvas: A canvas. @@ -4043,8 +4085,8 @@ gnome_canvas_c2w (GnomeCanvas *canvas, int cx, int cy, double *wx, double *wy) * example. **/ void -gnome_canvas_window_to_world (GnomeCanvas *canvas, double winx, double winy, - double *worldx, double *worldy) +gnome_canvas_window_to_world (GnomeCanvas *canvas, gdouble winx, gdouble winy, + gdouble *worldx, gdouble *worldy) { g_return_if_fail (GNOME_IS_CANVAS (canvas)); @@ -4057,7 +4099,6 @@ gnome_canvas_window_to_world (GnomeCanvas *canvas, double winx, double winy, / canvas->pixels_per_unit); } - /** * gnome_canvas_world_to_window: * @canvas: A canvas. @@ -4069,8 +4110,8 @@ gnome_canvas_window_to_world (GnomeCanvas *canvas, double winx, double winy, * Converts world coordinates into window-relative coordinates. **/ void -gnome_canvas_world_to_window (GnomeCanvas *canvas, double worldx, double worldy, - double *winx, double *winy) +gnome_canvas_world_to_window (GnomeCanvas *canvas, gdouble worldx, gdouble worldy, + gdouble *winx, gdouble *winy) { g_return_if_fail (GNOME_IS_CANVAS (canvas)); @@ -4081,8 +4122,6 @@ gnome_canvas_world_to_window (GnomeCanvas *canvas, double worldx, double worldy, *winy = (canvas->pixels_per_unit)*(worldy - canvas->scroll_y1) + canvas->zoom_yofs; } - - /** * gnome_canvas_get_color: * @canvas: A canvas. @@ -4097,8 +4136,8 @@ gnome_canvas_world_to_window (GnomeCanvas *canvas, double worldx, double worldy, * Return value: TRUE if @spec is non-NULL and the color is allocated. If @spec * is NULL, then returns FALSE. **/ -int -gnome_canvas_get_color (GnomeCanvas *canvas, const char *spec, GdkColor *color) +gint +gnome_canvas_get_color (GnomeCanvas *canvas, const gchar *spec, GdkColor *color) { GdkColormap *colormap; @@ -4152,7 +4191,6 @@ gnome_canvas_get_color_pixel (GnomeCanvas *canvas, guint rgba) return color.pixel; } - /** * gnome_canvas_set_stipple_origin: * @canvas: A canvas. @@ -4194,7 +4232,7 @@ gnome_canvas_set_dither (GnomeCanvas *canvas, GdkRgbDither dither) * @canvas: A canvas. * * Returns the type of dithering used to render an antialiased canvas. - * + * * Return value: The dither setting. **/ GdkRgbDither @@ -4213,11 +4251,11 @@ boolean_handled_accumulator (GSignalInvocationHint *ihint, { gboolean continue_emission; gboolean signal_handled; - + signal_handled = g_value_get_boolean (handler_return); g_value_set_boolean (return_accu, signal_handled); continue_emission = !signal_handled; - + return continue_emission; } diff --git a/libgnomecanvas/gnome-canvas.h b/libgnomecanvas/gnome-canvas.h index 559bd9c8fb..7d01321ff3 100644 --- a/libgnomecanvas/gnome-canvas.h +++ b/libgnomecanvas/gnome-canvas.h @@ -47,11 +47,9 @@ G_BEGIN_DECLS - /* "Small" value used by canvas stuff */ #define GNOME_CANVAS_EPSILON 1e-10 - /* Macros for building colors that fit in a 32-bit integer. The values are in * [0, 255]. */ @@ -64,8 +62,7 @@ G_BEGIN_DECLS #define GNOME_CANVAS_COLOR_A(r, g, b, a) ((((unsigned int) (r) & 0xff) << 24) \ | (((unsigned int) (g) & 0xff) << 16) \ | (((unsigned int) (b) & 0xff) << 8) \ - | ((unsigned int) (a) & 0xff)) - + | ((guint) (a) & 0xff)) typedef struct _GnomeCanvas GnomeCanvas; typedef struct _GnomeCanvasClass GnomeCanvasClass; @@ -74,7 +71,6 @@ typedef struct _GnomeCanvasItemClass GnomeCanvasItemClass; typedef struct _GnomeCanvasGroup GnomeCanvasGroup; typedef struct _GnomeCanvasGroupClass GnomeCanvasGroupClass; - /* GnomeCanvasItem - base item class for canvas items * * All canvas items are derived from GnomeCanvasItem. The only information a @@ -120,7 +116,7 @@ typedef struct { ArtIRect rect; /* Rowstride for the buffer */ - int buf_rowstride; + gint buf_rowstride; /* Background color, given as 0xrrggbb */ guint32 bg_color; @@ -128,13 +124,12 @@ typedef struct { /* Invariant: at least one of the following flags is true. */ /* Set when the render rectangle area is the solid color bg_color */ - unsigned int is_bg : 1; + guint is_bg : 1; /* Set when the render rectangle area is represented by the buf */ - unsigned int is_buf : 1; + guint is_buf : 1; } GnomeCanvasBuf; - #define GNOME_TYPE_CANVAS_ITEM (gnome_canvas_item_get_type ()) #define GNOME_CANVAS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS_ITEM, GnomeCanvasItem)) #define GNOME_CANVAS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_ITEM, GnomeCanvasItemClass)) @@ -142,7 +137,6 @@ typedef struct { #define GNOME_IS_CANVAS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_ITEM)) #define GNOME_CANVAS_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_ITEM, GnomeCanvasItemClass)) - struct _GnomeCanvasItem { GtkObject object; @@ -157,10 +151,10 @@ struct _GnomeCanvasItem { * flags contains AFFINE_FULL, a six-element array containing an affine * transformation. */ - double *xform; + gdouble *xform; /* Bounding box for this item (in canvas coordinates) */ - double x1, y1, x2, y2; + gdouble x1, y1, x2, y2; /* XXX GtkObject flags are sealed now, so we have to provide * our own. This breaks ABI compatibility with upstream. */ @@ -176,7 +170,7 @@ struct _GnomeCanvasItemClass { * affine, if used, is a pointer to a 6-element array of doubles. The * update method also recomputes the bounding box of the item. */ - void (* update) (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags); + void (* update) (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags); /* Realize an item -- create GCs, etc. */ void (* realize) (GnomeCanvasItem *item); @@ -198,7 +192,7 @@ struct _GnomeCanvasItemClass { * drawn. (width, height) are the dimensions of the drawable. */ void (* draw) (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); + gint x, gint y, gint width, gint height); /* Render the item over the buffer given. The buf data structure * contains both a pointer to a packed 24-bit RGB array, and the @@ -214,13 +208,13 @@ struct _GnomeCanvasItemClass { * being a canvas group. (cx, cy) are the canvas pixel coordinates that * correspond to the item-relative coordinates (x, y). */ - double (* point) (GnomeCanvasItem *item, double x, double y, int cx, int cy, + gdouble (* point) (GnomeCanvasItem *item, gdouble x, gdouble y, gint cx, gint cy, GnomeCanvasItem **actual_item); /* Fetch the item's bounding box (need not be exactly tight). This * should be in item-relative coordinates. */ - void (* bounds) (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2); + void (* bounds) (GnomeCanvasItem *item, gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2); /* Signal: an event occurred for an item of this type. The (x, y) * coordinates are in the canvas world coordinate system. @@ -231,7 +225,6 @@ struct _GnomeCanvasItemClass { gpointer spare_vmethods [4]; }; - GType gnome_canvas_item_get_type (void) G_GNUC_CONST; /* Create a canvas item using the standard Gtk argument mechanism. The item is @@ -255,23 +248,23 @@ void gnome_canvas_item_set_valist (GnomeCanvasItem *item, const gchar *first_arg_name, va_list args); /* Move an item by the specified amount */ -void gnome_canvas_item_move (GnomeCanvasItem *item, double dx, double dy); +void gnome_canvas_item_move (GnomeCanvasItem *item, gdouble dx, gdouble dy); /* Apply a relative affine transformation to the item. */ -void gnome_canvas_item_affine_relative (GnomeCanvasItem *item, const double affine[6]); +void gnome_canvas_item_affine_relative (GnomeCanvasItem *item, const gdouble affine[6]); /* Apply an absolute affine transformation to the item. */ -void gnome_canvas_item_affine_absolute (GnomeCanvasItem *item, const double affine[6]); +void gnome_canvas_item_affine_absolute (GnomeCanvasItem *item, const gdouble affine[6]); /* Raise an item in the z-order of its parent group by the specified number of * positions. */ -void gnome_canvas_item_raise (GnomeCanvasItem *item, int positions); +void gnome_canvas_item_raise (GnomeCanvasItem *item, gint positions); /* Lower an item in the z-order of its parent group by the specified number of * positions. */ -void gnome_canvas_item_lower (GnomeCanvasItem *item, int positions); +void gnome_canvas_item_lower (GnomeCanvasItem *item, gint positions); /* Raise an item to the top of its parent group's z-order. */ void gnome_canvas_item_raise_to_top (GnomeCanvasItem *item); @@ -294,7 +287,7 @@ void gnome_canvas_item_hide (GnomeCanvasItem *item); * grab. Time is a proper X event time parameter. Returns the same values as * XGrabPointer(). */ -int gnome_canvas_item_grab (GnomeCanvasItem *item, unsigned int event_mask, +gint gnome_canvas_item_grab (GnomeCanvasItem *item, guint event_mask, GdkCursor *cursor, guint32 etime); /* Ungrabs the mouse -- the specified item must be the same that was passed to @@ -305,24 +298,24 @@ void gnome_canvas_item_ungrab (GnomeCanvasItem *item, guint32 etime); /* These functions convert from a coordinate system to another. "w" is world * coordinates and "i" is item coordinates. */ -void gnome_canvas_item_w2i (GnomeCanvasItem *item, double *x, double *y); -void gnome_canvas_item_i2w (GnomeCanvasItem *item, double *x, double *y); +void gnome_canvas_item_w2i (GnomeCanvasItem *item, gdouble *x, gdouble *y); +void gnome_canvas_item_i2w (GnomeCanvasItem *item, gdouble *x, gdouble *y); /* Gets the affine transform that converts from item-relative coordinates to * world coordinates. */ -void gnome_canvas_item_i2w_affine (GnomeCanvasItem *item, double affine[6]); +void gnome_canvas_item_i2w_affine (GnomeCanvasItem *item, gdouble affine[6]); /* Gets the affine transform that converts from item-relative coordinates to * canvas pixel coordinates. */ -void gnome_canvas_item_i2c_affine (GnomeCanvasItem *item, double affine[6]); +void gnome_canvas_item_i2c_affine (GnomeCanvasItem *item, gdouble affine[6]); /* Remove the item from its parent group and make the new group its parent. The * item will be put on top of all the items in the new group. The item's * coordinates relative to its new parent to *not* change -- this means that the * item could potentially move on the screen. - * + * * The item and the group must be in the same canvas. An item cannot be * reparented to a group that is the item itself or that is an inferior of the * item. @@ -339,14 +332,13 @@ void gnome_canvas_item_grab_focus (GnomeCanvasItem *item); * box is in the coordinate system of the item's parent. */ void gnome_canvas_item_get_bounds (GnomeCanvasItem *item, - double *x1, double *y1, double *x2, double *y2); + gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2); /* Request that the update method eventually get called. This should be used * only by item implementations. */ void gnome_canvas_item_request_update (GnomeCanvasItem *item); - /* GnomeCanvasGroup - a group of canvas items * * A group is a node in the hierarchical tree of groups/items inside a canvas. @@ -363,11 +355,10 @@ void gnome_canvas_item_request_update (GnomeCanvasItem *item); * * name type read/write description * -------------------------------------------------------------------------------- - * x double RW X coordinate of group's origin - * y double RW Y coordinate of group's origin + * x gdouble RW X coordinate of group's origin + * y gdouble RW Y coordinate of group's origin */ - #define GNOME_TYPE_CANVAS_GROUP (gnome_canvas_group_get_type ()) #define GNOME_CANVAS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS_GROUP, GnomeCanvasGroup)) #define GNOME_CANVAS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_GROUP, GnomeCanvasGroupClass)) @@ -375,7 +366,6 @@ void gnome_canvas_item_request_update (GnomeCanvasItem *item); #define GNOME_IS_CANVAS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_GROUP)) #define GNOME_CANVAS_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_GROUP, GnomeCanvasGroupClass)) - struct _GnomeCanvasGroup { GnomeCanvasItem item; @@ -388,13 +378,10 @@ struct _GnomeCanvasGroupClass { GnomeCanvasItemClass parent_class; }; - GType gnome_canvas_group_get_type (void) G_GNUC_CONST; - /*** GnomeCanvas ***/ - #define GNOME_TYPE_CANVAS (gnome_canvas_get_type ()) #define GNOME_CANVAS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS, GnomeCanvas)) #define GNOME_CANVAS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS, GnomeCanvasClass)) @@ -402,7 +389,6 @@ GType gnome_canvas_group_get_type (void) G_GNUC_CONST; #define GNOME_IS_CANVAS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS)) #define GNOME_CANVAS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS, GnomeCanvasClass)) - struct _GnomeCanvas { GtkLayout layout; @@ -431,11 +417,11 @@ struct _GnomeCanvas { GdkEvent pick_event; /* Scrolling region */ - double scroll_x1, scroll_y1; - double scroll_x2, scroll_y2; + gdouble scroll_x1, scroll_y1; + gdouble scroll_x2, scroll_y2; /* Scaling factor to be used for display */ - double pixels_per_unit; + gdouble pixels_per_unit; /* Idle handler ID */ guint idle_id; @@ -446,46 +432,46 @@ struct _GnomeCanvas { /* Area that is being redrawn. Contains (x1, y1) but not (x2, y2). * Specified in canvas pixel coordinates. */ - int redraw_x1, redraw_y1; - int redraw_x2, redraw_y2; + gint redraw_x1, redraw_y1; + gint redraw_x2, redraw_y2; /* Offsets of the temprary drawing pixmap */ - int draw_xofs, draw_yofs; + gint draw_xofs, draw_yofs; /* Internal pixel offsets when zoomed out */ - int zoom_xofs, zoom_yofs; + gint zoom_xofs, zoom_yofs; /* Last known modifier state, for deferred repick when a button is down */ - int state; + gint state; /* Event mask specified when grabbing an item */ guint grabbed_event_mask; /* Tolerance distance for picking items */ - int close_enough; + gint close_enough; /* Whether the canvas should center the scroll region in the middle of * the window if the scroll region is smaller than the window. */ - unsigned int center_scroll_region : 1; + guint center_scroll_region : 1; /* Whether items need update at next idle loop iteration */ - unsigned int need_update : 1; + guint need_update : 1; /* Whether the canvas needs redrawing at the next idle loop iteration */ - unsigned int need_redraw : 1; + guint need_redraw : 1; /* Whether current item will be repicked at next idle loop iteration */ - unsigned int need_repick : 1; + guint need_repick : 1; /* For use by internal pick_current_item() function */ - unsigned int left_grabbed_item : 1; + guint left_grabbed_item : 1; /* For use by internal pick_current_item() function */ - unsigned int in_repick : 1; + guint in_repick : 1; /* Whether the canvas is in antialiased mode or not */ - unsigned int aa : 1; + guint aa : 1; /* Which dither mode to use for antialiased mode drawing */ GdkRgbDither dither; @@ -498,7 +484,7 @@ struct _GnomeCanvasClass { * for non-antialiased canvases. */ void (* draw_background) (GnomeCanvas *canvas, GdkDrawable *drawable, - int x, int y, int width, int height); + gint x, gint y, gint width, gint height); /* Render the background for the buffer given. The buf data structure * contains both a pointer to a packed 24-bit RGB array, and the @@ -513,7 +499,6 @@ struct _GnomeCanvasClass { gpointer spare_vmethods [4]; }; - GType gnome_canvas_get_type (void) G_GNUC_CONST; /* Creates a new canvas. You should check that the canvas is created with the @@ -537,11 +522,11 @@ GnomeCanvasGroup *gnome_canvas_root (GnomeCanvas *canvas); /* Sets the limits of the scrolling region, in world coordinates */ void gnome_canvas_set_scroll_region (GnomeCanvas *canvas, - double x1, double y1, double x2, double y2); + gdouble x1, gdouble y1, gdouble x2, gdouble y2); /* Gets the limits of the scrolling region, in world coordinates */ void gnome_canvas_get_scroll_region (GnomeCanvas *canvas, - double *x1, double *y1, double *x2, double *y2); + gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2); /* Whether the canvas centers the scroll region if it is smaller than the window */ void gnome_canvas_set_center_scroll_region (GnomeCanvas *canvas, gboolean center_scroll_region); @@ -550,16 +535,16 @@ void gnome_canvas_set_center_scroll_region (GnomeCanvas *canvas, gboolean center gboolean gnome_canvas_get_center_scroll_region (GnomeCanvas *canvas); /* Sets the number of pixels that correspond to one unit in world coordinates */ -void gnome_canvas_set_pixels_per_unit (GnomeCanvas *canvas, double n); +void gnome_canvas_set_pixels_per_unit (GnomeCanvas *canvas, gdouble n); /* Scrolls the canvas to the specified offsets, given in canvas pixel coordinates */ -void gnome_canvas_scroll_to (GnomeCanvas *canvas, int cx, int cy); +void gnome_canvas_scroll_to (GnomeCanvas *canvas, gint cx, gint cy); /* Returns the scroll offsets of the canvas in canvas pixel coordinates. You * can specify NULL for any of the values, in which case that value will not be * queried. */ -void gnome_canvas_get_scroll_offsets (GnomeCanvas *canvas, int *cx, int *cy); +void gnome_canvas_get_scroll_offsets (GnomeCanvas *canvas, gint *cx, gint *cy); /* Requests that the canvas be repainted immediately instead of in the idle * loop. @@ -569,7 +554,7 @@ void gnome_canvas_update_now (GnomeCanvas *canvas); /* Returns the item that is at the specified position in world coordinates, or * NULL if no item is there. */ -GnomeCanvasItem *gnome_canvas_get_item_at (GnomeCanvas *canvas, double x, double y); +GnomeCanvasItem *gnome_canvas_get_item_at (GnomeCanvas *canvas, gdouble x, gdouble y); /* For use only by item type implementations. Request that the canvas eventually * redraw the specified region. The region is specified as a microtile @@ -581,42 +566,41 @@ void gnome_canvas_request_redraw_uta (GnomeCanvas *canvas, ArtUta *uta); * eventually redraw the specified region, specified in canvas pixel * coordinates. The region contains (x1, y1) but not (x2, y2). */ -void gnome_canvas_request_redraw (GnomeCanvas *canvas, int x1, int y1, int x2, int y2); +void gnome_canvas_request_redraw (GnomeCanvas *canvas, gint x1, gint y1, gint x2, gint y2); /* Gets the affine transform that converts world coordinates into canvas pixel * coordinates. */ -void gnome_canvas_w2c_affine (GnomeCanvas *canvas, double affine[6]); +void gnome_canvas_w2c_affine (GnomeCanvas *canvas, gdouble affine[6]); /* These functions convert from a coordinate system to another. "w" is world * coordinates, "c" is canvas pixel coordinates (pixel coordinates that are * (0,0) for the upper-left scrolling limit and something else for the * lower-left scrolling limit). */ -void gnome_canvas_w2c (GnomeCanvas *canvas, double wx, double wy, int *cx, int *cy); -void gnome_canvas_w2c_d (GnomeCanvas *canvas, double wx, double wy, double *cx, double *cy); -void gnome_canvas_c2w (GnomeCanvas *canvas, int cx, int cy, double *wx, double *wy); +void gnome_canvas_w2c (GnomeCanvas *canvas, gdouble wx, gdouble wy, gint *cx, gint *cy); +void gnome_canvas_w2c_d (GnomeCanvas *canvas, gdouble wx, gdouble wy, gdouble *cx, gdouble *cy); +void gnome_canvas_c2w (GnomeCanvas *canvas, gint cx, gint cy, gdouble *wx, gdouble *wy); /* This function takes in coordinates relative to the GTK_LAYOUT * (canvas)->bin_window and converts them to world coordinates. */ void gnome_canvas_window_to_world (GnomeCanvas *canvas, - double winx, double winy, double *worldx, double *worldy); + gdouble winx, gdouble winy, gdouble *worldx, gdouble *worldy); /* This is the inverse of gnome_canvas_window_to_world() */ void gnome_canvas_world_to_window (GnomeCanvas *canvas, - double worldx, double worldy, double *winx, double *winy); + gdouble worldx, gdouble worldy, gdouble *winx, gdouble *winy); /* Takes a string specification for a color and allocates it into the specified * GdkColor. If the string is null, then it returns FALSE. Otherwise, it * returns TRUE. */ -int gnome_canvas_get_color (GnomeCanvas *canvas, const char *spec, GdkColor *color); +gint gnome_canvas_get_color (GnomeCanvas *canvas, const gchar *spec, GdkColor *color); /* Allocates a color from the RGB value passed into this function. */ gulong gnome_canvas_get_color_pixel (GnomeCanvas *canvas, guint rgba); - /* Sets the stipple origin of the specified gc so that it will be aligned with * all the stipples used in the specified canvas. This is intended for use only diff --git a/libgnomecanvas/libgnomecanvastypes.c b/libgnomecanvas/libgnomecanvastypes.c index 9ea59664c8..c7c4fcf3cf 100644 --- a/libgnomecanvas/libgnomecanvastypes.c +++ b/libgnomecanvas/libgnomecanvastypes.c @@ -35,7 +35,7 @@ gnome_canvas_points_get_type (void) if (!type_canvas_points) type_canvas_points = g_boxed_type_register_static - ("GnomeCanvasPoints", + ("GnomeCanvasPoints", (GBoxedCopyFunc) gnome_canvas_points_ref, (GBoxedFreeFunc) gnome_canvas_points_unref); |