home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-05-26 | 61.4 KB | 1,832 lines |
- Newsgroups: comp.sources.x
- From: envbvs@epb9.lbl.gov (Brian V. Smith)
- Subject: v19i129: xfig - Draw amd manipulate objects in an X-Window, Part17/27
- Message-ID: <1993May21.021624.6813@sparky.imd.sterling.com>
- X-Md4-Signature: 621e4680aa05f4fb879911b2fafbe33c
- Sender: chris@sparky.imd.sterling.com (Chris Olson)
- Organization: Sterling Software
- Date: Fri, 21 May 1993 02:16:24 GMT
- Approved: chris@sparky.imd.sterling.com
-
- Submitted-by: envbvs@epb9.lbl.gov (Brian V. Smith)
- Posting-number: Volume 19, Issue 129
- Archive-name: xfig/part17
- Environment: X11
- Supersedes: xfig: Volume 16, Issue 6-30,39
-
- #! /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 17 (of 27)."
- # Contents: CHANGES f_read.c
- # Wrapped by envbvs@epb9.lbl.gov.lbl.gov on Mon May 3 12:06:01 1993
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'CHANGES' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'CHANGES'\"
- else
- echo shar: Extracting \"'CHANGES'\" \(30300 characters\)
- sed "s/^X//" >'CHANGES' <<'END_OF_FILE'
- XVersion 2.1
- X===========
- X
- XPatchlevel 7 (May 3, 1993)
- XChanges to Patchlevel 6:
- X
- XNEW FEATURES:
- X
- Xo Vertical and upside-down text - text with angles of 90, 180 and 270 degrees
- X supported. Text between those angles will be drawn with the next
- X higher angle (e.g. 130 degree text will be drawn at 180 degrees).
- X from Alan Richardson (mppa3@uk.ac.sussex.syma)
- Xo message panel uses asciiTextWidget so one may select text from it
- Xo does not ask if it is OK to write an existing file during save if it is the
- X current figure file that is being saved. Same for export.
- Xo accelerators to Save or Load file without popping up file menu
- X (default: Meta-S to Save and Meta-L to Load)
- Xo PRINTER environment variable is used if no resource is set for
- X Fig*printer*string
- Xo if an ellipse is scaled such that the radii become equal it is "converted"
- X to a circle
- Xo ablity to change to/from imperial and metric with popup menu by hitting
- X mouse button 3 in the units box (where rulers meet)
- X from Paul King (king@cs.uq.oz.au)
- Xo new command-line parameters -userscale (resource userscale) and -userunit
- X (resource userunit) which are used in the on-screen messages which
- X show the current length/diameter etc. This provides a simple way of
- X doing scale drawings, e.g. 0.25 inch = 1 ft (userscale=0.25,
- X userunit="ft") or 1 cm = 1 m (userscale=1, userunit="m"). These may
- X be changed via the popup menu by hitting mouse button 3 in the units
- X box (where rulers meet)
- Xo new indicator button allows text flags to be viewed/set
- Xo compiles/runs on DEC Alpha with OSF/1 now
- Xo text widget in the print popup to pass extra parameters to print program
- X (lp or lpr as the case may be)
- Xo indicator shows the number of figures in the batch print file in print popup
- Xo automatic on-screen generation of preview bitmap for EPS objects if you have
- X gs (ghostscript) - compile with -DGSBIT flag
- X from Michael C. Grant (mcgrant@rascals.stanford.edu)
- X adapted from
- X Marc Goldburg's (marcg@rascals.stanford.edu) original idea and code.
- Xo indicator in upper-left corner (under Quit button) shows current filename
- Xo print button changes message from "print FIGURE to printer" to "print BATCH to
- X printer" if there are figures in batch file
- Xo when drawing objects or moving/adding points the length/radius/diameter is
- X displayed in the message window
- Xo feature to shift figure on page if it is off the page has been disabled until
- X it can be done with option or explicit command
- Xo added -noscalablefonts command-line option to force scalable fonts OFF
- X (usually for debugging)
- X
- XBUG FIXES:
- X
- Xo condition for OSF/1 added to use dirent
- X from Dave Hill (ddhill@zk2.dec.com)
- Xo Floating point values allowed for BoundingBox in EPS files
- Xo if user asks for scalable fonts but server doesn't support them, xfig auto-
- X matically switches to non-scalable fonts
- Xo when printing to batch file, incorrect filename appeared in message panel
- Xo undo of a text move didn't redraw the text
- Xo <unistd.h> included unnecessarily in f_util.c (X11/Xos.h includes it if
- X necessary). Also, various cleanups with multiply defined cursors etc.
- X From Casey Leedom (casey@gauss.llnl.gov)
- Xo internalborderwidth resource should be integer not float
- Xo cancel when drawing latex line left unwanted garbage on screen
- Xo put_fmsg removed and put_msg uses varargs now so MIPS machines and others
- X should all work fine now
- Xo writing X11 bitmap still had bugs
- Xo text wasn't being rotated around mouse point with rotate mode
- Xo when moving end points of a (sp)line or when adding points to the end
- X of a (sp)line, the angle geometry button was not available
- Xo export directory now follows file directory when load/save figure is done
- Xo entering centered text with odd number of characters caused double image
- Xo fixed bug with incorrectly placing text with point positioning on when the
- X text was originally created with point positioning off
- Xo when moving centered or right-justified zoomed text grab point was shifted
- Xo rotated ellipses panned incorrectly
- Xo centering/flush-left options in Export menu were reversed
- Xo flipped EPS objects weren't being flipped properly when reading in figure
- Xo GC's weren't being freed when xfig finished
- Xo added Titan OS (Stardent) to list of machines needing getenv() and atof()
- X explicitely defined (not in /usr/include/... file )
- X from Joachim Wiesel (wiesel@ipf.bau-verm.uni-karlsruhe.de)
- Xo underscores weren't showing in text line in popup edit
- X from Daniel Faigin (faigin@aero.org)
- Xo old text outline wasn't being erased
- X from Daniel Faigin (faigin@aero.org)
- Xo number[] array wasn't large enough for new 3-character numbers in the rulers
- X from Andrew Haylett (ajh@gec-mrc.co.uk)
- Xo check for X_NOT_STDC_ENV reversed in fig.h for inclusion of stdlib.h and
- X defs of getenv() and atof()
- X from Jonathan Kamens (jik@pit-manager.mit.edu)
- Xo SetDir() parameters added (but not used) to placate certain compilers
- Xo point positioning resolution wasn't available with add-point-in-object
- Xo angle geometry indicator appeared when moving/adding points but isn't used
- Xo problem fixed with file popup and grab
- X from David Brooke (BROOKE@leva.leeds.ac.uk)
- X
- X------------------------------------------------------------------------------
- XPatchlevel 6 (Nov 1992)
- XChanges to Patchlevel 5:
- X
- XNEW FEATURES:
- X
- XBUG FIXES:
- X
- Xo typo in man pages with menu item "Textyl \special commands" in export menu
- Xo action changed from "cancel" to "dismiss" for print menu accelerator
- Xo bug in Intrinsics? on Sun Monochrome prevented side ruler from scrolling
- Xo was using ellipse routine to draw circles - was choppy for small circles
- Xo cast comparison function argument to qsort
- Xo rotated ellipses don't become coarse as they are zoomed
- X
- X------------------------------------------------------------------------------
- XPatchlevel 5 (Nov 1992)
- XChanges to Patchlevel 4:
- X
- XNEW FEATURES:
- X
- Xo support for two button mouse - use META + Button 3 to simulate button 2
- X from Lars Berntzon (lasse@delila.cgl.se)
- Xo new resource "textoutline" (class "TextOutline") and command-line argument
- X "-textoutline" which will outline text in red to show the bounding box
- X that the text will occupy when printed (useful for rotated text)
- Xo print popup stays up until dismissed - can still pop up file/export menues,
- X draw etc. while print popup is up. HOWEVER, while file or export
- X popups are up, the print panel is not active.
- Xo can align all objects to canvas, not just to compound - use mouse button 2
- X idea from Jon Forrest
- Xo ellipses may now be rotated by an arbitrary angle and show their rotation
- X from Janes Tough (jamest@cs.heriot-watt.ac.uk)
- Xo new -iconGeometry command-line argument
- Xo new command-line argument and resource -exportLanguage to specify default
- X Export language. See man pages.
- Xo new command-line argument and resource -flushleft to set default printing to
- X flush left on page. See man pages.
- Xo keyboard accelerators! Resource file has defaults for file, export and print
- X popup panels and top command panel accelerators; <Meta>f will popup file
- X panel, <Meta>q will quit, etc. See resource file and man pages for
- X details.
- Xo one may now batch together several xfig files for printing with one print job.
- X See popup print panel and man pages.
- Xo new label in the mouse function window & more obvious default color (yellow)
- Xo added scrollbar for indicator panel when buttons won't all fit on screen
- Xo can now edit sizes of arrowheads using popup edit panel
- Xo "make install" now automatically installs Fig.ad and Fig-color.ad in
- X app-defaults directory
- Xo WM_DELETE_WINDOW now supported by popups - cancels popup function
- X WM_DELETE_WINDOW in main canvas saves figure in xfig.SAVE and quits
- X from David Wexelblat (dwex@mtgzfs3.att.com)
- X
- XBUG FIXES:
- X
- Xo rulers only allowed 2 digits for inches/cm
- Xo deleted line thickness/color/area-fill/line-style and arrow settings for EPS
- X objects in the update mode and removed color part in popup edit panel
- Xo depth wasn't being updated for splines and texts using update button
- Xo more cleanup with respect to procedure/variable types/casts
- X from Don Sharp (dws@mari.co.uk)
- Xo fixed text bounds calculation to take into account any rotation when reading
- X in figure from a file to decide whether to shift figure to keep on
- X canvas
- X (fig2dev 2.1.5 is also fixed so figures with rotated text near edges
- X should center properly now)
- Xo fixed bug where segments disappeared while drawing interpolated spline in any
- X LaTeX drawing mode
- Xo rearranged a-z and A-Z keys in the CompKeyDB file because some HP computers
- X were apparently doing random things with capitalization
- X from Anthony Shipman (als@bohra.cpg.oz.au)
- Xo fixed export of color figure to X11 bitmap format. White -> white, all other
- X colors -> black.
- Xo removed apparently unnecessary translation from w_export, w_file and w_print
- X which causes coredump on some HP machines.
- X From Alfred van der Hoeven (alfred@arthur.et.tudelft.nl)
- Xo fixed initialization bug in u_undo.c and object.c which caused HP 9000/700
- X compilers to segfault
- X From Alfred van der Hoeven (alfred@arthur.et.tudelft.nl)
- Xo new environvemt variable "XFIGTMPDIR" used for xfig temporary files directory
- Xo when reading a figure file, if any object coordinates are negative, the figure
- X is shifted to keep it on the canvas so that the upper-left corner of the
- X figure is placed on the current point positioning grid
- X (in 2.1.4, the upper-left corner was placed at 10,10)
- Xo changed "char" to "unsigned char" for initialization of bitmaps by compilers
- X from Teus Hagen (teus@oce.nl)
- Xo was passing floats to put_fmsg() instead of doubles.
- Xo includes copy of X11/Xfuncs.h now to use correct routines for zeroing/copying
- X memory.
- Xo zooming to 0.1 no longer gives X error (dash list was null)
- Xo filenames in File/Export windows weren't sorted correctly
- X from Simon Marshall (S.Marshall@sequent.cc.hull.ac.uk)
- Xo more explicit note about object depth in the man pages in the "GRAPHICAL
- X OBJECTS" section
- Xo scaling vertical or horizontal line no longer causes floating point exception
- X from Steve Tynor (tynor@prism.gatech.edu)
- Xo null strings in text objects now produce warning message when reading from
- X file but xfig continues to read rest of file
- Xo scrollbars in File and Export popups reset to top when changing directories
- Xo default output filename in Export popup now changes to reflect current
- X figure filename
- Xo default colors in Fig-color are a little nicer :-)
- Xo checking for file writablity now uses access() call
- X from Devon Bowen (bowen@cs.buffalo.edu)
- Xo XtRemoveGrab bug when popping down file message window finally fixed
- X many thanks to David Wexelblat (dwex@mtgzfs3.att.com)
- Xo XtAppAddActions() only called once now for each action
- X from David Wexelblat (dwex@mtgzfs3.att.com)
- Xo changed cfree() calls to free() for those machines that don't have it
- X from Anthony Datri (datri@concave.convex.com)
- Xo moved static function definitions outside of procedures for those machines
- X which can't handle them
- X from Anthony Datri (datri@concave.convex.com)
- Xo added second line to Imakefile to put the xfig directory containing the
- X CompKeyDB (multi-key) database file in the standard X11 library
- Xo fixed bug introduced in 2.1.1 which incorrectly placed radius marker of
- X circles created by radius
- Xo circle is now changed to ellipse type when scaled assymetrically
- Xo fixed various typos in xfig.man
- Xo changed references to mouse buttons left/middle/right to say buttons 1/2/3
- X respectively
- Xo radius of ellipses-specified-by-radius was one pixel too large
- Xo changed interpretation of 1/0 bits in EPS preview bitmaps back to original
- X 0=white, 1=black according to EPSF guide version 2.0.
- X Brought to my attention by Vivek Khera (khera@cs.duke.edu)
- Xo moved #include Xaw... directives to figx.h to speed up compilation
- Xo added conditional for Sun 3 and SunOs 4.0.3
- X from Peter Scott (pjs@euclid.jpl.nasa.gov)
- Xo fixed typo in FORMAT2.1 file describing values for types of splines
- Xo more lint cleanup and print file name "protection" in case filename has
- X any shell meta characters
- X from Jonathan Kamens (jik@MIT.Edu)
- Xo epsf file wasn't closed after reading if there was no preview bitmap
- X from Herve Poirier (rvp@dxcern.cern.ch)
- Xo fixed bug where certain objects inside compound weren't being drawn when
- X there was more than one compound object in the figure
- Xo removed ISO8859 requirement for Symbol and ZapfDingbats fonts (those fonts
- X weren't being displayed)
- X
- X------------------------------------------------------------------------------
- XPatchlevel 4 (April 1992)
- XChanges to Patchlevel 3:
- X
- Xo keyFile resource allows ANY path for compose key data base, not just relative
- X to $XFIGLIBDIR
- X from Pete Kaiser (kaiser@heron.enet.dec.com)
- Xo simple edit arrowhead feature in the popup edit for lines - can add/delete
- X arrow heads. No adjustment of arrow size yet - uses current linewidth
- X from indicator panel
- Xo Example figure files have all been converted to 2.1 file format
- Xo if any object coordinates are negative, the whole figure is shifted to keep it
- X on the canvas
- Xo fixed major bug where the preview bitmap of EPS objects was in reverse video
- X (1 is white not black, according to the PostScript Language Ref. Manual)
- X *** SEE COMMENT IN PATCHLEVEL 5 ABOUT EPSI PREVIEW BITMAPS ***
- Xo general cleanup of param types in Xt callback/action etc. procedures and other
- X lint cleanup
- X from Jonathan Kamens (jik@MIT.Edu)
- Xo Alt_L key added to list of keys to do international characters
- X from Marc Goldburg (marcg@alfalfa.stanford.edu)
- Xo fractional zoom (i.e. zoom < 1) - see man pages
- Xo eps data wasn't being initialized when the eps file wasn't available
- Xo redefined filename length for eps object to PATH_MAX
- Xo -showallbuttons option didn't show the depth indicator
- X from Paul King (king@cs.uq.oz.au)
- Xo fixed bugs where using export and print shortcut before ever popping
- X up respective menus used incorrect options
- Xo changes to the file popup:
- X o new "Home" button changes directory to $HOME
- X o ~ (username) operator allowed in the current directory ascii widget
- X o new label widget shows the current figure filename
- X o presssing "Load", "Save" or "Merge Read" will operate on the
- X filename in the "Filename" window. If that name is empty the
- X operation is done on the file specified in the "Current Filename"
- X window.
- X o additionally, the "Load" operation will copy the name (if any)
- X from the "Filename" window to the "Current Filename" window
- X o pressing return in the "list of files" window in the popup File panel
- X will "Load" the file
- Xo changes to the export popup:
- X o new "Home" button changes directory to $HOME
- X o ~ (username) operator allowed in the current directory ascii widget
- X o pressing return in the "list of files" window in the popup Export
- X panel will "Export" the file
- Xo Pre-2.1 fig files now have text flags set to PostScript mode when reading into
- X xfig 2.1.4
- Xo 1.4-TFX fig files now have text flags set to PostScript mode PLUS Special
- Xo font names now include "ISO-8859" to insure that ISO Latin characters are used
- X from Thierry EXCOFFIER (exco@ligiahp.univ-lyon1.fr)
- Xo -debug no longer runs xfig synchronously - use standard toolkit option -sync
- Xo control points for spline objects now span multiple lines in output file if
- X there are many points
- Xo scrollable x-y points panel in the popup edit panel for objects with many
- X points (mwm didn't display the x-y values when the popup was taller than
- X the screen)
- Xo If you have Display Postscript in your server, compile xfig with -DDPS
- X and you will see the full Postscript object instead of preview bitmap
- X when you include EPS objects.
- X !!! WARNING: this has only been tested on IBM's AIX 3.2 (X11R4) on
- X an RS/6000 !!!
- X from Dave Hale (dhale@green.mines.colorado.edu)
- Xo fixed bug in error return from system() - now popups error message when
- X can't export/print figure
- Xo unused function clear_char_string() deleted from w_canvas.c
- Xo current depth is now in an indicator window and may be set like line
- X thickness, color etc.
- Xo added update tags to control which object components are modified/copied
- X when using the update button. Button appears in upper-right corner
- X of indicator button (e.g linewidth) when in update mode. Clicking
- X on the update tag enables/disables components (e.g. linewidth) from
- X being copied to/from objects when using update.
- Xo fixed exporting of pstex_t and pstex (used to give Postscript for both)
- Xo FIG 1.4-TFX file area_fill values now correctly translated to 2.1 format
- Xo deleted duplicate #include <math.h> from u_geom.c and w_export.c
- Xo changed ^U (control U) in w_canvas.c to \023 for mailers which clobber
- X control chars
- Xo added possibility of wider top ruler and taller side ruler by using
- X -DMAX_TOPRULER_WD=value and -DMAX_SIDERULER_HT=value in Imakefile
- Xo added function strtol() for those systems that don't have it.
- X from Jonathan Kamens (jik@pit-manager.MIT.EDU)
- Xo added note about -DNOSTRSTR and -DNOSTRTOL for those systems that don't
- X have strstr() and/or strtol() respectively.
- Xo fixed type mismatch and bug in call to getenv in main().
- Xo type mismatch fixed for X11R5 in call to XtAppInitialize().
- X from Jonathan Kamens (jik@pit-manager.MIT.EDU)
- Xo small performance fix in u_draw.c in add_point() when reallocating points
- X from Dave Hale (dhale@green.Mines.Colorado.EDU)
- X
- X------------------------------------------------------------------------------
- XPatchlevel 3
- XChanges to Patchlevel 2:
- X
- Xo pressing carriage return in value part of popup indicator buttons that take
- X integer or float (e.g. line width) now sets the value and pops down
- Xo added foreground colors to Text*, Menu* and List* widgets in default Fig-color.ad
- X this fixes problem of white-on-white text when using inverse video
- Xo changes two resource names -
- X "xfig_export_menu.export_panel.just_label.flush left" to
- X "xfig_export_menu.export_panel.just_label.justify"
- X and
- X "xfig_print_menu.print_panel.just_label.flush left" to
- X "xfig_print_menu.print_panel.just_label.justify"
- Xo some type castings fixed
- X from Wayne D Richardson (wdr@rchland.vnet.ibm.com)
- Xo fixed "open file leak" - directory wasn't closed after file popup finished
- Xo fixed selection of Times-Roman font under Openwindows
- Xo changed titles of popup panels to meaningful names
- Xo leading blanks no longer stripped from text objects
- X from George Ferguson (ferguson@cs.rochester.edu)
- Xo null strings in text objects now abort load/read of file with error message
- X from George Ferguson (ferguson@cs.rochester.edu)
- Xo conditional in xfig.man to set page offset only when using troff
- X from George Ferguson (ferguson@cs.rochester.edu)
- Xo added translation so that pressing return in filename window in popup FILE
- X will load the file
- Xo added translation so that pressing return in filename window in popup EXPORT
- X will export the file
- Xo fixed filled objects of DEFAULT color
- Xo fixed bug in delete region
- X from Peter Asenstorfer (peter@audrey.levels.unisa.edu.au)
- Xo cleaned up cursor stuff - no impact on user
- X from Brian Boyter (pyrdc!bimbo!boyter@uunet.UU.NET)
- Xo new resource "-keyFile" to specify alternate compose key translation
- X file in the XFIGLIBDIR directory
- X From Herve Soulard (soulard@corto.inria.fr)
- Xo popup message window to inform user when illegal values in figure file
- X are fixed or when converting from older file versions to newest
- Xo limit on depth of objects to 1000 when reading figure file. Fixes problems
- X of infinite looping for files which were converted from Fig 2.0.
- X Also sets depth to zero (0) when reading files older than 2.1.
- Xo xfig.man now tells man to run tbl so that regular tables can be used
- X from James B. Davis (james@solbourne.com)
- Xo fixed Meta-Y (insert current selection), ^Y (unkill) and ^G (multiply reset)
- X in CompKeyDB
- Xo added capability to delete whole text line from text widgets with ^X
- X from Brian Boyter (pyrdc!bimbo!boyter@uunet.UU.NET)
- Xo ^U no longer deletes line of text in text object mode for compatibility
- X with text widgets. Use only ^X now.
- Xo fixed problem with OpenWindows and rubberbanding objects
- X from Brian Boyter (pyrdc!bimbo!boyter@uunet.UU.NET)
- Xo fixed minor bug in f_util.c line 82: assignment with '==' instead of '='
- X from pf@diab.se (Per Fogelstr|m)
- Xo fixed up bug in set_tags call in w_modepanel.c
- X from Graeme Gill (graeme@labtam.labtam.oz.au)
- Xo added strstr() function for systems without it
- Xo warning message about redefining InstallManPage fixed
- Xo removed unneeded O_NONE symbol from object.h
- Xo directory code fixed to work with SVR4
- X from David Elliot (dce@krusty.smsc.sony.com)
- Xo cleaned up function declarations for event handlers
- X from Anthony Datri (datri@lovecraft.convex.com)
- Xo renamed Fig-co.ad to Fig-color.ad for color customization under X11R5 (see
- X README). Fig-co.ad can be deleted (if you have an older copy of xfig)
- X from David Elliot (dce@krusty.smsc.sony.com)
- X
- X------------------------------------------------------------------------------
- XPatchlevel 2
- XChanges to Patchlevel 1:
- X
- Xo the font flag (LaTeX, PostScript) wasn't being changed correctly in the
- X UPDATE text object operation when switching from LaTeX to PostScript
- X or vice versa.
- X
- Xo the textstep value may now be entered in floating point in the popup menu
- X
- Xo the eps-bitmap icon was renamed to eps-object because it can be any
- X eps object that is imported. If it has a preview bitmap
- X that will be displayed. Several filenames/program variables
- X were also changed to reflect this.
- X
- Xo there is now a more general glue mechanism for compounding objects
- X
- Xo text pasting into canvas now possible with F18 function key or any translation
- X desired by user. F18 is hardwired default in program; F20 also
- X programmed in Fig.ad to paste text.
- X Brian Boyter (pyrdc!bimbo!boyter@uunet.UU.NET)
- X
- Xo DEFAULT fill_style caused core dump
- X from Jeffry R. Abramson (jra@violin.att.com)
- X
- Xo made the mouse-tracking markers hollow so as not to be visually obtrusive
- X as suggested by Stephen Gildea (gildea@expo.lcs.mit.edu)
- X
- Xo removed extraneous call to free() in add_point() (u_draw.c)
- X from Per Fogelstr|m (pf@diab.se)
- X
- Xo cleaned up gcc compiler warnings about type mismatches etc.
- X
- Xo compound objects may be rotated by arbitrary angles if there are no boxes,
- X arc-boxes, ellipses or circles contained within.
- X
- Xo text rotation support is improved - markers are now shown rotated and
- X the angle attribute is set by the relevant rotate operations.
- X
- Xo both ps and eps modes now supported in export menu.
- X
- Xo new directory browsing facilities integrated with File and Export popups.
- X Allows selection of file by clicking on the filename. Has mask to list
- X only those files of interest. See the man pages for further details.
- X
- Xo Default font for Postscript fonts may now be selected and objects that
- X have default font may be edited
- X
- Xo FASTSERVER flag removed; now always uses smart redrawing when available
- X Additionally, smart redrawing is available more often
- X
- Xo fixed bug in regular polygon where some vertices were off by one pixel
- X
- Xo added "Use orig. size" button for eps objects to set object to original
- X size in popup edit
- X from Peter Scott (pjs@euclid.jpl.nasa.gov)
- X
- Xo international characters supported (umlauts, accents, cedilla etc) using
- X compose (meta) key
- X from Herve Soulard (soulard@corto.inria.fr)
- X
- Xo much improved color support
- X from Henning Spruth (hns@regent.e-technik.tu-muenchen.de)
- X
- Xo additional pan and zoom mode with <Ctrl>Key and left/middle/right button
- X from Henning Spruth (hns@regent.e-technik.tu-muenchen.de)
- X
- Xo removed reference to FONTLIBDIR in Imakefile (no longer required)
- X
- Xo added a smart-links feature for the MOVE and COPY commands.
- X With smart links turned on, when a BOX-like object is moved
- X so are the lines which join up to it (its links).
- X Two modes are supported: one which moves just the endpoint,
- X the other slides the endlink so that it's angle doesn't change.
- X In the second mode horizontal/vertical lines remain that way.
- X
- Xo added the ability to save figure during quit if it is modified
- X
- Xo added support for scalable fonts under R5
- X
- Xo additional command line flags supported
- X -latexfonts flag (resource .latexfonts) to start xfig with the LaTeX
- X fonts as the default instead of PostScript fonts
- X -specialtext flag (resource .specialtext) to start xfig with special
- X text as the default
- X
- Xo bug fixed where number of objects count in file popup was sometimes clipped
- X
- X------------------------------------------------------------------------------
- XPatchlevel 1
- XChanges to Patchlevel 0:
- X
- Xo xfig now reads text size, height and length as floats and rounds to ints
- X this is done because certain programs generate floats for these
- X
- Xo compound object was rounded to next larger grid even if objects inside were
- X already on the grid
- X
- Xo Examples/logo.fig included Logo.eps instead of logo.eps
- X
- Xo cancellation of line drawing left single dot on screen
- X
- Xo filename in File popup menu didn't get set until first popup - file save
- X shortcut would save to unnamed.fig even if xfig was started with file name
- X
- Xo bug fixed in not being able to delete points from certain objects
- X
- Xo typo in FORMAT2.1 file (and all previous) stating that text angle is int when
- X it is really float
- X
- Xo can now change corners of compound object with edit popup
- X also shows number of objects inside compound
- X
- Xo file menu now shows number of objects in figure
- X
- Xo some bugs fixed in calculating bounding boxes after scaling ellipses and
- X compounds
- X
- Xo "#ifdefined SYSV" now reads "#if defined(SYSV) || defined(SVR4)" because X11R5
- X doesn't define SYSV if SVR4 is defined
- X David Elliott (dce@krusty.smsc.Sony.COM)
- X
- Xo object depths < 0 are converted to depth = 0
- X
- Xo typo in Adobe font name (was "-abode-new century schoolbook-medium-r-*--*")
- X Jan Lindheim (lindheim@ccsf.caltech.edu)
- X
- Xo radius field for non-arcbox line objects now set to -1
- X Jan Nusteling (j.nusteling@et.tudelft.nl)
- X
- Xo bug fixed in not trying to load an eps bitmap file called <empty>
- X and not trying to reload an eps bitmap during a copy.
- X
- Xo bug fixed which caused crash after editing 0-width or 0-height ellipses
- X
- Xo bug fixed which caused incorrect mode after cancelling draw (int)spline
- X
- Xo bug fixed which caused incorrect minimum number of points for (int)spline
- X
- Xo bug fixed which caused erroneous large values to occur after box scale of
- X 0-width or 0-height objects. You can no longer box scale such objects
- X
- X------------------------------------------------------------------------------
- XPatchlevel 0
- XChanges to Version 2.0 Patchlevel 10:
- XImplemented by Paul King (king@cs.uq.oz.au) and
- XBrian Smith (envbvs@epb7.lbl.gov) with help from
- XMicah Beck (beck@cs.cornell.edu) and
- XBrian Boyter (pyrdc!bimbo!boyter@uunet.UU.NET) (EPS code).
- X
- XUSER INTERFACE
- X--------------
- X
- Xo The buttons are now grouped into three panels:
- X
- X COMMAND panel:
- X Quit, Delete all, Undo, Redraw, Paste, File popup, Export popup and
- X Print popup buttons. See man pages for details.
- X (see "Drawing Modes", below for description of Cut)
- X MODE panel:
- X Allow the user to select the current drawing or editing mode.
- X INDICATOR panel:
- X By default shows indicator buttons relevant to the current mode.
- X Each indicator button displays current setting of some quantity
- X (e.g. line width, area-fill) and allows it to be changed:
- X left button gives popup menu to select setting,
- X middle/right buttons provide a shortcut to inc/decrement settings.
- X
- Xo Pan figure by using left/middle/right button in the rulers in addition to
- X the previously supported arrow keys. Also a pan to origin operation
- X is available by clicking in the units window (or using HOME key).
- X
- Xo May now print figure that hasn't been saved (i.e. print what is on the
- X canvas, not the file)
- X
- Xo Zoom up or down with zoom button.
- X
- Xo Mouse function window shows function of active buttons
- X
- Xo New resources/command-line switches which affect the user interface:
- X -showallbuttons (show all indicator buttons all the time)
- X -internalBW n (use lines of width n between buttons/panels)
- X
- XDRAWING MODES
- X-------------
- X
- Xo Regular polygon drawing button - select number of sized from bottom panel.
- X Object created is normal xfig polygon.
- X
- Xo Inclusion of Encapsulated Postscript files (bitmap image in EPS file is
- X displayed).
- X
- Xo Rubberbanding of ellipses/circles.
- X
- Xo Filled splines show areafill on screen now
- X also dashed/dotted line type shows on screen
- X
- Xo Dot-gap and dash-length can be changed in the line-style indicator popup.
- X
- XEDITING MODES
- X-------------
- X
- Xo Cut to buffer operation is now part of Copy object mode & Delete object mode.
- X
- Xo Update button to either update objects to current settings, or update
- X indicator settings from an object.
- X
- Xo Rotation of certain objects by any angle (30, 45, 60, 90, 120 degrees can
- X be selected using the mouse middle/right shortcut buttons).
- X
- Xo Alignment horizontally and/or vertically of objects to compound object edge(s)
- X
- Xo Objects can be scaled (not just compounds).
- X
- Xo Point move or object copy/move constrainable to horizontal or vertical
- X movement (middle mouse button)
- X
- Xo Compound bounding corners shrink to fit enclosed objects and have markers
- X that appear the same as other objects.
- X
- Xo Shift-click selection should work on all editing operations.
- X
- Xo Only the objects relevant to a particular editing operation will
- X have their markers shown.
- X
- XOVERALL OPERATION
- X-----------------
- X
- Xo Smarter redrawing (if compiled with -DFASTSERVER).
- X Only the relevant objects are redrawn after an expose or after
- X an edit operation (not all operations support this yet).
- X
- Xo Undo should work for all commands.
- X
- Xo Operations can now be cancelled (using the right button when appropriate).
- X
- Xo Point positioning to three resolutions:
- X magnet (1/16inch), small grid or large grid
- X
- Xo TransFig 2.1 features: LaTex fonts, hidden text, scalable text, "special" text
- X see TransFig man pages for description
- X scalable text sizes with resizing of figure
- X
- Xo Attempts to save figure if signal detected (segmentation violation, etc)
- X
- Xo Resizing the xfig window should now be a bit smarter.
- X
- Xo The philosophy behind button usage has changed. This was necessary to
- X provide a consistent (as possible) philosophy which supports the
- X use of several buttons per mode. Now the same button used to start
- X an edit/draw operation is used to continue to the normal next step
- X in the operation. The right button can be used to cancel an operation.
- X Watch the mouse function window until you get the hang of it.
- X
- END_OF_FILE
- if test 30300 -ne `wc -c <'CHANGES'`; then
- echo shar: \"'CHANGES'\" unpacked with wrong size!
- fi
- # end of 'CHANGES'
- fi
- if test -f 'f_read.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'f_read.c'\"
- else
- echo shar: Extracting \"'f_read.c'\" \(28176 characters\)
- sed "s/^X//" >'f_read.c' <<'END_OF_FILE'
- X/*
- X * FIG : Facility for Interactive Generation of figures
- X * Copyright (c) 1985 by Supoj Sutanthavibul
- X *
- X * "Permission to use, copy, modify, distribute, and sell this software and its
- X * documentation for any purpose is hereby granted without fee, provided that
- X * the above copyright notice appear in all copies and that both the copyright
- X * notice and this permission notice appear in supporting documentation.
- X * No representations are made about the suitability of this software for
- X * any purpose. It is provided "as is" without express or implied warranty."
- X */
- X
- X#include "fig.h"
- X#include "figx.h"
- X#include "resources.h"
- X#include "object.h"
- X#include "mode.h"
- X#include "u_fonts.h"
- X#include "u_create.h"
- X#include "version.h"
- X#include "w_setup.h"
- X#include "w_util.h"
- X#include "w_zoom.h"
- X
- X/* file popup information */
- Xextern Widget file_popup; /* the popup itself */
- Xextern Boolean file_up;
- X
- X/* so w_file.c can access */
- XBoolean file_msg_is_popped=False;
- XWidget file_msg_popup;
- X
- Xstatic Widget file_msg_panel,
- X file_msg_win, file_msg_dismiss;
- Xstatic Boolean first_file_msg;
- Xstatic int file_msg_length=0;
- Xstatic char *read_file_name;
- Xstatic char tmpstr[100];
- X
- Xstatic String file_msg_translations =
- X "<Message>WM_PROTOCOLS: DismissFileMsg()\n";
- Xstatic XtEventHandler file_msg_panel_dismiss();
- Xstatic XtActionsRec file_msg_actions[] =
- X{
- X {"DismissFileMsg", (XtActionProc) file_msg_panel_dismiss},
- X};
- X
- Xstatic char Err_incomp[] = "Incomplete %s object at line %d.";
- X
- Xstatic F_ellipse *read_ellipseobject();
- Xstatic F_line *read_lineobject();
- Xstatic F_text *read_textobject();
- Xstatic F_spline *read_splineobject();
- Xstatic F_arc *read_arcobject();
- Xstatic F_compound *read_compoundobject();
- X
- X#define FILL_CONVERT(f) \
- X (((proto>=20) || (f) == UNFILLED || !TFX) \
- X ? (f) : (!TFX? 21 - ((f)-1)*5: 0))
- X
- X#define BUF_SIZE 1024
- X
- XDeclareStaticArgs(10);
- Xchar buf[BUF_SIZE];
- Xint line_no;
- Xint num_object;
- Xint proto; /* file protocol*10 */
- Xint TFX; /* true for 1.4TFX protocol */
- X
- Xread_fail_message(file, err)
- X char *file;
- X int err;
- X{
- X if (err == 0) /* Successful read */
- X return;
- X#ifdef ENAMETOOLONG
- X else if (err == ENAMETOOLONG)
- X file_msg("File name \"%s\" is too long", file);
- X#endif
- X else if (err == ENOENT)
- X file_msg("File \"%s\" does not exist", file);
- X else if (err == ENOTDIR)
- X file_msg("A name in the path \"%s\" is not a directory", file);
- X else if (err == EACCES)
- X file_msg("Read access to file \"%s\" is blocked", file);
- X else if (err == EISDIR)
- X file_msg("File \"%s\" is a directory", file);
- X else if (err == -2) {
- X file_msg("File \"%s\" is empty", file);
- X } else if (err == -1) {
- X /* Format error; relevant error message is already delivered */
- X } else
- X file_msg("File \"%s\" is not accessable; %s", file, sys_errlist[err]);
- X}
- X
- X/**********************************************************
- XRead_fig returns :
- X
- X 0 : successful read.
- X -1 : File is in incorrect format
- X -2 : File is empty
- Xerr_no : if file can not be read for various reasons
- X
- XThe resolution (ppi) and the coordinate system (coord_sys) are
- Xstored in obj->nwcorner.x and obj->nwcorner.y respectively.
- XThe coordinate system is 1 for lower left at 0,0 and
- X2 for upper left at 0,0
- X>>> xfig only uses 2 for the coordinate system. <<<
- X**********************************************************/
- X
- Xread_fig(file_name, obj)
- X char *file_name;
- X F_compound *obj;
- X{
- X FILE *fp;
- X
- X line_no = 0;
- X read_file_name = file_name;
- X first_file_msg = True;
- X if ((fp = fopen(file_name, "r")) == NULL)
- X return (errno);
- X else {
- X put_msg("Reading objects from \"%s\" ...", file_name);
- X return (readfp_fig(fp, obj));
- X }
- X}
- X
- Xreadfp_fig(fp, obj)
- X FILE *fp;
- X F_compound *obj;
- X{
- X int status;
- X float fproto;
- X char tmpstr[10];
- X
- X num_object = 0;
- X bzero(obj, COMOBJ_SIZE);
- X if (fgets(buf, BUF_SIZE, fp) == 0) /* version */
- X return -2;
- X if (strncmp(buf, "#FIG", 4) == 0) { /* versions 1.4/later have #FIG in
- X * first line */
- X if ((sscanf((char*)(index(buf, ' ') + 1), "%f", &fproto)) == 0) /* assume 1.4 */
- X proto = 14;
- X else
- X proto = (fproto + .01) * 10; /* protocol version*10 */
- X /* if file protocol != current protocol, give message */
- X sprintf(tmpstr,"%.1f",fproto);
- X if (strcmp(tmpstr,PROTOCOL_VERSION) != 0)
- X file_msg("Converting figure from %s format to %s",tmpstr,PROTOCOL_VERSION);
- X TFX = False;
- X if (strstr(buf, "TFX") != NULL)
- X TFX = True;
- X status = read_objects(fp, obj);
- X } else {
- X file_msg("Converting figure from 1.3 format to %s",PROTOCOL_VERSION);
- X proto = 13;
- X status = read_1_3_objects(fp, obj);
- X }
- X
- X /* shift the figure on the page if there are negative coords */
- X /**** DISABLE UNTIL WE PUT IN AN *OPTION* TO DO THIS */
- X /* shift_figure(obj); */
- X
- X fclose(fp);
- X return (status);
- X}
- X
- Xint
- Xread_objects(fp, obj)
- X FILE *fp;
- X F_compound *obj;
- X{
- X F_ellipse *e, *le = NULL;
- X F_line *l, *ll = NULL;
- X F_text *t, *lt = NULL;
- X F_spline *s, *ls = NULL;
- X F_arc *a, *la = NULL;
- X F_compound *c, *lc = NULL;
- X int object, ppi, coord_sys;
- X
- X line_no++;
- X if (get_line(fp) < 0) {
- X file_msg("File is truncated");
- X return (-1);
- X }
- X if (2 != sscanf(buf, "%d%d\n", &ppi, &coord_sys)) {
- X file_msg("Incomplete data at line %d", line_no);
- X return (-1);
- X }
- X obj->nwcorner.x = ppi;
- X obj->nwcorner.y = coord_sys;
- X while (get_line(fp) > 0) {
- X if (1 != sscanf(buf, "%d", &object)) {
- X file_msg("Incorrect format at line %d", line_no);
- X return (-1);
- X }
- X switch (object) {
- X case O_POLYLINE:
- X if ((l = read_lineobject(fp)) == NULL)
- X return (-1);
- X if (ll)
- X ll = (ll->next = l);
- X else
- X ll = obj->lines = l;
- X num_object++;
- X break;
- X case O_SPLINE:
- X if ((s = read_splineobject(fp)) == NULL)
- X return (-1);
- X if (ls)
- X ls = (ls->next = s);
- X else
- X ls = obj->splines = s;
- X num_object++;
- X break;
- X case O_ELLIPSE:
- X if ((e = read_ellipseobject()) == NULL)
- X return (-1);
- X if (le)
- X le = (le->next = e);
- X else
- X le = obj->ellipses = e;
- X num_object++;
- X break;
- X case O_ARC:
- X if ((a = read_arcobject(fp)) == NULL)
- X return (-1);
- X if (la)
- X la = (la->next = a);
- X else
- X la = obj->arcs = a;
- X num_object++;
- X break;
- X case O_TEXT:
- X if ((t = read_textobject(fp)) == NULL)
- X continue;
- X /*return (-1);*/
- X if (lt)
- X lt = (lt->next = t);
- X else
- X lt = obj->texts = t;
- X num_object++;
- X break;
- X case O_COMPOUND:
- X if ((c = read_compoundobject(fp)) == NULL)
- X return (-1);
- X if (lc)
- X lc = (lc->next = c);
- X else
- X lc = obj->compounds = c;
- X num_object++;
- X break;
- X default:
- X file_msg("Incorrect object code at line %d", line_no);
- X return (-1);
- X } /* switch */
- X } /* while */
- X if (feof(fp))
- X return (0);
- X else
- X return (errno);
- X} /* read_objects */
- X
- Xstatic F_arc *
- Xread_arcobject(fp)
- X FILE *fp;
- X{
- X F_arc *a;
- X int n, fa, ba;
- X int type, style;
- X float thickness, wid, ht;
- X
- X if ((a = create_arc()) == NULL)
- X return (NULL);
- X
- X a->next = NULL;
- X a->for_arrow = a->back_arrow = NULL; /* added 8/23/89 B.V.Smith */
- X n = sscanf(buf, "%*d%d%d%d%d%d%d%d%f%d%d%d%f%f%d%d%d%d%d%d\n",
- X &a->type, &a->style, &a->thickness,
- X &a->color, &a->depth,
- X &a->pen, &a->fill_style,
- X &a->style_val, &a->direction, &fa, &ba,
- X &a->center.x, &a->center.y,
- X &a->point[0].x, &a->point[0].y,
- X &a->point[1].x, &a->point[1].y,
- X &a->point[2].x, &a->point[2].y);
- X if (n != 19) {
- X file_msg(Err_incomp, "arc", line_no);
- X free((char *) a);
- X return (NULL);
- X }
- X a->fill_style = FILL_CONVERT(a->fill_style);
- X fixdepth(&a->depth);
- X skip_comment(fp);
- X if (fa) {
- X line_no++;
- X if (5 != fscanf(fp, "%d%d%f%f%f", &type, &style, &thickness, &wid, &ht)) {
- X fprintf(stderr, Err_incomp, "arc", line_no);
- X return (NULL);
- X }
- X skip_line(fp);
- X a->for_arrow = new_arrow(type, style, thickness, wid, ht);
- X skip_comment(fp);
- X }
- X skip_comment(fp);
- X if (ba) {
- X line_no++;
- X if (5 != fscanf(fp, "%d%d%f%f%f", &type, &style, &thickness, &wid, &ht)) {
- X fprintf(stderr, Err_incomp, "arc", line_no);
- X return (NULL);
- X }
- X skip_line(fp);
- X a->back_arrow = new_arrow(type, style, thickness, wid, ht);
- X }
- X return (a);
- X}
- X
- Xstatic F_compound *
- Xread_compoundobject(fp)
- X FILE *fp;
- X{
- X F_arc *a, *la = NULL;
- X F_ellipse *e, *le = NULL;
- X F_line *l, *ll = NULL;
- X F_spline *s, *ls = NULL;
- X F_text *t, *lt = NULL;
- X F_compound *com, *c, *lc = NULL;
- X int n, object;
- X
- X if ((com = create_compound()) == NULL)
- X return (NULL);
- X
- X com->arcs = NULL;
- X com->ellipses = NULL;
- X com->lines = NULL;
- X com->splines = NULL;
- X com->texts = NULL;
- X com->compounds = NULL;
- X com->next = NULL;
- X n = sscanf(buf, "%*d%d%d%d%d\n", &com->nwcorner.x, &com->nwcorner.y,
- X &com->secorner.x, &com->secorner.y);
- X if (4 != n) {
- X file_msg(Err_incomp, "compound", line_no);
- X free((char *) com);
- X return (NULL);
- X }
- X while (get_line(fp) > 0) {
- X if (1 != sscanf(buf, "%d", &object)) {
- X file_msg(Err_incomp, "compound", line_no);
- X free_compound(&com);
- X return (NULL);
- X }
- X switch (object) {
- X case O_POLYLINE:
- X if ((l = read_lineobject(fp)) == NULL) {
- X free_line(&l);
- X return (NULL);
- X }
- X if (ll)
- X ll = (ll->next = l);
- X else
- X ll = com->lines = l;
- X break;
- X case O_SPLINE:
- X if ((s = read_splineobject(fp)) == NULL) {
- X free_spline(&s);
- X return (NULL);
- X }
- X if (ls)
- X ls = (ls->next = s);
- X else
- X ls = com->splines = s;
- X break;
- X case O_ELLIPSE:
- X if ((e = read_ellipseobject()) == NULL) {
- X free_ellipse(&e);
- X return (NULL);
- X }
- X if (le)
- X le = (le->next = e);
- X else
- X le = com->ellipses = e;
- X break;
- X case O_ARC:
- X if ((a = read_arcobject(fp)) == NULL) {
- X free_arc(&a);
- X return (NULL);
- X }
- X if (la)
- X la = (la->next = a);
- X else
- X la = com->arcs = a;
- X break;
- X case O_TEXT:
- X if ((t = read_textobject(fp)) == NULL) {
- X free_text(&t);
- X return (NULL);
- X }
- X if (lt)
- X lt = (lt->next = t);
- X else
- X lt = com->texts = t;
- X break;
- X case O_COMPOUND:
- X if ((c = read_compoundobject(fp)) == NULL) {
- X free_compound(&c);
- X return (NULL);
- X }
- X if (lc)
- X lc = (lc->next = c);
- X else
- X lc = com->compounds = c;
- X break;
- X case O_END_COMPOUND:
- X return (com);
- X default:
- X file_msg("Incorrect object code at line %d", line_no);
- X return (NULL);
- X } /* switch */
- X }
- X if (feof(fp))
- X return (com);
- X else
- X return (NULL);
- X}
- X
- Xstatic F_ellipse *
- Xread_ellipseobject()
- X{
- X F_ellipse *e;
- X int n;
- X
- X if ((e = create_ellipse()) == NULL)
- X return (NULL);
- X
- X e->next = NULL;
- X n = sscanf(buf, "%*d%d%d%d%d%d%d%d%f%d%f%d%d%d%d%d%d%d%d\n",
- X &e->type, &e->style, &e->thickness,
- X &e->color, &e->depth, &e->pen, &e->fill_style,
- X &e->style_val, &e->direction, &e->angle,
- X &e->center.x, &e->center.y,
- X &e->radiuses.x, &e->radiuses.y,
- X &e->start.x, &e->start.y,
- X &e->end.x, &e->end.y);
- X if (n != 18) {
- X file_msg(Err_incomp, "ellipse", line_no);
- X free((char *) e);
- X return (NULL);
- X }
- X e->fill_style = FILL_CONVERT(e->fill_style);
- X fixdepth(&e->depth);
- X return (e);
- X}
- X
- Xstatic F_line *
- Xread_lineobject(fp)
- X FILE *fp;
- X{
- X F_line *l;
- X F_point *p, *q;
- X int n, x, y, fa, ba;
- X int type, style, radius_flag;
- X float thickness, wid, ht;
- X
- X if ((l = create_line()) == NULL)
- X return (NULL);
- X
- X l->points = NULL;
- X l->for_arrow = l->back_arrow = NULL;
- X l->next = NULL;
- X
- X sscanf(buf, "%*d%d", &l->type);
- X
- X /* 2.1 or later has radius parm for all line objects */
- X /* 2.0 has radius parm only for arc-box objects */
- X radius_flag = ((proto >= 21) || (l->type == T_ARC_BOX && proto == 20));
- X if (radius_flag) {
- X n = sscanf(buf, "%*d%d%d%d%d%d%d%d%f%d%d%d",
- X &l->type, &l->style, &l->thickness, &l->color, &l->depth,
- X &l->pen, &l->fill_style, &l->style_val, &l->radius, &fa, &ba);
- X } else { /* old format uses pen for radius of arc-box
- X * corners */
- X n = sscanf(buf, "%*d%d%d%d%d%d%d%d%f%d%d",
- X &l->type, &l->style, &l->thickness, &l->color,
- X &l->depth, &l->pen, &l->fill_style, &l->style_val, &fa, &ba);
- X if (l->type == T_ARC_BOX) {
- X l->radius = l->pen;
- X l->pen = 0;
- X } else
- X l->radius = 0;
- X }
- X if ((!radius_flag && n != 10) || (radius_flag && n != 11)) {
- X file_msg(Err_incomp, "line", line_no);
- X free((char *) l);
- X return (NULL);
- X }
- X l->fill_style = FILL_CONVERT(l->fill_style);
- X fixdepth(&l->depth);
- X skip_comment(fp);
- X if (fa) {
- X line_no++;
- X if (5 != fscanf(fp, "%d%d%f%f%f", &type, &style, &thickness, &wid, &ht)) {
- X fprintf(stderr, Err_incomp, "line", line_no);
- X return (NULL);
- X }
- X skip_line(fp);
- X l->for_arrow = new_arrow(type, style, thickness, wid, ht);
- X skip_comment(fp);
- X }
- X if (ba) {
- X line_no++;
- X if (5 != fscanf(fp, "%d%d%f%f%f", &type, &style, &thickness, &wid, &ht)) {
- X fprintf(stderr, Err_incomp, "line", line_no);
- X return (NULL);
- X }
- X skip_line(fp);
- X l->back_arrow = new_arrow(type, style, thickness, wid, ht);
- X skip_comment(fp);
- X }
- X if (l->type == T_EPS_BOX) {
- X line_no++;
- X if ((l->eps = create_eps()) == NULL) {
- X free((char *) l);
- X return (NULL);
- X }
- X if (2 != fscanf(fp, "%d %s", &l->eps->flipped, l->eps->file)) {
- X file_msg(Err_incomp, "Encapsulated Postscript", line_no);
- X fprintf(stderr, Err_incomp, "Encapsulated Postscript", line_no);
- X return (NULL);
- X }
- X read_epsf(l->eps);
- X } else
- X l->eps = NULL;
- X
- X /* points start on new line */
- X line_no++;
- X if ((p = create_point()) == NULL)
- X return (NULL);
- X
- X l->points = p;
- X p->next = NULL;
- X
- X /* read first point */
- X if (fscanf(fp, "%d%d", &p->x, &p->y) != 2) {
- X file_msg(Err_incomp, "line", line_no);
- X free_linestorage(l);
- X return (NULL);
- X }
- X /* read subsequent points */
- X for (;;) {
- X if (fscanf(fp, "%d%d", &x, &y) != 2) {
- X file_msg(Err_incomp, "line", line_no);
- X free_linestorage(l);
- X return (NULL);
- X }
- X if (x == 9999)
- X break;
- X if ((q = create_point()) == NULL) {
- X free_linestorage(l);
- X return (NULL);
- X }
- X q->x = x;
- X q->y = y;
- X q->next = NULL;
- X p->next = q;
- X p = q;
- X }
- X skip_line(fp);
- X return (l);
- X}
- X
- Xstatic F_spline *
- Xread_splineobject(fp)
- X FILE *fp;
- X{
- X F_spline *s;
- X F_point *p, *q;
- X F_control *cp, *cq;
- X int c, n, x, y, fa, ba;
- X int type, style;
- X float thickness, wid, ht;
- X float lx, ly, rx, ry;
- X
- X if ((s = create_spline()) == NULL)
- X return (NULL);
- X
- X s->points = NULL;
- X s->controls = NULL;
- X s->for_arrow = s->back_arrow = NULL;
- X s->next = NULL;
- X
- X n = sscanf(buf, "%*d%d%d%d%d%d%d%d%f%d%d%d%d%d%d",
- X &s->type, &s->style, &s->thickness, &s->color,
- X &s->depth, &s->pen, &s->fill_style, &s->style_val, &fa, &ba);
- X if (n != 10) {
- X file_msg(Err_incomp, "spline", line_no);
- X free((char *) s);
- X return (NULL);
- X }
- X s->fill_style = FILL_CONVERT(s->fill_style);
- X fixdepth(&s->depth);
- X skip_comment(fp);
- X if (fa) {
- X line_no++;
- X if (5 != fscanf(fp, "%d%d%f%f%f", &type, &style, &thickness, &wid, &ht)) {
- X fprintf(stderr, Err_incomp, "spline", line_no);
- X return (NULL);
- X }
- X skip_line(fp);
- X s->for_arrow = new_arrow(type, style, thickness, wid, ht);
- X skip_comment(fp);
- X }
- X if (ba) {
- X line_no++;
- X if (5 != fscanf(fp, "%d%d%f%f%f", &type, &style, &thickness, &wid, &ht)) {
- X fprintf(stderr, Err_incomp, "spline", line_no);
- X return (NULL);
- X }
- X skip_line(fp);
- X s->back_arrow = new_arrow(type, style, thickness, wid, ht);
- X skip_comment(fp);
- X }
- X line_no++;
- X
- X /* Read points */
- X if ((n = fscanf(fp, "%d%d", &x, &y)) != 2) {
- X file_msg(Err_incomp, "spline", line_no);
- X free_splinestorage(s);
- X return (NULL);
- X };
- X if ((p = create_point()) == NULL) {
- X free_splinestorage(s);
- X return (NULL);
- X }
- X s->points = p;
- X p->x = x;
- X p->y = y;
- X for (c = 1;;) {
- X if (fscanf(fp, "%d%d", &x, &y) != 2) {
- X file_msg(Err_incomp, "spline", line_no);
- X p->next = NULL;
- X free_splinestorage(s);
- X return (NULL);
- X };
- X if (x == 9999)
- X break;
- X if ((q = create_point()) == NULL) {
- X free_splinestorage(s);
- X return (NULL);
- X }
- X q->x = x;
- X q->y = y;
- X p->next = q;
- X p = q;
- X c++;
- X }
- X p->next = NULL;
- X skip_line(fp);
- X
- X if (normal_spline(s))
- X return (s);
- X
- X line_no++;
- X skip_comment(fp);
- X /* Read controls */
- X if ((n = fscanf(fp, "%f%f%f%f", &lx, &ly, &rx, &ry)) != 4) {
- X file_msg(Err_incomp, "spline", line_no);
- X free_splinestorage(s);
- X return (NULL);
- X };
- X if ((cp = create_cpoint()) == NULL) {
- X free_splinestorage(s);
- X return (NULL);
- X }
- X s->controls = cp;
- X cp->lx = lx;
- X cp->ly = ly;
- X cp->rx = rx;
- X cp->ry = ry;
- X while (--c) {
- X if (fscanf(fp, "%f%f%f%f", &lx, &ly, &rx, &ry) != 4) {
- X file_msg(Err_incomp, "spline", line_no);
- X cp->next = NULL;
- X free_splinestorage(s);
- X return (NULL);
- X };
- X if ((cq = create_cpoint()) == NULL) {
- X cp->next = NULL;
- X free_splinestorage(s);
- X return (NULL);
- X }
- X cq->lx = lx;
- X cq->ly = ly;
- X cq->rx = rx;
- X cq->ry = ry;
- X cp->next = cq;
- X cp = cq;
- X }
- X cp->next = NULL;
- X
- X skip_line(fp);
- X return (s);
- X}
- X
- Xstatic F_text *
- Xread_textobject(fp)
- X FILE *fp;
- X{
- X F_text *t;
- X int n;
- X int ignore = 0;
- X char s[BUF_SIZE], s_temp[BUF_SIZE], junk[2];
- X float tx_size, tx_height, tx_length;
- X extern PIX_ROT_FONT lookfont();
- X
- X if ((t = create_text()) == NULL)
- X return (NULL);
- X
- X t->next = NULL;
- X /*
- X * The text object is terminated by a CONTROL-A, so we read everything up
- X * to the CONTROL-A and then read that character. If we do not find the
- X * CONTROL-A on this line then this must be a multi-line text object and
- X * we will have to read more.
- X *
- X * We read text size, height and length as floats because TransFig uses
- X * floats for these, but they are rounded to ints internally to xfig.
- X */
- X /* read the leading blanks for the string, but delete the first later */
- X n = sscanf(buf, "%*d%d%d%f%d%d%d%f%d%f%f%d%d%[^\1]%[\1]",
- X &t->type, &t->font, &tx_size, &t->pen,
- X &t->color, &t->depth, &t->angle,
- X &t->flags, &tx_height, &tx_length,
- X &t->base_x, &t->base_y, s, junk);
- X if (n != 13 && n != 14) {
- X file_msg(Err_incomp, "text", line_no);
- X free((char *) t);
- X return (NULL);
- X }
- X /* now round size, height and length to int */
- X if ((int) tx_size == DEFAULT) /* just copy DEFAULT */
- X t->size = DEFAULT;
- X else
- X t->size = round(tx_size);
- X while (t->angle < 0.0)
- X t->angle += M_2PI;
- X while (t->angle > M_2PI)
- X t->angle -= M_2PI;
- X /* get the font struct */
- X t->fontstruct = lookfont(x_fontnum(t->flags, t->font),
- X round(t->size*zoomscale), t->angle);
- X t->height = round(tx_height);
- X t->length = round(tx_length);
- X fixdepth(&t->depth);
- X if (n == 13) {
- X /* Read in the remainder of the text object. */
- X do {
- X /*
- X * khc 06JUL90 - test for end-of-file or else hangs in loop if no
- X * ^A is found
- X */
- X if (fgets(buf, BUF_SIZE, fp) == NULL)
- X break;
- X line_no++; /* As is done in get_line */
- X n = sscanf(buf, "%[^\1]%[\1]", s_temp, junk);
- X /* Safety check */
- X if (strlen(s) + 1 + strlen(s_temp) + 1 > BUF_SIZE) {
- X /* Too many characters. Ignore the rest. */
- X if (!ignore)
- X file_msg("Truncating TEXT object to %d chars in line %d",
- X BUF_SIZE,line_no);
- X ignore = 1;
- X }
- X if (!ignore)
- X strcat(s, s_temp);
- X } while (n == 1);
- X }
- X if (t->type > T_RIGHT_JUSTIFIED) {
- X file_msg("Invalid text justification at line %d, setting to LEFT.", line_no);
- X t->type = T_LEFT_JUSTIFIED;
- X }
- X
- X /* convert all pre-2.1 NON-TFX text flags (used to be font_style) to PostScript
- X and all pre-2.1 TFX flags to PostScript + Special */
- X if (proto <= 20)
- X {
- X t->flags = PSFONT_TEXT;
- X if (TFX)
- X t->flags |= SPECIAL_TEXT;
- X }
- X
- X if (t->font >= MAXFONT(t)) {
- X file_msg("Invalid text font (%d) at line %d, setting to DEFAULT.",
- X t->font, line_no);
- X t->font = DEFAULT;
- X }
- X if (strlen(s) <= 1)
- X {
- X file_msg("Empty text string at line %d", line_no);
- X return (NULL);
- X }
- X /* skip first blank from input file by starting at s[1] */
- X if ((t->cstring = new_string(strlen(&s[1]) + 1)) == NULL) {
- X free((char *) t);
- X return (NULL);
- X }
- X (void) strcpy(t->cstring, &s[1]);
- X
- X return (t);
- X}
- X
- Xget_line(fp)
- X FILE *fp;
- X{
- X while (1) {
- X if (NULL == fgets(buf, BUF_SIZE, fp)) {
- X return (-1);
- X }
- X line_no++;
- X if (*buf != '\n' && *buf != '#') /* Skip empty and comment
- X * lines */
- X return (1);
- X }
- X}
- X
- Xskip_comment(fp)
- X FILE *fp;
- X{
- X char c;
- X
- X while ((c = fgetc(fp)) == '#')
- X skip_line(fp);
- X if (c != '#')
- X ungetc(c, fp);
- X}
- X
- Xskip_line(fp)
- X FILE *fp;
- X{
- X while (fgetc(fp) != '\n') {
- X if (feof(fp))
- X return;
- X }
- X}
- X
- Xfixdepth(depth)
- X int *depth;
- X{
- X if (*depth>MAXDEPTH) {
- X *depth=MAXDEPTH;
- X file_msg("Depth > %d, setting to %d in line %d",
- X MAXDEPTH,line_no,MAXDEPTH);
- X }
- X else if (*depth<0 || proto<21) {
- X *depth=0;
- X if (proto>=21)
- X file_msg("Depth < 0, setting to 0 in line %d", line_no);
- X }
- X}
- X
- Xshift_figure(obj)
- XF_compound *obj;
- X{
- X F_ellipse *e;
- X F_arc *a;
- X F_line *l;
- X F_spline *s;
- X F_compound *c;
- X F_text *t;
- X int lowx,lowy,dx,dy;
- X int llx,lly,urx,ury;
- X int rnd;
- X
- X lowx = 10000;
- X lowy = 10000;
- X for (e = obj->ellipses; e != NULL; e = e->next) {
- X ellipse_bound(e, &llx, &lly, &urx, &ury);
- X lowx = min2(llx,lowx);
- X lowy = min2(lly,lowy);
- X }
- X for (a = obj->arcs; a != NULL; a = a->next) {
- X arc_bound(a, &llx, &lly, &urx, &ury);
- X lowx = min2(llx,lowx);
- X lowy = min2(lly,lowy);
- X }
- X for (l = obj->lines; l != NULL; l = l->next) {
- X line_bound(l, &llx, &lly, &urx, &ury);
- X lowx = min2(llx,lowx);
- X lowy = min2(lly,lowy);
- X }
- X for (s = obj->splines; s != NULL; s = s->next) {
- X spline_bound(s, &llx, &lly, &urx, &ury);
- X lowx = min2(llx,lowx);
- X lowy = min2(lly,lowy);
- X }
- X for (c = obj->compounds; c != NULL; c = c->next) {
- X compound_bound(c, &llx, &lly, &urx, &ury);
- X lowx = min2(llx,lowx);
- X lowy = min2(lly,lowy);
- X }
- X for (t = obj->texts; t != NULL; t = t->next) {
- X int dum;
- X text_bound_actual(t, t->angle, &llx, &lly, &urx, &ury,
- X &dum,&dum,&dum,&dum,&dum,&dum,&dum,&dum);
- X lowx = min2(llx,lowx);
- X lowy = min2(lly,lowy);
- X }
- X /* check if any part of the figure has negative coords */
- X if (lowx >= 0 && lowy >= 0)
- X return; /* no, ok */
- X
- X /* shift the whole figure to keep it "on the page" */
- X dx = dy = 0;
- X rnd = posn_rnd[cur_pointposn];
- X if (lowx < 0)
- X {
- X dx = -lowx+rnd; /* and round up to small grid */
- X if (rnd != 0)
- X dx--;
- X }
- X if (lowy < 0)
- X {
- X dy = -lowy+rnd;
- X if (rnd != 0)
- X dy--;
- X }
- X file_msg(
- X "Shifting entire figure %d pixels right and %d pixels down to keep on page",
- X dx,dy);
- X for (e = obj->ellipses; e != NULL; e = e->next)
- X translate_ellipse(e, dx, dy);
- X for (a = obj->arcs; a != NULL; a = a->next)
- X translate_arc(a, dx, dy);
- X for (l = obj->lines; l != NULL; l = l->next)
- X translate_line(l, dx, dy);
- X for (s = obj->splines; s != NULL; s = s->next)
- X translate_spline(s, dx, dy);
- X for (c = obj->compounds; c != NULL; c = c->next)
- X translate_compound(c, dx, dy);
- X for (t = obj->texts; t != NULL; t = t->next)
- X translate_text(t, dx, dy);
- X}
- X
- X/* VARARGS1 */
- Xfile_msg(format, arg1, arg2, arg3, arg4, arg5)
- X char *format;
- X int arg1, arg2, arg3, arg4, arg5;
- X{
- X XawTextBlock block;
- X popup_file_msg();
- X if (first_file_msg)
- X {
- X first_file_msg = False;
- X file_msg("---------------------");
- X file_msg("File %s:",read_file_name);
- X }
- X sprintf(tmpstr, format, arg1, arg2, arg3, arg4, arg5);
- X strcat(tmpstr,"\n");
- X /* append this message to the file message widget string */
- X block.firstPos = 0;
- X block.ptr = tmpstr;
- X block.length = strlen(tmpstr);
- X block.format = FMT8BIT;
- X /* make editable to add new message */
- X FirstArg(XtNeditType, XawtextEdit);
- X SetValues(file_msg_win);
- X /* insert the new message after the end */
- X (void) XawTextReplace(file_msg_win,file_msg_length,file_msg_length,&block);
- X (void) XawTextSetInsertionPoint(file_msg_win,file_msg_length);
- X
- X /* make read-only again */
- X FirstArg(XtNeditType, XawtextRead);
- X SetValues(file_msg_win);
- X file_msg_length += block.length;
- X}
- X
- Xclear_file_message(w, ev)
- X Widget w;
- X XButtonEvent *ev;
- X{
- X XawTextBlock block;
- X int replcode;
- X
- X if (!file_msg_popup)
- X return;
- X
- X tmpstr[0]=' ';
- X block.firstPos = 0;
- X block.ptr = tmpstr;
- X block.length = 1;
- X block.format = FMT8BIT;
- X
- X /* make editable to clear message */
- X FirstArg(XtNeditType, XawtextEdit);
- X NextArg(XtNdisplayPosition, 0);
- X SetValues(file_msg_win);
- X
- X /* replace all messages with one blank */
- X replcode = XawTextReplace(file_msg_win,0,file_msg_length,&block);
- X if (replcode == XawPositionError)
- X fprintf(stderr,"XawTextReplace XawPositionError\n");
- X else if (replcode == XawEditError)
- X fprintf(stderr,"XawTextReplace XawEditError\n");
- X
- X /* make read-only again */
- X FirstArg(XtNeditType, XawtextRead);
- X SetValues(file_msg_win);
- X file_msg_length = 0;
- X}
- X
- Xstatic Bool grabbed=False;
- X
- Xstatic
- XXtEventHandler
- Xfile_msg_panel_dismiss(w, ev)
- X Widget w;
- X XButtonEvent *ev;
- X{
- X if ((grabbed) && (!file_up))
- X XtAddGrab(file_msg_popup, False, False);
- X XtPopdown(file_msg_popup);
- X file_msg_is_popped=False;
- X}
- X
- Xpopup_file_msg()
- X{
- X extern Atom wm_delete_window;
- X
- X if (file_msg_popup)
- X {
- X if (!file_msg_is_popped)
- X {
- X if (file_up)
- X {
- X XtPopup(file_msg_popup, XtGrabNonexclusive);
- X XSetWMProtocols(XtDisplay(file_msg_popup),
- X XtWindow(file_msg_popup),
- X &wm_delete_window, 1);
- X grabbed = True;
- X }
- X else
- X {
- X XtPopup(file_msg_popup, XtGrabNone);
- X XSetWMProtocols(XtDisplay(file_msg_popup),
- X XtWindow(file_msg_popup),
- X &wm_delete_window, 1);
- X grabbed = False;
- X }
- X }
- X file_msg_is_popped = True;
- X return;
- X }
- X
- X file_msg_is_popped = True;
- X FirstArg(XtNx, 0);
- X NextArg(XtNy, 0);
- X NextArg(XtNtitle, "Xfig: File error messages");
- X file_msg_popup = XtCreatePopupShell("xfig_file_msg",
- X transientShellWidgetClass,
- X tool, Args, ArgCount);
- X XtOverrideTranslations(file_msg_popup,
- X XtParseTranslationTable(file_msg_translations));
- X XtAppAddActions(tool_app, file_msg_actions, XtNumber(file_msg_actions));
- X
- X file_msg_panel = XtCreateManagedWidget("file_msg_panel", formWidgetClass,
- X file_msg_popup, NULL, ZERO);
- X FirstArg(XtNwidth, 500);
- X NextArg(XtNheight, 200);
- X NextArg(XtNeditType, XawtextRead);
- X NextArg(XtNdisplayCaret, False);
- X NextArg(XtNborderWidth, INTERNAL_BW);
- X NextArg(XtNscrollHorizontal, XawtextScrollWhenNeeded);
- X NextArg(XtNscrollVertical, XawtextScrollAlways);
- X file_msg_win = XtCreateManagedWidget("file_msg_win", asciiTextWidgetClass,
- X file_msg_panel, Args, ArgCount);
- X
- X FirstArg(XtNlabel, "Dismiss");
- X NextArg(XtNheight, 25);
- X NextArg(XtNborderWidth, INTERNAL_BW);
- X NextArg(XtNfromVert, file_msg_win);
- X file_msg_dismiss = XtCreateManagedWidget("dismiss", commandWidgetClass,
- X file_msg_panel, Args, ArgCount);
- X XtAddEventHandler(file_msg_dismiss, ButtonReleaseMask, (Boolean) 0,
- X (XtEventHandler)file_msg_panel_dismiss, (XtPointer) NULL);
- X
- X FirstArg(XtNlabel, "Clear");
- X NextArg(XtNheight, 25);
- X NextArg(XtNborderWidth, INTERNAL_BW);
- X NextArg(XtNfromVert, file_msg_win);
- X NextArg(XtNfromHoriz, file_msg_dismiss);
- X file_msg_dismiss = XtCreateManagedWidget("clear", commandWidgetClass,
- X file_msg_panel, Args, ArgCount);
- X XtAddEventHandler(file_msg_dismiss, ButtonReleaseMask, (Boolean) 0,
- X (XtEventHandler)clear_file_message, (XtPointer) NULL);
- X
- X if (file_up)
- X {
- X XtPopup(file_msg_popup, XtGrabNonexclusive);
- X XSetWMProtocols(XtDisplay(file_msg_popup),
- X XtWindow(file_msg_popup),
- X &wm_delete_window, 1);
- X grabbed = True;
- X }
- X else
- X {
- X XtPopup(file_msg_popup, XtGrabNone);
- X XSetWMProtocols(XtDisplay(file_msg_popup),
- X XtWindow(file_msg_popup),
- X &wm_delete_window, 1);
- X grabbed = False;
- X }
- X}
- END_OF_FILE
- if test 28176 -ne `wc -c <'f_read.c'`; then
- echo shar: \"'f_read.c'\" unpacked with wrong size!
- fi
- # end of 'f_read.c'
- fi
- echo shar: End of archive 17 \(of 27\).
- cp /dev/null ark17isdone
- 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 22 23 24 25 26 27 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 27 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
-
- exit 0 # Just in case...
- --
- // chris@IMD.Sterling.COM | Send comp.sources.x submissions to:
- \X/ Amiga - The only way to fly! | sources-x@imd.sterling.com
- "It's intuitively obvious to the |
- most casual observer..." | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
-