diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-08-25 21:00:38 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-09-01 20:06:32 +0800 |
commit | d89e767a1cde7b3349182e713085241e58a30fe8 (patch) | |
tree | 2c054ebfdc252d71a774b6be11fdaa2a5ee64494 /libgnomecanvas | |
parent | caff4060d5542aec79b8e27d0a35f8097c5fdfc0 (diff) | |
download | gsoc2013-evolution-d89e767a1cde7b3349182e713085241e58a30fe8.tar.gz gsoc2013-evolution-d89e767a1cde7b3349182e713085241e58a30fe8.tar.zst gsoc2013-evolution-d89e767a1cde7b3349182e713085241e58a30fe8.zip |
Coding style and whitespace cleanup.
Diffstat (limited to 'libgnomecanvas')
-rw-r--r-- | libgnomecanvas/gnome-canvas-text.c | 804 | ||||
-rw-r--r-- | libgnomecanvas/gnome-canvas-widget.c | 14 | ||||
-rw-r--r-- | libgnomecanvas/gnome-canvas.c | 209 |
3 files changed, 593 insertions, 434 deletions
diff --git a/libgnomecanvas/gnome-canvas-text.c b/libgnomecanvas/gnome-canvas-text.c index 6720ad42eb..89d8078702 100644 --- a/libgnomecanvas/gnome-canvas-text.c +++ b/libgnomecanvas/gnome-canvas-text.c @@ -148,305 +148,420 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) gobject_class->get_property = gnome_canvas_text_get_property; /* Text */ - g_object_class_install_property - (gobject_class, - PROP_TEXT, - g_param_spec_string ("text", - "Text", - "Text to render", - NULL, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - g_object_class_install_property - (gobject_class, - PROP_MARKUP, - g_param_spec_string ("markup", - "Markup", - "Marked up text to render", - NULL, - (G_PARAM_WRITABLE))); + g_object_class_install_property ( + gobject_class, + PROP_TEXT, + g_param_spec_string ( + "text", + "Text", + "Text to render", + NULL, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_MARKUP, + g_param_spec_string ( + "markup", + "Markup", + "Marked up text to render", + NULL, + G_PARAM_WRITABLE)); /* Position */ - g_object_class_install_property - (gobject_class, - PROP_X, - g_param_spec_double ("x", NULL, NULL, - -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - g_object_class_install_property - (gobject_class, - PROP_Y, - g_param_spec_double ("y", NULL, NULL, - -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); + g_object_class_install_property ( + gobject_class, + PROP_X, + g_param_spec_double ( + "x", + NULL, + NULL, + -G_MAXDOUBLE, + G_MAXDOUBLE, + 0.0, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_Y, + g_param_spec_double ( + "y", + NULL, + NULL, + -G_MAXDOUBLE, + G_MAXDOUBLE, + 0.0, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); /* Font */ - g_object_class_install_property - (gobject_class, - PROP_FONT, - g_param_spec_string ("font", - "Font", - "Font description as a string", - NULL, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - g_object_class_install_property - (gobject_class, - PROP_FONT_DESC, - g_param_spec_boxed ("font_desc", - "Font description", - "Font description as a PangoFontDescription struct", - PANGO_TYPE_FONT_DESCRIPTION, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - g_object_class_install_property - (gobject_class, - PROP_FAMILY, - g_param_spec_string ("family", - "Font family", - "Name of the font family, e.g. " - "Sans, Helvetica, Times, Monospace", - NULL, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); + g_object_class_install_property ( + gobject_class, + PROP_FONT, + g_param_spec_string ( + "font", + "Font", + "Font description as a string", + NULL, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_FONT_DESC, + g_param_spec_boxed ( + "font_desc", + "Font description", + "Font description as a PangoFontDescription struct", + PANGO_TYPE_FONT_DESCRIPTION, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_FAMILY, + g_param_spec_string ( + "family", + "Font family", + "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, - PROP_ATTRIBUTES, - 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, - g_param_spec_enum ("style", - "Font style", - "Font style", - PANGO_TYPE_STYLE, - PANGO_STYLE_NORMAL, - G_PARAM_READABLE | G_PARAM_WRITABLE)); - - g_object_class_install_property - (gobject_class, - PROP_VARIANT, - g_param_spec_enum ("variant", - "Font variant", - "Font variant", - PANGO_TYPE_VARIANT, - PANGO_VARIANT_NORMAL, - G_PARAM_READABLE | G_PARAM_WRITABLE)); - - g_object_class_install_property - (gobject_class, - PROP_WEIGHT, - g_param_spec_int ("weight", - "Font weight", - "Font weight", - 0, - G_MAXINT, - PANGO_WEIGHT_NORMAL, - G_PARAM_READABLE | G_PARAM_WRITABLE)); - - g_object_class_install_property - (gobject_class, - PROP_STRETCH, - g_param_spec_enum ("stretch", - "Font stretch", - "Font stretch", - 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)", - 0, - G_MAXINT, - 0, - G_PARAM_READABLE | G_PARAM_WRITABLE)); - - g_object_class_install_property - (gobject_class, + g_object_class_install_property ( + gobject_class, + PROP_ATTRIBUTES, + 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, + g_param_spec_enum ( + "style", + "Font style", + "Font style", + PANGO_TYPE_STYLE, + PANGO_STYLE_NORMAL, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_VARIANT, + g_param_spec_enum ( + "variant", + "Font variant", + "Font variant", + PANGO_TYPE_VARIANT, + PANGO_VARIANT_NORMAL, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_WEIGHT, + g_param_spec_int ( + "weight", + "Font weight", + "Font weight", + 0, + G_MAXINT, + PANGO_WEIGHT_NORMAL, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_STRETCH, + g_param_spec_enum ( + "stretch", + "Font stretch", + "Font stretch", + 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)", + 0, + G_MAXINT, + 0, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, PROP_SIZE_POINTS, - g_param_spec_double ("size_points", - "Font points", - "Font size in points (eg. 12 for a 12pt font size)", - 0.0, - G_MAXDOUBLE, - 0.0, - G_PARAM_READABLE | G_PARAM_WRITABLE)); - - g_object_class_install_property - (gobject_class, - PROP_RISE, - g_param_spec_int ("rise", - "Rise", - "Offset of text above the baseline " - "(below the baseline if rise is negative)", - -G_MAXINT, - G_MAXINT, - 0, - G_PARAM_READABLE | G_PARAM_WRITABLE)); - - g_object_class_install_property - (gobject_class, - PROP_STRIKETHROUGH, - g_param_spec_boolean ("strikethrough", - "Strikethrough", - "Whether to strike through the text", - FALSE, - G_PARAM_READABLE | G_PARAM_WRITABLE)); - - g_object_class_install_property - (gobject_class, - PROP_UNDERLINE, - g_param_spec_enum ("underline", - "Underline", - "Style of underline for this text", - PANGO_TYPE_UNDERLINE, - PANGO_UNDERLINE_NONE, - G_PARAM_READABLE | G_PARAM_WRITABLE)); - - g_object_class_install_property - (gobject_class, - PROP_SCALE, - g_param_spec_double ("scale", - "Scale", - "Size of font, relative to default size", - 0.0, - G_MAXDOUBLE, - 1.0, - G_PARAM_READABLE | G_PARAM_WRITABLE)); - - g_object_class_install_property - (gobject_class, - PROP_JUSTIFICATION, - g_param_spec_enum ("justification", NULL, NULL, - GTK_TYPE_JUSTIFICATION, - GTK_JUSTIFY_LEFT, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - g_object_class_install_property - (gobject_class, - PROP_CLIP_WIDTH, - g_param_spec_double ("clip_width", NULL, NULL, - -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - g_object_class_install_property - (gobject_class, - PROP_CLIP_HEIGHT, - g_param_spec_double ("clip_height", NULL, NULL, - -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - g_object_class_install_property - (gobject_class, - PROP_CLIP, - g_param_spec_boolean ("clip", NULL, NULL, - FALSE, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - g_object_class_install_property - (gobject_class, - PROP_X_OFFSET, - g_param_spec_double ("x_offset", NULL, NULL, - -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - g_object_class_install_property - (gobject_class, - PROP_Y_OFFSET, - g_param_spec_double ("y_offset", NULL, NULL, - -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - g_object_class_install_property - (gobject_class, - PROP_FILL_COLOR, - g_param_spec_string ("fill_color", - "Color", - "Text color, as string", - NULL, - G_PARAM_WRITABLE)); - g_object_class_install_property - (gobject_class, - PROP_FILL_COLOR_GDK, - g_param_spec_boxed ("fill_color_gdk", - "Color", - "Text color, as a GdkColor", - GDK_TYPE_COLOR, - G_PARAM_WRITABLE)); - g_object_class_install_property - (gobject_class, - PROP_FILL_COLOR_RGBA, - g_param_spec_uint ("fill_color_rgba", - "Color", - "Text color, as an R/G/B/A combined integer", - 0, G_MAXUINT, 0, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - g_object_class_install_property - (gobject_class, - PROP_TEXT_WIDTH, - g_param_spec_double ("text_width", - "Text width", - "Width of the rendered text", - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READABLE)); - g_object_class_install_property - (gobject_class, - PROP_TEXT_HEIGHT, - g_param_spec_double ("text_height", - "Text height", - "Height of the rendered text", - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READABLE)); + g_param_spec_double ( + "size_points", + "Font points", + "Font size in points (eg. 12 for a 12pt font size)", + 0.0, + G_MAXDOUBLE, + 0.0, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_RISE, + g_param_spec_int ( + "rise", + "Rise", + "Offset of text above the baseline " + "(below the baseline if rise is negative)", + -G_MAXINT, + G_MAXINT, + 0, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_STRIKETHROUGH, + g_param_spec_boolean ( + "strikethrough", + "Strikethrough", + "Whether to strike through the text", + FALSE, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_UNDERLINE, + g_param_spec_enum ( + "underline", + "Underline", + "Style of underline for this text", + PANGO_TYPE_UNDERLINE, + PANGO_UNDERLINE_NONE, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_SCALE, + g_param_spec_double ( + "scale", + "Scale", + "Size of font, relative to default size", + 0.0, + G_MAXDOUBLE, + 1.0, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_JUSTIFICATION, + g_param_spec_enum ( + "justification", + NULL, + NULL, + GTK_TYPE_JUSTIFICATION, + GTK_JUSTIFY_LEFT, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_CLIP_WIDTH, + g_param_spec_double ( + "clip_width", + NULL, + NULL, + -G_MAXDOUBLE, + G_MAXDOUBLE, + 0.0, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_CLIP_HEIGHT, + g_param_spec_double ( + "clip_height", + NULL, + NULL, + -G_MAXDOUBLE, + G_MAXDOUBLE, + 0.0, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_CLIP, + g_param_spec_boolean ( + "clip", + NULL, + NULL, + FALSE, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_X_OFFSET, + g_param_spec_double ( + "x_offset", + NULL, + NULL, + -G_MAXDOUBLE, + G_MAXDOUBLE, + 0.0, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_Y_OFFSET, + g_param_spec_double ( + "y_offset", + NULL, + NULL, + -G_MAXDOUBLE, + G_MAXDOUBLE, + 0.0, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_FILL_COLOR, + g_param_spec_string ( + "fill_color", + "Color", + "Text color, as string", + NULL, + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_FILL_COLOR_GDK, + g_param_spec_boxed ( + "fill_color_gdk", + "Color", + "Text color, as a GdkColor", + GDK_TYPE_COLOR, + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_FILL_COLOR_RGBA, + g_param_spec_uint ( + "fill_color_rgba", + "Color", + "Text color, as an R/G/B/A combined integer", + 0, G_MAXUINT, 0, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_TEXT_WIDTH, + g_param_spec_double ( + "text_width", + "Text width", + "Width of the rendered text", + 0.0, G_MAXDOUBLE, 0.0, + G_PARAM_READABLE)); + + g_object_class_install_property ( + gobject_class, + PROP_TEXT_HEIGHT, + g_param_spec_double ( + "text_height", + "Text height", + "Height of the rendered text", + 0.0, G_MAXDOUBLE, 0.0, + 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)) - - ADD_SET_PROP ("family_set", PROP_FAMILY_SET, - "Font family set", - "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"); - - ADD_SET_PROP ("scale_set", PROP_SCALE_SET, - "Scale set", - "Whether this tag affects font scaling"); + 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"); + + 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"); + + ADD_SET_PROP ( + "scale_set", + PROP_SCALE_SET, + "Scale set", + "Whether this tag affects font scaling"); #undef ADD_SET_PROP item_class->dispose = gnome_canvas_text_dispose; @@ -557,23 +672,22 @@ get_bounds (GnomeCanvasText *text, static PangoFontMask get_property_font_set_mask (guint property_id) { - switch (property_id) - { - case PROP_FAMILY_SET: - return PANGO_FONT_MASK_FAMILY; - case PROP_STYLE_SET: - return PANGO_FONT_MASK_STYLE; - case PROP_VARIANT_SET: - return PANGO_FONT_MASK_VARIANT; - case PROP_WEIGHT_SET: - return PANGO_FONT_MASK_WEIGHT; - case PROP_STRETCH_SET: - return PANGO_FONT_MASK_STRETCH; - case PROP_SIZE_SET: - return PANGO_FONT_MASK_SIZE; - } - - return 0; + switch (property_id) { + case PROP_FAMILY_SET: + return PANGO_FONT_MASK_FAMILY; + case PROP_STYLE_SET: + return PANGO_FONT_MASK_STYLE; + case PROP_VARIANT_SET: + return PANGO_FONT_MASK_VARIANT; + case PROP_WEIGHT_SET: + return PANGO_FONT_MASK_WEIGHT; + case PROP_STRETCH_SET: + return PANGO_FONT_MASK_STRETCH; + case PROP_SIZE_SET: + return PANGO_FONT_MASK_SIZE; + } + + return 0; } static void @@ -616,8 +730,8 @@ gnome_canvas_text_set_property (GObject *object, break; case PROP_MARKUP: - gnome_canvas_text_set_markup (text, - g_value_get_string (value)); + gnome_canvas_text_set_markup ( + text, g_value_get_string (value)); break; case PROP_X: @@ -660,33 +774,40 @@ gnome_canvas_text_set_property (GObject *object, switch (param_id) { case PROP_FAMILY: - pango_font_description_set_family (text->font_desc, - g_value_get_string (value)); + pango_font_description_set_family ( + text->font_desc, + g_value_get_string (value)); break; case PROP_STYLE: - pango_font_description_set_style (text->font_desc, - g_value_get_enum (value)); + pango_font_description_set_style ( + text->font_desc, + g_value_get_enum (value)); break; case PROP_VARIANT: - pango_font_description_set_variant (text->font_desc, - g_value_get_enum (value)); + pango_font_description_set_variant ( + text->font_desc, + g_value_get_enum (value)); break; case PROP_WEIGHT: - pango_font_description_set_weight (text->font_desc, - g_value_get_int (value)); + pango_font_description_set_weight ( + text->font_desc, + g_value_get_int (value)); break; case PROP_STRETCH: - pango_font_description_set_stretch (text->font_desc, - g_value_get_enum (value)); + pango_font_description_set_stretch ( + text->font_desc, + g_value_get_enum (value)); break; case PROP_SIZE: /* FIXME: This is bogus! It should be pixels, not points/PANGO_SCALE! */ - pango_font_description_set_size (text->font_desc, - g_value_get_int (value)); + pango_font_description_set_size ( + text->font_desc, + g_value_get_int (value)); break; case PROP_SIZE_POINTS: - pango_font_description_set_size (text->font_desc, - g_value_get_double (value) * PANGO_SCALE); + pango_font_description_set_size ( + text->font_desc, + g_value_get_double (value) * PANGO_SCALE); break; } @@ -700,8 +821,9 @@ gnome_canvas_text_set_property (GObject *object, case PROP_STRETCH_SET: case PROP_SIZE_SET: if (!g_value_get_boolean (value) && text->font_desc) - pango_font_description_unset_fields (text->font_desc, - get_property_font_set_mask (param_id)); + pango_font_description_unset_fields ( + text->font_desc, + get_property_font_set_mask (param_id)); break; case PROP_SCALE: @@ -847,9 +969,10 @@ gnome_canvas_text_set_property (GObject *object, /* Calculate text dimensions */ if (text->layout) - pango_layout_get_pixel_size (text->layout, - &text->max_width, - &text->height); + pango_layout_get_pixel_size ( + text->layout, + &text->max_width, + &text->height); else { text->max_width = 0; text->height = 0; @@ -1170,9 +1293,10 @@ gnome_canvas_text_update (GnomeCanvasItem *item, get_bounds (text, &x1, &y1, &x2, &y2); - gnome_canvas_update_bbox (item, - floor (x1), floor (y1), - ceil (x2), ceil (y2)); + gnome_canvas_update_bbox ( + item, + floor (x1), floor (y1), + ceil (x2), ceil (y2)); } /* Draw handler for the text item */ @@ -1192,19 +1316,21 @@ gnome_canvas_text_draw (GnomeCanvasItem *item, cairo_save (cr); if (text->clip) { - cairo_rectangle (cr, - text->clip_cx - x, - text->clip_cy - y, - text->clip_cwidth, - text->clip_cheight); + cairo_rectangle ( + cr, + text->clip_cx - x, + text->clip_cy - y, + text->clip_cwidth, + text->clip_cheight); cairo_clip (cr); } - cairo_set_source_rgba (cr, - ((text->rgba >> 24) & 0xff) / 255.0, - ((text->rgba >> 16) & 0xff) / 255.0, - ((text->rgba >> 8) & 0xff) / 255.0, - ( text->rgba & 0xff) / 255.0); + cairo_set_source_rgba ( + cr, + ((text->rgba >> 24) & 0xff) / 255.0, + ((text->rgba >> 16) & 0xff) / 255.0, + ((text->rgba >> 8) & 0xff) / 255.0, + ( text->rgba & 0xff) / 255.0); cairo_move_to (cr, text->cx - x, text->cy - y); pango_cairo_show_layout (cr, text->layout); diff --git a/libgnomecanvas/gnome-canvas-widget.c b/libgnomecanvas/gnome-canvas-widget.c index 7632bb0ddf..f47c32332b 100644 --- a/libgnomecanvas/gnome-canvas-widget.c +++ b/libgnomecanvas/gnome-canvas-widget.c @@ -211,9 +211,10 @@ recalc_bounds (GnomeCanvasWidget *witem) item->y2 = witem->cy + witem->cheight; if (witem->widget) - gtk_layout_move (GTK_LAYOUT (item->canvas), witem->widget, - witem->cx + item->canvas->zoom_xofs, - witem->cy + item->canvas->zoom_yofs); + gtk_layout_move ( + GTK_LAYOUT (item->canvas), witem->widget, + witem->cx + item->canvas->zoom_xofs, + witem->cy + item->canvas->zoom_yofs); } static void @@ -248,9 +249,10 @@ gnome_canvas_widget_set_property (GObject *object, if (obj) { witem->widget = GTK_WIDGET (obj); g_object_weak_ref (obj, do_destroy, witem); - gtk_layout_put (GTK_LAYOUT (item->canvas), witem->widget, - witem->cx + item->canvas->zoom_xofs, - witem->cy + item->canvas->zoom_yofs); + gtk_layout_put ( + GTK_LAYOUT (item->canvas), witem->widget, + witem->cx + item->canvas->zoom_xofs, + witem->cy + item->canvas->zoom_yofs); } update = TRUE; diff --git a/libgnomecanvas/gnome-canvas.c b/libgnomecanvas/gnome-canvas.c index 24d44e0af9..2b1c61e000 100644 --- a/libgnomecanvas/gnome-canvas.c +++ b/libgnomecanvas/gnome-canvas.c @@ -854,12 +854,9 @@ gnome_canvas_item_grab (GnomeCanvasItem *item, layout = GTK_LAYOUT (item->canvas); bin_window = gtk_layout_get_bin_window (layout); - retval = gdk_pointer_grab (bin_window, - FALSE, - event_mask, - NULL, - cursor, - etime); + retval = gdk_pointer_grab ( + bin_window, FALSE, event_mask, + NULL, cursor, etime); if (retval != GDK_GRAB_SUCCESS) return retval; @@ -1225,20 +1222,31 @@ gnome_canvas_group_class_init (GnomeCanvasGroupClass *class) object_class->set_property = gnome_canvas_group_set_property; object_class->get_property = gnome_canvas_group_get_property; - g_object_class_install_property - (object_class, GROUP_PROP_X, - g_param_spec_double ("x", - "X", - "X", - -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - g_object_class_install_property - (object_class, GROUP_PROP_Y, - g_param_spec_double ("y", - "Y", - "Y", - -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); + g_object_class_install_property ( + object_class, + GROUP_PROP_X, + g_param_spec_double ( + "x", + "X", + "X", + -G_MAXDOUBLE, + G_MAXDOUBLE, + 0.0, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + object_class, + GROUP_PROP_Y, + g_param_spec_double ( + "y", + "Y", + "Y", + -G_MAXDOUBLE, + G_MAXDOUBLE, + 0.0, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); item_class->dispose = gnome_canvas_group_dispose; item_class->update = gnome_canvas_group_update; @@ -1827,19 +1835,29 @@ gnome_canvas_class_init (GnomeCanvasClass *class) class->draw_background = gnome_canvas_draw_background; class->request_update = gnome_canvas_request_update_real; - g_object_class_install_property (object_class, PROP_FOCUSED_ITEM, - g_param_spec_object ("focused_item", NULL, NULL, - GNOME_TYPE_CANVAS_ITEM, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - canvas_signals[DRAW_BACKGROUND] = - g_signal_new ("draw_background", - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GnomeCanvasClass, draw_background), - NULL, NULL, NULL, - G_TYPE_NONE, 5, CAIRO_GOBJECT_TYPE_CONTEXT, - G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT); + g_object_class_install_property ( + object_class, + PROP_FOCUSED_ITEM, + g_param_spec_object ( + "focused_item", + NULL, + NULL, + GNOME_TYPE_CANVAS_ITEM, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + canvas_signals[DRAW_BACKGROUND] = g_signal_new ( + "draw_background", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GnomeCanvasClass, draw_background), + NULL, NULL, NULL, + G_TYPE_NONE, 5, + CAIRO_GOBJECT_TYPE_CONTEXT, + G_TYPE_INT, + G_TYPE_INT, + G_TYPE_INT, + G_TYPE_INT); gail_canvas_init (); } @@ -2018,18 +2036,19 @@ gnome_canvas_realize (GtkWidget *widget) layout = GTK_LAYOUT (canvas); bin_window = gtk_layout_get_bin_window (layout); - gdk_window_set_events (bin_window, - (gdk_window_get_events (bin_window) - | GDK_EXPOSURE_MASK - | GDK_SCROLL_MASK - | GDK_BUTTON_PRESS_MASK - | GDK_BUTTON_RELEASE_MASK - | GDK_POINTER_MOTION_MASK - | GDK_KEY_PRESS_MASK - | GDK_KEY_RELEASE_MASK - | GDK_ENTER_NOTIFY_MASK - | GDK_LEAVE_NOTIFY_MASK - | GDK_FOCUS_CHANGE_MASK)); + gdk_window_set_events ( + bin_window, + (gdk_window_get_events (bin_window) + | GDK_EXPOSURE_MASK + | GDK_SCROLL_MASK + | GDK_BUTTON_PRESS_MASK + | GDK_BUTTON_RELEASE_MASK + | GDK_POINTER_MOTION_MASK + | GDK_KEY_PRESS_MASK + | GDK_KEY_RELEASE_MASK + | GDK_ENTER_NOTIFY_MASK + | GDK_LEAVE_NOTIFY_MASK + | GDK_FOCUS_CHANGE_MASK)); /* Create our own temporary pixmap gc and realize all the items */ @@ -2181,9 +2200,10 @@ gnome_canvas_size_allocate (GtkWidget *widget, gtk_adjustment_set_page_size (vadjustment, allocation->height); gtk_adjustment_set_page_increment (vadjustment, allocation->height / 2); - scroll_to (GNOME_CANVAS (widget), - gtk_adjustment_get_value (hadjustment), - gtk_adjustment_get_value (vadjustment)); + scroll_to ( + GNOME_CANVAS (widget), + gtk_adjustment_get_value (hadjustment), + gtk_adjustment_get_value (vadjustment)); g_object_thaw_notify (G_OBJECT (hadjustment)); g_object_thaw_notify (G_OBJECT (vadjustment)); @@ -2222,18 +2242,20 @@ gnome_canvas_draw (GtkWidget *widget, } cairo_save (cr); - cairo_translate (cr, - -canvas->zoom_xofs + rect.x, - -canvas->zoom_yofs + rect.y); + cairo_translate ( + cr, + -canvas->zoom_xofs + rect.x, + -canvas->zoom_yofs + rect.y); rect.x += hadjustment_value; rect.y += vadjustment_value; /* No pending updates, draw exposed area immediately */ - gnome_canvas_paint_rect (canvas, cr, - rect.x, rect.y, - rect.x + rect.width, - rect.y + rect.height); + gnome_canvas_paint_rect ( + canvas, cr, + rect.x, rect.y, + rect.x + rect.width, + rect.y + rect.height); cairo_restore (cr); /* And call expose on parent container class */ @@ -2322,9 +2344,10 @@ emit_event (GnomeCanvas *canvas, { case GDK_ENTER_NOTIFY: case GDK_LEAVE_NOTIFY: - gnome_canvas_window_to_world (canvas, - ev->crossing.x, ev->crossing.y, - &ev->crossing.x, &ev->crossing.y); + gnome_canvas_window_to_world ( + canvas, + ev->crossing.x, ev->crossing.y, + &ev->crossing.x, &ev->crossing.y); break; case GDK_MOTION_NOTIFY: @@ -2332,9 +2355,10 @@ emit_event (GnomeCanvas *canvas, case GDK_2BUTTON_PRESS: case GDK_3BUTTON_PRESS: case GDK_BUTTON_RELEASE: - gnome_canvas_window_to_world (canvas, - ev->motion.x, ev->motion.y, - &ev->motion.x, &ev->motion.y); + gnome_canvas_window_to_world ( + canvas, + ev->motion.x, ev->motion.y, + &ev->motion.x, &ev->motion.y); break; default: @@ -2361,8 +2385,9 @@ emit_event (GnomeCanvas *canvas, while (item && !finished) { g_object_ref (G_OBJECT (item)); - g_signal_emit (item, item_signals[ITEM_EVENT], 0, - ev, &finished); + g_signal_emit ( + item, item_signals[ITEM_EVENT], 0, + ev, &finished); parent = item->parent; g_object_unref (G_OBJECT (item)); @@ -2805,10 +2830,11 @@ add_idle (GnomeCanvas *canvas) g_return_if_fail (canvas->need_update); if (!canvas->idle_id) - canvas->idle_id = g_idle_add_full (CANVAS_IDLE_PRIORITY, - idle_handler, - canvas, - NULL); + canvas->idle_id = g_idle_add_full ( + CANVAS_IDLE_PRIORITY, + idle_handler, + canvas, + NULL); /* canvas->idle_id = gtk_idle_add (idle_handler, canvas); */ } @@ -2870,12 +2896,11 @@ gnome_canvas_set_scroll_region (GnomeCanvas *canvas, * visible contents of the canvas. */ - gnome_canvas_c2w (canvas, - hadjustment_value + canvas->zoom_xofs, - vadjustment_value + canvas->zoom_yofs, - /*canvas->zoom_xofs, - canvas->zoom_yofs,*/ - &wxofs, &wyofs); + gnome_canvas_c2w ( + canvas, + hadjustment_value + canvas->zoom_xofs, + vadjustment_value + canvas->zoom_yofs, + &wxofs, &wyofs); canvas->scroll_x1 = x1; canvas->scroll_y1 = y1; @@ -3084,8 +3109,9 @@ gnome_canvas_request_redraw (GnomeCanvas *canvas, if (!gdk_rectangle_intersect (&area, &clip, &area)) return; - gdk_window_invalidate_rect (gtk_layout_get_bin_window (GTK_LAYOUT (canvas)), - &area, FALSE); + gdk_window_invalidate_rect ( + gtk_layout_get_bin_window (GTK_LAYOUT (canvas)), + &area, FALSE); } /** @@ -3302,20 +3328,25 @@ gnome_canvas_item_class_init (GnomeCanvasItemClass *class) gobject_class->set_property = gnome_canvas_item_set_property; gobject_class->get_property = gnome_canvas_item_get_property; - g_object_class_install_property - (gobject_class, ITEM_PROP_PARENT, - g_param_spec_object ("parent", NULL, NULL, - GNOME_TYPE_CANVAS_ITEM, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - item_signals[ITEM_EVENT] = - g_signal_new ("event", - G_TYPE_FROM_CLASS (class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GnomeCanvasItemClass, event), - boolean_handled_accumulator, NULL, NULL, - G_TYPE_BOOLEAN, 1, - GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); + g_object_class_install_property ( + gobject_class, + ITEM_PROP_PARENT, + g_param_spec_object ( + "parent", + NULL, + NULL, + GNOME_TYPE_CANVAS_ITEM, + G_PARAM_READABLE | + G_PARAM_WRITABLE)); + + item_signals[ITEM_EVENT] = g_signal_new ( + "event", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GnomeCanvasItemClass, event), + boolean_handled_accumulator, NULL, NULL, + G_TYPE_BOOLEAN, 1, + GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); gobject_class->dispose = gnome_canvas_item_dispose; |