home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume4 / xtroff / part12 < prev    next >
Encoding:
Internet Message Format  |  1989-07-17  |  39.3 KB

  1. Path: uunet!island!argv
  2. From: argv@island.uu.net (Dan Heller)
  3. Newsgroups: comp.sources.x
  4. Subject: v04i057: xtroff -- troff previewer for X11, Part12/18
  5. Message-ID: <891@island.uu.net>
  6. Date: 18 Jul 89 07:27:13 GMT
  7. Organization: Island Graphics, Marin County, California
  8. Lines: 1360
  9. Approved: island!argv@sun.com
  10.  
  11. Submitted-by: Mark Moraes <moraes@ai.toronto.edu>
  12. Posting-number: Volume 4, Issue 57
  13. Archive-name: xtroff/part12
  14.  
  15.  
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then unpack
  19. # it by saving it into a file and typing "sh file".  To overwrite existing
  20. # files, type "sh file -c".  You can also feed this as standard input via
  21. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  22. # will see the following message at the end:
  23. #        "End of archive 12 (of 18)."
  24. # Contents:  xtroff/XtStuff/Menu.c xtroff/devpsc/bdfdit.awk
  25. # Wrapped by moraes@neat.ai on Thu Jul 13 20:55:18 1989
  26. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  27. if test -f 'xtroff/XtStuff/Menu.c' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'xtroff/XtStuff/Menu.c'\"
  29. else
  30. echo shar: Extracting \"'xtroff/XtStuff/Menu.c'\" \(19435 characters\)
  31. sed "s/^X//" >'xtroff/XtStuff/Menu.c' <<'END_OF_FILE'
  32. X#ifndef lint
  33. Xstatic char rcsid[] = "$Header: Menu.c,v 1.3 88/06/01 02:22:16 moraes Exp $";
  34. X#endif lint
  35. X
  36. X/*
  37. X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
  38. X * 
  39. X *                         All Rights Reserved
  40. X * 
  41. X * Permission to use, copy, modify, and distribute this software and its 
  42. X * documentation for any purpose and without fee is hereby granted, 
  43. X * provided that the above copyright notice appear in all copies and that
  44. X * both that copyright notice and this permission notice appear in 
  45. X * supporting documentation, and that the name of Digital Equipment
  46. X * Corporation not be used in advertising or publicity pertaining to
  47. X * distribution of the software without specific, written prior permission.  
  48. X * 
  49. X * 
  50. X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  51. X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  52. X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  53. X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  54. X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  55. X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  56. X * SOFTWARE.
  57. X */
  58. X/* 
  59. X * Menu.c -
  60. X *   
  61. X * Author:       Robert P. Shen
  62. X *               Malcolm Forbes
  63. X *               Digital Equipment Corporation
  64. X *               ESG Systems Engineering
  65. X *
  66. X * Date:         February 1, 1988
  67. X */
  68. X
  69. X#include    <X11/IntrinsicP.h>
  70. X#include    <X11/StringDefs.h>
  71. X#include    <X11/XawMisc.h>
  72. X#include    <X11/Xmu.h>
  73. X#include    "MenuP.h"
  74. X#include    "MenuItem.h"
  75. X#include    "CheckItem.h"
  76. X#include     <X11/Label.h>
  77. X#include    <ctype.h>
  78. X
  79. X/****************************************************************
  80. X *
  81. X * Menu Resources
  82. X *
  83. X ****************************************************************/
  84. X
  85. Xstatic XtOrientation init_orient = XtorientVertical;
  86. Xstatic XtResource resources[] = {
  87. X    {XtNxMargin, XtCHSpace, XtRInt, sizeof(int),
  88. X     XtOffset(MenuWidget, menu.x_margin), XtRString, "0"},
  89. X    {XtNyMargin, XtCVSpace, XtRInt, sizeof(int),
  90. X     XtOffset(MenuWidget, menu.y_margin), XtRString, "0"},
  91. X    {XtNx, XtCPosition, XtRPosition, sizeof(Position),
  92. X         XtOffset(MenuWidget,core.x),XtRString, "800"},
  93. X    {XtNy, XtCPosition, XtRPosition, sizeof(Position),
  94. X         XtOffset(MenuWidget,core.y),XtRString, "800"},
  95. X    {XtNborder,"MyBorder",XtRPixel,sizeof(Pixel),
  96. X         XtOffset(MenuWidget,core.border_pixel),XtRString, "Black"},
  97. X/*
  98. X    {XtNborder,XtCBorderColor,XtRPixel,sizeof(Pixel),
  99. X         XtOffset(MenuWidget,core.border_pixel),XtRString, "White"},
  100. X*/
  101. X    {XtNmenuForeground, XtCForeground,XtRPixel, sizeof(Pixel),
  102. X         XtOffset(MenuWidget,menu.menu_foreground_pixel),XtRString, "Black"},
  103. X    {XtNcheckForeground, XtCForeground,XtRPixel, sizeof(Pixel),
  104. X         XtOffset(MenuWidget,menu.check_foreground_pixel),XtRString, "Black"},
  105. X    {XtNbackground, XtCBackground,XtRPixel, sizeof(Pixel),
  106. X         XtOffset(MenuWidget,core.background_pixel),XtRString, "White"},
  107. X    {XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension),
  108. X         XtOffset(MenuWidget,core.border_width),XtRString, "2"},
  109. X    {XtNorientation, XtCOrientation, XtROrientation, sizeof(XtOrientation),
  110. X         XtOffset(MenuWidget,menu.orient),XtRString, "vertical"},
  111. X    {XtNmenuItemsList, "MenuItemsList", XtRPointer, sizeof(MenuItems),
  112. X         XtOffset(MenuWidget,menu.items),XtRPointer, NULL},
  113. X};
  114. X/****************************************************************
  115. X *
  116. X * Full class record constant
  117. X *
  118. X ****************************************************************/
  119. X
  120. Xstatic void Initialize();
  121. Xstatic void Realize();
  122. Xstatic void Resize();
  123. Xstatic Boolean SetValues();
  124. Xstatic XtGeometryResult GeometryManager();
  125. Xstatic void ChangeManaged();
  126. Xstatic void ClassInitialize();
  127. X
  128. XMenuClassRec menuClassRec = {
  129. X  {
  130. X/* core_class fields      */
  131. X    /* superclass         */    (WidgetClass) &compositeClassRec,
  132. X    /* class_name         */    "Menu",
  133. X    /* widget_size        */    sizeof(MenuRec),
  134. X    /* class_initialize   */    ClassInitialize,
  135. X    /* class_part_init    */                NULL,
  136. X    /* class_inited       */    FALSE,
  137. X    /* initialize         */    Initialize,
  138. X    /* initialize_hook       */        NULL,
  139. X    /* realize            */    Realize,
  140. X    /* actions            */    NULL,
  141. X    /* num_actions      */    0,
  142. X    /* resources          */    resources,
  143. X    /* num_resources      */    XtNumber(resources),
  144. X    /* xrm_class          */    NULLQUARK,
  145. X    /* compress_motion      */    TRUE,
  146. X    /* compress_exposure  */    TRUE,
  147. X    /* compress_enterleave*/    TRUE,
  148. X    /* visible_interest   */    FALSE,
  149. X    /* destroy            */    NULL,
  150. X    /* resize             */    Resize,
  151. X    /* expose             */    NULL,
  152. X    /* set_values         */    SetValues,
  153. X    /* set_values_hook    */    NULL,
  154. X    /* set_values_almost  */    NULL,
  155. X    /* get_values_hook    */    NULL,
  156. X    /* accept_focus       */    NULL,
  157. X    /* version            */    XtVersion,
  158. X    /* callback_private   */    NULL,
  159. X    /* tm_table           */    NULL,
  160. X    /* query_geometry     */    NULL,
  161. X    /* display_accelerator    */    XtInheritDisplayAccelerator,
  162. X    /* extension        */    NULL
  163. X  },{
  164. X/* composite_class fields */
  165. X    /* geometry_manager   */    GeometryManager,
  166. X    /* change_managed     */    ChangeManaged,
  167. X    /* insert_child      */    NULL,    /* Inherit from superclass */
  168. X    /* delete_child      */    NULL,    /* Inherit from superclass */
  169. X  },{
  170. X    /* mumble          */    0    /* Make C compiler happy   */
  171. X  }
  172. X};
  173. X
  174. XWidgetClass menuWidgetClass = (WidgetClass)&menuClassRec;
  175. Xstatic Dimension no_resize_width, no_resize_height;
  176. X
  177. X
  178. X
  179. X
  180. Xstatic void CvtStringToOrientation();
  181. X
  182. Xstatic XrmQuark    XrmQEvertical;
  183. Xstatic XrmQuark    XrmQEhorizontal;
  184. X/* ARGSUSED */
  185. Xstatic void CvtStringToOrientation(args, pargs, fromVal, toVal)
  186. X    XrmValuePtr    args;
  187. X    Cardinal    pargs;
  188. X    XrmValuePtr fromVal;
  189. X    XrmValuePtr toVal;
  190. X{
  191. X    static XtOrientation    e;
  192. X    XrmQuark    q;
  193. X    char    *s = (char *) fromVal->addr;
  194. X    char        lowerName[1000];
  195. X    int        i;
  196. X
  197. X    if (s == NULL) return;
  198. X
  199. X    for (i=0; i<=strlen(s); i++) {
  200. X        char c = s[i];
  201. X    lowerName[i] = isupper(c) ? (char) tolower(c) : c;
  202. X    }
  203. X
  204. X    q = XrmStringToQuark(lowerName);
  205. X
  206. X    toVal->size = sizeof(XtOrientation);
  207. X    toVal->addr = (caddr_t) &e;
  208. X
  209. X    if (q == XrmQEvertical)   { e = XtorientVertical;   return; }
  210. X    if (q == XrmQEhorizontal) { e = XtorientHorizontal; return; }
  211. X
  212. X    toVal->size = 0;
  213. X    toVal->addr = NULL;
  214. X};
  215. X
  216. X/****************************************************************
  217. X *
  218. X * Private Routines
  219. X *
  220. X ****************************************************************/
  221. X
  222. Xstatic void ClassInitialize()
  223. X{
  224. X    CompositeWidgetClass superclass;
  225. X    MenuWidgetClass myclass;
  226. X
  227. X    myclass = (MenuWidgetClass) menuWidgetClass;
  228. X    superclass = (CompositeWidgetClass) myclass->core_class.superclass;
  229. X
  230. X    /* Inherit insert_child and delete_child from Composite */
  231. X    myclass->composite_class.insert_child =
  232. X        superclass->composite_class.insert_child;
  233. X    myclass->composite_class.delete_child =
  234. X        superclass->composite_class.delete_child;
  235. X
  236. X    XrmQEvertical   = XrmStringToQuark("vertical");
  237. X    XrmQEhorizontal = XrmStringToQuark("horizontal");
  238. X
  239. X    XtAddConverter(XtRString, XtROrientation, CvtStringToOrientation,
  240. X           NULL, (Cardinal)0 );
  241. X}
  242. X
  243. X/*
  244. X *
  245. X * Do a layout, either actually assigning positions, or just calculating size.
  246. X * Returns TRUE on success; FALSE if it couldn't make things fit.
  247. X *
  248. X */
  249. X
  250. Xstatic void horizontal_layout_plan(menuw, width, height, position)
  251. X     MenuWidget menuw;
  252. X     Dimension *width, *height;
  253. X{
  254. X  Widget kid;
  255. X  Dimension w, h;
  256. X  Dimension child_w, child_h, x, y, x_margin, y_margin;
  257. X  int i;
  258. X
  259. X    /* Menu width and height */
  260. X    w = x = child_w = x_margin = menuw->menu.x_margin;
  261. X    h = y = child_h = y_margin = menuw->menu.y_margin;
  262. X
  263. X    for (i = 0; i < menuw->composite.num_children; i++) {
  264. X    kid = menuw->composite.children[i];
  265. X    if (kid->core.managed) {
  266. X        /* Compute menu width */
  267. X        child_w = kid->core.width + 2*kid->core.border_width + x_margin;
  268. X        AssignMax(child_h, kid->core.height);
  269. X        w += child_w;
  270. X        h = child_h + 2*kid->core.border_width+2* y_margin;
  271. X
  272. X        if (position) {
  273. X
  274. X          XtMoveWidget(kid, (int)x, (int)y);
  275. X              XtResizeWidget(kid,kid->core.width,child_h,kid->core.border_width);
  276. X
  277. X            }
  278. X        x = w;
  279. X    } /* if managed */
  280. X    } /* for */
  281. X
  282. X  *width = w;
  283. X  *height = h;
  284. X
  285. X}
  286. X
  287. Xstatic void redeploy_kids(menuw)
  288. X     MenuWidget menuw;
  289. X{
  290. X  Widget kid;
  291. X  int i;
  292. X  Dimension menu_width, kid_width;
  293. X  Dimension x, y;
  294. X  Dimension x_margin, y_margin;
  295. X
  296. X  menu_width = menuw->core.width;
  297. X  x = x_margin = menuw->menu.x_margin;
  298. X  y = y_margin = menuw->menu.y_margin;
  299. X
  300. X  for (i = 0; i <menuw->composite.num_children; i++) {
  301. X    kid = menuw->composite.children[i];
  302. X    if (kid->core.managed) {
  303. X      kid_width = menu_width - 2*kid->core.border_width - 2*x_margin;
  304. X/*
  305. X      XtResizeWidget(kid,kid_width,kid->core.height,kid->core.border_width);
  306. X*/
  307. X      XtMoveWidget(kid, (int)x, (int)y);
  308. X      y += kid->core.height + 2*kid->core.border_width + y_margin;
  309. X    }
  310. X  }
  311. X}
  312. X
  313. X
  314. X/* ARGSUSED */
  315. Xstatic LayoutPlan(menuw, width, height, replyWidth, replyHeight, position)
  316. X    MenuWidget    menuw;
  317. X    Dimension        width, height;
  318. X    Dimension        *replyWidth, *replyHeight;    /* RETURN */
  319. X    Boolean        position;    /* actually reposition the windows? */
  320. X{
  321. X    Cardinal  i;
  322. X    Dimension w, h;    /* Width and height needed for menu panel     */
  323. X    Dimension x, y;
  324. X    Dimension child_w, child_h;
  325. X    Dimension x_margin, y_margin;  /* Local copy of menuw->menu.x_margin     */
  326. X    Dimension hlayout_width, hlayout_height;
  327. X    Widget    kid;    /* Current menu                 */
  328. X
  329. X    /* Menu width and height */
  330. X    w = x = x_margin = menuw->menu.x_margin;
  331. X    h = y = y_margin = menuw->menu.y_margin;
  332. X
  333. X    for (i = 0; i < menuw->composite.num_children; i++) {
  334. X    kid = menuw->composite.children[i];
  335. X    if (kid->core.managed) {
  336. X        /* Compute menu width */
  337. X        child_w = kid->core.width + 2*kid->core.border_width + 2*x_margin;
  338. X        child_h = kid->core.height + 2*kid->core.border_width + y_margin;
  339. X        AssignMax(w, child_w);
  340. X        h += child_h + y_margin;
  341. X
  342. X        if (position) {
  343. X
  344. X          XtMoveWidget(kid, (int)x, (int)y);
  345. X              XtResizeWidget(kid,(width-2*kid->core.border_width-2*x_margin),
  346. X             kid->core.height,kid->core.border_width);
  347. X
  348. X            }
  349. X        y = h;
  350. X    } /* if managed */
  351. X    } /* for */
  352. X
  353. X    h += y_margin;
  354. X
  355. X    *replyWidth = Max(w, 1);
  356. X    *replyHeight = Max(h, 1);
  357. X}
  358. X
  359. X/*
  360. X *
  361. X * Calculate preferred size, given constraining box
  362. X *
  363. X */
  364. X
  365. Xstatic Boolean PreferredSize(menuw, width, height, replyWidth, replyHeight)
  366. X    MenuWidget    menuw;
  367. X    Dimension        width, height;
  368. X    Dimension        *replyWidth, *replyHeight;
  369. X{
  370. X    LayoutPlan(menuw, width, height, replyWidth, replyHeight, FALSE);
  371. X    return ((*replyWidth <= width) && (*replyHeight <= height));
  372. X}
  373. X
  374. X/*
  375. X *
  376. X * Actually layout the menu panel
  377. X *
  378. X */
  379. X
  380. Xstatic void Resize(menuw)
  381. X    MenuWidget    menuw;
  382. X{
  383. X    Widget kid;
  384. X    Dimension junk, width, height;
  385. X
  386. X    if (menuw->menu.orient == XtorientVertical) {
  387. X      LayoutPlan((MenuWidget)menuw, menuw->core.width, menuw->core.height,
  388. X         &junk, &junk, TRUE);
  389. X    }
  390. X    else if (menuw->menu.orient == XtorientHorizontal) {
  391. X          horizontal_layout_plan (menuw, &width, &height, TRUE);
  392. X      }
  393. X/*
  394. X    redeploy_kids(w);
  395. X*/
  396. X} /* Resize */
  397. X
  398. X/*
  399. X *
  400. X * Try to do a new layout within the current width and height;
  401. X * if that fails try to do it within the box returned by PreferredSize.
  402. X *
  403. X * TryNewLayout just says if it's possible, and doesn't actually move the kids
  404. X */
  405. X
  406. Xstatic Boolean TryNewLayout(menuw)
  407. X    MenuWidget    menuw;
  408. X{
  409. X    Dimension        width, height, junk_w, junk_h;
  410. X
  411. X    if (!PreferredSize(menuw, menuw->core.width, menuw->core.height, &width, &height))
  412. X    (void) PreferredSize(menuw, width, height, &width, &height);
  413. X
  414. X    if ((menuw->core.width == width) && (menuw->core.height == height)) {
  415. X        /* Same size */
  416. X    return (TRUE);
  417. X    }
  418. X
  419. X    /* let's see if our parent will go for a new size. */
  420. X    switch (XtMakeResizeRequest((Widget) menuw, width, height, &width, &height)) {
  421. X
  422. X    case XtGeometryYes:
  423. X        return (TRUE);
  424. X
  425. X    case XtGeometryNo:
  426. X        if ((width <= menuw->core.width) && (height <= menuw->core.height))
  427. X            return (TRUE);
  428. X        else
  429. X            return (FALSE);
  430. X
  431. X    case XtGeometryAlmost:
  432. X        if (! PreferredSize(menuw, width, height, &junk_w, &junk_h))
  433. X            return (FALSE);
  434. X        (void) XtMakeResizeRequest((Widget) menuw, width, height, 
  435. X                    &width, &height);
  436. X        return (TRUE);
  437. X    }
  438. X}
  439. X
  440. X/*
  441. X *
  442. X * Geometry Manager
  443. X *
  444. X */
  445. X
  446. X/*ARGSUSED*/
  447. Xstatic XtGeometryResult GeometryManager(w, request, reply)
  448. X    Widget        w;
  449. X    XtWidgetGeometry    *request;
  450. X    XtWidgetGeometry    *reply;    /* RETURN */
  451. X
  452. X{
  453. X    Dimension    width, height, borderWidth;
  454. X    MenuWidget menuw;
  455. X
  456. X    /* Position request always denied */
  457. X    if (request->request_mode & (CWX | CWY))
  458. X        return (XtGeometryNo);
  459. X
  460. X    /* Size changes must see if the new size can be accomodated */
  461. X    if (request->request_mode & (CWWidth | CWHeight | CWBorderWidth)) {
  462. X
  463. X    /* Make all three fields in the request valid */
  464. X    if ((request->request_mode & CWWidth) == 0)
  465. X        request->width = w->core.width;
  466. X    if ((request->request_mode & CWHeight) == 0)
  467. X        request->height = w->core.height;
  468. X        if ((request->request_mode & CWBorderWidth) == 0)
  469. X        request->border_width = w->core.border_width;
  470. X
  471. X    /* Save current size and set to new size */
  472. X    width = w->core.width;
  473. X    height = w->core.height;
  474. X    borderWidth = w->core.border_width;
  475. X    w->core.width = request->width;
  476. X    w->core.height = request->height;
  477. X    w->core.border_width = request->border_width;
  478. X
  479. X    /* Decide if new layout works: (1) new menu is smaller,
  480. X       (2) new menu fits in existing Menu, (3) Menu can be
  481. X       expanded to allow new menu to fit */
  482. X
  483. X    menuw = (MenuWidget) w->core.parent;
  484. X
  485. X/* whenever a child changes his geometry, we attempt to
  486. X * change ours to be the minimum enclosing size...
  487. X    if (((request->width + request->border_width <= width + borderWidth) &&
  488. X        (request->height + request->border_width <= height + borderWidth))
  489. X    || PreferredSize(menuw, menuw->core.width, menuw->core.height, &junk, &junk)
  490. X    || TryNewLayout(menuw)) {
  491. X */
  492. X    if (TryNewLayout(menuw)) {
  493. X        /* Fits in existing or new space, relayout */
  494. X        Resize((Widget)menuw);
  495. X        return (XtGeometryYes);
  496. X    } else {
  497. X        /* Cannot satisfy request, change back to original geometry */
  498. X        w->core.width = width;
  499. X        w->core.height = height;
  500. X        w->core.border_width = borderWidth;
  501. X        return (XtGeometryNo);
  502. X    }
  503. X    }; /* if any size changes requested */
  504. X
  505. X    /* Any stacking changes don't make a difference, so allow if that's all */
  506. X    return (XtGeometryYes);
  507. X}
  508. X
  509. Xstatic void ChangeManaged(w)
  510. X    MenuWidget w;
  511. X{
  512. X    Dimension hlayout_width, h_layout_height, kid_height;
  513. X    Dimension x_margin, y_margin;
  514. X    Dimension width, height;
  515. X
  516. X    if (w->menu.orient == XtorientVertical)
  517. X      {
  518. X
  519. X    (void) TryNewLayout((MenuWidget)w);
  520. X
  521. X    Resize(w);
  522. X/*
  523. X    redeploy_kids(w);
  524. X*/
  525. X      }
  526. X    else if (w->menu.orient == XtorientHorizontal)
  527. X      {
  528. X    horizontal_layout_plan (w, &width, &height, FALSE);
  529. X    switch (XtMakeResizeRequest((Widget)w, width, height, &width, &height))
  530. X      {
  531. X        case XtGeometryYes: break;
  532. X            case XtGeometryNo: break;
  533. X            case XtGeometryAlmost: break;
  534. X      }
  535. X    horizontal_layout_plan (w, &width, &height, TRUE);
  536. X      }
  537. X}
  538. X
  539. X/* ARGSUSED */
  540. Xstatic void Initialize(request, new)
  541. X    Widget    request, new;
  542. X    {
  543. X    MenuWidget    newmenuw = (MenuWidget)new;
  544. X    Widget    cmd;
  545. X    MenuItems    items;
  546. X    int        i, j;
  547. X/*    char        str[32];        */
  548. X/*    static char    check_pad[] = "    ";    */
  549. X/*    static char    space_pad[] = "    ";    */
  550. X
  551. X    static Arg labelArgs[] = {
  552. X            {XtNbackground,  (XtArgVal) NULL},
  553. X        {XtNforeground,  (XtArgVal) NULL}
  554. X        };
  555. X    static Arg menuArgs[] = {
  556. X            {XtNbackground,  (XtArgVal) NULL},
  557. X        {XtNforeground,  (XtArgVal) NULL},
  558. X            {XtNborderWidth, (XtArgVal) 0},
  559. X        {XtNcallback,    (XtArgVal) NULL}
  560. X        };
  561. X    static Arg checkArgs[] = {
  562. X            {XtNbackground,  (XtArgVal) NULL},
  563. X        {XtNforeground,  (XtArgVal) NULL},
  564. X            {XtNborderWidth, (XtArgVal) 0},
  565. X        {XtNcheckState, (XtArgVal)  TRUE},
  566. X        {XtNcallback,    (XtArgVal) NULL}
  567. X        };
  568. X    static Arg uncheckArgs[] = {
  569. X            {XtNbackground,  (XtArgVal) NULL},
  570. X        {XtNforeground,  (XtArgVal) NULL},
  571. X            {XtNborderWidth, (XtArgVal) 0},
  572. X        {XtNcheckState, (XtArgVal) FALSE},
  573. X        {XtNcallback,    (XtArgVal) NULL}
  574. X        };
  575. X
  576. X
  577. X/* ||| What are consequences of letting height, width be 0? If okay, then
  578. X       Initialize can be NULL */
  579. X
  580. X    if (newmenuw->core.width == 0)
  581. X        newmenuw->core.width = ((newmenuw->menu.x_margin != 0)
  582. X                  ? newmenuw->menu.x_margin : 1);    /* MOD */
  583. X    if (newmenuw->core.height == 0)
  584. X    newmenuw->core.height = ((newmenuw->menu.y_margin != 0)
  585. X                   ? newmenuw->menu.y_margin : 1);    /* MOD */
  586. X
  587. X    XtSetArg(labelArgs[0], XtNbackground,newmenuw->menu.menu_foreground_pixel);
  588. X    XtSetArg(labelArgs[1], XtNforeground,newmenuw->core.background_pixel);
  589. X    XtSetArg(menuArgs[0], XtNbackground,newmenuw->core.background_pixel);
  590. X    XtSetArg(menuArgs[1],XtNforeground,newmenuw->menu.menu_foreground_pixel);
  591. X    XtSetArg(checkArgs[0], XtNbackground, newmenuw->core.background_pixel);
  592. X    XtSetArg(checkArgs[1],XtNforeground,newmenuw->menu.check_foreground_pixel);
  593. X    XtSetArg(uncheckArgs[0], XtNbackground, newmenuw->core.background_pixel);
  594. X    XtSetArg(uncheckArgs[1],XtNforeground,newmenuw->menu.check_foreground_pixel);
  595. X    cmd = XtCreateManagedWidget (newmenuw->core.name,
  596. X                       labelWidgetClass, new,
  597. X                labelArgs, XtNumber(labelArgs));
  598. X
  599. X    if( newmenuw->menu.items )
  600. X    {
  601. X        XtCallbackList  temprec;
  602. X        
  603. X        items = newmenuw->menu.items;
  604. X        for (; items->proc; items++) {     /* at least proc must exist! */
  605. X        temprec = (XtCallbackList)XtMalloc(sizeof(XtCallbackRec)*2);
  606. X        temprec->callback = items->proc;
  607. X        temprec->closure = items->closure;
  608. X        (temprec+1)->callback = NULL;
  609. X        (temprec+1)->closure = NULL;
  610. X        if (items->flags & (XtitemCheckable | XtitemIsChecked)) {
  611. X            XtSetArg(checkArgs[4], XtNcallback, temprec);
  612. X            XtSetArg(uncheckArgs[4], XtNcallback, temprec);
  613. X            cmd = XtCreateManagedWidget (items->text,
  614. X                    checkitemWidgetClass, new,
  615. X                    (items->flags & XtitemIsChecked ?
  616. X                        (ArgList) checkArgs :
  617. X                        (ArgList) uncheckArgs),
  618. X                    (items->flags & XtitemIsChecked ?
  619. X                     XtNumber(checkArgs) :
  620. X                     XtNumber(uncheckArgs)));
  621. X
  622. X        }
  623. X        else {
  624. X            XtSetArg(menuArgs[3], XtNcallback, temprec);
  625. X            cmd = XtCreateManagedWidget (items->text,
  626. X                    menuitemWidgetClass, new,
  627. X                         (ArgList) menuArgs,
  628. X                         XtNumber(menuArgs));
  629. X        }
  630. X        XtSetSensitive (cmd, !(items->flags & XtitemUnselectable));
  631. X    }
  632. X    }
  633. X} /* Initialize */
  634. X
  635. X/* ||| Should Realize just return a modified mask and attributes?  Or will some
  636. X   of the other parameters change from class to class? */
  637. Xstatic void Realize(w, valueMask, attributes)
  638. X
  639. X    register Widget w;
  640. X    Mask *valueMask;
  641. X    XSetWindowAttributes *attributes;
  642. X{
  643. X    MenuWidget newmenuw = (MenuWidget)w;
  644. X
  645. X    attributes->bit_gravity = NorthWestGravity;
  646. X    *valueMask |= CWBitGravity;
  647. X
  648. X    XtCreateWindow( w, (unsigned)InputOutput, (Visual *)CopyFromParent,
  649. X            *valueMask, attributes);
  650. X} /* Realize */
  651. X
  652. X/*
  653. X *
  654. X * Set Values
  655. X *
  656. X */
  657. X
  658. X/* ARGSUSED */
  659. Xstatic Boolean SetValues (current, request, new, last)
  660. X    Widget current, request, new;
  661. X    Boolean last;
  662. X{
  663. X    /* ||| Old code completely bogus, need background, etc. then relayout */
  664. X
  665. X    /*XtSetValuesGeometryRequest( current, new, (XtWidgetGeometry *)NULL );*/
  666. X
  667. X    /* ||| should handle XtGeometryAlmost */
  668. X
  669. X    return (FALSE);
  670. X}
  671. END_OF_FILE
  672. if test 19435 -ne `wc -c <'xtroff/XtStuff/Menu.c'`; then
  673.     echo shar: \"'xtroff/XtStuff/Menu.c'\" unpacked with wrong size!
  674. fi
  675. # end of 'xtroff/XtStuff/Menu.c'
  676. fi
  677. if test -f 'xtroff/devpsc/bdfdit.awk' -a "${1}" != "-c" ; then 
  678.   echo shar: Will not clobber existing file \"'xtroff/devpsc/bdfdit.awk'\"
  679. else
  680. echo shar: Extracting \"'xtroff/devpsc/bdfdit.awk'\" \(17215 characters\)
  681. sed "s/^X//" >'xtroff/devpsc/bdfdit.awk' <<'END_OF_FILE'
  682. X# devpsc/bdfdit.awk
  683. X#
  684. X# Copyright (c) 1988 Cray Research, Inc. All Rights Reserved.
  685. X#
  686. X# This awk(1) program serves two purposes.  It helps convert
  687. X# X11 bdf font metrics files (bdf files) into ditroff
  688. X# font description files (as input to makedev), and it
  689. X# helps create the ditroff device description file (DESC) for
  690. X# bdf fonts.
  691. X#
  692. X
  693. XBEGIN {
  694. X    SCALE = 5.0        # font width scale factor to 
  695. X                # achieve proper dynamic range
  696. X                # (ditroff widths are <= 256)
  697. X
  698. X    # file names for pieces. These are cat'ed together.
  699. X    header = "temp.header"    # comments and ligature list
  700. X    spaces = "temp.spaces"    # space widths and "charset" header
  701. X    trailer = "temp.trailer"# actual character data
  702. X    aux = "temp.aux"
  703. X
  704. X    isspecial = 0
  705. X    istext = 1
  706. X
  707. X# ligatures
  708. X
  709. X    ligature["ff"] = "ff"
  710. X    ligature["ffi"] = "Fi"
  711. X    ligature["ffl"] = "Fl"
  712. X    ligature["fi"] = "fi"
  713. X    ligature["fl"] = "fl"
  714. X
  715. X# ditmap is a mapping from non-ascii bdf file character names
  716. X#    (plus a few special ones) to DITROFF \( special codes.
  717. X#    Note that some chars have more than one code (separated by spaces).
  718. X
  719. X    ditmap[".ditspace"] = "\\^ \\| \\&"
  720. X    ditmap["AE"] = "AE"
  721. X    ditmap["Alpha"] = "*A"
  722. X    ditmap["Beta"] = "*B"
  723. X    ditmap["Chi"] = "*X"
  724. X    ditmap["Delta"] = "*D"
  725. X    ditmap["Epsilon"] = "*E"
  726. X    ditmap["Eta"] = "*Y"
  727. X    ditmap["Gamma"] = "*G"
  728. X    ditmap["Iota"] = "*I"
  729. X    ditmap["Kappa"] = "*K"
  730. X    ditmap["Lambda"] = "*L"
  731. X    ditmap["Lslash"] = "PL"
  732. X    ditmap["Mu"] = "*M"
  733. X    ditmap["Nu"] = "*N"
  734. X    ditmap["OE"] = "OE"
  735. X    ditmap["Omega"] = "*W"
  736. X    ditmap["Omicron"] = "*O"
  737. X    ditmap["Oslash"] = "O/"
  738. X    ditmap["Phi"] = "*F"
  739. X    ditmap["Pi"] = "*P"
  740. X    ditmap["Psi"] = "*Q"
  741. X    ditmap["Rho"] = "*R"
  742. X    ditmap["Sigma"] = "*S"
  743. X    ditmap["Tau"] = "*T"
  744. X    ditmap["Theta"] = "*H"
  745. X    ditmap["Upsilon"] = "*U"
  746. X    ditmap["Xi"] = "*C"
  747. X    ditmap["Zeta"] = "*Z"
  748. X     ditmap["acute"] = "aa \\'"
  749. X    ditmap["ae"] = "ae"
  750. X    ditmap["aleph"] = "al"
  751. X    ditmap["alpha"] = "*a"
  752. X     ditmap["angle"] = "ag"
  753. X     ditmap["angleleft"] = "l< L<"
  754. X     ditmap["angleright"] = "r> R>"
  755. X    ditmap["apple"] = "AL"
  756. X    ditmap["approxequal"] = "~="
  757. X     ditmap["arrowboth"] = "<>"
  758. X     ditmap["arrowdbldown"] = "d="
  759. X     ditmap["arrowdblboth"] = "io"
  760. X     ditmap["arrowdblleft"] = "<: lh"    # left double arrow (& hand)
  761. X     ditmap["arrowdblright"] = ":> im rh"    # right double arrow (& hand)
  762. X     ditmap["arrowdblup"] = "u="
  763. X    ditmap["arrowdown"] = "da"
  764. X    ditmap["arrowleft"] = "<-"
  765. X    ditmap["arrowright"] = "->"
  766. X    ditmap["arrowup"] = "ua"
  767. X    ditmap["asciicircum"] = "a^"
  768. X    ditmap["asciitilde"] = "a~"
  769. X    ditmap["asteriskmath"] = "**"
  770. X    ditmap["bar"] = "or"
  771. X    ditmap["beta"] = "*b"
  772. X#     ditmap["br"] = "br"    # box rule
  773. X#     ditmap["bu"] = "bu"    # bullet
  774. X#     ditmap["bv"] = "bv"    # bold vertical
  775. X#     ditmap["bx"] = "bx"    # box
  776. X    ditmap["breve"] = "be"
  777. X    ditmap["bullet"] = "bu"
  778. X    ditmap["caron"] = "hc"
  779. X    ditmap["cedilla"] = "cd"
  780. X    ditmap["cent"] = "ct"
  781. X    ditmap["chi"] = "*x"
  782. X    ditmap["circumflex"] = "^"
  783. X     ditmap["carriagereturn"] = "cr"
  784. X#     ditmap["ci"] = "ci"    # circle
  785. X     ditmap["circlemultiply"] = "ax"
  786. X     ditmap["circleplus"] = "a+"
  787. X    ditmap["club"] = "Cc"
  788. X    ditmap["congruent"] = "=~"
  789. X    ditmap["copyrightserif"] = "co"
  790. X    ditmap["dagger"] = "dg"
  791. X    ditmap["daggerdbl"] = "dd"
  792. X    ditmap["degree"] = "de"
  793. X    ditmap["delta"] = "*d"
  794. X     ditmap["diamond"] = "Cd"
  795. X     ditmap["dieresis"] = "um .."    # umlaut
  796. X     ditmap["dotaccent"] = "dt"
  797. X    ditmap["dotlessi"] = "ui"
  798. X    ditmap["divide"] = "di"
  799. X     ditmap["dotmath"] = "m."
  800. X     ditmap["element"] = "mo"
  801. X    ditmap["emdash"] = "em"
  802. X    ditmap["emptyset"] = "es"
  803. X    ditmap["endash"] = "en"
  804. X    ditmap["epsilon"] = "*e"
  805. X    ditmap["equal"] = "eq"    ;    mathonly["eq"] = "equal"
  806. X    ditmap["equivalence"] = "=="
  807. X    ditmap["eta"] = "*y"
  808. X     ditmap["exclamdown"] = "!! I!"
  809. X    ditmap["existential"] = "te"
  810. X    ditmap["ff"] = "ff"
  811. X    ditmap["ffi"] = "Fi"
  812. X    ditmap["ffl"] = "Fl"
  813. X    ditmap["fi"] = "fi"
  814. X    ditmap["fl"] = "fl"
  815. X     ditmap["florin"] = "$D"
  816. X    ditmap["germandbls"] = "ss"
  817. X    ditmap["gamma"] = "*g"
  818. X    ditmap["gradient"] = "gr"
  819. X     ditmap["grave"] = "ga \\`"
  820. X    ditmap["greaterequal"] = ">="
  821. X    ditmap["guillemotleft"] = "d<"
  822. X    ditmap["guillemotright"] = "d>"
  823. X    ditmap["guillmotleft"] = "d<"
  824. X    ditmap["guillmotright"] = "d>"
  825. X    ditmap["guilsinglleft"] = "l<"
  826. X    ditmap["guilsinglright"] = "r>"
  827. X    ditmap["heart"] = "bs Ch"
  828. X    ditmap["hungarumlaut"] = "''"
  829. X    ditmap["hyphen"] = "hy"
  830. X    ditmap["infinity"] = "if"
  831. X    ditmap["integral"] = "is"
  832. X#     ditmap["lb"] = "lb"    # left bot curly
  833. X#     ditmap["lc"] = "lc"    # left ceil
  834. X#     ditmap["lf"] = "lf"    # left floor
  835. X#     ditmap["lk"] = "lk"    # left center curly
  836. X     ditmap["logicaland"] = "an la"
  837. X     ditmap["logicalor"] = "lo"
  838. X    ditmap["lozenge"] = "dm"
  839. X    ditmap["intersection"] = "ca"
  840. X    ditmap["iota"] = "*i"
  841. X    ditmap["kappa"] = "*k"
  842. X    ditmap["lambda"] = "*l"
  843. X    ditmap["lessequal"] = "<="
  844. X    ditmap["logicalnot"] = "no"
  845. X    ditmap["lslash"] = "Pl"
  846. X    ditmap["onequarter"] = "14"
  847. X    ditmap["onehalf"] = "12"
  848. X    ditmap["threequarters"] = "34"
  849. X     ditmap["macron"] = "mc ma"
  850. X    ditmap["minus"] = "\\- mi"    ;    mathonly["mi"] = "minus"
  851. X#     ditmap["minus"] = "\\- mi"
  852. X     ditmap["minute"] = "fm mt"
  853. X    ditmap["mu"] = "*m"
  854. X    ditmap["multiply"] = "mu"
  855. X     ditmap["notelement"] = "!m"
  856. X     ditmap["notsubset"] = "!s"
  857. X    ditmap["notequal"] = "!="
  858. X    ditmap["nu"] = "*n"
  859. X     ditmap["ogonek"] = "og"
  860. X    ditmap["oe"] = "oe"
  861. X    ditmap["omega"] = "*w"
  862. X    ditmap["omicron"] = "*o"
  863. X    ditmap["oslash"] = "o/"
  864. X     ditmap["onehalf"] = "12"
  865. X     ditmap["onequarter"] = "14"
  866. X    ditmap["paragraph"] = "pp"
  867. X    ditmap["partialdiff"] = "pd"
  868. X    ditmap["phi"] = "*f"
  869. X    ditmap["pi"] = "*p"
  870. X    ditmap["plus"] = "pl"    ;    mathonly["pl"] = "plus"
  871. X    ditmap["plusminus"] = "+-"
  872. X    ditmap["propersubset"] = "sb"
  873. X    ditmap["propersuperset"] = "sp"
  874. X    ditmap["proportional"] = "pt"
  875. X    ditmap["psi"] = "*q"
  876. X     ditmap["questiondown"] = "?? I?"
  877. X    ditmap["quotedblbase"] = "bq"
  878. X     ditmap["quotedblleft"] = "lq oq"
  879. X     ditmap["quotedblright"] = "rq cq"
  880. X     ditmap["quotesingle"] = "n'"
  881. X    ditmap["radical"] = "sr"
  882. X    ditmap["radicalex"] = "rn"
  883. X    ditmap["reflexsubset"] = "ib"
  884. X    ditmap["reflexsuperset"] = "ip"
  885. X    ditmap["registerserif"] = "rg"
  886. X    ditmap["rho"] = "*r"
  887. X     ditmap["ring"] = "ri"
  888. X     ditmap["second"] = "sd"
  889. X    ditmap["section"] = "sc"
  890. X    ditmap["sigma"] = "*s"
  891. X    ditmap["sigma1"] = "ts"
  892. X    ditmap["similar"] = "ap"
  893. X    ditmap["slash"] = "sl"
  894. X    ditmap["spade"] = "Cs"
  895. X     ditmap["sterling"] = "ps po"
  896. X    ditmap["suchthat"] = "cm"
  897. X    ditmap["tau"] = "*t"
  898. X    ditmap["therefore"] = "tf"
  899. X    ditmap["theta"] = "*h"
  900. X    ditmap["tilde"] = "~"
  901. X    ditmap["trademarkserif"] = "tm"
  902. X    ditmap["underscore"] = "ul \\_"
  903. X#     ditmap["ul"] = "ul"    # under rule
  904. X#     ditmap["underscore"] = "\\_"
  905. X#     ditmap["vr"] = "vr"    # vertical rule
  906. X    ditmap["union"] = "cu"
  907. X    ditmap["universal"] = "fa"
  908. X    ditmap["upsilon"] = "*u"
  909. X    ditmap["xi"] = "*c"
  910. X    ditmap["yen"] = "yn"
  911. X     ditmap["yen"] = "yi yn $J"
  912. X    ditmap["zeta"] = "*z"
  913. X    ditmap["circle"] = "ci"
  914. X    ditmap["square"] = "sq"
  915. X
  916. X# Additional troff characters.  The mod to add these special
  917. X# characters to the bdf character set is needed.
  918. X
  919. X    ditmap["box"] = "bx"
  920. X    ditmap["boxrule"] = "br"
  921. X    ditmap["rule"] = "ru"
  922. X    ditmap["boldvertical"] = "bv"
  923. X    ditmap["lefttopcurly"] = "lt"
  924. X    ditmap["leftbotcurly"] = "lb"
  925. X    ditmap["righttopcurly"] = "rt"
  926. X    ditmap["rightbotcurly"] = "rb"
  927. X#     ditmap["lt"] = "lt"    # left top curly
  928. X#     ditmap["ob"] = "ob"    # outline bullet
  929. X#     ditmap["rb"] = "rb"    # right bot curly
  930. X#     ditmap["rc"] = "rc"    # right ceil
  931. X#     ditmap["rf"] = "rf"    # right floor
  932. X#     ditmap["rk"] = "rk"    # right center curly
  933. X#     ditmap["rn"] = "rn"    # root extender
  934. X#     ditmap["rt"] = "rt"    # rith top curly
  935. X#     ditmap["ru"] = "ru"    # rule
  936. X    ditmap["leftmidcurly"] = "lk"
  937. X    ditmap["rightmidcurly"] = "rk"
  938. X    ditmap["leftfloor"] = "lf"
  939. X    ditmap["rightfloor"] = "rf"
  940. X    ditmap["leftceiling"] = "lc"
  941. X    ditmap["rightceiling"] = "rc"
  942. X    ditmap["outlinebullet"] = "ob"
  943. X     ditmap["perpendicular"] = "bt"
  944. X     ditmap["perthousand"] = "pm"
  945. X
  946. X#  Characters in the ISO Latan 1 set
  947. X#  Assignment of troff characters made by D. A. Cahlander 89/01/09.
  948. X#  Disabled since the DESC.out file can only describe 256-character fonts.
  949. X
  950. X#    ditmap["Aacute"] = "A'"
  951. X#    ditmap["Acircumflex"] = "A^"
  952. X    ditmap["Adieresis"] = "A:"
  953. X#    ditmap["Agrave"] = "A`"
  954. X#    ditmap["Aring"] = "Ao"
  955. X#    ditmap["Atilde"] = "A~"
  956. X#    ditmap["Ccedilla"] = "Cc"
  957. X#    ditmap["Eacute"] = "E'"
  958. X#    ditmap["Ecircumflex"] = "E^"
  959. X#    ditmap["Edieresis"] = "E."
  960. X#    ditmap["Egrave"] = "E`"
  961. X#    ditmap["Iacute"] = "I'"
  962. X#    ditmap["Icircumflex"] = "I^"
  963. X#    ditmap["Idieresis"] = "I."
  964. X#    ditmap["Igrave"] = "I`"
  965. X#    ditmap["Ntilde"] = "N~"
  966. X#    ditmap["Oacute"] = "O'"
  967. X#    ditmap["Ocircumflex"] = "O^"
  968. X    ditmap["Odieresis"] = "O:"
  969. X#    ditmap["Ograve"] = "O`"
  970. X#    ditmap["Otilde"] = "O~"
  971. X#    ditmap["Scaron"] = "Sc"
  972. X#    ditmap["Uacute"] = "U'"
  973. X#    ditmap["Ucircumflex"] = "U^"
  974. X    ditmap["Udieresis"] = "U:"
  975. X#    ditmap["Ugrave"] = "U`"
  976. X#    ditmap["Ydieresis"] = "Y."
  977. X#    ditmap["Zcaron"] = "Zc"
  978. X#    ditmap["aacute"] = "a'"
  979. X#    ditmap["acircumflex"] = "a^"
  980. X    ditmap["adieresis"] = "a:"
  981. X#    ditmap["agrave"] = "a`"
  982. X#    ditmap["aring"] = "ao"
  983. X#    ditmap["atilde"] = "a~"
  984. X#    ditmap["ccedilla"] = "cc"
  985. X#    ditmap["eacute"] = "e'"
  986. X#    ditmap["ecircumflex"] = "e^"
  987. X#    ditmap["edieresis"] = "e."
  988. X#    ditmap["egrave"] = "e`"
  989. X#    ditmap["iacute"] = "i'"
  990. X#    ditmap["icircumflex"] = "i^"
  991. X#    ditmap["idieresis"] = "i."
  992. X#    ditmap["igrave"] = "i`"
  993. X#    ditmap["ntilde"] = "n~"
  994. X#    ditmap["oacute"] = "o'"
  995. X#    ditmap["ocircumflex"] = "o^"
  996. X    ditmap["odieresis"] = "o:"
  997. X#    ditmap["ograve"] = "o`"
  998. X#    ditmap["otilde"] = "o~"
  999. X#    ditmap["scaron"] = "sc"
  1000. X#    ditmap["uacute"] = "u'"
  1001. X#    ditmap["ucircumflex"] = "u^"
  1002. X    ditmap["udieresis"] = "u:"
  1003. X#    ditmap["ugrave"] = "u`"
  1004. X#    ditmap["ydieresis"] = "y."
  1005. X#    ditmap["zcaron"] = "zc"
  1006. X
  1007. X# Characters that have subroutine proceedures that are used
  1008. X# to draw them with psdit.
  1009. X
  1010. X    psdit["onequarter"] = "14"
  1011. X    psdit["onehalf"] = "12"
  1012. X    psdit["threequarters"] = "34"
  1013. X
  1014. X    psdit["square"] = 1
  1015. X    psdit["box"] = 1
  1016. X    psdit["circle"] = 1
  1017. X    psdit["boxrule"] = 1
  1018. X    psdit["boldvertical"] = 1
  1019. X    psdit["rule"] = 1
  1020. X
  1021. X    psdit["lefttopcurly"] = 1
  1022. X    psdit["leftbotcurly"] = 1
  1023. X    psdit["righttopcurly"] = 1
  1024. X    psdit["rightbotcurly"] = 1
  1025. X    psdit["leftmidcurly"] = 1
  1026. X    psdit["rightmidcurly"] = 1
  1027. X    psdit["leftfloor"] = 1
  1028. X    psdit["rightfloor"] = 1
  1029. X    psdit["leftceiling"] = 1
  1030. X    psdit["rightceiling"] = 1
  1031. X
  1032. X# No mapping exists for these characters.
  1033. X
  1034. X    ditmap[".noPS1"] = "ma fe"    # male female
  1035. X    ditmap[".noPS2"] = "~~"     # almost exactly equals
  1036. X    ditmap[".noPS3"] = ">< <> !> !<"    # funny relations
  1037. X    ditmap[".noPS4"] = "uj"        # dotless (undotted) j
  1038. X    ditmap[".noPS5"] = "cp"        # cap (upside down breve)
  1039. X    ditmap[".noPS6"] = "-+"        # - over + ?
  1040. X    ditmap[".noPS7"] = "vr"        # vertical rule 
  1041. X
  1042. X#    ditmap[".noPS90"] = "wi tp sg sa rd ra os =p =. 4d"
  1043. X#    ditmap[".noPS91"] = "le ld hi gp ge el eg dc"
  1044. X#    ditmap[".noPS92"] = "cy bc b9 b0 as an ai \\` \\_ \\'"
  1045. X#    ditmap[".noPS93"] = "UT Sl SQ RC RB LE GE EL EG DT CB *V"
  1046. X
  1047. X# L. and l. are used for line drawing on systems without graphics
  1048. X
  1049. X# ascii is a mapping which contains the troff character names
  1050. X#    for the printable ascii characters.  The values are the ascii
  1051. X#    character codes but are not used in this program.  A test is
  1052. X#    made to see if a specific name is in the table.
  1053. X
  1054. X    ascii["space"] = 32
  1055. X    ascii["exclam"] = 33
  1056. X    ascii["quotedbl"] = 34
  1057. X    ascii["numbersign"] = 35
  1058. X    ascii["dollar"] = 36
  1059. X    ascii["percent"] = 37
  1060. X    ascii["ampersand"] = 38
  1061. X    ascii["quoteright"] = 39
  1062. X    ascii["parenleft"] = 40
  1063. X    ascii["parenright"] = 41
  1064. X    ascii["asterisk"] = 42
  1065. X    ascii["plus"] = 43
  1066. X    ascii["comma"] = 44
  1067. X    ascii["hyphen"] = 45
  1068. X#    ascii["minus"] = 45
  1069. X    ascii["period"] = 46
  1070. X    ascii["slash"] = 47
  1071. X    ascii["zero"] = 48
  1072. X    ascii["one"] = 49
  1073. X    ascii["two"] = 50
  1074. X    ascii["three"] = 51
  1075. X    ascii["four"] = 52
  1076. X    ascii["five"] = 53
  1077. X    ascii["six"] = 54
  1078. X    ascii["seven"] = 55
  1079. X    ascii["eight"] = 56
  1080. X    ascii["nine"] = 57
  1081. X    ascii["colon"] = 58
  1082. X    ascii["semicolon"] = 59
  1083. X    ascii["less"] = 60
  1084. X    ascii["equal"] = 61
  1085. X    ascii["greater"] = 62
  1086. X    ascii["question"] = 63
  1087. X    ascii["at"] = 64
  1088. X    ascii["A"] = 65
  1089. X    ascii["B"] = 66
  1090. X    ascii["C"] = 67
  1091. X    ascii["D"] = 68
  1092. X    ascii["E"] = 69
  1093. X    ascii["F"] = 70
  1094. X    ascii["G"] = 71
  1095. X    ascii["H"] = 72
  1096. X    ascii["I"] = 73
  1097. X    ascii["J"] = 74
  1098. X    ascii["K"] = 75
  1099. X    ascii["L"] = 76
  1100. X    ascii["M"] = 77
  1101. X    ascii["N"] = 78
  1102. X    ascii["O"] = 79
  1103. X    ascii["P"] = 80
  1104. X    ascii["Q"] = 81
  1105. X    ascii["R"] = 82
  1106. X    ascii["S"] = 83
  1107. X    ascii["T"] = 84
  1108. X    ascii["U"] = 85
  1109. X    ascii["V"] = 86
  1110. X    ascii["W"] = 87
  1111. X    ascii["X"] = 88
  1112. X    ascii["Y"] = 89
  1113. X    ascii["Z"] = 90
  1114. X    ascii["bracketleft"] = 91
  1115. X    ascii["backslash"] = 92
  1116. X    ascii["bracketright"] = 93
  1117. X#    ascii["asciicircum"] = 94    # 195 see ditmap, should be ascii!
  1118. X    ascii["underscore"] = 95
  1119. X    ascii["quoteleft"] = 96
  1120. X    ascii["a"] = 97
  1121. X    ascii["b"] = 98
  1122. X    ascii["c"] = 99
  1123. X    ascii["d"] = 100
  1124. X    ascii["e"] = 101
  1125. X    ascii["f"] = 102
  1126. X    ascii["g"] = 103
  1127. X    ascii["h"] = 104
  1128. X    ascii["i"] = 105
  1129. X    ascii["j"] = 106
  1130. X    ascii["k"] = 107
  1131. X    ascii["l"] = 108
  1132. X    ascii["m"] = 109
  1133. X    ascii["n"] = 110
  1134. X    ascii["o"] = 111
  1135. X    ascii["p"] = 112
  1136. X    ascii["q"] = 113
  1137. X    ascii["r"] = 114
  1138. X    ascii["s"] = 115
  1139. X    ascii["t"] = 116
  1140. X    ascii["u"] = 117
  1141. X    ascii["v"] = 118
  1142. X    ascii["w"] = 119
  1143. X    ascii["x"] = 120
  1144. X    ascii["y"] = 121
  1145. X    ascii["z"] = 122
  1146. X    ascii["braceleft"] = 123
  1147. X    ascii["bar"] = 124
  1148. X    ascii["braceright"] = 125
  1149. X#    ascii["asciitilde"] = 126    # 196 see ditmap, should be ascii !
  1150. X
  1151. X    ditmap[".proctext"] = "18 38 58 78 13 23"
  1152. X
  1153. X    # character-code and width info for synthetic characters
  1154. X
  1155. X    cc = 132    # manufacture unique character codes
  1156. X    proc["18"] = cc++ " 0 833"    # 1/8
  1157. X    proc["38"] = cc++ " 0 833"    # 3/8
  1158. X    proc["58"] = cc++ " 0 833"    # 5/8
  1159. X    proc["78"] = cc++ " 0 833"    # 7/8
  1160. X    proc["13"] = cc++ " 0 833"    # 1/3
  1161. X    proc["23"] = cc++ " 0 833"    # 2/3
  1162. X} # BEGIN
  1163. X
  1164. X# The following dumps the character set defined above to standard
  1165. X# output.  It is triggared if the input file is named "DESC".
  1166. X# This info is used in the device description DESC to describe the
  1167. X# global (over all fonts) character set of the device.
  1168. X# Note that this dumps the information in random order (awk's
  1169. X# enumeration of ditmap), but troff (makedev) shouldn't care.  This
  1170. X# is the only place the resolution, font sizes, unitwidth, etc. are
  1171. X# wired.  If they get too large, troff will explode, so change them
  1172. X# at your own risk.
  1173. X
  1174. XFILENAME == "DESC" {
  1175. X    SIZES = "6 8 10 12 14 18 24"
  1176. X    RES = 72 * 8
  1177. X    print "sizes", SIZES, 0
  1178. X    print "res", RES
  1179. X    print "hor 1"
  1180. X    print "vert 1"
  1181. X    print "unitwidth", int((1000.0 / SCALE) * (72.0 / RES))
  1182. X    print "charset"
  1183. X    outstr = ""
  1184. X    for (i in ditmap) {
  1185. X        n = ditmap[i]
  1186. X        if ((length(outstr)+length(n)) > 60) {
  1187. X            print outstr
  1188. X            outstr = n " "
  1189. X        } else {
  1190. X            outstr = outstr n " "
  1191. X        }
  1192. X    }
  1193. X    if (length(outstr) != 0) print outstr
  1194. X    exit
  1195. X}
  1196. X
  1197. X# Define the actions on the fields in the BDF format.
  1198. X#    Note that 3 files are generated which are cat'ed together
  1199. X#    outside this program.
  1200. X
  1201. X# handle header information
  1202. X
  1203. X/^STARTFONT/ {
  1204. X    print "#", $0 > header
  1205. X    next
  1206. X}
  1207. X
  1208. X/^COMMENT Begin LogicalFontDescription/ {next}
  1209. X/^COMMENT END LogicalFontDescription/ {next}
  1210. X/^COMMENT .* end of inserted font properties/    {next}
  1211. X
  1212. X/^COMMENT/ {
  1213. X    $1 = "# "
  1214. X    print > header
  1215. X    next
  1216. X} 
  1217. X
  1218. X/^FONT / {
  1219. X    print "#  " $2 > header
  1220. X    split($0, arg, ".")
  1221. X    print "name", arg[2] > header
  1222. X    if (arg[2] == "S") {
  1223. X        print "special" > header
  1224. X        isspecial = 1
  1225. X        istext = 0
  1226. X    }
  1227. X    next
  1228. X}
  1229. X
  1230. X/^X_HEIGHT / {
  1231. X    ascender = $2
  1232. X    next
  1233. X}
  1234. X
  1235. X/^ENDPROPERTIES/ { next }
  1236. X
  1237. X# set character name
  1238. X
  1239. X/^STARTCHAR .*/ {
  1240. X    charname = $2
  1241. X    next
  1242. X}
  1243. X
  1244. X# set encoding
  1245. X
  1246. X/^ENCODING .*/ {
  1247. X    charcode = $2
  1248. X    next
  1249. X}
  1250. X
  1251. X/^SWIDTH [0-9]* [0-9]*/ {
  1252. X    width = $2
  1253. X    next
  1254. X}
  1255. X
  1256. X/^DWIDTH [0-9]* [0-9]*/ {
  1257. X    dwidth = $2
  1258. X    next
  1259. X}
  1260. X
  1261. X# 1   2       3       4       5
  1262. X/^BBX [-0-9]* [-0-9]* [-0-9]* [-0-9]*/ {
  1263. X    if (charcode == -1)            # unused character
  1264. X        next
  1265. X
  1266. X    bblly = $5
  1267. X    bbury = $3 + $5
  1268. X
  1269. X#    ignore out of range characters
  1270. X    if (charcode >= 256)
  1271. X        next
  1272. X
  1273. X#    compute width
  1274. X    scaledwidth = int(0.5 + (width / SCALE))
  1275. X    if ((scaledwidth < 0) || (scaledwidth > 256)) {
  1276. X        print "ERROR! Width out of range!"
  1277. X        exit 2
  1278. X    }
  1279. X
  1280. X#    handle space
  1281. X    if (charname == "space") {        # special char widths
  1282. X        spacewidth = scaledwidth
  1283. X        printf "ligatures " > header
  1284. X        printf "spacewidth %d\n", spacewidth > spaces
  1285. X        print "charset" > spaces
  1286. X        printf "\\|\t%d 0 000\t1/6 em space\n", int (0.5 + (1000.0/6.0) / SCALE) > trailer
  1287. X        printf "\\^\t%d 0 000\t1/12 em space\n", int (0.5 + (1000.0/12.0) / SCALE) > trailer
  1288. X        printf "\\&\t00 0 000\tno space\n" > trailer
  1289. X        next
  1290. X    }
  1291. X
  1292. X#    parse ligatures
  1293. X    if (length(ligature[charname]))
  1294. X        printf "%s ", charname > header
  1295. X
  1296. X#    ascender/descender flags
  1297. X    ad = 0
  1298. X    if (bblly < 0) ad += 1
  1299. X    if (bbury > ascender) ad += 2
  1300. X
  1301. X#    dump the description line
  1302. X    if (length(ascii[charname]) > 0) {
  1303. X        printf "%c\t%d %d 0%2o\t%s\n", charcode, scaledwidth, ad, charcode, charname  > trailer
  1304. X        # look for ditmap synonyms
  1305. X        if (length(ditmap[charname]) > 0) {
  1306. X            n = split(ditmap[charname],others," ")
  1307. X            for (i = 1; i <= n; i++) {
  1308. X                oth = others[i];
  1309. X                if ((length(mathonly[oth]) > 0) && (isspecial != 1)) continue;
  1310. X                printf "%s\t\"\n", others[i]  > trailer
  1311. X            }
  1312. X        }
  1313. X    } else if (length(ditmap[charname]) > 0) {
  1314. X        # not a printable ascii character
  1315. X        n = split(ditmap[charname],others," ")
  1316. X        printf "%s\t%d %d 0%o\t%s\n", others[1], scaledwidth, ad, charcode, charname  > trailer
  1317. X        for (i = 2; i <= n; i++) {
  1318. X            printf "%s\t\"\n", others[i]  > trailer
  1319. X        }
  1320. X    }
  1321. X
  1322. X# dump a line for PS specific actual width/hack table
  1323. X
  1324. X    specialcode = 0
  1325. X    if (length(psdit[charname]) != 0)
  1326. X        specialcode = 1
  1327. X    printf "%d %d %d\n", charcode, width, specialcode > aux
  1328. X    next
  1329. X}
  1330. X
  1331. XEND    {
  1332. X    printf "0\n" > header
  1333. X
  1334. X    # dump the "fudged" characters.
  1335. X    for (i in proc) {
  1336. X        p = proc[i]
  1337. X        split(p,vals," ")
  1338. X        scaledwidth = int(0.5 + (vals[3] / SCALE))
  1339. X        if (((istext == 1) && (index(ditmap[".proctext"],i) != 0)) || ((isspecial == 1) && (index(ditmap[".procspecial"],i) != 0))) {
  1340. X            printf "%s\t%d %d 0%o\tfudgedproc!\n", i, scaledwidth, vals[2], vals[1] > trailer
  1341. X
  1342. X            printf "%d %d %d\n", vals[1], vals[3], 1 > aux
  1343. X        }
  1344. X    }
  1345. X    exit
  1346. X
  1347. X}
  1348. END_OF_FILE
  1349. if test 17215 -ne `wc -c <'xtroff/devpsc/bdfdit.awk'`; then
  1350.     echo shar: \"'xtroff/devpsc/bdfdit.awk'\" unpacked with wrong size!
  1351. fi
  1352. # end of 'xtroff/devpsc/bdfdit.awk'
  1353. fi
  1354. echo shar: End of archive 12 \(of 18\).
  1355. cp /dev/null ark12isdone
  1356. MISSING=""
  1357. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ; do
  1358.     if test ! -f ark${I}isdone ; then
  1359.     MISSING="${MISSING} ${I}"
  1360.     fi
  1361. done
  1362. if test "${MISSING}" = "" ; then
  1363.     echo You have unpacked all 18 archives.
  1364.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1365. else
  1366.     echo You still need to unpack the following archives:
  1367.     echo "        " ${MISSING}
  1368. fi
  1369. ##  End of shell archive.
  1370. exit 0
  1371.