From 91e188fd49c2f9c1494eb00292a41050a9157e12 Mon Sep 17 00:00:00 2001 From: handa Date: Mon, 23 Nov 2009 23:29:15 +0000 Subject: [PATCH] (get_features): Adjusted for the change of FeatureRec->features. (FeatureProc): Don't re-order FeatureRec->features. --- example/otfview.c | 75 +++++++++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 43 deletions(-) diff --git a/example/otfview.c b/example/otfview.c index 1c68f40..4be053f 100644 --- a/example/otfview.c +++ b/example/otfview.c @@ -299,18 +299,15 @@ get_features (OTF_FeatureList *list, FeatureRec *rec) if (! rec->langsys || ! rec->features || ! rec->features[0].on) return NULL; for (i = n = 0; i < rec->langsys->FeatureCount; i++) - { - if (rec->features[i].on) - n++; - else - break; - } + if (rec->features[i].on) + n++; str = malloc (n * 5); for (i = 0, p = str; i < n; i++, p += 5) - { - OTF_tag_name (rec->features[i].tag, p); - p[4] = ','; - } + if (rec->features[i].on) + { + OTF_tag_name (rec->features[i].tag, p); + p[4] = ','; + } p[-1] = '\0'; return str; } @@ -901,43 +898,35 @@ FeatureProc (Widget w, XtPointer client_data, XtPointer call_data) if (idx < 0) { int on = idx == -2; + char str[5]; - for (i = j = 0; j < rec->langsys->FeatureCount; j++) - { - int index = rec->langsys->FeatureIndex[j]; - - rec->features[j].tag - = rec->gsub_gpos->FeatureList.Feature[index].FeatureTag; - rec->features[j].on = on; - } + for (i = 0; i < rec->langsys->FeatureCount; i++) + if (rec->features[i].on != on) + { + rec->features[i].on = on; + if (on) + { + XtSetArg (arg[0], XtNborderWidth, 3); + XtSetArg (arg[1], XtNinternalHeight, 2); + XtSetArg (arg[2], XtNinternalWidth, 2); + } + else + { + XtSetArg (arg[0], XtNborderWidth, 1); + XtSetArg (arg[1], XtNinternalHeight, 4); + XtSetArg (arg[2], XtNinternalWidth, 4); + } + OTF_tag_name (rec->features[i].tag, str); + XtSetArg (arg[3], XtNlabel, str); + XtSetValues (rec->features[i].w, arg, 4); + } } else { - OTF_Tag tag = rec->features[idx].tag; - - i = idx; - if (rec->features[i].on) - { - for (j = i + 1; - j < rec->langsys->FeatureCount && rec->features[j].on; j++) - rec->features[j - 1].tag = rec->features[j].tag; - rec->features[j - 1].tag = tag; - rec->features[j - 1].on = 0; - } - else - { - for (j = i + 1; i > 0 && ! rec->features[i - 1].on; i--) - rec->features[i].tag = rec->features[i - 1].tag; - rec->features[i].tag = tag; - rec->features[i].on = 1; - } - } - - for (; i < j; i++) - { char str[5]; - if (rec->features[i].on) + rec->features[idx].on = ! rec->features[idx].on; + if (rec->features[idx].on) { XtSetArg (arg[0], XtNborderWidth, 3); XtSetArg (arg[1], XtNinternalHeight, 2); @@ -949,9 +938,9 @@ FeatureProc (Widget w, XtPointer client_data, XtPointer call_data) XtSetArg (arg[1], XtNinternalHeight, 4); XtSetArg (arg[2], XtNinternalWidth, 4); } - OTF_tag_name (rec->features[i].tag, str); + OTF_tag_name (rec->features[idx].tag, str); XtSetArg (arg[3], XtNlabel, str); - XtSetValues (rec->features[i].w, arg, 4); + XtSetValues (rec->features[idx].w, arg, 4); } update_seq_area (); } -- 1.7.10.4