v08i018: xfig -- X Drawing Tool, Part09/21
Brian V. Smith
envbvs at epb2.lbl.gov
Wed Jul 4 04:00:33 AEST 1990
Submitted-by: envbvs at epb2.lbl.gov (Brian V. Smith)
Posting-number: Volume 8, Issue 18
Archive-name: xfig2.8/part09
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 9 (of 21)."
# Contents: @figs/watch.fig FORMAT1.4 FORMAT2.0 autoarrow.c flip.c
# Wrapped by envbvs at epb2.lbl.gov on Thu Jun 28 08:52:06 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f '@figs/watch.fig' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'@figs/watch.fig'\"
else
echo shar: Extracting \"'@figs/watch.fig'\" \(9595 characters\)
sed "s/^X//" >'@figs/watch.fig' <<'END_OF_FILE'
X#FIG 2.0
X80 2
X5 1 0 1 0 0 0 0 0.000 0 0 0 194.000 436.000 206 431 207 436 206 441
X5 1 0 1 0 0 0 0 0.000 0 0 0 190.500 436.000 208 430 209 436 208 442
X5 1 0 1 0 0 0 0 0.000 0 0 0 187.000 436.000 212 429 213 436 212 443
X5 1 0 1 0 0 0 0 0.000 1 0 0 205.000 436.000 193 431 192 436 193 441
X5 1 0 1 0 0 0 0 0.000 1 0 0 207.500 436.000 190 430 189 436 190 442
X5 1 0 1 0 0 0 0 0.000 1 0 0 211.000 436.000 187 429 186 436 187 443
X1 4 0 1 0 0 0 0 0.000 1 0.000 240 339 8 8 233 339 248 339
X1 4 0 3 0 0 0 21 0.000 1 0.000 240 339 3 3 238 339 243 339
X1 3 0 1 0 0 0 21 0.000 1 0.000 198 440 2 2 198 440 200 440
X1 3 0 1 0 0 0 21 0.000 1 0.000 252 442 2 2 252 442 254 442
X2 3 0 1 0 0 0 21 0.000 0 0
X 235 328 222 305 223 303 225 303 235 328 9999 9999
X2 4 0 1 0 0 0 0 0.000 5 0 0
X 479 259 479 279 491 279 491 259 479 259 9999 9999
X2 4 0 1 0 0 0 0 0.000 5 0 0
X 479 419 479 439 491 439 491 419 479 419 9999 9999
X2 4 0 1 0 0 0 0 0.000 5 0 0
X 147 419 147 439 159 439 159 419 147 419 9999 9999
X2 1 0 3 0 0 0 0 0.000 0 0
X 354 384 354 389 9999 9999
X2 1 0 3 0 0 0 0 0.000 0 0
X 354 354 354 359 9999 9999
X2 3 0 1 0 0 0 21 0.000 0 0
X 446 377 444 380 444 402 446 405 448 402 448 380 446 377 9999 9999
X2 3 0 1 0 0 0 21 0.000 0 0
X 446 345 444 348 444 370 446 373 448 370 448 348 446 345 9999 9999
X2 3 0 1 0 0 0 21 0.000 0 0
X 446 375 443 373 421 373 418 375 421 377 443 377 446 375 9999 9999
X2 3 0 1 0 0 0 21 0.000 0 0
X 398 405 395 403 373 403 370 405 373 407 395 407 398 405 9999 9999
X2 3 0 1 0 0 0 21 0.000 0 0
X 369 376 367 379 367 401 369 404 371 401 371 379 369 376 9999 9999
X2 3 0 1 0 0 0 21 0.000 0 0
X 399 345 397 348 397 370 399 373 401 370 401 348 399 345 9999 9999
X2 3 0 1 0 0 0 21 0.000 0 0
X 397 344 394 342 372 342 369 344 372 346 394 346 397 344 9999 9999
X2 3 0 1 0 0 0 21 0.000 0 0
X 344 376 342 379 342 401 344 404 346 401 346 379 344 376 9999 9999
X2 3 0 1 0 0 0 21 0.000 0 0
X 344 344 342 347 342 369 344 372 346 369 346 347 344 344 9999 9999
X2 3 0 1 0 0 0 21 0.000 0 0
X 397 374 394 372 372 372 369 374 372 376 394 376 397 374 9999 9999
X2 3 0 1 0 0 0 21 0.000 0 0
X 314 376 312 379 312 401 314 404 316 401 316 379 314 376 9999 9999
X2 3 0 1 0 0 0 21 0.000 0 0
X 314 344 312 347 312 369 314 372 316 369 316 347 314 344 9999 9999
X2 3 0 1 0 0 0 21 0.000 0 0
X 418 345 416 348 416 370 418 373 420 370 420 348 418 345 9999 9999
X2 2 0 1 0 0 0 0 0.000 0 0
X 151 258 151 279 159 279 159 258 151 258 9999 9999
X2 1 0 1 0 0 0 21 0.000 0 0
X 194 339 209 339 9999 9999
X2 1 0 1 0 0 0 21 0.000 0 0
X 289 339 274 339 9999 9999
X2 1 0 1 0 0 0 0 0.000 0 0
X 239 389 239 404 9999 9999
X2 1 0 1 0 0 0 0 0.000 0 0
X 239 264 239 279 9999 9999
X2 3 0 1 0 0 0 21 0.000 0 0
X 248 349 273 377 272 380 269 379 248 349 9999 9999
X2 1 0 2 0 0 0 0 0.000 0 0
X 420 308 433 308 9999 9999
X2 1 0 2 0 0 0 0 0.000 0 0
X 421 286 435 286 9999 9999
X2 1 0 2 0 0 0 0 0.000 0 0
X 423 263 436 263 9999 9999
X2 1 0 2 0 0 0 0 0.000 0 0
X 437 287 435 307 9999 9999
X2 1 0 2 0 0 0 0 0.000 0 0
X 439 264 437 284 9999 9999
X2 1 0 2 0 0 0 0 0.000 0 0
X 419 287 417 307 9999 9999
X2 1 0 2 0 0 0 0 0.000 0 0
X 421 264 419 284 9999 9999
X2 1 0 2 0 0 0 0 0.000 0 0
X 404 287 402 307 9999 9999
X2 1 0 2 0 0 0 0 0.000 0 0
X 406 264 404 284 9999 9999
X2 4 0 1 0 0 0 0 0.000 7 0 0
X 299 254 299 414 454 414 454 254 299 254 9999 9999
X2 4 0 1 0 0 0 0 0.000 7 0 0
X 184 254 184 414 299 414 299 254 184 254 9999 9999
X2 1 0 1 0 0 0 0 0.000 0 0
X 279 419 179 419 9999 9999
X2 2 0 1 0 0 0 0 0.000 0 0
X 324 419 279 419 279 454 324 454 324 419 9999 9999
X2 2 0 1 0 0 0 0 0.000 0 0
X 324 419 369 419 369 454 324 454 324 419 9999 9999
X2 2 0 1 0 0 0 0 0.000 0 0
X 414 419 369 419 369 454 414 454 414 419 9999 9999
X2 1 0 1 0 0 0 0 0.000 0 0
X 459 419 414 419 9999 9999
X2 4 0 2 0 0 0 0 0.000 8 0 0
X 179 249 179 454 459 454 459 249 179 249 9999 9999
X2 1 0 1 0 0 0 0 0.000 0 0
X 254 239 439 239 9999 9999
X2 1 0 1 0 0 0 0 0.000 0 0
X 254 234 439 234 9999 9999
X2 1 0 1 0 0 0 0 0.000 0 0
X 254 229 439 229 9999 9999
X2 1 0 1 0 0 0 0 0.000 0 0
X 254 224 439 224 9999 9999
X2 1 0 1 0 0 0 0 0.000 0 0
X 254 219 439 219 9999 9999
X2 3 0 2 0 0 0 0 0.000 0 0
X 189 214 179 234 184 244 454 244 459 234 449 214 189 214 9999 9999
X2 3 0 2 0 0 0 0 0.000 0 0
X 184 209 169 239 169 459 184 489 454 489 469 459 469 239 454 209 184 209 9999 9999
X2 3 0 3 0 0 0 0 0.000 0 0
X 179 199 159 239 159 459 179 499 459 499 479 459 479 239 459 199 179 199 9999 9999
X2 3 0 1 0 0 0 4 0.000 0 0
X 189 199 189 184 269 184 269 164 289 164 289 184 309 184 309 164 329 164 329 184 349 184 349 164 369 164 369 184 449 184 449 199 189 199 9999 9999
X2 3 0 1 0 0 0 4 0.000 0 0
X 194 179 269 179 269 144 204 144 194 179 9999 9999
X2 3 0 1 0 0 0 4 0.000 0 0
X 269 139 269 104 216 104 206 139 269 139 9999 9999
X2 3 0 1 0 0 0 4 0.000 0 0
X 269 99 269 64 223 64 217 99 269 99 9999 9999
X2 3 0 1 0 0 0 4 0.000 0 0
X 224 59 269 59 269 24 227 24 224 59 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 269 124 269 164 289 164 289 124 269 124 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 289 144 289 184 309 184 309 144 289 144 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 349 4 349 44 369 44 369 4 349 4 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 309 124 309 164 329 164 329 124 309 124 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 289 104 289 144 309 144 309 104 289 104 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 269 84 269 124 289 124 289 84 269 84 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 289 64 289 104 309 104 309 64 289 64 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 309 84 309 124 329 124 329 84 309 84 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 329 144 329 184 349 184 349 144 329 144 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 329 104 329 144 349 144 349 104 329 104 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 349 124 349 164 369 164 369 124 349 124 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 349 84 349 124 369 124 369 84 349 84 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 329 64 329 104 349 104 349 64 329 64 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 309 44 309 84 329 84 329 44 309 44 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 269 44 269 84 289 84 289 44 269 44 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 289 24 289 64 309 64 309 24 289 24 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 269 4 269 44 289 44 289 4 269 4 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 329 24 329 64 349 64 349 24 329 24 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 309 4 309 44 329 44 329 4 309 4 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 349 44 349 84 369 84 369 44 349 44 9999 9999
X2 3 0 1 0 0 0 4 0.000 0 0
X 444 179 369 179 369 144 434 144 444 179 9999 9999
X2 3 0 1 0 0 0 4 0.000 0 0
X 369 139 369 104 422 104 432 139 369 139 9999 9999
X2 3 0 1 0 0 0 4 0.000 0 0
X 369 99 369 64 415 64 421 99 369 99 9999 9999
X2 3 0 1 0 0 0 4 0.000 0 0
X 414 59 369 59 369 24 411 24 414 59 9999 9999
X2 3 0 1 0 0 0 4 0.000 0 0
X 414 639 369 639 369 674 411 674 414 639 9999 9999
X2 3 0 1 0 0 0 4 0.000 0 0
X 369 599 369 634 415 634 421 599 369 599 9999 9999
X2 3 0 1 0 0 0 4 0.000 0 0
X 369 559 369 594 422 594 432 559 369 559 9999 9999
X2 3 0 1 0 0 0 4 0.000 0 0
X 444 519 369 519 369 554 434 554 444 519 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 349 654 349 614 369 614 369 654 349 654 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 309 694 309 654 329 654 329 694 309 694 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 329 674 329 634 349 634 349 674 329 674 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 269 694 269 654 289 654 289 694 269 694 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 289 674 289 634 309 634 309 674 289 674 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 269 654 269 614 289 614 289 654 269 654 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 309 654 309 614 329 614 329 654 309 654 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 329 634 329 594 349 594 349 634 329 634 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 349 614 349 574 369 574 369 614 349 614 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 349 574 349 534 369 534 369 574 349 574 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 329 594 329 554 349 554 349 594 329 594 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 329 554 329 514 349 514 349 554 329 554 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 309 614 309 574 329 574 329 614 309 614 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 289 634 289 594 309 594 309 634 289 634 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 269 614 269 574 289 574 289 614 269 614 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 289 594 289 554 309 554 309 594 289 594 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 309 574 309 534 329 534 329 574 309 574 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 349 694 349 654 369 654 369 694 349 694 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 289 554 289 514 309 514 309 554 289 554 9999 9999
X2 2 0 1 0 0 0 4 0.000 0 0
X 269 574 269 534 289 534 289 574 269 574 9999 9999
X2 3 0 1 0 0 0 4 0.000 0 0
X 224 639 269 639 269 674 227 674 224 639 9999 9999
X2 3 0 1 0 0 0 4 0.000 0 0
X 269 599 269 634 223 634 217 599 269 599 9999 9999
X2 3 0 1 0 0 0 4 0.000 0 0
X 269 559 269 594 216 594 206 559 269 559 9999 9999
X2 3 0 1 0 0 0 4 0.000 0 0
X 194 519 269 519 269 554 204 554 194 519 9999 9999
X2 3 0 1 0 0 0 4 0.000 0 0
X 189 499 189 514 269 514 269 534 289 534 289 514 309 514 309 534 329 534 329 514 349 514 349 534 369 534 369 514 449 514 449 499 189 499 9999 9999
X2 1 0 3 0 0 0 0 0.000 0 0
X 200 432 204 432 9999 9999
X2 1 0 1 0 0 0 21 0.000 0 0
X 200 439 200 432 9999 9999
X2 1 0 1 0 0 0 0 0.000 0 0
X 244 439 246 437 248 430 251 429 9999 9999
X2 1 0 1 0 0 0 0 0.000 0 0
X 259 439 257 437 255 430 252 429 9999 9999
X2 1 0 1 0 0 0 0 0.000 0 0
X 244 439 258 439 9999 9999
X2 1 0 2 0 0 0 0 0.000 0 0
X 252 429 252 427 9999 9999
X4 0 18 14 0 0 0 0.000 1 11 23 319 289 AM
X4 1 18 18 0 0 0 0.000 1 14 60 218 236 CASIO
X4 1 18 14 0 0 0 0.000 1 11 32 436 442 CHR
X4 1 18 14 0 0 0 0.000 1 11 32 393 442 TMR
X4 1 18 14 0 0 0 0.000 1 11 40 347 442 DUAL
X4 1 18 14 0 0 0 0.000 1 11 31 301 442 ALM
END_OF_FILE
echo shar: 6 control characters may be missing from \"'@figs/watch.fig'\"
if test 9595 -ne `wc -c <'@figs/watch.fig'`; then
echo shar: \"'@figs/watch.fig'\" unpacked with wrong size!
fi
# end of '@figs/watch.fig'
fi
if test -f 'FORMAT1.4' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'FORMAT1.4'\"
else
echo shar: Extracting \"'FORMAT1.4'\" \(9377 characters\)
sed "s/^X//" >'FORMAT1.4' <<'END_OF_FILE'
X****** This is the old format 1.4. ******
X
XThe following is the format of fig output (fig 1.4).
X
X(1) The very first line is a comment line containing the name and version:
X #FIG 1.4
X
X The character # at the first column of a line indicates that the line
X is a comment line which will be ignored.
X
X(2) The first non-comment line consists of two numbers :
X
X int fig_resolution (pixels/inch)
X int coordinate_system (1 : origin is at the lower left corner
X 2 : Upper left)
X
X Fig_resolution is the resolution fig is using for the current file.
X It may not be the same as screen resolution (which can be higher or
X lower). I assume that a pixel is square, therefore this number
X represents drawing resolution in both direction. I've experimented
X with fig automatically changing this number according to the resolution
X of the monitor it is running on (The screen resolution, width and height
X in pixels, not pixel/inch, can be done by doing a ioctl on the /dev/fb).
X I've found that for monitors with higher resolution but same size
X (19" diagonal), I preferred using the pixels for other things than
X having fig occupying most of the screen. Thus I opted for a fixed
X pixel-per-inch number which make fig window smaller on higher resolution
X monitor (than the standard sun monitor). This however may change in
X the future version.
X
X(3) The rest of the file contains various objects. An object can be one
X of six classes (or types).
X
X i) Arc.
X ii) Ellipse which is a generalization of circle.
X iii) Polyline which includes polygon and box.
X iv) Spline which includes closed/open control/interpolated spline.
X v) Text.
X vi) Compound object which is composed of one or more objects.
X
X In the following elaboration on object formats, every value of fig
X output are separated by blank characters or new line ('\n'). The
X value of the not-used parameters will be -1.
X
X A number of values are described as unused or not applicable to some
X object even though they are defined for those objects. These value
X will (hopefully) be used in the future version of fig. The intention
X of their uses are the following.
X
X Value Usage
X ----- -----
X area_fill The stipple pattern (which will be align) for
X filling object internals. For example, an filled
X arc will look like a piece of pie.
X
X pen This will be a structure defining the shape of
X pen used in drawing objects. It also includes
X the the stipple pattern for line filling.
X The default pen is a circular pen with black
X filling.
X
X thickness Every pen has the thickness of one.
X Thickness scales the size of a pen.
X
X depth This value adds a half dimension to fig.
X It is useful when we have overlapping filled
X objects and we want one to obliterate another.
X An object can have only one depth (including
X compound object). An object that is in less
X depth can obscure the one with greater depth
X if they overlap.
X
X line_style Only polyline (including polygon and box) can
X be rendered with dashed line. However the
X objects created when the dash-line mode was on
X will be recorded as such. Currently the filter
X f2ps (1) is able to render the desired line style
X effect on hard copy. Three line styles are defined.
X
X 0 : SOLID_LINE
X 1 : DASH_LINE
X 2 : DOTTED_LINE
X
X style_val For dash style, it is the length of a dash.
X For dotted line it indicates the approximated
X gap of consecutive dots.
X
X (3.1) ARC
X
X First line :
X type name (brief description)
X ---- ---- -------------------
X int object_code (always 5)
X int sub_type (always 1)
X int line_style (See the end of this section)
X int line_thickness (pixels, not used)
X int color (not used)
X int depth (not used)
X int pen (not used)
X int area_fill (not used)
X float style_val (pixels, not used)
X int direction (0 : clockwise, 1 : counterclockwise)
X int forward_arrow (0: no forward arrow, 1: on)
X int backward_arrow (0: no forward arrow, 1: on)
X float center_x, center_y (center of the arc)
X int x1, y1 (pixels, the 1st point the user entered)
X int x2, y2 (pixels, the 2nd point)
X int x3, y3 (pixels, the last point)
X
X Forward arrow line (Optional; absent if forward_arrow is 0) :
X type name (brief description)
X ---- ---- -------------------
X int arrow_type (not used)
X int arrow_style (not used)
X int arrow_thickness (not used)
X int arrow_width (pixels)
X int arrow_height (pixels)
X
X Backward arrow line (Optional; absent if backward_arrow is 0) :
X type name (brief description)
X ---- ---- -------------------
X int arrow_type (not used)
X int arrow_style (not used)
X int arrow_thickness (not used)
X int arrow_width (pixels)
X int arrow_height (pixels)
X
X (3.2) COMPOUND
X
X A line with object code 6 signifies the start of a compound.
X There are four more numbers on this line which indicate the
X upper right corner and the lower left corner of the bounding
X box of this compound. A line with object code -6 signifies
X the end of the compound. Compound may be nested.
X
X First line :
X type name (brief description)
X ---- ---- -------------------
X int object_code (always 6)
X int upperright_corner_x (pixels)
X int upperright_corner_y (pixels)
X int lowerleft_corner_x (pixels)
X int lowerleft_corner_y (pixels)
X
X Subsequent lines :
X objects
X .
X .
X
X Last line :
X -6
X
X (3.3) ELLIPSE
X
X First line :
X type name (brief description)
X ---- ---- -------------------
X int object_code (always 1)
X int sub_type (1 : ellipse defined by radiuses
X 2 : ellipse defined by diameters
X 3 : circle defined by radius
X 4 : circle defined by diameter)
X int line_style (See the end of this section)
X int thickness (pixels, not used)
X int color (not used)
X int depth (not used)
X int pen (not used)
X int area_fill (not used)
X float style_val (pixels, not used)
X int direction (always 1)
X float angle (radian, the angle of the x-axis)
X int center_x, center_y (pixels)
X int radius_x, radius_y (pixels)
X int start_x, start_y (pixels; the 1st point entered)
X int end_x, end_y (pixels; the last point entered)
X
X (3.4) POLYLINE
X
X First line :
X type name (brief description)
X ---- ---- -------------------
X int object_code (always 1)
X int sub_type (1 : polyline, 2 : box, 3 : polygon)
X int line_style (See the end of this section)
X int thickness (pixels, not used)
X int color (not used)
X int depth (not used)
X int pen (not used)
X int area_fill (not used)
X float style_val (pixels)
X int forward_arrow (0: off, 1: on)
X int backward_arrow (0: off, 1: on)
X
X Forward arrow line : same as ARC object
X
X Backward arrow line : same as ARC object
X
X Points line :
X type name (brief description)
X ---- ---- -------------------
X int x1, y1 (pixels)
X int x2, y2 (pixels)
X .
X .
X int xn, yn (this will be the same as the 1st
X point for polygon and box)
X int x, y (always 9999, 9999; marks the end of
X point for polygon and box)
X
X (3.5) SPLINE
X
X First line :
X type name (brief description)
X ---- ---- -------------------
X int object_code (always 1)
X int sub_type (1 : open spline
X 2 : closed spline
X 3 : open interpolated spline
X 4 : closed interpolated spline)
X int line_style (See the end of this section)
X int thickness (pixels, not used)
X int color (not used)
X int depth (not used)
X int pen (not used)
X int area_fill (not used)
X float style_val (pixels, not used)
X int forward_arrow (0: off, 1: on)
X int backward_arrow (0: off, 1: on)
X
X Forward arrow line : same as ARC object
X
X Backward arrow line : same as ARC object
X
X Points line : same as POLYLINE object
X
X Control points line (absent if sub_type is 1 or 2) :
X Control points of interpolated spline. There are two control
X points for each knots. A section i, of the spline is drawn
X using Bezier cubic with the following four points:
X (x ,y ), (rx ,ry ), (lx , ly ), (x , y ).
X i i i i i+1 i+1 i+1 i+1
X For closed interpolated spline the last pair of control points,
X (lxn,lyn) and (rxn,ryn) (which can be ignored), are the same as
X (lx1,ly1) and (rx1,ry1) respectively.
X
X type name (brief description)
X ---- ---- -------------------
X float lx1, ly1 (pixels)
X float rx1, ry1 (pixels)
X float lx2, ly2 (pixels)
X float rx2, ry2 (pixels)
X .
X .
X float lxn, lyn (pixels)
X float rxn, ryn (pixels)
X
X (3.6) TEXT
X type name (brief description)
X ---- ---- -------------------
X int object (always 4)
X int sub_type (0 : Left justified
X 1 : Center justified
X 2 : Right justified)
X int font (not used)
X int font_size (not used)
X int pen (not used)
X int color (not used)
X int depth (not used)
X int angle (radian, not used, the angle of the
X the base line of the string)
X int font_style (not used)
X int height (pixels)
X int length (pixels)
X int x, y (pixels, coordinate of the origin
X of the string. If sub_type = 0, it is
X the lower left corner of the string.
X If sub_type = 1, it is the lower
X center. Otherwise it is the lower
X right corner of the string.)
X char string[] (ascii characters; starts after a blank
X character following the last number and
X ends before the character '\1'. This
X character is not part of the string.
X Note that the string may contain '\n'.)
END_OF_FILE
if test 9377 -ne `wc -c <'FORMAT1.4'`; then
echo shar: \"'FORMAT1.4'\" unpacked with wrong size!
fi
# end of 'FORMAT1.4'
fi
if test -f 'FORMAT2.0' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'FORMAT2.0'\"
else
echo shar: Extracting \"'FORMAT2.0'\" \(9404 characters\)
sed "s/^X//" >'FORMAT2.0' <<'END_OF_FILE'
XThe following is the format of fig output for Protocol version 2.0:
X
X(1) The very first line is a comment line containing the name and version:
X #FIG 2.0
X
X The character # at the first column of a line indicates that the line
X is a comment line which will be ignored.
X
X(2) The first non-comment line consists of two numbers :
X
X int fig_resolution (pixels/inch)
X int coordinate_system (1 : origin is at the lower left corner
X 2 : Upper left)
X
X Fig_resolution is the resolution fig is using for the current file.
X It may not be the same as screen resolution (which can be higher or
X lower). I assume that a pixel is square, therefore this number
X represents drawing resolution in both direction. I've experimented
X with fig automatically changing this number according to the resolution
X of the monitor it is running on (The screen resolution, width and height
X in pixels, not pixel/inch, can be done by doing a ioctl on the /dev/fb).
X I've found that for monitors with higher resolution but same size
X (19" diagonal), I preferred using the pixels for other things than
X having fig occupying most of the screen. Thus I opted for a fixed
X pixel-per-inch number which make fig window smaller on higher resolution
X monitor (than the standard sun monitor). This however may change in
X the future version.
X
X(3) The rest of the file contains various objects. An object can be one
X of six classes (or types).
X
X i) Ellipse which is a generalization of circle.
X ii) Polyline which includes polygon and box.
X iii) Spline which includes closed/open control/interpolated spline.
X iv) Text.
X v) Arc.
X vi) Compound object which is composed of one or more objects.
X
X In the following elaboration on object formats, every value of fig
X output are separated by blank characters or new line ('\n'). The
X value of the not-used parameters will be -1.
X
X A number of values are described as unused or not applicable to some
X object even though they are defined for those objects. These value
X will (hopefully) be used in the future version of fig. The intention
X of their uses are the following.
X
X Value Usage
X ----- -----
X area_fill The gray color for filling object internals.
X Non-TFX:(gray color; 0=no fill,1=white,21=black)
X TFX: (gray color; 0=no fill,1=black, 5=white)
X
X pen This will be a structure defining the shape of
X pen used in drawing objects. It also includes
X the the stipple pattern for line filling.
X The default pen is a circular pen with black
X filling.
X
X thickness Every pen has the thickness of one.
X Thickness scales the size of a pen.
X
X depth This value adds a half dimension to fig.
X It is useful when we have overlapping filled
X objects and we want one to obliterate another.
X An object can have only one depth (including
X compound object). An object that is in less
X depth can obscure the one with greater depth
X if they overlap.
X
X style Three line styles are defined.
X
X 0 : SOLID_LINE
X 1 : DASH_LINE
X 2 : DOTTED_LINE
X
X style_val For dash style, it is the length of a dash.
X For dotted line it indicates the approximated
X gap of consecutive dots.
X
X radius For rounded-corner boxes, this is the radius of
X the corners.
X
X (3.1) ELLIPSE
X
X First line :
X type name (brief description)
X ---- ---- -------------------
X int object_code (always 1)
X int sub_type (1 : ellipse defined by radiuses
X 2 : ellipse defined by diameters
X 3 : circle defined by radius
X 4 : circle defined by diameter)
X int style (See the end of this section)
X int thickness (pixels, not used)
X int color (not used)
X int depth (not used)
X int pen (not used)
X int area_fill (gray color)
X float style_val (pixels, not used)
X int direction (always 1)
X float angle (radian, the angle of the x-axis)
X int center_x, center_y (pixels)
X int radius_x, radius_y (pixels)
X int start_x, start_y (pixels; the 1st point entered)
X int end_x, end_y (pixels; the last point entered)
X
X (3.2) POLYLINE
X
X First line :
X type name (brief description)
X ---- ---- -------------------
X int object_code (always 2)
X int sub_type (1 : polyline, 2 : box,
X 3 : polygon, 4 : rounded-corner box)
X int style (See the end of this section)
X int thickness (pixels, not used)
X int color (not used)
X int depth (not used)
X int pen (not used)
X int area_fill * (gray color)
X float style_val (pixels)
X int radius ** (pixels, radius of rounded-corner boxes)
X int forward_arrow (0: off, 1: on)
X int backward_arrow (0: off, 1: on)
X
X* Fill only available for box, polygon and rounded-corner box, not polyline.
X** This component exists only in rounded-corner box object.
X
X Forward arrow line : same as ARC object
X
X Backward arrow line : same as ARC object
X
X Points line :
X type name (brief description)
X ---- ---- -------------------
X int x1, y1 (pixels)
X int x2, y2 (pixels)
X .
X .
X int xn, yn (this will be the same as the 1st
X point for polygon and box)
X int x, y (always 9999, 9999; marks the end of
X point for polygon and box)
X
X (3.3) SPLINE
X
X First line :
X type name (brief description)
X ---- ---- -------------------
X int object_code (always 3)
X int sub_type (0 : open spline
X 1 : closed spline
X 2 : open interpolated spline
X 3 : closed interpolated spline)
X int style (See the end of this section)
X int thickness (pixels, not used)
X int color (not used)
X int depth (not used)
X int pen (not used)
X int area_fill (gray color)
X float style_val (pixels, not used)
X int forward_arrow (0: off, 1: on)
X int backward_arrow (0: off, 1: on)
X
X Forward arrow line : same as ARC object
X
X Backward arrow line : same as ARC object
X
X Points line : same as POLYLINE object
X
X Control points line (absent if sub_type is 1 or 2) :
X Control points of interpolated spline. There are two control
X points for each knots. A section i, of the spline is drawn
X using Bezier cubic with the following four points:
X (x ,y ), (rx ,ry ), (lx , ly ), (x , y ).
X i i i i i+1 i+1 i+1 i+1
X For closed interpolated spline the last pair of control points,
X (lxn,lyn) and (rxn,ryn) (which can be ignored), are the same as
X (lx1,ly1) and (rx1,ry1) respectively.
X
X type name (brief description)
X ---- ---- -------------------
X float lx1, ly1 (pixels)
X float rx1, ry1 (pixels)
X float lx2, ly2 (pixels)
X float rx2, ry2 (pixels)
X .
X .
X float lxn, lyn (pixels)
X float rxn, ryn (pixels)
X
X (3.4) TEXT
X type name (brief description)
X ---- ---- -------------------
X int object (always 4)
X int sub_type (0 : Left justified
X 1 : Center justified
X 2 : Right justified)
X int font (font number 0-...)
X int font_size (point size)
X int pen (not used)
X int color (not used)
X int depth (not used)
X float angle (radian, not used, the angle of the
X the base line of the string)
X int font_style (not used)
X int height (pixels)
X int length (pixels)
X int x, y (pixels, coordinate of the origin
X of the string. If sub_type = 0, it is
X the lower left corner of the string.
X If sub_type = 1, it is the lower
X center. Otherwise it is the lower
X right corner of the string.)
X char string[] (ascii characters; starts after a blank
X character following the last number and
X ends before the character '\1'. This
X character is not part of the string.
X Note that the string may contain '\n'.)
X (3.5) ARC
X
X First line :
X type name (brief description)
X ---- ---- -------------------
X int object_code (always 5)
X int sub_type (always 1)
X int style (See the end of this section)
X int line_thickness (pixels, not used)
X int color (not used)
X int depth (not used)
X int pen (not used)
X int area_fill (gray color)
X float style_val (pixels, not used)
X int direction (0 : clockwise, 1 : counterclockwise)
X int forward_arrow (0: no forward arrow, 1: on)
X int backward_arrow (0: no forward arrow, 1: on)
X float center_x, center_y (center of the arc)
X int x1, y1 (pixels, the 1st point the user entered)
X int x2, y2 (pixels, the 2nd point)
X int x3, y3 (pixels, the last point)
X
X Forward arrow line (Optional; absent if forward_arrow is 0) :
X type name (brief description)
X ---- ---- -------------------
X int arrow_type (not used)
X int arrow_style (not used)
X float arrow_thickness (not used)
X float arrow_width (pixels)
X float arrow_height (pixels)
X
X Backward arrow line (Optional; absent if backward_arrow is 0) :
X type name (brief description)
X ---- ---- -------------------
X int arrow_type (not used)
X int arrow_style (not used)
X float arrow_thickness (not used)
X float arrow_width (pixels)
X float arrow_height (pixels)
X
X (3.6) COMPOUND
X
X A line with object code 6 signifies the start of a compound.
X There are four more numbers on this line which indicate the
X upper right corner and the lower left corner of the bounding
X box of this compound. A line with object code -6 signifies
X the end of the compound. Compound may be nested.
X
X First line :
X type name (brief description)
X ---- ---- -------------------
X int object_code (always 6)
X int upperright_corner_x (pixels)
X int upperright_corner_y (pixels)
X int lowerleft_corner_x (pixels)
X int lowerleft_corner_y (pixels)
X
X Subsequent lines :
X objects
X .
X .
X
X Last line :
X -6
X
X
END_OF_FILE
if test 9404 -ne `wc -c <'FORMAT2.0'`; then
echo shar: \"'FORMAT2.0'\" unpacked with wrong size!
fi
# end of 'FORMAT2.0'
fi
if test -f 'autoarrow.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'autoarrow.c'\"
else
echo shar: Extracting \"'autoarrow.c'\" \(9299 characters\)
sed "s/^X//" >'autoarrow.c' <<'END_OF_FILE'
X/*
X * FIG : Facility for Interactive Generation of figures
X *
X * Copyright (c) 1985 by Supoj Sutanthavibul (supoj at sally.UTEXAS.EDU)
X * January 1985.
X * 1st revision : Aug 1985.
X *
X * %W% %G%
X*/
X#include "fig.h"
X#include "resources.h"
X#include "func.h"
X#include "object.h"
X#include "paintop.h"
X
X#define TOLERANCE 7
X
Xextern (*canvas_kbd_proc)();
Xextern (*canvas_locmove_proc)();
Xextern (*canvas_leftbut_proc)();
Xextern (*canvas_middlebut_proc)();
Xextern (*canvas_rightbut_proc)();
Xextern null_proc();
Xextern set_popupmenu();
Xextern F_line *line_point_search();
Xextern F_spline *spline_point_search();
Xextern F_arc *arc_point_search();
Xextern F_arrow *forward_arrow(), *backward_arrow();
X
Xextern int foreground_color, background_color;
Xextern int pointmarker_shown;
X
XF_point *selected_point, *left_point;
Xint arcpoint_num;
Xextern int add_arrow_head();
Xextern int delete_arrow_head();
X
X#define round(x) ((int) (x + .5))
X
Xarrow_head_selected()
X{
X canvas_kbd_proc = null_proc;
X canvas_locmove_proc = null_proc;
X canvas_leftbut_proc = add_arrow_head;
X canvas_middlebut_proc = delete_arrow_head;
X canvas_rightbut_proc = set_popupmenu;
X set_cursor(&pick9_cursor);
X }
X
Xadd_arrow_head(x, y)
Xint x, y;
X{
X F_line *line;
X F_spline *spline;
X F_arc *arc;
X
X if ((line = line_point_search(x, y, TOLERANCE,
X &left_point, &selected_point)) != NULL) {
X add_linearrow(line);
X }
X else if ((spline = spline_point_search(x, y,
X TOLERANCE, &left_point, &selected_point)) != NULL){
X add_splinearrow(spline);
X }
X else if ((arc = arc_point_search(x, y, TOLERANCE,
X &arcpoint_num)) != NULL) {
X add_arcarrow(arc);
X }
X else
X return;
X
X set_modifiedflag();
X }
X
Xdelete_arrow_head(x, y)
Xint x, y;
X{
X F_line *line;
X F_spline *spline;
X F_arc *arc;
X
X if ((line = line_point_search(x, y, TOLERANCE,
X &left_point, &selected_point)) != NULL) {
X delete_linearrow(line);
X }
X else if ((spline = spline_point_search(x, y,
X TOLERANCE, &left_point, &selected_point)) != NULL){
X delete_splinearrow(spline);
X }
X else if ((arc = arc_point_search(x, y, TOLERANCE,
X &arcpoint_num)) != NULL) {
X delete_arcarrow(arc);
X }
X else
X return;
X
X set_modifiedflag();
X }
X
Xadd_linearrow(line)
XF_line *line;
X{
X F_point *p;
X
X if (line->type == T_POLYGON
X || line->type == T_BOX || line->type == T_ARC_BOX)
X return;
X if (line->points->next == NULL) return; /* A single point line */
X
X if (left_point == NULL) { /* selected_point is the first point */
X if (line->back_arrow) return;
X p = selected_point->next;
X line->back_arrow = backward_arrow();
X if (pointmarker_shown) toggle_linepointmarker(line);
X draw_arrow(p->x, p->y, selected_point->x, selected_point->y,
X line->back_arrow, PAINT);
X if (pointmarker_shown) toggle_linepointmarker(line);
X }
X else if (selected_point->next == NULL) { /* forward arrow */
X if (line->for_arrow) return;
X line->for_arrow = forward_arrow();
X if (pointmarker_shown) toggle_linepointmarker(line);
X draw_arrow(left_point->x, left_point->y,
X selected_point->x, selected_point->y,
X line->for_arrow, PAINT);
X if (pointmarker_shown) toggle_linepointmarker(line);
X }
X clean_up();
X set_action_object(F_ADD_ARROW_HEAD, O_POLYLINE);
X }
X
Xadd_arcarrow(arc)
XF_arc *arc;
X{
X
X if (arcpoint_num == 0) { /* backward arrow */
X if (arc->back_arrow) return;
X arc->back_arrow = backward_arrow();
X if (pointmarker_shown) toggle_arcpointmarker(arc);
X draw_arcarrow(arc, foreground_color);
X if (pointmarker_shown) toggle_arcpointmarker(arc);
X }
X else if (arcpoint_num == 2) { /* for_arrow */
X if (arc->for_arrow) return;
X arc->for_arrow = forward_arrow();
X if (pointmarker_shown) toggle_arcpointmarker(arc);
X draw_arcarrow(arc, foreground_color);
X if (pointmarker_shown) toggle_arcpointmarker(arc);
X }
X clean_up();
X set_action_object(F_ADD_ARROW_HEAD, O_ARC);
X }
X
Xadd_splinearrow(spline)
XF_spline *spline;
X{
X F_point *p;
X F_control *c;
X
X if (closed_spline(spline)) return;
X if (left_point == NULL) { /* add backward arrow */
X if (spline->back_arrow) return;
X p = selected_point->next;
X spline->back_arrow = backward_arrow();
X if (pointmarker_shown) toggle_splinepointmarker(spline);
X if (normal_spline(spline)) {
X draw_arrow(p->x, p->y, selected_point->x,
X selected_point->y, spline->back_arrow, PAINT);
X }
X else {
X c = spline->controls;
X draw_arrow(round(c->rx), round(c->ry), selected_point->x,
X selected_point->y, spline->back_arrow, PAINT);
X }
X if (pointmarker_shown) toggle_splinepointmarker(spline);
X }
X else if (selected_point->next == NULL) { /* add forward arrow */
X if (spline->for_arrow) return;
X spline->for_arrow = forward_arrow();
X if (pointmarker_shown) toggle_splinepointmarker(spline);
X if (normal_spline(spline)) {
X draw_arrow(left_point->x, left_point->y,
X selected_point->x, selected_point->y,
X spline->for_arrow, PAINT);
X }
X else {
X for (c = spline->controls; c->next != NULL; c = c->next);
X draw_arrow(round(c->lx), round(c->ly), selected_point->x,
X selected_point->y, spline->for_arrow, PAINT);
X }
X if (pointmarker_shown) toggle_splinepointmarker(spline);
X }
X clean_up();
X set_action_object(F_ADD_ARROW_HEAD, O_SPLINE);
X }
X
Xdelete_linearrow(line)
XF_line *line;
X{
X if (line->type == T_POLYGON
X || line->type == T_BOX || line->type == T_ARC_BOX)
X return;
X
X if (left_point == NULL) { /* selected_point is the first point */
X if (! line->back_arrow) return;
X if (pointmarker_shown) toggle_linepointmarker(line);
X draw_line(line, INV_PAINT);
X free((char*)line->back_arrow);
X line->back_arrow = NULL;
X draw_line(line, PAINT);
X if (pointmarker_shown) toggle_linepointmarker(line);
X }
X else if (selected_point->next == NULL) { /* forward arrow */
X if (! line->for_arrow) return;
X if (pointmarker_shown) toggle_linepointmarker(line);
X draw_line(line, INV_PAINT);
X free((char*)line->for_arrow);
X line->for_arrow = NULL;
X draw_line(line, PAINT);
X if (pointmarker_shown) toggle_linepointmarker(line);
X }
X clean_up();
X set_action_object(F_DELETE_ARROW_HEAD, O_POLYLINE);
X }
X
Xdelete_arcarrow(arc)
XF_arc *arc;
X{
X if (arcpoint_num == 0) { /* backward arrow */
X if (! arc->back_arrow) return;
X if (pointmarker_shown) toggle_arcpointmarker(arc);
X draw_arc(arc, background_color);
X free((char*)arc->back_arrow);
X arc->back_arrow = NULL;
X draw_arc(arc, foreground_color);
X if (pointmarker_shown) toggle_arcpointmarker(arc);
X }
X else if (arcpoint_num == 2) { /* for_arrow */
X if (! arc->for_arrow) return;
X if (pointmarker_shown) toggle_arcpointmarker(arc);
X draw_arc(arc, background_color);
X free((char*)arc->for_arrow);
X arc->for_arrow = NULL;
X draw_arc(arc, foreground_color);
X if (pointmarker_shown) toggle_arcpointmarker(arc);
X }
X clean_up();
X set_action_object(F_DELETE_ARROW_HEAD, O_ARC);
X }
X
Xdelete_splinearrow(spline)
XF_spline *spline;
X{
X F_point *p;
X
X if (closed_spline(spline)) return;
X if (left_point == NULL) { /* selected_point is the first point */
X if (! spline->back_arrow) return;
X if (pointmarker_shown) toggle_splinepointmarker(spline);
X p = selected_point->next;
X if (normal_spline(spline)) {
X draw_arrow(p->x, p->y, selected_point->x,
X selected_point->y, spline->back_arrow, ERASE);
X pw_vector(canvas_win, selected_point->x, selected_point->y,
X round((p->x+selected_point->x)/2.0),
X round((p->y+selected_point->y)/2.0), PAINT,
X spline->thickness, spline->style, spline->style_val);
X }
X else {
X F_control *a, *b;
X
X a = spline->controls;
X b = a->next;
X draw_arrow(round(a->rx), round(a->ry), selected_point->x,
X selected_point->y, spline->back_arrow, ERASE);
X bezier_spline(
X (float)selected_point->x, (float)selected_point->y,
X a->rx, a->ry, b->lx, b->ly, (float)p->x, (float)p->y,
X PAINT,spline->thickness, spline->style, spline->style_val);
X }
X free((char*)spline->back_arrow);
X spline->back_arrow = NULL;
X if (pointmarker_shown) toggle_splinepointmarker(spline);
X }
X else if (selected_point->next == NULL) { /* forward arrow */
X if (! spline->for_arrow) return;
X if (pointmarker_shown) toggle_splinepointmarker(spline);
X if (normal_spline(spline)) {
X draw_arrow(left_point->x, left_point->y,
X selected_point->x, selected_point->y,
X spline->for_arrow, ERASE);
X pw_vector(canvas_win, selected_point->x, selected_point->y,
X round((selected_point->x+left_point->x)/2.0),
X round((selected_point->y+left_point->y)/2.0),
X PAINT, spline->thickness, spline->style, spline->style_val);
X }
X else {
X F_control *a, *b;
X
X a = spline->controls;
X for (b = a->next; b->next != NULL; a = b, b = b->next);
X draw_arrow(round(b->lx), round(b->ly), selected_point->x,
X selected_point->y, spline->for_arrow, ERASE);
X bezier_spline(
X (float)left_point->x, (float)left_point->y,
X a->rx, a->ry, b->lx, b->ly,
X (float)selected_point->x, (float)selected_point->y,
X PAINT,spline->thickness, spline->style, spline->style_val);
X }
X free((char*)spline->for_arrow);
X spline->for_arrow = NULL;
X if (pointmarker_shown) toggle_splinepointmarker(spline);
X }
X clean_up();
X set_action_object(F_DELETE_ARROW_HEAD, O_SPLINE);
X }
END_OF_FILE
if test 9299 -ne `wc -c <'autoarrow.c'`; then
echo shar: \"'autoarrow.c'\" unpacked with wrong size!
fi
# end of 'autoarrow.c'
fi
if test -f 'flip.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'flip.c'\"
else
echo shar: Extracting \"'flip.c'\" \(9477 characters\)
sed "s/^X//" >'flip.c' <<'END_OF_FILE'
X/*
X * FIG : Facility for Interactive Generation of figures
X *
X * Copyright (c) 1985 by Supoj Sutanthavibul (supoj at sally.UTEXAS.EDU)
X * January 1985.
X * 1st revision : Aug 1985.
X *
X * %W% %G%
X*/
X#include "fig.h"
X#include "resources.h"
X#include "func.h"
X#include "object.h"
X#include "paintop.h"
X
X#define TOLERANCE 7
X#define min(a, b) (((a) < (b)) ? (a) : (b))
X#define max(a, b) (((a) > (b)) ? (a) : (b))
X
Xextern (*canvas_kbd_proc)();
Xextern (*canvas_locmove_proc)();
Xextern (*canvas_leftbut_proc)();
Xextern (*canvas_middlebut_proc)();
Xextern (*canvas_rightbut_proc)();
Xextern null_proc();
Xextern set_popupmenu();
X
Xextern F_line *line_search(), *copy_line();
Xextern F_ellipse *ellipse_search(), *copy_ellipse();
Xextern F_ellipse *ellipse_point_search();
Xextern F_text *copy_text();
Xextern F_spline *spline_search(), *copy_spline();
Xextern F_arc *arc_point_search(), *copy_arc();
Xextern F_compound *compound_search(), *copy_compound();
X
Xextern F_compound objects;
X
Xextern int flip_axis;
Xextern int pointmarker_shown;
Xextern int foreground_color, background_color;
X
Xstatic int copy;
Xextern int init_flip();
Xextern int init_copynflip();
X
Xflip_selected()
X{
X canvas_kbd_proc = null_proc;
X canvas_locmove_proc = null_proc;
X canvas_leftbut_proc = init_copynflip;
X canvas_middlebut_proc = init_flip;
X canvas_rightbut_proc = set_popupmenu;
X set_cursor(&pick15_cursor);
X }
X
Xinit_flip(x, y)
Xint x, y;
X{
X copy = 0;
X flip_search(x, y);
X flip_selected();
X }
X
Xinit_copynflip(x, y)
Xint x, y;
X{
X copy = 1;
X flip_search(x, y);
X flip_selected();
X }
X
Xflip_search(x, y)
Xint x, y;
X{
X F_line *l;
X F_arc *a;
X F_ellipse *e;
X F_spline *s;
X F_compound *c;
X int px, py;
X
X if ((l = line_search(x, y, TOLERANCE, &px, &py)) != NULL) {
X init_flipline(l, px, py);
X }
X else if ((a = arc_point_search(x, y, TOLERANCE, &px)) != NULL) {
X init_fliparc(a, a->point[px].x, a->point[px].y);
X }
X else if ((e = ellipse_point_search(x, y, TOLERANCE, &px)) != NULL) {
X if (px == 0) /* start point */
X init_flipellipse(e, e->start.x, e->start.y);
X else
X init_flipellipse(e, e->end.x, e->end.y);
X }
X else if ((e = ellipse_search(x, y, TOLERANCE, &px, &py)) != NULL) {
X init_flipellipse(e, px, py);
X }
X else if ((s = spline_search(x, y, TOLERANCE, &px, &py)) != NULL) {
X init_flipspline(s, px, py);
X }
X else if ((c = compound_search(x, y, TOLERANCE, &px, &py)) != NULL) {
X init_flipcompound(c, px, py);
X }
X set_modifiedflag();
X }
X
Xinit_fliparc(a, px, py)
XF_arc *a;
Xint px, py;
X{
X F_arc *arc;
X
X win_setmouseposition(canvas_win, px, py);
X if (pointmarker_shown) toggle_arcpointmarker(a);
X if (copy) {
X arc = copy_arc(a);
X flip_arc(arc, px, py, flip_axis);
X clean_up();
X set_action_object(F_CREATE, O_ARC);
X insert_arc(&objects.arcs, arc);
X }
X else {
X draw_arc(a, background_color);
X flip_arc(a, px, py, flip_axis);
X clean_up();
X set_action_object(F_FLIP, O_ARC);
X set_lastaxis(flip_axis);
X set_lastposition(px, py);
X arc = a;
X }
X draw_arc(arc, foreground_color);
X if (pointmarker_shown) {
X toggle_arcpointmarker(arc);
X if (copy) toggle_arcpointmarker(a);
X }
X set_latestarc(arc);
X }
X
Xinit_flipcompound(c, px, py)
XF_compound *c;
Xint px, py;
X{
X F_compound *compound;
X
X win_setmouseposition(canvas_win, px, py);
X set_temp_cursor(&wait_cursor);
X if (copy) {
X compound = copy_compound(c);
X flip_compound(compound, px, py, flip_axis);
X clean_up();
X set_action_object(F_CREATE, O_COMPOUND);
X insert_compound(&objects.compounds, compound);
X }
X else {
X draw_compoundbox(c, INV_PAINT);
X erase_compound(c);
X flip_compound(c, px, py, flip_axis);
X clean_up();
X set_action_object(F_FLIP, O_COMPOUND);
X set_lastaxis(flip_axis);
X set_lastposition(px, py);
X compound = c;
X }
X draw_compoundbox(compound, INV_PAINT);
X draw_compound(compound);
X set_latestcompound(compound);
X set_temp_cursor(cur_cursor);
X }
X
Xinit_flipellipse(e, px, py)
XF_ellipse *e;
X{
X F_ellipse *ellipse;
X
X win_setmouseposition(canvas_win, px, py);
X if (pointmarker_shown) toggle_ellipsepointmarker(e);
X if (copy) {
X ellipse = copy_ellipse(e);
X flip_ellipse(ellipse, px, py, flip_axis);
X clean_up();
X set_action_object(F_CREATE, O_ELLIPSE);
X insert_ellipse(&objects.ellipses, ellipse);
X }
X else {
X draw_ellipse(e, background_color);
X flip_ellipse(e, px, py, flip_axis);
X clean_up();
X set_action_object(F_FLIP, O_ELLIPSE);
X set_lastaxis(flip_axis);
X set_lastposition(px, py);
X ellipse = e;
X }
X draw_ellipse(ellipse, foreground_color);
X if (pointmarker_shown) {
X toggle_ellipsepointmarker(ellipse);
X if (copy) toggle_ellipsepointmarker(e);
X }
X set_latestellipse(ellipse);
X }
X
Xinit_flipline(l, px, py)
XF_line *l;
Xint px, py;
X{
X F_line *line;
X
X win_setmouseposition(canvas_win, px, py);
X if (pointmarker_shown) toggle_linepointmarker(l);
X if (copy) {
X line = copy_line(l);
X flip_line(line, px, py, flip_axis);
X clean_up();
X set_action_object(F_CREATE, O_POLYLINE);
X insert_line(&objects.lines, line);
X }
X else {
X draw_line(l, ERASE);
X flip_line(l, px, py, flip_axis);
X clean_up();
X set_action_object(F_FLIP, O_POLYLINE);
X set_lastaxis(flip_axis);
X set_lastposition(px, py);
X line = l;
X }
X draw_line(line, PAINT);
X if (pointmarker_shown) {
X toggle_linepointmarker(line);
X if (copy) toggle_linepointmarker(l);
X }
X set_latestline(line);
X }
X
Xinit_flipspline(s, px, py)
XF_spline *s;
Xint px, py;
X{
X F_spline *spline;
X
X win_setmouseposition(canvas_win, px, py);
X if (pointmarker_shown) toggle_splinepointmarker(s);
X if (copy) {
X spline = copy_spline(s);
X flip_spline(spline, px, py, flip_axis);
X clean_up();
X set_action_object(F_CREATE, O_SPLINE);
X insert_spline(&objects.splines, spline);
X }
X else { /* delete the original */
X draw_spline(s, ERASE);
X flip_spline(s, px, py, flip_axis);
X clean_up();
X set_action_object(F_FLIP, O_SPLINE);
X set_lastaxis(flip_axis);
X set_lastposition(px, py);
X spline = s;
X }
X draw_spline(spline, PAINT);
X if (pointmarker_shown) {
X toggle_splinepointmarker(spline);
X if (copy) toggle_splinepointmarker(s);
X }
X set_latestspline(spline);
X }
X
Xflip_line(l, x, y, flip_axis)
XF_line *l;
Xint x, y, flip_axis;
X{
X F_point *p;
X
X switch(flip_axis) {
X case 1 : /* x axis */
X for (p = l->points; p != NULL; p = p->next)
X p->y = y + (y - p->y);
X break;
X case 2 : /* y axis */
X for (p = l->points; p != NULL; p = p->next)
X p->x = x + (x - p->x);
X break;
X }
X }
X
Xflip_spline(s, x, y, flip_axis)
XF_spline *s;
Xint x, y, flip_axis;
X{
X F_point *p;
X F_control *cp;
X
X switch(flip_axis) {
X case 1 : /* x axis */
X for (p = s->points; p != NULL; p = p->next)
X p->y = y + (y - p->y);
X for (cp = s->controls; cp != NULL; cp = cp->next) {
X cp->ly = y + (y - cp->ly);
X cp->ry = y + (y - cp->ry);
X }
X break;
X case 2 : /* y axis */
X for (p = s->points; p != NULL; p = p->next)
X p->x = x + (x - p->x);
X for (cp = s->controls; cp != NULL; cp = cp->next) {
X cp->lx = x + (x - cp->lx);
X cp->rx = x + (x - cp->rx);
X }
X break;
X }
X }
X
Xflip_text(t, x, y, flip_axis)
XF_text *t;
Xint x, y, flip_axis;
X{
X switch(flip_axis) {
X case 1 : /* x axis */
X t->base_y = y + (y - t->base_y);
X break;
X case 2 : /* y axis */
X t->base_x = x + (x - t->base_x);
X break;
X }
X }
X
Xflip_ellipse(e, x, y, flip_axis)
XF_ellipse *e;
Xint x, y, flip_axis;
X{
X switch(flip_axis) {
X case 1 : /* x axis */
X e->direction ^= 1;
X e->center.y = y + (y - e->center.y);
X e->start.y = y + (y - e->start.y);
X e->end.y = y + (y - e->end.y);
X break;
X case 2 : /* y axis */
X e->direction ^= 1;
X e->center.x = x + (x - e->center.x);
X e->start.x = x + (x - e->start.x);
X e->end.x = x + (x - e->end.x);
X break;
X }
X }
X
Xflip_arc(a, x, y, flip_axis)
XF_arc *a;
Xint x, y, flip_axis;
X{
X switch(flip_axis) {
X case 1 : /* x axis */
X a->direction ^= 1;
X a->center.y = y + (y - a->center.y);
X a->point[0].y = y + (y - a->point[0].y);
X a->point[1].y = y + (y - a->point[1].y);
X a->point[2].y = y + (y - a->point[2].y);
X break;
X case 2 : /* y axis */
X a->direction ^= 1;
X a->center.x = x + (x - a->center.x);
X a->point[0].x = x + (x - a->point[0].x);
X a->point[1].x = x + (x - a->point[1].x);
X a->point[2].x = x + (x - a->point[2].x);
X break;
X }
X }
X
Xflip_compound(c, x, y, flip_axis)
XF_compound *c;
Xint x, y, flip_axis;
X{
X F_line *l;
X F_arc *a;
X F_ellipse *e;
X F_spline *s;
X F_text *t;
X F_compound *c1;
X int p, q;
X
X switch(flip_axis) {
X case 1 : /* x axis */
X p = y + (y - c->nwcorner.y);
X q = y + (y - c->secorner.y);
X c->nwcorner.y = min(p, q);
X c->secorner.y = max(p, q);
X break;
X case 2 : /* y axis */
X p = x + (x - c->nwcorner.x);
X q = x + (x - c->secorner.x);
X c->nwcorner.x = min(p, q);
X c->secorner.x = max(p, q);
X break;
X }
X for (l = c->lines; l != NULL; l = l->next)
X flip_line(l, x, y, flip_axis);
X for (a = c->arcs; a != NULL; a = a->next)
X flip_arc(a, x, y, flip_axis);
X for (e = c->ellipses; e != NULL; e = e->next)
X flip_ellipse(e, x, y, flip_axis);
X for (s = c->splines; s != NULL; s = s->next)
X flip_spline(s, x, y, flip_axis);
X for (t = c->texts; t != NULL; t = t->next)
X flip_text(t, x, y, flip_axis);
X for (c1 = c->compounds; c1 != NULL; c1 = c1->next)
X flip_compound(c1, x, y, flip_axis);
X }
END_OF_FILE
if test 9477 -ne `wc -c <'flip.c'`; then
echo shar: \"'flip.c'\" unpacked with wrong size!
fi
# end of 'flip.c'
fi
echo shar: End of archive 9 \(of 21\).
cp /dev/null ark9isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 21 archives.
rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0
dan
----------------------------------------------------
O'Reilly && Associates argv at sun.com / argv at ora.com
Opinions expressed reflect those of the author only.
More information about the Comp.sources.x
mailing list