From: handa Date: Fri, 13 Nov 2009 12:45:15 +0000 (+0000) Subject: (code, code_label, code_list): New variables. X-Git-Tag: REL-0-9-11~44 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=900d2f4e13eed2d347e9c24cf7b95e5ae7c40711;p=m17n%2Flibotf.git (code, code_label, code_list): New variables. (update_seq_area): Display code list. (create_widgets): Create widgets code, code_label, code_list. --- diff --git a/example/otfview.c b/example/otfview.c index d867f30..8827481 100644 --- a/example/otfview.c +++ b/example/otfview.c @@ -98,6 +98,9 @@ XtAppContext context; | | +--- seq (box) --------------------+ | | | | | seq_label seq_image | | | | | +----------------------------------+ | | + | | +--- code (box) -------------------+ | | + | | | code_label code_list ... | | | + | | +----------------------------------+ | | | +--------------------------------------+ | +------------------------------------------+ */ Widget shell, frame; @@ -105,8 +108,8 @@ Widget command_area, quit, dump, *charmap; Widget navi_area, FIRST, PREV, prev, range, next, NEXT, LAST; Widget glyph_area, glyph[128], index_label[8]; Widget uvs_area, uvs_label; -Widget render_area, clear, del, bidi, alt_subst, raw, seq; -Widget raw_label, raw_image, seq_label, seq_image; +Widget render_area, clear, del, bidi, alt_subst, raw, seq, code; +Widget raw_label, raw_image, seq_label, seq_image, code_label, code_list; unsigned long foreground, background; typedef struct @@ -522,10 +525,22 @@ update_seq_area () else base = g, base_width = advance; } - free (gstring.glyphs); XtSetArg (arg[0], XtNbitmap, seq_pixmap); XtSetValues (seq_image, arg, 1); + + if (gstring.used > 0) + { + char *buf = alloca (gstring.used * 5); + + sprintf (buf, "%04X", gstring.glyphs[0].glyph_id); + for (i = 1; i < gstring.used; i++) + sprintf (buf + 4 + (i - 1) * 5, " %04X", gstring.glyphs[i].glyph_id); + XtSetArg (arg[0], XtNlabel, buf); + XtSetValues (code_list, arg, 1); + } + + free (gstring.glyphs); } @@ -1482,6 +1497,16 @@ create_widgets () XtSetArg (arg[1], XtNbitmap, seq_pixmap); seq_image = XtCreateManagedWidget ("seq-image", labelWidgetClass, seq, arg, 2); + XtSetArg (arg[6], XtNfromVert, seq); + code = XtCreateManagedWidget ("code", boxWidgetClass, render_area, arg, 7); + XtSetArg (arg[0], XtNborderWidth, 0); + XtSetArg (arg[1], XtNlabel, "code:"); + code_label = XtCreateManagedWidget ("code-label", labelWidgetClass, + code, arg, 2); + XtSetArg (arg[1], XtNlabel, ""); + XtSetArg (arg[2], XtNwidth, render_width); + code_list = XtCreateManagedWidget ("code-list", labelWidgetClass, + code, arg, 3); XtInstallAllAccelerators (shell, shell); }