diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-06-21 13:37:37 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-06-21 13:37:37 +0800 |
commit | dad705c65cc4da62ed23ad917321d274246a05a5 (patch) | |
tree | 7ec0209301cce4e8911068ce927ec0122bfc79bc /widgets | |
parent | 5df817c875f094ca6477e54cabb2c5cffffda5c5 (diff) | |
download | gsoc2013-evolution-dad705c65cc4da62ed23ad917321d274246a05a5.tar gsoc2013-evolution-dad705c65cc4da62ed23ad917321d274246a05a5.tar.gz gsoc2013-evolution-dad705c65cc4da62ed23ad917321d274246a05a5.tar.bz2 gsoc2013-evolution-dad705c65cc4da62ed23ad917321d274246a05a5.tar.lz gsoc2013-evolution-dad705c65cc4da62ed23ad917321d274246a05a5.tar.xz gsoc2013-evolution-dad705c65cc4da62ed23ad917321d274246a05a5.tar.zst gsoc2013-evolution-dad705c65cc4da62ed23ad917321d274246a05a5.zip |
Removed the usage of "x" and "y" arguments to EText.
2000-06-21 Christopher James Lahey <clahey@helixcode.com>
* notes/e-note.c, widgets/meeting-time-sel/e-meeting-time-sel.c,
widgets/shortcut-bar/e-icon-bar.c: Removed the usage of "x" and
"y" arguments to EText.
* widgets/e-text/e-text.c, widgets/e-text/e-text.h: Removed the
"x" and "y" arguments to EText. Added vertical scrolling.
svn path=/trunk/; revision=3670
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/e-text/e-text.c | 112 | ||||
-rw-r--r-- | widgets/e-text/e-text.h | 4 | ||||
-rw-r--r-- | widgets/meeting-time-sel/e-meeting-time-sel.c | 11 | ||||
-rw-r--r-- | widgets/shortcut-bar/e-icon-bar.c | 9 | ||||
-rw-r--r-- | widgets/text/e-text.c | 112 | ||||
-rw-r--r-- | widgets/text/e-text.h | 4 |
6 files changed, 150 insertions, 102 deletions
diff --git a/widgets/e-text/e-text.c b/widgets/e-text/e-text.c index 330fa25e81..70174749f8 100644 --- a/widgets/e-text/e-text.c +++ b/widgets/e-text/e-text.c @@ -56,8 +56,6 @@ enum { ARG_MODEL, ARG_EVENT_PROCESSOR, ARG_TEXT, - ARG_X, - ARG_Y, ARG_FONT, ARG_FONTSET, ARG_FONT_GDK, @@ -220,10 +218,6 @@ e_text_class_init (ETextClass *klass) GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_EVENT_PROCESSOR); gtk_object_add_arg_type ("EText::text", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TEXT); - gtk_object_add_arg_type ("EText::x", - GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_X); - gtk_object_add_arg_type ("EText::y", - GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_Y); gtk_object_add_arg_type ("EText::font", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FONT); gtk_object_add_arg_type ("EText::fontset", @@ -309,8 +303,6 @@ e_text_init (EText *text) GTK_SIGNAL_FUNC(e_text_text_model_changed), text); - text->x = 0.0; - text->y = 0.0; text->anchor = GTK_ANCHOR_CENTER; text->justification = GTK_JUSTIFY_LEFT; text->clip_width = -1.0; @@ -325,6 +317,7 @@ e_text_init (EText *text) text->editable = FALSE; text->editing = FALSE; text->xofs_edit = 0; + text->yofs_edit = 0; text->selection_start = 0; text->selection_end = 0; @@ -447,9 +440,9 @@ get_bounds_item_relative (EText *text, double *px1, double *py1, double *px2, do int old_height; item = GNOME_CANVAS_ITEM (text); - - x = text->x; - y = text->y; + + x = 0; + y = 0; clip_x = x; clip_y = y; @@ -478,14 +471,20 @@ get_bounds_item_relative (EText *text, double *px1, double *py1, double *px2, do case GTK_ANCHOR_CENTER: case GTK_ANCHOR_S: x -= text->max_width / 2; - clip_x -= text->clip_width / 2; + if ( text->clip_width >= 0) + clip_x -= text->clip_width / 2; + else + clip_x -= text->width / 2; break; case GTK_ANCHOR_NE: case GTK_ANCHOR_E: case GTK_ANCHOR_SE: x -= text->max_width; - clip_x -= text->clip_width; + if (text->clip_width >= 0) + clip_x -= text->clip_width; + else + clip_x -= text->width; break; } @@ -522,7 +521,10 @@ get_bounds_item_relative (EText *text, double *px1, double *py1, double *px2, do /* maybe do bbox intersection here? */ *px1 = clip_x; *py1 = clip_y; - *px2 = clip_x + text->clip_width; + if (text->clip_width >= 0) + *px2 = clip_x + text->clip_width; + else + *px2 = clip_x + text->width; if ( text->clip_height >= 0 ) *py2 = clip_y + text->clip_height; @@ -546,8 +548,8 @@ get_bounds (EText *text, double *px1, double *py1, double *px2, double *py2) /* Get canvas pixel coordinates for text position */ - wx = text->x; - wy = text->y; + wx = 0; + wy = 0; gnome_canvas_item_i2w (item, &wx, &wy); gnome_canvas_w2c (item->canvas, wx + text->xofs, wy + text->yofs, &text->cx, &text->cy); @@ -992,18 +994,6 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) e_text_model_set_text(text->model, GTK_VALUE_STRING (*arg)); break; - case ARG_X: - text->x = GTK_VALUE_DOUBLE (*arg); - text->needs_recalc_bounds = 1; - needs_update = 1; - break; - - case ARG_Y: - text->y = GTK_VALUE_DOUBLE (*arg); - text->needs_recalc_bounds = 1; - needs_update = 1; - break; - case ARG_FONT: if (text->font) gdk_font_unref (text->font); @@ -1259,14 +1249,6 @@ e_text_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) GTK_VALUE_STRING (*arg) = g_strdup (text->text); break; - case ARG_X: - GTK_VALUE_DOUBLE (*arg) = text->x; - break; - - case ARG_Y: - GTK_VALUE_DOUBLE (*arg) = text->y; - break; - case ARG_FONT_GDK: GTK_VALUE_BOXED (*arg) = text->font; break; @@ -1392,8 +1374,9 @@ e_text_reflow (GnomeCanvasItem *item, int flags) } } lines --; + i--; x = gdk_text_width(text->font, - lines->text, + lines->text, text->selection_end - (lines->text - text->text)); @@ -1404,6 +1387,12 @@ e_text_reflow (GnomeCanvasItem *item, int flags) if (2 + x - text->clip_width > text->xofs_edit) { text->xofs_edit = 2 + x - text->clip_width; } + + if ((text->font->ascent + text->font->descent) * (i - 1) < text->yofs_edit) + text->yofs_edit = (text->font->ascent + text->font->descent) * (i - 1); + + if (2 + (text->font->ascent + text->font->descent) * i - text->clip_height > text->yofs_edit) + text->yofs_edit = 2 + (text->font->ascent + text->font->descent) * i - text->clip_height; } if ( text->needs_calc_height ) { calc_height (text); @@ -1504,7 +1493,7 @@ get_line_xpos_item_relative (EText *text, struct line *line) { double x; - x = text->x; + x = 0; switch (text->anchor) { case GTK_ANCHOR_NW: @@ -1550,7 +1539,7 @@ get_line_ypos_item_relative (EText *text) { double y; - y = text->y; + y = 0; switch (text->anchor) { case GTK_ANCHOR_NW: @@ -1658,6 +1647,8 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, clip_rect = ▭ } ypos = text->cy + text->font->ascent; + if (text->editing) + ypos -= text->yofs_edit; if (text->stipple) gnome_canvas_set_stipple_origin (item->canvas, text->gc); @@ -1965,8 +1956,8 @@ e_text_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double text = E_TEXT (item); - *x1 = text->x; - *y1 = text->y; + *x1 = 0; + *y1 = 0; if (text->clip) { width = text->clip_width; @@ -2031,7 +2022,8 @@ _get_xy_from_position (EText *text, gint position, gint *xp, gint *yp) double xd, yd; int j; x = get_line_xpos_item_relative (text, lines); - y = text->y + text->yofs; + y = text->yofs; + y -= text->yofs_edit; for (j = 0, lines = text->lines; j < text->num_lines; lines++, j++) { if (lines->text > text->text + position) break; @@ -2060,7 +2052,7 @@ static gint _get_position_from_xy (EText *text, gint x, gint y) { int i, j; - int ypos = text->y + text->yofs; + int ypos = text->yofs; int xpos; double xd, yd; @@ -2071,6 +2063,8 @@ _get_position_from_xy (EText *text, gint x, gint y) gnome_canvas_item_w2i (GNOME_CANVAS_ITEM(text), &xd, &yd); x = xd; y = yd; + y += text->yofs_edit; + j = 0; while (y > ypos) { ypos += text->font->ascent + text->font->descent; @@ -2139,6 +2133,22 @@ _blink_scroll_timeout (gpointer data) text->xofs_edit = 0; redraw = TRUE; } + + if (text->lasty - text->clip_cy > text->clip_cheight && + text->yofs_edit < text->height - text->clip_cheight) { + text->yofs_edit += 4; + if (text->yofs_edit > text->height - text->clip_cheight + 1) + text->yofs_edit = text->height - text->clip_cheight + 1; + redraw = TRUE; + } + if (text->lasty - text->clip_cy < 0 && + text->yofs_edit > 0) { + text->yofs_edit -= 4; + if (text->yofs_edit < 0) + text->yofs_edit = 0; + redraw = TRUE; + } + if (redraw) { ETextEventProcessorEvent e_tep_event; e_tep_event.type = GDK_MOTION_NOTIFY; @@ -2206,7 +2216,7 @@ _do_tooltip (gpointer data) gdouble max_width; gboolean cut_off; double i2c[6]; - ArtPoint origin = {text->x, text->y}; + ArtPoint origin = {0, 0}; ArtPoint pixel_origin; int canvas_x, canvas_y; GnomeCanvasItem *tooltip_text; @@ -2253,6 +2263,13 @@ _do_tooltip (gpointer data) gtk_container_set_border_width (GTK_CONTAINER (text->tooltip_window), 1); canvas = e_canvas_new (); + + + + + + + gtk_container_add (GTK_CONTAINER (text->tooltip_window), canvas); /* Get the longest line length */ @@ -2418,6 +2435,7 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event) text->selection_end = 0; text->select_by_word = FALSE; text->xofs_edit = 0; + text->yofs_edit = 0; if (text->timeout_id == 0) text->timeout_id = g_timeout_add(10, _blink_scroll_timeout, text); text->timer = g_timer_new(); @@ -2851,6 +2869,12 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp if (2 + x - text->clip_width > text->xofs_edit) { text->xofs_edit = 2 + x - text->clip_width; } + + if ((text->font->ascent + text->font->descent) * (i - 1) < text->yofs_edit) + text->yofs_edit = (text->font->ascent + text->font->descent) * (i - 1); + + if (2 + (text->font->ascent + text->font->descent) * i - text->clip_height > text->yofs_edit) + text->yofs_edit = 2 + (text->font->ascent + text->font->descent) * i - text->clip_height; } text->needs_redraw = 1; diff --git a/widgets/e-text/e-text.h b/widgets/e-text/e-text.h index 6409ede6dc..cde023fb08 100644 --- a/widgets/e-text/e-text.h +++ b/widgets/e-text/e-text.h @@ -42,8 +42,6 @@ BEGIN_GNOME_DECLS * name type read/write description * ------------------------------------------------------------------------------------------ * text string RW The string of the text label - * x double RW X coordinate of anchor point - * y double RW Y coordinate of anchor point * font string W X logical font descriptor * fontset string W X logical fontset descriptor * font_gdk GdkFont* RW Pointer to a GdkFont @@ -110,7 +108,6 @@ struct _EText { gpointer lines; /* Text split into lines (private field) */ int num_lines; /* Number of lines of text */ - double x, y; /* Position at anchor */ GdkFont *font; /* Font for text */ GtkAnchorType anchor; /* Anchor side for text */ GtkJustification justification; /* Justification for text */ @@ -146,6 +143,7 @@ struct _EText { gboolean editing; /* Item is currently being edited */ int xofs_edit; /* Offset because of editing */ + int yofs_edit; /* Offset because of editing */ /* This needs to be reworked a bit once we get line wrapping. */ int selection_start; /* Start of selection */ diff --git a/widgets/meeting-time-sel/e-meeting-time-sel.c b/widgets/meeting-time-sel/e-meeting-time-sel.c index 99c9430775..10544a81e4 100644 --- a/widgets/meeting-time-sel/e-meeting-time-sel.c +++ b/widgets/meeting-time-sel/e-meeting-time-sel.c @@ -46,6 +46,7 @@ #include <libgnomeui/gnome-canvas-widget.h> #include "../../e-util/e-canvas.h" +#include "e-util/e-canvas-utils.h" #include "e-meeting-time-sel.h" #include "e-meeting-time-sel-item.h" #include "e-meeting-time-sel-list-item.h" @@ -1253,13 +1254,15 @@ e_meeting_time_selector_attendee_add (EMeetingTimeSelector *mts, "max_lines", 1, "editable", TRUE, "text", attendee_name ? attendee_name : "", - "x", (gdouble) E_MEETING_TIME_SELECTOR_ICON_COLUMN_WIDTH - + E_MEETING_TIME_SELECTOR_TEXT_X_PAD, - "y", (gdouble) (mts->attendees->len * mts->row_height + 1 - + E_MEETING_TIME_SELECTOR_TEXT_Y_PAD), "clip_width", (gdouble) item_width, "clip_height", (gdouble) font->ascent + font->descent, NULL); + + e_canvas_item_move_absolute(attendee.text_item, + E_MEETING_TIME_SELECTOR_ICON_COLUMN_WIDTH + + E_MEETING_TIME_SELECTOR_TEXT_X_PAD, + mts->attendees->len * mts->row_height + 1 + + E_MEETING_TIME_SELECTOR_TEXT_Y_PAD); #if 0 gnome_canvas_item_hide (attendee.text_item); #endif diff --git a/widgets/shortcut-bar/e-icon-bar.c b/widgets/shortcut-bar/e-icon-bar.c index dae19b6590..73346b8535 100644 --- a/widgets/shortcut-bar/e-icon-bar.c +++ b/widgets/shortcut-bar/e-icon-bar.c @@ -33,6 +33,7 @@ #include "e-icon-bar.h" #include "e-icon-bar-bg-item.h" #include "../e-text/e-text.h" +#include "e-util/e-canvas-utils.h" /* These are the offsets of the icons & text in both views. Note that the shadow around icons is drawn in the space between items (as is the @@ -437,9 +438,9 @@ e_icon_bar_recalc_item_positions (EIconBar *icon_bar) "anchor", anchor, "max_lines", max_lines, "line_wrap", line_wrap, - "x", text_x, - "y", (gdouble) item->text_y, NULL); + e_canvas_item_move_absolute(item->text, + text_x, item->text_y); /* Get the text item's height. */ gnome_canvas_item_get_bounds (item->text, &x1, &y1, &x2, &y2); @@ -622,13 +623,13 @@ e_icon_bar_add_item (EIconBar *icon_bar, "justification", justify, "line_wrap", TRUE, "max_lines", max_lines, - "x", text_x, - "y", (gdouble) 0, "clip", TRUE, "clip_width", (gdouble) (icon_bar->text_w), "clip_height", clip_height, "text", text, NULL); + e_canvas_item_move_absolute(item.text, + text_x, 0); gtk_signal_connect (GTK_OBJECT (item.text), "event", GTK_SIGNAL_FUNC (e_icon_bar_on_item_event), diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c index 330fa25e81..70174749f8 100644 --- a/widgets/text/e-text.c +++ b/widgets/text/e-text.c @@ -56,8 +56,6 @@ enum { ARG_MODEL, ARG_EVENT_PROCESSOR, ARG_TEXT, - ARG_X, - ARG_Y, ARG_FONT, ARG_FONTSET, ARG_FONT_GDK, @@ -220,10 +218,6 @@ e_text_class_init (ETextClass *klass) GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_EVENT_PROCESSOR); gtk_object_add_arg_type ("EText::text", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TEXT); - gtk_object_add_arg_type ("EText::x", - GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_X); - gtk_object_add_arg_type ("EText::y", - GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_Y); gtk_object_add_arg_type ("EText::font", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FONT); gtk_object_add_arg_type ("EText::fontset", @@ -309,8 +303,6 @@ e_text_init (EText *text) GTK_SIGNAL_FUNC(e_text_text_model_changed), text); - text->x = 0.0; - text->y = 0.0; text->anchor = GTK_ANCHOR_CENTER; text->justification = GTK_JUSTIFY_LEFT; text->clip_width = -1.0; @@ -325,6 +317,7 @@ e_text_init (EText *text) text->editable = FALSE; text->editing = FALSE; text->xofs_edit = 0; + text->yofs_edit = 0; text->selection_start = 0; text->selection_end = 0; @@ -447,9 +440,9 @@ get_bounds_item_relative (EText *text, double *px1, double *py1, double *px2, do int old_height; item = GNOME_CANVAS_ITEM (text); - - x = text->x; - y = text->y; + + x = 0; + y = 0; clip_x = x; clip_y = y; @@ -478,14 +471,20 @@ get_bounds_item_relative (EText *text, double *px1, double *py1, double *px2, do case GTK_ANCHOR_CENTER: case GTK_ANCHOR_S: x -= text->max_width / 2; - clip_x -= text->clip_width / 2; + if ( text->clip_width >= 0) + clip_x -= text->clip_width / 2; + else + clip_x -= text->width / 2; break; case GTK_ANCHOR_NE: case GTK_ANCHOR_E: case GTK_ANCHOR_SE: x -= text->max_width; - clip_x -= text->clip_width; + if (text->clip_width >= 0) + clip_x -= text->clip_width; + else + clip_x -= text->width; break; } @@ -522,7 +521,10 @@ get_bounds_item_relative (EText *text, double *px1, double *py1, double *px2, do /* maybe do bbox intersection here? */ *px1 = clip_x; *py1 = clip_y; - *px2 = clip_x + text->clip_width; + if (text->clip_width >= 0) + *px2 = clip_x + text->clip_width; + else + *px2 = clip_x + text->width; if ( text->clip_height >= 0 ) *py2 = clip_y + text->clip_height; @@ -546,8 +548,8 @@ get_bounds (EText *text, double *px1, double *py1, double *px2, double *py2) /* Get canvas pixel coordinates for text position */ - wx = text->x; - wy = text->y; + wx = 0; + wy = 0; gnome_canvas_item_i2w (item, &wx, &wy); gnome_canvas_w2c (item->canvas, wx + text->xofs, wy + text->yofs, &text->cx, &text->cy); @@ -992,18 +994,6 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) e_text_model_set_text(text->model, GTK_VALUE_STRING (*arg)); break; - case ARG_X: - text->x = GTK_VALUE_DOUBLE (*arg); - text->needs_recalc_bounds = 1; - needs_update = 1; - break; - - case ARG_Y: - text->y = GTK_VALUE_DOUBLE (*arg); - text->needs_recalc_bounds = 1; - needs_update = 1; - break; - case ARG_FONT: if (text->font) gdk_font_unref (text->font); @@ -1259,14 +1249,6 @@ e_text_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) GTK_VALUE_STRING (*arg) = g_strdup (text->text); break; - case ARG_X: - GTK_VALUE_DOUBLE (*arg) = text->x; - break; - - case ARG_Y: - GTK_VALUE_DOUBLE (*arg) = text->y; - break; - case ARG_FONT_GDK: GTK_VALUE_BOXED (*arg) = text->font; break; @@ -1392,8 +1374,9 @@ e_text_reflow (GnomeCanvasItem *item, int flags) } } lines --; + i--; x = gdk_text_width(text->font, - lines->text, + lines->text, text->selection_end - (lines->text - text->text)); @@ -1404,6 +1387,12 @@ e_text_reflow (GnomeCanvasItem *item, int flags) if (2 + x - text->clip_width > text->xofs_edit) { text->xofs_edit = 2 + x - text->clip_width; } + + if ((text->font->ascent + text->font->descent) * (i - 1) < text->yofs_edit) + text->yofs_edit = (text->font->ascent + text->font->descent) * (i - 1); + + if (2 + (text->font->ascent + text->font->descent) * i - text->clip_height > text->yofs_edit) + text->yofs_edit = 2 + (text->font->ascent + text->font->descent) * i - text->clip_height; } if ( text->needs_calc_height ) { calc_height (text); @@ -1504,7 +1493,7 @@ get_line_xpos_item_relative (EText *text, struct line *line) { double x; - x = text->x; + x = 0; switch (text->anchor) { case GTK_ANCHOR_NW: @@ -1550,7 +1539,7 @@ get_line_ypos_item_relative (EText *text) { double y; - y = text->y; + y = 0; switch (text->anchor) { case GTK_ANCHOR_NW: @@ -1658,6 +1647,8 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, clip_rect = ▭ } ypos = text->cy + text->font->ascent; + if (text->editing) + ypos -= text->yofs_edit; if (text->stipple) gnome_canvas_set_stipple_origin (item->canvas, text->gc); @@ -1965,8 +1956,8 @@ e_text_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double text = E_TEXT (item); - *x1 = text->x; - *y1 = text->y; + *x1 = 0; + *y1 = 0; if (text->clip) { width = text->clip_width; @@ -2031,7 +2022,8 @@ _get_xy_from_position (EText *text, gint position, gint *xp, gint *yp) double xd, yd; int j; x = get_line_xpos_item_relative (text, lines); - y = text->y + text->yofs; + y = text->yofs; + y -= text->yofs_edit; for (j = 0, lines = text->lines; j < text->num_lines; lines++, j++) { if (lines->text > text->text + position) break; @@ -2060,7 +2052,7 @@ static gint _get_position_from_xy (EText *text, gint x, gint y) { int i, j; - int ypos = text->y + text->yofs; + int ypos = text->yofs; int xpos; double xd, yd; @@ -2071,6 +2063,8 @@ _get_position_from_xy (EText *text, gint x, gint y) gnome_canvas_item_w2i (GNOME_CANVAS_ITEM(text), &xd, &yd); x = xd; y = yd; + y += text->yofs_edit; + j = 0; while (y > ypos) { ypos += text->font->ascent + text->font->descent; @@ -2139,6 +2133,22 @@ _blink_scroll_timeout (gpointer data) text->xofs_edit = 0; redraw = TRUE; } + + if (text->lasty - text->clip_cy > text->clip_cheight && + text->yofs_edit < text->height - text->clip_cheight) { + text->yofs_edit += 4; + if (text->yofs_edit > text->height - text->clip_cheight + 1) + text->yofs_edit = text->height - text->clip_cheight + 1; + redraw = TRUE; + } + if (text->lasty - text->clip_cy < 0 && + text->yofs_edit > 0) { + text->yofs_edit -= 4; + if (text->yofs_edit < 0) + text->yofs_edit = 0; + redraw = TRUE; + } + if (redraw) { ETextEventProcessorEvent e_tep_event; e_tep_event.type = GDK_MOTION_NOTIFY; @@ -2206,7 +2216,7 @@ _do_tooltip (gpointer data) gdouble max_width; gboolean cut_off; double i2c[6]; - ArtPoint origin = {text->x, text->y}; + ArtPoint origin = {0, 0}; ArtPoint pixel_origin; int canvas_x, canvas_y; GnomeCanvasItem *tooltip_text; @@ -2253,6 +2263,13 @@ _do_tooltip (gpointer data) gtk_container_set_border_width (GTK_CONTAINER (text->tooltip_window), 1); canvas = e_canvas_new (); + + + + + + + gtk_container_add (GTK_CONTAINER (text->tooltip_window), canvas); /* Get the longest line length */ @@ -2418,6 +2435,7 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event) text->selection_end = 0; text->select_by_word = FALSE; text->xofs_edit = 0; + text->yofs_edit = 0; if (text->timeout_id == 0) text->timeout_id = g_timeout_add(10, _blink_scroll_timeout, text); text->timer = g_timer_new(); @@ -2851,6 +2869,12 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp if (2 + x - text->clip_width > text->xofs_edit) { text->xofs_edit = 2 + x - text->clip_width; } + + if ((text->font->ascent + text->font->descent) * (i - 1) < text->yofs_edit) + text->yofs_edit = (text->font->ascent + text->font->descent) * (i - 1); + + if (2 + (text->font->ascent + text->font->descent) * i - text->clip_height > text->yofs_edit) + text->yofs_edit = 2 + (text->font->ascent + text->font->descent) * i - text->clip_height; } text->needs_redraw = 1; diff --git a/widgets/text/e-text.h b/widgets/text/e-text.h index 6409ede6dc..cde023fb08 100644 --- a/widgets/text/e-text.h +++ b/widgets/text/e-text.h @@ -42,8 +42,6 @@ BEGIN_GNOME_DECLS * name type read/write description * ------------------------------------------------------------------------------------------ * text string RW The string of the text label - * x double RW X coordinate of anchor point - * y double RW Y coordinate of anchor point * font string W X logical font descriptor * fontset string W X logical fontset descriptor * font_gdk GdkFont* RW Pointer to a GdkFont @@ -110,7 +108,6 @@ struct _EText { gpointer lines; /* Text split into lines (private field) */ int num_lines; /* Number of lines of text */ - double x, y; /* Position at anchor */ GdkFont *font; /* Font for text */ GtkAnchorType anchor; /* Anchor side for text */ GtkJustification justification; /* Justification for text */ @@ -146,6 +143,7 @@ struct _EText { gboolean editing; /* Item is currently being edited */ int xofs_edit; /* Offset because of editing */ + int yofs_edit; /* Offset because of editing */ /* This needs to be reworked a bit once we get line wrapping. */ int selection_start; /* Start of selection */ |