aboutsummaryrefslogtreecommitdiff
path: root/generic/Field.c
diff options
context:
space:
mode:
authorlecoanet2002-09-09 08:46:56 +0000
committerlecoanet2002-09-09 08:46:56 +0000
commit6cf1bfbea85fd3bad84b7ed2f3d5aafaafe97940 (patch)
tree66b9c41955d356ce044e6cc43547b741a3c2ea5c /generic/Field.c
parent19dc3f5a6158de1de56b8a38fbe1d2f5b5cc4b03 (diff)
downloadtkzinc-6cf1bfbea85fd3bad84b7ed2f3d5aafaafe97940.zip
tkzinc-6cf1bfbea85fd3bad84b7ed2f3d5aafaafe97940.tar.gz
tkzinc-6cf1bfbea85fd3bad84b7ed2f3d5aafaafe97940.tar.bz2
tkzinc-6cf1bfbea85fd3bad84b7ed2f3d5aafaafe97940.tar.xz
* (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�.
Diffstat (limited to 'generic/Field.c')
-rw-r--r--generic/Field.c19
1 files changed, 13 insertions, 6 deletions
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,