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;
}
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);
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 ();
}