(FILECREATED "11-May-87 12:15:55" {QV}<NOTECARDS>1.3K>NEXT>PMIPATCH038.;1 6552   

      changes to:  (VARS PMIPATCH038COMS)
		   (FNS BMOBJ.BUTTONEVENTINFN))


(* Copyright (c) 1987 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT PMIPATCH038COMS)

(RPAQQ PMIPATCH038COMS ((* * rht&pmi 5/8/87: fixes bug %# 495: divide by zero error while scaling a 
			     bitmap. Loaded the current souce of BMOBJ.DISPLAYFN and compiled it into 
			     our world. Removed TEdit dependent stuff used in the CHANGE.SCALE option 
			     of BMOBJ.BUTTONEVENTINFN, replaced with PROMPTFORWORD)
			  (* * Changes to KOTOTEDITPATCHES)
			  (FNS BMOBJ.DISPLAYFN BMOBJ.BUTTONEVENTINFN)))
(* * rht&pmi 5/8/87: fixes bug %# 495: divide by zero error while scaling a bitmap. Loaded the
 current souce of BMOBJ.DISPLAYFN and compiled it into our world. Removed TEdit dependent stuff
 used in the CHANGE.SCALE option of BMOBJ.BUTTONEVENTINFN, replaced with PROMPTFORWORD)

(* * Changes to KOTOTEDITPATCHES)

