home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume17 / xparty / part02 < prev    next >
Encoding:
Text File  |  1992-03-31  |  50.1 KB  |  1,761 lines

  1. Newsgroups: comp.sources.x
  2. Path: uunet!zaphod.mps.ohio-state.edu!mips!msi!dcmartin
  3. From: peebles@mips.com (Andrew Peebles)
  4. Subject: v17i045: Xparty - multi-person conference call (MOTIF), Part02/04
  5. Message-ID: <1992Apr1.135324.383@msi.com>
  6. Originator: dcmartin@fascet
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Organization: Molecular Simulations, Inc.
  9. References: <csx-17i044-xparty@uunet.UU.NET>
  10. Date: Wed, 1 Apr 1992 13:53:24 GMT
  11. Approved: dcmartin@msi.com
  12.  
  13. Submitted-by: peebles@mips.com (Andrew Peebles)
  14. Posting-number: Volume 17, Issue 45
  15. Archive-name: xparty/part02
  16.  
  17. # this is part.02 (part 2 of a multipart archive)
  18. # do not concatenate these parts, unpack them in order with /bin/sh
  19. # file Table.c continued
  20. #
  21. if test ! -r _shar_seq_.tmp; then
  22.     echo 'Please unpack part 1 first!'
  23.     exit 1
  24. fi
  25. (read Scheck
  26.  if test "$Scheck" != 2; then
  27.     echo Please unpack part "$Scheck" next!
  28.     exit 1
  29.  else
  30.     exit 0
  31.  fi
  32. ) < _shar_seq_.tmp || exit 1
  33. if test ! -f _shar_wnt_.tmp; then
  34.     echo 'x - still skipping Table.c'
  35. else
  36. echo 'x - continuing file Table.c'
  37. sed 's/^X//' << 'SHAR_EOF' >> 'Table.c' &&
  38. X * the routine will resize the widget to fit its allocated
  39. X * space.  Then it will place the widget paying attention
  40. X * to the justification.
  41. X */
  42. {
  43. X    Cardinal i;
  44. X    Position ax, ay;
  45. X    Dimension aw, ah;
  46. X    Dimension nw, nh;
  47. X
  48. X    for (i = 0;  i < managed->n_layout;  i++) {
  49. X    ax = SumVec(0, managed->locs[i].loc.ax, cvec, hp, cs, 0);
  50. X    ay = SumVec(0, managed->locs[i].loc.ay, rvec, vp, rs, 0);
  51. X    aw = SumVec(managed->locs[i].loc.ax,
  52. X            (Position) managed->locs[i].loc.h_span, cvec, 0, cs, -cs);
  53. X    ah = SumVec(managed->locs[i].loc.ay,
  54. X            (Position) managed->locs[i].loc.v_span, rvec, 0, rs, -rs);
  55. X    nw = aw - 2*managed->locs[i].w->core.border_width;
  56. X    nh = ah - 2*managed->locs[i].w->core.border_width;
  57. X    if (managed->locs[i].loc.options & TBL_LK_WIDTH) {
  58. X        nw = managed->locs[i].w->core.width;
  59. X    }
  60. X    if (managed->locs[i].loc.options & TBL_LK_HEIGHT) {
  61. X        nh = managed->locs[i].w->core.height;
  62. X    }
  63. X    if (((nw != managed->locs[i].w->core.width) ||
  64. X         (nh != managed->locs[i].w->core.height)) &&
  65. X        (nw > 0) && (nh > 0)) {
  66. X        /* Resize widget */
  67. #ifdef sizing
  68. X        Widget w = managed->locs[i].w;
  69. X        printf("Resizing %s(%X) -> %d, %d, %d\n", 
  70. X                   XrmQuarkToString(w->core.xrm_name),
  71. X           w, nw, nh,
  72. X           w->core.border_width);
  73. #endif
  74. X        _XmResizeObject((RectObj) managed->locs[i].w, nw, nh,
  75. X                managed->locs[i].w->core.border_width);
  76. X    }
  77. X    
  78. X    /* Now place */
  79. X    nw = managed->locs[i].w->core.width +
  80. X      2*managed->locs[i].w->core.border_width;;
  81. X    nh = managed->locs[i].w->core.height +
  82. X      2*managed->locs[i].w->core.border_width;;
  83. X    PlaceWidget(managed->locs[i].w, ax, ay, aw, ah, nw, nh,
  84. X            managed->locs[i].loc.options);
  85. X    }
  86. }
  87. X
  88. X
  89. X
  90. /*ARGSUSED*/
  91. static void TblPlacement(tw)
  92. TableWidget tw;            /* Table widget */
  93. /*
  94. X * Places the children of the table widget.  There are several steps:
  95. X *   1.  Distribute any extra space into local copies of spacing vectors.
  96. X *   2.  If the option is set,  any extra space is offered to each widget.
  97. X *   3.  The final placement is done according to the actual size of
  98. X *       each widget and the space allocated for it.
  99. X */
  100. {
  101. X    Cardinal i;
  102. X    TableVecPtr lrows, lcols;
  103. X    TableLocTblPtr managed;
  104. X    Dimension real_width, real_height, tmp;
  105. X    float    offset;
  106. X
  107. X    if (tw->table.num_rows && tw->table.num_cols) {
  108. X    /* Make local copies of vectors */
  109. X    lrows = (TableVecPtr)
  110. X      XtCalloc(tw->table.num_rows, sizeof(struct _TableVector));
  111. X    for (i = 0;  i < tw->table.num_rows;  i++) {
  112. X        lrows[i] = tw->table.rows[i];
  113. X    }
  114. X    lcols = (TableVecPtr)
  115. X      XtCalloc(tw->table.num_cols, sizeof(struct _TableVector));
  116. X    for (i = 0;  i < tw->table.num_cols;  i++) {
  117. X        lcols[i] = tw->table.cols[i];
  118. X    }
  119. X
  120. X    /* Add extra space to vector */
  121. X    real_width = tw->core.width - 2*tw->table.int_width -
  122. X      (tw->table.num_cols-1)*tw->table.col_spacing;
  123. X    real_height = tw->core.height - 2*tw->table.int_height -
  124. X      (tw->table.num_rows-1)*tw->table.row_spacing;
  125. X
  126. #ifdef sizing
  127. X    /* Worry about the case where we couldn't grow enough */
  128. X    /* This is a real hack.  If there is one item which seems to be the
  129. X         * trouble maker, then we shrink it, otherwise we shrink everyone
  130. X     * proportionately.  We can still truncate here, but only when things
  131. X     * start getting around 10 pixels.
  132. X         */
  133. X    if (real_width < tw->table.vec_width) {
  134. X        printf("Too wide! (%d < %d)\n", real_width, tw->table.vec_width);
  135. X        for (i = 0; i < tw->table.num_rows; ++i) {
  136. X        if (lrows[i].value > real_width) {
  137. X            printf("shrunk item %d from %d", i, lrows[i].value);
  138. X            tmp = lrows[i].value;
  139. X            lrows[i].value = real_width - (tw->table.vec_width - tmp);
  140. X            if (lrows[i].value < 10) lrows[i].value = 10;
  141. X            tw->table.vec_width -= (tmp - lrows[i].value);
  142. X            printf(" to %d\n", lrows[i].value);
  143. X        }
  144. X        }
  145. X        if (real_width < tw->table.vec_width) {
  146. X        offset = tw->table.vec_width - real_width;
  147. X        offset /= tw->table.vec_width;
  148. X        for (i = 0; i < tw->table.num_rows; ++i) {
  149. X            if (lrows[i].value > 10) {
  150. X            lrows[i].value *= offset;
  151. X            if (lrows[i].value < 10) lrows[i].value = 10;
  152. X            } else printf("won't shrink %d\n", i);
  153. X        }
  154. X        printf("shrunk by %f\n", offset);
  155. X        }
  156. X    }
  157. X    if (real_height < tw->table.vec_height) {
  158. X        printf("Too tall! (%d < %d)\n", real_height, tw->table.vec_height);
  159. X        for (i = 0; i < tw->table.num_cols; ++i) {
  160. X        if (lcols[i].value > real_height) {
  161. X            printf("shrunk item %d from %d", i, lcols[i].value);
  162. X            tmp = lcols[i].value;
  163. X            lcols[i].value = real_height - (tw->table.vec_height - tmp);
  164. X            if (lcols[i].value < 10) lcols[i].value = 10;
  165. X            tw->table.vec_height -= (tmp - lcols[i].value);
  166. X            printf(" to %d\n", lcols[i].value);
  167. X        }
  168. X        }
  169. X        if (real_height < tw->table.vec_height) {
  170. X        offset = tw->table.vec_height - real_height;
  171. X        offset /= tw->table.vec_height;
  172. X        for (i = 0; i < tw->table.num_cols; ++i) {
  173. X            if (lcols[i].value > 10) {
  174. X            lcols[i].value *= offset;
  175. X            if (lcols[i].value < 10) lcols[i].value = 10;
  176. X            } else printf("won't shrink %d\n", i);
  177. X        }
  178. X        printf("shrunk by %f\n", offset);
  179. X        }
  180. X    }
  181. #endif
  182. X          
  183. X    ExtraSpace(tw->table.num_cols, lcols, real_width);
  184. X    ExtraSpace(tw->table.num_rows, lrows, real_height);
  185. X
  186. X    /* Get list of managed widgets with locations */
  187. X    managed = GetManaged(tw->composite.num_children, tw->composite.children);
  188. X    DoPlace(managed, lcols, lrows, tw->table.int_height, tw->table.int_width,
  189. X        tw->table.row_spacing, tw->table.col_spacing);
  190. X
  191. X    /* Free up resources */
  192. X    XtFree((char *) lcols);
  193. X    XtFree((char *) lrows);
  194. X    TblFreeLocTbl(managed);
  195. X    }
  196. }
  197. X
  198. X
  199. X
  200. X
  201. static void TblResize(w)
  202. Widget w;            /* Table widget */
  203. /*
  204. X * This routine is called when the table widget itself is
  205. X * resized.  If needed,  the vectors are recomputed and
  206. X * placement is done.
  207. X */
  208. {
  209. X    TableWidget tw = (TableWidget) w;
  210. X
  211. X    if (tw->table.vec_state == INVALID) {
  212. X    TblRecompVectors(tw);
  213. X    tw->table.vec_state = MINIMUM;
  214. X    }
  215. X    TblPlacement(tw);
  216. }
  217. X
  218. X
  219. X
  220. static XtGeometryResult ExamineRequest(request)
  221. XXtWidgetGeometry *request;
  222. /*
  223. X * Examines the bits set in `request' and returns an appropriate
  224. X * geometry manager result.  Pure size changes are accepted
  225. X * (XtGeometryYes),  pure position changes are rejected
  226. X * (XtGeometryNo),  and combinations are conditionally
  227. X * accepted (XtGeometryAlmost).
  228. X */
  229. {
  230. X    if (request->request_mode & (CWWidth|CWHeight|CWBorderWidth)) {
  231. X    if (request->request_mode & (CWX|CWY|CWSibling|CWStackMode)) {
  232. X        return XtGeometryAlmost;
  233. X    } else {
  234. X        return XtGeometryYes;
  235. X    }
  236. X    } else {
  237. X    return XtGeometryNo;
  238. X    }
  239. }
  240. X
  241. X
  242. X
  243. static XtGeometryResult TblGeometryManager(w, request, reply)
  244. Widget w;            /* Widget                    */
  245. XXtWidgetGeometry *request;    /* Requested geometry change */
  246. XXtWidgetGeometry *reply;    /* Actual reply to request   */
  247. /*
  248. X * This routine handles geometry requests from children.  Width
  249. X * and height changes are always accepted.  Position changes
  250. X * are always rejected.  Combinations result in XtGeometryAlmost
  251. X * with the requested widths filled in.  Accepted changes cause
  252. X * an immediate XtResizeWidget followed by a new placement.
  253. X */
  254. {
  255. X    Widget parent;
  256. X    TableWidget tw = (TableWidget) w->core.parent;
  257. X    XtGeometryResult result;
  258. X    Dimension width, height, bdr;
  259. X    Dimension owidth, oheight, obdr;
  260. X    Dimension ow, oh;
  261. X
  262. X    parent = w->core.parent;
  263. X    if (parent &&
  264. X    (strcmp(parent->core.widget_class->core_class.class_name,
  265. X        TBL_CLASS_NAME) == 0)) {
  266. X
  267. X    tw = (TableWidget) parent;
  268. X    result = ExamineRequest(request);
  269. X    switch (result) {
  270. X      case XtGeometryYes:
  271. X      case XtGeometryAlmost:
  272. X        if (request->request_mode & CWWidth) width = request->width;
  273. X        else width = w->core.width;
  274. X        if (request->request_mode & CWHeight) height = request->height;
  275. X        else height = w->core.height;
  276. X        if (request->request_mode & CWBorderWidth) bdr = request->height;
  277. X        else bdr = w->core.border_width;
  278. X
  279. X        oheight = w->core.height;
  280. X        owidth = w->core.width;
  281. X        obdr = w->core.border_width;
  282. X        w->core.width = width;
  283. X        w->core.height = height;
  284. X        w->core.border_width = bdr;
  285. X
  286. X        ow = tw->table.vec_width;
  287. X        oh = tw->table.vec_height;
  288. X        TblRecompVectors(tw);
  289. X        w->core.width = owidth;
  290. X        w->core.height = oheight;
  291. X        w->core.border_width = obdr;
  292. X        
  293. X        if ((ow != tw->table.vec_width) || (oh != tw->table.vec_height)) {
  294. X        tw->table.vec_state = MINIMUM;
  295. X        TblRequestResize(tw);
  296. X        }
  297. X
  298. X      {
  299. X          Position        x, y;
  300. X          Dimension        h, v;
  301. X          XtTblMask     options;
  302. X          Position         ax, ay;
  303. X          Dimension     aw, ah;
  304. X          Dimension     nw, nh;
  305. X          TableVecPtr    lcols, lrows;
  306. X          Cardinal        i;
  307. X          XtGeometryResult    gres;
  308. X          char        *name;
  309. X          Dimension        real_width, real_height;
  310. X    
  311. X          name = XrmQuarkToString(w->core.xrm_name);
  312. X          
  313. #ifdef sizing
  314. X          printf("Positioning %s (%X)\n", name, w);
  315. #endif
  316. X          
  317. X          if (!TblFindChild(w, &x, &y, &h, &v, &options)) return XtGeometryNo;
  318. X
  319. X          lrows = (TableVecPtr)  XtCalloc(tw->table.num_rows, sizeof(struct _TableVector));
  320. X          for (i = 0;  i < tw->table.num_rows;  i++) lrows[i] = tw->table.rows[i];
  321. X          lcols = (TableVecPtr) XtCalloc(tw->table.num_cols, sizeof(struct _TableVector));
  322. X          for (i = 0;  i < tw->table.num_cols;  i++) lcols[i] = tw->table.cols[i];
  323. X
  324. X          real_width = tw->core.width - 2*tw->table.int_width -
  325. X        (tw->table.num_cols-1)*tw->table.col_spacing;
  326. X          real_height = tw->core.height - 2*tw->table.int_height -
  327. X        (tw->table.num_rows-1)*tw->table.row_spacing;
  328. X          ExtraSpace(tw->table.num_cols, lcols, real_width);
  329. X          ExtraSpace(tw->table.num_rows, lrows, real_height);
  330. X
  331. X          ax = SumVec(0, x, lcols, tw->table.int_width, tw->table.col_spacing, 0);
  332. X          ay = SumVec(0, y, lrows, tw->table.int_height, tw->table.row_spacing, 0);
  333. X          aw = SumVec(x, (Position) h, lcols, 0, tw->table.col_spacing, -tw->table.col_spacing);
  334. X          ah = SumVec(y, (Position) v, lrows, 0, tw->table.row_spacing, -tw->table.row_spacing);
  335. X          nw = aw - 2*w->core.border_width;
  336. X          nh = ah - 2*w->core.border_width;
  337. X          if (options & TBL_LK_WIDTH) nw = w->core.width;
  338. X          if (options & TBL_LK_HEIGHT) nh = w->core.height;
  339. X          XtFree(lcols);
  340. X          XtFree(lrows);
  341. X
  342. X          /* Worry about the case where we couldn't grow enough */
  343. X          /* Note, we may need a border here or something! */
  344. X          if (real_width < tw->table.vec_width) {
  345. #ifdef sizing
  346. X          printf("%s: Too wide! (%d < %d)\n", name, real_width, tw->table.vec_width);
  347. #endif
  348. X          nw -= (tw->table.vec_width - real_width);
  349. X          if (nw <= 0) {
  350. #ifdef sizing
  351. X              printf("%s: Give up!\n", name);
  352. #endif
  353. X              return XtGeometryNo;
  354. X          }
  355. X          }
  356. X          if (real_height < tw->table.vec_height) {
  357. #ifdef sizing
  358. X          printf("%s: Too tall! (%d < %d)\n", name, real_height, tw->table.vec_height);
  359. #endif
  360. X          nh -= (tw->table.vec_height - real_height);
  361. X          if (nh <= 0) {
  362. #ifdef sizing
  363. X              printf("%s: Give up!\n", name);
  364. #endif
  365. X              return XtGeometryNo;
  366. X          }
  367. X          }
  368. X          
  369. X
  370. X          *reply = *request;
  371. X          reply->request_mode &= (CWWidth|CWHeight|CWBorderWidth);
  372. X          reply->width = nw;
  373. X          reply->height = nh;
  374. X
  375. #ifdef sizing
  376. X          printf("%s: w=o%d,r%d,a%d,t%d h=o%d,r%d,a%d,t%d\n", name,
  377. X             owidth, width, w->core.width, nw, oheight, height, w->core.height, nh);
  378. #endif
  379. X
  380. X          /* Return No if there is no change */
  381. X          if (w->core.width == nw && w->core.height == nh) {
  382. X          if (request->request_mode & CWBorderWidth) {
  383. X              if (w->core.border_width == request->border_width) {
  384. #ifdef sizing
  385. X              printf("%s: No change\n", name);
  386. #endif
  387. X              return XtGeometryNo;
  388. X              }
  389. #ifdef sizing
  390. X              printf("%s: Almost border\n", name);
  391. #endif
  392. X              reply->request_mode = CWBorderWidth;
  393. X              return XtGeometryAlmost;
  394. X          }
  395. X          }
  396. X              
  397. X          gres = XtGeometryDone;
  398. X          if (((request->request_mode & CWWidth) && nw != width) ||
  399. X          ((request->request_mode & CWHeight) && nh != height)) {
  400. X          gres = XtGeometryAlmost;
  401. X          }
  402. X
  403. X          if (request->request_mode & (~CWWidth&~CWHeight&~CWBorderWidth&~XtCWQueryOnly))
  404. X        gres = XtGeometryAlmost;
  405. X
  406. X          if (request->request_mode & XtCWQueryOnly) {
  407. X          if (gres == XtGeometryDone) return XtGeometryYes;
  408. #ifdef sizing
  409. X          printf("%s: It was a query (%d)\n", name, gres);
  410. #endif
  411. X          return gres;
  412. X          }
  413. X
  414. X          if (gres == XtGeometryAlmost) {
  415. #ifdef sizing
  416. X          printf("%s: Almost fits (Request=%d Reply=%d)\n", name,
  417. X             request->request_mode, reply->request_mode);
  418. #endif
  419. X          return gres;
  420. X          }
  421. X
  422. X          w->core.border_width = bdr;
  423. X          TblPlacement(tw);
  424. X
  425. #ifdef sizing
  426. X          printf("%s: w=o%d,r%d,a%d,t%d h=o%d,r%d,a%d,t%d (%X)\n", name,
  427. X             owidth, width, w->core.width, nw, oheight, height, w->core.height, nh, w);
  428. #endif
  429. X      }
  430. X
  431. X        return XtGeometryDone;
  432. X        /*NOTREACHED*/
  433. X    case XtGeometryNo:
  434. X        return result;
  435. #ifdef never
  436. X        /* This isn't right, since if you return almost you must promise
  437. X         * to honor the same request next time, and we haven't really checked
  438. X         * here.
  439. X             */
  440. X    case XtGeometryAlmost:
  441. X        *reply = *request;
  442. X        /* Turn off all but the size changes */
  443. X        reply->request_mode &= (CWWidth|CWHeight|CWBorderWidth);
  444. X        return XtGeometryAlmost;
  445. #endif
  446. X    }
  447. X    /*NOTREACHED*/
  448. X    } else {
  449. X    XtErrorMsg("TblGeometryManager", "badParent", "XtToolkitError",
  450. X           "Parent of widget is not a tableClassWidget",
  451. X           (String *) NULL, (Cardinal *) NULL);
  452. X    }
  453. X    /*NOTREACHED*/
  454. }
  455. X
  456. X
  457. X
  458. /*ARGSUSED*/
  459. static Boolean TblSetValues(current, request, new)
  460. Widget current;            /* Before call to XtSetValues */
  461. Widget request;            /* After call to XtSetValues  */
  462. Widget new;            /* Final version of widget    */
  463. /*
  464. X * Checks for changes to `init_table'.  If so,  a recomputation
  465. X * and replacement occurs.  Always returns false.
  466. X */
  467. {
  468. X    TableWidget old = (TableWidget) current;
  469. X    TableWidget req = (TableWidget) request;
  470. X    TableWidget tw  = (TableWidget) new;
  471. X    Boolean recomp  = False;
  472. X
  473. X    if ( old->table.init_layout != tw->table.init_layout ) {
  474. X         XtFree(old->table.init_layout);
  475. X         tw->table.init_layout = CopyDefLoc(req->table.init_layout);
  476. X         recomp = True;
  477. X    }
  478. X
  479. X    if ((tw->table.init_layout) ||
  480. X    (old->table.int_width != tw->table.int_width) ||
  481. X    (old->table.int_height != tw->table.int_height) ||
  482. X    (old->table.row_spacing != tw->table.row_spacing) ||
  483. X    (old->table.col_spacing != tw->table.col_spacing)) {
  484. X    recomp = True;
  485. X    }
  486. X    if (recomp) {
  487. X    /* Causes complete recomputation and placement */
  488. X    TblRecompVectors(tw);
  489. X    tw->table.vec_state = MINIMUM;
  490. X    TblRequestResize(tw);
  491. X    TblPlacement(tw);
  492. X    }
  493. X    return FALSE;
  494. }
  495. X
  496. X
  497. X
  498. X
  499. static void TblChangeManaged(w)
  500. Widget w;            /* Table widget */
  501. /*
  502. X * This routine is called when a change to the managed set of
  503. X * children occurs.  The current implementation simply refigures
  504. X * the widget and repositions all widgets.  Better implementations
  505. X * may be able to examine the change and react accordingly.
  506. X */
  507. {
  508. X    TableWidget tw = (TableWidget) w;
  509. X    XtWidgetGeometry    g;
  510. X
  511. /*    if (_XmMakeGeometryRequest(tw, &g) == XtGeometryYes && XtIsRealized(tw)) 
  512. X    {
  513. */
  514. X    TblRecompVectors(tw);
  515. X    tw->table.vec_state = MINIMUM;
  516. X    TblRequestResize(tw);
  517. X    TblPlacement(tw);
  518. /*    }*/
  519. }
  520. X
  521. X
  522. X
  523. static XtGeometryResult TblQueryGeometry(w, request, geo_return)
  524. Widget w;            /* Table widget         */
  525. XXtWidgetGeometry *request;    /* Parent intended size */
  526. XXtWidgetGeometry *geo_return;   /* This widget's size   */
  527. /*
  528. X * This routine is called by a parent that wants a preferred
  529. X * size for the widget.  The `request' is the size (and/or position) 
  530. X * the parent intends to make the widget.  The `geo_return' is the
  531. X * preferred size of the widget.  The preferred size of the
  532. X * table widget is its vector size.
  533. X */
  534. {
  535. X    TableWidget tw = (TableWidget) w;
  536. X
  537. X    if (tw->table.vec_state == INVALID) {
  538. X    TblRecompVectors(tw);
  539. X    tw->table.vec_state = MINIMUM;
  540. X    }
  541. X    geo_return->request_mode = CWWidth|CWHeight;
  542. X    geo_return->width = tw->table.vec_width + 2*tw->table.int_width +
  543. X      (tw->table.num_cols-1)*tw->table.col_spacing;
  544. X    geo_return->height = tw->table.vec_height + 2*tw->table.int_height +
  545. X      (tw->table.num_rows-1)*tw->table.row_spacing;
  546. X
  547. X    /* Now determine return code */
  548. X    if (((geo_return->request_mode & request->request_mode) !=
  549. X     geo_return->request_mode) ||
  550. X    (request->width < geo_return->width) ||
  551. X    (request->height < geo_return->height)) {
  552. X    return XtGeometryAlmost;
  553. X    } else if ((request->width == geo_return->width) &&
  554. X           (request->height == geo_return->height)) {
  555. X    return XtGeometryNo;
  556. X    } else {
  557. X    return XtGeometryYes;
  558. X    }
  559. X    /*NOTREACHED*/
  560. }
  561. X
  562. X
  563. X
  564. static void TblPositionChild(w, c, r, hspan, vspan, options)
  565. Widget w;            /* Subwidget to place              */
  566. Position c, r;            /* Position in array (column, row) */
  567. Dimension hspan, vspan;        /* Horizontal and vertical span    */
  568. XXtTblMask options;        /* Widget placement options        */
  569. /*
  570. X * This routine registers the position of Widget w.  The widget
  571. X * must be a sub-widget of a Table class widget.  The row and
  572. X * column must be non-negative.  The horizontal and vertical
  573. X * span must be positive.  The options are as follows:
  574. X *   TBL_LEFT        Horizontally left justified.
  575. X *   TBL_RIGHT        Horizontally right justified.
  576. X *   TBL_TOP        Vertically top justified.
  577. X *   TBL_BOTTOM     Vertically bottom justified.
  578. X *   TBL_SM_WIDTH    Force the width to be as small as possible.
  579. X *   TBL_SM_HEIGHT    Force the height to be as small as possible.
  580. X *   TBL_LK_WIDTH    Don't try to expand the widget horizontally.
  581. X *   TBL_LK_HEIGHT    Don't try to expand the widget vertically.
  582. X * If `options' is equal to TBL_DEF_OPT,  it is filled with 
  583. X * the default value for the table widget. The routine adds the 
  584. X * information into a table and recomputes position information.
  585. X */
  586. {
  587. X    Widget parent;
  588. X    TableWidget tw;
  589. X    TableLoc loc;
  590. X
  591. X    if ((c < 0) || (r < 0) || (hspan == 0) || (vspan == 0)) {
  592. X    /* Bad arguments */
  593. X    XtErrorMsg("TblPositionChild", "wrongParameters", "XtToolkitError",
  594. X           "Bad value for row, column, hspan, or vspan",
  595. X           (String *) NULL, (Cardinal *) NULL);
  596. X    }
  597. X    parent = w->core.parent;
  598. X    if (parent &&
  599. X    (strcmp(parent->core.widget_class->core_class.class_name,
  600. X        TBL_CLASS_NAME)==0)){
  601. X    /* The parent exists and is a TableWidget */
  602. X    tw = (TableWidget) parent;
  603. X    loc.ax = c;
  604. X    loc.ay = r;
  605. X    loc.h_span = hspan;
  606. X    loc.v_span = vspan;
  607. X    if (options == TBL_DEF_OPT) {
  608. X        loc.options = tw->table.def_options;
  609. X    } else {
  610. X        loc.options = options;
  611. X    }
  612. X    TblInsertLoc(tw->table.real_layout, w, &loc);
  613. X    tw->table.vec_state = INVALID;
  614. X    /* Full recomputation if realized */
  615. X    if (XtIsRealized(parent)) TblResize(parent);
  616. X    } else {
  617. X    XtErrorMsg("TblPositionChild", "badParent", "XtToolkitError",
  618. X           "Parent of widget is not a tableClassWidget",
  619. X           (String *) NULL, (Cardinal *) NULL);
  620. X    }
  621. }
  622. X
  623. X
  624. X
  625. static Boolean TblFindChild(w, c_r, r_r, hspan_r, vspan_r, opt_r)
  626. Widget w;            /* Widget to locate  */
  627. Position *c_r, *r_r;        /* Returned position */
  628. Dimension *hspan_r, *vspan_r;    /* Returned span     */
  629. XXtTblMask *opt_r;        /* Returned options  */
  630. /*
  631. X * This routine looks up a child widget's location and span.  The
  632. X * parent must be a table widget.  Only non-zero fields are filled
  633. X * in.  If the widget cannot be found,  the routine returns False
  634. X * and does not modify any of the passed in pointers.  The routine
  635. X * first looks in a table of widget positions defined by the
  636. X * `position_child' class procedure.  If not found there,  it
  637. X * searches the default table using the widget name.  These
  638. X * defaults are set by resources or XtSetValues().
  639. X */
  640. {
  641. X    Widget parent;
  642. X    TableWidget tw;
  643. X    TableLocPtr locp;
  644. X    TableDefLocPtr temp;
  645. X    char    *name;
  646. X
  647. X    parent = w->core.parent;
  648. X    if (parent &&
  649. X    (strcmp(parent->core.widget_class->core_class.class_name,
  650. X        TBL_CLASS_NAME)==0)) {
  651. X    tw = (TableWidget) parent;
  652. X    if (locp = TblLocLookup(tw->table.real_layout, w)) {
  653. X        if (c_r) *c_r = locp->ax;
  654. X        if (r_r) *r_r = locp->ay;
  655. X        if (hspan_r) *hspan_r = locp->h_span;
  656. X        if (vspan_r) *vspan_r = locp->v_span;
  657. X        if (opt_r) *opt_r = locp->options;
  658. X        return True;
  659. X    } else {
  660. X        if (tw->table.init_layout) {
  661. X        temp = MergeDefLoc(tw->table.layout_db, tw->table.init_layout);
  662. X        XtFree((char *) (tw->table.init_layout));
  663. X        tw->table.init_layout = (TableDefLocPtr) 0;
  664. X        XtFree((char *) (tw->table.layout_db));
  665. X        tw->table.layout_db = temp;
  666. X        }
  667. X        /* Attempt to look it up */
  668. X        name = XrmQuarkToString(w->core.xrm_name);
  669. X        if (temp = FindDefLoc(tw->table.layout_db, name)) {
  670. X        if (c_r) *c_r = temp->loc.ax;
  671. X        if (r_r) *r_r = temp->loc.ay;
  672. X        if (hspan_r) *hspan_r = temp->loc.h_span;
  673. X        if (vspan_r) *vspan_r = temp->loc.v_span;
  674. X        if (opt_r) *opt_r = temp->loc.options;
  675. X        return True;
  676. X        } else {
  677. X        return False;
  678. X        }
  679. X    }
  680. X    } else {
  681. X    XtErrorMsg("TblFindChild", "badParent", "XtToolkitError",
  682. X           "Parent of widget is not a tableClassWidget",
  683. X           (String *) NULL, (Cardinal *) NULL);
  684. X    }
  685. X    /*NOTREACHED*/
  686. }
  687. X
  688. X
  689. X
  690. static void TblDestroy(w)
  691. Widget w;            /* Widget to destroy */
  692. /*
  693. X * Called to free resources consumed by the widget.
  694. X */
  695. {
  696. X    TableWidget tw = (TableWidget) w;
  697. X
  698. X    XtFree((char *) (tw->table.init_layout));
  699. X    XtFree((char *) (tw->table.layout_db));
  700. X    TblFreeLocTbl(tw->table.real_layout);
  701. X    if (tw->table.rows) XtFree((char *) (tw->table.rows));
  702. X    if (tw->table.cols) XtFree((char *) (tw->table.cols));
  703. }
  704. X
  705. X
  706. static Cardinal DefSpecLen(layout)
  707. String layout;            /* Full layout specification string */
  708. /*
  709. X * Examines `layout' and determines how many statements there are.
  710. X * Basically counts semi-colons and adds one.
  711. X */
  712. {
  713. X    extern String strchr();
  714. X    String idx = layout;
  715. X    Cardinal result = 0;
  716. X
  717. X    while (idx && *idx) {
  718. X    idx = (char *)strchr(idx, ';');
  719. X    if (idx) {
  720. X        result++;
  721. X        idx++;
  722. X    }
  723. X    }
  724. X    return result+1;
  725. }
  726. X
  727. #define MAX_FIELD    128
  728. #define NUM_FIELDS    6
  729. #define MAX_CHARS    255
  730. X
  731. static XtTblMask ParseOpts(spec)
  732. String spec;            /* Option letters */
  733. /*
  734. X * Parses the null-terminated string of option characters in `spec'.
  735. X * Returns a mask that is the `or' of all options selected.
  736. X */
  737. {
  738. X    static Boolean init = 0;
  739. X    static XtTblMask all_chars[MAX_CHARS];
  740. X    XtTblMask result = 0;
  741. X    String idx;
  742. X
  743. X    if (!init) {
  744. X    Cardinal i;
  745. X
  746. X    for (i = 0;  i < MAX_CHARS;  i++) all_chars[i] = 0;
  747. X    all_chars['l'] = TBL_LEFT;
  748. X    all_chars['r'] = TBL_RIGHT;
  749. X    all_chars['t'] = TBL_TOP;
  750. X    all_chars['b'] = TBL_BOTTOM;
  751. X    all_chars['w'] = TBL_LK_WIDTH;
  752. X    all_chars['h'] = TBL_LK_HEIGHT;
  753. X    all_chars['W'] = TBL_SM_WIDTH;
  754. X    all_chars['H'] = TBL_SM_HEIGHT;
  755. X    }
  756. X    for (idx = spec;  *idx;  idx++) {
  757. X    result |= all_chars[*idx];
  758. X    }
  759. X    return result;
  760. }
  761. X
  762. static void DefParse(spec, loc_spec)
  763. String spec;            /* One specification statement */
  764. TableDefLocPtr loc_spec;    /* Result location spec        */
  765. /*
  766. X * Parses a text specification statement into an internal
  767. X * form given  by `loc_spec'.
  768. X *
  769. X ******************* NOTE ********************
  770. X * Assumes only called from cvtStrToDefLoc() *
  771. X *********************************************
  772. X */
  773. {
  774. #ifndef MAX_TABLE_CHILD_WIDGET_NAME_LEN
  775. #define MAX_TABLE_CHILD_WIDGET_NAME_LEN 128
  776. #endif
  777. X    static char buf[MAX_TABLE_CHILD_WIDGET_NAME_LEN];
  778. X    int         i  = 0;
  779. X    char*       cp = spec;
  780. X
  781. X    /* initial values, NOT the defaults */
  782. X    loc_spec->loc.ax = loc_spec->loc.ay = 0;
  783. X    loc_spec->loc.h_span = loc_spec->loc.v_span = 0;
  784. X
  785. X    /* Now attempt to parse the string */
  786. X    while (*cp && *cp <= ' ') cp++;        /* eat whitespace */
  787. X
  788. X    while (' ' < *cp && i < MAX_TABLE_CHILD_WIDGET_NAME_LEN)
  789. X    buf[i++] = *cp++;
  790. X    buf[i] = '\0';
  791. X    if ( i )
  792. X    loc_spec->w_name = XtNewString(buf);    /* widget name */
  793. X    else
  794. X    loc_spec->w_name = "No Name";        /* default name */
  795. X
  796. X    while (*cp && *cp <= ' ') cp++;        /* eat whitespace */
  797. X
  798. X    while ('0' <= *cp && *cp <= '9')
  799. X    loc_spec->loc.ax = loc_spec->loc.ax * 10 + *cp++ - '0';
  800. X
  801. X    while (*cp && *cp <= ' ') cp++;        /* eat whitespace */
  802. X
  803. X    while ('0' <= *cp && *cp <= '9')
  804. X    loc_spec->loc.ay = loc_spec->loc.ay * 10 + *cp++ - '0';
  805. X
  806. X    while (*cp && *cp <= ' ') cp++;        /* eat whitespace */
  807. X
  808. X    while ('0' <= *cp && *cp <= '9')
  809. X    loc_spec->loc.h_span = loc_spec->loc.h_span * 10 + *cp++ - '0';
  810. X    if (loc_spec->loc.h_span == 0)
  811. X    loc_spec->loc.h_span = 1;        /* default span */
  812. X
  813. X    while (*cp && *cp <= ' ') cp++;        /* eat whitespace */
  814. X
  815. X    while ('0' <= *cp && *cp <= '9')
  816. X    loc_spec->loc.v_span = loc_spec->loc.v_span * 10 + *cp++ - '0';
  817. X    if (loc_spec->loc.v_span == 0)
  818. X    loc_spec->loc.v_span = 1;        /* default span */
  819. X
  820. X    while (*cp && *cp <= ' ') cp++;        /* eat whitespace */
  821. X
  822. X    i = 0;
  823. X    while (*cp && i < MAX_TABLE_CHILD_WIDGET_NAME_LEN &&
  824. X    *cp == 'l' || *cp == 'r' || *cp == 't' || *cp == 'b' ||
  825. X    *cp == 'w' || *cp == 'h' || *cp == 'W' || *cp == 'H' )
  826. X    buf[i++] = *cp++;
  827. X    buf[i] = '\0';
  828. X    if ( i )
  829. X    loc_spec->loc.options = ParseOpts(buf);
  830. X    else
  831. X    loc_spec->loc.options = 0;        /* default */
  832. X
  833. X    while (*cp && *cp <= ' ') cp++;        /* eat whitespace */
  834. X
  835. X    if (*cp )
  836. X    XtStringConversionWarning( spec, 
  837. X        "layout component: name [col] [row] [h_span] [v_span] [lrtbwhWH]");
  838. }
  839. X
  840. static String GetSpec(spec_ptr)
  841. String *spec_ptr;        /* Specification pointer */
  842. /*
  843. X * This routine gets the next specification from the string
  844. X * `spec_ptr' and updates the pointer appropriately.
  845. X */
  846. {
  847. X    extern String strchr();
  848. X    String result;
  849. X    String semi;
  850. X
  851. X    if (*spec_ptr && **spec_ptr) {
  852. X    semi = (char *)strchr(*spec_ptr, ';');
  853. X    if (semi) {
  854. X        *semi = '\0';
  855. X        result = *spec_ptr;
  856. X        *spec_ptr = semi+1;
  857. X        return result;
  858. X    } else {
  859. X        result = *spec_ptr;
  860. X        *spec_ptr += strlen(*spec_ptr);
  861. X        return result;
  862. X    }
  863. X    } else {
  864. X    return (String) 0;
  865. X    }
  866. }
  867. X
  868. X
  869. X
  870. /**********************************************************************
  871. X *
  872. X * Public routines
  873. X *
  874. X **********************************************************************/
  875. X
  876. X
  877. /*ARGSUSED*/
  878. caddr_t XtTblParseLayout(layout)
  879. String layout;            /* String layout specification */
  880. /*
  881. X * Parses a string layout specification into an internal form
  882. X * suitable for use in a call to XtSetValues().  The form is
  883. X * a list of statements separated by semicolons.  Each statement
  884. X * has the form:
  885. X *   widget_name column row horizontal_span vertical_span opt_list
  886. X * where the meaning of each field is:
  887. X *   widget_name    Name of the widget as given to XtCreateWidget().
  888. X *   column        Integer >= 0 descibing column in array
  889. X *   row        Row >= 0 describing row in array
  890. X *   horizontal_span    Integer >= 1 describing horizontal widget span
  891. X *   vertical_span    Integer >= 1 describing vertical widget span
  892. X *   opt_list        Series of characters each representing an option:
  893. X *    l:  TBL_LEFT
  894. X *    r:  TBL_RIGHT
  895. X *      t:  TBL_TOP
  896. X *      b:  TBL_BOTTOM
  897. X *      w:  TBL_LK_WIDTH
  898. X *      h:  TBL_LK_HEIGHT
  899. X *      W:  TBL_SM_WIDTH
  900. X *      H:  TBL_SM_HEIGHT
  901. X * The options are as described in TblPostionChild().  The horizontal_span,
  902. X * vertical_span, and opt_list are optional and will default to reasonable
  903. X * values.
  904. X */
  905. {
  906. X    TableDefLocPtr result, idx;
  907. X    Cardinal len;
  908. X    String spec;
  909. X    String orig;
  910. X
  911. X    /* Make a copy for safety */
  912. X    if (layout && ((len = DefSpecLen(layout)) > 0)) {
  913. X    orig = layout = XtNewString(layout);
  914. X    result = (TableDefLocPtr) XtCalloc(len+1, sizeof(struct _TableDefLoc));
  915. X    idx = result;
  916. X    while (spec = GetSpec(&layout)) {
  917. X        DefParse(spec, idx);
  918. X        idx++;
  919. X    }
  920. X    /* null terminate */
  921. X    idx->w_name = (String) 0;
  922. X    XtFree(orig);
  923. X    return (caddr_t) result;
  924. X    } else {
  925. X    return (caddr_t) 0;
  926. X    }
  927. X    /*NOTREACHED*/
  928. }
  929. X
  930. void XtTblPosition(w, col, row)
  931. Widget w;            /* Widget to position */
  932. Position col, row;        /* Position in array  */
  933. /*
  934. X * This routine positions a widget that has been created
  935. X * under a widget of class tableWidgetClass.  The widget
  936. X * will be placed at column `col' and row `row'.  If
  937. X * the widget has never been placed before,  it will
  938. X * span only one space in each direction and its
  939. X * options will be the defaults for the table widget.
  940. X */
  941. {
  942. X    Position old_row, old_col;
  943. X    Dimension old_hspan, old_vspan;
  944. X    XtTblMask old_opts;
  945. X
  946. X    if (TblFindChild(w, &old_col, &old_row, &old_hspan, &old_vspan, &old_opts)) {
  947. X    TblPositionChild(w, col, row, old_hspan, old_vspan, old_opts);
  948. X    } else {
  949. X    TblPositionChild(w, col, row, 1, 1, TBL_DEF_OPT);
  950. X    }
  951. }
  952. X
  953. void XtTblResize(w, h_span, v_span)
  954. Widget w;            /* Widget to resize            */
  955. Dimension h_span, v_span;    /* New widget span             */
  956. /*
  957. X * This routine changes the span of widget `w' to (`h_span', `v_span').
  958. X * If the widget has never been placed before,  it will be located
  959. X * at (0,0) and its options will be the defaults for its
  960. X * parent table widget.
  961. X */
  962. {
  963. X    Position old_row, old_col;
  964. X    Dimension old_hspan, old_vspan;
  965. X    XtTblMask old_opts;
  966. X
  967. X    if (TblFindChild(w, &old_col, &old_row, &old_hspan, &old_vspan, &old_opts)) {
  968. X    TblPositionChild(w, old_col, old_row, h_span, v_span, old_opts);
  969. X    } else {
  970. X    TblPositionChild(w, 0, 0, h_span, v_span, TBL_DEF_OPT);
  971. X    }
  972. }
  973. X
  974. void XtTblOptions(w, opt)
  975. Widget w;            /* Widget to change */
  976. XXtTblMask opt;            /* New option mask  */
  977. /*
  978. X * This routine changes the options of widget `w' to `opt'.  If
  979. X * the widget has never been placed before,  it will be located
  980. X * and (0,0) with a span of (1,1) and its options will be the
  981. X * default options for its parent table widget.  The option
  982. X * mask is as described for TblPositionChild.
  983. X */
  984. {
  985. X    Position old_row, old_col;
  986. X    Dimension old_hspan, old_vspan;
  987. X    XtTblMask old_opts;
  988. X
  989. X    if (TblFindChild(w, &old_col, &old_row, &old_hspan, &old_vspan, &old_opts)) {
  990. X    TblPositionChild(w, old_col, old_row, old_hspan, old_vspan, opt);
  991. X    } else {
  992. X    TblPositionChild(w, 0, 0, 1, 1, opt);
  993. X    }
  994. }
  995. X
  996. void XtTblConfig(w, col, row, h_span, v_span, opt)
  997. Widget w;            /* Widget to position          */
  998. Position col, row;        /* Position in array           */
  999. Dimension h_span, v_span;    /* Horizonal and vertical span */
  1000. XXtTblMask opt;            /* Widget placement options    */
  1001. /*
  1002. X * This routine positions a widget that has been created
  1003. X * under a widget of class tableWidgetClass.  The widget
  1004. X * will be placed at column `col' and row `row'.  The
  1005. X * widget will span the distances given by `h_span' and `v_span'.
  1006. X * The options argument is as described for TblPositionChild.
  1007. X */
  1008. {
  1009. X    TblPositionChild(w, col, row, h_span, v_span, opt);
  1010. }
  1011. X
  1012. Widget XtCreateTable(parent, name, arglist, argcount)
  1013. Widget parent;
  1014. char * name;
  1015. ArgList arglist;
  1016. Cardinal argcount;
  1017. X
  1018. {
  1019. X   return(XtCreateWidget(name, tableWidgetClass, parent, arglist, argcount));
  1020. }
  1021. X
  1022. X
  1023. SHAR_EOF
  1024. echo 'File Table.c is complete' &&
  1025. chmod 0644 Table.c ||
  1026. echo 'restore of Table.c failed'
  1027. Wc_c="`wc -c < 'Table.c'`"
  1028. test 58120 -eq "$Wc_c" ||
  1029.     echo 'Table.c: original size 58120, current size' "$Wc_c"
  1030. rm -f _shar_wnt_.tmp
  1031. fi
  1032. # ============= Table.h ==============
  1033. if test -f 'Table.h' -a X"$1" != X"-c"; then
  1034.     echo 'x - skipping Table.h (File already exists)'
  1035.     rm -f _shar_wnt_.tmp
  1036. else
  1037. > _shar_wnt_.tmp
  1038. echo 'x - extracting Table.h (Text)'
  1039. sed 's/^X//' << 'SHAR_EOF' > 'Table.h' &&
  1040. /*
  1041. X * Table - Forms-based composite widget/geometry manager for the X Toolkit
  1042. X *
  1043. X * David Harrison
  1044. X * University of California, Berkeley
  1045. X * 1989
  1046. X *
  1047. X * This file contains the Table public declarations.
  1048. X */
  1049. X
  1050. /*  -- The following defines external storage class for data DEFINITION and
  1051. X    -- REFERENCE. The VAX LINKER strictly demands clear distinction between
  1052. X    -- data definition for external reference, and reference to external data. 
  1053. */
  1054. #ifdef VAX
  1055. #define EXTERNDEF globaldef
  1056. #define EXTERNREF globalref
  1057. #else
  1058. #define EXTERNDEF
  1059. #define EXTERNREF extern
  1060. #endif
  1061. X
  1062. #ifndef _Table_h
  1063. #define _Table_h
  1064. X
  1065. #include <Xm/Xm.h>
  1066. /*
  1067. X * Table Widget Parameters
  1068. X *
  1069. X * Name            Class        RepType        Default Value
  1070. X *
  1071. X * background        Background    Pixel        XtDefaultBackground
  1072. X * border        BorderColor    Pixel        XtDefaultForeground
  1073. X * borderWidth        BorderWidth    Dimension    0
  1074. X * x            Position    Position    0
  1075. X * y            Position    Position    0
  1076. X * width        Width        Dimension    (computed)
  1077. X * height        Height        Dimension    (computed)
  1078. X * mappedWhenManaged    MappedWhenManaged Boolean    True
  1079. X * sensitive        Sensitive    Boolean        True
  1080. X * layout        Layout        String        NULL
  1081. X * internalHeight    Height        Dimension    0
  1082. X * internalWidth    Width        Dimension    0
  1083. X * columnSpacing    Spacing        Dimension    0
  1084. X * rowSpacing        Spacing        Dimension    0
  1085. X */
  1086. X
  1087. #define XtNlayout        "layout"
  1088. #define XtNcolumnSpacing        "columnSpacing"
  1089. #define XtNrowSpacing           "rowSpacing"
  1090. #define XtNdefaultOptions    "defaultOptions"
  1091. X
  1092. #define XtCLayout        "Layout"
  1093. #ifndef XtCSpacing
  1094. #define XtCSpacing        "Spacing"
  1095. #endif
  1096. #define XtCOptions        "Options"
  1097. X
  1098. #define XtROptions        "Options"
  1099. X
  1100. /*
  1101. X * Option masks
  1102. X */
  1103. #define TBL_LEFT    (1<<0)
  1104. #define TBL_RIGHT    (1<<1)
  1105. #define TBL_TOP        (1<<2)
  1106. #define TBL_BOTTOM    (1<<3)
  1107. #define TBL_SM_WIDTH    (1<<4)
  1108. #define TBL_SM_HEIGHT    (1<<5)    
  1109. #define TBL_LK_WIDTH    (1<<6)
  1110. #define TBL_LK_HEIGHT    (1<<7)
  1111. X
  1112. #define TBL_DEF_OPT    -1
  1113. X
  1114. typedef int XtTblMask;
  1115. X
  1116. /*
  1117. X * Opaque class and instance records
  1118. X */
  1119. X
  1120. typedef struct _TableClassRec    *TableWidgetClass;
  1121. typedef struct _TableRec    *TableWidget;
  1122. X
  1123. #ifndef _Table_c
  1124. EXTERNREF WidgetClass tableWidgetClass;
  1125. #endif
  1126. X
  1127. /*
  1128. X * Public access routines
  1129. X */
  1130. X
  1131. extern caddr_t XtTblParseLayout();
  1132. X  /* String layout; */
  1133. X
  1134. extern void XtTblPosition();
  1135. X  /* 
  1136. X   * Widget w;
  1137. X   * Position col, row;
  1138. X   */
  1139. X
  1140. extern void XtTblResize();
  1141. X  /*
  1142. X   * Widget w;
  1143. X   * Dimension h_span, v_span;
  1144. X   */
  1145. X
  1146. extern void XtTblOptions();
  1147. X  /*
  1148. X   * Widget w;
  1149. X   * XtTblMask opt;
  1150. X   */
  1151. X
  1152. extern void XtTblConfig();
  1153. X  /* 
  1154. X   * Widget w;
  1155. X   * Position col, row;
  1156. X   * Dimension h_span, v_span;
  1157. X   * XtTblMask opt;
  1158. X   */
  1159. X
  1160. extern Widget XtCreateTable();
  1161. /*
  1162. Widget parent;
  1163. char * name;
  1164. ArgList arglist;
  1165. Cardinal argcount;
  1166. */
  1167. #endif /* _Table_h */
  1168. X
  1169. SHAR_EOF
  1170. chmod 0644 Table.h ||
  1171. echo 'restore of Table.h failed'
  1172. Wc_c="`wc -c < 'Table.h'`"
  1173. test 2633 -eq "$Wc_c" ||
  1174.     echo 'Table.h: original size 2633, current size' "$Wc_c"
  1175. rm -f _shar_wnt_.tmp
  1176. fi
  1177. # ============= TableP.h ==============
  1178. if test -f 'TableP.h' -a X"$1" != X"-c"; then
  1179.     echo 'x - skipping TableP.h (File already exists)'
  1180.     rm -f _shar_wnt_.tmp
  1181. else
  1182. > _shar_wnt_.tmp
  1183. echo 'x - extracting TableP.h (Text)'
  1184. sed 's/^X//' << 'SHAR_EOF' > 'TableP.h' &&
  1185. /*
  1186. X * Table - Forms-based composite widget/geometry manager for the X Toolkit
  1187. X *
  1188. X * David Harrison
  1189. X * University of California, Berkeley
  1190. X * 1989
  1191. X *
  1192. X * This file contains the Table private declarations.
  1193. X */
  1194. X
  1195. #ifndef _TableP_h
  1196. #define _TableP_h
  1197. X
  1198. #include "Table.h"
  1199. #include <Xm/XmP.h>
  1200. #include <Xm/BulletinBP.h>
  1201. X
  1202. /*
  1203. X * Local definitions
  1204. X */
  1205. X
  1206. typedef void (*XtTblRProc)();
  1207. X  /*
  1208. X   * Widget table;
  1209. X   * Widget subwidget;
  1210. X   * Position r, c;
  1211. X   * Dimension hspan, vspan;
  1212. X   * XtTblMask options;
  1213. X   */
  1214. X
  1215. typedef Boolean (*XtTblLProc)();
  1216. X   /*
  1217. X    * Widget w;
  1218. X    * Position *r, *c;
  1219. X    * Dimension *hspan, *vspan;
  1220. X    * XtTblMask *options;
  1221. X    */
  1222. X
  1223. typedef struct _TableLocTbl *TableLocTblPtr;
  1224. X   /*
  1225. X    * Opaque reference to actual widget location table
  1226. X    * defined in Table.c
  1227. X    */
  1228. X
  1229. typedef struct _TableDefLoc *TableDefLocPtr;
  1230. X   /*
  1231. X    * Opaque reference to default widget location table defined
  1232. X    * in Table.c.
  1233. X    */    
  1234. X
  1235. typedef struct _TableVector *TableVecPtr;
  1236. X   /*
  1237. X    * Opaque reference to vectors used for giving size of
  1238. X    * each row and column.
  1239. X    */
  1240. X
  1241. typedef enum _TableVecState { INVALID, MINIMUM } TableVecState;
  1242. X
  1243. /*
  1244. X * Information kept in class record
  1245. X */
  1246. X
  1247. typedef struct {
  1248. X    XtTblRProc position_child;    /* Register location of some child widget  */
  1249. X    XtTblLProc find_child;    /* Return information about a child widget */
  1250. } TableClassPart;
  1251. X
  1252. /*
  1253. X * Class hierarchy
  1254. X */
  1255. X
  1256. typedef struct _TableClassRec {
  1257. X    CoreClassPart    core_class;
  1258. X    CompositeClassPart    composite_class;
  1259. X    ConstraintClassPart    constraint_class;
  1260. X    XmManagerClassPart    manager_class;
  1261. X    XmBulletinBoardClassPart bulletin_class;
  1262. X    TableClassPart    table_class;
  1263. } TableClassRec;
  1264. X
  1265. #ifndef _Table_c
  1266. EXTERNREF TableClassRec tableClassRec;
  1267. #endif
  1268. X
  1269. /*
  1270. X * Information in instance record
  1271. X */
  1272. X
  1273. typedef struct _TablePart {
  1274. X    Dimension        int_width;   /* Inner horizontal padding          */
  1275. X    Dimension        int_height;  /* Inner vertical padding            */
  1276. X    Dimension        row_spacing; /* Space between rows                */
  1277. X    Dimension        col_spacing; /* Space between columns             */
  1278. X    XtTblMask        def_options; /* Default layout options            */
  1279. X    TableDefLocPtr    init_layout; /* Initial layout spec from resource */
  1280. X    TableDefLocPtr    layout_db;   /* Merged table                      */
  1281. X    TableLocTblPtr    real_layout; /* Actual current layout information */
  1282. X    TableVecState    vec_state;   /* Current state of vectors          */
  1283. X    Cardinal        num_rows;    /* Number of rows                    */
  1284. X    TableVecPtr        rows;         /* Heights of each row               */
  1285. X    Cardinal        num_cols;    /* Number of columns                 */
  1286. X    TableVecPtr        cols;         /* Widths of each column             */
  1287. X    Cardinal        vec_height;  /* Sum of current rows               */
  1288. X    Cardinal        vec_width;   /* Sum of current columns            */
  1289. } TablePart;
  1290. X
  1291. /*
  1292. X * Instance hierarchy
  1293. X */
  1294. X
  1295. typedef struct _TableRec {
  1296. X    CorePart        core;
  1297. X    CompositePart    composite;
  1298. X    ConstraintPart        constraint;
  1299. X    XmManagerPart        manager;
  1300. X    XmBulletinBoardPart    bulletin_board;
  1301. X    TablePart        table;
  1302. } TableRec;
  1303. X
  1304. #endif /* _TableP_h */
  1305. SHAR_EOF
  1306. chmod 0644 TableP.h ||
  1307. echo 'restore of TableP.h failed'
  1308. Wc_c="`wc -c < 'TableP.h'`"
  1309. test 3108 -eq "$Wc_c" ||
  1310.     echo 'TableP.h: original size 3108, current size' "$Wc_c"
  1311. rm -f _shar_wnt_.tmp
  1312. fi
  1313. # ============= Warning.c ==============
  1314. if test -f 'Warning.c' -a X"$1" != X"-c"; then
  1315.     echo 'x - skipping Warning.c (File already exists)'
  1316.     rm -f _shar_wnt_.tmp
  1317. else
  1318. > _shar_wnt_.tmp
  1319. echo 'x - extracting Warning.c (Text)'
  1320. sed 's/^X//' << 'SHAR_EOF' > 'Warning.c' &&
  1321. #include <stdio.h>
  1322. #include <Xm/MessageB.h>
  1323. X
  1324. Warning (reference, message)
  1325. Widget    reference;
  1326. char    *message;
  1327. /*
  1328. X * post an error message
  1329. X */
  1330. {
  1331. X  Widget        mbox;
  1332. X  Widget        button;
  1333. X  Arg           args[10];
  1334. X  int           n;
  1335. X  XmString      msg_string;
  1336. X
  1337. X  msg_string = XmStringLtoRCreate (message, XmSTRING_DEFAULT_CHARSET);
  1338. X
  1339. X  n=0;
  1340. X  XtSetArg (args[n], XmNmessageString, msg_string); n++;
  1341. X  XtSetArg (args[n], XmNdefaultPosition, True); n++;
  1342. X  XtSetArg (args[n], XmNdialogStyle, XmDIALOG_APPLICATION_MODAL); n++;
  1343. X  XtSetArg (args[n], XmNtitle, XmStringCreateLtoR ("WARNING!",XmSTRING_DEFAULT_CHARSET)); n++;
  1344. X  mbox = XmCreateWarningDialog (reference,
  1345. X                              "WarningDialog",
  1346. X                              args,n);
  1347. X  button = XmMessageBoxGetChild (mbox, XmDIALOG_CANCEL_BUTTON);
  1348. X  XtUnmanageChild (button);
  1349. X  button = XmMessageBoxGetChild (mbox, XmDIALOG_HELP_BUTTON);
  1350. X  XtUnmanageChild (button);
  1351. X
  1352. X  /*
  1353. X   * bring it up
  1354. X   */
  1355. X  XtManageChild (mbox);
  1356. }
  1357. X
  1358. SHAR_EOF
  1359. chmod 0644 Warning.c ||
  1360. echo 'restore of Warning.c failed'
  1361. Wc_c="`wc -c < 'Warning.c'`"
  1362. test 983 -eq "$Wc_c" ||
  1363.     echo 'Warning.c: original size 983, current size' "$Wc_c"
  1364. rm -f _shar_wnt_.tmp
  1365. fi
  1366. # ============= WidgetNames.c ==============
  1367. if test -f 'WidgetNames.c' -a X"$1" != X"-c"; then
  1368.     echo 'x - skipping WidgetNames.c (File already exists)'
  1369.     rm -f _shar_wnt_.tmp
  1370. else
  1371. > _shar_wnt_.tmp
  1372. echo 'x - extracting WidgetNames.c (Text)'
  1373. sed 's/^X//' << 'SHAR_EOF' > 'WidgetNames.c' &&
  1374. /***************************************************************************
  1375. X *
  1376. X * FILE NAME        : WidgetNames.c
  1377. X *
  1378. X * AUTHOR        : Andrew Peebles
  1379. X *
  1380. X * DESCRIPTION        : Given a widget, list the resource name hierarcy
  1381. X *
  1382. X * VERSIONS        : %W%
  1383. X *
  1384. X ***************************************************************************/
  1385. X
  1386. /*
  1387. X * standard includes
  1388. X */
  1389. #include <stdio.h>
  1390. #include <X11/Xlib.h
  1391. #include <X11/StringDefs.h>
  1392. #include <X11/Intrinsic.h>
  1393. #include <X11/IntrinsicP.h>
  1394. #include <X11/Core.h>
  1395. #include <X11/CoreP.h>
  1396. #include <X11/Composite.h>
  1397. #include <X11/CompositeP.h>
  1398. X
  1399. static  int    widget_index = 0;
  1400. X
  1401. #include <Xm/Xm.h>
  1402. X
  1403. ListWidgetNames (top)
  1404. Widget  top;
  1405. {
  1406. X  WidgetClassRec *ws;
  1407. X  int i;
  1408. X  CompositeWidget cw = (CompositeWidget) top;
  1409. X  char    *name, *class;
  1410. X  XmGadget gd;
  1411. X
  1412. X  gd = (XmGadget) top;
  1413. X
  1414. X  for (i=0; i<widget_index; i++) printf ("   ");
  1415. X  ws = top->core.widget_class;
  1416. X
  1417. X  name = XrmNameToString(top->core.xrm_name);
  1418. X
  1419. X  if (!ws->core_class.class_name)
  1420. X    class = "nil";
  1421. X  else
  1422. X    class = ws->core_class.class_name;
  1423. X
  1424. X  printf ("%s: \t%s\n",name, class);
  1425. X
  1426. X  if (XtIsSubclass(top, xmGadgetClass)) 
  1427. X    return (0); 
  1428. X
  1429. X  if (top->core.num_popups > 0) {
  1430. X    ++widget_index;
  1431. X    for (i=0; i<top->core.num_popups; i++)
  1432. X      ListWidgetNames(top->core.popup_list[i]);
  1433. X    --widget_index;
  1434. X  }
  1435. X
  1436. X  if (XtIsComposite(top)) {
  1437. X    if (cw->composite.num_children > 0) {
  1438. X      ++widget_index;
  1439. X      for (i=0; i<cw->composite.num_children; i++)
  1440. X    ListWidgetNames(cw->composite.children[i]);
  1441. X      --widget_index;
  1442. X    }
  1443. X  }
  1444. X
  1445. }
  1446. X
  1447. X
  1448. SHAR_EOF
  1449. chmod 0644 WidgetNames.c ||
  1450. echo 'restore of WidgetNames.c failed'
  1451. Wc_c="`wc -c < 'WidgetNames.c'`"
  1452. test 1513 -eq "$Wc_c" ||
  1453.     echo 'WidgetNames.c: original size 1513, current size' "$Wc_c"
  1454. rm -f _shar_wnt_.tmp
  1455. fi
  1456. # ============= XParty ==============
  1457. if test -f 'XParty' -a X"$1" != X"-c"; then
  1458.     echo 'x - skipping XParty (File already exists)'
  1459.     rm -f _shar_wnt_.tmp
  1460. else
  1461. > _shar_wnt_.tmp
  1462. echo 'x - extracting XParty (Text)'
  1463. sed 's/^X//' << 'SHAR_EOF' > 'XParty' &&
  1464. !
  1465. ! X resources for xparty
  1466. ! Author: Andrew Peebles
  1467. !
  1468. X
  1469. xparty.tokenKey:        <Key>F3: PassToken()
  1470. X
  1471. xparty*vpane.spacing:        20
  1472. X
  1473. xparty*rc.orientation:           VERTICAL
  1474. xparty*rc.numColumns:            3
  1475. xparty*rc.packing:               PACK_COLUMN
  1476. X
  1477. xparty*horizontalSpacing:        5
  1478. xparty*verticalSpacing:          5
  1479. X
  1480. xparty*rows:            15
  1481. xparty*columns:            40
  1482. X
  1483. !!
  1484. !! Canned responses to one-way messages.
  1485. !! These are YOUR responses when people send YOU one-way messages.
  1486. !! Other people might define thier own responses and you'll get
  1487. !! one of those when they reply to your messages.
  1488. !!
  1489. X
  1490. xparty.response:    yes\n\
  1491. you bet\n\
  1492. otay\n\
  1493. cool\n\
  1494. Jambo dude!\n\
  1495. ?????????\n\
  1496. What?\n\
  1497. no\n\
  1498. no way dude!\n\
  1499. get back to ya ...\n\
  1500. you kidding?\n\
  1501. later\n\
  1502. you and what army?\n\
  1503. Excellent!\n\
  1504. Bogus dude\n\
  1505. yo momma\n\
  1506. /dev/null\n\
  1507. that's tight.\n\
  1508. you're blowin it man.\n\
  1509. Be right over ...\n\
  1510. Come on over!
  1511. X
  1512. !!
  1513. !! Colors and Fonts
  1514. !!
  1515. X
  1516. xparty*fontList:        9x15
  1517. X
  1518. xparty*Recipients.fontList:      -adobe-helvetica-bold-r-normal--25-*
  1519. xparty*Message.fontList:         -adobe-helvetica-bold-r-normal--25-*
  1520. X
  1521. xparty*WarningDialog*background:              #9c2361
  1522. xparty*WarningDialog*foreground:              White
  1523. X
  1524. xparty*status.fontList:        -adobe-helvetica-bold-r-normal--25-*
  1525. xparty*speaking.fontList:    -adobe-helvetica-bold-r-normal--25-*
  1526. xparty*message_form*fontList:    -adobe-helvetica-bold-r-normal--25-*
  1527. X
  1528. xparty*vpane*sash.background:   Gold
  1529. X
  1530. xparty*background:        LightSteelBlue
  1531. xparty*foreground:        black
  1532. X
  1533. xparty*status.foreground:    #9c2361
  1534. xparty*speaking.foreground:    #9c2361
  1535. X
  1536. xparty*message_form*message_label*foreground:    #9c2361
  1537. xparty*message_form*operator_label*foreground:    #9c2361
  1538. X
  1539. xparty*Quit.foreground:            Red
  1540. SHAR_EOF
  1541. chmod 0644 XParty ||
  1542. echo 'restore of XParty failed'
  1543. Wc_c="`wc -c < 'XParty'`"
  1544. test 1677 -eq "$Wc_c" ||
  1545.     echo 'XParty: original size 1677, current size' "$Wc_c"
  1546. rm -f _shar_wnt_.tmp
  1547. fi
  1548. # ============= image.h ==============
  1549. if test -f 'image.h' -a X"$1" != X"-c"; then
  1550.     echo 'x - skipping image.h (File already exists)'
  1551.     rm -f _shar_wnt_.tmp
  1552. else
  1553. > _shar_wnt_.tmp
  1554. echo 'x - extracting image.h (Text)'
  1555. sed 's/^X//' << 'SHAR_EOF' > 'image.h' &&
  1556. #define errorWidth  20
  1557. #define errorHeight 20
  1558. static char errorBits[] = {
  1559. X   0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0xf0, 0x3a, 0x00, 0x58, 0x55, 0x00,
  1560. X   0x2c, 0xa0, 0x00, 0x56, 0x40, 0x01, 0xaa, 0x80, 0x02, 0x46, 0x81, 0x01,
  1561. X   0x8a, 0x82, 0x02, 0x06, 0x85, 0x01, 0x0a, 0x8a, 0x02, 0x06, 0x94, 0x01,
  1562. X   0x0a, 0xe8, 0x02, 0x14, 0x50, 0x01, 0x28, 0xb0, 0x00, 0xd0, 0x5f, 0x00,
  1563. X   0xa0, 0x2a, 0x00, 0x40, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  1564. X
  1565. #define infoWidth  11 
  1566. #define infoHeight 24
  1567. static char infoBits[] = {
  1568. X   0x00, 0x00, 0x78, 0x00, 0x54, 0x00, 0x2c, 0x00, 0x54, 0x00, 0x28, 0x00,
  1569. X   0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x2a, 0x00, 0x5c, 0x00, 0x28, 0x00,
  1570. X   0x58, 0x00, 0x28, 0x00, 0x58, 0x00, 0x28, 0x00, 0x58, 0x00, 0x28, 0x00,
  1571. X   0x58, 0x00, 0xae, 0x01, 0x56, 0x01, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00};
  1572. X
  1573. #define questionWidth  13
  1574. #define questionHeight 22
  1575. static char questionBits[] = {
  1576. X   0x00, 0x00, 0xf8, 0x01, 0xac, 0x02, 0x56, 0x05, 0x0a, 0x03, 0x06, 0x05,
  1577. X   0x0a, 0x03, 0x80, 0x05, 0xc0, 0x02, 0x60, 0x01, 0xb0, 0x00, 0x50, 0x00,
  1578. X   0xb0, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x50, 0x00,
  1579. X   0xb0, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00};
  1580. X
  1581. #define warningWidth  9 
  1582. #define warningHeight 22
  1583. static char warningBits[] = {
  1584. X   0x00, 0x00, 0x18, 0x00, 0x2c, 0x00, 0x56, 0x00, 0x2a, 0x00, 0x56, 0x00,
  1585. X   0x2a, 0x00, 0x56, 0x00, 0x2c, 0x00, 0x14, 0x00, 0x2c, 0x00, 0x14, 0x00,
  1586. X   0x2c, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x14, 0x00,
  1587. X   0x2c, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00};
  1588. X
  1589. #define workingWidth  21
  1590. #define workingHeight 23
  1591. static char workingBits[] = {
  1592. X   0x00, 0x00, 0x00, 0xfe, 0xff, 0x0f, 0xaa, 0xaa, 0x0a, 0x44, 0x55, 0x06,
  1593. X   0xcc, 0x2a, 0x02, 0x44, 0x55, 0x06, 0xcc, 0x2a, 0x02, 0x84, 0x15, 0x06,
  1594. X   0x8c, 0x2a, 0x02, 0x04, 0x15, 0x06, 0x0c, 0x0a, 0x02, 0x04, 0x06, 0x06,
  1595. X   0x0c, 0x0b, 0x02, 0x84, 0x15, 0x06, 0xcc, 0x2a, 0x02, 0x44, 0x55, 0x06,
  1596. X   0xcc, 0x2a, 0x02, 0x44, 0x55, 0x06, 0xcc, 0x2a, 0x02, 0x44, 0x55, 0x06,
  1597. X   0xfe, 0xff, 0x0f, 0x56, 0x55, 0x05, 0x00, 0x00, 0x00};
  1598. X
  1599. SHAR_EOF
  1600. chmod 0644 image.h ||
  1601. echo 'restore of image.h failed'
  1602. Wc_c="`wc -c < 'image.h'`"
  1603. test 2058 -eq "$Wc_c" ||
  1604.     echo 'image.h: original size 2058, current size' "$Wc_c"
  1605. rm -f _shar_wnt_.tmp
  1606. fi
  1607. # ============= list.bg ==============
  1608. if test -f 'list.bg' -a X"$1" != X"-c"; then
  1609.     echo 'x - skipping list.bg (File already exists)'
  1610.     rm -f _shar_wnt_.tmp
  1611. else
  1612. > _shar_wnt_.tmp
  1613. echo 'x - extracting list.bg (Text)'
  1614. sed 's/^X//' << 'SHAR_EOF' > 'list.bg' &&
  1615. #define list_width 16
  1616. #define list_height 16
  1617. static char list_bits[] = {
  1618. X   0x11, 0x11, 0xb8, 0xb8, 0x7c, 0x7c, 0x3a, 0x3a, 0x11, 0x11, 0xa3, 0xa3,
  1619. X   0xc7, 0xc7, 0x8b, 0x8b, 0x11, 0x11, 0xb8, 0xb8, 0x7c, 0x7c, 0x3a, 0x3a,
  1620. X   0x11, 0x11, 0xa3, 0xa3, 0xc7, 0xc7, 0x8b, 0x8b};
  1621. SHAR_EOF
  1622. chmod 0644 list.bg ||
  1623. echo 'restore of list.bg failed'
  1624. Wc_c="`wc -c < 'list.bg'`"
  1625. test 275 -eq "$Wc_c" ||
  1626.     echo 'list.bg: original size 275, current size' "$Wc_c"
  1627. rm -f _shar_wnt_.tmp
  1628. fi
  1629. # ============= message.c ==============
  1630. if test -f 'message.c' -a X"$1" != X"-c"; then
  1631.     echo 'x - skipping message.c (File already exists)'
  1632.     rm -f _shar_wnt_.tmp
  1633. else
  1634. > _shar_wnt_.tmp
  1635. echo 'x - extracting message.c (Text)'
  1636. sed 's/^X//' << 'SHAR_EOF' > 'message.c' &&
  1637. /***************************************************************************
  1638. X *
  1639. X * FILE NAME        : message.c
  1640. X *
  1641. X * AUTHOR        : Andrew Peebles
  1642. X *
  1643. X * DESCRIPTION        : The routines for displaying a static message
  1644. X *              on a remote display.  
  1645. X *              
  1646. X *
  1647. X * VERSIONS        : %W%
  1648. X *
  1649. X ***************************************************************************/
  1650. X
  1651. /*
  1652. X * standard includes
  1653. X */
  1654. #include <stdio.h>
  1655. X
  1656. #include <Xm/Form.h>
  1657. #include <Xm/Label.h>
  1658. #include <Xm/PushB.h>
  1659. #include <Xm/Text.h>
  1660. #include <X11/Shell.h>
  1661. #include <Xm/PushBG.h>
  1662. #include <Xm/CascadeBG.h>
  1663. #include <Xm/RowColumn.h>
  1664. X
  1665. #include "xphone.h"
  1666. X
  1667. #define xmstr(str)    XmStringCreateLtoR(str,XmSTRING_DEFAULT_CHARSET)
  1668. X
  1669. #define YES     0
  1670. #define NO    1
  1671. #define OTHER    2
  1672. X
  1673. typedef struct _msg_info {
  1674. X  Widget    shell, context;
  1675. X  char        *name;
  1676. X  Display    *display;
  1677. X  char        *responce;
  1678. } msg_info;
  1679. X
  1680. typedef struct _res {
  1681. X  Boolean    iconic;
  1682. X  char        *response;
  1683. } res, *resPtr;
  1684. extern res defaults;
  1685. static XtResource resource_struct[] = {
  1686. X  {"iconic", "Iconic",
  1687. X     XmRBoolean, sizeof(Boolean),
  1688. X     XtOffset (resPtr,iconic),
  1689. X     XmRString, "False"},
  1690. X  {"response", "Response",
  1691. X     XmRString, sizeof(char *),
  1692. X     XtOffset (resPtr,response),
  1693. X     XmRString, "yes\nno\nget back to you ..."}
  1694. };
  1695. X
  1696. PostMessage (display_name, user_name, message)
  1697. char    *display_name, *user_name, *message;
  1698. {
  1699. X  Arg    args[20];
  1700. X  int    n;
  1701. X  Widget    form, label, ok, top, toplevel, text, yes, no, label2;
  1702. X  Display    *display;
  1703. X  int        ac = 1;
  1704. X  char        *av[1];
  1705. X  Widget    CreateResponseOptions();
  1706. X  XSizeHints    wm_hints;
  1707. X  int        shell_x, shell_y, shell_width, shell_height;
  1708. X  char        title[80];
  1709. X  int        screen;
  1710. X
  1711. X  void        message_popdown();
  1712. X  msg_info    *minfo;
  1713. X
  1714. X  av[0] = "xparty";
  1715. X
  1716. X  display = XtOpenDisplay (xphone,
  1717. X               display_name,
  1718. X               "xparty",
  1719. X               "XParty",
  1720. X               NULL, 0,
  1721. X               &ac, av);
  1722. X  if (!display) {
  1723. X    XpWarning (display_name, "Couldn't open display");
  1724. X    return (False);
  1725. X  }
  1726. X
  1727. X  screen = DefaultScreen (display);
  1728. X
  1729. X  toplevel = XtAppCreateShell ("xparty", "XParty",
  1730. X                   applicationShellWidgetClass,
  1731. X                   display, NULL, 0);
  1732. X
  1733. X  XtGetApplicationResources (toplevel,
  1734. X                             &defaults,
  1735. X                             resource_struct,
  1736. X                             XtNumber(resource_struct),
  1737. X                             NULL,0);
  1738. X
  1739. X  n = 0;
  1740. X  top = XtCreatePopupShell ("xparty",
  1741. X                            topLevelShellWidgetClass,
  1742. X                            toplevel, args, n);
  1743. X
  1744. X  n = 0;
  1745. X  form = XmCreateForm (top,
  1746. X               "message_form",
  1747. SHAR_EOF
  1748. true || echo 'restore of message.c failed'
  1749. fi
  1750. echo 'End of  part 2'
  1751. echo 'File message.c is continued in part 3'
  1752. echo 3 > _shar_seq_.tmp
  1753. exit 0
  1754. -- 
  1755. --
  1756. Molecular Simulations, Inc.            mail: dcmartin@msi.com
  1757. 796 N. Pastoria Avenue                uucp: uunet!dcmartin
  1758. Sunnyvale, California 94086            at&t: 408/522-9236
  1759.