diff options
author | Bruno Coudoin <bcoudoin@src.gnome.org> | 2007-06-08 23:49:16 (GMT) |
---|---|---|
committer | Bruno Coudoin <bcoudoin@src.gnome.org> | 2007-06-08 23:49:16 (GMT) |
commit | a000e7f1e0433dc61ca408a5bdb804b0cf984ac4 (patch) | |
tree | 4cd1b8049b46c4546bb6d7cba1c526ae99cdaa3e /src/libgnomecanvas | |
parent | 3d75568928efebf525e8eecd33e8a576ddd706e2 (diff) |
Major rework of activity icons by Mathieu Ignacio.
These Images are an original creation of Mathieu Ignacio. Released under GPL.
Starting now, we switch to the svg format.
* po/POTFILES.skip: Updated
* src/boards/Makefile.am: cleanup, removed draw.c
* src/boards/Makefile.mingw: -
* src/boards/draw.c: -
* src/boards/python/anim.py: removed focus highlight to keep the ON buttons.
* src/boards/python/redraw.py: removed image boards/draw directory, use them from skins now.
* src/boards/wordprocessor.c: (wordprocessor_create): use draw skin image now
* src/gcompris/gameutil.c: (gc_pixmap_load): Now return a blank inline pixmap instead of
NULL if the file is not found.
* src/libgnomecanvas/gnome-canvas-rich-text.c: removed translatable string
svn path=/trunk/; revision=2694
Diffstat (limited to 'src/libgnomecanvas')
-rw-r--r-- | src/libgnomecanvas/gnome-canvas-rich-text.c | 176 | ||||
-rw-r--r-- | src/libgnomecanvas/gnome-canvas-text.c | 300 | ||||
-rw-r--r-- | src/libgnomecanvas/gnome-canvas.c | 12 |
3 files changed, 244 insertions, 244 deletions
diff --git a/src/libgnomecanvas/gnome-canvas-rich-text.c b/src/libgnomecanvas/gnome-canvas-rich-text.c index 043b54f..a27cd06 100644 --- a/src/libgnomecanvas/gnome-canvas-rich-text.c +++ b/src/libgnomecanvas/gnome-canvas-rich-text.c @@ -120,16 +120,16 @@ static void gnome_canvas_rich_text_update(GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int 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, +static double gnome_canvas_rich_text_point(GnomeCanvasItem *item, double x, double y, - int cx, int cy, + int cx, int 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); 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); @@ -198,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; @@ -208,88 +208,88 @@ gnome_canvas_rich_text_class_init(GnomeCanvasRichTextClass *klass) gobject_class, PROP_TEXT, g_param_spec_string ("text", - _("Text"), - _("Text to display"), + "Text", + "Text to display", NULL, G_PARAM_READWRITE)); g_object_class_install_property ( gobject_class, PROP_X, g_param_spec_double ("x", - _("X"), - _("X position"), + "X", + "X position", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE)); g_object_class_install_property ( gobject_class, PROP_Y, g_param_spec_double ("y", - _("Y"), - _("Y position"), + "Y", + "Y position", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE)); g_object_class_install_property ( gobject_class, PROP_WIDTH, g_param_spec_double ("width", - _("Width"), - _("Width for text box"), + "Width", + "Width for text box", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE)); g_object_class_install_property ( gobject_class, PROP_HEIGHT, g_param_spec_double ("height", - _("Height"), - _("Height for text box"), + "Height", + "Height for text box", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE)); g_object_class_install_property ( gobject_class, PROP_EDITABLE, g_param_spec_boolean ("editable", - _("Editable"), - _("Is this rich text item editable?"), + "Editable", + "Is this rich text item editable?", TRUE, G_PARAM_READWRITE)); g_object_class_install_property ( gobject_class, PROP_VISIBLE, g_param_spec_boolean ("visible", - _("Visible"), - _("Is this rich text item visible?"), + "Visible", + "Is this rich text item visible?", TRUE, G_PARAM_READWRITE)); g_object_class_install_property ( gobject_class, PROP_CURSOR_VISIBLE, g_param_spec_boolean ("cursor_visible", - _("Cursor Visible"), - _("Is the cursor visible in this rich text item?"), + "Cursor Visible", + "Is the cursor visible in this rich text item?", TRUE, G_PARAM_READWRITE)); g_object_class_install_property ( gobject_class, PROP_CURSOR_BLINK, g_param_spec_boolean ("cursor_blink", - _("Cursor Blink"), - _("Does the cursor blink in this rich text item?"), + "Cursor Blink", + "Does the cursor blink in this rich text item?", TRUE, G_PARAM_READWRITE)); g_object_class_install_property ( gobject_class, PROP_GROW_HEIGHT, g_param_spec_boolean ("grow_height", - _("Grow Height"), - _("Should the text box height grow if the text does not fit?"), + "Grow Height", + "Should the text box height grow if the text does not fit?", FALSE, G_PARAM_READWRITE)); g_object_class_install_property ( gobject_class, PROP_WRAP_MODE, g_param_spec_enum ("wrap_mode", - _("Wrap Mode"), - _("Wrap mode for multiline text"), + "Wrap Mode", + "Wrap mode for multiline text", GTK_TYPE_WRAP_MODE, GTK_WRAP_WORD, G_PARAM_READWRITE)); @@ -297,8 +297,8 @@ gnome_canvas_rich_text_class_init(GnomeCanvasRichTextClass *klass) gobject_class, PROP_JUSTIFICATION, g_param_spec_enum ("justification", - _("Justification"), - _("Justification mode"), + "Justification", + "Justification mode", GTK_TYPE_JUSTIFICATION, GTK_JUSTIFY_LEFT, G_PARAM_READWRITE)); @@ -306,8 +306,8 @@ gnome_canvas_rich_text_class_init(GnomeCanvasRichTextClass *klass) gobject_class, PROP_DIRECTION, g_param_spec_enum ("direction", - _("Direction"), - _("Text direction"), + "Direction", + "Text direction", GTK_TYPE_DIRECTION_TYPE, gtk_widget_get_default_direction (), G_PARAM_READWRITE)); @@ -315,8 +315,8 @@ gnome_canvas_rich_text_class_init(GnomeCanvasRichTextClass *klass) gobject_class, PROP_ANCHOR, g_param_spec_enum ("anchor", - _("Anchor"), - _("Anchor point for text"), + "Anchor", + "Anchor point for text", GTK_TYPE_ANCHOR_TYPE, GTK_ANCHOR_NW, G_PARAM_READWRITE)); @@ -324,8 +324,8 @@ gnome_canvas_rich_text_class_init(GnomeCanvasRichTextClass *klass) gobject_class, PROP_PIXELS_ABOVE_LINES, g_param_spec_int ("pixels_above_lines", - _("Pixels Above Lines"), - _("Number of pixels to put above lines"), + "Pixels Above Lines", + "Number of pixels to put above lines", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); @@ -333,8 +333,8 @@ gnome_canvas_rich_text_class_init(GnomeCanvasRichTextClass *klass) gobject_class, PROP_PIXELS_BELOW_LINES, g_param_spec_int ("pixels_below_lines", - _("Pixels Below Lines"), - _("Number of pixels to put below lines"), + "Pixels Below Lines", + "Number of pixels to put below lines", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); @@ -342,8 +342,8 @@ gnome_canvas_rich_text_class_init(GnomeCanvasRichTextClass *klass) gobject_class, PROP_PIXELS_INSIDE_WRAP, g_param_spec_int ("pixels_inside_wrap", - _("Pixels Inside Wrap"), - _("Number of pixels to put inside the wrap"), + "Pixels Inside Wrap", + "Number of pixels to put inside the wrap", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); @@ -351,8 +351,8 @@ gnome_canvas_rich_text_class_init(GnomeCanvasRichTextClass *klass) gobject_class, PROP_LEFT_MARGIN, g_param_spec_int ("left_margin", - _("Left Margin"), - _("Number of pixels in the left margin"), + "Left Margin", + "Number of pixels in the left margin", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); @@ -360,8 +360,8 @@ gnome_canvas_rich_text_class_init(GnomeCanvasRichTextClass *klass) gobject_class, PROP_RIGHT_MARGIN, g_param_spec_int ("right_margin", - _("Right Margin"), - _("Number of pixels in the right margin"), + "Right Margin", + "Number of pixels in the right margin", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); @@ -369,8 +369,8 @@ gnome_canvas_rich_text_class_init(GnomeCanvasRichTextClass *klass) gobject_class, PROP_INDENT, g_param_spec_int ("indent", - _("Indentation"), - _("Number of pixels for indentation"), + "Indentation", + "Number of pixels for indentation", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); @@ -418,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; @@ -507,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); } @@ -535,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; @@ -544,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; @@ -553,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; @@ -562,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; @@ -571,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; @@ -580,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; @@ -725,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; @@ -748,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: @@ -760,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); @@ -843,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; } @@ -922,9 +922,9 @@ selection_motion_event_handler(GnomeCanvasRichText *text, GdkEvent *event, 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); @@ -980,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); @@ -1019,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; } @@ -1212,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; @@ -1245,7 +1245,7 @@ gnome_canvas_rich_text_button_press_event(GnomeCanvasItem *item, 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 @@ -1290,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; @@ -1299,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); } @@ -1361,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 */ @@ -1374,7 +1374,7 @@ gnome_canvas_rich_text_button_release_event(GnomeCanvasItem *item, 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; @@ -1434,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; @@ -1454,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; @@ -1470,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( @@ -1543,7 +1543,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. **/ @@ -1710,12 +1710,12 @@ scale_fonts(GtkTextTag *tag, gpointer data) return; 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); @@ -1724,11 +1724,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)); @@ -1757,10 +1757,10 @@ changed_handler(GtkTextLayout *layout, gint start_y, * @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)); @@ -1845,8 +1845,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, @@ -1871,7 +1871,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); @@ -2075,7 +2075,7 @@ 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) @@ -2146,7 +2146,7 @@ gnome_canvas_rich_text_draw(GnomeCanvasItem *item, GdkDrawable *drawable, y2 = c2.y; gtk_text_layout_set_screen_width(text->_priv->layout, x2 - x1); - + /* FIXME: should last arg be NULL? */ gtk_text_layout_draw( text->_priv->layout, @@ -2167,7 +2167,7 @@ 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, + int start_offset, int end_offset, const char *first_property_name, ...) { GtkTextTag *tag; diff --git a/src/libgnomecanvas/gnome-canvas-text.c b/src/libgnomecanvas/gnome-canvas-text.c index 1213e9c..1b9d050 100644 --- a/src/libgnomecanvas/gnome-canvas-text.c +++ b/src/libgnomecanvas/gnome-canvas-text.c @@ -66,7 +66,7 @@ enum { PROP_FONT, PROP_FONT_DESC, PROP_FAMILY, PROP_FAMILY_SET, - + /* Style */ PROP_ATTRIBUTES, PROP_STYLE, PROP_STYLE_SET, @@ -148,11 +148,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 @@ -203,8 +203,8 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) (gobject_class, PROP_TEXT, g_param_spec_string ("text", - _("Text"), - _("Text to render"), + "Text", + "Text to render", NULL, (G_PARAM_READABLE | G_PARAM_WRITABLE))); @@ -212,8 +212,8 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) (gobject_class, PROP_MARKUP, g_param_spec_string ("markup", - _("Markup"), - _("Marked up text to render"), + "Markup", + "Marked up text to render", NULL, (G_PARAM_WRITABLE))); @@ -238,17 +238,17 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) (gobject_class, PROP_FONT, g_param_spec_string ("font", - _("Font"), - _("Font description as a string"), + "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"), + "Font description", + "Font description as a PangoFontDescription struct", PANGO_TYPE_FONT_DESCRIPTION, (G_PARAM_READABLE | G_PARAM_WRITABLE))); @@ -256,11 +256,11 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) (gobject_class, PROP_FAMILY, g_param_spec_string ("family", - _("Font family"), - _("Name of the font family, e.g. Sans, Helvetica, Times, Monospace"), + "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, @@ -268,97 +268,97 @@ 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, g_param_spec_enum ("style", - _("Font style"), - _("Font 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"), + "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"), + "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"), + "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)"), + "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)"), + "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_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)"), + "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"), + "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"), + "Underline", + "Style of underline for this text", PANGO_TYPE_UNDERLINE, PANGO_UNDERLINE_NONE, G_PARAM_READABLE | G_PARAM_WRITABLE)); @@ -367,13 +367,13 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) (gobject_class, PROP_SCALE, g_param_spec_double ("scale", - _("Scale"), - _("Size of font, relative to default size"), + "Scale", + "Size of font, relative to default size", 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, @@ -422,24 +422,24 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) (gobject_class, PROP_FILL_COLOR, g_param_spec_string ("fill_color", - _("Color"), - _("Text color, as string"), + "Color", + "Text color, as string", NULL, (G_PARAM_READABLE | 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"), + "Color", + "Text color, as a GdkColor", GDK_TYPE_COLOR, (G_PARAM_READABLE | 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"), + "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 @@ -452,16 +452,16 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) (gobject_class, PROP_TEXT_WIDTH, g_param_spec_double ("text_width", - _("Text width"), - _("Width of the rendered text"), + "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"), + "Text height", + "Height of the rendered text", 0.0, G_MAXDOUBLE, 0.0, G_PARAM_READABLE)); @@ -469,46 +469,46 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class) #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")); - + "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")); - + "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")); - + "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")); - + "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")); - + "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")); - + "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")); - + "Rise set", + "Whether this tag affects the rise"); + ADD_SET_PROP ("strikethrough_set", PROP_STRIKETHROUGH_SET, - _("Strikethrough set"), - _("Whether this tag affects strikethrough")); - + "Strikethrough set", + "Whether this tag affects strikethrough"); + ADD_SET_PROP ("underline_set", PROP_UNDERLINE_SET, - _("Underline set"), - _("Whether this tag affects underlining")); + "Underline set", + "Whether this tag affects underlining"); ADD_SET_PROP ("scale_set", PROP_SCALE_SET, - _("Scale set"), - _("Whether this tag affects font scaling")); + "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; @@ -535,15 +535,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; @@ -567,7 +567,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; @@ -576,17 +576,17 @@ gnome_canvas_text_destroy (GtkObject *object) if (text->attr_list) pango_attr_list_unref (text->attr_list); text->attr_list = NULL; - + if (text->stipple) gdk_bitmap_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); } @@ -601,7 +601,7 @@ get_bounds (GnomeCanvasText *text, double *px1, double *py1, double *px2, double /* Get canvas pixel coordinates for text position */ - + wx = text->x; wy = text->y; gnome_canvas_item_i2w (item, &wx, &wy); @@ -763,27 +763,27 @@ gnome_canvas_text_set_property (GObject *object, color_changed = FALSE; have_pixel = FALSE; - + if (!text->layout) { PangoContext *gtk_context, *context; gtk_context = gtk_widget_get_pango_context (GTK_WIDGET (item->canvas)); - + if (item->canvas->aa) { PangoLanguage *language; gint pixels, mm; double dpi_x; double dpi_y; - + pixels = gdk_screen_width (); mm = gdk_screen_width_mm (); dpi_x = (((double) pixels * 25.4) / (double) mm); - + pixels = gdk_screen_height (); mm = gdk_screen_height_mm (); dpi_y = (((double) pixels * 25.4) / (double) mm); - + context = pango_ft2_get_context (dpi_x, dpi_y); language = pango_context_get_language (gtk_context); pango_context_set_language (context, language); @@ -791,13 +791,13 @@ 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)); } @@ -835,7 +835,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); @@ -887,7 +887,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; @@ -906,29 +906,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; @@ -936,14 +936,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; @@ -951,14 +951,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; @@ -969,7 +969,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; @@ -995,19 +995,19 @@ gnome_canvas_text_set_property (GObject *object, /* 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: @@ -1093,7 +1093,7 @@ gnome_canvas_text_set_property (GObject *object, text->max_width = 0; text->height = 0; } - + gnome_canvas_item_request_update (item); } @@ -1134,7 +1134,7 @@ gnome_canvas_text_get_property (GObject *object, case PROP_SIZE: case PROP_SIZE_POINTS: ensure_font (text); - + switch (param_id) { case PROP_FONT: { @@ -1142,14 +1142,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; @@ -1157,27 +1157,27 @@ 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); break; @@ -1204,28 +1204,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; @@ -1332,14 +1332,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); } @@ -1489,7 +1489,7 @@ gnome_canvas_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) int src_dx, src_dy; int i, alpha; int bm_rows, bm_width; - + text = GNOME_CANVAS_TEXT (item); if (!text->text) @@ -1503,7 +1503,7 @@ gnome_canvas_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) bm_width = (text->clip) ? text->clip_cwidth : text->max_width; if(text->priv->render_dirty || bm_rows != text->priv->bitmap.rows || - bm_width != text->priv->bitmap.width) { + bm_width != text->priv->bitmap.width) { if(text->priv->bitmap.buffer) { g_free(text->priv->bitmap.buffer); } @@ -1540,16 +1540,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; } @@ -1559,13 +1559,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; @@ -1583,7 +1583,7 @@ 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; } @@ -1616,7 +1616,7 @@ gnome_canvas_text_point (GnomeCanvasItem *item, double x, double y, 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); @@ -1663,11 +1663,11 @@ 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; } @@ -1736,5 +1736,5 @@ gnome_canvas_text_bounds (GnomeCanvasItem *item, double *x1, double *y1, double } *x2 = *x1 + width; - *y2 = *y1 + height; + *y2 = *y1 + height; } diff --git a/src/libgnomecanvas/gnome-canvas.c b/src/libgnomecanvas/gnome-canvas.c index dda2607..a211f0c 100644 --- a/src/libgnomecanvas/gnome-canvas.c +++ b/src/libgnomecanvas/gnome-canvas.c @@ -1397,15 +1397,15 @@ gnome_canvas_group_class_init (GnomeCanvasGroupClass *class) g_object_class_install_property (gobject_class, GROUP_PROP_X, g_param_spec_double ("x", - _("X"), - _("X"), + "X", + "X", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, (G_PARAM_READABLE | G_PARAM_WRITABLE))); g_object_class_install_property (gobject_class, GROUP_PROP_Y, g_param_spec_double ("y", - _("Y"), - _("Y"), + "Y", + "Y", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, (G_PARAM_READABLE | G_PARAM_WRITABLE))); @@ -2042,8 +2042,8 @@ gnome_canvas_class_init (GnomeCanvasClass *klass) g_object_class_install_property (G_OBJECT_CLASS (object_class), PROP_AA, g_param_spec_boolean ("aa", - _("Antialiased"), - _("The antialiasing mode of the canvas."), + "Antialiased", + "The antialiasing mode of the canvas.", FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |