From 1b7887af1dcaed1419c8991082f6dce75eef0786 Mon Sep 17 00:00:00 2001 From: handa Date: Sun, 8 Aug 2004 23:40:31 +0000 Subject: [PATCH] (FeatureProc): Highlight selected features by changing border width, not by changing fore and back color. (setup_feature_rec): Setup internal height and width of widgets. (create_otf_widgets): Likewise. --- example/otfview.c | 51 +++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/example/otfview.c b/example/otfview.c index 8edc649..83f7c13 100644 --- a/example/otfview.c +++ b/example/otfview.c @@ -691,7 +691,7 @@ FeatureProc (Widget w, XtPointer client_data, XtPointer call_data) { FeatureRec *rec = (FeatureRec *) client_data; int idx, i, j; - Arg arg[3]; + Arg arg[4]; char *label; if (! rec->langsys) @@ -748,25 +748,22 @@ FeatureProc (Widget w, XtPointer client_data, XtPointer call_data) for (; i < j; i++) { char str[5]; - unsigned fore = foreground, back = background; -#if 0 - if (i == idx) - fore = background, back = foreground; -#endif if (rec->features[i].on) { - XtSetArg (arg[0], XtNforeground, back); - XtSetArg (arg[1], XtNbackground, fore); + XtSetArg (arg[0], XtNborderWidth, 3); + XtSetArg (arg[1], XtNinternalHeight, 2); + XtSetArg (arg[2], XtNinternalWidth, 2); } else { - XtSetArg (arg[0], XtNforeground, fore); - XtSetArg (arg[1], XtNbackground, back); + 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[2], XtNlabel, str); - XtSetValues (rec->features[i].w, arg, 3); + XtSetArg (arg[3], XtNlabel, str); + XtSetValues (rec->features[i].w, arg, 4); } update_seq_area (); } @@ -790,10 +787,10 @@ setup_feature_rec (FeatureRec *rec) else { XtSetArg (arg[0], XtNborderWidth, 1); - XtSetArg (arg[1], XtNborderColor, foreground); - XtSetArg (arg[2], XtNsensitive, True); - XtSetArg (arg[3], XtNforeground, foreground); - XtSetArg (arg[4], XtNbackground, background); + XtSetArg (arg[1], XtNinternalHeight, 4); + XtSetArg (arg[2], XtNinternalWidth, 4); + XtSetArg (arg[3], XtNborderColor, foreground); + XtSetArg (arg[4], XtNsensitive, True); for (i = 0; i < rec->langsys->FeatureCount && i < MAX_FEATURE_COUNT; i++) { OTF_Feature *feature = rec->gsub_gpos->FeatureList.Feature; @@ -807,14 +804,11 @@ setup_feature_rec (FeatureRec *rec) XtSetValues (rec->features[i].w, arg, 6); } } - XtSetArg (arg[0], XtNborderWidth, 1); - XtSetArg (arg[1], XtNborderColor, background); - XtSetArg (arg[2], XtNsensitive, False); - XtSetArg (arg[3], XtNforeground, foreground); - XtSetArg (arg[4], XtNbackground, background); - XtSetArg (arg[5], XtNlabel, " "); + XtSetArg (arg[0], XtNborderColor, background); + XtSetArg (arg[1], XtNsensitive, False); + XtSetArg (arg[2], XtNlabel, " "); for (; i < MAX_FEATURE_COUNT; i++) - XtSetValues (rec->features[i].w, arg, 6); + XtSetValues (rec->features[i].w, arg, 3); } void @@ -918,14 +912,17 @@ create_otf_widgets (Widget prev, FeatureRec *rec) prev = XtCreateManagedWidget (rec->label, boxWidgetClass, render_area, arg, 7); XtCreateManagedWidget (rec->label, labelWidgetClass, prev, arg, 1); - w = XtCreateManagedWidget ("all", commandWidgetClass, prev, NULL, 0); + XtSetArg (arg[0], XtNborderWidth, 1); + XtSetArg (arg[1], XtNinternalHeight, 4); + XtSetArg (arg[2], XtNinternalWidth, 4); + w = XtCreateManagedWidget ("all", commandWidgetClass, prev, arg, 3); XtAddCallback (w, XtNcallback, FeatureProc, (XtPointer) rec); - w = XtCreateManagedWidget ("none", commandWidgetClass, prev, NULL, 0); + w = XtCreateManagedWidget ("none", commandWidgetClass, prev, arg, 3); XtAddCallback (w, XtNcallback, FeatureProc, (XtPointer) rec); for (i = 0; i < MAX_FEATURE_COUNT; i++) { - w = XtCreateManagedWidget ("", commandWidgetClass, prev, arg, 1); + w = XtCreateManagedWidget ("", commandWidgetClass, prev, arg, 0); XtAddCallback (w, XtNcallback, FeatureProc, (XtPointer) rec); rec->features[i].w = w; } @@ -1230,6 +1227,8 @@ main (int argc, char **argv) { fprintf (stderr, "Usage: %s [ X-OPTION ... ] OTF-FILE\n", basename (argv[0])); + fprintf (stderr, + " Pixel size is decided by the environment variable PIXEL_SIZE ((default %d).\n", DEFAULT_PIXEL_SIZE); exit (argc != 2); } filename = argv[1]; -- 1.7.10.4