(DEFINEQ

(BMOBJ.DISPLAYFN
  (LAMBDA (IMAGEOBJ IMAGE.STREAM)                            (* ; "Edited 17-Apr-87 15:02 by jds")
                                                             (* ; 
							     
"function which displays a scaled bitmap on only an interpress stream for now")
    (PROG ((FACTOR (fetch (BITMAPOBJ BMOBJSCALEFACTOR) of (IMAGEOBJPROP IMAGEOBJ
										(QUOTE OBJECTDATUM))
			      ))
	     (BITMAP (fetch (BITMAPOBJ BITMAP) of (IMAGEOBJPROP IMAGEOBJ (QUOTE OBJECTDATUM)))
		     )
	     (CACHE (IMAGEOBJPROP IMAGEOBJ (QUOTE CACHED.BITMAP)))
	     SHRUNK.BITMAP)                                  (* ; "(IMAGESTREAMTYPE IMAGE.STREAM)")
	    (SELECTQ (IMAGESTREAMTYPE IMAGE.STREAM)
		       (INTERPRESS                           (* ; 
							     
"Printing to an Interpress stream, so use the specialized method.")
				   (SHOWBITMAP.IP IMAGE.STREAM BITMAP NIL FACTOR 0))
		       (PROGN                              (* ; 
							     
"This is the default case, press display and everyone else prints the junky shrunk bitmap")
				(COND
				  ((NOT (SETQ SHRUNK.BITMAP CACHE))
				    (COND
				      ((LEQ FACTOR 1.0)    (* ; 
							     
"We're shrinking the bitmap.  Create a shrunk image for display")
					(SETQ SHRUNK.BITMAP (SHRINKBITMAP BITMAP
									      (FQUOTIENT 1.0 FACTOR)
									      (FQUOTIENT 1.0 FACTOR)
									      )))
				      (T                     (* ; "We're expanding it.  Create a bigger one.")
					 (SETQ SHRUNK.BITMAP (EXPANDBITMAP BITMAP FACTOR FACTOR)))
				      )
				    (IMAGEOBJPROP IMAGEOBJ (QUOTE CACHED.BITMAP)
						    SHRUNK.BITMAP)))
				(BITBLT SHRUNK.BITMAP NIL NIL IMAGE.STREAM (DSPXPOSITION NIL 
										     IMAGE.STREAM)
					  (DSPYPOSITION NIL IMAGE.STREAM)
					  (FIXR (FTIMES FACTOR (BITMAPWIDTH BITMAP)))
					  (FIXR (FTIMES FACTOR (BITMAPHEIGHT BITMAP)))))))))

(BMOBJ.BUTTONEVENTINFN
  (LAMBDA (IMAGEOBJ WINDOW SELECTION X Y SELWINDOW TEXTSTREAM BUTTON OPERATION)
                                                             (* pmi: "11-May-87 12:09")
                                                             (* ;;; 
							     
"the user has pressed a button inside the bitmap object IMAGEOBJ.  Bring up a menu of bitmap edit operations.")

          (* * rht&pmi 5/8/87: Removed TEdit dependent stuff used in the CHANGE.SCALE option; replaced with PROMPTFORWORD)


    (PROG* ((OBJ (IMAGEOBJPROP IMAGEOBJ (QUOTE OBJECTDATUM)))
	    (OLDSCALE (fetch (BITMAPOBJ BMOBJSCALEFACTOR) of OBJ))
	    NEW.BITMAP COMMAND.MENU COMMAND PREVIOUS.BITMAP NAME TEMP X Y PROMPT.WINDOW)
           (COND
	     ((OR (EQ BUTTON (QUOTE RIGHT))
		    (AND OPERATION (NEQ OPERATION 'NORMAL)))
                                                             (* ; 
							     
" If he's extending a selection, or is selecting for move/copy/delete, DON'T bring up the bitmap editing menu!")
	       (RETURN)))
           (SETQ PREVIOUS.BITMAP (BITMAPCOPY (fetch (BITMAPOBJ BITMAP) of OBJ)))
           (SETQ NEW.BITMAP (SELECTQ (MENU (COND
						   ((type? MENU BITMAP.OBJ.MENU)
						     BITMAP.OBJ.MENU)
						   (T (SETQ BITMAP.OBJ.MENU (BMOBJ.CREATE.MENU))))
						 )
					 (CHANGE.SCALE       (* ; "Change the scale on the bitmap.")
						       (CLEARW (SETQ PROMPT.WINDOW
								   (GETPROMPTWINDOW
								     (OR (WINDOWP WINDOW)
									   (WFROMDS WINDOW)))))
						       (replace (BITMAPOBJ BMOBJSCALEFACTOR)
							  of OBJ
							  with (OR (NUMBERP
									 (MKATOM (PROMPTFORWORD
										     
										"Scale Factor:  "
										     OLDSCALE NIL 
										    PROMPT.WINDOW)))
								       OLDSCALE))
                                                             (* ; 
							     
"Return the prevous bitmap, so we don't change the bits.")
						       PREVIOUS.BITMAP)
					 (HAND.EDIT (EDITBM PREVIOUS.BITMAP))
					 (TRIM (TRIM.BITMAP PREVIOUS.BITMAP))
					 (INVERT.HORIZONTALLY (INVERT.BITMAP.HORIZONTALLY 
										  PREVIOUS.BITMAP))
					 (INVERT.VERTICALLY (INVERT.BITMAP.VERTICALLY 
										  PREVIOUS.BITMAP))
					 (INVERT.DIAGONALLY (INVERT.BITMAP.DIAGONALLY 
										  PREVIOUS.BITMAP))
					 (ROTATE.BITMAP.LEFT (ROTATE.BITMAP.LEFT PREVIOUS.BITMAP))
					 (ROTATE.BITMAP.RIGHT (ROTATE.BITMAP.RIGHT 
										  PREVIOUS.BITMAP))
					 (SHIFT.LEFT (INTERACT&SHIFT.BITMAP.LEFT PREVIOUS.BITMAP))
					 (SHIFT.RIGHT (INTERACT&SHIFT.BITMAP.RIGHT PREVIOUS.BITMAP))
					 (SHIFT.DOWN (INTERACT&SHIFT.BITMAP.DOWN PREVIOUS.BITMAP))
					 (SHIFT.UP (INTERACT&SHIFT.BITMAP.UP PREVIOUS.BITMAP))
					 (INTERCHANGE.BLACK/WHITE (INVERT.BITMAP.B/W 
										  PREVIOUS.BITMAP))
					 (ADD.BORDER (INTERACT&ADD.BORDER.TO.BITMAP PREVIOUS.BITMAP)
						     )
					 (RETURN NIL)))
           (replace (BITMAPOBJ BITMAP) of OBJ with NEW.BITMAP)
           (IMAGEOBJPROP IMAGEOBJ (QUOTE CACHED.BITMAP)
			   NIL)                              (* ; 
							     
"And clear any cached shrunk bitmaps so the display looks reasonable.")
           (RETURN (QUOTE CHANGED)))))
)
(PUTPROPS PMIPATCH038 COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (1015 6470 (BMOBJ.DISPLAYFN 1025 . 3065) (BMOBJ.BUTTONEVENTINFN 3067 . 6468)))))
STOP