(FILECREATED "19-Aug-85 16:48:19" {PHYLUM}<PAPERWORKS>SKETCHOBJ.;56 33921 changes to: (FNS SK.IMAGEOBJ.TRANSLATEFN CREATE.SKIMAGEOBJ.TYPE MAKE.IMAGE.OBJECT.OF.SKETCH SKETCH.IMAGEOBJ.OF.ELEMENT SKETCH.SCALE.OF.ELEMENT SKETCH.POSITION.OF.ELEMENT SK.ELEMENT.FROM.IMAGEOBJ SKETCH.IMAGE.OBJECT.ELEMENT SK.IMAGEOBJ.CHANGEFN) (VARS SKETCHOBJCOMS) previous date: "19-Jul-85 15:07:51" {PHYLUM}<PAPERWORKS>SKETCHOBJ.;52) (* Copyright (c) 1984, 1985 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT SKETCHOBJCOMS) (RPAQQ SKETCHOBJCOMS [(COMS (* the stuff to support sketch images in documents.) (FNS MAKE.IMAGE.OBJECT.OF.SKETCH SK.ELEMENT.FROM.IMAGEOBJ SKETCHIMAGEOBJ.FROM.VIEWER SKETCH.IMAGEOBJ SKIO.DISPLAYFN SKIO.IMAGEBOXFN SKIO.GETFN.2 SKIO.UPDATE.FROM.OLD.FORM SKIO.GETFN SKIO.PUTFN SKIO.COPYFN SKIO.BUTTONEVENTINFN TRANSLATE.REGION UPDATE.IMAGE.IN.DOCUMENT SK.COPY.IMAGEOBJ \CREATE.SKETCH.IMAGEFNS) (DECLARE: DONTCOPY DOEVAL@COMPILE (RECORDS SKETCHIMAGEOBJ SKETCHDOCUMENTINFO)) (P (\CREATE.SKETCH.IMAGEFNS)) (ADDVARS (IMAGEOBJGETFNS SKIO.GETFN))) (COMS (* stuff to support image objects as elements in a sketch) (FNS SKETCH.IMAGE.OBJECT.ELEMENT SKETCH.IMAGEOBJ.OF.ELEMENT SKETCH.SCALE.OF.ELEMENT SKETCH.POSITION.OF.ELEMENT CREATE.SKIMAGEOBJ.TYPE IMAGEBOXSIZE) (FNS SK.IMAGEOBJ.DRAWFN SK.IMAGEOBJ.REGIONFN SK.IMAGEOBJ.TRANSLATEFN SK.IMAGEOBJ.EXPANDFN SK.IMAGEOBJ.INSIDEFN SK.IMAGEOBJ.MOVEFN SK.IMAGEOBJ.CHANGEFN SK.IMAGEOBJ.READCHANGEFN SK.IMAGEOBJ.TRANSFORMFN) (RECORDS LOCALSKIMAGEOBJ SKIMAGEOBJ) (FNS READ.IMAGEOBJ WRITE.IMAGEOBJ) (P (CREATE.SKIMAGEOBJ.TYPE)) (ADDVARS (HPRINTMACROS (IMAGEOBJ . WRITE.IMAGEOBJ]) (* the stuff to support sketch images in documents.) (DEFINEQ (MAKE.IMAGE.OBJECT.OF.SKETCH [LAMBDA (SKETCH REGION SCALE GRIDSIZE) (* rrb "14-Aug-85 17:07") (* Returns a sketch image object. REGION is the region in sketch coordinates that the image object will show. SCALE is the scale at which it will be shown. GRIDSIZE is the grid size of the sketch. If SKETCH is a viewer, any of the other arguments that are NIL will be filled in from the values in the viewer. If SKETCH is a sketch, REGION defaults to the extent of the sketch, SCALE defaults to 1.0 and GRIDSIZE defaults to 8.0.) (SKETCH.IMAGEOBJ (INSURE.SKETCH SKETCH) (COND ((REGIONP REGION)) (REGION (ERROR REGION " illegal argument.")) (T (printout PROMPTWINDOW T "For now, MAKE.IMAGE.OBJECT.OF.SKETCH must have a region.") (CREATEREGION 0 0 300 200))) (OR (NUMBERP SCALE) 1.0) (OR GRIDSIZE 8.0]) (SK.ELEMENT.FROM.IMAGEOBJ [LAMBDA (IMAGEOBJ SKETCHW ORGPOS) (* rrb " 1-Aug-85 13:56") (* * returns a sketch element for an image object.) (SKETCH.IMAGE.OBJECT.ELEMENT IMAGEOBJ (SKETCHW.SCALE SKETCHW) ORGPOS]) (SKETCHIMAGEOBJ.FROM.VIEWER [LAMBDA (SKETCHW) (* rrb "26-Oct-84 10:27") (* * returns a SKETCH image object which describes the contents of a window.) (SKETCH.IMAGEOBJ (INSURE.SKETCH (SKETCH.FROM.VIEWER SKETCHW)) (SK.REGION.VIEWED SKETCHW) (WINDOW.SCALE SKETCHW) (SK.GRIDFACTOR SKETCHW]) (SKETCH.IMAGEOBJ [LAMBDA (SKETCH REGION SCALE GRID) (* rrb " 7-May-85 18:29") (DECLARE (GLOBALVARS SKETCHIMAGEFNS)) (* * returns an image obj which gives the functional information for a sketch object in a tedit file.) (IMAGEOBJCREATE (create SKETCHIMAGEOBJ SKIO.SKETCH ← SKETCH SKIO.REGION ← REGION SKIO.SCALE ← SCALE SKIO.GRID ← GRID) SKETCHIMAGEFNS]) (SKIO.DISPLAYFN [LAMBDA (BMOBJ STREAM) (* rrb " 8-May-85 14:40") (* * display function for a sketch image object) (PROG ((SKIO (IMAGEOBJPROP BMOBJ (QUOTE OBJECTDATUM))) REGION TYPE) (SETQ REGION (fetch (SKETCHIMAGEOBJ SKIO.REGION) of SKIO)) (COND ((EQMEMB (QUOTE DISPLAY) (SETQ TYPE (IMAGESTREAMTYPE STREAM))) (* This is being displayed on the screen) (PROG ((CLIPPINGSAV (DSPCLIPPINGREGION NIL STREAM)) (SCALE (fetch (SKETCHIMAGEOBJ SKIO.SCALE) of SKIO)) XOFFSETSAV YOFFSETSAV NEWXOFFSET NEWYOFFSET) (DSPOPERATION (QUOTE PAINT) STREAM) (* adjust the offsets of the stream so that the sketch does not have to be translated.) (SETQ XOFFSETSAV (DSPXOFFSET [FIXR (DIFFERENCE (DSPXPOSITION NIL STREAM) (SETQ NEWXOFFSET (QUOTIENT (fetch (REGION LEFT) of REGION) SCALE] STREAM)) (SETQ YOFFSETSAV (DSPYOFFSET [FIXR (DIFFERENCE (DSPYPOSITION NIL STREAM) (SETQ NEWYOFFSET (QUOTIENT (fetch (REGION BOTTOM) of REGION) SCALE] STREAM)) (DSPCLIPPINGREGION (TRANSLATE.REGION CLIPPINGSAV (FIXR NEWXOFFSET) (FIXR NEWYOFFSET)) STREAM) (DRAW.LOCAL.SKETCH [COND ((fetch (SKETCHIMAGEOBJ SKIO.LOCALSPECS) of SKIO)) (T (* SKIO.LOCALSPECS is used to cache the local coordinates of the sketch as it is being display now.) (replace (SKETCHIMAGEOBJ SKIO.LOCALSPECS) of SKIO with (MAKE.LOCAL.SKETCH (fetch (SKETCHIMAGEOBJ SKIO.SKETCH) of SKIO) REGION SCALE STREAM T] STREAM (SCALE.REGION REGION SCALE) SCALE) (* put offsets back) (DSPXOFFSET XOFFSETSAV STREAM) (DSPYOFFSET YOFFSETSAV STREAM) (DSPCLIPPINGREGION CLIPPINGSAV STREAM))) (T (PROG ((SKSCALE (fetch (SKETCHIMAGEOBJ SKIO.SCALE) of SKIO)) (STRMSCALE (DSPSCALE NIL STREAM)) SKTOSTRMSCALE SKXOFFSET SKYOFFSET) (* the TRANSLATE.SKETCH is to move the sketch to the right place on the page. When all streams support tranlation, this should be taken out.) (SETQ SKTOSTRMSCALE (QUOTIENT SKSCALE STRMSCALE)) (SETQ SKXOFFSET (DIFFERENCE (TIMES (DSPXPOSITION NIL STREAM) SKTOSTRMSCALE) (fetch (REGION LEFT) of REGION))) (SETQ SKYOFFSET (DIFFERENCE (TIMES (DSPYPOSITION NIL STREAM) SKTOSTRMSCALE) (fetch (REGION BOTTOM) of REGION))) (RETURN (DRAW.LOCAL.SKETCH (MAKE.LOCAL.SKETCH (TRANSLATE.SKETCH (COPY (fetch (SKETCHIMAGEOBJ SKIO.SKETCH) of SKIO)) (IMINUS SKXOFFSET) (IMINUS SKYOFFSET)) (SETQ REGION (TRANSLATE.REGION REGION SKXOFFSET SKYOFFSET)) SKTOSTRMSCALE STREAM) STREAM (SCALE.REGION REGION SKTOSTRMSCALE]) (SKIO.IMAGEBOXFN [LAMBDA (IMAGEOBJ STREAM) (* rrb " 7-May-85 19:20") (* size function for a sketch image object.) (PROG ((SKOBJ (IMAGEOBJPROP IMAGEOBJ (QUOTE OBJECTDATUM))) SKREG SKW SKH SCALEFACTOR) (* determine the scale between the sketch specs and the stream.) (SETQ SCALEFACTOR (QUOTIENT (fetch (SKETCHIMAGEOBJ SKIO.SCALE) of SKOBJ) (DSPSCALE NIL STREAM))) (SETQ SKW (FIXR (FQUOTIENT (fetch (REGION WIDTH) of (SETQ SKREG (fetch (SKETCHIMAGEOBJ SKIO.REGION) of SKOBJ))) SCALEFACTOR))) (SETQ SKH (FIXR (FQUOTIENT (fetch (REGION HEIGHT) of SKREG) SCALEFACTOR))) (RETURN (create IMAGEBOX XSIZE ← SKW YSIZE ← SKH YDESC ← 0 XKERN ← 0]) (SKIO.GETFN.2 [LAMBDA (STREAM) (* rrb "18-Jul-85 17:23") (* Get a description of a sketch object from the file.) (SKETCH.IMAGEOBJ [PROG ((READSKETCH (HREAD STREAM))) (RETURN (COND ((NLISTP (CAR READSKETCH)) (* pre property list format, update it.) (SKIO.UPDATE.FROM.OLD.FORM READSKETCH)) (T (* values of all properties and sketch elements were written out as a LIST.) (create SKETCH ALLSKETCHPROPS ←(CAR READSKETCH) SKETCHELTS ←(CDR READSKETCH] (READ STREAM) (READ STREAM) (READ STREAM]) (SKIO.UPDATE.FROM.OLD.FORM [LAMBDA (OLDSKETCH) (* rrb "18-Jul-85 17:24") (* converts a sketch from old form to new form.) (* update the arrowhead format to the new form.) (MAPGLOBALSKETCHELEMENTS (CDR OLDSKETCH) (FUNCTION SK.UPDATE.ARROWHEAD.FORMAT)) (create SKETCH SKETCHNAME ←(CAR OLDSKETCH) SKETCHELTS ←(CDR OLDSKETCH]) (SKIO.GETFN [LAMBDA (STREAM) (* rrb " 7-May-85 11:21") (* Get a description of a sketch object from the file. This is an old version left around in case old format object still exist.) (printout T "This file contains sketch that is in an old format. " "To update it to the new format, " "load this file into a Harmony sysout and do a 'Put' from there.") (ERROR "old format Sketch object"]) (SKIO.PUTFN [LAMBDA (IMAGEOBJ STREAM) (* rrb "12-May-85 18:34") (* Put a description of a sketch object into the file.) (PROG ((SKETCHIMAGEOBJ (IMAGEOBJPROP IMAGEOBJ (QUOTE OBJECTDATUM))) SKETCH) (SETQ SKETCH (fetch (SKETCHIMAGEOBJ SKIO.SKETCH) of SKETCHIMAGEOBJ)) (* can't print sketch directly because it contains a TCONC cell which must be reconstructed on reading in.) (HPRINT (CONS (fetch (SKETCH ALLSKETCHPROPS) of SKETCH) (fetch (SKETCH SKETCHELTS) of SKETCH)) STREAM T) (PRINT (fetch (SKETCHIMAGEOBJ SKIO.REGION) of SKETCHIMAGEOBJ) STREAM) (PRINT (fetch (SKETCHIMAGEOBJ SKIO.SCALE) of SKETCHIMAGEOBJ) STREAM) (PRINT (fetch (SKETCHIMAGEOBJ SKIO.GRID) of SKETCHIMAGEOBJ) STREAM]) (SKIO.COPYFN [LAMBDA (IMAGEOBJ) (* rrb "26-Oct-84 10:27") (* makes a copy of a sketch image object.) (PROG [(SKETCHOBJ (IMAGEOBJPROP IMAGEOBJ (QUOTE OBJECTDATUM] (RETURN (SKETCH.IMAGEOBJ (COPY (fetch (SKETCHIMAGEOBJ SKIO.SKETCH) of SKETCHOBJ)) (COPY (fetch (SKETCHIMAGEOBJ SKIO.REGION) of SKETCHOBJ)) (fetch (SKETCHIMAGEOBJ SKIO.SCALE) of SKETCHOBJ) (fetch (SKETCHIMAGEOBJ SKIO.GRID) of SKETCHOBJ]) (SKIO.BUTTONEVENTINFN [LAMBDA (IMAGEOBJ WINDOW) (* rrb " 9-Jul-85 11:07") (* the user has pressed a button inside the sketch object IMAGEOBJ. Offer a chance to edit it in a separate window.) (PROG [(OBJ (IMAGEOBJPROP IMAGEOBJ (QUOTE OBJECTDATUM] (SELECTQ [MENU (create MENU ITEMS ←(QUOTE ((Edit% sketch (QUOTE EDIT) "opens a window in which this sketch can be changed."] [EDIT (* user wants to edit it) (PROG ((SKREG (fetch (SKETCHIMAGEOBJ SKIO.REGION) of OBJ)) (SCALE (fetch (SKETCHIMAGEOBJ SKIO.SCALE) of OBJ)) (SKETCH (fetch (SKETCHIMAGEOBJ SKIO.SKETCH) of OBJ)) SKW) (* give the sketch a new name so that it doesn't get confused about the real sketch on the property list. The whole idea of names should probably be scrapped) (SETQ SKW (SKETCHW.CREATE (create SKETCH SKETCHNAME ←(QUOTE a% figure% from% a% document) SKETCHPROPS ←(COPY (fetch (SKETCH SKETCHPROPS) of SKETCH)) SKETCHELTS ←(COPY (fetch (SKETCH SKETCHELTS) of SKETCH))) SKREG (GETBOXREGION (WIDTHIFWINDOW (FIXR (FQUOTIENT (fetch (REGION WIDTH) of SKREG) SCALE))) (HEIGHTIFWINDOW (FIXR (FQUOTIENT (fetch (REGION HEIGHT) of SKREG) SCALE)) T)) NIL SCALE T (fetch (SKETCHIMAGEOBJ SKIO.GRID) of OBJ))) (* keep track of enough information to find this sketch in the document if the user closes the window.) (WINDOWPROP SKW (QUOTE DOCUMENTINFO) (create SKETCHDOCUMENTINFO FROMIMAGEOBJ ← IMAGEOBJ FROMTEDITWINDOW ← WINDOW] NIL]) (TRANSLATE.REGION [LAMBDA (REGION NEWLEFT NEWBOTTOM) (* rrb "20-Sep-84 14:12") (* translates a region so that its new lower left corner is at NEWLEFT NEWBOTTOM) (CREATEREGION (PLUS (fetch (REGION LEFT) of REGION) NEWLEFT) (PLUS (fetch (REGION BOTTOM) of REGION) NEWBOTTOM) (fetch (REGION WIDTH) of REGION) (fetch (REGION HEIGHT) of REGION]) (UPDATE.IMAGE.IN.DOCUMENT [LAMBDA (SKW) (* rrb "17-Jan-85 12:56") (* * this sketch window was the result of editting a sketch from a document. Ask if the user wants to put it back and if so, do it.) (SELECTQ (MENU (create MENU TITLE ← "Put changes back into Document?" ITEMS ←(QUOTE ((Yes (QUOTE YES) "this image used in the document instead of the one that is there.") (No (QUOTE NO) "the changes made to this image will not be put into the document."))) CENTERFLG ← T)) (YES (PROG ((DOCINFO (WINDOWPROP SKW (QUOTE DOCUMENTINFO))) TEXTOBJ OLDIMAGEOBJ POS) (COND ([NOT (SETQ TEXTOBJ (TEXTOBJ (fetch (SKETCHDOCUMENTINFO FROMTEDITWINDOW) of DOCINFO] (PROMPTPRINT "Can't find the edit window for the source document.") (RETURN))) (COND ([NOT (SETQ POS (TEDIT.FIND.OBJECT TEXTOBJ (SETQ OLDIMAGEOBJ (fetch (SKETCHDOCUMENTINFO FROMIMAGEOBJ) of DOCINFO] (PROMPTPRINT "Can't find this sketch in the document it came from.") (* later should allow the user to specify where.) (RETURN))) (TEDIT.DELETE (SETQ TEXTOBJ (TEXTSTREAM TEXTOBJ)) POS 1) (TEDIT.INSERT.OBJECT (SKETCHIMAGEOBJ.FROM.VIEWER SKW) TEXTOBJ POS))) (NIL (* if the user clicks outside, stop the close.) (QUOTE DON'T)) (NO NIL) NIL]) (SK.COPY.IMAGEOBJ [LAMBDA (GELT WINDOW CALLWHENCOPIEDFN) (* rrb "23-Oct-84 10:59") (* * makes a copy of a image object sketch element. Has to call the image objects copyfn. Calls its its WHENCOPIEDFN if CALLWHENCOPIEDFN is not NIL) (PROG (INDVGELT IMAGEOBJ FN NEWSKELT) [SETQ NEWSKELT (COND ((AND (SETQ FN (IMAGEOBJPROP [SETQ IMAGEOBJ (fetch (SKIMAGEOBJ SKIMAGEOBJ) of (SETQ INDVGELT (fetch (GLOBALPART INDIVIDUALGLOBALPART) of GELT] (QUOTE COPYFN))) (NEQ FN (QUOTE NILL))) (create GLOBALPART INDIVIDUALGLOBALPART ←(create SKIMAGEOBJ using INDVGELT SKIMAGEOBJ ←(APPLY* FN IMAGEOBJ)) COMMONGLOBALPART ←(fetch (GLOBALPART COMMONGLOBALPART) of GELT))) (T (COPY GELT] (COND ((AND CALLWHENCOPIEDFN (SETQ FN (IMAGEOBJPROP IMAGEOBJ (QUOTE WHENCOPIEDFN))) (NEQ FN (QUOTE NILL))) (* documentation calls for passing text streams as well but there aren't any.) (APPLY* FN IMAGEOBJ WINDOW))) (RETURN NEWSKELT]) (\CREATE.SKETCH.IMAGEFNS [LAMBDA NIL (* rrb "25-Feb-85 16:53") (DECLARE (GLOBALVARS SKETCHIMAGEFNS)) (* creates the IMAGEFNS vector for the sketch image object.) (COND ((IMAGEFNSP SKETCHIMAGEFNS)) (T (SETQ SKETCHIMAGEFNS (IMAGEFNSCREATE (FUNCTION SKIO.DISPLAYFN) (FUNCTION SKIO.IMAGEBOXFN) (FUNCTION SKIO.PUTFN) (FUNCTION SKIO.GETFN.2) (FUNCTION SKIO.COPYFN) (FUNCTION SKIO.BUTTONEVENTINFN) (FUNCTION NILL) (FUNCTION NILL) (FUNCTION NILL) (FUNCTION NILL) (FUNCTION NILL) (FUNCTION NILL) (FUNCTION NILL]) ) (DECLARE: DONTCOPY DOEVAL@COMPILE [DECLARE: EVAL@COMPILE (RECORD SKETCHIMAGEOBJ (SKIO.SKETCH SKIO.REGION SKIO.SCALE SKIO.LOCALSPECS SKIO.GRID)) (RECORD SKETCHDOCUMENTINFO (FROMIMAGEOBJ FROMTEDITWINDOW)) ] ) (\CREATE.SKETCH.IMAGEFNS) (ADDTOVAR IMAGEOBJGETFNS SKIO.GETFN) (* stuff to support image objects as elements in a sketch) (DEFINEQ (SKETCH.IMAGE.OBJECT.ELEMENT [LAMBDA (IMAGEOBJ SCALE GLOBALPOS) (* rrb " 1-Aug-85 13:53") (* internal function for creating a global imageobj sketch element. Called during copy select insert and during editting.) (PROG (IMOBJSIZE) (SETQ IMOBJSIZE (IMAGEBOXSIZE IMAGEOBJ)) (OR SCALE (SETQ SCALE 1.0)) (RETURN (create GLOBALPART INDIVIDUALGLOBALPART ←(create SKIMAGEOBJ SKIMAGEOBJ ← IMAGEOBJ SKIMOBJ.GLOBALREGION ←(CREATEREGION (COND (GLOBALPOS (fetch (POSITION XCOORD) of GLOBALPOS)) (T 0)) (COND (GLOBALPOS (fetch (POSITION YCOORD) of GLOBALPOS)) (T 0)) (TIMES (fetch (IMAGEBOX XSIZE) of IMOBJSIZE) SCALE) (TIMES (fetch (IMAGEBOX YSIZE) of IMOBJSIZE) SCALE)) SKIMOBJ.ORIGSCALE ← SCALE SKIMOBJ.OFFSETPOS ←(create POSITION XCOORD ←(fetch (IMAGEBOX XKERN) of IMOBJSIZE) YCOORD ←(fetch (IMAGEBOX YDESC) of IMOBJSIZE))) COMMONGLOBALPART ←(create COMMONGLOBALPART MAXSCALE ←(TIMES SCALE MINIMUM.VISIBLE.SCALE.FACTOR) MINSCALE ←(QUOTIENT SCALE DEFAULT.VISIBLE.SCALE.FACTOR]) (SKETCH.IMAGEOBJ.OF.ELEMENT [LAMBDA (ELEMENT) (* rrb "14-Aug-85 16:38") (* returns the image object from an image object sketch element.) (fetch (SKIMAGEOBJ SKIMAGEOBJ) of (fetch (GLOBALPART INDIVIDUALGLOBALPART) of ELEMENT]) (SKETCH.SCALE.OF.ELEMENT [LAMBDA (ELEMENT) (* rrb "14-Aug-85 16:39") (* returns the scale from an image object sketch element.) (fetch (SKIMAGEOBJ SKIMOBJ.ORIGSCALE) of (fetch (GLOBALPART INDIVIDUALGLOBALPART) of ELEMENT]) (SKETCH.POSITION.OF.ELEMENT [LAMBDA (ELEMENT) (* rrb "14-Aug-85 16:42") (* returns the position from an image object sketch element.) (PROG [(REG (fetch (SKIMAGEOBJ SKIMOBJ.GLOBALREGION) of (fetch (GLOBALPART INDIVIDUALGLOBALPART) of ELEMENT] (RETURN (CREATEPOSITION (fetch (REGION LEFT) of REG) (fetch (REGION BOTTOM) of REG]) (CREATE.SKIMAGEOBJ.TYPE [LAMBDA NIL (* rrb "19-Aug-85 16:40") (* create a sketch type that allows image objects to appear in sketches.) (COND ((NOT (SKETCH.ELEMENT.TYPEP (QUOTE SKIMAGEOBJ))) (CREATE.SKETCH.ELEMENT.TYPE (QUOTE SKIMAGEOBJ) NIL "functions for using image objects in sketches" (FUNCTION SK.IMAGEOBJ.DRAWFN) (FUNCTION SK.IMAGEOBJ.EXPANDFN) (QUOTE OBSOLETE) (FUNCTION SK.IMAGEOBJ.CHANGEFN) (FUNCTION NILL) (FUNCTION SK.IMAGEOBJ.INSIDEFN) (FUNCTION SK.IMAGEOBJ.REGIONFN) (FUNCTION SK.IMAGEOBJ.TRANSLATEFN) (FUNCTION NILL) (FUNCTION SK.IMAGEOBJ.READCHANGEFN) (FUNCTION SK.IMAGEOBJ.TRANSFORMFN) NIL]) (IMAGEBOXSIZE [LAMBDA (IMAGEOBJ) (* rrb "31-Mar-84 09:21") (* returns the size of an imageobj) (APPLY* (fetch (IMAGEFNS IMAGEBOXFN) of (fetch (IMAGEOBJ IMAGEOBJFNS) of IMAGEOBJ)) IMAGEOBJ]) ) (DEFINEQ (SK.IMAGEOBJ.DRAWFN [LAMBDA (IMAGEOBJELT WINDOW REGION) (* rrb "25-Oct-84 10:27") (* shows an image object element) (PROG ((IMAGEOBJ (fetch (SKIMAGEOBJ SKIMAGEOBJ) of (fetch (SCREENELT INDIVIDUALGLOBALPART) of IMAGEOBJELT))) (LOCALIMOBJ (fetch (SCREENELT LOCALPART) of IMAGEOBJELT)) LOCALPOS LOCALOFFSET) (SETQ LOCALPOS (fetch (LOCALSKIMAGEOBJ SKIMOBJLOCALPOS) of LOCALIMOBJ)) (SETQ LOCALOFFSET (fetch (LOCALSKIMAGEOBJ SKIMOBJLOCALOFFSETPOS) of LOCALIMOBJ)) (* move stream to correct position.) (MOVETO (PLUS (fetch (POSITION XCOORD) of LOCALPOS) (fetch (POSITION XCOORD) of LOCALOFFSET)) (PLUS (fetch (POSITION YCOORD) of LOCALPOS) (fetch (POSITION YCOORD) of LOCALOFFSET)) WINDOW) (COND ((type? ANNO (IMAGEOBJPROP IMAGEOBJ (QUOTE OBJECTDATUM))) (* handle annotations specially so they get the scale.) (ANNO.DISPLAYFN IMAGEOBJ WINDOW (IMAGESTREAMTYPE WINDOW) NIL (fetch (LOCALSKIMAGEOBJ SKIMOBJLOCALSCALE) of LOCALIMOBJ))) (T (APPLY* (IMAGEOBJPROP IMAGEOBJ (QUOTE DISPLAYFN)) IMAGEOBJ WINDOW]) (SK.IMAGEOBJ.REGIONFN [LAMBDA (IMAGEOJBELT) (* rrb " 4-Oct-84 13:34") (* determines the local region covered by image object elt.) (fetch (LOCALSKIMAGEOBJ SKIMOBJLOCALREGION) of (fetch (SCREENELT LOCALPART) of IMAGEOJBELT]) (SK.IMAGEOBJ.TRANSLATEFN [LAMBDA (GIMAGEOBJ DELTAPOS WINDOW) (* rrb "19-Aug-85 10:45") (* moves a imageobj figure element to a new position.) (PROG ((INDIMAGEOBJELT (fetch (GLOBALPART INDIVIDUALGLOBALPART) of GIMAGEOBJ)) IMAGEOBJ FN) (COND ((AND (SETQ FN (IMAGEOBJPROP (SETQ IMAGEOBJ (fetch (SKIMAGEOBJ SKIMAGEOBJ) of INDIMAGEOBJELT)) (QUOTE WHENMOVEDFN))) (NEQ FN (QUOTE NILL))) (* documentation calls for passing text streams as well but there aren't any.) (APPLY* FN IMAGEOBJ WINDOW WINDOW))) (* update the region positions.) (RETURN (create GLOBALPART COMMONGLOBALPART ←(fetch (GLOBALPART COMMONGLOBALPART) of GIMAGEOBJ) INDIVIDUALGLOBALPART ←(create SKIMAGEOBJ using INDIMAGEOBJELT SKIMOBJ.GLOBALREGION ←( TRANSLATE.REGION (fetch (SKIMAGEOBJ SKIMOBJ.GLOBALREGION) of INDIMAGEOBJELT) (fetch (POSITION XCOORD) of DELTAPOS) (fetch (POSITION YCOORD) of DELTAPOS]) (SK.IMAGEOBJ.EXPANDFN [LAMBDA (GIMAGEOBJPART SCALE) (* rrb "29-Jan-85 14:50") (* creates a local imageobject screen element from a global imageobject element.) (PROG ((GIMAGEOBJ (fetch (GLOBALPART INDIVIDUALGLOBALPART) of GIMAGEOBJPART)) LOCALREG LOCALPOS IMAGESIZE) (SETQ LOCALREG (SCALE.REGION (fetch (SKIMAGEOBJ SKIMOBJ.GLOBALREGION) of GIMAGEOBJ) SCALE)) (RETURN (create SCREENELT LOCALPART ←(create LOCALSKIMAGEOBJ SKIMOBJLOCALPOS ←(create POSITION XCOORD ←(fetch (REGION LEFT) of LOCALREG) YCOORD ←(fetch (REGION BOTTOM) of LOCALREG)) SKIMOBJLOCALSCALE ←(QUOTIENT SCALE (fetch (SKIMAGEOBJ SKIMOBJ.ORIGSCALE) of GIMAGEOBJ)) SKIMOBJLOCALREGION ← LOCALREG SKIMOBJLOCALOFFSETPOS ←(SK.SCALE.POSITION.INTO.VIEWER (fetch (SKIMAGEOBJ SKIMOBJ.OFFSETPOS) of GIMAGEOBJ) SCALE)) GLOBALPART ← GIMAGEOBJPART]) (SK.IMAGEOBJ.INSIDEFN [LAMBDA (GIMAGEOBJ WREG) (* rrb "31-Mar-84 09:15") (* determines if the global annotation element is inside of WREG.) (REGIONSINTERSECTP (fetch (SKIMAGEOBJ SKIMOBJ.GLOBALREGION) of (fetch (GLOBALPART INDIVIDUALGLOBALPART) of GIMAGEOBJ)) WREG]) (SK.IMAGEOBJ.MOVEFN [LAMBDA (IMAGEOBJELT SELPOS NEWINPUTPT WINDOW) (* rrb "11-Jul-85 13:55") (* moves a annotation element to a new position.) (PROG ((GIMOBJ (fetch (SCREENELT GLOBALPART) of IMAGEOBJELT)) (SCALEDNEWPOS (SK.MAP.INPUT.PT.TO.GLOBAL NEWINPUTPT (WINDOW.SCALE WINDOW))) GREG GINDV FN IMAGEOBJ) (* update the position) [SETQ GREG (fetch (SKIMAGEOBJ SKIMOBJ.GLOBALREGION) of (SETQ GINDV (fetch (GLOBALPART INDIVIDUALGLOBALPART) of GIMOBJ] (replace (SKIMAGEOBJ SKIMOBJ.GLOBALREGION) of GINDV with (CREATEREGION (fetch (POSITION XCOORD) of SCALEDNEWPOS) (fetch (POSITION YCOORD) of SCALEDNEWPOS) (fetch (REGION WIDTH) of GREG) (fetch (REGION HEIGHT) of GREG))) (COND ((AND (SETQ FN (IMAGEOBJPROP (SETQ IMAGEOBJ (fetch (SKIMAGEOBJ SKIMAGEOBJ) of GINDV)) (QUOTE WHENMOVEDFN))) (NEQ FN (QUOTE NILL))) (* documentation calls for passing text streams as well but there aren't any.) (APPLY* FN IMAGEOBJ WINDOW))) (RETURN GIMOBJ]) (SK.IMAGEOBJ.CHANGEFN [LAMBDA (IMAGEOBJELTS WINDOW HOW) (* rrb " 1-Aug-85 13:57") (* * user has indicated that they want to change the image object in IMAGEOBJELT) (* HOW is always T because SK.IMAGEOBJ.READCHANGEFN always returns T) (* for now only work on the first one.) (PROG (FN (IMAGEOBJELT (CAR IMAGEOBJELTS)) SKIMOBJELT NEWIMAGEOBJ IMAGEOBJ OLDREG) (SETQ SKIMOBJELT (fetch (SCREENELT INDIVIDUALGLOBALPART) of IMAGEOBJELT)) (SETQ IMAGEOBJ (fetch (SKIMAGEOBJ SKIMAGEOBJ) of SKIMOBJELT)) (* call the BUTTONEVENTINFN even though this may not work because much information is unavailable.) (COND ((AND (SETQ FN (IMAGEOBJPROP IMAGEOBJ (QUOTE BUTTONEVENTINFN))) (NEQ FN (QUOTE NILL))) (AND (SETQ NEWIMAGEOBJ (APPLY* (IMAGEOBJPROP IMAGEOBJ (QUOTE BUTTONEVENTINFN)) IMAGEOBJ WINDOW)) (RETURN (LIST (SKETCH.IMAGE.OBJECT.ELEMENT (COND ((type? IMAGEOBJ NEWIMAGEOBJ) NEWIMAGEOBJ) (T IMAGEOBJ)) (fetch (SKIMAGEOBJ SKIMOBJ.ORIGSCALE) of SKIMOBJELT) (create POSITION XCOORD ←(fetch (REGION LEFT) of (SETQ OLDREG (fetch (SKIMAGEOBJ SKIMOBJ.GLOBALREGION) of SKIMOBJELT)) ) YCOORD ←(fetch (REGION BOTTOM) of OLDREG]) (SK.IMAGEOBJ.READCHANGEFN [LAMBDA (SKW) (* return T so SK.IMAGE.OBJ.CHANGEFN will always be called.) T]) (SK.IMAGEOBJ.TRANSFORMFN [LAMBDA (GELT TRANSFORMFN TRANSFORMDATA SCALEFACTOR) (* rrb "29-Apr-85 16:08") (* * returns a copy of the global SKIMAGEOBJ element that has its region transformed by transformfn. TRANSFORMDATA is arbitrary data that is passed to tranformfn.) (PROG ((INDVPART (fetch (GLOBALPART INDIVIDUALGLOBALPART) of GELT))) (RETURN (create GLOBALPART using GELT INDIVIDUALGLOBALPART ←(create SKIMAGEOBJ using INDVPART SKIMOBJ.GLOBALREGION ←( SK.TRANSFORM.REGION (fetch (SKIMAGEOBJ SKIMOBJ.GLOBALREGION) of INDVPART) TRANSFORMFN TRANSFORMDATA] ) ) [DECLARE: EVAL@COMPILE (RECORD LOCALSKIMAGEOBJ ((SKIMOBJLOCALPOS) SKIMOBJLOCALSCALE SKIMOBJLOCALREGION SKIMOBJLOCALOFFSETPOS)) (TYPERECORD SKIMAGEOBJ (SKIMAGEOBJ SKIMOBJ.GLOBALREGION SKIMOBJ.ORIGSCALE SKIMOBJ.OFFSETPOS)) ] (DEFINEQ (READ.IMAGEOBJ [LAMBDA (INFILE) (* rrb "31-Mar-84 12:51") (* function written onto the file by WRITE.IMAGEOBJ which is called by HPRINT function.) (* uses STREAM freely from an enclosing call of ANNO.GETFN. This is fragile and may break if used by other that TEDIT.) (PROG ((GETFN (READ INFILE HPRINTRDTBL))) (RETURN (COND ((AND (LISTP GETFN) (NULL (CDR GETFN))) (APPLY* (CAR GETFN) INFILE STREAM)) (T (ERROR "incorrect format for image object" GETFN]) (WRITE.IMAGEOBJ [LAMBDA (IMAGEOBJ STREAM) (* rrb "19-Dec-84 14:50") (* HPRINT function for writing out IMAGE OBJECTS) (* write out the name of the function to read things back in with.) (PRINT (LIST (fetch (IMAGEFNS GETFN) of (fetch (IMAGEOBJ IMAGEOBJFNS) of IMAGEOBJ))) STREAM HPRINTRDTBL) (APPLY* (fetch (IMAGEFNS PUTFN) of (fetch (IMAGEOBJ IMAGEOBJFNS) of IMAGEOBJ)) IMAGEOBJ STREAM) T]) ) (CREATE.SKIMAGEOBJ.TYPE) (ADDTOVAR HPRINTMACROS (IMAGEOBJ . WRITE.IMAGEOBJ)) (PUTPROPS SKETCHOBJ COPYRIGHT ("Xerox Corporation" 1984 1985)) (DECLARE: DONTCOPY (FILEMAP (NIL (1854 18466 (MAKE.IMAGE.OBJECT.OF.SKETCH 1864 . 2837) (SK.ELEMENT.FROM.IMAGEOBJ 2839 . 3116) (SKETCHIMAGEOBJ.FROM.VIEWER 3118 . 3521) (SKETCH.IMAGEOBJ 3523 . 3985) (SKIO.DISPLAYFN 3987 . 7431) (SKIO.IMAGEBOXFN 7433 . 8433) (SKIO.GETFN.2 8435 . 9286) (SKIO.UPDATE.FROM.OLD.FORM 9288 . 9839) (SKIO.GETFN 9841 . 10339) (SKIO.PUTFN 10341 . 11374) (SKIO.COPYFN 11376 . 11984) ( SKIO.BUTTONEVENTINFN 11986 . 14086) (TRANSLATE.REGION 14088 . 14610) (UPDATE.IMAGE.IN.DOCUMENT 14612 . 16370) (SK.COPY.IMAGEOBJ 16372 . 17634) (\CREATE.SKETCH.IMAGEFNS 17636 . 18464)) (18821 22953 ( SKETCH.IMAGE.OBJECT.ELEMENT 18831 . 20388) (SKETCH.IMAGEOBJ.OF.ELEMENT 20390 . 20767) ( SKETCH.SCALE.OF.ELEMENT 20769 . 21144) (SKETCH.POSITION.OF.ELEMENT 21146 . 21684) ( CREATE.SKIMAGEOBJ.TYPE 21686 . 22616) (IMAGEBOXSIZE 22618 . 22951)) (22954 32075 (SK.IMAGEOBJ.DRAWFN 22964 . 24457) (SK.IMAGEOBJ.REGIONFN 24459 . 24831) (SK.IMAGEOBJ.TRANSLATEFN 24833 . 26162) ( SK.IMAGEOBJ.EXPANDFN 26164 . 27369) (SK.IMAGEOBJ.INSIDEFN 27371 . 27824) (SK.IMAGEOBJ.MOVEFN 27826 . 29317) (SK.IMAGEOBJ.CHANGEFN 29319 . 31127) (SK.IMAGEOBJ.READCHANGEFN 31129 . 31309) ( SK.IMAGEOBJ.TRANSFORMFN 31311 . 32073)) (32314 33754 (READ.IMAGEOBJ 32324 . 33105) (WRITE.IMAGEOBJ 33107 . 33752))))) STOP