(FILECREATED " 9-Apr-87 11:43:55" {ERIS}KOTO>PLOTINSKETCH.;3 8424 changes to: (FNS IMAGE.OBJECT.CHANGED PLIO.EDITCLOSEFN) (VARS PLOTINSKETCHCOMS) previous date: " 8-Apr-87 11:38:56" {ERIS}KOTO>PLOTINSKETCH.;2) (* Copyright (c) 1987 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT PLOTINSKETCHCOMS) (RPAQQ PLOTINSKETCHCOMS ((FNS PLIO.IMAGEBOXFN PLIO.BUTTONEVENTINFN PLIO.REINSERTOBJ PLIO.EDITCLOSEFN) (FNS IMAGE.OBJECT.CHANGED))) (DEFINEQ (PLIO.IMAGEBOXFN (LAMBDA (PLOTIOBJ IMAGESTREAM CURRENTX RIGHTMARGIN) (* thh: " 6-Aug-86 09:09") (* * Determines size of plotimageobj) (PROG ((IMAGEWIDTH (IMAGEOBJPROP PLOTIOBJ (QUOTE WIDTH))) (IMAGEHEIGHT (IMAGEOBJPROP PLOTIOBJ (QUOTE HEIGHT))) (PLOT (IMAGEOBJPROP PLOTIOBJ (QUOTE OBJECTDATUM))) (SCALE (COND (IMAGESTREAM (DSPSCALE NIL IMAGESTREAM)) (T 1))) NEWREGION MINSIZE) (* (* this doesn't work with Sketch which has no rightmargin) (if (GREATERP (TIMES SCALE IMAGEWIDTH)  (DIFFERENCE RIGHTMARGIN CURRENTX)) then (if (NOT (EQ (IMAGESTREAMTYPE IMAGESTREAM) (QUOTE DISPLAY))) then  (HELP "PLOT image object too big")) (PROMPTPRINT "Image object too wide. Choose a smaller region")  (SETQ MINSIZE (MINSTREAMREGIONSIZE IMAGESTREAM PLOT)) (SETQ NEWREGION (GETREGION (CAR MINSIZE)  (CDR MINSIZE))) (SETQ IMAGEWIDTH (fetch WIDTH of NEWREGION)) (IMAGEOBJPROP PLOTIOBJ (QUOTE WIDTH) IMAGEWIDTH)  (SETQ IMAGEHEIGHT (fetch HEIGHT of NEWREGION)) (IMAGEOBJPROP PLOTIOBJ (QUOTE HEIGHT) IMAGEHEIGHT))) (RETURN (create IMAGEBOX XSIZE _(TIMES SCALE IMAGEWIDTH) YSIZE _(TIMES SCALE IMAGEHEIGHT) YDESC _ 0 XKERN _ 0))))) (PLIO.BUTTONEVENTINFN (LAMBDA (PLOTIMAGEOBJ WINDOWSTREAM SELECTION RELX RELY WINDOW TEXTSTREAM BUTTON) (* thh: " 6-Aug-86 10:34") (PROG ((CHOICEMENU (CONSTANT (create MENU CENTERFLG _ T ITEMS _(QUOTE ((Select (QUOTE SELECT) "Select the image object") (Reshape (QUOTE RESHAPE) "Reshape the image objcet") (Plot% Window (QUOTE EDIT) "Open a window containing plot"))))) ) (PLOT (IMAGEOBJPROP PLOTIMAGEOBJ (QUOTE OBJECTDATUM))) (IMAGEWIDTH (IMAGEOBJPROP PLOTIMAGEOBJ (QUOTE WIDTH))) (IMAGEHEIGHT (IMAGEOBJPROP PLOTIMAGEOBJ (QUOTE HEIGHT))) MINSIZE NEWREGION WIN NEWPLOT) (* * consider selection if BUTTON=NIL to handle plots in Koto version of Sketch) (COND ((OR (NOT BUTTON) (EQ BUTTON (QUOTE LEFT))) (SELECTQ (MENU CHOICEMENU) (RESHAPE (SETQ MINSIZE (MINSTREAMREGIONSIZE (WINDOWPROP (fetch PLOTWINDOW of PLOT) (QUOTE DSP)) PLOT)) (* Assumes the WINDOWSTREAM has been changed to fit  the imageobj) (SETQ NEWREGION (GETREGION (CAR MINSIZE) (CDR MINSIZE) (CREATEREGION (DSPXOFFSET NIL WINDOWSTREAM) (DSPYOFFSET NIL WINDOWSTREAM) IMAGEWIDTH IMAGEHEIGHT))) (IMAGEOBJPROP PLOTIMAGEOBJ (QUOTE WIDTH) (fetch WIDTH of NEWREGION)) (IMAGEOBJPROP PLOTIMAGEOBJ (QUOTE HEIGHT) (fetch HEIGHT of NEWREGION)) (* Redraw the Image object) (RETURN (QUOTE CHANGED))) (EDIT (SETQ NEWPLOT (COPYPLOT PLOT NIL (GETBOXREGION ( WIDTHIFWINDOW IMAGEWIDTH) ( HEIGHTIFWINDOW IMAGEHEIGHT T)) "Plot Edit Window")) (SETQ WIN (OPENPLOTWINDOW NEWPLOT)) (* Cache some info some that changes to NEWPLOT may be reinserted into TEXTSTREAM. Windowprops are used because they are not copied  (HACK)) (* * sketch doesn't pass down anything for TEXTSTREAM arg so must use viewer window instead) (WINDOWPROP WIN (QUOTE SOURCEHOST) (OR TEXTSTREAM WINDOW WINDOWSTREAM)) (WINDOWPROP WIN (QUOTE SOURCEIMAGEOBJ) PLOTIMAGEOBJ) (WINDOWADDPROP WIN (QUOTE CLOSEFN) (QUOTE PLIO.EDITCLOSEFN) T) (* * handle reinsert by a closefn rather than an new menu item -- similar to the behavior of Sketch image object  edits (PLOTADDMENUITEMS NEWPLOT (QUOTE RIGHT) (QUOTE ((Reinsert PLIO.REINSERTOBJ "Change source image object"))))) (RETURN T)) (RETURN NIL))) (T (RETURN NIL)))))) (PLIO.REINSERTOBJ (LAMBDA (PLOT) (* thh: " 6-Aug-86 09:48") (* * allows modified plot to be reinserted in document) (* * modified to work with Sketch as well as TEdit sources) (PROG ((PLOTWINDOW (fetch PLOTWINDOW of PLOT)) HOST OBJ) (SETQ HOST (WINDOWPROP PLOTWINDOW (QUOTE SOURCEHOST))) (SETQ OBJ (WINDOWPROP PLOTWINDOW (QUOTE SOURCEIMAGEOBJ))) (COND ((NOT (IMAGEOBJP OBJ)) (HELP "Not an IMAGEOBJ" OBJ))) (* Destructively change imageobj to retain EQ ness) (IMAGEOBJPROP OBJ (QUOTE OBJECTDATUM) (COPYPLOT PLOT)) (IMAGEOBJPROP OBJ (QUOTE WIDTH) (WINDOWPROP PLOTWINDOW (QUOTE WIDTH))) (IMAGEOBJPROP OBJ (QUOTE HEIGHT) (WINDOWPROP PLOTWINDOW (QUOTE HEIGHT))) (IMAGE.OBJECT.CHANGED HOST OBJ)))) (PLIO.EDITCLOSEFN (LAMBDA (W) (* thh: " 8-Apr-87 11:38") (* * this plot window is from an image object. Reinsert plot if requested) (* * later could test if plot has been changed -- if no changes don't ask to reinsert) (LET (RESULT) (SETQ RESULT (SELECTQ (MENU (CONSTANT (create MENU TITLE _ "Change source image object?" 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 (PLIO.REINSERTOBJ (WHICHPLOT W)) NIL) (NO NIL) (NIL (* user selected outside the menu -- abort the close) (QUOTE DON'T)) NIL)) (OR RESULT (WINDOWDELPROP W (QUOTE CLOSEFN) (QUOTE PLIO.EDITCLOSEFN))) (* clean up window prop -- required since currently  PLOT.CLOSEFN calls CLOSEW!) RESULT))) ) (DEFINEQ (IMAGE.OBJECT.CHANGED (LAMBDA (HOST OBJECT) (* thh: " 9-Apr-87 10:15") (* notifies HOST that OBJECT has changed and needs to  be redisplayed) (* * currently assumes object is in TEdit or Sketch) (LET (CANONICALHOST) (COND ((SETQ CANONICALHOST (CAR (NLSETQ (TEXTSTREAM HOST)))) (TEDIT.OBJECT.CHANGED CANONICALHOST OBJECT)) ((SETQ CANONICALHOST (CAR (NLSETQ (INSURE.SKETCH HOST)))) (* INSURE.SKETCH noerrorflg doesn't work) (SK.MARK.DIRTY CANONICALHOST) (* this sets SKETCHCHANGED prop of all viewers on the  sketch) (for SKW in (SKETCH.ALL.VIEWERS CANONICALHOST) do (REDISPLAYW SKW))) (T (HELP "Can't update image object in " HOST)))))) ) (PUTPROPS PLOTINSKETCH COPYRIGHT ("Xerox Corporation" 1987)) (DECLARE: DONTCOPY (FILEMAP (NIL (511 7336 (PLIO.IMAGEBOXFN 521 . 1825) (PLIO.BUTTONEVENTINFN 1827 . 5107) ( PLIO.REINSERTOBJ 5109 . 6079) (PLIO.EDITCLOSEFN 6081 . 7334)) (7337 8341 (IMAGE.OBJECT.CHANGED 7347 . 8339))))) STOP