aboutsummaryrefslogtreecommitdiffstats
path: root/libgnomecanvas
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-10-15 06:13:46 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-30 01:50:00 +0800
commit9c183ab12ae27089ce972e29aab7000c2edfd466 (patch)
treea1d54e110940b2962b12e08ac6d09cc5e03ebdb6 /libgnomecanvas
parente4489322156d487fe7346a1a564a7837c73cddc1 (diff)
downloadgsoc2013-evolution-9c183ab12ae27089ce972e29aab7000c2edfd466.tar
gsoc2013-evolution-9c183ab12ae27089ce972e29aab7000c2edfd466.tar.gz
gsoc2013-evolution-9c183ab12ae27089ce972e29aab7000c2edfd466.tar.bz2
gsoc2013-evolution-9c183ab12ae27089ce972e29aab7000c2edfd466.tar.lz
gsoc2013-evolution-9c183ab12ae27089ce972e29aab7000c2edfd466.tar.xz
gsoc2013-evolution-9c183ab12ae27089ce972e29aab7000c2edfd466.tar.zst
gsoc2013-evolution-9c183ab12ae27089ce972e29aab7000c2edfd466.zip
gnome-canvas: Change line-width handling of GnomeCanvasShape
Remove "width-pixels" property and replace the "width-units" property name with "line-width". Also adapt the code to use "line-width". It didn't really matter which property was used, because the views weren't scaled.
Diffstat (limited to 'libgnomecanvas')
-rw-r--r--libgnomecanvas/gnome-canvas-shape-private.h3
-rw-r--r--libgnomecanvas/gnome-canvas-shape.c70
2 files changed, 18 insertions, 55 deletions
diff --git a/libgnomecanvas/gnome-canvas-shape-private.h b/libgnomecanvas/gnome-canvas-shape-private.h
index b36609a303..fb4637c035 100644
--- a/libgnomecanvas/gnome-canvas-shape-private.h
+++ b/libgnomecanvas/gnome-canvas-shape-private.h
@@ -75,9 +75,8 @@ struct _GnomeCanvasShapePriv {
guint fill_set : 1; /* Is fill color set? */
guint outline_set : 1; /* Is outline color set? */
- guint width_pixels : 1; /* Is outline width specified in pixels or units? */
- gdouble width; /* Width of outline, in user coords */
+ gdouble line_width; /* Width of outline, in user coords */
guint32 fill_rgba; /* Fill color, RGBA */
guint32 outline_rgba; /* Outline color, RGBA */
diff --git a/libgnomecanvas/gnome-canvas-shape.c b/libgnomecanvas/gnome-canvas-shape.c
index a1e2f74202..e033add5fe 100644
--- a/libgnomecanvas/gnome-canvas-shape.c
+++ b/libgnomecanvas/gnome-canvas-shape.c
@@ -49,8 +49,7 @@ enum {
PROP_OUTLINE_COLOR,
PROP_OUTLINE_COLOR_GDK,
PROP_OUTLINE_COLOR_RGBA,
- PROP_WIDTH_PIXELS,
- PROP_WIDTH_UNITS,
+ PROP_LINE_WIDTH,
PROP_CAP_STYLE,
PROP_JOIN_STYLE,
PROP_WIND,
@@ -135,14 +134,9 @@ gnome_canvas_shape_class_init (GnomeCanvasShapeClass *class)
0, G_MAXUINT, 0,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
g_object_class_install_property (gobject_class,
- PROP_WIDTH_PIXELS,
- g_param_spec_uint ("width_pixels", NULL, NULL,
- 0, G_MAXUINT, 0,
- (G_PARAM_READABLE | G_PARAM_WRITABLE)));
- g_object_class_install_property (gobject_class,
- PROP_WIDTH_UNITS,
- g_param_spec_double ("width_units", NULL, NULL,
- 0.0, G_MAXDOUBLE, 0.0,
+ PROP_LINE_WIDTH,
+ g_param_spec_double ("line_width", NULL, NULL,
+ 0.0, G_MAXDOUBLE, 1.0,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
g_object_class_install_property (gobject_class,
PROP_CAP_STYLE,
@@ -195,9 +189,8 @@ gnome_canvas_shape_init (GnomeCanvasShape *shape)
shape->priv->fill_set = FALSE;
shape->priv->outline_set = FALSE;
- shape->priv->width_pixels = FALSE;
- shape->priv->width = 1.0;
+ shape->priv->line_width = 1.0;
shape->priv->fill_rgba = 0x0000003f;
shape->priv->outline_rgba = 0x0000007f;
@@ -373,16 +366,8 @@ gnome_canvas_shape_set_property (GObject *object,
gnome_canvas_item_request_update (item);
break;
- case PROP_WIDTH_PIXELS:
- priv->width = g_value_get_uint (value);
- priv->width_pixels = TRUE;
-
- gnome_canvas_item_request_update (item);
- break;
-
- case PROP_WIDTH_UNITS:
- priv->width = fabs (g_value_get_double (value));
- priv->width_pixels = FALSE;
+ case PROP_LINE_WIDTH:
+ priv->line_width = g_value_get_double (value);
gnome_canvas_item_request_update (item);
break;
@@ -524,12 +509,8 @@ gnome_canvas_shape_get_property (GObject *object,
g_value_set_enum (value, priv->join);
break;
- case PROP_WIDTH_PIXELS:
- g_value_set_uint (value, priv->width);
- break;
-
- case PROP_WIDTH_UNITS:
- g_value_set_double (value, priv->width);
+ case PROP_LINE_WIDTH:
+ g_value_set_double (value, priv->line_width);
break;
case PROP_MITERLIMIT:
@@ -729,21 +710,12 @@ gnome_canvas_shape_update_gdk (GnomeCanvasShape * shape, gdouble * affine, ArtSV
if (priv->outline_set) {
GdkLineStyle style;
- if (priv->width_pixels) {
- 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 = (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) {
- width = 1;
- }
- }
+ width = (gint) floor ((priv->line_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->line_width != 0 && width == 0) {
+ width = 1;
+ }
/* If dashed, set it in GdkGC */
@@ -1006,11 +978,7 @@ gnome_canvas_shape_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_
/* Set linewidth */
- if (priv->width_pixels) {
- width = priv->width;
- } else {
- width = priv->width * priv->scale;
- }
+ width = priv->line_width * priv->scale;
if (width < 0.5) width = 0.5;
@@ -1300,11 +1268,7 @@ gnome_canvas_shape_bounds (GnomeCanvasItem *item, gdouble *x1, gdouble *y1, gdou
/* Set linewidth */
- if (priv->width_pixels) {
- width = priv->width;
- } else {
- width = priv->width * priv->scale;
- }
+ width = priv->line_width * priv->scale;
if (width < 0.5) width = 0.5;