rs@uunet.UU.NET (Rich Salz) (08/06/87)
Submitted-by: "Alan W. Paeth" <awpaeth%watcgl.waterloo.edu@RELAY.CS.NET> Posting-number: Volume 10, Issue 93 Archive-name: lemming/Part03 #! /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 shell archive." # Contents: document # Wrapped by rs@uunet on Thu Aug 6 16:30:30 1987 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f document -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"document\" else echo shar: Extracting \"document\" \(24201 characters\) sed "s/^X//" >document <<'END_OF_document' XFrom @RELAY.CS.NET:awpaeth@watcgl.waterloo.edu Fri Jun 12 19:58:01 1987 XReceived: from RELAY.CS.NET by uunet.UU.NET (5.54/1.14) X id AA01326; Fri, 12 Jun 87 19:58:01 EDT XReceived: from relay2.cs.net by RELAY.CS.NET id aa05579; 12 Jun 87 19:58 EDT XReceived: from waterloo by csnet-relay.csnet id ad24127; 12 Jun 87 19:47 EDT XReceived: from watcgl.uucp by watmath; Fri, 12 Jun 87 19:15:21 EDT XReceived: by watcgl; Fri, 12 Jun 87 19:17:07 EDT XFrom: "Alan W. Paeth" <awpaeth%watcgl.waterloo.edu@RELAY.CS.NET> XMessage-Id: <8706122317.AA01079@watcgl.uucp> XDate: 12 Jun 87 23:17:06 GMT XTo: comp-sources-unix%watmath.waterloo.edu@RELAY.CS.NET XSubject: Submission for comp-sources-unix XResponding-System: watcgl.UUCP XStatus: R X XPath: watcgl!awpaeth XFrom: awpaeth@watcgl.UUCP (Alan W. Paeth) XNewsgroups: comp.sources.unix XSubject: LEMMING [3-4] XMessage-ID: <1233@watcgl.UUCP> XDate: 12 Jun 87 23:17:04 GMT XDistribution: comp XOrganization: U of Waterloo, Ontario XLines: 500 X X X Lemming - Little Editor for Mice and other rodents. X X (c) Alan W. Paeth, 1987 X Computer Graphics Laboratory, University of Waterloo X X X X X[0] Overview X XThe lemming editor is an interactive package for editing simple (PIC-like) Xgraphics images. It presently runs under the Vax (Ikonas), VaxII (X-windows) Xand SUN (X-windows) environments. It is designed to be highly portable: it Xrequires a one button mouse and binary (one bitplane) display to operate. X XThe objects presently supported include lines, text, boxes and ellipses. XAttributes include dotted, dashed, text justification, various fonts, etc. XPIC output can be produced. X XFiles: X XImportant user files include: X Xlemik # tty based Ikonas Frame Buffer executable Xlemx # X-windows (GPXII,Sun) executable Xlemdoc # this document X.lemrc # standard defaults (not essential) X XIn addition, binary font files must be in place on the directory X/usr/local/lib/BFont/*. The path for this file is in "lemrc.c" X X[1] Command Summary X XMouse Actions: X X DISPLAY STATE X X no mark, no mark and X | mark | selections | selections| X ---+---------+------------+-----------+ X M click free | place | draw | move | X | mark | line | mark | X O ---+---------+------------+-----------+ X click mark | -- | remove the mark | X U | | | X ---+---------+------------+-----------+ X S drag mark | -- | tug marked | move all | X | | objects | selections| X E ---+---------+------------+-----------+ X drag free | (de) select by rectangle area | X | | X ---+----------------------------------+ X X XKeyboard Actions: X X ESC Delete Mark; Deselect all X TAB Select marked obj (cyclically) X BS Backspace input text X CR Add text (if present) X ^A All select X ^B Box-ify selections X ^C Copy selections (in place) X ^D Delete selections X ^E Ellipse-ify selections X ^F Force<+key>: 0=reset/1-9=size/Bld/Nrm/Itl/Lft/Rht/Cen X ^G Group selections X ^L Refresh display X ^N No select (deselect all) X ^O Output PIC \filename\ X ^P Pop (ungroup -- instantiate) selected groups X ^Q Quit X ^R Read \filename\ X ^Sc Special function escape X ^Td Tickmarks (on/off) X ^U Undo selections (undelete, untransform) X ^V Vector-ify selections X ^W Write \filename\ X ^X Cut lines (selections scissor normal lines) X X[2] Interaction Model X XLemming uses two devices for interaction: the keyboard and the mouse. XThe mouse is used to specify targets (operands) which will receive some Xaction, the keyboard is used to initiate action (operations). This is a Xsimple extension to the "vi" interaction model, in which the motion keys X(h,j,k,l) have been replaced by the mouse as a pointing device. X XOnly one button of the mouse is required (the biped, triped and quadraped Xmembers of the species function identically, and will possibly become Xextinct due to natural selection in the distant future). Keyboard commands Xare control keys, which are struck without any <cr>, as in "vi". The <esc> Xand <tab> control keys are used most heavily, so in practice the user places Xthe left pinkie near the left edge on the keyboard, while the right hand runs Xthe mouse (Left-handed members of the human species might find this awkward, Xbut in the distant future...). X XMouse Interaction: X XThe mouse may be used to "click" or "drag". Clicking means "point, button Xdown, button up". Drag means "button down, move the mouse, button up". XIn all cases, clicking the mouse will place the "mark" (a green plus sign) Xsomewhere on the display, either in free space, or upon some nearby object. X XThe Display: X XThe display shows all graphics objects in the editor workspace. In addition, Xthe hardware cursor shows the current mouse location. A static cursor belonging Xto the editor (called the "mark") may also be present. Its presence and Xplacement are controlled by the user. A tick grid may also be turned on to aid Xmeasuring and aligning. X XColors: X XLemming runs with a black background, and white foreground objects. The Xcurrent mark location is either green or red, depending on whether the Xmark is placed in free space, or is on (in close proximity) to some object. XItems change from white to red when selected. Text entered on the user Xcommand line is green. In short, white objects depict actual entities, not Xfeedback information. On the SUN (or other two-color X-window systems), Xcolored objects are depicted using greyscale, created by stippling. X XModes: X XThere are no modes in the sense of a hierarchical control structure. XSome actions behave differently as a function of screen selections or Xin the presence of a "mark". In this sense, "mode" can be inferred by Xthe display. For instance, if no objects are selected, then "delete" is Xmeaningless. X X"Selected object mode": An object turns red when it is selected. This Xchanges the meaning of a few commands. X X"Mark present mode": When the mouse has been clicked somewhere, the mark Xappears, and this can affect the behavior of some subsequent operations. X X[3] Tutorial X XStart Up: X XRun the appropriate version of "lemming" with no other command line Xparameters. The screen will be cleared to black, and a crosshair cursor Xwill smoothly track the current mouse location. The screen may be refreshed Xat any time using the <^L> command. X XSimple Drawing: X XThese three control keys will be used together with the mouse: X X<esc> -- deselect all and remove mark (thereby turning off any modes) X<tab> -- select/deselect the object(s) under the current mark, if present X<^D> -- delete selected object(s). X XWhen nothing is selected and the mark is present, then subsequent clicks Xwill draw a line and advance the mark to the new cursor position. Thus, Xit is possible to draw two lines of three vertices thus: X X<click> <click> <click> <esc> <click> <click> <click> X XHere the <esc> removes the mark (nothing was selected, but would have been Xdeselected also by this action) and allows the line-chain to be broken. X XEdit While Drawing: X XIf the last segment in a chain doesn't belong, then the sequence: X X<tab> <^D> X Xwill select the object under the mark (which is attached to the trailing Xvertex of the line-chain), and the <^D> will remove that segment. X XDragging the Mark: X XIf nothing is selected (as when entering new lines), then dragging the mark X(click down directly upon the mark, move to new location, release), will Xmove the mark and all lines and text strings connected at this vertex. XSo if the last segment in a draw chain is misplaced, simply button down Xon the mark, and carry the vertex to the new location. You should also Xtry adjusting the location of an intermediate vertex with this operation. X XSelection: X XFor mass selection, the <^A> key selects all objects, the <^N> selects Xno objects (unlike the <ESC>, the latter leaves the mark untouched). X XSelections are cumulative. Consider our example: two chains of three lines. XWe wish to delete the middle segment (the second and fifth entered) of each Xchain. Begin by making sure everything is deselected, then click the mark Xon the middle object of chain one, hit <tab>, thereby selecting it, while Xremoving the mark. Now click the middle line of the second chain. The mark Xwill be placed there. Note that because of the previous selection, the X"draw line" function is omitted -- the mark simply moved. Again, hit <tab> Xto select the middle line in the chain. With both objects now selected, Xhit <^D> to delete all selections. Use the <^U> to undelete the selections, Xand go on: X XArea Selection: X XWhen dragging is done, but NOT beginning upon the mark, an area selection Xis done. This operation takes place independent of any modes (i.e. independent Xof the presence/absence of both the mark and selected objects). X XTo select all of the first chain, imagine the bounding box which surrounds Xall three objects within the first chain. Move to the upper-left-hand corner Xof that imaginary box, button down, and drag diagonally to the lower-rh Xcorner, then release. All objects FULLY (ie, both endpoints) within the Xselection rectangle will be selected. Again, this operation is cumulative. XThe mark should now be off (if it was left on, remove it without deselecting Xthese objects by clicking directly upon it. Now mark that middle chain item Xonce again, which is now selected. Again, use the <tab> command, and it will Xtoggle its selection status: it will become deselected. X XAreas selection may be used to perform deselection as well. The latter Xoccurs when "uphill" selecting is done, i.e., when the drag motion moves Xup (in y) the display screen. X XOther Objects - Boxes and Ellipses: X XNow two of six objects are selected. Type <^B>, and all selected vectors Xbecome boxes (the vector defining the diagonal). Type <^E> and they become Xellipses. Type <^V> and they are vectors once again. Note: on the Vax-8600, Xthe <^V> command (also <^Q> and <^O>) must be literal quoted with an Xadditional <^V> command. So to convert back to vectors (on the 8600), type X<^V> <^V>. X XOther Objects - Text: X XText is entered simply by typing in a string (not containing control Xcharacters). To place text somewhere, place the mark, type the text, and Xhit return. (Or, type the text, place the mark and hit return. Or, type Xthe text, hit return (nothing happens - no mark), place the mark, hit Xreturn again). When the text is entered, the mark moves downward by the Xbaseline distance (plus some small line leading) to facilitate the Xentry of blocks of text. X XObject Attributes: X XObjects may have certain attributes forced upon them. This is done by Xusing the <^F> (force) command, followed by a single additional (and case Xinsensitive) keystroke. For instance, text is center adjusted by default. XEnter some text, select it (area selection will probably be the fastest Xway, as the mark has moved), and then type <^F>L to left justify it. XLeft justifying a line has the property of placing an arrowhead at Xat the ending vertex of the line, right adjusting places the arrowhead at Xthe beginning vertex. The various modes are presented below: X X<^F>: key name if text if box,line,ellipse X X N normal regular solid X B bold embolden dashed X I italic italicize dotted X L left left just trailing arrowhead (lines only) X R right right adjust forward arrowhead (lines only) X C center center adjust no arrowheads X 0 reset (defaults: center, regular) X 1-9 (font) select font N select line thickness N X X X[4] Advanced Techniques X XCommand Line Parameters: X XIf Lemming is started with command line parameters, each parameter not Xbeginning with a hyphen is taken to be a lemming input file (with file Xextension rules applying, as described under "Reading" below). All input Xfiles are read. At present one command line switch (-p) is recognized. XIt causes pic output to be written, based on the name of the first command Xline input file appearing, with the ".pic" suffix appended. X XThe LEMRC file: X XAdditional object attributes may be triggered by use of <^F><digit). XWhen digit is zero, all attributes (including the bold/italic and left/right Xattributes) are reset. When <digit> is in the range 1-9, a corresponding Xattribute is taken from the nth line of the .lemrc file. The contents of this Xfile may be viewed from within the editor by using the help-slash (i.e. <^^>/) Xfacility. This file is generally used to set up the default fonts for both the Xdisplay and for PIC/troff. However, an entry for line width attributes also Xexists. Consider this simple .lemrc file: X X.lemrc file 18/05/87 X |----------------------- Fonts ------------------------------| XPnt Line |Display Typeset PostScript | XSz Thkn Rg/Bld/Itl Rg/Bld/Itl X------------------------------------------------------------------------ X12 1 TimesRoman TR TB TI Times-Bold Times-Bold Times-Bold X12 1 Helvetica SR SB SI Times-Bold Times-Bold Times-Bold X.end of file X XOnly lines beginning with digits are treated as data lines. Using this file, X<^F>1 (the default) will select TimesRoman -- a serif font, and <^F><2> will Xselect Helvetica -- a sans-serif font. Typing <^F>0 will clear the font of Xemphasis and centering, and reset to the default font (font 1). Under some Xversions, line thickness may not appear on the user display, but will on Xoutput. The PostScript font entries are present for expansion. The .lemrc is Xnormally read from the current directory, otherwise the user's home directory Xis checked. Failing this, a single default font is used. When a document Xcontains more fonts than present in the .lemrc, absent fonts will display and Xprint using font 1. This font is also used for help text. X XTick Gridding: X XTick marks may be placed on the active window with the <^T><digit> command. XThe tick marks may be removed with the <^T> command (a non-symmetric toggle). XThe tick grid restricts the location of the (green) mark when it is placed in Xfree space to lie coincident with a visible tick point. It does not constrain Xthe tracking of the cursor, nor selections to active object features, such Xas box edges or line endpoints. X XWhen setting tick marks, a <digit> value in the range 1-5 sets a square grid Xwith a spacing of 2^n. For instance, <^T><4> gives a 16x16 tick grid. The Xcurrent implementation limits the visible tick marks to an 8x8 grid to avoid Xdisplay clutter, though 2x2 and 4x4 gridding are permitted. X XDigit values "6" (mnemonic for "hexagon") through "9" provide hexagonal (and Xthus triangular) gridding with edge lengths of 8,16,32 and 64 pixels, Xrespectively. Here the vertical and horizontal tick pitch are not equal, and Xthe user might have to redefine the tick offset in some applications (below). X XWhen ticking is enabled and the mark is present, the tick grid produced is Xoffset in x and y so that a tick point coincides with the current mark. This Xis particularly important with hexagonal tick grids, and allows the Xconstruction of radials with orientations that are multiple of sixty degrees X(through one of six near neighbor tick points), or thirty degrees (through Xclose neighbors). Analogously, square tick grids allow the construction of Xninety and forty-five degree lines, through immediate and near tick points. X XSelections: X XSelecting a line near an endpoint moves to the exact endpoint. Selecting Xon a line snaps to some portion of the line that is n/12ths of the way Xalong the line. This makes it easy to subdivide lines by 1/2ths, 1/4ths and X1/6ths. X XSelecting a rectangle moves to one of nine compass points along the boxes Xedges, or in its center. These points are analogous to PIC's "nw", "ne", "w", X"c" etc. location designations. X XSelecting an ellipse moves to one of five points: "n", "s", "e", "w" or "c". XThis avoids the intersection testing for selecting elsewhere along the curve. XAdditionally, this allows the ellipse to be subsequently changed to a box X(if the aesthetics of this style is better), with no fear that the lines Xdon't connect properly. This is because ellipses and rectangles touch X("kiss") and these four cardinal points, and are concentric. X XUndo: X XThe <^U> undo operation normally is used to undelete the last set of objects Xdeleted. It will also undo the effects of a tug, move or special transformation Xcommand. In the latter cases the undo is effected internally by specifng the Xreverse transformation. Should intervening selections have taken place, the Xundo will not reconstruct the original situation (this "feature" can be Xexploited to the user's gain). Undo in the case of tugging may not always Xwork exactly, as the reverse operation might tug new objects which became Xattached at the conclusion of the original operation. X XGrouping: X XTyping <^G> will take all selected objects and place them in a common X"group". A grouping associates objects for the sake of selection and Xdeselection, thereby facilitating moving, copying and deleting. The Xgrouping is nameless, and overrides any previous grouping (groupings Xare non-hierarchical). However, multiple disjoint groups may exist Xconcurrently. When a file is written, grouping information is lost. When Xit is read in, all items are placed in a new group, and the read input is Xselected. This makes it simple to composite foreground and background data Xtaken from respective files. X XUngrouping is done with the <^P> (pop grouping) command, which instantiates Xall selected objects into ungrouped, atomic entities. X XCopying: X XThe <^C> command replicates all selected objects, placing them in a new Xgroup, and displaying them offset from their original data. Most often Xit is immediately followed by a move command to place the data properly. XThe offset is by one tick unit (or by eight units if ticking is off) in both Xthe up and left directions. X XMoving: X XDragging the mark when objects are selected will move all selected objects Xby the vector length defined between the mark position and the button Xup position. X XCutting: X XThe <^X> key will allow all selected lines to fragment (cut) any deselected Xlines into disjoint pieces. The cut lines retain all properties of grouping Xand style. This is useful when "shaving" a set of lines to some slope, or Xfor doing hidden line removal by hand, opaquing the contents behind some X"polygon", etc. There is (at present) no way to uncut lines (i.e. rejoin Xlines with common vertex and similar slope). X XTugging: X XPlacing the mark on some object, and the dragging the mark (if no other Xobjects are selected) will "tug" that portion of the object. For instance, Xtugging a line's enpoint will move only that vertex, thus reorienting the Xline. Tugging any of the eight perimeter compass points of a box will align Xone or more edges while leaving the remaining edges untouched. Tugging of Xellipses is similar, except that only the four cardinal compass points along Xthe perimeter may be moved. Tugging the interior of an object (the central Xpoint for text, ellipses or boxes, or any non-endpoint on a line) is a short- Xhand way to "move" that object while it is still deselected. Because the mark Xbecomes red when its placed on an object, this is an indication that tugging Xwill take place if the mark is dragged from some object. X XSpecial Orientation Facilities: X XA sub-menu of orientation facilities is available with the <^S> (special) Xcommand. These operations include mirroring, ninety-degree rotation, X(non-)differential scaling, arbitrary rotation and alignment. All require the Xpresence of the mark to define a local origin, and operate only on selected Xobjects. The "Flip" command will mirror objects about the vertical axis passing through the mark. The "CCW" command rotates objects ninety degrees counter- Xclockwise about the mark. X XFor remaining commands, the mark must be coincident with exactly two line Xendpoints. One line must be "normal", and the other have an arrowhead (i.e., Xis left or right adjusted) not on the mark (origin). This small orientation Xsymbol defines the basis of transformation for various commands. The arrowed Xline is called the source basis, the normal line the destination basis. XThe magnify command resizes objects such that the length of the source basis Xwill be mapped into the length of the destination basis. In fact, if the bases Xare selected, this transformation will provide a visual confirmation of this. XThe stretch command performs differential magnification to map the source Xbasis onto the destination basis. The rotate command similarly orients the Xsource basis onto the destination basis. Finally, the align command orients Xthe source basis onto the Y (up) unit vector, and the destination basis onto Xthe X (across) unit vector. This general affine transformation allows for the Xeasy rectification of input data which has been digitized with some residual Xscaling or orientation. X XReading: X XThe <^R> command prompts for a filename for an input file, which is read Xin if found. Failing this, the operation is reattepted on {filename.lem}, Xwhich allows the omission of the .lem extension in most cases. Reading may Xalso be specified by running the program "lemming {filename}", which invokes Xthe read command on the command line specified file. Any number of files may Xbe specified on the command line. If "filename" is not found, the command is Xfails. If found, the dataset is checked to see if it is a valid lemming file, Xand the read is aborted if it fails this test. X XData read in belongs to a unique group (see Grouping) and is left selected, Xto facilitate positioning of fore and background files. X XWriting: X XThe <^W> command works analogously to the <^R> command for filing. The Xexternal representation is in ASCII. Because the file contains no Xhierarchical structure, users may edit it at will. At present, no provision Xfor overwrite testing is done. X XPic Output: X XThe <^O> key generates PIC style output, given an output file name. XRemember to save your drawing as a lemming file as well, the program does XNOT read PIC files for input. Vax 8600 users may have to use the sequence X<^V><^O> to trigger this command. X XQuitting: X XThe <^Q> command quits. Vax-8600 users will need to use <^V><^Q>. No Xconfirmation is done (at the moment). Quitting requires confirmation Xif the workspace has been changed. X XFine Points: X XWhen the mark is clicked, it is aligned to any object in its near proximity. XFailing this, it will align to the nearest grid point, if present. Finally, Xnear vertical and near horizontal motion align the grid point to the axis of Xmotion. This makes rectilinear drawing simple. X XArea selection is most often done (it has been observed) by dragging from Xtop to bottom. Some versions of "lemming" are experimenting with uphill Xdragging (mouse moving up the display, prior to release) as a means to Xdeselect objects within an area. X XText may contain embedded TeX or Troff commands as an aid to setting Xmathematics or other specialized strings. The length of the display text is Xthen no longer a good approximation to the hardcopy version. X XHelp: X XThe control(^) character is used for system help. If followed immediately Xby a single keystroke, it responds with the action defined by that key. XIf followed by a "space" character, help for all commands is given. X XThe command <^></> may be used to view all current fonts in their three Xemphases (regular, bold and italic), as described under the .lemrc section. XThe current default font and emphasis is flagged with the marker "[x]", where Xx is 'L' 'R' or 'C' to described the current alignment mode in effect. X XMachine Considerations: X XThe SUN version depicts selection ("red") by using a simple stipple pattern Xto make "grey". This causes dotted and dashed lines to become rather sparse, Xbut they are still distinguishable. X X END_OF_document if test 24201 -ne `wc -c <document`; then echo shar: \"document\" unpacked with wrong size! fi # end of overwriting check fi echo shar: End of shell archive. exit 0 -- Rich $alz "Anger is an energy" Cronus Project, BBN Labs rsalz@bbn.com Moderator, comp.sources.unix sources@uunet.uu.net