home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume17 / xbae / part09 < prev    next >
Encoding:
Text File  |  1992-03-22  |  50.2 KB  |  1,987 lines

  1. Newsgroups: comp.sources.x
  2. Path: uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!mips!msi!dcmartin
  3. From: Andrew Wason <aw@bae.bellcore.com>
  4. Subject: v17i036: Xbae widgets (MOTIF), Part09/12
  5. Message-ID: <1992Mar23.180157.16280@msi.com>
  6. Originator: dcmartin@fascet
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Organization: Molecular Simulations, Inc.
  9. References: <csx-17i028-xbae@uunet.UU.NET>
  10. Date: Mon, 23 Mar 1992 18:01:57 GMT
  11. Approved: dcmartin@msi.com
  12.  
  13. Submitted-by: Andrew Wason <aw@bae.bellcore.com>
  14. Posting-number: Volume 17, Issue 36
  15. Archive-name: xbae/part09
  16.  
  17. Submitted-by: aw@jello
  18. Archive-name: Xbae/part09
  19.  
  20. ---- Cut Here and feed the following to sh ----
  21. #!/bin/sh
  22. # this is Xbae.shar.09 (part 9 of Xbae)
  23. # do not concatenate these parts, unpack them in order with /bin/sh
  24. # file Xbae/src/Matrix.c continued
  25. #
  26. if test ! -r _shar_seq_.tmp; then
  27.     echo 'Please unpack part 1 first!'
  28.     exit 1
  29. fi
  30. (read Scheck
  31.  if test "$Scheck" != 9; then
  32.     echo Please unpack part "$Scheck" next!
  33.     exit 1
  34.  else
  35.     exit 0
  36.  fi
  37. ) < _shar_seq_.tmp || exit 1
  38. if test ! -f _shar_wnt_.tmp; then
  39.     echo 'x - still skipping Xbae/src/Matrix.c'
  40. else
  41. echo 'x - continuing file Xbae/src/Matrix.c'
  42. sed 's/^X//' << 'SHAR_EOF' >> 'Xbae/src/Matrix.c' &&
  43. X     */
  44. X    (*((XbaeMatrixWidgetClass) XtClass(mw))->matrix_class.cancel_edit)
  45. X    (mw, True);
  46. X
  47. X    /*
  48. X     * Generate expose events on Matrix and Clip to force the
  49. X     * columns to be redrawn.
  50. X     */
  51. X    XClearArea(XtDisplay(mw), XtWindow(mw),
  52. X           0, 0,
  53. X           0 /*Full Width*/, 0 /*Full Height*/,
  54. X           True);
  55. X    XbaeClipRedraw(ClipChild(mw));
  56. }
  57. X
  58. /*
  59. X * Public interface to delete_columns method
  60. X */
  61. void
  62. XXbaeMatrixDeleteColumns(w, position, num_columns)
  63. Widget w;
  64. int position;
  65. int num_columns;
  66. {
  67. X    /*
  68. X     * Make sure w is a Matrix or a subclass
  69. X     */
  70. X    XtCheckSubclass(w, xbaeMatrixWidgetClass, NULL);
  71. X
  72. X    /*
  73. X     * Call the delete_columns method
  74. X     */
  75. X    (*((XbaeMatrixWidgetClass) XtClass(w))->matrix_class.delete_columns)
  76. X    ((XbaeMatrixWidget)w, position, num_columns);
  77. }
  78. X
  79. /*
  80. X * Matrix set_row_colors method
  81. X */
  82. static void
  83. SetRowColors(mw, position, colors, num_colors)
  84. XXbaeMatrixWidget mw;
  85. int position;
  86. Pixel *colors;
  87. int num_colors;
  88. {
  89. X    Rectangle rect;
  90. X    int i, j;
  91. X
  92. X    /*
  93. X     * Do some error checking.
  94. X     */
  95. X    if (num_colors <= 0)
  96. X    return;
  97. X    if (position < 0 || position + num_colors > mw->matrix.rows) {
  98. X    XtAppWarningMsg(XtWidgetToApplicationContext((Widget)mw),
  99. X            "setRowColors", "badPosition", "XbaeMatrix",
  100. X            "XbaeMatrix: Position out of bounds or too many colors in SetRowColors.",
  101. X            NULL, 0);
  102. X    return;
  103. X    }
  104. X
  105. X    /*
  106. X     * If we don't have any colors yet, malloc them, and initialize
  107. X     * unused entries to foreground
  108. X     */
  109. X    if (mw->matrix.colors == NULL) {
  110. X    CreateColors(mw);
  111. X    for (i = 0; i < position; i++)
  112. X        for (j = 0; j < mw->matrix.columns; j++)
  113. X        mw->matrix.colors[i][j] = mw->manager.foreground;
  114. X    for (i = position + num_colors; i < mw->matrix.rows; i++)
  115. X        for (j = 0; j < mw->matrix.columns; j++)
  116. X        mw->matrix.colors[i][j] = mw->manager.foreground;
  117. X    }
  118. X
  119. X    /*
  120. X     * Set each row to the appropriate color
  121. X     */
  122. X    for (i = 0; i < num_colors; i++)
  123. X    for (j = 0; j < mw->matrix.columns; j++)
  124. X        mw->matrix.colors[i + position][j] = colors[i];
  125. X
  126. X    /*
  127. X     * Redraw all the visible non-fixed cells.    We don't need to clear first
  128. X     * since only the color changed.
  129. X     */
  130. X    SETRECT(rect,
  131. X        0, 0,
  132. X        ClipChild(mw)->core.width - 1, ClipChild(mw)->core.height - 1);
  133. X    RedrawCells(mw, &rect);
  134. X
  135. X    /*
  136. X     * Redraw all the visible fixed cells (but not the labels).
  137. X     * We don't need to clear first since only the color changed.
  138. X     */
  139. X    SETRECT(rect,
  140. X        ROW_LABEL_WIDTH(mw), COLUMN_LABEL_HEIGHT(mw),
  141. X        mw->core.width - 1, mw->core.height - 1);
  142. X    RedrawLabelsAndFixed(mw, &rect);
  143. }
  144. X
  145. /*
  146. X * Public interface to set_row_colors method
  147. X */
  148. void
  149. XXbaeMatrixSetRowColors(w, position, colors, num_colors)
  150. Widget w;
  151. int position;
  152. Pixel *colors;
  153. int num_colors;
  154. {
  155. X    /*
  156. X     * Make sure w is a Matrix or a subclass
  157. X     */
  158. X    XtCheckSubclass(w, xbaeMatrixWidgetClass, NULL);
  159. X
  160. X    /*
  161. X     * Call the set_row_colors method
  162. X     */
  163. X    (*((XbaeMatrixWidgetClass) XtClass(w))->matrix_class.set_row_colors)
  164. X    ((XbaeMatrixWidget)w, position, colors, num_colors);
  165. }
  166. X
  167. /*
  168. X * Matrix set_column_colors method
  169. X */
  170. static void
  171. SetColumnColors(mw, position, colors, num_colors)
  172. XXbaeMatrixWidget mw;
  173. int position;
  174. Pixel *colors;
  175. int num_colors;
  176. {
  177. X    Rectangle rect;
  178. X    int i, j;
  179. X
  180. X    /*
  181. X     * Do some error checking.
  182. X     */
  183. X    if (num_colors <= 0)
  184. X    return;
  185. X    if (position < 0 || position + num_colors > mw->matrix.columns) {
  186. X    XtAppWarningMsg(XtWidgetToApplicationContext((Widget)mw),
  187. X            "setColumnColors", "badPosition", "XbaeMatrix",
  188. X            "XbaeMatrix: Position out of bounds or too many colors in SetColumnColors.",
  189. X            NULL, 0);
  190. X    return;
  191. X    }
  192. X
  193. X    /*
  194. X     * If we don't have any colors yet, malloc them, and initialize
  195. X     * unused entries to foreground
  196. X     */
  197. X    if (mw->matrix.colors == NULL) {
  198. X    CreateColors(mw);
  199. X    for (i = 0; i < mw->matrix.rows; i++)
  200. X        for (j = 0; j < position; j++)
  201. X        mw->matrix.colors[i][j] = mw->manager.foreground;
  202. X    for (i = 0; i < mw->matrix.rows; i++)
  203. X        for (j = position + num_colors; j < mw->matrix.columns; j++)
  204. X        mw->matrix.colors[i][j] = mw->manager.foreground;
  205. X    }
  206. X
  207. X    /*
  208. X     * Set each column to the appropriate color
  209. X     */
  210. X    for (i = 0; i < mw->matrix.rows; i++)
  211. X    for (j = 0; j < num_colors; j++)
  212. X        mw->matrix.colors[i][j + position] = colors[j];
  213. X
  214. X    /*
  215. X     * Redraw all the visible non-fixed cells.    We don't need to clear first
  216. X     * since only the color changed.
  217. X     */
  218. X    SETRECT(rect,
  219. X        0, 0,
  220. X        ClipChild(mw)->core.width - 1, ClipChild(mw)->core.height - 1);
  221. X    RedrawCells(mw, &rect);
  222. X
  223. X    /*
  224. X     * Redraw all the visible fixed cells (but not the labels).
  225. X     * We don't need to clear first since only the color changed.
  226. X     */
  227. X    SETRECT(rect,
  228. X        ROW_LABEL_WIDTH(mw), COLUMN_LABEL_HEIGHT(mw),
  229. X        mw->core.width - 1, mw->core.height - 1);
  230. X    RedrawLabelsAndFixed(mw, &rect);
  231. }
  232. X
  233. /*
  234. X * Public interface to set_column_colors method
  235. X */
  236. void
  237. XXbaeMatrixSetColumnColors(w, position, colors, num_colors)
  238. Widget w;
  239. int position;
  240. Pixel *colors;
  241. int num_colors;
  242. {
  243. X    /*
  244. X     * Make sure w is a Matrix or a subclass
  245. X     */
  246. X    XtCheckSubclass(w, xbaeMatrixWidgetClass, NULL);
  247. X
  248. X    /*
  249. X     * Call the set_column_colors method
  250. X     */
  251. X    (*((XbaeMatrixWidgetClass) XtClass(w))->matrix_class.set_column_colors)
  252. X    ((XbaeMatrixWidget)w, position, colors, num_colors);
  253. }
  254. X
  255. /*
  256. X * Matrix set_cell_color method
  257. X */
  258. static void
  259. SetCellColor(mw, row, column, color)
  260. XXbaeMatrixWidget mw;
  261. int row;
  262. int column;
  263. Pixel color;
  264. {
  265. X    int i, j;
  266. X
  267. X    /*
  268. X     * Do some error checking.
  269. X     */
  270. X    if (row >= mw->matrix.rows || row < 0 ||
  271. X    column >= mw->matrix.columns || column < 0) {
  272. X    XtAppWarningMsg(XtWidgetToApplicationContext((Widget)mw),
  273. X            "setCellColor", "badIndex", "XbaeMatrix",
  274. X            "XbaeMatrix: Row or column parameter out of bounds for SetCellColor.",
  275. X            NULL, 0);
  276. X    return;
  277. X    }
  278. X
  279. X    /*
  280. X     * If we don't have any colors yet, malloc them and initialize them
  281. X     */
  282. X    if (mw->matrix.colors == NULL) {
  283. X    CreateColors(mw);
  284. X    for (i = 0; i < mw->matrix.rows; i++)
  285. X        for (j = 0; j < mw->matrix.columns; j++)
  286. X        mw->matrix.colors[i][j] = mw->manager.foreground;
  287. X    }
  288. X
  289. X    /*
  290. X     * Set our cells color
  291. X     */
  292. X    mw->matrix.colors[row][column] = color;
  293. X
  294. X    /*
  295. X     * Redraw the cell if it is visible
  296. X     */
  297. X    if (IsCellVisible(mw, row, column))
  298. X    DrawCell(mw, row, column);
  299. }
  300. X
  301. /*
  302. X * Public interface to set_cell_color method
  303. X */
  304. void
  305. XXbaeMatrixSetCellColor(w, row, column, color)
  306. Widget w;
  307. int row;
  308. int column;
  309. Pixel color;
  310. {
  311. X    /*
  312. X     * Make sure w is a Matrix or a subclass
  313. X     */
  314. X    XtCheckSubclass(w, xbaeMatrixWidgetClass, NULL);
  315. X
  316. X    /*
  317. X     * Call the set_cell_color method
  318. X     */
  319. X    (*((XbaeMatrixWidgetClass) XtClass(w))->matrix_class.set_cell_color)
  320. X    ((XbaeMatrixWidget)w, row, column, color);
  321. }
  322. X
  323. X
  324. /*
  325. X * Action to edit a non-fixed cell.
  326. X */
  327. /* ARGSUSED */
  328. static void
  329. EditCellACT(w, event, params, nparams)
  330. Widget w;
  331. XXEvent *event;
  332. String *params;
  333. Cardinal *nparams;
  334. {
  335. X    XbaeMatrixWidget mw;
  336. X    int row, column;
  337. X    XrmQuark q;
  338. X    static XrmQuark QPointer, QLeft, QRight, QUp, QDown;
  339. X    static Boolean haveQuarks = False;
  340. X
  341. X    /*
  342. X     * Get static quarks for the parms we understand
  343. X     */
  344. X    if (!haveQuarks) {
  345. X    QPointer = XrmStringToQuark("Pointer");
  346. X    QLeft = XrmStringToQuark("Left");
  347. X    QRight = XrmStringToQuark("Right");
  348. X    QUp = XrmStringToQuark("Up");
  349. X    QDown = XrmStringToQuark("Down");
  350. X    haveQuarks = True;
  351. X    }
  352. X
  353. X    /*
  354. X     * Get Matrix widget and make sure it is a Matrix subclass.
  355. X     * w could be Matrix, or the Clip or textField children of Matrix
  356. X     */
  357. X    if (XtIsSubclass(w, xbaeMatrixWidgetClass))
  358. X    mw = (XbaeMatrixWidget) w;
  359. X    else if (XtIsSubclass(XtParent(w), xbaeMatrixWidgetClass))
  360. X    mw = (XbaeMatrixWidget) XtParent(w);
  361. X    else {
  362. X    XtAppWarningMsg(XtWidgetToApplicationContext(w),
  363. X            "editCellACT", "badWidget", "XbaeMatrix",
  364. X            "XbaeMatrix: Bad widget passed to EditCell action",
  365. X            NULL, 0);
  366. X    return;
  367. X    }
  368. X
  369. X    /*
  370. X     * Make sure we have a single parm
  371. X     */
  372. X    if (*nparams != 1) {
  373. X    XtAppWarningMsg(XtWidgetToApplicationContext(w),
  374. X            "editCellACT", "badParms", "XbaeMatrix",
  375. X            "XbaeMatrix: Wrong number of parameters passed to EditCell action, needs 1",
  376. X            NULL, 0);
  377. X    return;
  378. X    }
  379. X
  380. X    /*
  381. X     * Initialize row/column to the current position
  382. X     */
  383. X    row = mw->matrix.current_row;
  384. X    column = mw->matrix.current_column;
  385. X
  386. X    /*
  387. X     * Quarkify the string param
  388. X     */
  389. X    q = XrmStringToQuark(params[0]);
  390. X
  391. X    /*
  392. X     * If we aren't currently editing, then the only kind of traversal that
  393. X     * makes sense is pointer.
  394. X     */
  395. X    if (!XtIsManaged(TextChild(mw)) && q != QPointer)
  396. X    return;
  397. X
  398. X    if (q == QPointer) {
  399. X    int x, y;
  400. X
  401. X    /*
  402. X     * Get the x,y point coordinate relative to the Clip window.
  403. X     * Return if this event did not occur in the Clip subwindow
  404. X     * (since we can only edit non-fixed cells).
  405. X     */
  406. X    switch (event->type) {
  407. X    case ButtonPress:
  408. X    case ButtonRelease:
  409. X        x = event->xbutton.x;
  410. X        y = event->xbutton.y;
  411. X        break;
  412. X    case KeyPress:
  413. X    case KeyRelease:
  414. X        x = event->xkey.x;
  415. X        y = event->xkey.y;
  416. X        break;
  417. X    case MotionNotify:
  418. X        x = event->xmotion.x;
  419. X        y = event->xmotion.y;
  420. X        break;
  421. X    default:
  422. X        return;
  423. X    }
  424. X
  425. X    if (event->xbutton.subwindow == XtWindow(ClipChild(mw))) {
  426. X        x -= FIXED_COLUMN_LABEL_OFFSET(mw);
  427. X        y -=  FIXED_ROW_LABEL_OFFSET(mw);
  428. X    }
  429. X    else if (event->xbutton.window != XtWindow(ClipChild(mw)))
  430. X        return;
  431. X
  432. X    /*
  433. X     * Convert the point to a row,column. If it does not pick a valid
  434. X     * cell, then return.
  435. X     */
  436. X    if (!XYToRowCol(mw, &x, &y, &row, &column, NonFixedCell))
  437. X        return;
  438. X    }
  439. X    else if (q == QRight) {
  440. X    /*
  441. X     * If we are in the lower right corner, stay there.
  442. X     * Otherwise move over a column, if we move off the right edge,
  443. X     * then move down a row and back to the first non-fixed column.
  444. X     */
  445. X    if (mw->matrix.current_row != mw->matrix.rows - 1 ||
  446. X        mw->matrix.current_column != mw->matrix.columns -1) {
  447. X
  448. X        column++;
  449. X
  450. X        if (column >= (int)mw->matrix.columns) {
  451. X        column = mw->matrix.fixed_columns;
  452. X        row++;
  453. X        }
  454. X    }
  455. X    }
  456. X    else if (q == QLeft) {
  457. X    /*
  458. X     * If we are in the upper left corner, stay there.
  459. X     * Otherwise move back a column, if we move before the fixed columns,
  460. X     * then move up a row and over to the last column.
  461. X     */
  462. X    if (mw->matrix.current_row != mw->matrix.fixed_rows ||
  463. X        mw->matrix.current_column !=
  464. X        mw->matrix.fixed_columns) {
  465. X
  466. X        column--;
  467. X
  468. X        if (column < (int)mw->matrix.fixed_columns) {
  469. X        column = mw->matrix.columns - 1;
  470. X        row--;
  471. X        }
  472. X    }
  473. X    }
  474. X    else if (q == QDown) {
  475. X    row++;
  476. X
  477. X    if (row >= (int)mw->matrix.rows)
  478. X        row = mw->matrix.fixed_rows;
  479. X    }
  480. X    else if (q == QUp) {
  481. X    row--;
  482. X
  483. X    if (row < (int)mw->matrix.fixed_rows)
  484. X        row = mw->matrix.rows - 1;
  485. X    }
  486. X
  487. X    /*
  488. X     * Call the traverseCellCallback to allow the application to
  489. X     * perform custom traversal.
  490. X     */
  491. X    if (mw->matrix.traverse_cell_callback) {
  492. X    XbaeMatrixTraverseCellCallbackStruct call_data;
  493. X
  494. X    call_data.reason = XbaeTraverseCellReason;
  495. X    call_data.row = mw->matrix.current_row;
  496. X    call_data.column = mw->matrix.current_column;
  497. X    call_data.next_row = row;
  498. X    call_data.next_column = column;
  499. X    call_data.fixed_rows = mw->matrix.fixed_rows;
  500. X    call_data.fixed_columns = mw->matrix.fixed_columns;
  501. X    call_data.num_rows = mw->matrix.rows;
  502. X    call_data.num_columns = mw->matrix.columns;
  503. X    call_data.param = params[0];
  504. X    call_data.qparam = q;
  505. X
  506. X    XtCallCallbackList((Widget)mw, mw->matrix.traverse_cell_callback,
  507. X               (XtPointer) &call_data);
  508. X
  509. X    row = call_data.next_row;
  510. X    column = call_data.next_column;
  511. X    }
  512. X
  513. X    /*
  514. X     * Attempt to edit the new cell using the edit_cell method.
  515. X     * If we are editing a cell based on pointer position, we always
  516. X     * call edit_cell.    Otherwise, we must be editing a new cell to
  517. X     * call edit_cell.
  518. X     */
  519. X    if (q == QPointer || (row != mw->matrix.current_row ||
  520. X              column != mw->matrix.current_column))
  521. X    (*((XbaeMatrixWidgetClass) XtClass(mw))->matrix_class.edit_cell)
  522. X        (mw, row, column);
  523. X
  524. X    /*
  525. X     * Traverse to the textField
  526. X     */
  527. X    XmProcessTraversal(TextChild(mw), XmTRAVERSE_CURRENT);
  528. }
  529. X
  530. /*
  531. X * Action to unmap the textField and discard any edits made
  532. X */
  533. /* ARGSUSED */
  534. static void
  535. CancelEditACT(w, event, params, nparams)
  536. Widget w;
  537. XXEvent *event;
  538. String *params;
  539. Cardinal *nparams;
  540. {
  541. X    XbaeMatrixWidget mw;
  542. X    Boolean unmap;
  543. X
  544. X    /*
  545. X     * Get Matrix widget and make sure it is a Matrix subclass.
  546. X     * w could be Matrix, or the Clip or textField children of Matrix
  547. X     */
  548. X    if (XtIsSubclass(w, xbaeMatrixWidgetClass))
  549. X    mw = (XbaeMatrixWidget) w;
  550. X    else if (XtIsSubclass(XtParent(w), xbaeMatrixWidgetClass))
  551. X    mw = (XbaeMatrixWidget) XtParent(w);
  552. X    else {
  553. X    XtAppWarningMsg(XtWidgetToApplicationContext(w),
  554. X            "cancelEditACT", "badWidget", "XbaeMatrix",
  555. X            "XbaeMatrix: Bad widget passed to CancelEdit action",
  556. X            NULL, 0);
  557. X    return;
  558. X    }
  559. X
  560. X    /*
  561. X     * Make sure we have a single param
  562. X     */
  563. X    if (*nparams != 1) {
  564. X    XtAppWarningMsg(XtWidgetToApplicationContext(w),
  565. X            "cancelEditACT", "badParms", "XbaeMatrix",
  566. X            "XbaeMatrix: Wrong number of parameters passed to CancelEdit action, needs 1",
  567. X            NULL, 0);
  568. X    return;
  569. X    }
  570. X
  571. X    /*
  572. X     * Validate our param
  573. X     */
  574. X    if (!strcmp(params[0], "True"))
  575. X    unmap = True;
  576. X    else if (!strcmp(params[0], "False"))
  577. X    unmap = False;
  578. X    else {
  579. X    XtAppWarningMsg(XtWidgetToApplicationContext(w),
  580. X            "cancelEditACT", "badParm", "XbaeMatrix",
  581. X            "XbaeMatrix: Invalid parameter passed to CancelEdit action, must be True or False",
  582. X            NULL, 0);
  583. X    return;
  584. X    }
  585. X    /*
  586. X     * Call the cancel_edit method
  587. X     */
  588. X    (*((XbaeMatrixWidgetClass) XtClass(mw))->matrix_class.cancel_edit)
  589. X    (mw, unmap);
  590. }
  591. X
  592. /*
  593. X * Action save any edits made and unmap the textField if params[0] is True
  594. X */
  595. /* ARGSUSED */
  596. static void
  597. CommitEditACT(w, event, params, nparams)
  598. Widget w;
  599. XXEvent *event;
  600. String *params;
  601. Cardinal *nparams;
  602. {
  603. X    XbaeMatrixWidget mw;
  604. X    Boolean unmap;
  605. X
  606. X    /*
  607. X     * Get Matrix widget and make sure it is a Matrix subclass.
  608. X     * w could be Matrix, or the Clip or textField children of Matrix
  609. X     */
  610. X    if (XtIsSubclass(w, xbaeMatrixWidgetClass))
  611. X    mw = (XbaeMatrixWidget) w;
  612. X    else if (XtIsSubclass(XtParent(w), xbaeMatrixWidgetClass))
  613. X    mw = (XbaeMatrixWidget) XtParent(w);
  614. X    else {
  615. X    XtAppWarningMsg(XtWidgetToApplicationContext(w),
  616. X            "commitEditACT", "badWidget", "XbaeMatrix",
  617. X            "XbaeMatrix: Bad widget passed to CommitEdit action",
  618. X            NULL, 0);
  619. X    return;
  620. X    }
  621. X
  622. X    /*
  623. X     * Make sure we have a single param
  624. X     */
  625. X    if (*nparams != 1) {
  626. X    XtAppWarningMsg(XtWidgetToApplicationContext(w),
  627. X            "commitEditACT", "badParms", "XbaeMatrix",
  628. X            "XbaeMatrix: Wrong number of parameters passed to CommitEdit action, needs 1",
  629. X            NULL, 0);
  630. X    return;
  631. X    }
  632. X
  633. X    /*
  634. X     * Validate our param
  635. X     */
  636. X    if (!strcmp(params[0], "True"))
  637. X    unmap = True;
  638. X    else if (!strcmp(params[0], "False"))
  639. X    unmap = False;
  640. X    else {
  641. X    XtAppWarningMsg(XtWidgetToApplicationContext(w),
  642. X            "commitEditACT", "badParm", "XbaeMatrix",
  643. X            "XbaeMatrix: Invalid parameter passed to CommitEdit action, must be True or False",
  644. X            NULL, 0);
  645. X    return;
  646. X    }
  647. X
  648. X    (void)(*((XbaeMatrixWidgetClass) XtClass(mw))->matrix_class.commit_edit)
  649. X    (mw, unmap);
  650. }
  651. X
  652. /*
  653. X * Convert the coordinates in an event to be relative to the Clip
  654. X * window or the Matrix window.  Set the cell to indicate which one.
  655. X * Used by some actions.
  656. X */
  657. /* ARGSUSED */
  658. static Boolean
  659. EventToXY(mw, event, x, y, cell)
  660. XXbaeMatrixWidget mw;
  661. XXEvent *event;
  662. int *x, *y;
  663. CellType *cell;
  664. {
  665. X    switch (event->type) {
  666. X    case ButtonPress:
  667. X    case ButtonRelease:
  668. X    *x = event->xbutton.x;
  669. X    *y = event->xbutton.y;
  670. X    break;
  671. X    case KeyPress:
  672. X    case KeyRelease:
  673. X    *x = event->xkey.x;
  674. X    *y = event->xkey.y;
  675. X    break;
  676. X    case MotionNotify:
  677. X        *x = event->xmotion.x;
  678. X        *y = event->xmotion.y;
  679. X    break;
  680. X    default:
  681. X    return False;
  682. X    }
  683. X
  684. X    if (event->xbutton.subwindow == XtWindow(ClipChild(mw))) {
  685. X    *cell = NonFixedCell;
  686. X    *x -= FIXED_COLUMN_LABEL_OFFSET(mw);
  687. X    *y -= FIXED_ROW_LABEL_OFFSET(mw);
  688. X    }
  689. X    else if (event->xbutton.window == XtWindow(mw))
  690. X    *cell = FixedCell;
  691. X    else if (event->xbutton.window == XtWindow(ClipChild(mw)))
  692. X    *cell = NonFixedCell;
  693. X    else if (event->xbutton.window == XtWindow(TextChild(mw))) {
  694. X    Position tx, ty;
  695. X    *cell = NonFixedCell;
  696. X    XtVaGetValues(TextChild(mw),
  697. X              XmNx, &tx,
  698. X              XmNy, &ty,
  699. X              NULL);
  700. X    *x += tx;
  701. X    *y += ty;
  702. X    }
  703. X    else
  704. X    return False;
  705. X
  706. X    return True;
  707. }
  708. X
  709. /* ARGSUSED */
  710. static void
  711. SelectCellACT(w, event, params, nparams)
  712. Widget w;
  713. XXEvent *event;
  714. String *params;
  715. Cardinal *nparams;
  716. {
  717. X    XbaeMatrixWidget mw;
  718. X    int x, y;
  719. X    int row, column;
  720. X    CellType cell;
  721. X    XbaeMatrixSelectCellCallbackStruct call_data;
  722. X
  723. X    /*
  724. X     * Get Matrix widget and make sure it is a Matrix subclass.
  725. X     * w could be Matrix, or the Clip or textField children of Matrix
  726. X     */
  727. X    if (XtIsSubclass(w, xbaeMatrixWidgetClass))
  728. X    mw = (XbaeMatrixWidget) w;
  729. X    else if (XtIsSubclass(XtParent(w), xbaeMatrixWidgetClass))
  730. X    mw = (XbaeMatrixWidget) XtParent(w);
  731. X    else {
  732. X    XtAppWarningMsg(XtWidgetToApplicationContext(w),
  733. X            "selectCellACT", "badWidget", "XbaeMatrix",
  734. X            "XbaeMatrix: Bad widget passed to SelectCell action",
  735. X            NULL, 0);
  736. X    return;
  737. X    }
  738. X
  739. X    /*
  740. X     * If we don't have a selectCellCallback, then return now
  741. X     */
  742. X    if (!mw->matrix.select_cell_callback)
  743. X    return;
  744. X    
  745. X    if (!EventToXY(mw, event, &x, &y, &cell))
  746. X    return;
  747. X
  748. X    /*
  749. X     * Convert the point to a row,column. If it does not pick a valid
  750. X     * cell, then return.
  751. X     */
  752. X    if (!XYToRowCol(mw, &x, &y, &row, &column, cell))
  753. X    return;
  754. X
  755. X    /*
  756. X     * Call our select_cell callbacks
  757. X     */
  758. X    call_data.reason = XbaeSelectCellReason;
  759. X    call_data.row = row;
  760. X    call_data.column = column;
  761. X    call_data.selected_cells = mw->matrix.selected_cells;
  762. X    call_data.cells = mw->matrix.cells;
  763. X    call_data.num_params = *nparams;
  764. X    call_data.params = params;
  765. X    call_data.event = event;
  766. X
  767. X    XtCallCallbackList((Widget)mw, mw->matrix.select_cell_callback,
  768. X               (XtPointer) &call_data);
  769. }
  770. X
  771. X
  772. /* ARGSUSED */
  773. static void
  774. TraverseNextACT(w, event, params, nparams)
  775. Widget w;
  776. XXEvent *event;
  777. String *params;
  778. Cardinal *nparams;
  779. {
  780. X    XbaeMatrixWidget mw;
  781. X
  782. X    /*
  783. X     * Get Matrix widget and make sure it is a Matrix subclass.
  784. X     * w should be the textField widget.
  785. X     */
  786. X    if (XtIsSubclass(XtParent(w), xbaeMatrixWidgetClass))
  787. X    mw = (XbaeMatrixWidget) XtParent(w);
  788. X    else {
  789. X    XtAppWarningMsg(XtWidgetToApplicationContext(w),
  790. X            "traverseNextACT", "badWidget", "XbaeMatrix",
  791. X            "XbaeMatrix: Bad widget passed to TraverseNext action",
  792. X            NULL, 0);
  793. X    return;
  794. X    }
  795. X
  796. X    /*
  797. X     * Set the traversing direction flag.  XmProcessTraversal may traverse
  798. X     * to the Clip widget. If it does, then we will see this flag in
  799. X     * the Clip focusCallback, TraverseInCB, and we will continue to traverse
  800. X     * on out of the mw.  yuck!
  801. X     */
  802. X    mw->matrix.traversing = XmTRAVERSE_NEXT_TAB_GROUP;
  803. X    XmProcessTraversal(TextChild(mw), XmTRAVERSE_NEXT_TAB_GROUP);
  804. X    mw->matrix.traversing = NOT_TRAVERSING;
  805. }
  806. X
  807. /* ARGSUSED */
  808. static void
  809. TraversePrevACT(w, event, params, nparams)
  810. Widget w;
  811. XXEvent *event;
  812. String *params;
  813. Cardinal *nparams;
  814. {
  815. X    XbaeMatrixWidget mw;
  816. X
  817. X    /*
  818. X     * Get Matrix widget and make sure it is a Matrix subclass.
  819. X     * w should be the textField widget.
  820. X     */
  821. X    if (XtIsSubclass(XtParent(w), xbaeMatrixWidgetClass))
  822. X    mw = (XbaeMatrixWidget) XtParent(w);
  823. X    else {
  824. X    XtAppWarningMsg(XtWidgetToApplicationContext(w),
  825. X            "traversePrevACT", "badWidget", "XbaeMatrix",
  826. X            "XbaeMatrix: Bad widget passed to TraversePrev action",
  827. X            NULL, 0);
  828. X    return;
  829. X    }
  830. X
  831. X    /*
  832. X     * Set the traversing direction flag.  XmProcessTraversal may traverse
  833. X     * to the Clip widget. If it does, then we will see this flag in
  834. X     * the Clip focusCallback, TraverseInCB, and we will continue to traverse
  835. X     * on out of the mw.  yuck!
  836. X     */
  837. X    mw->matrix.traversing = XmTRAVERSE_PREV_TAB_GROUP;
  838. X    XmProcessTraversal(TextChild(mw), XmTRAVERSE_PREV_TAB_GROUP);
  839. X    mw->matrix.traversing = NOT_TRAVERSING;
  840. }
  841. X
  842. /*
  843. X * Convert a comma separated list of strings to a NULL terminated array
  844. X * of substrings.  Handles escaped commas (\,) and escaped escaped commas (\\,)
  845. X * - A comma (,) terminates a string
  846. X * - A backslash-comma (\,) does not terminate a string and is copied as
  847. X *   a comma (,)
  848. X * - A backslash-backslash-comma (\\,) does not terminate a string and is
  849. X *   copied as a backslash-comma (\,)
  850. X */
  851. /* ARGSUSED */
  852. Boolean
  853. CvtStringToStringArray(dpy, args, num_args, from, to, data)
  854. Display *dpy;
  855. XXrmValuePtr args;
  856. Cardinal *num_args;
  857. XXrmValuePtr from, to;
  858. XXtPointer *data;
  859. {
  860. X    static String *array;
  861. X    String start = from->addr;
  862. X
  863. X    if (*num_args != 0)
  864. X    XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
  865. X            "cvtStringToStringArray", "wrongParameters",
  866. X            "XbaeMatrix",
  867. X            "String to StringArray conversion needs no extra arguments",
  868. X            NULL, NULL);
  869. X
  870. X    /*
  871. X     * User didn't provide enough space
  872. X     */
  873. X    if (to->addr != NULL && to->size < sizeof(String *)) {
  874. X    to->size = sizeof(String *);
  875. X    return False;
  876. X    }
  877. X
  878. X    if (start == NULL || *start == '\0')
  879. X    array = NULL;
  880. X    else {
  881. X    char *ch, *next, *a;
  882. X    int i, sub, len, count;
  883. X    
  884. X    /*
  885. X     * Count the substrings
  886. X     */
  887. X    for (ch = start, count = 1; *ch != '\0'; ch++) {
  888. X
  889. X        /*
  890. X         * We hit a backslash
  891. X         */
  892. X        if (*ch == '\\') {
  893. X        /*
  894. X         * Take care of backslash-backslash-comma
  895. X         */
  896. X        if (*(ch+1) == '\\' && *(ch+2) == ',')
  897. X            ch += 2;
  898. X        
  899. X        /*
  900. X         * Take care of backslash-comma
  901. X         */
  902. X        else if (*(ch+1) == ',')
  903. X            ch++;
  904. X        }
  905. X        /*
  906. X         * We hit an unescaped comma
  907. X         */
  908. X        else if (*ch == ',')
  909. X        count++;
  910. X    }
  911. X    
  912. X    /*
  913. X     * Malloc the array, make it one bigger for a terminating NULL entry
  914. X     */
  915. X    array = (String *) XtMalloc((count + 1) * sizeof(String));
  916. X    array[count] = NULL;
  917. X    
  918. X    for (sub = 0; sub < count; sub++) {
  919. X        
  920. X        /*
  921. X         * Skip leading white space
  922. X         */
  923. X        while (isspace((unsigned char)*start))
  924. X        start++;
  925. X        
  926. X        /*
  927. X         * Count the number of chars in this substring.
  928. X         * backslash-comma counts as one and does not terminate.
  929. X         * backslash-backslash-comma counts as two and does not terminate.
  930. X         */
  931. X        for (ch = start, len = 0; *ch != '\0' && *ch != ','; ch++) {
  932. X        /*
  933. X         * We hit a backslash
  934. X         */
  935. X        if (*ch == '\\') {
  936. X            /*
  937. X             * Take care of backslash-backslash-comma
  938. X             */
  939. X            if (*(ch+1) == '\\' && *(ch+2) == ',') {
  940. X            len += 2;
  941. X            ch += 2;
  942. X            }
  943. X            /*
  944. X             * Take care of backslash-comma
  945. X             */
  946. X            else if (*(ch+1) == ',') {
  947. X            len++;
  948. X            ch++;
  949. X            }
  950. X            else
  951. X            len++;
  952. X        }
  953. X        else
  954. X            len++;
  955. X        }
  956. X        
  957. X        /*
  958. X         * Save the beginning of the next substring
  959. X         */
  960. X        next = ch + 1;
  961. X        
  962. X        /*
  963. X         * Back up over trailing white space if we moved at all
  964. X         */
  965. X        if (ch != start)
  966. X        while (isspace((unsigned char)*(--ch)))
  967. X            len--;
  968. X        
  969. X        /*
  970. X         * Malloc a String of the correct size
  971. X         */
  972. X        array[sub] = (String) XtMalloc(len + 1);
  973. X        
  974. X        /*
  975. X         * Copy the substring into our new string.
  976. X         * backslash-comma gets copied as comma.
  977. X         * backslash-backslash-comma gets copied as backslash-comma.
  978. X         */
  979. X        for (i = 0, ch = start, a = array[sub];
  980. X         i < len;
  981. X         i++, ch++) {
  982. X        
  983. X        /*
  984. X         * We hit a backslash
  985. X         */
  986. X        if (*ch == '\\') {
  987. X            /*
  988. X             * Take care of backslash-backslash-comma
  989. X             */
  990. X            if (*(ch+1) == '\\' && *(ch+2) == ',') {
  991. X            *(a++) = '\\';
  992. X            *(a++) = ',';
  993. X            i++;
  994. X            ch += 2;
  995. X            }
  996. X            /*
  997. X             * Take care of backslash-comma
  998. X             */
  999. X            else if (*(ch+1) == ',') {
  1000. X            *(a++) = ',';
  1001. X            ch++;
  1002. X            }
  1003. X            else
  1004. X            *(a++) = *ch;
  1005. X        }
  1006. X        else
  1007. X            *(a++) = *ch;
  1008. X        }
  1009. X        *a = '\0';
  1010. X        
  1011. X        /*
  1012. X         * Point to the beginning of the next string.
  1013. X         */
  1014. X        start = next;
  1015. X    }
  1016. X    }
  1017. X
  1018. X    if (to->addr == NULL)
  1019. X    to->addr = (caddr_t) &array;
  1020. X    else
  1021. X    *(String **) to->addr = array;
  1022. X    to->size = sizeof(String *);
  1023. X
  1024. X    return True;
  1025. }
  1026. X
  1027. /*
  1028. X * Free the string array allocated by the String to StringArray converter
  1029. X */
  1030. /* ARGSUSED */
  1031. void
  1032. StringArrayDestructor(app, to, converter_data, args, num_args)
  1033. XXtAppContext app;
  1034. XXrmValuePtr to;
  1035. XXtPointer converter_data;
  1036. XXrmValuePtr args;
  1037. Cardinal *num_args;
  1038. {
  1039. X    String *array = *(String **) to->addr;
  1040. X    String *entry;
  1041. X
  1042. X    if (array == NULL)
  1043. X    return;
  1044. X
  1045. X    for (entry = array; *entry != NULL; entry++)
  1046. X    XtFree((XtPointer) *entry);
  1047. X
  1048. X    XtFree((XtPointer) array);
  1049. }
  1050. X
  1051. /*
  1052. X * Convert a comma separated list of short ints to array of widths.
  1053. X * The array is terminated with BAD_WIDTH.
  1054. X */
  1055. /* ARGSUSED */
  1056. Boolean
  1057. CvtStringToWidthArray(dpy, args, num_args, from, to, data)
  1058. Display *dpy;
  1059. XXrmValuePtr args;
  1060. Cardinal *num_args;
  1061. XXrmValuePtr from, to;
  1062. XXtPointer *data;
  1063. {
  1064. X    static short *array;
  1065. X    String start = from->addr;
  1066. X    char *ch;
  1067. X    int i, count;
  1068. X
  1069. X    if (*num_args != 0)
  1070. X    XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
  1071. X            "cvtStringToWidthArray", "wrongParameters",
  1072. X            "XbaeMatrix",
  1073. X            "String to WidthArray conversion needs no extra arguments",
  1074. X            NULL, NULL);
  1075. X
  1076. X    /*
  1077. X     * User didn't provide enough space
  1078. X     */
  1079. X    if (to->addr != NULL && to->size < sizeof(short *)) {
  1080. X    to->size = sizeof(short *);
  1081. X    return False;
  1082. X    }
  1083. X
  1084. X    if (start == NULL || *start == '\0')
  1085. X    array = NULL;
  1086. X
  1087. X    else {
  1088. X
  1089. X    /*
  1090. X     * Count the comma separated shorts
  1091. X     */
  1092. X    for (ch = start, count = 1; *ch != '\0'; ch++)
  1093. X        if (*ch == ',')
  1094. X        count++;
  1095. X
  1096. X    /*
  1097. X     * Malloc the array
  1098. X     */
  1099. X    array = (short *) XtMalloc((count + 1) * sizeof(short));
  1100. X    array[count] = BAD_WIDTH;
  1101. X
  1102. X    for (i = 0; i < count; i++) {
  1103. X
  1104. X        array[i] = (short) atoi(start);
  1105. X
  1106. X        /*
  1107. X         * Find the comma at the end of this short
  1108. X         */
  1109. X        /* EMPTY */
  1110. X        for (; *start != '\0' && *start != ','; start++);
  1111. X        start++;
  1112. X    }
  1113. X    }
  1114. X
  1115. X    if (to->addr == NULL)
  1116. X    to->addr = (caddr_t) &array;
  1117. X    else
  1118. X    *(short **) to->addr = array;
  1119. X    to->size = sizeof(short *);
  1120. X
  1121. X    return True;
  1122. }
  1123. X
  1124. /*
  1125. X * Free the width array allocated by the String to WidthArray converter
  1126. X */
  1127. /* ARGSUSED */
  1128. void
  1129. WidthArrayDestructor(app, to, converter_data, args, num_args)
  1130. XXtAppContext app;
  1131. XXrmValuePtr to;
  1132. XXtPointer converter_data;
  1133. XXrmValuePtr args;
  1134. Cardinal *num_args;
  1135. {
  1136. X    short *array = *(short **) to->addr;
  1137. X
  1138. X    XtFree((XtPointer) array);
  1139. }
  1140. X
  1141. /*
  1142. X * Convert a comma separated list of ints to array of max lengths.
  1143. X * The array is terminated with BAD_MAXLENGTH.
  1144. X */
  1145. /* ARGSUSED */
  1146. Boolean
  1147. CvtStringToMaxLengthArray(dpy, args, num_args, from, to, data)
  1148. Display *dpy;
  1149. XXrmValuePtr args;
  1150. Cardinal *num_args;
  1151. XXrmValuePtr from, to;
  1152. XXtPointer *data;
  1153. {
  1154. X    static int *array;
  1155. X    String start = from->addr;
  1156. X    char *ch;
  1157. X    int i, count;
  1158. X
  1159. X    if (*num_args != 0)
  1160. X    XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
  1161. X            "cvtStringToMaxLengthArray", "wrongParameters",
  1162. X            "XbaeMatrix",
  1163. X            "String to MaxLengthArray conversion needs no extra arguments",
  1164. X            NULL, NULL);
  1165. X
  1166. X    /*
  1167. X     * User didn't provide enough space
  1168. X     */
  1169. X    if (to->addr != NULL && to->size < sizeof(int *)) {
  1170. X    to->size = sizeof(int *);
  1171. X    return False;
  1172. X    }
  1173. X
  1174. X    if (start == NULL || *start == '\0')
  1175. X    array = NULL;
  1176. X
  1177. X    else {
  1178. X
  1179. X    /*
  1180. X     * Count the comma separated ints
  1181. X     */
  1182. X    for (ch = start, count = 1; *ch != '\0'; ch++)
  1183. X        if (*ch == ',')
  1184. X        count++;
  1185. X
  1186. X    /*
  1187. X     * Malloc the array
  1188. X     */
  1189. X    array = (int *) XtMalloc((count + 1) * sizeof(int));
  1190. X    array[count] = BAD_MAXLENGTH;
  1191. X
  1192. X    for (i = 0; i < count; i++) {
  1193. X
  1194. X        array[i] = (int) atoi(start);
  1195. X
  1196. X        /*
  1197. X         * Find the comma at the end of this int
  1198. X         */
  1199. X        /* EMPTY */
  1200. X        for (; *start != '\0' && *start != ','; start++);
  1201. X        start++;
  1202. X    }
  1203. X    }
  1204. X
  1205. X    if (to->addr == NULL)
  1206. X    to->addr = (caddr_t) &array;
  1207. X    else
  1208. X    *(int **) to->addr = array;
  1209. X    to->size = sizeof(int *);
  1210. X
  1211. X    return True;
  1212. }
  1213. X
  1214. /*
  1215. X * Free the max length array allocated by the String to
  1216. X * MaxLengthArray converter
  1217. X */
  1218. /* ARGSUSED */
  1219. void
  1220. MaxLengthArrayDestructor(app, to, converter_data, args, num_args)
  1221. XXtAppContext app;
  1222. XXrmValuePtr to;
  1223. XXtPointer converter_data;
  1224. XXrmValuePtr args;
  1225. Cardinal *num_args;
  1226. {
  1227. X    int *array = *(int **) to->addr;
  1228. X
  1229. X    XtFree((XtPointer) array);
  1230. }
  1231. X
  1232. /*
  1233. X * Compare two strings up to length chars, and return True if they are equal.
  1234. X * Handles Xm prefix too. The string test must be lower case.
  1235. X * Used by StringToAlignmentArray converter.
  1236. X */
  1237. static Boolean
  1238. StringsAreEqual(in, test, length)
  1239. String in;
  1240. String test;
  1241. int length;
  1242. {
  1243. X    int i;
  1244. X
  1245. X    if ((in[0] == 'X' || in[0] == 'x') &&
  1246. X    (in[1] == 'M' || in[1] == 'm'))
  1247. X    in +=2;
  1248. X
  1249. X    for (i = 0; i < length; i++) {
  1250. X    char c = *in; 
  1251. X
  1252. X    if (isupper(c))
  1253. X        c = tolower(c);
  1254. X
  1255. X    if (c != test[i])
  1256. X        return False;
  1257. X
  1258. X    in++;
  1259. X    }
  1260. X
  1261. X    /*
  1262. X     * String in may have trailing garbage, but as long as the first
  1263. X     * length chars matched, we return True
  1264. X     */
  1265. X    return True;
  1266. }
  1267. X
  1268. /*
  1269. X * Convert a comma separated list of alignments to array of alignments
  1270. X * (unsigned chars).  The array is terminated by BAD_ALIGNMENT.
  1271. X */
  1272. /* ARGSUSED */
  1273. Boolean
  1274. CvtStringToAlignmentArray(dpy, args, num_args, from, to, data)
  1275. Display *dpy;
  1276. XXrmValuePtr args;
  1277. Cardinal *num_args;
  1278. XXrmValuePtr from, to;
  1279. XXtPointer *data;
  1280. {
  1281. X    static unsigned char *array;
  1282. X    String start = from->addr;
  1283. X    char *ch;
  1284. X    int i, count;
  1285. X
  1286. X    if (*num_args != 0)
  1287. X    XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
  1288. X            "cvtStringToAlignmentArray", "wrongParameters",
  1289. X            "XbaeMatrix",
  1290. X            "String to AlignmentArray conversion needs no extra arguments",
  1291. X            NULL, NULL);
  1292. X
  1293. X    /*
  1294. X     * User didn't provide enough space
  1295. X     */
  1296. X    if (to->addr != NULL && to->size < sizeof(unsigned char *)) {
  1297. X    to->size = sizeof(unsigned char *);
  1298. X    return False;
  1299. X    }
  1300. X
  1301. X    if (start == NULL || *start == '\0')
  1302. X    array = NULL;
  1303. X
  1304. X    else {
  1305. X
  1306. X    /*
  1307. X     * Count the comma separated alignments
  1308. X     */
  1309. X    for (ch = start, count = 1; *ch != '\0'; ch++)
  1310. X        if (*ch == ',')
  1311. X        count++;
  1312. X
  1313. X    /*
  1314. X     * Malloc the array
  1315. X     */
  1316. X    array = (unsigned char *)XtMalloc((count + 1) * sizeof(unsigned char));
  1317. X    array[count] = BAD_ALIGNMENT;
  1318. X
  1319. X    /*
  1320. X     * Compare each substring to the alignment strings.
  1321. X     * If we find a bad one, display a warning and fail.
  1322. X     * We should be able to use XtCallConverter on _XmCvtStringToAlignment,
  1323. X     * but that function is static so we have to duplicate its
  1324. X     * functionality.
  1325. X     */
  1326. X    for (i = 0; i < count; i++) {
  1327. X
  1328. X        /*
  1329. X         * Skip leading white space
  1330. X         */
  1331. X        while (isspace(*start))
  1332. X        start++;
  1333. X
  1334. X        if (StringsAreEqual(start, "alignment_beginning", 19))
  1335. X        array[i] = XmALIGNMENT_BEGINNING;
  1336. X        else if (StringsAreEqual(start, "alignment_center", 16))
  1337. X        array[i] = XmALIGNMENT_CENTER;
  1338. X        else if (StringsAreEqual(start, "alignment_end", 13))
  1339. X        array[i] = XmALIGNMENT_END;
  1340. X        else {
  1341. X        XtDisplayStringConversionWarning(dpy, from->addr,
  1342. X                         XmRAlignmentArray);
  1343. X        return False;
  1344. X        }
  1345. X
  1346. X        /*
  1347. X         * Find the comma at the end of this alignment
  1348. X         */
  1349. X        /* EMPTY */
  1350. X        for (; *start != '\0' && *start != ','; start++);
  1351. X        start++;
  1352. X    }
  1353. X    }
  1354. X
  1355. X    if (to->addr == NULL)
  1356. X    to->addr = (caddr_t) &array;
  1357. X    else
  1358. X    *(unsigned char **) to->addr = array;
  1359. X    to->size = sizeof(unsigned char *);
  1360. X
  1361. X    return True;
  1362. }
  1363. X
  1364. /*
  1365. X * Free the alignment array allocated by the String to AlignmentArray converter
  1366. X */
  1367. /* ARGSUSED */
  1368. void
  1369. AlignmentArrayDestructor(app, to, converter_data, args, num_args)
  1370. XXtAppContext app;
  1371. XXrmValuePtr to;
  1372. XXtPointer converter_data;
  1373. XXrmValuePtr args;
  1374. Cardinal *num_args;
  1375. {
  1376. X    unsigned char *array = *(unsigned char **) to->addr;
  1377. X
  1378. X    XtFree((XtPointer) array);
  1379. }
  1380. X
  1381. X
  1382. /*
  1383. X * ScrollMgr implementation.
  1384. X * When we scroll using XCopyArea, occluding windows will cause GraphicsExpose
  1385. X * events to be generated, if there are no occluding windows then NoExpose
  1386. X * events will be generated. The removal of occluding windows will cause Expose
  1387. X * events.  If a number of scrolls (XCopyAreas) occur in quick succession,
  1388. X * the events will contain obsolete x/y information since our internal
  1389. X * coordinates have been scrolled to a new location.  The ScrollMgr
  1390. X * keeps track of scrolls and offsets required to relocate the events to the
  1391. X * current coordinate system.
  1392. X * 
  1393. X * The Matrix widget has two ScrollMgrs, one for the Matrixs window
  1394. X * and one for the Clip widgets window.
  1395. X *
  1396. X * Each widgets compress_exposures field should be XtExposeCompressSeries
  1397. X * or XtExposeNoCompress.
  1398. X * 
  1399. X * The idea behind this code is based on the PanHandler posted by Chuck Ocheret
  1400. X * (chuck@fid.morgan.com)
  1401. X */
  1402. X
  1403. /*
  1404. X * Create and initialize a ScrollMgr
  1405. X */
  1406. static SmScrollMgr
  1407. SmCreateScrollMgr()
  1408. {
  1409. X    SmScrollMgr scrollMgr = XtNew(SmScrollMgrRec);
  1410. X
  1411. X    scrollMgr->offset_x = 0;
  1412. X    scrollMgr->offset_y = 0;
  1413. X    scrollMgr->scroll_count = 0;
  1414. X    scrollMgr->scroll_queue = NULL;
  1415. X    scrollMgr->scrolling = False;
  1416. X
  1417. X    return scrollMgr;
  1418. }
  1419. X
  1420. /*
  1421. X * Destroy a ScrollMgr, including any queued scrolls
  1422. X */
  1423. static void
  1424. SmDestroyScrollMgr(scrollMgr)
  1425. SmScrollMgr scrollMgr;
  1426. {
  1427. X    if (scrollMgr->scroll_queue) {
  1428. X    SmScrollNode node = scrollMgr->scroll_queue->next;
  1429. X
  1430. X    while (node != scrollMgr->scroll_queue) {
  1431. X        SmScrollNode d = node;
  1432. X        node = node->next;
  1433. X        XtFree((XtPointer)d);
  1434. X    }
  1435. X    XtFree((XtPointer) node);
  1436. X    }
  1437. X
  1438. X    XtFree((XtPointer)scrollMgr);
  1439. }
  1440. X
  1441. /*
  1442. X * Record a new scroll request in the ScrollMgr
  1443. X */
  1444. static void
  1445. SmAddScroll(scrollMgr, delta_x, delta_y)
  1446. SmScrollMgr scrollMgr;
  1447. int delta_x;
  1448. int delta_y;
  1449. {
  1450. X    SmScrollNode node = XtNew(SmScrollNodeRec);
  1451. X
  1452. X    node->x = delta_x;
  1453. X    node->y = delta_y;
  1454. X
  1455. X    scrollMgr->offset_x += delta_x;
  1456. X    scrollMgr->offset_y += delta_y;
  1457. X    scrollMgr->scroll_count++;
  1458. X
  1459. X    /*
  1460. X     * Insert the node at the end of the queue
  1461. X     */
  1462. X    if (!scrollMgr->scroll_queue) {
  1463. X    scrollMgr->scroll_queue = node;
  1464. X    node->next = node;
  1465. X    node->prev = node;
  1466. X    }
  1467. X    else {
  1468. X    SmScrollNode last = scrollMgr->scroll_queue->prev;
  1469. X
  1470. X    last->next = node;
  1471. X    node->next = scrollMgr->scroll_queue;
  1472. X    node->prev = last;
  1473. X    scrollMgr->scroll_queue->prev = node;
  1474. X    }
  1475. }
  1476. X
  1477. /*
  1478. X * Remove a scroll from the ScrollMgr queue
  1479. X */
  1480. static void
  1481. SmRemoveScroll(scrollMgr)
  1482. SmScrollMgr scrollMgr;
  1483. {
  1484. X    if (scrollMgr->scroll_count) {
  1485. X    SmScrollNode node = scrollMgr->scroll_queue;
  1486. X
  1487. X    scrollMgr->offset_x -= node->x;
  1488. X    scrollMgr->offset_y -= node->y;
  1489. X
  1490. X    /*
  1491. X     * Remove node from head of queue
  1492. X     */
  1493. X    if (node->next == node)
  1494. X        scrollMgr->scroll_queue = NULL;
  1495. X    else {
  1496. X        scrollMgr->scroll_queue = node->next;
  1497. X        node->next->prev = node->prev;
  1498. X        node->prev->next = node->next;
  1499. X    }
  1500. X    XtFree((XtPointer)node);
  1501. X
  1502. X    scrollMgr->scroll_count--;
  1503. X    }
  1504. }
  1505. X
  1506. /*
  1507. X * Handle an expose event
  1508. X */
  1509. static void
  1510. SmScrollEvent(scrollMgr, event)
  1511. SmScrollMgr scrollMgr;
  1512. XXEvent *event;
  1513. {
  1514. X    switch (event->type) {
  1515. X
  1516. X    case Expose:
  1517. X
  1518. X    /*
  1519. X     * Normal Expose event, translate it into our scrolled
  1520. X     * coordinate system.
  1521. X     */
  1522. X    event->xexpose.x += scrollMgr->offset_x;
  1523. X    event->xexpose.y += scrollMgr->offset_y;
  1524. X    break;
  1525. X
  1526. X    case GraphicsExpose:
  1527. X
  1528. X    /*
  1529. X     * If we are not scrolling, then this must be the first
  1530. X     * GraphicsExpose event.  Remove the corresponding scroll from the
  1531. X     * queue, and if we have more GraphicsExposes to come, set scrolling
  1532. X     * to True.
  1533. X     */
  1534. X    if (scrollMgr->scrolling == False) {
  1535. X        SmRemoveScroll(scrollMgr);
  1536. X        if (event->xgraphicsexpose.count != 0)
  1537. X        scrollMgr->scrolling = True;
  1538. X    }
  1539. X
  1540. X    /*
  1541. X     * This is the last GraphicsExpose so set scrolling to False.
  1542. X     */
  1543. X    else if (event->xgraphicsexpose.count == 0)
  1544. X        scrollMgr->scrolling = False;
  1545. X
  1546. X    /*
  1547. X     * Translate the event into our scrolled coordinate system.
  1548. X     */
  1549. X    event->xgraphicsexpose.x += scrollMgr->offset_x;
  1550. X    event->xgraphicsexpose.y += scrollMgr->offset_y;
  1551. X    break;
  1552. X
  1553. X    case NoExpose:
  1554. X
  1555. X    /*
  1556. X     * A NoExpose event means we won't be getting any GraphicsExpose
  1557. X     * events, so remove the scroll from the queue and set scrolling
  1558. X     * to False.
  1559. X     */
  1560. X    SmRemoveScroll(scrollMgr);
  1561. X    scrollMgr->scrolling = False;
  1562. X    break;
  1563. X
  1564. X    default:
  1565. X    break;
  1566. X    }
  1567. }
  1568. X
  1569. SHAR_EOF
  1570. echo 'File Xbae/src/Matrix.c is complete' &&
  1571. chmod 0444 Xbae/src/Matrix.c ||
  1572. echo 'restore of Xbae/src/Matrix.c failed'
  1573. Wc_c="`wc -c < 'Xbae/src/Matrix.c'`"
  1574. test 206960 -eq "$Wc_c" ||
  1575.     echo 'Xbae/src/Matrix.c: original size 206960, current size' "$Wc_c"
  1576. rm -f _shar_wnt_.tmp
  1577. fi
  1578. # ============= Xbae/src/version.c ==============
  1579. if test -f 'Xbae/src/version.c' -a X"$1" != X"-c"; then
  1580.     echo 'x - skipping Xbae/src/version.c (File already exists)'
  1581.     rm -f _shar_wnt_.tmp
  1582. else
  1583. > _shar_wnt_.tmp
  1584. echo 'x - extracting Xbae/src/version.c (Text)'
  1585. sed 's/^X//' << 'SHAR_EOF' > 'Xbae/src/version.c' &&
  1586. /*
  1587. X * Copyright(c) 1992 Bell Communications Research, Inc. (Bellcore)
  1588. X *                        All rights reserved
  1589. X * Permission to use, copy, modify and distribute this material for
  1590. X * any purpose and without fee is hereby granted, provided that the
  1591. X * above copyright notice and this permission notice appear in all
  1592. X * copies, and that the name of Bellcore not be used in advertising
  1593. X * or publicity pertaining to this material without the specific,
  1594. X * prior written permission of an authorized representative of
  1595. X * Bellcore.
  1596. X *
  1597. X * BELLCORE MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES, EX-
  1598. X * PRESS OR IMPLIED, WITH RESPECT TO THE SOFTWARE, INCLUDING, BUT
  1599. X * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  1600. X * FITNESS FOR ANY PARTICULAR PURPOSE, AND THE WARRANTY AGAINST IN-
  1601. X * FRINGEMENT OF PATENTS OR OTHER INTELLECTUAL PROPERTY RIGHTS.  THE
  1602. X * SOFTWARE IS PROVIDED "AS IS", AND IN NO EVENT SHALL BELLCORE OR
  1603. X * ANY OF ITS AFFILIATES BE LIABLE FOR ANY DAMAGES, INCLUDING ANY
  1604. X * LOST PROFITS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES RELAT-
  1605. X * ING TO THE SOFTWARE.
  1606. X */
  1607. X
  1608. #ifndef SABER
  1609. static char sccsid[] = "@(#)version.c    3.5 3/13/92";
  1610. #endif
  1611. X
  1612. /*
  1613. X
  1614. X  This file contains version information for a given Xbae release.
  1615. X  The SCCSID of this file should be used as the Xbae release number.
  1616. X
  1617. X  Matrix.h    3.7
  1618. X  MatrixP.h    3.7
  1619. X  Matrix.c    3.12
  1620. X  Clip.h    3.3
  1621. X  ClipP.h    3.3
  1622. X  Clip.c    3.3
  1623. X  Caption.h    1.4
  1624. X  CaptionP.h    1.4
  1625. X  Caption.c    1.7
  1626. X
  1627. */
  1628. SHAR_EOF
  1629. chmod 0444 Xbae/src/version.c ||
  1630. echo 'restore of Xbae/src/version.c failed'
  1631. Wc_c="`wc -c < 'Xbae/src/version.c'`"
  1632. test 1453 -eq "$Wc_c" ||
  1633.     echo 'Xbae/src/version.c: original size 1453, current size' "$Wc_c"
  1634. rm -f _shar_wnt_.tmp
  1635. fi
  1636. # ============= Xbae/src/Caption.h ==============
  1637. if test -f 'Xbae/src/Caption.h' -a X"$1" != X"-c"; then
  1638.     echo 'x - skipping Xbae/src/Caption.h (File already exists)'
  1639.     rm -f _shar_wnt_.tmp
  1640. else
  1641. > _shar_wnt_.tmp
  1642. echo 'x - extracting Xbae/src/Caption.h (Text)'
  1643. sed 's/^X//' << 'SHAR_EOF' > 'Xbae/src/Caption.h' &&
  1644. /*
  1645. X * Copyright(c) 1992 Bell Communications Research, Inc. (Bellcore)
  1646. X *                        All rights reserved
  1647. X * Permission to use, copy, modify and distribute this material for
  1648. X * any purpose and without fee is hereby granted, provided that the
  1649. X * above copyright notice and this permission notice appear in all
  1650. X * copies, and that the name of Bellcore not be used in advertising
  1651. X * or publicity pertaining to this material without the specific,
  1652. X * prior written permission of an authorized representative of
  1653. X * Bellcore.
  1654. X *
  1655. X * BELLCORE MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES, EX-
  1656. X * PRESS OR IMPLIED, WITH RESPECT TO THE SOFTWARE, INCLUDING, BUT
  1657. X * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  1658. X * FITNESS FOR ANY PARTICULAR PURPOSE, AND THE WARRANTY AGAINST IN-
  1659. X * FRINGEMENT OF PATENTS OR OTHER INTELLECTUAL PROPERTY RIGHTS.  THE
  1660. X * SOFTWARE IS PROVIDED "AS IS", AND IN NO EVENT SHALL BELLCORE OR
  1661. X * ANY OF ITS AFFILIATES BE LIABLE FOR ANY DAMAGES, INCLUDING ANY
  1662. X * LOST PROFITS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES RELAT-
  1663. X * ING TO THE SOFTWARE.
  1664. X *
  1665. X * CaptionWidget Author: Andrew Wason, Bellcore, aw@bae.bellcore.com
  1666. X */
  1667. X
  1668. #ifndef _Caption_h
  1669. #define _Caption_h
  1670. X
  1671. /*
  1672. X *  "@(#)Caption.h    1.4 2/18/92"
  1673. X */
  1674. X
  1675. /*
  1676. X * Caption Widget public include file
  1677. X */
  1678. X
  1679. #include <Xm/Xm.h>
  1680. #include <X11/Core.h>
  1681. X
  1682. X
  1683. /* Resources:
  1684. X * Name            Class        RepType        Default Value
  1685. X * ----            -----        -------        -------------
  1686. X * fontList        FontList    FontList    dynamic
  1687. X * labelAlignment    LabelAlignment    LabelAlignment    AlignmentCenter
  1688. X * labelOffset        LabelOffset    int        0
  1689. X * labelPixmap        LabelPixmap    PrimForegroundPixmap
  1690. X *                            XmUNSPECIFIED_PIXMAP
  1691. X * labelPosition    LabelPosition    LabelPosition    PositionLeft
  1692. X * labelString        XmString    XmString    widget name
  1693. X * labelTextAlignment    Alignment    Alignment    XmALIGNMENT_CENTER
  1694. X * labelType        LabelType    LabelType    XmSTRING
  1695. X */
  1696. X
  1697. /*
  1698. X * New resource constants
  1699. X */
  1700. #define XmNlabelPosition "labelPosition"
  1701. #define XmCLabelPosition "LabelPosition"
  1702. #define XmNlabelAlignment "labelAlignment"
  1703. #define XmCLabelAlignment "LabelAlignment"
  1704. #define XmNlabelTextAlignment "labelTextAlignment"
  1705. #define XmNlabelOffset "labelOffset"
  1706. #define XmCLabelOffset "LabelOffset"
  1707. X
  1708. #define XmRLabelPosition "LabelPosition"
  1709. #define XmRLabelAlignment "LabelAlignment"
  1710. X
  1711. /* Class record constants */
  1712. X
  1713. extern WidgetClass xbaeCaptionWidgetClass;
  1714. X
  1715. typedef struct _XbaeCaptionClassRec *XbaeCaptionWidgetClass;
  1716. typedef struct _XbaeCaptionRec *XbaeCaptionWidget;
  1717. X
  1718. /*
  1719. X * Type for XmNlabelPosition resource
  1720. X */
  1721. typedef enum _XbaeLabelPosition {
  1722. X    XbaePositionLeft,
  1723. X    XbaePositionRight,
  1724. X    XbaePositionTop,
  1725. X    XbaePositionBottom
  1726. } XbaeLabelPosition;
  1727. X
  1728. /*
  1729. X * Type for XmNlabelAlignment resource
  1730. X */
  1731. typedef enum _XbaeLabelAlignment {
  1732. X    XbaeAlignmentTopOrLeft,
  1733. X    XbaeAlignmentCenter,
  1734. X    XbaeAlignmentBottomOrRight
  1735. } XbaeLabelAlignment;
  1736. X
  1737. #endif /* _Caption_h */
  1738. /* DON'T ADD STUFF AFTER THIS #endif */
  1739. X
  1740. SHAR_EOF
  1741. chmod 0444 Xbae/src/Caption.h ||
  1742. echo 'restore of Xbae/src/Caption.h failed'
  1743. Wc_c="`wc -c < 'Xbae/src/Caption.h'`"
  1744. test 2904 -eq "$Wc_c" ||
  1745.     echo 'Xbae/src/Caption.h: original size 2904, current size' "$Wc_c"
  1746. rm -f _shar_wnt_.tmp
  1747. fi
  1748. # ============= Xbae/src/CaptionP.h ==============
  1749. if test -f 'Xbae/src/CaptionP.h' -a X"$1" != X"-c"; then
  1750.     echo 'x - skipping Xbae/src/CaptionP.h (File already exists)'
  1751.     rm -f _shar_wnt_.tmp
  1752. else
  1753. > _shar_wnt_.tmp
  1754. echo 'x - extracting Xbae/src/CaptionP.h (Text)'
  1755. sed 's/^X//' << 'SHAR_EOF' > 'Xbae/src/CaptionP.h' &&
  1756. /*
  1757. X * Copyright(c) 1992 Bell Communications Research, Inc. (Bellcore)
  1758. X *                        All rights reserved
  1759. X * Permission to use, copy, modify and distribute this material for
  1760. X * any purpose and without fee is hereby granted, provided that the
  1761. X * above copyright notice and this permission notice appear in all
  1762. X * copies, and that the name of Bellcore not be used in advertising
  1763. X * or publicity pertaining to this material without the specific,
  1764. X * prior written permission of an authorized representative of
  1765. X * Bellcore.
  1766. X *
  1767. X * BELLCORE MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES, EX-
  1768. X * PRESS OR IMPLIED, WITH RESPECT TO THE SOFTWARE, INCLUDING, BUT
  1769. X * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  1770. X * FITNESS FOR ANY PARTICULAR PURPOSE, AND THE WARRANTY AGAINST IN-
  1771. X * FRINGEMENT OF PATENTS OR OTHER INTELLECTUAL PROPERTY RIGHTS.  THE
  1772. X * SOFTWARE IS PROVIDED "AS IS", AND IN NO EVENT SHALL BELLCORE OR
  1773. X * ANY OF ITS AFFILIATES BE LIABLE FOR ANY DAMAGES, INCLUDING ANY
  1774. X * LOST PROFITS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES RELAT-
  1775. X * ING TO THE SOFTWARE.
  1776. X *
  1777. X * CaptionWidget Author: Andrew Wason, Bellcore, aw@bae.bellcore.com
  1778. X */
  1779. X
  1780. /*
  1781. X * CaptionP.h - Private definitions for Caption widget
  1782. X */
  1783. X
  1784. #ifndef _CaptionP_h
  1785. #define _CaptionP_h
  1786. X
  1787. /*
  1788. X *  "@(#)CaptionP.h    1.4 2/18/92"
  1789. X */
  1790. X
  1791. #include <Xm/XmP.h>
  1792. #include <Xbae/Caption.h>
  1793. X
  1794. X
  1795. /*
  1796. X * New fields for the Caption widget class record
  1797. X */
  1798. typedef struct {
  1799. X    XtPointer            extension;
  1800. } XbaeCaptionClassPart;
  1801. X
  1802. /*
  1803. X * Full class record declaration
  1804. X */
  1805. typedef struct _XbaeCaptionClassRec {
  1806. X    CoreClassPart        core_class;
  1807. X    CompositeClassPart        composite_class;
  1808. X    ConstraintClassPart        constraint_class;
  1809. X    XmManagerClassPart        manager_class;
  1810. X    XbaeCaptionClassPart    caption_class;
  1811. } XbaeCaptionClassRec;
  1812. X
  1813. extern XbaeCaptionClassRec xbaeCaptionClassRec;
  1814. X
  1815. /*
  1816. X * New fields for the Caption widget record
  1817. X */
  1818. typedef struct {
  1819. X    /* resources */
  1820. X    XmFontList        font_list;
  1821. X    XbaeLabelAlignment    label_alignment;
  1822. X    int            label_offset;
  1823. X    Pixmap        label_pixmap;
  1824. X    XbaeLabelPosition    label_position;
  1825. X    XmString        label_string;
  1826. X    unsigned char    label_text_alignment;
  1827. X    unsigned char    label_type;
  1828. X
  1829. X    /* private state */
  1830. X
  1831. } XbaeCaptionPart;
  1832. X
  1833. /*
  1834. X * Full instance record declaration
  1835. X */
  1836. typedef struct _XbaeCaptionRec {
  1837. X    CorePart        core;
  1838. X    CompositePart    composite;
  1839. X    ConstraintPart    constraint;
  1840. X    XmManagerPart    manager;
  1841. X    XbaeCaptionPart    caption;
  1842. } XbaeCaptionRec;
  1843. X
  1844. #endif /* _CaptionP_h */
  1845. SHAR_EOF
  1846. chmod 0444 Xbae/src/CaptionP.h ||
  1847. echo 'restore of Xbae/src/CaptionP.h failed'
  1848. Wc_c="`wc -c < 'Xbae/src/CaptionP.h'`"
  1849. test 2477 -eq "$Wc_c" ||
  1850.     echo 'Xbae/src/CaptionP.h: original size 2477, current size' "$Wc_c"
  1851. rm -f _shar_wnt_.tmp
  1852. fi
  1853. # ============= Xbae/src/Clip.h ==============
  1854. if test -f 'Xbae/src/Clip.h' -a X"$1" != X"-c"; then
  1855.     echo 'x - skipping Xbae/src/Clip.h (File already exists)'
  1856.     rm -f _shar_wnt_.tmp
  1857. else
  1858. > _shar_wnt_.tmp
  1859. echo 'x - extracting Xbae/src/Clip.h (Text)'
  1860. sed 's/^X//' << 'SHAR_EOF' > 'Xbae/src/Clip.h' &&
  1861. /*
  1862. X * Copyright(c) 1992 Bell Communications Research, Inc. (Bellcore)
  1863. X *                        All rights reserved
  1864. X * Permission to use, copy, modify and distribute this material for
  1865. X * any purpose and without fee is hereby granted, provided that the
  1866. X * above copyright notice and this permission notice appear in all
  1867. X * copies, and that the name of Bellcore not be used in advertising
  1868. X * or publicity pertaining to this material without the specific,
  1869. X * prior written permission of an authorized representative of
  1870. X * Bellcore.
  1871. X *
  1872. X * BELLCORE MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES, EX-
  1873. X * PRESS OR IMPLIED, WITH RESPECT TO THE SOFTWARE, INCLUDING, BUT
  1874. X * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  1875. X * FITNESS FOR ANY PARTICULAR PURPOSE, AND THE WARRANTY AGAINST IN-
  1876. X * FRINGEMENT OF PATENTS OR OTHER INTELLECTUAL PROPERTY RIGHTS.  THE
  1877. X * SOFTWARE IS PROVIDED "AS IS", AND IN NO EVENT SHALL BELLCORE OR
  1878. X * ANY OF ITS AFFILIATES BE LIABLE FOR ANY DAMAGES, INCLUDING ANY
  1879. X * LOST PROFITS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES RELAT-
  1880. X * ING TO THE SOFTWARE.
  1881. X *
  1882. X * ClipWidget Author: Andrew Wason, Bellcore, aw@bae.bellcore.com
  1883. X */
  1884. X
  1885. /*
  1886. X * Clip.h - Public definitions for Clip widget
  1887. X */
  1888. X
  1889. #ifndef _Clip_h
  1890. #define _Clip_h
  1891. X
  1892. /*
  1893. X *  "@(#)Clip.h    3.3 2/18/92"
  1894. X */
  1895. X
  1896. #include <Xm/Xm.h>
  1897. X
  1898. X
  1899. /* Resources:
  1900. X * Name            Class            RepType        Default Value
  1901. X * ----            -----            -------        -------------
  1902. X * exposeProc        Function        Function    NULL
  1903. X * focusCallback    Callback        Callback    NULL
  1904. X */
  1905. X
  1906. #define XmNexposeProc "exposeProc"
  1907. X
  1908. X
  1909. /* Class record constants */
  1910. X
  1911. extern WidgetClass xbaeClipWidgetClass;
  1912. X
  1913. typedef struct _XbaeClipClassRec *XbaeClipWidgetClass;
  1914. typedef struct _XbaeClipRec *XbaeClipWidget;
  1915. X
  1916. X
  1917. /*
  1918. X * External interfaces to class methods
  1919. X */
  1920. X
  1921. X
  1922. #if defined (__cplusplus) || defined(c_plusplus)
  1923. extern "C" {
  1924. #endif
  1925. X
  1926. extern void XbaeClipRedraw(
  1927. #if NeedFunctionPrototypes
  1928. X               Widget    /* w */
  1929. #endif
  1930. X               );
  1931. X
  1932. #if defined (__cplusplus) || defined(c_plusplus)
  1933. }
  1934. #endif
  1935. X
  1936. #endif /* _Clip_h */
  1937. SHAR_EOF
  1938. chmod 0444 Xbae/src/Clip.h ||
  1939. echo 'restore of Xbae/src/Clip.h failed'
  1940. Wc_c="`wc -c < 'Xbae/src/Clip.h'`"
  1941. test 1996 -eq "$Wc_c" ||
  1942.     echo 'Xbae/src/Clip.h: original size 1996, current size' "$Wc_c"
  1943. rm -f _shar_wnt_.tmp
  1944. fi
  1945. # ============= Xbae/src/ClipP.h ==============
  1946. if test -f 'Xbae/src/ClipP.h' -a X"$1" != X"-c"; then
  1947.     echo 'x - skipping Xbae/src/ClipP.h (File already exists)'
  1948.     rm -f _shar_wnt_.tmp
  1949. else
  1950. > _shar_wnt_.tmp
  1951. echo 'x - extracting Xbae/src/ClipP.h (Text)'
  1952. sed 's/^X//' << 'SHAR_EOF' > 'Xbae/src/ClipP.h' &&
  1953. /*
  1954. X * Copyright(c) 1992 Bell Communications Research, Inc. (Bellcore)
  1955. X *                        All rights reserved
  1956. X * Permission to use, copy, modify and distribute this material for
  1957. X * any purpose and without fee is hereby granted, provided that the
  1958. X * above copyright notice and this permission notice appear in all
  1959. X * copies, and that the name of Bellcore not be used in advertising
  1960. X * or publicity pertaining to this material without the specific,
  1961. X * prior written permission of an authorized representative of
  1962. X * Bellcore.
  1963. X *
  1964. X * BELLCORE MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES, EX-
  1965. X * PRESS OR IMPLIED, WITH RESPECT TO THE SOFTWARE, INCLUDING, BUT
  1966. X * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  1967. X * FITNESS FOR ANY PARTICULAR PURPOSE, AND THE WARRANTY AGAINST IN-
  1968. X * FRINGEMENT OF PATENTS OR OTHER INTELLECTUAL PROPERTY RIGHTS.  THE
  1969. X * SOFTWARE IS PROVIDED "AS IS", AND IN NO EVENT SHALL BELLCORE OR
  1970. X * ANY OF ITS AFFILIATES BE LIABLE FOR ANY DAMAGES, INCLUDING ANY
  1971. X * LOST PROFITS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES RELAT-
  1972. X * ING TO THE SOFTWARE.
  1973. X *
  1974. X * ClipWidget Author: Andrew Wason, Bellcore, aw@bae.bellcore.com
  1975. SHAR_EOF
  1976. true || echo 'restore of Xbae/src/ClipP.h failed'
  1977. fi
  1978. echo 'End of Xbae part 9'
  1979. echo 'File Xbae/src/ClipP.h is continued in part 10'
  1980. echo 10 > _shar_seq_.tmp
  1981. exit 0
  1982. -- 
  1983. --
  1984. Molecular Simulations, Inc.            mail: dcmartin@msi.com
  1985. 796 N. Pastoria Avenue                uucp: uunet!dcmartin
  1986. Sunnyvale, California 94086            at&t: 408/522-9236
  1987.