diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2001-01-30 19:54:53 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-01-30 19:54:53 +0800 |
commit | 2dee35819cd9af4a512f85b505641e5962005685 (patch) | |
tree | e1066779f6e8917a10abb4e66434089034ecace3 /widgets/text/e-text.c | |
parent | 9c47d1bafa2f66533af51d41945b8257b2794bd6 (diff) | |
download | gsoc2013-evolution-2dee35819cd9af4a512f85b505641e5962005685.tar.gz gsoc2013-evolution-2dee35819cd9af4a512f85b505641e5962005685.tar.zst gsoc2013-evolution-2dee35819cd9af4a512f85b505641e5962005685.zip |
Reverted the latest change to EText since we're in feature freeze.
2001-01-30 Christopher James Lahey <clahey@helixcode.com>
* Reverted the latest change to EText since we're in feature freeze.
svn path=/trunk/; revision=7912
Diffstat (limited to 'widgets/text/e-text.c')
-rw-r--r-- | widgets/text/e-text.c | 97 |
1 files changed, 6 insertions, 91 deletions
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c index 1427a078ca..fbbe77dc0d 100644 --- a/widgets/text/e-text.c +++ b/widgets/text/e-text.c @@ -128,7 +128,6 @@ static void e_text_get_selection(EText *text, GdkAtom selection, guint32 time); static void e_text_supply_selection (EText *text, guint time, GdkAtom selection, guchar *data, gint length); static void e_text_text_model_changed(ETextModel *model, EText *text); -static void e_text_text_model_position(ETextModel *model, gint position, EText *text); static void _get_tep(EText *text); @@ -332,11 +331,6 @@ e_text_init (EText *text) "changed", GTK_SIGNAL_FUNC(e_text_text_model_changed), text); - text->model_position_signal_id = - gtk_signal_connect(GTK_OBJECT(text->model), - "position", - GTK_SIGNAL_FUNC(e_text_text_model_position), - text); text->anchor = GTK_ANCHOR_CENTER; text->justification = GTK_JUSTIFY_LEFT; @@ -393,8 +387,6 @@ e_text_init (EText *text) text->dbl_timeout = 0; text->tpl_timeout = 0; - text->rgba_object = 0x0000ffff; - text->draw_background = FALSE; e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(text), e_text_reflow); @@ -414,9 +406,6 @@ e_text_destroy (GtkObject *object) if (text->model_changed_signal_id) gtk_signal_disconnect(GTK_OBJECT(text->model), text->model_changed_signal_id); - if (text->model_position_signal_id) - gtk_signal_disconnect(GTK_OBJECT(text->model), - text->model_position_signal_id); if (text->model) gtk_object_unref(GTK_OBJECT(text->model)); @@ -476,48 +465,16 @@ e_text_destroy (GtkObject *object) } static void -fix_selection (EText *text) -{ - gint len = strlen (text->text); - - if (text->selection_start > len) { - text->selection_start = len; - } - if (text->selection_end > len) { - text->selection_end = len; - } -} - -static void e_text_text_model_changed (ETextModel *model, EText *text) { - gint len; - text->text = e_text_model_get_text(model); - len = strlen (text->text); - - fix_selection (text); - e_text_free_lines(text); gtk_signal_emit (GTK_OBJECT (text), e_text_signals[E_TEXT_CHANGED]); - text->needs_redraw = 1; text->needs_split_into_lines = 1; e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(text)); } static void -e_text_text_model_position (ETextModel *model, gint position, EText *text) -{ - /* - For now, something very simple. We can worry about things - like preserving a multi-char selection later. - */ - - text->selection_start = position; - text->selection_end = position; -} - -static void get_bounds_item_relative (EText *text, double *px1, double *py1, double *px2, double *py2) { GnomeCanvasItem *item; @@ -841,9 +798,6 @@ text_width_with_objects (ETextModel *model, gint object_num, gchar *c; gint width = 0; - if (text == NULL) - return 0; - while (*text && numbytes > 0) { c = text; @@ -895,14 +849,11 @@ static void text_draw_with_objects (ETextModel *model, gint object_num, GdkDrawable *drawable, EFont *font, EFontStyle style, - GdkGC *gc, GdkGC *obj_gc, + GdkGC *gc, gint x, gint y, gchar *text, gint numbytes) { gchar *c; - - if (text == NULL) - return; while (*text && numbytes > 0) { @@ -920,20 +871,16 @@ text_draw_with_objects (ETextModel *model, gint object_num, const gchar *obj_str; gint start_x = x; gint len; - - if (obj_gc == NULL) - obj_gc = gc; - g_assert (object_num < e_text_model_object_count (model)); obj_str = e_text_model_get_nth_object (model, object_num); len = strlen (obj_str); - e_font_draw_utf8_text (drawable, font, style, obj_gc, x, y, obj_str, len); + e_font_draw_utf8_text (drawable, font, style, gc, x, y, obj_str, len); x += e_font_utf8_text_width (font, style, obj_str, len); /* We underline our objects. */ - gdk_draw_line (drawable, obj_gc, start_x, y+1, x, y+1); + gdk_draw_line (drawable, gc, start_x, y+1, x, y+1); ++object_num; ++c; @@ -1222,9 +1169,6 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) if ( text->model_changed_signal_id ) gtk_signal_disconnect(GTK_OBJECT(text->model), text->model_changed_signal_id); - if ( text->model_position_signal_id ) - gtk_signal_disconnect(GTK_OBJECT(text->model), - text->model_position_signal_id); gtk_object_unref(GTK_OBJECT(text->model)); text->model = E_TEXT_MODEL(GTK_VALUE_OBJECT (*arg)); gtk_object_ref(GTK_OBJECT(text->model)); @@ -1234,11 +1178,6 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) "changed", GTK_SIGNAL_FUNC(e_text_text_model_changed), text); - text->model_position_signal_id = - gtk_signal_connect(GTK_OBJECT(text->model), - "position", - GTK_SIGNAL_FUNC(e_text_text_model_position), - text); e_text_free_lines(text); @@ -1834,7 +1773,7 @@ e_text_realize (GnomeCanvasItem *item) (* parent_class->realize) (item); text->gc = gdk_gc_new (item->canvas->layout.bin_window); - + text->i_cursor = gdk_cursor_new (GDK_XTERM); text->default_cursor = gdk_cursor_new (GDK_LEFT_PTR); if (text->font == NULL) { @@ -2009,16 +1948,6 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, canvas = GNOME_CANVAS_ITEM(text)->canvas; fg_gc = GTK_WIDGET(canvas)->style->fg_gc[text->has_selection ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE]; - - if (text->rgba_object && text->gc_object == NULL && text->gc) { - GdkColor c; - c.pixel = gnome_canvas_get_color_pixel (item->canvas, text->rgba_object); - - text->gc_object = gdk_gc_new (item->canvas->layout.bin_window); - gdk_gc_copy (text->gc_object, text->gc); - gdk_gc_set_foreground (text->gc_object, &c); - } - if (text->draw_borders || text->draw_background) { gdouble thisx = item->x1 - x; @@ -2142,7 +2071,6 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, drawable, text->font, E_FONT_PLAIN, text->gc, - text->gc_object, xpos - x, ypos - y, lines->text, @@ -2151,7 +2079,6 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, drawable, text->font, E_FONT_PLAIN, fg_gc, - text->gc_object, xpos - x + text_width_with_objects (text->model, lines->first_obj, text->font, E_FONT_PLAIN, lines->text, @@ -2163,7 +2090,6 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, drawable, text->font, E_FONT_PLAIN, text->gc, - text->gc_object, xpos - x + text_width_with_objects (text->model, lines->first_obj, text->font, E_FONT_PLAIN, lines->text, @@ -2176,7 +2102,6 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, drawable, text->font, E_FONT_PLAIN, text->gc, - text->gc_object, xpos - x, ypos - y, lines->text, @@ -2203,7 +2128,6 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, drawable, text->font, E_FONT_PLAIN, text->gc, - text->gc_object, xpos - x, ypos - y, lines->text, @@ -2220,7 +2144,6 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, drawable, text->font, E_FONT_PLAIN, text->gc, - text->gc_object, xpos - x, ypos - y, lines->text, @@ -3374,8 +3297,6 @@ _delete_selection(EText *text) e_text_model_delete(text->model, text->selection_end, text->selection_start - text->selection_end); text->selection_start = text->selection_end; } - - fix_selection (text); } static void @@ -3384,13 +3305,8 @@ _insert(EText *text, char *string, int value) if (value > 0) { e_text_model_insert_length(text->model, text->selection_start, string, value); - /* - text->selection_start += value; - text->selection_end = text->selection_start; - */ - - fix_selection (text); - + text->selection_start += value; + text->selection_end = text->selection_start; } } @@ -3399,7 +3315,6 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp { EText *text = E_TEXT(data); int sel_start, sel_end; - switch (command->action) { case E_TEP_MOVE: text->selection_start = _get_position(text, command); |