From 6cf1bfbea85fd3bad84b7ed2f3d5aafaafe97940 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Mon, 9 Sep 2002 08:46:56 +0000 Subject: * (DrawField): Correction de l'affichage parasit� sur la selection du 1er field d'un tabular/etiquette en X. * Correction de bugs r�siduels suite au changement de la repr�sentation d'un texte vide. * (FieldsEngine): Correction du bug de selection qui montrait la selection dans tous les champs apr�s le champ manipul�. --- generic/Field.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'generic') diff --git a/generic/Field.c b/generic/Field.c index 286e5fb..b2499a3 100644 --- a/generic/Field.c +++ b/generic/Field.c @@ -204,9 +204,12 @@ ComputeFieldAttachment(FieldSet field_set, break; case LF_DIM_AUTO: { - int len = strlen(field_ptr->text); + int len = 0; ZnDim text_width; + if (field_ptr->text) { + len = strlen(field_ptr->text); + } real_width = 0.0; if (field_ptr->image != ZnUnspecifiedImage) { real_width = (ZnDim) icon_width; @@ -253,7 +256,7 @@ ComputeFieldAttachment(FieldSet field_set, if (field_ptr->image != ZnUnspecifiedImage) { real_height = (ZnDim) icon_height; } - if (strlen(field_ptr->text)) { + if (field_ptr->text && strlen(field_ptr->text)) { Tk_GetFontMetrics(field_ptr->font, &fm); text_height = (ZnDim) (fm.ascent + fm.descent); real_height = text_height < real_height ? real_height : text_height; @@ -706,7 +709,7 @@ LeaderToLabel(FieldSet field_set, /* * Empty text. */ - if (field_ptr->text[scan_forw] == 0) { + if (!field_ptr->text || (field_ptr->text[scan_forw] == 0)) { continue; } @@ -1593,7 +1596,7 @@ FieldsEngine(FieldSet field_set, ZnDim lwidth, lheight; ZnReal val; int cursor; - int sel_start = -1, sel_stop = -1; + int sel_start, sel_stop; if (!field_set->num_fields) { return; @@ -1642,6 +1645,8 @@ FieldsEngine(FieldSet field_set, restore |= val < 0; cursor = -1; + sel_start = -1, sel_stop = -1; + if (field_ptr->text) { if ((field_set->item == wi->focus_item) && (wi->focus_field == i) && wi->got_focus && ti->cursor_on) { @@ -1816,7 +1821,8 @@ DrawField(WidgetInfo *wi, if (num_chars) { if (sel_start >= 0) { values.foreground = ZnPixel(ZnGetGradientColor(ti->sel_color, 0, NULL)); - XChangeGC(wi->dpy, wi->gc, GCForeground, &values); + values.fill_style = FillSolid; + XChangeGC(wi->dpy, wi->gc, GCForeground|GCFillStyle, &values); XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc, text_bbox->orig.x+sel_start, text_bbox->orig.y, sel_stop-sel_start, @@ -1833,7 +1839,8 @@ DrawField(WidgetInfo *wi, if (cursor >= 0) { values.line_width = ti->insert_width; values.foreground = ZnPixel(ZnGetGradientColor(ti->insert_color, 0, NULL)); - XChangeGC(wi->dpy, wi->gc, GCForeground|GCLineWidth, &values); + values.fill_style = FillSolid; + XChangeGC(wi->dpy, wi->gc, GCForeground|GCLineWidth|GCFillStyle, &values); xs = text_bbox->orig.x + cursor; XDrawLine(wi->dpy, wi->draw_buffer, wi->gc, xs, text_bbox->orig.y, -- cgit v1.1