home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume19 / xfig / part08 < prev    next >
Encoding:
Text File  |  1993-05-26  |  72.7 KB  |  2,149 lines

  1. Newsgroups: comp.sources.x
  2. From: envbvs@epb9.lbl.gov (Brian V. Smith)
  3. Subject: v19i120:  xfig - Draw amd manipulate objects in an X-Window, Part08/27
  4. Message-ID: <1993May21.021345.5484@sparky.imd.sterling.com>
  5. X-Md4-Signature: dc06da6051ded3fa1a8738bc56266f09
  6. Sender: chris@sparky.imd.sterling.com (Chris Olson)
  7. Organization: Sterling Software
  8. Date: Fri, 21 May 1993 02:13:45 GMT
  9. Approved: chris@sparky.imd.sterling.com
  10.  
  11. Submitted-by: envbvs@epb9.lbl.gov (Brian V. Smith)
  12. Posting-number: Volume 19, Issue 120
  13. Archive-name: xfig/part08
  14. Environment: X11
  15. Supersedes: xfig: Volume 16, Issue 6-30,39
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then unpack
  19. # it by saving it into a file and typing "sh file".  To overwrite existing
  20. # files, type "sh file -c".  You can also feed this as standard input via
  21. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  22. # will see the following message at the end:
  23. #        "End of archive 8 (of 27)."
  24. # Contents:  Doc/FORMAT1.4 Doc/FORMAT2.0 Doc/TODO Examples/logic.fig.uu
  25. #   e_arrow.c e_glue.c w_fontpanel.c
  26. # Wrapped by envbvs@epb9.lbl.gov.lbl.gov on Mon May  3 12:05:51 1993
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f 'Doc/FORMAT1.4' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'Doc/FORMAT1.4'\"
  30. else
  31. echo shar: Extracting \"'Doc/FORMAT1.4'\" \(9377 characters\)
  32. sed "s/^X//" >'Doc/FORMAT1.4' <<'END_OF_FILE'
  33. X****** This is the old format 1.4. ******
  34. X
  35. XThe following is the format of fig output (fig 1.4).
  36. X
  37. X(1) The very first line is a comment line containing the name and version:
  38. X    #FIG 1.4
  39. X
  40. X    The character # at the first column of a line indicates that the line
  41. X    is a comment line which will be ignored.
  42. X
  43. X(2) The first non-comment line consists of two numbers :
  44. X
  45. X    int    fig_resolution        (pixels/inch)
  46. X    int    coordinate_system    (1 : origin is at the lower left corner
  47. X                     2 : Upper left)
  48. X
  49. X    Fig_resolution is the resolution fig is using for the current file.
  50. X    It may not be the same as screen resolution (which can be higher or
  51. X    lower).  I assume that a pixel is square, therefore this number
  52. X    represents drawing resolution in both direction.  I've experimented
  53. X    with fig automatically changing this number according to the resolution
  54. X    of the monitor it is running on (The screen resolution, width and height
  55. X    in pixels, not pixel/inch, can be done by doing a ioctl on the /dev/fb).
  56. X    I've found that for monitors with higher resolution but same size
  57. X    (19" diagonal), I preferred using the pixels for other things than
  58. X    having fig occupying most of the screen.  Thus I opted for a fixed
  59. X    pixel-per-inch number which make fig window smaller on higher resolution
  60. X    monitor (than the standard sun monitor).  This however may change in
  61. X    the future version.
  62. X
  63. X(3) The rest of the file contains various objects.  An object can be one
  64. X    of six classes (or types).
  65. X
  66. X      i)    Arc.
  67. X     ii)    Ellipse which is a generalization of circle.
  68. X    iii)    Polyline which includes polygon and box.
  69. X     iv)    Spline which includes closed/open control/interpolated spline.
  70. X      v)    Text.
  71. X     vi)    Compound object which is composed of one or more objects.
  72. X
  73. X    In the following elaboration on object formats, every value of fig
  74. X    output are separated by blank characters or new line ('\n').  The
  75. X    value of the not-used parameters will be -1.
  76. X
  77. X    A number of values are described as unused or not applicable to some
  78. X    object even though they are defined for those objects.  These value
  79. X    will (hopefully) be used in the future version of fig.  The intention
  80. X    of their uses are the following.
  81. X
  82. X    Value            Usage
  83. X    -----            -----
  84. X    area_fill    The stipple pattern (which will be align) for
  85. X            filling object internals.  For example, an filled
  86. X            arc will look like a piece of pie.
  87. X
  88. X    pen        This will be a structure defining the shape of
  89. X            pen used in drawing objects.  It also includes
  90. X            the the stipple pattern for line filling.
  91. X            The default pen is a circular pen with black
  92. X            filling.
  93. X
  94. X    thickness    Every pen has the thickness of one.
  95. X            Thickness scales the size of a pen. 
  96. X
  97. X    depth        This value adds a half dimension to fig.
  98. X            It is useful when we have overlapping filled
  99. X            objects and we want one to obliterate another.
  100. X            An object can have only one depth (including
  101. X            compound object).  An object that is in less
  102. X            depth can obscure the one with greater depth
  103. X            if they overlap.
  104. X    
  105. X    line_style    Only polyline (including polygon and box) can
  106. X            be rendered with dashed line.  However the
  107. X            objects created when the dash-line mode was on
  108. X            will be recorded as such.  Currently the filter
  109. X            f2ps (1) is able to render the desired line style
  110. X            effect on hard copy.  Three line styles are defined.
  111. X
  112. X                0 : SOLID_LINE
  113. X                1 : DASH_LINE
  114. X                2 : DOTTED_LINE
  115. X
  116. X    style_val    For dash style, it is the length of a dash.
  117. X            For dotted line it indicates the approximated
  118. X            gap of consecutive dots. 
  119. X
  120. X    (3.1) ARC
  121. X
  122. X    First line :
  123. X    type    name            (brief description)
  124. X    ----    ----            -------------------
  125. X    int    object_code        (always 5)
  126. X    int    sub_type        (always    1)
  127. X    int    line_style        (See the end of this section)
  128. X    int    line_thickness        (pixels, not used)
  129. X    int    color            (not used)
  130. X    int    depth            (not used)
  131. X    int    pen            (not used)
  132. X    int    area_fill        (not used)
  133. X    float    style_val        (pixels, not used)
  134. X    int    direction        (0 : clockwise, 1 : counterclockwise)
  135. X    int    forward_arrow        (0: no forward arrow, 1: on)
  136. X    int    backward_arrow        (0: no forward arrow, 1: on)
  137. X    float    center_x, center_y    (center of the arc)
  138. X    int    x1, y1            (pixels, the 1st point the user entered)
  139. X    int    x2, y2            (pixels, the 2nd point)
  140. X    int    x3, y3            (pixels, the last point)
  141. X
  142. X    Forward arrow line (Optional; absent if forward_arrow is 0) :
  143. X    type    name            (brief description)
  144. X    ----    ----            -------------------
  145. X    int    arrow_type        (not used)
  146. X    int    arrow_style        (not used)
  147. X    int    arrow_thickness        (not used)
  148. X    int    arrow_width        (pixels)
  149. X    int    arrow_height        (pixels)
  150. X
  151. X    Backward arrow line (Optional; absent if backward_arrow is 0) :
  152. X    type    name            (brief description)
  153. X    ----    ----            -------------------
  154. X    int    arrow_type        (not used)
  155. X    int    arrow_style        (not used)
  156. X    int    arrow_thickness        (not used)
  157. X    int    arrow_width        (pixels)
  158. X    int    arrow_height        (pixels)
  159. X
  160. X    (3.2) COMPOUND
  161. X
  162. X    A line with object code 6 signifies the start of a compound.
  163. X    There are four more numbers on this line which indicate the
  164. X    upper right corner and the lower left corner of the bounding
  165. X    box of this compound.  A line with object code -6 signifies
  166. X    the end of the compound.  Compound may be nested.
  167. X
  168. X    First line :
  169. X    type    name            (brief description)
  170. X    ----    ----            -------------------
  171. X    int    object_code        (always 6)
  172. X    int    upperright_corner_x    (pixels)
  173. X    int    upperright_corner_y    (pixels)
  174. X    int    lowerleft_corner_x    (pixels)
  175. X    int    lowerleft_corner_y    (pixels)
  176. X
  177. X    Subsequent lines :
  178. X    objects
  179. X    .
  180. X    .
  181. X
  182. X    Last line :
  183. X    -6
  184. X
  185. X    (3.3) ELLIPSE
  186. X
  187. X    First line :
  188. X    type    name            (brief description)
  189. X    ----    ----            -------------------
  190. X    int    object_code        (always 1)
  191. X    int    sub_type        (1 : ellipse defined by radiuses
  192. X                     2 : ellipse defined by diameters
  193. X                     3 : circle defined by radius
  194. X                     4 : circle defined by diameter)
  195. X    int    line_style        (See the end of this section)
  196. X    int    thickness        (pixels, not used)
  197. X    int    color            (not used)
  198. X    int    depth            (not used)
  199. X    int    pen            (not used)
  200. X    int    area_fill        (not used)
  201. X    float    style_val        (pixels, not used)
  202. X    int    direction        (always 1)
  203. X    float    angle            (radian, the angle of the x-axis)
  204. X    int    center_x, center_y    (pixels)
  205. X    int    radius_x, radius_y    (pixels)
  206. X    int    start_x, start_y    (pixels; the 1st point entered)
  207. X    int    end_x, end_y        (pixels; the last point entered)
  208. X
  209. X    (3.4) POLYLINE
  210. X
  211. X    First line :
  212. X    type    name            (brief description)
  213. X    ----    ----            -------------------
  214. X    int    object_code        (always 1)
  215. X    int    sub_type        (1 : polyline, 2 : box, 3 : polygon)
  216. X    int    line_style        (See the end of this section)
  217. X    int    thickness        (pixels, not used)
  218. X    int    color            (not used)
  219. X    int    depth            (not used)
  220. X    int    pen            (not used)
  221. X    int    area_fill        (not used)
  222. X    float    style_val        (pixels)
  223. X    int    forward_arrow        (0: off, 1: on)
  224. X    int    backward_arrow        (0: off, 1: on)
  225. X
  226. X    Forward arrow line : same as ARC object
  227. X
  228. X    Backward arrow line : same as ARC object
  229. X
  230. X    Points line :
  231. X    type    name            (brief description)
  232. X    ----    ----            -------------------
  233. X    int    x1, y1            (pixels)
  234. X    int    x2, y2            (pixels)
  235. X      .
  236. X      .
  237. X    int    xn, yn            (this will be the same as the 1st
  238. X                    point for polygon and box)
  239. X    int    x, y            (always 9999, 9999; marks the end of
  240. X                    point for polygon and box)
  241. X
  242. X    (3.5) SPLINE
  243. X
  244. X    First line :
  245. X    type    name            (brief description)
  246. X    ----    ----            -------------------
  247. X    int    object_code        (always 1)
  248. X    int    sub_type        (1 : open spline
  249. X                     2 : closed spline
  250. X                     3 : open interpolated spline
  251. X                     4 : closed interpolated spline)
  252. X    int    line_style        (See the end of this section)
  253. X    int    thickness        (pixels, not used)
  254. X    int    color            (not used)
  255. X    int    depth            (not used)
  256. X    int    pen            (not used)
  257. X    int    area_fill        (not used)
  258. X    float    style_val        (pixels, not used)
  259. X    int    forward_arrow        (0: off, 1: on)
  260. X    int    backward_arrow        (0: off, 1: on)
  261. X
  262. X    Forward arrow line : same as ARC object
  263. X
  264. X    Backward arrow line : same as ARC object
  265. X
  266. X    Points line : same as POLYLINE object
  267. X
  268. X    Control points line (absent if sub_type is 1 or 2) :
  269. X    Control points of interpolated spline.  There are two control
  270. X    points for each knots.  A section i, of the spline is drawn
  271. X    using Bezier cubic with the following four points:
  272. X        (x ,y ), (rx ,ry ), (lx      , ly   ), (x   , y   ).
  273. X          i  i        i    i      i+1    i+1     i+1   i+1
  274. X    For closed interpolated spline the last pair of control points,
  275. X    (lxn,lyn) and (rxn,ryn) (which can be ignored), are the same as
  276. X    (lx1,ly1) and (rx1,ry1) respectively.
  277. X
  278. X    type    name            (brief description)
  279. X    ----    ----            -------------------
  280. X    float    lx1, ly1        (pixels)
  281. X    float    rx1, ry1        (pixels)
  282. X    float    lx2, ly2        (pixels)
  283. X    float    rx2, ry2        (pixels)
  284. X      .
  285. X      .
  286. X    float    lxn, lyn        (pixels)
  287. X    float    rxn, ryn        (pixels)
  288. X
  289. X    (3.6) TEXT
  290. X    type    name            (brief description)
  291. X    ----    ----            -------------------
  292. X    int    object             (always 4)
  293. X    int    sub_type        (0 : Left justified
  294. X                     1 : Center justified
  295. X                     2 : Right justified)
  296. X    int    font             (not used)
  297. X    int    font_size         (not used)
  298. X    int    pen            (not used)
  299. X    int    color            (not used)
  300. X    int    depth            (not used)
  301. X    int    angle            (radian, not used, the angle of the
  302. X                    the base line of the string)
  303. X    int    font_style        (not used)
  304. X    int    height            (pixels)
  305. X    int    length            (pixels)
  306. X    int    x, y            (pixels, coordinate of the origin
  307. X                     of the string.  If sub_type = 0, it is
  308. X                     the lower left corner of the string.
  309. X                     If sub_type = 1, it is the lower
  310. X                     center.  Otherwise it is the lower
  311. X                     right corner of the string.)
  312. X    char    string[]        (ascii characters; starts after a blank
  313. X                    character following the last number and
  314. X                    ends before the character '\1'.  This
  315. X                    character is not part of the string.
  316. X                    Note that the string may contain '\n'.)
  317. END_OF_FILE
  318. if test 9377 -ne `wc -c <'Doc/FORMAT1.4'`; then
  319.     echo shar: \"'Doc/FORMAT1.4'\" unpacked with wrong size!
  320. fi
  321. # end of 'Doc/FORMAT1.4'
  322. fi
  323. if test -f 'Doc/FORMAT2.0' -a "${1}" != "-c" ; then 
  324.   echo shar: Will not clobber existing file \"'Doc/FORMAT2.0'\"
  325. else
  326. echo shar: Extracting \"'Doc/FORMAT2.0'\" \(9404 characters\)
  327. sed "s/^X//" >'Doc/FORMAT2.0' <<'END_OF_FILE'
  328. XThe following is the format of fig output for Protocol version 2.0:
  329. X
  330. X(1) The very first line is a comment line containing the name and version:
  331. X    #FIG 2.0
  332. X
  333. X    The character # at the first column of a line indicates that the line
  334. X    is a comment line which will be ignored.
  335. X
  336. X(2) The first non-comment line consists of two numbers :
  337. X
  338. X    int    fig_resolution        (pixels/inch)
  339. X    int    coordinate_system    (1 : origin is at the lower left corner
  340. X                     2 : Upper left)
  341. X
  342. X    Fig_resolution is the resolution fig is using for the current file.
  343. X    It may not be the same as screen resolution (which can be higher or
  344. X    lower).  I assume that a pixel is square, therefore this number
  345. X    represents drawing resolution in both direction.  I've experimented
  346. X    with fig automatically changing this number according to the resolution
  347. X    of the monitor it is running on (The screen resolution, width and height
  348. X    in pixels, not pixel/inch, can be done by doing a ioctl on the /dev/fb).
  349. X    I've found that for monitors with higher resolution but same size
  350. X    (19" diagonal), I preferred using the pixels for other things than
  351. X    having fig occupying most of the screen.  Thus I opted for a fixed
  352. X    pixel-per-inch number which make fig window smaller on higher resolution
  353. X    monitor (than the standard sun monitor).  This however may change in
  354. X    the future version.
  355. X
  356. X(3) The rest of the file contains various objects.  An object can be one
  357. X    of six classes (or types).
  358. X
  359. X      i)    Ellipse which is a generalization of circle.
  360. X     ii)    Polyline which includes polygon and box.
  361. X    iii)    Spline which includes closed/open control/interpolated spline.
  362. X     iv)    Text.
  363. X      v)    Arc.
  364. X     vi)    Compound object which is composed of one or more objects.
  365. X
  366. X    In the following elaboration on object formats, every value of fig
  367. X    output are separated by blank characters or new line ('\n').  The
  368. X    value of the not-used parameters will be -1.
  369. X
  370. X    A number of values are described as unused or not applicable to some
  371. X    object even though they are defined for those objects.  These value
  372. X    will (hopefully) be used in the future version of fig.  The intention
  373. X    of their uses are the following.
  374. X
  375. X    Value            Usage
  376. X    -----            -----
  377. X    area_fill    The gray color for filling object internals.
  378. X            Non-TFX:(gray color; 0=no fill,1=white,21=black)
  379. X            TFX:    (gray color; 0=no fill,1=black, 5=white)
  380. X
  381. X    pen        This will be a structure defining the shape of
  382. X            pen used in drawing objects.  It also includes
  383. X            the the stipple pattern for line filling.
  384. X            The default pen is a circular pen with black
  385. X            filling.
  386. X
  387. X    thickness    Every pen has the thickness of one.
  388. X            Thickness scales the size of a pen. 
  389. X
  390. X    depth        This value adds a half dimension to fig.
  391. X            It is useful when we have overlapping filled
  392. X            objects and we want one to obliterate another.
  393. X            An object can have only one depth (including
  394. X            compound object).  An object that is in less
  395. X            depth can obscure the one with greater depth
  396. X            if they overlap.
  397. X    
  398. X    style        Three line styles are defined.
  399. X
  400. X                0 : SOLID_LINE
  401. X                1 : DASH_LINE
  402. X                2 : DOTTED_LINE
  403. X
  404. X    style_val    For dash style, it is the length of a dash.
  405. X            For dotted line it indicates the approximated
  406. X            gap of consecutive dots. 
  407. X    
  408. X    radius        For rounded-corner boxes, this is the radius of
  409. X            the corners.
  410. X
  411. X    (3.1) ELLIPSE
  412. X
  413. X    First line :
  414. X    type    name            (brief description)
  415. X    ----    ----            -------------------
  416. X    int    object_code        (always 1)
  417. X    int    sub_type        (1 : ellipse defined by radiuses
  418. X                     2 : ellipse defined by diameters
  419. X                     3 : circle defined by radius
  420. X                     4 : circle defined by diameter)
  421. X    int    style            (See the end of this section)
  422. X    int    thickness        (pixels, not used)
  423. X    int    color            (not used)
  424. X    int    depth            (not used)
  425. X    int    pen            (not used)
  426. X    int    area_fill        (gray color)
  427. X    float    style_val        (pixels, not used)
  428. X    int    direction        (always 1)
  429. X    float    angle            (radian, the angle of the x-axis)
  430. X    int    center_x, center_y    (pixels)
  431. X    int    radius_x, radius_y    (pixels)
  432. X    int    start_x, start_y    (pixels; the 1st point entered)
  433. X    int    end_x, end_y        (pixels; the last point entered)
  434. X
  435. X    (3.2) POLYLINE
  436. X
  437. X    First line :
  438. X    type    name            (brief description)
  439. X    ----    ----            -------------------
  440. X    int    object_code        (always 2)
  441. X    int    sub_type        (1 : polyline, 2 : box, 
  442. X                     3 : polygon, 4 : rounded-corner box)
  443. X    int    style            (See the end of this section)
  444. X    int    thickness        (pixels, not used)
  445. X    int    color            (not used)
  446. X    int    depth            (not used)
  447. X    int    pen            (not used)
  448. X    int    area_fill    *    (gray color)
  449. X    float    style_val        (pixels)
  450. X    int    radius        **    (pixels, radius of rounded-corner boxes)
  451. X    int    forward_arrow        (0: off, 1: on)
  452. X    int    backward_arrow        (0: off, 1: on)
  453. X
  454. X*  Fill only available for box, polygon and rounded-corner box, not polyline.
  455. X** This component exists only in rounded-corner box object.
  456. X
  457. X    Forward arrow line : same as ARC object
  458. X
  459. X    Backward arrow line : same as ARC object
  460. X
  461. X    Points line :
  462. X    type    name            (brief description)
  463. X    ----    ----            -------------------
  464. X    int    x1, y1            (pixels)
  465. X    int    x2, y2            (pixels)
  466. X      .
  467. X      .
  468. X    int    xn, yn            (this will be the same as the 1st
  469. X                    point for polygon and box)
  470. X    int    x, y            (always 9999, 9999; marks the end of
  471. X                    point for polygon and box)
  472. X
  473. X    (3.3) SPLINE
  474. X
  475. X    First line :
  476. X    type    name            (brief description)
  477. X    ----    ----            -------------------
  478. X    int    object_code        (always 3)
  479. X    int    sub_type        (0 : open spline
  480. X                     1 : closed spline
  481. X                     2 : open interpolated spline
  482. X                     3 : closed interpolated spline)
  483. X    int    style            (See the end of this section)
  484. X    int    thickness        (pixels, not used)
  485. X    int    color            (not used)
  486. X    int    depth            (not used)
  487. X    int    pen            (not used)
  488. X    int    area_fill        (gray color)
  489. X    float    style_val        (pixels, not used)
  490. X    int    forward_arrow        (0: off, 1: on)
  491. X    int    backward_arrow        (0: off, 1: on)
  492. X
  493. X    Forward arrow line : same as ARC object
  494. X
  495. X    Backward arrow line : same as ARC object
  496. X
  497. X    Points line : same as POLYLINE object
  498. X
  499. X    Control points line (absent if sub_type is 1 or 2) :
  500. X    Control points of interpolated spline.  There are two control
  501. X    points for each knots.  A section i, of the spline is drawn
  502. X    using Bezier cubic with the following four points:
  503. X        (x ,y ), (rx ,ry ), (lx      , ly   ), (x   , y   ).
  504. X          i  i        i    i      i+1    i+1     i+1   i+1
  505. X    For closed interpolated spline the last pair of control points,
  506. X    (lxn,lyn) and (rxn,ryn) (which can be ignored), are the same as
  507. X    (lx1,ly1) and (rx1,ry1) respectively.
  508. X
  509. X    type    name            (brief description)
  510. X    ----    ----            -------------------
  511. X    float    lx1, ly1        (pixels)
  512. X    float    rx1, ry1        (pixels)
  513. X    float    lx2, ly2        (pixels)
  514. X    float    rx2, ry2        (pixels)
  515. X      .
  516. X      .
  517. X    float    lxn, lyn        (pixels)
  518. X    float    rxn, ryn        (pixels)
  519. X
  520. X    (3.4) TEXT
  521. X    type    name            (brief description)
  522. X    ----    ----            -------------------
  523. X    int    object             (always 4)
  524. X    int    sub_type        (0 : Left justified
  525. X                     1 : Center justified
  526. X                     2 : Right justified)
  527. X    int    font             (font number 0-...)
  528. X    int    font_size         (point size)
  529. X    int    pen            (not used)
  530. X    int    color            (not used)
  531. X    int    depth            (not used)
  532. X    float    angle            (radian, not used, the angle of the
  533. X                    the base line of the string)
  534. X    int    font_style        (not used)
  535. X    int    height            (pixels)
  536. X    int    length            (pixels)
  537. X    int    x, y            (pixels, coordinate of the origin
  538. X                     of the string.  If sub_type = 0, it is
  539. X                     the lower left corner of the string.
  540. X                     If sub_type = 1, it is the lower
  541. X                     center.  Otherwise it is the lower
  542. X                     right corner of the string.)
  543. X    char    string[]        (ascii characters; starts after a blank
  544. X                    character following the last number and
  545. X                    ends before the character '\1'.  This
  546. X                    character is not part of the string.
  547. X                    Note that the string may contain '\n'.)
  548. X    (3.5) ARC
  549. X
  550. X    First line :
  551. X    type    name            (brief description)
  552. X    ----    ----            -------------------
  553. X    int    object_code        (always 5)
  554. X    int    sub_type        (always    1)
  555. X    int    style            (See the end of this section)
  556. X    int    line_thickness        (pixels, not used)
  557. X    int    color            (not used)
  558. X    int    depth            (not used)
  559. X    int    pen            (not used)
  560. X    int    area_fill        (gray color)
  561. X    float    style_val        (pixels, not used)
  562. X    int    direction        (0 : clockwise, 1 : counterclockwise)
  563. X    int    forward_arrow        (0: no forward arrow, 1: on)
  564. X    int    backward_arrow        (0: no forward arrow, 1: on)
  565. X    float    center_x, center_y    (center of the arc)
  566. X    int    x1, y1            (pixels, the 1st point the user entered)
  567. X    int    x2, y2            (pixels, the 2nd point)
  568. X    int    x3, y3            (pixels, the last point)
  569. X
  570. X    Forward arrow line (Optional; absent if forward_arrow is 0) :
  571. X    type    name            (brief description)
  572. X    ----    ----            -------------------
  573. X    int    arrow_type        (not used)
  574. X    int    arrow_style        (not used)
  575. X    float    arrow_thickness        (not used)
  576. X    float    arrow_width        (pixels)
  577. X    float    arrow_height        (pixels)
  578. X
  579. X    Backward arrow line (Optional; absent if backward_arrow is 0) :
  580. X    type    name            (brief description)
  581. X    ----    ----            -------------------
  582. X    int    arrow_type        (not used)
  583. X    int    arrow_style        (not used)
  584. X    float    arrow_thickness        (not used)
  585. X    float    arrow_width        (pixels)
  586. X    float    arrow_height        (pixels)
  587. X
  588. X    (3.6) COMPOUND
  589. X
  590. X    A line with object code 6 signifies the start of a compound.
  591. X    There are four more numbers on this line which indicate the
  592. X    upper right corner and the lower left corner of the bounding
  593. X    box of this compound.  A line with object code -6 signifies
  594. X    the end of the compound.  Compound may be nested.
  595. X
  596. X    First line :
  597. X    type    name            (brief description)
  598. X    ----    ----            -------------------
  599. X    int    object_code        (always 6)
  600. X    int    upperright_corner_x    (pixels)
  601. X    int    upperright_corner_y    (pixels)
  602. X    int    lowerleft_corner_x    (pixels)
  603. X    int    lowerleft_corner_y    (pixels)
  604. X
  605. X    Subsequent lines :
  606. X    objects
  607. X    .
  608. X    .
  609. X
  610. X    Last line :
  611. X    -6
  612. X
  613. X
  614. END_OF_FILE
  615. if test 9404 -ne `wc -c <'Doc/FORMAT2.0'`; then
  616.     echo shar: \"'Doc/FORMAT2.0'\" unpacked with wrong size!
  617. fi
  618. # end of 'Doc/FORMAT2.0'
  619. fi
  620. if test -f 'Doc/TODO' -a "${1}" != "-c" ; then 
  621.   echo shar: Will not clobber existing file \"'Doc/TODO'\"
  622. else
  623. echo shar: Extracting \"'Doc/TODO'\" \(9507 characters\)
  624. sed "s/^X//" >'Doc/TODO' <<'END_OF_FILE'
  625. XThis file contains some possible things to do in future versions of xfig.
  626. X
  627. Xallow rotated boxes (not just polygons)
  628. Xreduce number of grid lines (if necessary) when zooming < 1.0
  629. Xfix grid rounding problems at 0.75 zoom factor
  630. Xallow printing of grid in figure
  631. Xmake the rulers understand the real screen resolution according to the server
  632. Xadd the concept of "layers" for each depth.  That way a user may work on 
  633. X    certain layers at one time, masking out or overlaying the other layers
  634. X    as desired.
  635. Xmake <Shift>middle mouse button DELETE previous points just created during
  636. X    create POLYobject/ARC/Ellipse etc.  That way, one may backup when
  637. X    creating objects.
  638. Xcreate resource for "print" command (e.g. lp, lpr, whatever) which uses meta-
  639. X    notation to place filename (e.g.  print_command: "lpr -P%p %f" where %p
  640. X    is the printer string and %f is the filename)
  641. Xmake line counter update correctly when reading multiple-line POLYLINES and
  642. X    SPLINES from input file
  643. Xallow vertically-aligned text
  644. X  "top" would mean the insertion point specifies the line over the top of the
  645. X        text
  646. X  "middle" would mean that it specifies the midline of the text (I'm not
  647. X        sure how this is defined, perhaps the average of top and base
  648. X        or top and bottom.
  649. X  "base" would mean the line under all letters which do not hang down.
  650. X        For example, g and j extend below the baseline.
  651. X  "bottom" would mean the time under the bottom of the text including
  652. X        descenders.
  653. Xhave arc sub-type 2 for pie wedge-type arcs
  654. Xhave common edit popup for all four splines to allow conversion between all
  655. Xsave modified_flag before file operations and restore if undo used
  656. XShould arrow size change in update mode when linewidth changes?
  657. Xinvestigate whether eps objects that don't have a preview bitmap
  658. X    are scaled correctly
  659. Xchange eps_bitmaps so that background is transparent (needs to work
  660. X    in normal and reverse-video modes).
  661. XMake popup windows come up so that they don't overlap the figure (if possible).
  662. X    An edit popup window should at least not overlap the
  663. X    object being edited (again only if possible).
  664. XUse fill pattern (grey-shading) to mimic color objects on monochrome systems.
  665. XExtend smart links to work for SCALE, MOVEPT and perhaps EDIT, UPDATE.
  666. X    Could also extend them to work for arc-type links and for
  667. X    ellipse/circle objects and objects inside compound objects.  
  668. X    Also, at the moment smart-links
  669. X    only work for one end of a link if both ends of the link
  670. X    happen to touch the object being operated on.  To fix this would
  671. X    require changing the F_linkinfo structure to have left_endpt,
  672. X    left_prevpt, right_endpt, right_prevpt fields instead of the current
  673. X    endpt, prevpt and two_pts fields.
  674. XMake xfig resources more consistent with normal use of resources in X clients.
  675. X    e.g. provide support to allow each command button (say) to be
  676. X    a different color.  Ditto for mode buttons, etc.
  677. Xinvestigate if we should be setting initialResourcesPersistent to false for
  678. X    widgets that are created and destroyed as required.
  679. XStill need to think about how point positioning should be utilized with
  680. X    many of the editing commands, e.g. if point positioning is set to
  681. X    large grid and you are trying to move an object, should:
  682. X    a) it be ignored, b) you can pick up an object anywhere but
  683. X    you must put the 'pick-up' point back on a grid posn,
  684. X    c) you have to pick up and put down objects at grid posns,
  685. X    d) you can pick up and place an object anywhere but when you
  686. X    place it, the point on the object closest the pickup point is
  687. X    automatically rounded to the nearest grid posn, e) you can
  688. X    pick up objects anywhere and movement is multiples of the grid size.
  689. X    The current behaviour is c) and b) can be mimicked by changing the
  690. X    point posn indicator mid-move.  It has the disadvantage that you
  691. X    may not be able to pick up an object which isn't on the grid points.
  692. X    I think e) is the next best but it won't let you mimick b).
  693. XUse clipping rectangles in more places:
  694. X    use the redisplay_* routines as necessary.
  695. Xallow popup menus to be pinned?
  696. Xhave a resource which can be set to keep backups during a save, instead of
  697. X    prompting the user about overwrite etc.
  698. Xmake a keypad label:
  699. X    This should popup in the mousefun window whenever a panel for
  700. X    entering text is entered.  The kbd_ic icon is already there.
  701. Xzooming of text is still a kludge. (It doesn't work properly yet)
  702. Xmake arcs use pw_curve to speed them up.
  703. Xadd bounding box to every F_object definition, useful for:
  704. X    1) faster drawing of rubber objects
  705. X    2) handling the selective redrawing of figures better after they become
  706. X       the innocent victim during an expose or erasure of another object
  707. Xthings like pan/zoom/resize/iconify will still leave junk on the screen
  708. X    or mess up the figure if you are in the middle of drawing it:
  709. X    One solution is to call canvas_rightbut_proc whenever the
  710. X    action_on flag is set and one of the above functions is called.
  711. X    This forces the operation being performed to be cancelled - probably
  712. X    not a good idea for panning - we might be trying to pan a little
  713. X    bit to place the last point in a large object.
  714. X    Another solution is to have a big case statement which performs
  715. X    a single elastic draw of whatever object is being drawn/moved etc.
  716. X    The function would need to be called before an iconify (or
  717. X    whatever) and again after the operation was completed.  This
  718. X    would allow drawing operations to be continued after window functions
  719. X    had been performed.
  720. X    A third solution is to use a canvas_elasticdraw_save parameter
  721. X    instead of using a case statement - it would need to be set
  722. X    prior to every elastic draw operation.
  723. XGeneralize align mode (like glue mode) to allow arbitrary tagged objects to be
  724. X    aligned rather than just compounds.
  725. XAdditional align mode options for distributing objects evenly within a compound
  726. X    or abutting them together: abutT, abutB, abutL, abutR, distH, distV
  727. XSome facility to provide better support for small screens.
  728. X    e.g. scrollable mode button list or automatic resizing
  729. X    to have several rows as needed.  A good test is to limit the total 
  730. X    space to 640x480 so that it is still useable on an IBM-PC VGA screen.
  731. XMake a raise/lower depth feature:
  732. X    the raise_ic icon is already in w_icons.c
  733. XMake xfig understand depth better:
  734. X    If you set the depth using the object edit panels, xfig will redraw
  735. X    them correctly, however it would be nice if as you entered new filled
  736. X    objects that they were automatically given an appropriate depth.
  737. X    This would involve finding the depth of all overlapping (filled?)
  738. X    objects and setting the depth to be one less.
  739. X    What about support for negative depth values?
  740. X
  741. X--------------------------------------------------------------------
  742. XThe following items would require a change to the Fig file protocol:
  743. X--------------------------------------------------------------------
  744. X
  745. Xextend color model to include 24-bit color
  746. Xuse floating point coordinates for objects (at least internally to xfig if not
  747. X    in the figure file)
  748. Xsuper/subscripts for text objects
  749. Xallow background color for figure and store in fig file - also requires that
  750. X    fig2dev knows about this background color
  751. Xallow fractional text sizes (float)
  752. Xpossibly make extension to Fig protocol to handle several line 
  753. X    cap/join styles (e.g. round, butt, miter)
  754. X
  755. X--------------------------------------------------------------------
  756. XWhat really needs to be done is a major rework of the list structures used
  757. X    to store xfig objects.  Here are some comments involving the change.
  758. X
  759. X-------- note about restructuring xfig data structures -------------
  760. XRather than having a depth attribute for objects, you can use the order
  761. Xin which objects are entered to determine their depth:  later objects
  762. Xappear on the top.  A raise/lower depth operation would allow you to
  763. Xchange the ordering.
  764. X
  765. XThe consequences to the current implementation of converting totally to this
  766. Xscheme are non-trivial.  Instead of having separate lists for each object
  767. Xtype, you need to have a single list which has a union of all the different
  768. Xobjects as its type.  This will require changes in many places in the code.
  769. XAt the moment there are many places where each of the lists are traversed
  770. Xseparately.  In many cases the code can be simplified dramatically if there
  771. Xwas only a single list.  For example, to perform a move on an object there
  772. Xare separate routines (one for each object type) to start/cancel/place the
  773. Xobject.  You could replace this by a single routine for start/cancel and
  774. Xplace which worked no matter what type you had.  (Who says you can't use
  775. Xobject-orientation in C :-)).  Another advantage is that the current caching
  776. Xscheme for redrawing would no longer be needed (i.e. redrawing would be
  777. Xgreatly simplified).  Also undo would become simpler (I think).
  778. X
  779. XIf we want to make a smooth transition from the current scheme to the
  780. Xone described above (and I do), here is how I propose we do it:
  781. X
  782. XWe need to change every direct access to the current lists to use functions.
  783. Xi.e. something like
  784. X        for (a=objects.arc; a!=NULL; a=a->next) ...
  785. Xto be something like
  786. X        for (a=first_arc(); a!=NULL; a=next_arc(a)) ...
  787. X
  788. XAt the moment these routines would be simple to implement.
  789. XOnce all occurrences had been changed, it would simply be a matter
  790. Xof changing the underlying list structure and changing the first_arc,
  791. Xnext_arc routines.  Then as we had time we could replace whichever
  792. Xsets of six loops by a single loop which did
  793. X        for (o=first_obj(); o!=NULL; o=next_obj(o)) ...
  794. X-------- end of note about restructuring xfig data structures -------------
  795. X
  796. END_OF_FILE
  797. if test 9507 -ne `wc -c <'Doc/TODO'`; then
  798.     echo shar: \"'Doc/TODO'\" unpacked with wrong size!
  799. fi
  800. # end of 'Doc/TODO'
  801. fi
  802. if test -f 'Examples/logic.fig.uu' -a "${1}" != "-c" ; then 
  803.   echo shar: Will not clobber existing file \"'Examples/logic.fig.uu'\"
  804. else
  805. echo shar: Extracting \"'Examples/logic.fig.uu'\" \(9760 characters\)
  806. sed "s/^X//" >'Examples/logic.fig.uu' <<'END_OF_FILE'
  807. Xbegin 444 logic.fig
  808. XM(T9)1R`R+C$*.#`@,@HQ(#0@,"`Q("TQ(#`@,"`R,2`P+C`P,"`Q(#`N,#`P
  809. XM(#(R-"`W.2`S(#,@,C(R(#<Y(#(R-R`W.0HQ(#,@,"`Q("TQ(#`@,"`P(#`N
  810. XM,#`P(#$@,"XP,#`@,C$Y(#(T(#$P(#$P(#(Q.2`R-"`R,CD@,C0*,2`S(#`@
  811. XM,2`M,2`P(#`@,"`P+C`P,"`Q(#`N,#`P(#4S-"`Q,#0@-2`U(#4S-"`Q,#0@
  812. XM-3,Y(#$P-`HQ(#,@,"`Q("TQ(#`@,"`P(#`N,#`P(#$@,"XP,#`@-#,T(#0T
  813. XM(#$P(#$P(#0S-"`T-"`T-#0@-#0*,2`T(#`@,2`M,2`P(#`@,C$@,"XP,#`@
  814. XM,2`P+C`P,"`T-SD@-SD@,R`S(#0W-R`W.2`T.#(@-SD*,2`T(#`@,2`M,2`P
  815. XM(#`@,C$@,"XP,#`@,2`P+C`P,"`V.#D@-SD@,R`S(#8X-R`W.2`V.3(@-SD*
  816. XM,2`S(#`@,2`M,2`P(#`@,"`P+C`P,"`Q(#`N,#`P(#,V-"`R-#D@,3`@,3`@
  817. XM,S8T(#(T.2`S-S0@,C0Y"C$@-"`P(#$@+3$@,"`P(#(Q(#`N,#`P(#$@,"XP
  818. XM,#`@-#$Y(#(R-"`S(#,@-#$W(#(R-"`T,C(@,C(T"C$@-"`P(#$@+3$@,"`P
  819. XM(#(Q(#`N,#`P(#$@,"XP,#`@-#$Y(#,T.2`S(#,@-#$W(#,T.2`T,C(@,S0Y
  820. XM"C$@-"`P(#$@+3$@,"`P(#(Q(#`N,#`P(#$@,"XP,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@,"`P+C`P,"`T(#D@.2`S,#0@,SDT($0!"C0@
  958. XM,"`P(#$R(#`@+3$@,"`P+C`P,"`T(#D@-B`U-C`@,C`W(&0!"C0@,"`P(#$R
  959. XM(#`@+3$@,"`P+C`P,"`T(#D@.2`U-#0@,CDT($$!"C0@,"`P(#$R(#`@+3$@
  960. XM,"`P+C`P,"`T(#D@."`V,#0@,CDT($,!"C0@,"`P(#$R(#`@+3$@,"`P+C`P
  961. XM,"`T(#D@."`U-#0@,S4Y($(!"C0@,"`P(#$R(#`@+3$@,"`P+C`P,"`T(#D@
  962. XM.2`V,#0@,S4Y($0!"C0@,"`P(#$R(#`@+3$@,"`P+C`P,"`T(#<@,C4@.3D@
  963. XM-3$Y(&YO=&4Z`0HT(#`@,"`Q,B`P("TQ(#`@,"XP,#`@-"`Y(#D@,34T(#4V
  964. XL.2!!`0HT(#`@,"`Q,B`P("TQ(#`@,"XP,#`@-"`Y(#D@,S$T(#4R.2!!`0HV
  965. X`
  966. Xend
  967. END_OF_FILE
  968. if test 9760 -ne `wc -c <'Examples/logic.fig.uu'`; then
  969.     echo shar: \"'Examples/logic.fig.uu'\" unpacked with wrong size!
  970. fi
  971. # end of 'Examples/logic.fig.uu'
  972. fi
  973. if test -f 'e_arrow.c' -a "${1}" != "-c" ; then 
  974.   echo shar: Will not clobber existing file \"'e_arrow.c'\"
  975. else
  976. echo shar: Extracting \"'e_arrow.c'\" \(9407 characters\)
  977. sed "s/^X//" >'e_arrow.c' <<'END_OF_FILE'
  978. X/*
  979. X * FIG : Facility for Interactive Generation of figures
  980. X * Copyright (c) 1985 by Supoj Sutanthavibul
  981. X *
  982. X * "Permission to use, copy, modify, distribute, and sell this software and its
  983. X * documentation for any purpose is hereby granted without fee, provided that
  984. X * the above copyright notice appear in all copies and that both the copyright
  985. X * notice and this permission notice appear in supporting documentation. 
  986. X * No representations are made about the suitability of this software for 
  987. X * any purpose.  It is provided "as is" without express or implied warranty."
  988. X */
  989. X
  990. X#include "fig.h"
  991. X#include "resources.h"
  992. X#include "mode.h"
  993. X#include "object.h"
  994. X#include "paintop.h"
  995. X#include "u_create.h"
  996. X#include "u_search.h"
  997. X#include "w_canvas.h"
  998. X#include "w_mousefun.h"
  999. X
  1000. Xstatic        add_arrow_head();
  1001. Xstatic        delete_arrow_head();
  1002. X
  1003. Xarrow_head_selected()
  1004. X{
  1005. X    set_mousefun("add arrow", "delete arrow", "");
  1006. X    canvas_kbd_proc = null_proc;
  1007. X    canvas_locmove_proc = null_proc;
  1008. X    init_searchproc_left(add_arrow_head);
  1009. X    init_searchproc_middle(delete_arrow_head);
  1010. X    canvas_leftbut_proc = point_search_left;
  1011. X    canvas_middlebut_proc = point_search_middle;
  1012. X    canvas_rightbut_proc = null_proc;
  1013. X    set_cursor(pick9_cursor);
  1014. X}
  1015. X
  1016. Xstatic
  1017. Xadd_arrow_head(obj, type, x, y, p, q)
  1018. X    char       *obj;
  1019. X    int            type, x, y;
  1020. X    F_point       *p, *q;
  1021. X{
  1022. X    switch (type) {
  1023. X    case O_POLYLINE:
  1024. X    cur_l = (F_line *) obj;
  1025. X    add_linearrow(cur_l, p, q);
  1026. X    break;
  1027. X    case O_SPLINE:
  1028. X    cur_s = (F_spline *) obj;
  1029. X    add_splinearrow(cur_s, p, q);
  1030. X    break;
  1031. X    case O_ARC:
  1032. X    cur_a = (F_arc *) obj;
  1033. X    /* dirty trick - arc point number is stored in p */
  1034. X    add_arcarrow(cur_a, (int) p);
  1035. X    break;
  1036. X    }
  1037. X}
  1038. X
  1039. Xstatic
  1040. Xdelete_arrow_head(obj, type, x, y, p, q)
  1041. X    char       *obj;
  1042. X    int            type, x, y;
  1043. X    F_point       *p, *q;
  1044. X{
  1045. X    switch (type) {
  1046. X    case O_POLYLINE:
  1047. X    cur_l = (F_line *) obj;
  1048. X    delete_linearrow(cur_l, p, q);
  1049. X    break;
  1050. X    case O_SPLINE:
  1051. X    cur_s = (F_spline *) obj;
  1052. X    delete_splinearrow(cur_s, p, q);
  1053. X    break;
  1054. X    case O_ARC:
  1055. X    cur_a = (F_arc *) obj;
  1056. X    /* dirty trick - arc point number is stored in p */
  1057. X    delete_arcarrow(cur_a, (int) p);
  1058. X    break;
  1059. X    }
  1060. X}
  1061. X
  1062. Xadd_linearrow(line, prev_point, selected_point)
  1063. X    F_line       *line;
  1064. X    F_point       *prev_point, *selected_point;
  1065. X{
  1066. X    if (line->points->next == NULL)
  1067. X    return;            /* A single point line */
  1068. X
  1069. X    if (prev_point == NULL) {    /* selected_point is the first point */
  1070. X    if (line->back_arrow)
  1071. X        return;
  1072. X    line->back_arrow = backward_arrow();
  1073. X    mask_toggle_linemarker(line);
  1074. X    draw_arrow(selected_point->next->x, selected_point->next->y,
  1075. X           selected_point->x, selected_point->y, line->back_arrow,
  1076. X           PAINT, line->color);
  1077. X    mask_toggle_linemarker(line);
  1078. X    } else if (selected_point->next == NULL) {    /* forward arrow */
  1079. X    if (line->for_arrow)
  1080. X        return;
  1081. X    line->for_arrow = forward_arrow();
  1082. X    mask_toggle_linemarker(line);
  1083. X    draw_arrow(prev_point->x, prev_point->y, selected_point->x,
  1084. X           selected_point->y, line->for_arrow, PAINT, line->color);
  1085. X    mask_toggle_linemarker(line);
  1086. X    } else
  1087. X    return;
  1088. X    clean_up();
  1089. X    set_last_prevpoint(prev_point);
  1090. X    set_last_selectedpoint(selected_point);
  1091. X    set_latestline(line);
  1092. X    set_action_object(F_ADD_ARROW_HEAD, O_POLYLINE);
  1093. X    set_modifiedflag();
  1094. X}
  1095. X
  1096. Xadd_arcarrow(arc, point_num)
  1097. X    F_arc       *arc;
  1098. X    int            point_num;
  1099. X{
  1100. X
  1101. X    if (point_num == 0) {    /* backward arrow  */
  1102. X    if (arc->back_arrow)
  1103. X        return;
  1104. X    arc->back_arrow = backward_arrow();
  1105. X    mask_toggle_arcmarker(arc);
  1106. X    draw_arcarrows(arc, PAINT);
  1107. X    mask_toggle_arcmarker(arc);
  1108. X    } else if (point_num == 2) {/* for_arrow  */
  1109. X    if (arc->for_arrow)
  1110. X        return;
  1111. X    arc->for_arrow = forward_arrow();
  1112. X    mask_toggle_arcmarker(arc);
  1113. X    draw_arcarrows(arc, PAINT);
  1114. X    mask_toggle_arcmarker(arc);
  1115. X    } else
  1116. X    return;
  1117. X    clean_up();
  1118. X    set_last_arcpointnum(point_num);
  1119. X    set_latestarc(arc);
  1120. X    set_action_object(F_ADD_ARROW_HEAD, O_ARC);
  1121. X    set_modifiedflag();
  1122. X}
  1123. X
  1124. Xadd_splinearrow(spline, prev_point, selected_point)
  1125. X    F_spline       *spline;
  1126. X    F_point       *prev_point, *selected_point;
  1127. X{
  1128. X    F_point       *p;
  1129. X    F_control       *c;
  1130. X
  1131. X    if (prev_point == NULL) {    /* add backward arrow */
  1132. X    if (spline->back_arrow)
  1133. X        return;
  1134. X    p = selected_point->next;
  1135. X    spline->back_arrow = backward_arrow();
  1136. X    mask_toggle_splinemarker(spline);
  1137. X    if (normal_spline(spline)) {
  1138. X        draw_arrow(p->x, p->y, selected_point->x,
  1139. X               selected_point->y, spline->back_arrow, PAINT,
  1140. X               spline->color);
  1141. X    } else {
  1142. X        c = spline->controls;
  1143. X        draw_arrow(round(c->rx), round(c->ry), selected_point->x,
  1144. X               selected_point->y, spline->back_arrow, PAINT,
  1145. X               spline->color);
  1146. X    }
  1147. X    mask_toggle_splinemarker(spline);
  1148. X    } else if (selected_point->next == NULL) {    /* add forward arrow */
  1149. X    if (spline->for_arrow)
  1150. X        return;
  1151. X    spline->for_arrow = forward_arrow();
  1152. X    mask_toggle_splinemarker(spline);
  1153. X    if (normal_spline(spline)) {
  1154. X        draw_arrow(prev_point->x, prev_point->y,
  1155. X               selected_point->x, selected_point->y,
  1156. X               spline->for_arrow, PAINT,
  1157. X               spline->color);
  1158. X    } else {
  1159. X        for (c = spline->controls; c->next != NULL; c = c->next);
  1160. X        draw_arrow(round(c->lx), round(c->ly), selected_point->x,
  1161. X               selected_point->y, spline->for_arrow, PAINT,
  1162. X               spline->color);
  1163. X    }
  1164. X    mask_toggle_splinemarker(spline);
  1165. X    }
  1166. X    clean_up();
  1167. X    set_last_prevpoint(prev_point);
  1168. X    set_last_selectedpoint(selected_point);
  1169. X    set_latestspline(spline);
  1170. X    set_action_object(F_ADD_ARROW_HEAD, O_SPLINE);
  1171. X    set_modifiedflag();
  1172. X}
  1173. X
  1174. Xdelete_linearrow(line, prev_point, selected_point)
  1175. X    F_line       *line;
  1176. X    F_point       *prev_point, *selected_point;
  1177. X{
  1178. X    if (line->points->next == NULL)
  1179. X    return;            /* A single point line */
  1180. X
  1181. X    if (prev_point == NULL) {    /* selected_point is the first point */
  1182. X    if (!line->back_arrow)
  1183. X        return;
  1184. X    mask_toggle_linemarker(line);
  1185. X    draw_arrow(selected_point->next->x, selected_point->next->y,
  1186. X          selected_point->x, selected_point->y, line->back_arrow, ERASE,
  1187. X           line->color);
  1188. X    free((char *) line->back_arrow);
  1189. X    line->back_arrow = NULL;
  1190. X    draw_line(line, PAINT);
  1191. X    mask_toggle_linemarker(line);
  1192. X    } else if (selected_point->next == NULL) {    /* forward arrow */
  1193. X    if (!line->for_arrow)
  1194. X        return;
  1195. X    mask_toggle_linemarker(line);
  1196. X    draw_arrow(prev_point->x, prev_point->y, selected_point->x,
  1197. X           selected_point->y, line->for_arrow, ERASE,
  1198. X           line->color);
  1199. X    free((char *) line->for_arrow);
  1200. X    line->for_arrow = NULL;
  1201. X    draw_line(line, PAINT);
  1202. X    mask_toggle_linemarker(line);
  1203. X    } else
  1204. X    return;
  1205. X    clean_up();
  1206. X    set_last_prevpoint(prev_point);
  1207. X    set_last_selectedpoint(selected_point);
  1208. X    set_latestline(line);
  1209. X    set_action_object(F_DELETE_ARROW_HEAD, O_POLYLINE);
  1210. X    set_modifiedflag();
  1211. X}
  1212. X
  1213. Xdelete_arcarrow(arc, point_num)
  1214. X    F_arc       *arc;
  1215. X    int            point_num;
  1216. X{
  1217. X    if (point_num == 0) {    /* backward arrow  */
  1218. X    if (!arc->back_arrow)
  1219. X        return;
  1220. X    mask_toggle_arcmarker(arc);
  1221. X    draw_arcarrows(arc, ERASE);
  1222. X    free((char *) arc->back_arrow);
  1223. X    arc->back_arrow = NULL;
  1224. X    draw_arc(arc, PAINT);
  1225. X    mask_toggle_arcmarker(arc);
  1226. X    } else if (point_num == 2) {/* for_arrow  */
  1227. X    if (!arc->for_arrow)
  1228. X        return;
  1229. X    mask_toggle_arcmarker(arc);
  1230. X    draw_arcarrows(arc, ERASE);
  1231. X    free((char *) arc->for_arrow);
  1232. X    arc->for_arrow = NULL;
  1233. X    draw_arc(arc, PAINT);
  1234. X    mask_toggle_arcmarker(arc);
  1235. X    } else
  1236. X    return;
  1237. X    clean_up();
  1238. X    set_last_arcpointnum(point_num);
  1239. X    set_latestarc(arc);
  1240. X    set_action_object(F_DELETE_ARROW_HEAD, O_ARC);
  1241. X    set_modifiedflag();
  1242. X}
  1243. X
  1244. Xdelete_splinearrow(spline, prev_point, selected_point)
  1245. X    F_spline       *spline;
  1246. X    F_point       *prev_point, *selected_point;
  1247. X{
  1248. X    F_point       *p;
  1249. X
  1250. X    if (closed_spline(spline))
  1251. X    return;
  1252. X    if (prev_point == NULL) {    /* selected_point is the first point */
  1253. X    if (!spline->back_arrow)
  1254. X        return;
  1255. X    mask_toggle_splinemarker(spline);
  1256. X    p = selected_point->next;
  1257. X    if (normal_spline(spline)) {
  1258. X        draw_arrow(p->x, p->y, selected_point->x,
  1259. X               selected_point->y, spline->back_arrow, ERASE,
  1260. X               spline->color);
  1261. X        free((char *) spline->back_arrow);
  1262. X        spline->back_arrow = NULL;
  1263. X        draw_spline(spline, PAINT);
  1264. X    } else {
  1265. X        F_control       *a;
  1266. X
  1267. X        a = spline->controls;
  1268. X        draw_arrow(round(a->rx), round(a->ry), selected_point->x,
  1269. X               selected_point->y, spline->back_arrow, ERASE,
  1270. X               spline->color);
  1271. X        free((char *) spline->back_arrow);
  1272. X        spline->back_arrow = NULL;
  1273. X        draw_spline(spline, PAINT);
  1274. X    }
  1275. X    mask_toggle_splinemarker(spline);
  1276. X    } else if (selected_point->next == NULL) {    /* forward arrow */
  1277. X    if (!spline->for_arrow)
  1278. X        return;
  1279. X    mask_toggle_splinemarker(spline);
  1280. X    if (normal_spline(spline)) {
  1281. X        draw_arrow(prev_point->x, prev_point->y,
  1282. X               selected_point->x, selected_point->y,
  1283. X               spline->for_arrow, ERASE,
  1284. X               spline->color);
  1285. X        free((char *) spline->for_arrow);
  1286. X        spline->for_arrow = NULL;
  1287. X        draw_spline(spline, PAINT);
  1288. X    } else {
  1289. X        F_control       *a, *b;
  1290. X
  1291. X        a = spline->controls;
  1292. X        for (b = a->next; b->next != NULL; a = b, b = b->next);
  1293. X        draw_arrow(round(b->lx), round(b->ly), selected_point->x,
  1294. X               selected_point->y, spline->for_arrow, ERASE,
  1295. X               spline->color);
  1296. X        free((char *) spline->for_arrow);
  1297. X        spline->for_arrow = NULL;
  1298. X        draw_spline(spline, PAINT);
  1299. X    }
  1300. X    mask_toggle_splinemarker(spline);
  1301. X    } else
  1302. X    return;
  1303. X    clean_up();
  1304. X    set_last_prevpoint(prev_point);
  1305. X    set_last_selectedpoint(selected_point);
  1306. X    set_latestspline(spline);
  1307. X    set_action_object(F_DELETE_ARROW_HEAD, O_SPLINE);
  1308. X    set_modifiedflag();
  1309. X}
  1310. END_OF_FILE
  1311. if test 9407 -ne `wc -c <'e_arrow.c'`; then
  1312.     echo shar: \"'e_arrow.c'\" unpacked with wrong size!
  1313. fi
  1314. # end of 'e_arrow.c'
  1315. fi
  1316. if test -f 'e_glue.c' -a "${1}" != "-c" ; then 
  1317.   echo shar: Will not clobber existing file \"'e_glue.c'\"
  1318. else
  1319. echo shar: Extracting \"'e_glue.c'\" \(10253 characters\)
  1320. sed "s/^X//" >'e_glue.c' <<'END_OF_FILE'
  1321. X/*
  1322. X * FIG : Facility for Interactive Generation of figures
  1323. X * Copyright (c) 1985 by Supoj Sutanthavibul
  1324. X *
  1325. X * "Permission to use, copy, modify, distribute, and sell this software and its
  1326. X * documentation for any purpose is hereby granted without fee, provided that
  1327. X * the above copyright notice appear in all copies and that both the copyright
  1328. X * notice and this permission notice appear in supporting documentation. 
  1329. X * No representations are made about the suitability of this software for 
  1330. X * any purpose.  It is provided "as is" without express or implied warranty."
  1331. X */
  1332. X
  1333. X#include "fig.h"
  1334. X#include "resources.h"
  1335. X#include "mode.h"
  1336. X#include "object.h"
  1337. X#include "paintop.h"
  1338. X#include "u_create.h"
  1339. X#include "u_draw.h"
  1340. X#include "u_elastic.h"
  1341. X#include "u_list.h"
  1342. X#include "u_search.h"
  1343. X#include "u_undo.h"
  1344. X#include "w_canvas.h"
  1345. X#include "w_mousefun.h"
  1346. X
  1347. Xstatic        create_compoundobject(), cancel_tag_region(),
  1348. X        init_tag_region(), tag_region(), tag_object();
  1349. Xstatic        get_arc(), sel_arc();
  1350. Xstatic        get_compound(), sel_compound();
  1351. Xstatic        get_ellipse(), sel_ellipse();
  1352. Xstatic        get_line(), sel_line();
  1353. Xstatic        get_spline(), sel_spline();
  1354. Xstatic        get_text(), sel_text();
  1355. X
  1356. Xcompound_selected()
  1357. X{
  1358. X    set_mousefun("tag object", "tag region", "compound tagged");
  1359. X    canvas_kbd_proc = null_proc;
  1360. X    canvas_locmove_proc = null_proc;
  1361. X    init_searchproc_left(tag_object);
  1362. X    canvas_leftbut_proc = object_search_left;
  1363. X    canvas_middlebut_proc = init_tag_region;
  1364. X    canvas_rightbut_proc = create_compoundobject;
  1365. X    set_cursor(pick9_cursor);
  1366. X    reset_action_on();
  1367. X}
  1368. X
  1369. Xstatic
  1370. Xtag_object(p, type, x, y, px, py)
  1371. X    char           *p;
  1372. X    int             type;
  1373. X    int             x, y;
  1374. X    int             px, py;
  1375. X{
  1376. X    switch (type) {
  1377. X    case O_COMPOUND:
  1378. X        cur_c = (F_compound *) p;
  1379. X        toggle_compoundhighlight(cur_c);
  1380. X    cur_c->tagged = 1 - cur_c->tagged;
  1381. X        break;
  1382. X    case O_POLYLINE:
  1383. X        cur_l = (F_line *) p;
  1384. X        toggle_linehighlight(cur_l);
  1385. X    cur_l->tagged = 1 - cur_l->tagged;
  1386. X        break;
  1387. X    case O_TEXT:
  1388. X        cur_t = (F_text *) p;
  1389. X        toggle_texthighlight(cur_t);
  1390. X    cur_t->tagged = 1 - cur_t->tagged;
  1391. X        break;
  1392. X    case O_ELLIPSE:
  1393. X        cur_e = (F_ellipse *) p;
  1394. X        toggle_ellipsehighlight(cur_e);
  1395. X    cur_e->tagged = 1 - cur_e->tagged;
  1396. X        break;
  1397. X    case O_ARC:
  1398. X        cur_a = (F_arc *) p;
  1399. X        toggle_archighlight(cur_a);
  1400. X    cur_a->tagged = 1 - cur_a->tagged;
  1401. X        break;
  1402. X    case O_SPLINE:
  1403. X        cur_s = (F_spline *) p;
  1404. X        toggle_splinehighlight(cur_s);
  1405. X    cur_s->tagged = 1 - cur_s->tagged;
  1406. X        break;
  1407. X    default:
  1408. X        return;
  1409. X    }
  1410. X}
  1411. X
  1412. Xstatic
  1413. Xinit_tag_region(x, y)
  1414. X    int            x, y;
  1415. X{
  1416. X    init_box_drawing(x, y);
  1417. X    set_mousefun("", "final corner", "cancel");
  1418. X    draw_mousefun_canvas();
  1419. X    canvas_leftbut_proc = null_proc;
  1420. X    canvas_middlebut_proc = tag_region;
  1421. X    canvas_rightbut_proc = cancel_tag_region;
  1422. X}
  1423. X
  1424. Xstatic
  1425. Xcancel_tag_region()
  1426. X{
  1427. X    elastic_box(fix_x, fix_y, cur_x, cur_y);
  1428. X    compound_selected();
  1429. X    draw_mousefun_canvas();
  1430. X}
  1431. X
  1432. Xstatic
  1433. Xtag_region(x, y)
  1434. X    int            x, y;
  1435. X{
  1436. X    int            xmin, ymin, xmax, ymax;
  1437. X
  1438. X    elastic_box(fix_x, fix_y, cur_x, cur_y);
  1439. X    xmin = min2(fix_x, x);
  1440. X    ymin = min2(fix_y, y);
  1441. X    xmax = max2(fix_x, x);
  1442. X    ymax = max2(fix_y, y);
  1443. X    tag_obj_in_region(xmin, ymin, xmax, ymax);
  1444. X    compound_selected();
  1445. X    draw_mousefun_canvas();
  1446. X}
  1447. X
  1448. Xstatic
  1449. Xcreate_compoundobject(x, y)
  1450. X    int            x, y;
  1451. X{
  1452. X    F_compound       *c;
  1453. X
  1454. X    if ((c = create_compound()) == NULL)
  1455. X    return;
  1456. X
  1457. X    if (compose_compound(c) == 0) {
  1458. X    free((char *) c);
  1459. X    compound_selected();
  1460. X    draw_mousefun_canvas();
  1461. X    put_msg("Empty compound, ignored");
  1462. X    return;
  1463. X    }
  1464. X    /*
  1465. X     * Make the bounding box exactly match the dimensions of the compound.
  1466. X     */
  1467. X    compound_bound(c, &c->nwcorner.x, &c->nwcorner.y,
  1468. X           &c->secorner.x, &c->secorner.y);
  1469. X
  1470. X    c->next = NULL;
  1471. X    clean_up();
  1472. X    set_action(F_GLUE);
  1473. X    toggle_markers_in_compound(c);
  1474. X    list_add_compound(&objects.compounds, c);
  1475. X    mask_toggle_compoundmarker(c);
  1476. X    set_latestcompound(c);
  1477. X    set_modifiedflag();
  1478. X    compound_selected();
  1479. X    draw_mousefun_canvas();
  1480. X}
  1481. X
  1482. Xtag_obj_in_region(xmin, ymin, xmax, ymax)
  1483. X    int            xmin, ymin, xmax, ymax;
  1484. X{
  1485. X    sel_ellipse(xmin, ymin, xmax, ymax);
  1486. X    sel_line(xmin, ymin, xmax, ymax);
  1487. X    sel_spline(xmin, ymin, xmax, ymax);
  1488. X    sel_text(xmin, ymin, xmax, ymax);
  1489. X    sel_arc(xmin, ymin, xmax, ymax);
  1490. X    sel_compound(xmin, ymin, xmax, ymax);
  1491. X}
  1492. X
  1493. X
  1494. Xcompose_compound(c)
  1495. X    F_compound       *c;
  1496. X{
  1497. X    c->ellipses = NULL;
  1498. X    c->lines = NULL;
  1499. X    c->texts = NULL;
  1500. X    c->splines = NULL;
  1501. X    c->arcs = NULL;
  1502. X    c->compounds = NULL;
  1503. X    get_ellipse(&c->ellipses);
  1504. X    get_line(&c->lines);
  1505. X    get_spline(&c->splines);
  1506. X    get_text(&c->texts);
  1507. X    get_arc(&c->arcs);
  1508. X    get_compound(&c->compounds);
  1509. X    if (c->ellipses != NULL)
  1510. X    return (1);
  1511. X    if (c->splines != NULL)
  1512. X    return (1);
  1513. X    if (c->lines != NULL)
  1514. X    return (1);
  1515. X    if (c->texts != NULL)
  1516. X    return (1);
  1517. X    if (c->arcs != NULL)
  1518. X    return (1);
  1519. X    if (c->compounds != NULL)
  1520. X    return (1);
  1521. X    return (0);
  1522. X}
  1523. X
  1524. Xstatic
  1525. Xsel_ellipse(xmin, ymin, xmax, ymax)
  1526. X    int            xmin, ymin, xmax, ymax;
  1527. X{
  1528. X    F_ellipse       *e;
  1529. X
  1530. X    for (e = objects.ellipses; e != NULL; e = e->next) {
  1531. X    if (xmin > e->center.x - e->radiuses.x)
  1532. X        continue;
  1533. X    if (xmax < e->center.x + e->radiuses.x)
  1534. X        continue;
  1535. X    if (ymin > e->center.y - e->radiuses.y)
  1536. X        continue;
  1537. X    if (ymax < e->center.y + e->radiuses.y)
  1538. X        continue;
  1539. X    e->tagged = 1 - e->tagged;
  1540. X    toggle_ellipsehighlight(e);
  1541. X    }
  1542. X}
  1543. X
  1544. Xstatic
  1545. Xget_ellipse(list)
  1546. X    F_ellipse      **list;
  1547. X{
  1548. X    F_ellipse       *e, *ee, *ellipse;
  1549. X
  1550. X    for (e = objects.ellipses; e != NULL;) {
  1551. X    if (!e->tagged) {
  1552. X        ee = e;
  1553. X        e = e->next;
  1554. X        continue;
  1555. X    }
  1556. X    if (*list == NULL)
  1557. X        *list = e;
  1558. X    else
  1559. X        ellipse->next = e;
  1560. X    ellipse = e;
  1561. X    if (e == objects.ellipses)
  1562. X        e = objects.ellipses = objects.ellipses->next;
  1563. X    else {
  1564. X        e = ee->next = e->next;
  1565. X    }
  1566. X    ellipse->next = NULL;
  1567. X    }
  1568. X}
  1569. X
  1570. Xstatic
  1571. Xsel_arc(xmin, ymin, xmax, ymax)
  1572. X    int            xmin, ymin, xmax, ymax;
  1573. X{
  1574. X    F_arc       *a;
  1575. X    int            urx, ury, llx, lly;
  1576. X
  1577. X    for (a = objects.arcs; a != NULL; a = a->next) {
  1578. X    arc_bound(a, &llx, &lly, &urx, &ury);
  1579. X    if (xmin > llx)
  1580. X        continue;
  1581. X    if (xmax < urx)
  1582. X        continue;
  1583. X    if (ymin > lly)
  1584. X        continue;
  1585. X    if (ymax < ury)
  1586. X        continue;
  1587. X    a->tagged = 1 - a->tagged;
  1588. X    toggle_archighlight(a);
  1589. X    }
  1590. X}
  1591. X
  1592. Xstatic
  1593. Xget_arc(list)
  1594. X    F_arc      **list;
  1595. X{
  1596. X    F_arc       *a, *arc, *aa;
  1597. X
  1598. X    for (a = objects.arcs; a != NULL;) {
  1599. X    if (!a->tagged) {
  1600. X        aa = a;
  1601. X        a = a->next;
  1602. X        continue;
  1603. X    }
  1604. X    if (*list == NULL)
  1605. X        *list = a;
  1606. X    else
  1607. X        arc->next = a;
  1608. X    arc = a;
  1609. X    if (a == objects.arcs)
  1610. X        a = objects.arcs = objects.arcs->next;
  1611. X    else
  1612. X        a = aa->next = a->next;
  1613. X    arc->next = NULL;
  1614. X    }
  1615. X}
  1616. X
  1617. Xstatic
  1618. Xsel_line(xmin, ymin, xmax, ymax)
  1619. X    int            xmin, ymin, xmax, ymax;
  1620. X{
  1621. X    F_line       *l;
  1622. X    F_point       *p;
  1623. X    int            inbound;
  1624. X
  1625. X    for (l = objects.lines; l != NULL; l = l->next) {
  1626. X    for (inbound = 1, p = l->points; p != NULL && inbound;
  1627. X         p = p->next) {
  1628. X        inbound = 0;
  1629. X        if (xmin > p->x)
  1630. X        continue;
  1631. X        if (xmax < p->x)
  1632. X        continue;
  1633. X        if (ymin > p->y)
  1634. X        continue;
  1635. X        if (ymax < p->y)
  1636. X        continue;
  1637. X        inbound = 1;
  1638. X    }
  1639. X    if (!inbound)
  1640. X        continue;
  1641. X    l->tagged = 1 - l->tagged;
  1642. X    toggle_linehighlight(l);
  1643. X    }
  1644. X}
  1645. X
  1646. Xstatic
  1647. Xget_line(list)
  1648. X    F_line      **list;
  1649. X{
  1650. X    F_line       *line, *l, *ll;
  1651. X
  1652. X    for (l = objects.lines; l != NULL;) {
  1653. X    if (!l->tagged) {
  1654. X        ll = l;
  1655. X        l = l->next;
  1656. X        continue;
  1657. X    }
  1658. X    if (*list == NULL)
  1659. X        *list = l;
  1660. X    else
  1661. X        line->next = l;
  1662. X    line = l;
  1663. X    if (l == objects.lines)
  1664. X        l = objects.lines = objects.lines->next;
  1665. X    else
  1666. X        l = ll->next = l->next;
  1667. X    line->next = NULL;
  1668. X    }
  1669. X}
  1670. X
  1671. Xstatic
  1672. Xsel_spline(xmin, ymin, xmax, ymax)
  1673. X    int            xmin, ymin, xmax, ymax;
  1674. X{
  1675. X    F_spline       *s;
  1676. X    int            urx, ury, llx, lly;
  1677. X
  1678. X    for (s = objects.splines; s != NULL; s = s->next) {
  1679. X    spline_bound(s, &llx, &lly, &urx, &ury);
  1680. X    if (xmin > llx)
  1681. X        continue;
  1682. X    if (xmax < urx)
  1683. X        continue;
  1684. X    if (ymin > lly)
  1685. X        continue;
  1686. X    if (ymax < ury)
  1687. X        continue;
  1688. X    s->tagged = 1 - s->tagged;
  1689. X    toggle_splinehighlight(s);
  1690. X    }
  1691. X}
  1692. X
  1693. Xstatic
  1694. Xget_spline(list)
  1695. X    F_spline      **list;
  1696. X{
  1697. X    F_spline       *spline, *s, *ss;
  1698. X
  1699. X    for (s = objects.splines; s != NULL;) {
  1700. X    if (!s->tagged) {
  1701. X        ss = s;
  1702. X        s = s->next;
  1703. X        continue;
  1704. X    }
  1705. X    if (*list == NULL)
  1706. X        *list = s;
  1707. X    else
  1708. X        spline->next = s;
  1709. X    spline = s;
  1710. X    if (s == objects.splines)
  1711. X        s = objects.splines = objects.splines->next;
  1712. X    else
  1713. X        s = ss->next = s->next;
  1714. X    spline->next = NULL;
  1715. X    }
  1716. X}
  1717. X
  1718. Xstatic
  1719. Xsel_text(xmin, ymin, xmax, ymax)
  1720. X    int            xmin, ymin, xmax, ymax;
  1721. X{
  1722. X    F_text       *t;
  1723. X    int            txmin, txmax, tymin, tymax;
  1724. X    int            dum;
  1725. X
  1726. X    for (t = objects.texts; t != NULL; t = t->next) {
  1727. X    if (appres.textoutline) {
  1728. X        text_bound_actual(t, t->angle, &txmin, &tymin, &txmax, &tymax,
  1729. X                &dum,&dum,&dum,&dum,&dum,&dum,&dum,&dum);
  1730. X    } else {
  1731. X        text_bound(t, &txmin, &tymin, &txmax, &tymax);
  1732. X    }
  1733. X    if (xmin > txmin || xmax < txmax ||
  1734. X        ymin > tymin || ymax < tymax)
  1735. X        continue;
  1736. X    t->tagged = 1 - t->tagged;
  1737. X    toggle_texthighlight(t);
  1738. X    }
  1739. X}
  1740. X
  1741. Xstatic
  1742. Xget_text(list)
  1743. X    F_text      **list;
  1744. X{
  1745. X    F_text       *text, *t, *tt;
  1746. X
  1747. X    for (t = objects.texts; t != NULL;) {
  1748. X    if (!t->tagged) {
  1749. X        tt = t;
  1750. X        t = t->next;
  1751. X        continue;
  1752. X    }
  1753. X    if (*list == NULL)
  1754. X        *list = t;
  1755. X    else
  1756. X        text->next = t;
  1757. X    text = t;
  1758. X    if (t == objects.texts)
  1759. X        t = objects.texts = objects.texts->next;
  1760. X    else
  1761. X        t = tt->next = t->next;
  1762. X    text->next = NULL;
  1763. X    }
  1764. X}
  1765. X
  1766. Xstatic
  1767. Xsel_compound(xmin, ymin, xmax, ymax)
  1768. X    int            xmin, ymin, xmax, ymax;
  1769. X{
  1770. X    F_compound       *c;
  1771. X
  1772. X    for (c = objects.compounds; c != NULL; c = c->next) {
  1773. X    if (xmin > c->nwcorner.x)
  1774. X        continue;
  1775. X    if (xmax < c->secorner.x)
  1776. X        continue;
  1777. X    if (ymin > c->nwcorner.y)
  1778. X        continue;
  1779. X    if (ymax < c->secorner.y)
  1780. X        continue;
  1781. X    c->tagged = 1 - c->tagged;
  1782. X    toggle_compoundhighlight(c);
  1783. X    }
  1784. X}
  1785. X
  1786. Xstatic
  1787. Xget_compound(list)
  1788. X    F_compound      **list;
  1789. X{
  1790. X    F_compound       *compd, *c, *cc;
  1791. X
  1792. X    for (c = objects.compounds; c != NULL;) {
  1793. X    if (!c->tagged) {
  1794. X        cc = c;
  1795. X        c = c->next;
  1796. X        continue;
  1797. X    }
  1798. X    if (*list == NULL)
  1799. X        *list = c;
  1800. X    else
  1801. X        compd->next = c;
  1802. X    compd = c;
  1803. X    if (c == objects.compounds)
  1804. X        c = objects.compounds = objects.compounds->next;
  1805. X    else
  1806. X        c = cc->next = c->next;
  1807. X    compd->next = NULL;
  1808. X    }
  1809. X}
  1810. END_OF_FILE
  1811. if test 10253 -ne `wc -c <'e_glue.c'`; then
  1812.     echo shar: \"'e_glue.c'\" unpacked with wrong size!
  1813. fi
  1814. # end of 'e_glue.c'
  1815. fi
  1816. if test -f 'w_fontpanel.c' -a "${1}" != "-c" ; then 
  1817.   echo shar: Will not clobber existing file \"'w_fontpanel.c'\"
  1818. else
  1819. echo shar: Extracting \"'w_fontpanel.c'\" \(10064 characters\)
  1820. sed "s/^X//" >'w_fontpanel.c' <<'END_OF_FILE'
  1821. X/*
  1822. X * FIG : Facility for Interactive Generation of figures
  1823. X * Copyright (c) 1991 by Brian V. Smith
  1824. X *
  1825. X * "Permission to use, copy, modify, distribute, and sell this software and its
  1826. X * documentation for any purpose is hereby granted without fee, provided that
  1827. X * the above copyright notice appear in all copies and that both the copyright
  1828. X * notice and this permission notice appear in supporting documentation. 
  1829. X * No representations are made about the suitability of this software for 
  1830. X * any purpose.  It is provided "as is" without express or implied warranty."
  1831. X */
  1832. X
  1833. X#include "fig.h"
  1834. X#include "figx.h"
  1835. X#include "resources.h"
  1836. X#include "u_fonts.h"        /* printer font names */
  1837. X#include "w_setup.h"
  1838. X#include "w_util.h"
  1839. X
  1840. X/********************  global variables     ***************************/
  1841. X
  1842. Xextern char    *psfont_menu_bits[];
  1843. Xextern char    *latexfont_menu_bits[];
  1844. Xextern Pixmap    psfont_menu_bitmaps[];
  1845. Xextern Pixmap    latexfont_menu_bitmaps[];
  1846. Xextern Atom    wm_delete_window;
  1847. Xextern struct _fstruct ps_fontinfo[];    /* font names */
  1848. Xextern struct _fstruct latex_fontinfo[];    /* font names */
  1849. X
  1850. X/* LOCAL VARIABLES */
  1851. X
  1852. Xstatic int     *font_ps_sel;    /* ptr to store selected ps font in */
  1853. Xstatic int     *font_latex_sel; /* ptr to store selected latex font */
  1854. Xstatic int     *flag_sel;    /* pointer to store ps/latex flag */
  1855. Xstatic TOOL    font_widget;    /* widget adr to store font image in */
  1856. Xstatic int    (*font_setimage) ();
  1857. X
  1858. X/********************  local variables    ***************************/
  1859. X
  1860. Xstatic MenuItemRec ps_fontmenu_items[NUM_PS_FONTS + 1];
  1861. Xstatic MenuItemRec latex_fontmenu_items[NUM_LATEX_FONTS];
  1862. X
  1863. Xstatic void    fontpane_select();
  1864. Xstatic void    fontpane_cancel();
  1865. Xstatic void    fontpane_swap();
  1866. X
  1867. Xstatic XtCallbackRec pane_callbacks[] =
  1868. X{
  1869. X    {fontpane_select, NULL},
  1870. X    {NULL, NULL},
  1871. X};
  1872. X
  1873. Xstatic String    fontpane_translations =
  1874. X    "<Message>WM_PROTOCOLS: FontPaneCancel()\n";
  1875. Xstatic XtActionsRec    fontpane_actions[] =
  1876. X{
  1877. X    {"FontPaneCancel", (XtActionProc) fontpane_cancel},
  1878. X};
  1879. X
  1880. Xstatic TOOL    ps_fontpanes, ps_buttons;
  1881. Xstatic TOOL    latex_fontpanes, latex_buttons;
  1882. Xstatic TOOL    ps_fontpane[NUM_PS_FONTS + 1];
  1883. Xstatic TOOL    latex_fontpane[NUM_LATEX_FONTS];
  1884. X
  1885. Xinit_fontmenu(tool)
  1886. X    TOOL        tool;
  1887. X{
  1888. X    TOOL        tmp_but;
  1889. X    register int    i;
  1890. X    register MenuItemRec *mi;
  1891. X    XtTranslations  pane_actions;
  1892. X
  1893. X    DeclareArgs(8);
  1894. X
  1895. X    FirstArg(XtNborderWidth, POPUP_BW);
  1896. X    NextArg(XtNmappedWhenManaged, False);
  1897. X    NextArg(XtNtitle, "Xfig: Font menu");
  1898. X
  1899. X    ps_fontmenu = XtCreatePopupShell("xfig_ps_font_menu",
  1900. X                     transientShellWidgetClass, tool,
  1901. X                     Args, ArgCount);
  1902. X    XtOverrideTranslations(ps_fontmenu,
  1903. X            XtParseTranslationTable(fontpane_translations));
  1904. X    latex_fontmenu = XtCreatePopupShell("xfig_latex_font_menu",
  1905. X                    transientShellWidgetClass, tool,
  1906. X                    Args, ArgCount);
  1907. X    XtOverrideTranslations(latex_fontmenu,
  1908. X            XtParseTranslationTable(fontpane_translations));
  1909. X    XtAppAddActions(tool_app, fontpane_actions, XtNumber(fontpane_actions));
  1910. X
  1911. X    FirstArg(XtNvSpace, -INTERNAL_BW);
  1912. X    NextArg(XtNhSpace, 0);
  1913. X
  1914. X    ps_fontpanes = XtCreateManagedWidget("menu", boxWidgetClass,
  1915. X                     ps_fontmenu, Args, ArgCount);
  1916. X    latex_fontpanes = XtCreateManagedWidget("menu", boxWidgetClass,
  1917. X                        latex_fontmenu, Args, ArgCount);
  1918. X
  1919. X    for (i = 0; i < NUM_PS_FONTS + 1; i++) {
  1920. X    ps_fontmenu_items[i].type = MENU_IMAGESTRING;    /* put the fontnames in
  1921. X                             * menu */
  1922. X    ps_fontmenu_items[i].label = ps_fontinfo[i].name;
  1923. X    ps_fontmenu_items[i].info = (caddr_t) i - 1;    /* index for font # */
  1924. X    }
  1925. X
  1926. X    for (i = 0; i < NUM_LATEX_FONTS; i++) {
  1927. X    latex_fontmenu_items[i].type = MENU_IMAGESTRING;    /* put the fontnames in
  1928. X                                 * menu */
  1929. X    latex_fontmenu_items[i].label = latex_fontinfo[i].name;
  1930. X    latex_fontmenu_items[i].info = (caddr_t) i;    /* index for font # */
  1931. X    }
  1932. X
  1933. X    FirstArg(XtNwidth, PS_FONTPANE_WD);
  1934. X    NextArg(XtNdefaultDistance, INTERNAL_BW);
  1935. X    NextArg(XtNborderWidth, 0);
  1936. X    ps_buttons = XtCreateManagedWidget("buttons", formWidgetClass,
  1937. X                       ps_fontpanes, Args, ArgCount);
  1938. X    latex_buttons = XtCreateManagedWidget("buttons", formWidgetClass,
  1939. X                      latex_fontpanes, Args, ArgCount);
  1940. X
  1941. X    i = (int) ((PS_FONTPANE_WD - INTERNAL_BW) / 3);
  1942. X    FirstArg(XtNwidth, i);
  1943. X    NextArg(XtNborderWidth, 0);
  1944. X    tmp_but = XtCreateManagedWidget("cancel", commandWidgetClass,
  1945. X                    ps_buttons, Args, ArgCount);
  1946. X    XtAddEventHandler(tmp_but, ButtonReleaseMask, (Boolean) 0,
  1947. X              fontpane_cancel, (XtPointer) NULL);
  1948. X
  1949. X    FirstArg(XtNfromHoriz, tmp_but);
  1950. X    NextArg(XtNwidth, PS_FONTPANE_WD - INTERNAL_BW - i);
  1951. X    NextArg(XtNborderWidth, 0);
  1952. X    tmp_but = XtCreateManagedWidget("use_latex_fonts", commandWidgetClass,
  1953. X                    ps_buttons, Args, ArgCount);
  1954. X    XtAddEventHandler(tmp_but, ButtonReleaseMask, (Boolean) 0,
  1955. X              fontpane_swap, (XtPointer) NULL);
  1956. X
  1957. X    FirstArg(XtNwidth, i);
  1958. X    NextArg(XtNborderWidth, 0);
  1959. X    tmp_but = XtCreateManagedWidget("cancel", commandWidgetClass,
  1960. X                    latex_buttons, Args, ArgCount);
  1961. X    XtAddEventHandler(tmp_but, ButtonReleaseMask, (Boolean) 0,
  1962. X              fontpane_cancel, (XtPointer) NULL);
  1963. X
  1964. X    FirstArg(XtNfromHoriz, tmp_but);
  1965. X    NextArg(XtNwidth, PS_FONTPANE_WD - INTERNAL_BW - i);
  1966. X    NextArg(XtNborderWidth, 0);
  1967. X    tmp_but = XtCreateManagedWidget("use_postscript_fonts", commandWidgetClass,
  1968. X                    latex_buttons, Args, ArgCount);
  1969. X    XtAddEventHandler(tmp_but, ButtonReleaseMask, (Boolean) 0,
  1970. X              fontpane_swap, (XtPointer) NULL);
  1971. X
  1972. X    pane_actions = XtParseTranslationTable("<EnterWindow>:set()\n\
  1973. X        <Btn1Up>:notify()unset()\n");
  1974. X
  1975. X    FirstArg(XtNwidth, PS_FONTPANE_WD);
  1976. X    NextArg(XtNheight, PS_FONTPANE_HT);
  1977. X    NextArg(XtNcallback, pane_callbacks);
  1978. X    NextArg(XtNbitmap, NULL);
  1979. X    NextArg(XtNinternalWidth, 0);    /* space between pixmap and edge */
  1980. X    NextArg(XtNinternalHeight, 0);
  1981. X    NextArg(XtNborderWidth, INTERNAL_BW);
  1982. X    NextArg(XtNresize, False);    /* don't allow resize */
  1983. X
  1984. X    for (i = 0; i < NUM_PS_FONTS + 1; ++i) {
  1985. X    mi = &ps_fontmenu_items[i];
  1986. X    pane_callbacks[0].closure = (caddr_t) mi;
  1987. X    ps_fontpane[i] = XtCreateManagedWidget("pane", commandWidgetClass,
  1988. X                           ps_fontpanes, Args, ArgCount);
  1989. X    XtOverrideTranslations(ps_fontpane[i], pane_actions);
  1990. X    }
  1991. X
  1992. X    for (i = 0; i < NUM_LATEX_FONTS; ++i) {
  1993. X    mi = &latex_fontmenu_items[i];
  1994. X    pane_callbacks[0].closure = (caddr_t) mi;
  1995. X    latex_fontpane[i] = XtCreateManagedWidget("pane", commandWidgetClass,
  1996. X                       latex_fontpanes, Args, ArgCount);
  1997. X    XtOverrideTranslations(latex_fontpane[i], pane_actions);
  1998. X    }
  1999. X
  2000. X    return (1);
  2001. X}
  2002. X
  2003. X/* create the bitmaps for the font menu */
  2004. X
  2005. Xsetup_fontmenu()
  2006. X{
  2007. X    register int    i;
  2008. X
  2009. X    DeclareArgs(2);
  2010. X
  2011. X    Pixel        bg, fg;
  2012. X
  2013. X    /* get the foreground/background of the widget */
  2014. X    FirstArg(XtNforeground, &fg);
  2015. X    NextArg(XtNbackground, &bg);
  2016. X    GetValues(ps_fontpane[0]);
  2017. X
  2018. X    /* Create the bitmaps */
  2019. X
  2020. X    for (i = 0; i < NUM_PS_FONTS + 1; i++)
  2021. X    psfont_menu_bitmaps[i] = XCreatePixmapFromBitmapData(tool_d,
  2022. X                   XtWindow(ind_panel), (char *) psfont_menu_bits[i],
  2023. X                     PS_FONTPANE_WD, PS_FONTPANE_HT, fg, bg,
  2024. X                      XDefaultDepthOfScreen(tool_s));
  2025. X
  2026. X    for (i = 0; i < NUM_LATEX_FONTS; i++)
  2027. X    latexfont_menu_bitmaps[i] = XCreatePixmapFromBitmapData(tool_d,
  2028. X                     XtWindow(ind_panel), (char *) latexfont_menu_bits[i],
  2029. X                      LATEX_FONTPANE_WD, LATEX_FONTPANE_HT, fg, bg,
  2030. X                       XDefaultDepthOfScreen(tool_s));
  2031. X
  2032. X    /* Store the bitmaps in the menu panes */
  2033. X    for (i = 0; i < NUM_PS_FONTS + 1; i++) {
  2034. X    FirstArg(XtNbitmap, psfont_menu_bitmaps[i]);
  2035. X    SetValues(ps_fontpane[i]);
  2036. X    }
  2037. X    for (i = 0; i < NUM_LATEX_FONTS; i++) {
  2038. X    FirstArg(XtNbitmap, latexfont_menu_bitmaps[i]);
  2039. X    SetValues(latex_fontpane[i]);
  2040. X    }
  2041. X
  2042. X    FirstArg(XtNbackground, BlackPixelOfScreen(tool_s));
  2043. X    SetValues(ps_buttons);
  2044. X    SetValues(latex_buttons);
  2045. X
  2046. X    XtRealizeWidget(ps_fontmenu);
  2047. X    XtRealizeWidget(latex_fontmenu);
  2048. X    /* at this point the windows are realized but not drawn */
  2049. X    XDefineCursor(tool_d, XtWindow(ps_fontpanes), arrow_cursor);
  2050. X    XDefineCursor(tool_d, XtWindow(latex_fontpanes), arrow_cursor);
  2051. X}
  2052. X
  2053. Xvoid
  2054. Xfontpane_popup(psfont_adr, latexfont_adr, psflag_adr, showfont_fn, show_widget)
  2055. X    int           *psfont_adr, *latexfont_adr, *psflag_adr;
  2056. X    int            (*showfont_fn) ();
  2057. X    Widget        show_widget;
  2058. X
  2059. X{
  2060. X    DeclareArgs(2);
  2061. X    Position        xposn, yposn, dummy;
  2062. X
  2063. X    font_ps_sel = psfont_adr;
  2064. X    font_latex_sel = latexfont_adr;
  2065. X    flag_sel = psflag_adr;
  2066. X    font_setimage = showfont_fn;
  2067. X    font_widget = show_widget;
  2068. X    XtTranslateCoords(show_widget, (Position) 0, (Position) 0, &xposn, &dummy);
  2069. X    XtTranslateCoords(tool, (Position) 0, (Position) 0, &dummy, &yposn);
  2070. X    FirstArg(XtNx, xposn);
  2071. X    NextArg(XtNy, yposn - 20);    /* up a little bit from top of tool */
  2072. X    SetValues(ps_fontmenu);
  2073. X    SetValues(latex_fontmenu);
  2074. X    XtPopup(*flag_sel ? ps_fontmenu : latex_fontmenu, XtGrabExclusive);
  2075. X    XSetWMProtocols(XtDisplay(*flag_sel ? ps_fontmenu : latex_fontmenu),
  2076. X                XtWindow(*flag_sel ? ps_fontmenu : latex_fontmenu),
  2077. X            &wm_delete_window, 1);
  2078. X}
  2079. X
  2080. Xstatic void
  2081. Xfontpane_select(w, closure, call_data)
  2082. X    Widget    w;
  2083. X    XtPointer closure;
  2084. X    XtPointer call_data;
  2085. X{
  2086. X    TOOL        widget = (TOOL) w;
  2087. X    MenuItemRec       *mi = (MenuItemRec *) closure;
  2088. X    char       *font_name = mi->label;
  2089. X
  2090. X    if (*flag_sel)
  2091. X    *font_ps_sel = (int) mi->info;    /* set ps font to one selected */
  2092. X    else
  2093. X    *font_latex_sel = (int) mi->info;    /* set latex font to one
  2094. X                         * selected */
  2095. X    put_msg("Font: %s", font_name);
  2096. X    /* put image of font in indicator window */
  2097. X    (*font_setimage) (font_widget);
  2098. X    XtPopdown(*flag_sel ? ps_fontmenu : latex_fontmenu);
  2099. X}
  2100. X
  2101. Xstatic void
  2102. Xfontpane_cancel()
  2103. X{
  2104. X    XtPopdown(*flag_sel ? ps_fontmenu : latex_fontmenu);
  2105. X}
  2106. X
  2107. Xstatic void
  2108. Xfontpane_swap()
  2109. X{
  2110. X    XtPopdown(*flag_sel ? ps_fontmenu : latex_fontmenu);
  2111. X    *flag_sel = 1 - *flag_sel;
  2112. X    /* put image of font in indicator window */
  2113. X    (*font_setimage) (font_widget);
  2114. X    XtPopup(*flag_sel ? ps_fontmenu : latex_fontmenu, XtGrabExclusive);
  2115. X    XSetWMProtocols(XtDisplay(*flag_sel ? ps_fontmenu : latex_fontmenu),
  2116. X                XtWindow(*flag_sel ? ps_fontmenu : latex_fontmenu),
  2117. X            &wm_delete_window, 1);
  2118. X}
  2119. END_OF_FILE
  2120. if test 10064 -ne `wc -c <'w_fontpanel.c'`; then
  2121.     echo shar: \"'w_fontpanel.c'\" unpacked with wrong size!
  2122. fi
  2123. # end of 'w_fontpanel.c'
  2124. fi
  2125. echo shar: End of archive 8 \(of 27\).
  2126. cp /dev/null ark8isdone
  2127. MISSING=""
  2128. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 ; do
  2129.     if test ! -f ark${I}isdone ; then
  2130.     MISSING="${MISSING} ${I}"
  2131.     fi
  2132. done
  2133. if test "${MISSING}" = "" ; then
  2134.     echo You have unpacked all 27 archives.
  2135.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2136. else
  2137.     echo You still need to unpack the following archives:
  2138.     echo "        " ${MISSING}
  2139. fi
  2140. ##  End of shell archive.
  2141. exit 0
  2142.  
  2143. exit 0 # Just in case...
  2144. -- 
  2145.   // chris@IMD.Sterling.COM       | Send comp.sources.x submissions to:
  2146. \X/  Amiga - The only way to fly! |    sources-x@imd.sterling.com
  2147.  "It's intuitively obvious to the |
  2148.   most casual observer..."        | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
  2149.