aboutsummaryrefslogtreecommitdiffstats
path: root/libgnomecanvas
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-10-25 22:36:27 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-27 01:31:26 +0800
commit5d812173d0e4e12a74bce2ee137d04b0e56db827 (patch)
tree3e86f53297ae3f0e5c61385c9fa430ca1bb05373 /libgnomecanvas
parentde12bb89a800991bd63ce09ae42b04e1f7903198 (diff)
downloadgsoc2013-evolution-5d812173d0e4e12a74bce2ee137d04b0e56db827.tar
gsoc2013-evolution-5d812173d0e4e12a74bce2ee137d04b0e56db827.tar.gz
gsoc2013-evolution-5d812173d0e4e12a74bce2ee137d04b0e56db827.tar.bz2
gsoc2013-evolution-5d812173d0e4e12a74bce2ee137d04b0e56db827.tar.lz
gsoc2013-evolution-5d812173d0e4e12a74bce2ee137d04b0e56db827.tar.xz
gsoc2013-evolution-5d812173d0e4e12a74bce2ee137d04b0e56db827.tar.zst
gsoc2013-evolution-5d812173d0e4e12a74bce2ee137d04b0e56db827.zip
Drop usage of GtkAnchorType.
gtk+-3.0 removed it for being "unused".
Diffstat (limited to 'libgnomecanvas')
-rw-r--r--libgnomecanvas/gnome-canvas-pixbuf.c70
-rw-r--r--libgnomecanvas/gnome-canvas-rich-text.c85
-rw-r--r--libgnomecanvas/gnome-canvas-text.c111
-rw-r--r--libgnomecanvas/gnome-canvas-text.h2
-rw-r--r--libgnomecanvas/gnome-canvas-widget.c111
-rw-r--r--libgnomecanvas/gnome-canvas-widget.h2
6 files changed, 7 insertions, 374 deletions
diff --git a/libgnomecanvas/gnome-canvas-pixbuf.c b/libgnomecanvas/gnome-canvas-pixbuf.c
index 3ea3f647be..9ae353b1f8 100644
--- a/libgnomecanvas/gnome-canvas-pixbuf.c
+++ b/libgnomecanvas/gnome-canvas-pixbuf.c
@@ -59,9 +59,6 @@ typedef struct {
/* Whether the transformation or size have changed */
guint need_xform_update : 1;
-
- /* Anchor */
- GtkAnchorType anchor;
} PixbufPrivate;
/* Object argument IDs */
@@ -77,8 +74,7 @@ enum {
PROP_X,
PROP_X_IN_PIXELS,
PROP_Y,
- PROP_Y_IN_PIXELS,
- PROP_ANCHOR
+ PROP_Y_IN_PIXELS
};
static void gnome_canvas_pixbuf_class_init (GnomeCanvasPixbufClass *class);
@@ -227,13 +223,6 @@ gnome_canvas_pixbuf_class_init (GnomeCanvasPixbufClass *class)
g_param_spec_boolean ("y_in_pixels", NULL, NULL,
FALSE,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
- g_object_class_install_property
- (gobject_class,
- PROP_ANCHOR,
- g_param_spec_enum ("anchor", NULL, NULL,
- GTK_TYPE_ANCHOR_TYPE,
- GTK_ANCHOR_NW,
- (G_PARAM_READABLE | G_PARAM_WRITABLE)));
item_class->destroy = gnome_canvas_pixbuf_destroy;
item_class->update = gnome_canvas_pixbuf_update;
@@ -256,7 +245,6 @@ gnome_canvas_pixbuf_init (GnomeCanvasPixbuf *gcp)
priv->height = 0.0;
priv->x = 0.0;
priv->y = 0.0;
- priv->anchor = GTK_ANCHOR_NW;
}
/* Destroy handler for the pixbuf canvas item */
@@ -406,12 +394,6 @@ gnome_canvas_pixbuf_set_property (GObject *object,
gnome_canvas_item_request_update (item);
break;
- case PROP_ANCHOR:
- priv->anchor = g_value_get_enum (value);
- priv->need_xform_update = TRUE;
- gnome_canvas_item_request_update (item);
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -479,10 +461,6 @@ gnome_canvas_pixbuf_get_property (GObject *object,
g_value_set_boolean (value, priv->y_in_pixels);
break;
- case PROP_ANCHOR:
- g_value_set_enum (value, priv->anchor);
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -595,29 +573,6 @@ compute_viewport_affine (GnomeCanvasPixbuf *gcp,
} else
ti_len = 1.0;
- switch (priv->anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_SW:
- ti_len *= x;
- break;
-
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_S:
- ti_len *= x - w * si_len / 2;
- break;
-
- case GTK_ANCHOR_NE:
- case GTK_ANCHOR_E:
- case GTK_ANCHOR_SE:
- ti_len *= x - w * si_len;
- break;
-
- default:
- break;
- }
-
if (priv->y_in_pixels) {
if (j_len > GNOME_CANVAS_EPSILON)
tj_len = 1.0 / j_len;
@@ -626,29 +581,6 @@ compute_viewport_affine (GnomeCanvasPixbuf *gcp,
} else
tj_len = 1.0;
- switch (priv->anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_NE:
- tj_len *= y;
- break;
-
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_E:
- tj_len *= y - h * sj_len / 2;
- break;
-
- case GTK_ANCHOR_SW:
- case GTK_ANCHOR_S:
- case GTK_ANCHOR_SE:
- tj_len *= y - h * sj_len;
- break;
-
- default:
- break;
- }
-
/* Compute the final affine */
art_affine_scale (scale, si_len, sj_len);
diff --git a/libgnomecanvas/gnome-canvas-rich-text.c b/libgnomecanvas/gnome-canvas-rich-text.c
index bd988ae3f5..2decb1dfbf 100644
--- a/libgnomecanvas/gnome-canvas-rich-text.c
+++ b/libgnomecanvas/gnome-canvas-rich-text.c
@@ -58,7 +58,6 @@ struct _GnomeCanvasRichTextPrivate {
GtkWrapMode wrap_mode;
GtkJustification justification;
GtkTextDirection direction;
- GtkAnchorType anchor;
gint pixels_above_lines;
gint pixels_below_lines;
gint pixels_inside_wrap;
@@ -316,15 +315,6 @@ gnome_canvas_rich_text_class_init (GnomeCanvasRichTextClass *klass)
G_PARAM_READWRITE));
g_object_class_install_property (
gobject_class,
- PROP_ANCHOR,
- g_param_spec_enum ("anchor",
- "Anchor",
- "Anchor point for text",
- GTK_TYPE_ANCHOR_TYPE,
- GTK_ANCHOR_NW,
- G_PARAM_READWRITE));
- g_object_class_install_property (
- gobject_class,
PROP_PIXELS_ABOVE_LINES,
g_param_spec_int ("pixels_above_lines",
"Pixels Above Lines",
@@ -418,7 +408,6 @@ gnome_canvas_rich_text_init (GnomeCanvasRichText *text)
text->_priv->wrap_mode = GTK_WRAP_WORD;
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;
@@ -531,9 +520,6 @@ gnome_canvas_rich_text_set_property (GObject *object, guint property_id,
gtk_text_layout_default_style_changed (text->_priv->layout);
}
break;
- case PROP_ANCHOR:
- text->_priv->anchor = g_value_get_enum (value);
- break;
case PROP_PIXELS_ABOVE_LINES:
text->_priv->pixels_above_lines = g_value_get_int (value);
@@ -639,9 +625,6 @@ gnome_canvas_rich_text_get_property (GObject *object, guint property_id,
case PROP_DIRECTION:
g_value_set_enum (value, text->_priv->direction);
break;
- case PROP_ANCHOR:
- g_value_set_enum (value, text->_priv->anchor);
- break;
case PROP_PIXELS_ABOVE_LINES:
g_value_set_enum (value, text->_priv->pixels_above_lines);
break;
@@ -1969,65 +1952,6 @@ gnome_canvas_rich_text_destroy_layout (GnomeCanvasRichText *text)
} /* gnome_canvas_rich_text_destroy_layout */
static void
-adjust_for_anchors (GnomeCanvasRichText *text, gdouble *ax, gdouble *ay)
-{
- gdouble x, y;
-
- x = text->_priv->x;
- y = text->_priv->y;
-
- /* Anchor text */
- /* X coordinates */
- switch (text->_priv->anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_SW:
- break;
-
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_S:
- x -= text->_priv->width / 2;
- break;
-
- case GTK_ANCHOR_NE:
- case GTK_ANCHOR_E:
- case GTK_ANCHOR_SE:
- x -= text->_priv->width;
- break;
- default:
- break;
- }
-
- /* Y coordinates */
- switch (text->_priv->anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_NE:
- break;
-
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_E:
- y -= text->_priv->height / 2;
- break;
-
- case GTK_ANCHOR_SW:
- case GTK_ANCHOR_S:
- case GTK_ANCHOR_SE:
- y -= text->_priv->height;
- break;
- default:
- break;
- }
-
- if (ax)
- *ax = x;
- if (ay)
- *ay = y;
-} /* adjust_for_anchors */
-
-static void
get_bounds (GnomeCanvasRichText *text, gdouble *px1, gdouble *py1,
gdouble *px2, gdouble *py2)
{
@@ -2036,7 +1960,8 @@ get_bounds (GnomeCanvasRichText *text, gdouble *px1, gdouble *py1,
gdouble x1, x2, y1, y2;
gint cx1, cx2, cy1, cy2;
- adjust_for_anchors (text, &x, &y);
+ x = text->_priv->x;
+ y = text->_priv->y;
x1 = x;
y1 = y;
@@ -2099,7 +2024,8 @@ gnome_canvas_rich_text_point (GnomeCanvasItem *item, gdouble x, gdouble y,
/* This is a lame cop-out. Anywhere inside of the bounding box. */
- adjust_for_anchors (text, &ax, &ay);
+ ax = text->_priv->x;
+ ay = text->_priv->y;
x1 = ax;
y1 = ay;
@@ -2143,7 +2069,8 @@ gnome_canvas_rich_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
gnome_canvas_w2c_affine (item->canvas, w2c);
art_affine_multiply (i2c, i2w, w2c);
- adjust_for_anchors (text, &ax, &ay);
+ ax = text->_priv->x;
+ ay = text->_priv->y;
i1.x = ax;
i1.y = ay;
diff --git a/libgnomecanvas/gnome-canvas-text.c b/libgnomecanvas/gnome-canvas-text.c
index 5f7679f3aa..7b3dd0695b 100644
--- a/libgnomecanvas/gnome-canvas-text.c
+++ b/libgnomecanvas/gnome-canvas-text.c
@@ -79,7 +79,6 @@ enum {
PROP_SCALE, PROP_SCALE_SET,
/* Clipping */
- PROP_ANCHOR,
PROP_JUSTIFICATION,
PROP_CLIP_WIDTH,
PROP_CLIP_HEIGHT,
@@ -374,13 +373,6 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class)
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property
- (gobject_class,
- PROP_ANCHOR,
- g_param_spec_enum ("anchor", NULL, NULL,
- GTK_TYPE_ANCHOR_TYPE,
- GTK_ANCHOR_CENTER,
- (G_PARAM_READABLE | G_PARAM_WRITABLE)));
- g_object_class_install_property
(gobject_class,
PROP_JUSTIFICATION,
g_param_spec_enum ("justification", NULL, NULL,
@@ -527,7 +519,6 @@ gnome_canvas_text_init (GnomeCanvasText *text)
{
text->x = 0.0;
text->y = 0.0;
- text->anchor = GTK_ANCHOR_CENTER;
text->justification = GTK_JUSTIFY_LEFT;
text->clip_width = 0.0;
text->clip_height = 0.0;
@@ -619,56 +610,6 @@ get_bounds (GnomeCanvasText *text,
text->clip_cwidth = text->clip_width * item->canvas->pixels_per_unit;
text->clip_cheight = text->clip_height * item->canvas->pixels_per_unit;
- /* Anchor text */
-
- switch (text->anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_SW:
- break;
-
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_S:
- text->cx -= text->max_width / 2;
- text->clip_cx -= text->clip_cwidth / 2;
- break;
-
- case GTK_ANCHOR_NE:
- case GTK_ANCHOR_E:
- case GTK_ANCHOR_SE:
- text->cx -= text->max_width;
- text->clip_cx -= text->clip_cwidth;
- break;
-
- default:
- break;
- }
-
- switch (text->anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_NE:
- break;
-
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_E:
- text->cy -= text->height / 2;
- text->clip_cy -= text->clip_cheight / 2;
- break;
-
- case GTK_ANCHOR_SW:
- case GTK_ANCHOR_S:
- case GTK_ANCHOR_SE:
- text->cy -= text->height;
- text->clip_cy -= text->clip_cheight;
- break;
-
- default:
- break;
- }
-
/* Bounds */
if (text->clip) {
@@ -984,10 +925,6 @@ gnome_canvas_text_set_property (GObject *object,
text->priv->render_dirty = 1;
break;
- case PROP_ANCHOR:
- text->anchor = g_value_get_enum (value);
- break;
-
case PROP_JUSTIFICATION:
text->justification = g_value_get_enum (value);
@@ -1244,10 +1181,6 @@ gnome_canvas_text_get_property (GObject *object,
g_value_set_boxed (value, text->attr_list);
break;
- case PROP_ANCHOR:
- g_value_set_enum (value, text->anchor);
- break;
-
case PROP_JUSTIFICATION:
g_value_set_enum (value, text->justification);
break;
@@ -1720,50 +1653,6 @@ gnome_canvas_text_bounds (GnomeCanvasItem *item,
height = text->height / item->canvas->pixels_per_unit;
}
- switch (text->anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_SW:
- break;
-
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_S:
- *x1 -= width / 2.0;
- break;
-
- case GTK_ANCHOR_NE:
- case GTK_ANCHOR_E:
- case GTK_ANCHOR_SE:
- *x1 -= width;
- break;
-
- default:
- break;
- }
-
- switch (text->anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_NE:
- break;
-
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_E:
- *y1 -= height / 2.0;
- break;
-
- case GTK_ANCHOR_SW:
- case GTK_ANCHOR_S:
- case GTK_ANCHOR_SE:
- *y1 -= height;
- break;
-
- default:
- break;
- }
-
*x2 = *x1 + width;
*y2 = *y1 + height;
}
diff --git a/libgnomecanvas/gnome-canvas-text.h b/libgnomecanvas/gnome-canvas-text.h
index 64eda6a9d4..0d754dab4b 100644
--- a/libgnomecanvas/gnome-canvas-text.h
+++ b/libgnomecanvas/gnome-canvas-text.h
@@ -75,7 +75,6 @@ G_BEGIN_DECLS
* 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 gdouble RW Width of clip rectangle
* clip_height gdouble RW Height of clip rectangle
@@ -130,7 +129,6 @@ struct _GnomeCanvasText {
gdouble affine[6]; /* The item -> canvas affine */ /*AA*/
- GtkAnchorType anchor; /* Anchor side for text */
GtkJustification justification; /* Justification for text */
gint cx, cy; /* Top-left canvas coordinates for text */
diff --git a/libgnomecanvas/gnome-canvas-widget.c b/libgnomecanvas/gnome-canvas-widget.c
index fbcb0a6a53..85259f0ce0 100644
--- a/libgnomecanvas/gnome-canvas-widget.c
+++ b/libgnomecanvas/gnome-canvas-widget.c
@@ -43,7 +43,6 @@ enum {
PROP_Y,
PROP_WIDTH,
PROP_HEIGHT,
- PROP_ANCHOR,
PROP_SIZE_PIXELS
};
@@ -158,13 +157,6 @@ gnome_canvas_widget_class_init (GnomeCanvasWidgetClass *class)
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
g_object_class_install_property
(gobject_class,
- PROP_ANCHOR,
- g_param_spec_enum ("anchor", NULL, NULL,
- GTK_TYPE_ANCHOR_TYPE,
- GTK_ANCHOR_NW,
- (G_PARAM_READABLE | G_PARAM_WRITABLE)));
- g_object_class_install_property
- (gobject_class,
PROP_SIZE_PIXELS,
g_param_spec_boolean ("size_pixels", NULL, NULL,
FALSE,
@@ -198,7 +190,6 @@ gnome_canvas_widget_init (GnomeCanvasWidget *witem)
witem->y = 0.0;
witem->width = 0.0;
witem->height = 0.0;
- witem->anchor = GTK_ANCHOR_NW;
witem->size_pixels = FALSE;
}
@@ -240,52 +231,6 @@ recalc_bounds (GnomeCanvasWidget *witem)
gnome_canvas_w2c (item->canvas, wx, wy, &witem->cx, &witem->cy);
- /* Anchor widget item */
-
- switch (witem->anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_SW:
- break;
-
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_S:
- witem->cx -= witem->cwidth / 2;
- break;
-
- case GTK_ANCHOR_NE:
- case GTK_ANCHOR_E:
- case GTK_ANCHOR_SE:
- witem->cx -= witem->cwidth;
- break;
-
- default:
- break;
- }
-
- switch (witem->anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_NE:
- break;
-
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_E:
- witem->cy -= witem->cheight / 2;
- break;
-
- case GTK_ANCHOR_SW:
- case GTK_ANCHOR_S:
- case GTK_ANCHOR_SE:
- witem->cy -= witem->cheight;
- break;
-
- default:
- break;
- }
-
/* Bounds */
item->x1 = witem->cx;
@@ -371,14 +316,6 @@ gnome_canvas_widget_set_property (GObject *object,
}
break;
- case PROP_ANCHOR:
- if (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))
{
@@ -433,10 +370,6 @@ gnome_canvas_widget_get_property (GObject *object,
g_value_set_double (value, witem->height);
break;
- case PROP_ANCHOR:
- g_value_set_enum (value, witem->anchor);
- break;
-
case PROP_SIZE_PIXELS:
g_value_set_boolean (value, witem->size_pixels);
break;
@@ -564,50 +497,6 @@ gnome_canvas_widget_bounds (GnomeCanvasItem *item,
*x1 = witem->x;
*y1 = witem->y;
- switch (witem->anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_SW:
- break;
-
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_S:
- *x1 -= witem->width / 2.0;
- break;
-
- case GTK_ANCHOR_NE:
- case GTK_ANCHOR_E:
- case GTK_ANCHOR_SE:
- *x1 -= witem->width;
- break;
-
- default:
- break;
- }
-
- switch (witem->anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_NE:
- break;
-
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_E:
- *y1 -= witem->height / 2.0;
- break;
-
- case GTK_ANCHOR_SW:
- case GTK_ANCHOR_S:
- case GTK_ANCHOR_SE:
- *y1 -= witem->height;
- break;
-
- default:
- break;
- }
-
*x2 = *x1 + witem->width;
*y2 = *y1 + witem->height;
}
diff --git a/libgnomecanvas/gnome-canvas-widget.h b/libgnomecanvas/gnome-canvas-widget.h
index 62000299b1..f96a52ea92 100644
--- a/libgnomecanvas/gnome-canvas-widget.h
+++ b/libgnomecanvas/gnome-canvas-widget.h
@@ -48,7 +48,6 @@ G_BEGIN_DECLS
* 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.
* If it is in pixels, then the widget will not
@@ -73,7 +72,6 @@ struct _GnomeCanvasWidget {
gdouble x, y; /* Position at anchor */
gdouble width, height; /* Dimensions of widget */
- GtkAnchorType anchor; /* Anchor side for widget */
gint cx, cy; /* Top-left canvas coordinates for widget */
gint cwidth, cheight; /* Size of widget in pixels */