aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-04-30 03:06:24 +0800
committerChris Lahey <clahey@src.gnome.org>2001-04-30 03:06:24 +0800
commitc4ff4d8239386bd6d88ace67e4ab7bf88ff49586 (patch)
tree1d3f5fa00e3a7d2ef3bc260ff3f379f6e9fa712f
parent9071df0d8f6eae44b673c63a6561ef4ddff86110 (diff)
downloadgsoc2013-evolution-c4ff4d8239386bd6d88ace67e4ab7bf88ff49586.tar.gz
gsoc2013-evolution-c4ff4d8239386bd6d88ace67e4ab7bf88ff49586.tar.zst
gsoc2013-evolution-c4ff4d8239386bd6d88ace67e4ab7bf88ff49586.zip
Made fewer calls to functions like split_into_lines to save time when
2001-04-29 Christopher James Lahey <clahey@ximian.com> * gal/e-text/e-text.c: Made fewer calls to functions like split_into_lines to save time when possible. svn path=/trunk/; revision=9629
-rw-r--r--widgets/text/e-text.c139
1 files changed, 53 insertions, 86 deletions
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index 55053b979f..c77c5d5d9b 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -430,7 +430,7 @@ e_text_init (EText *text)
text->strikeout = FALSE;
text->style = E_FONT_PLAIN;
-
+
e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(text), e_text_reflow);
}
@@ -663,10 +663,6 @@ get_bounds (EText *text, double *px1, double *py1, double *px2, double *py2)
gnome_canvas_item_i2w (item, &wx, &wy);
gnome_canvas_w2c (item->canvas, wx + text->xofs, wy + text->yofs, &text->cx, &text->cy);
- /* Calculate the width and heights */
- calc_height (text);
- calc_line_widths (text);
-
if (text->clip_width < 0)
clip_width = text->max_width;
else
@@ -751,10 +747,6 @@ calc_height (EText *text)
old_height = text->height;
- /* Make sure the text is split into lines first */
- if (text->text && text->num_lines == 0)
- split_into_lines (text);
-
if (text->text && text->font)
text->height = e_font_height (text->font) * text->num_lines;
else
@@ -783,10 +775,6 @@ calc_line_widths (EText *text)
gdouble clip_width;
const gchar *p;
- /* Make sure line has been split */
- if (text->text && text->num_lines == 0)
- split_into_lines (text);
-
lines = text->lines;
text->max_width = 0;
@@ -926,12 +914,13 @@ split_into_lines (EText *text)
double clip_width;
gunichar unival;
- /* Free old array of lines */
- e_text_free_lines(text);
- if (!text->text)
+ if (text->text == NULL)
return;
+ /* Free old array of lines */
+ e_text_free_lines(text);
+
/* First, count the number of lines */
lastend = text->text;
@@ -1218,21 +1207,14 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
e_font_unref (text->font);
text->font = e_font_from_gdk_name (GTK_VALUE_STRING (*arg));
-
-#if 0
- if (item->canvas->aa) {
- if (text->suckfont)
- e_suck_font_free (text->suckfont);
-
- text->suckfont = e_suck_font (text->font);
- }
-#endif
calc_ellipsis (text);
if ( text->line_wrap )
text->needs_split_into_lines = 1;
- else
+ else {
text->needs_calc_line_widths = 1;
+ text->needs_calc_height = 1;
+ }
needs_reflow = 1;
break;
@@ -1242,20 +1224,13 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
text->font = e_font_from_gdk_name (GTK_VALUE_STRING (*arg));
-#if 0
- if (item->canvas->aa) {
- if (text->suckfont)
- e_suck_font_free (text->suckfont);
-
- text->suckfont = e_suck_font (text->font);
- }
-#endif
-
calc_ellipsis (text);
if ( text->line_wrap )
text->needs_split_into_lines = 1;
- else
+ else {
text->needs_calc_line_widths = 1;
+ text->needs_calc_height = 1;
+ }
needs_reflow = 1;
break;
@@ -1267,22 +1242,17 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
e_font_unref (text->font);
text->font = e_font_from_gdk_font (GTK_VALUE_POINTER (*arg));
-#if 0
- if (item->canvas->aa) {
- if (text->suckfont)
- e_suck_font_free (text->suckfont);
-
- text->suckfont = e_suck_font (text->font);
- }
-#endif
calc_ellipsis (text);
if ( text->line_wrap )
text->needs_split_into_lines = 1;
- else
+ else {
text->needs_calc_line_widths = 1;
+ text->needs_calc_height = 1;
+ }
needs_reflow = 1;
break;
+
case ARG_FONT_E:
if (text->font)
e_font_unref (text->font);
@@ -1292,10 +1262,13 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
calc_ellipsis (text);
if (text->line_wrap)
text->needs_split_into_lines = 1;
- else
+ else {
text->needs_calc_line_widths = 1;
+ text->needs_calc_height = 1;
+ }
needs_reflow = 1;
break;
+
case ARG_BOLD:
text->bold = GTK_VALUE_BOOL (*arg);
text->style = text->bold ? E_FONT_BOLD : E_FONT_PLAIN;
@@ -1304,16 +1277,20 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
text->needs_recalc_bounds = 1;
if ( text->line_wrap )
text->needs_split_into_lines = 1;
- else
+ else {
text->needs_calc_line_widths = 1;
+ text->needs_calc_height = 1;
+ }
needs_update = 1;
needs_reflow = 1;
break;
+
case ARG_STRIKEOUT:
text->strikeout = GTK_VALUE_BOOL (*arg);
text->needs_redraw = 1;
needs_update = 1;
break;
+
case ARG_ANCHOR:
text->anchor = GTK_VALUE_ENUM (*arg);
text->needs_recalc_bounds = 1;
@@ -1331,8 +1308,10 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
calc_ellipsis (text);
if ( text->line_wrap )
text->needs_split_into_lines = 1;
- else
+ else {
text->needs_calc_line_widths = 1;
+ text->needs_calc_height = 1;
+ }
needs_reflow = 1;
break;
@@ -1347,8 +1326,10 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
calc_ellipsis (text);
if ( text->line_wrap )
text->needs_split_into_lines = 1;
- else
+ else {
text->needs_calc_line_widths = 1;
+ text->needs_calc_height = 1;
+ }
needs_reflow = 1;
break;
@@ -1457,8 +1438,10 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
calc_ellipsis (text);
if ( text->line_wrap )
text->needs_split_into_lines = 1;
- else
+ else {
text->needs_calc_line_widths = 1;
+ text->needs_calc_height = 1;
+ }
needs_reflow = 1;
break;
@@ -1478,7 +1461,7 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
text->needs_redraw = 1;
}
break;
-
+
case ARG_ALLOW_NEWLINES:
_get_tep(text);
gtk_object_set (GTK_OBJECT (text->tep),
@@ -1678,19 +1661,21 @@ e_text_reflow (GnomeCanvasItem *item, int flags)
text = E_TEXT (item);
- if ( text->needs_split_into_lines ) {
- split_into_lines(text);
+ if (text->needs_split_into_lines) {
+ split_into_lines (text);
+
text->needs_split_into_lines = 0;
text->needs_calc_line_widths = 1;
+ text->needs_calc_height = 1;
}
+
if ( text->needs_calc_line_widths ) {
int x;
int i;
struct line *lines;
gdouble clip_width;
- calc_line_widths(text);
+ calc_line_widths (text);
text->needs_calc_line_widths = 0;
- text->needs_calc_height = 1;
text->needs_redraw = 1;
lines = text->lines;
@@ -1708,7 +1693,6 @@ e_text_reflow (GnomeCanvasItem *item, int flags)
text->font, text->style,
lines->text,
text->selection_end - (lines->text - text->text));
-
if (x < text->xofs_edit) {
text->xofs_edit = x;
@@ -1724,10 +1708,10 @@ e_text_reflow (GnomeCanvasItem *item, int flags)
if (2 + x - clip_width > text->xofs_edit) {
text->xofs_edit = 2 + x - clip_width;
}
-
+
if (e_font_height (text->font) * i < text->yofs_edit)
text->yofs_edit = e_font_height (text->font) * i;
-
+
if (e_font_height (text->font) * (i + 1) -
(text->clip_height != -1 ? text->clip_height : text->height) > text->yofs_edit)
text->yofs_edit = e_font_height (text->font) * (i + 1) -
@@ -1771,6 +1755,7 @@ e_text_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int fla
item->x2 = x2;
item->y2 = y2;
text->needs_redraw = 1;
+ item->canvas->need_repick = TRUE;
}
} else {
/* aa rendering */
@@ -2319,10 +2304,6 @@ e_text_point (GnomeCanvasItem *item, double x, double y,
double clip_width;
double clip_height;
- /* Calculate the width and heights */
- calc_height (text);
- calc_line_widths (text);
-
if (text->clip_width < 0)
clip_width = text->max_width;
else
@@ -2817,8 +2798,9 @@ _do_tooltip (gpointer data)
e_canvas_item_move_absolute(tooltip_text, 1, 1);
- calc_height(E_TEXT(tooltip_text));
- calc_line_widths(E_TEXT(tooltip_text));
+ split_into_lines (E_TEXT(tooltip_text));
+ calc_height (E_TEXT(tooltip_text));
+ calc_line_widths (E_TEXT(tooltip_text));
gnome_canvas_item_set (tooltip_text,
"clip_height", (double) E_TEXT(tooltip_text)->height,
"clip_width", (double) E_TEXT(tooltip_text)->max_width,
@@ -2875,21 +2857,6 @@ _do_tooltip (gpointer data)
tooltip_x -= tooltip_width;
break;
}
-#if 0
- get_bounds(text, &x1, &y1, &x2, &y2);
- if ( x1 < tooltip_x ) {
- gnome_canvas_item_move(tooltip_text, tooltip_x - x1, 0);
- tooltip_x = x1;
- }
- if ( y1 < tooltip_y ) {
- gnome_canvas_item_move(tooltip_text, 0, tooltip_y - y1);
- tooltip_y = y1;
- }
- if ( x2 > tooltip_x + tooltip_width )
- tooltip_width = x2 - tooltip_x;
- if ( y2 > tooltip_y + tooltip_height )
- tooltip_height = y2 - tooltip_y;
-#endif
gnome_canvas_item_set(rect,
"x2", (double) tooltip_width + 4 + (text->draw_borders ? BORDER_INDENT * 2 : 0),
@@ -3119,19 +3086,26 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event)
break;
case GDK_ENTER_NOTIFY:
{
+#if 0
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
double x1, y1, x2, y2;
+ split_into_lines (text);
+ calc_height (text);
+ calc_line_widths (text);
get_bounds (text, &x1, &y1, &x2, &y2);
if (crossing->x >= x1 &&
crossing->y >= y1 &&
crossing->x <= x2 &&
crossing->y <= y2) {
+#endif
if ( text->tooltip_count == 0 && text->clip) {
if (!text->tooltip_timeout)
text->tooltip_timeout = gtk_timeout_add (1000, _do_tooltip, text);
}
text->tooltip_count ++;
+#if 0
}
+#endif
}
text->pointer_in = TRUE;
@@ -3867,10 +3841,3 @@ e_suck_font_free (ETextSuckFont *suckfont)
g_free (suckfont);
}
#endif
-
-
-
-
-
-
-
class='commitgraph'>| * - Remove useless -pthread replaceDmitry Marakasov2015-03-261-1/+1 | * Remove PTHREAD_LIBS, PTHREAD_CFLAGS from my portsDmitry Marakasov2015-03-261-1/+1 | * Replace USES=libtool:oldver with USES=libtool or USES=libtool:keepla inTijl Coosemans2014-12-091-1/+1 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the 32 ports that still use it. Bump PORTREVISION on their dependent ports except the ones that depend on these: audio/libogg audio/libvorbis devel/pcre ftp/curl graphics/jpeg graphics/libart_lgpl graphics/tiff textproc/expat2 textproc/libxslt In these cases the same trick as in the recent gettext update is used. The ports install a symlink with the old library version. When enough of their dependent ports have had regular updates the remaining ones can get a PORTREVISION bump and the links can be removed. Also remove the devel/pcre dependency from USE_GNOME=glib20. It causes over 2200 packages to depend on devel/pcre while less than 200 actually link with it. The glib20 package still depends on devel/pcre so this should not make a difference for ports with USE_GNOME=glib20. Also, libdata/pkgconfig/glib-2.0.pc lists pcre as a private library so USE_GNOME=glib20 should not propagate it. PR: 195724 Exp-run by: antoine Approved by: portmgr (antoine) * - Convert to USES=pythonDmitry Marakasov2014-09-291-2/+1 | * Update the default version of GCC in the Ports Collection from GCC 4.7.4Gerald Pfeifer2014-09-111-1/+1 | | | | | | | | | | to GCC 4.8.3. Part II, Bump PORTREVISIONs. PR: 192025 Tested by: antoine (-exp runs) Approved by: portmgr (implicit) * The FreeBSD x11@ and graphics team proudly presentsNiclas Zeising2014-04-171-0/+1 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a zeising, kwm production, with help from dumbbell, bdrewery: NEW XORG ON FREEBSD 9-STABLE AND 10-STABLE This update switches over to use the new xorg stack by default on FreeBSD 9 and 10 stable, on osversions where vt(9) is available. It is still possible to use the old stack by specifying WITHOUT_NEW_XORG in /etc/make.conf . FreeBSD 8-STABLE and released versions of FreeBSD still use the old version. A package repository with binary packages for new xorg will be available soon. This patch also contains updates of libxcb and related ports, pixman, as well as some drivers and utilities. Bump portrevisions for xf86-* ports, as well as virtualbox-ose-additions due to xserver version change. Apart from these updates, the way shared libraries are handled has been changed for all xorg ports, as well as libxml2 and freetype, which means ltverhack is gone and as a consequence shared libraries have been bumped. The plan is that this change will make library bumps less likely in the future. All affected ports have had their portrevisions bumped as a consequence of this. Fix some issues where WITH_NEW_XORG weren't detected properly on CURRENT. Update instructions, hardware support, and more notes can be found on https://wiki.freebsd.org/Graphics Thanks to: all testers, bdrewery and the FreeBSD x11@ team exp-run by: bdrewery [1] PR: ports/187602 [1] Approved by: portmgr (bdrewery), core (jhb) * - Fix the usage of 'python' to get rid of the implicit lang/pythonMarcus von Appen2013-12-151-1/+3 | | | | | | | | dependency - Restrict the build to the supported Python versions Reported by: exp-run (PR 184591) Approved by: portmgr (blanket) * - Fix build on currentDmitry Marakasov2013-11-081-0/+1 | | | | | PR: 183774 Submitted by: Pavlo Greenberg <dog@virtual.org.ua> * - Update to 0.6.2Dmitry Marakasov2013-11-083-526/+21 | | | | | - Support staging - Use new LIB_DEPENDS syntax * Add NO_STAGE all over the place in preparation for the staging support (cat: ↵Baptiste Daroussin2013-09-211-0/+1 | | | | games) * Fix build with clang/libc++Dmitry Marakasov2013-09-171-1/+1 | * - Remove MAKE_JOBS_SAFE variableAlex Kozlov2013-08-151-1/+0 | | | | Approved by: portmgr (bdrewery) * - Trim Makefile headersDmitry Marakasov2013-07-121-1/+1 | | | | | | | | | - Drop ABI versions from LIB_DEPENDS - OptionsNG - Pet portlint - Switch to dynamic plist where useful - Canonicalize patch names - Fix DOS line endings in patch files * - adopt optionsNG for gamesJason Helfman2013-05-311-11/+8 | | | | | | | - trim historical headers and trim comments - some Makefile cleanup Approved by: portmgr (bapt) * Bump PORTREVISION after DESKTOP_ENTRIES updateMax Brazhnikov2013-01-231-1/+1 | * - Update devel/sdl12 to 1.2.15Marcus von Appen2012-02-181-0/+1 | | | | | | | | | | | | | - Update audio/sdl_mixer to 1.2.15 - Update graphics/sdl_image to 1.2.12 - Update graphics/sdl_ttf to 2.0.11 - Update graphics/sdl_gfx to 2.0.23 - Update net/sdl_net to 1.2.8 - Bump PORTREVISIONs on ports that depend on one or more packages due to ABI and shared library version changes - Update Mk/bsd.sdl.mk accordingly for the new shared library versions Tested by: exp-run by pav * - Update to 0.6.1Dmitry Marakasov2011-08-103-5/+214 | * - Update to 0.6.0Dmitry Marakasov2011-08-047-111/+138 | | | | | PR: 156344 Submitted by: David Demelier <demelier.david@gmail.com> * -remove MD5Olli Hauer2011-07-031-2/+0 | * - Fix possible server segfaultsDmitry Marakasov2010-06-243-0/+36 | | | | | | PR: 148081 Submitted by: David DEMELIER <demelier.david@gmail.com> Feature safe: yes * Mark as broken on ia64: gets bus error.Mark Linimon2010-04-041-0/+4 | | | | Hat: portmgr * - Update to 0.5.2Dmitry Marakasov2009-10-302-4/+5 | * - Add DESKTOP_ENTRY to bunch of portsDmitry Marakasov2009-09-12