(FILECREATED "21-Apr-86 20:53:16" {ERIS}<lispusers>koto>MACWINDOW.;1 4605   

      changes to:  (FNS MACWINDOW.ZOOM2 MACWINDOW.ZOOMBOX MACWINDOW.ZOOMSTEP REGION-DISTANCE)

      previous date: "17-Apr-86 18:06:19" {PHYLUM}<MILLER>LISP>MACWINDOW.;1)


(* Copyright (c) 1984, 1985, 1986 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT MACWINDOWCOMS)

(RPAQQ MACWINDOWCOMS ((FNS MACWINDOW.ZOOM2 MACWINDOW.ZOOMBOX MACWINDOW.ZOOMSTEP REGION-DISTANCE)
			(VARS MACWINDOW.ZOOMSTEPTIME MACWINDOW.SPEED)
			(ADVISE EXPANDW SHRINKW)))
(DEFINEQ

(MACWINDOW.ZOOM2
  (LAMBDA (A B M C)                                          (* MPL "26-May-84 11:52")
    (IPLUS A (ITIMES C (IQUOTIENT (IDIFFERENCE B A)
					M)))))
)
(DEFINEQ

(MACWINDOW.ZOOMBOX
  (LAMBDA (IW TOWHAT ICONPOSITION)                           (* markM "17-Apr-86 17:56")
    (PROG (OLDXL OLDXR OLDYB OLDYT ZOOMXL ZOOMXR ZOOMYB ZOOMYT I M XLI XLW XRI XRW YBI YBW YTI YTW 
		   PP)
	    (DECLARE (SPECVARS . T))
	    (SETQ ZOOMXL)
	    (SETQ PP (WINDOWPROP IW (QUOTE REGION)))
	    (SETQ XLI (fetch (REGION LEFT) of PP))
	    (SETQ XRI (fetch (REGION RIGHT) of PP))
	    (SETQ YBI (fetch (REGION BOTTOM) of PP))
	    (SETQ YTI (fetch (REGION TOP) of PP))
	    (LET ((target (OR TOWHAT (WINDOWPROP IW (QUOTE ICONWINDOW))
				(SETQ PP (WINDOWPROP IW (QUOTE ICONFOR))))))
	         (SETQ PP (if (WINDOWP target)
				then (WINDOWPROP target (QUOTE REGION))
			      elseif (AND target ICONPOSITION)
				then (create REGION
						 LEFT ← (fetch (POSITION XCOORD) of 
										     ICONPOSITION)
						 BOTTOM ← (fetch (POSITION YCOORD) of 
										     ICONPOSITION)
						 WIDTH ← (fetch BITMAPWIDTH of TOWHAT)
						 HEIGHT ← (fetch BITMAPHEIGHT of TOWHAT))))
	         (if PP
		     then (SETQ XLW (fetch (REGION LEFT) of PP))
			    (SETQ XRW (fetch (REGION RIGHT) of PP))
			    (SETQ YBW (fetch (REGION BOTTOM) of PP))
			    (SETQ YTW (fetch (REGION TOP) of PP))
			    (SETQ M (REGION-DISTANCE PP (WINDOWPROP IW (QUOTE REGION))))
			    (SETQ M (IQUOTIENT M MACWINDOW.SPEED))
			    (COND
			      ((EQ M 0)
				(RETURN)))
			    (bind TIMER for I from 1 to M
			       do (SETQ TIMER (SETUPTIMER MACWINDOW.ZOOMSTEPTIME TIMER))
				    (MACWINDOW.ZOOMSTEP M I)
				    (OR (TIMEREXPIRED? TIMER)
					  (DISMISS NIL TIMER T)))
			    (DRAWGRAYBOX ZOOMXL ZOOMYB ZOOMXR ZOOMYT))))))
)
(DEFINEQ

(MACWINDOW.ZOOMSTEP
  (LAMBDA (M C)                                              (* mpl " 1-Jan-85 17:42")
    (SETQ OLDXL ZOOMXL)
    (SETQ OLDXR ZOOMXR)
    (SETQ OLDYB ZOOMYB)
    (SETQ OLDYT ZOOMYT)
    (SETQ ZOOMXL (MACWINDOW.ZOOM2 XLI XLW M C))
    (SETQ ZOOMXR (MACWINDOW.ZOOM2 XRI XRW M C))
    (SETQ ZOOMYB (MACWINDOW.ZOOM2 YBI YBW M C))
    (SETQ ZOOMYT (MACWINDOW.ZOOM2 YTI YTW M C))
    (COND
      (OLDXL (DRAWGRAYBOX OLDXL OLDYB OLDXR OLDYT)))
    (DRAWGRAYBOX ZOOMXL ZOOMYB ZOOMXR ZOOMYT)))
)
(DEFINEQ

(REGION-DISTANCE
  (LAMBDA (REG1 REG2)                                        (* mpl "10-Jan-85 19:04")
    (FIX (SQRT (FPLUS (EXPT (FLOAT (ABS (IDIFFERENCE (IPLUS
								     (fetch (REGION LEFT)
									of REG1)
								     (LRSH (fetch (REGION WIDTH)
										of REG1)
									     1))
								   (IPLUS
								     (fetch (REGION LEFT)
									of REG2)
								     (LRSH (fetch (REGION WIDTH)
										of REG2)
									     1)))))
				    2)
			    (EXPT (FLOAT (ABS (IDIFFERENCE (IPLUS
								     (fetch (REGION BOTTOM)
									of REG1)
								     (LRSH (fetch (REGION HEIGHT)
										of REG1)
									     1))
								   (IPLUS (fetch (REGION BOTTOM)
									       of REG2)
									    (fetch (REGION HEIGHT)
									       of REG2)))))
				    2))))))
)

(RPAQQ MACWINDOW.ZOOMSTEPTIME 10)

(RPAQQ MACWINDOW.SPEED 30)

(PUTPROPS EXPANDW READVICE (NIL (BEFORE FIRST (MACWINDOW.ZOOMBOX ICONW))))

(PUTPROPS SHRINKW READVICE (NIL (BEFORE FIRST (MACWINDOW.ZOOMBOX WINDOW TOWHAT ICONPOSITION))))
(READVISE EXPANDW SHRINKW)
(PUTPROPS MACWINDOW COPYRIGHT ("Xerox Corporation" 1984 1985 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (549 752 (MACWINDOW.ZOOM2 559 . 750)) (753 2713 (MACWINDOW.ZOOMBOX 763 . 2711)) (2714 
3299 (MACWINDOW.ZOOMSTEP 2724 . 3297)) (3300 4236 (REGION-DISTANCE 3310 . 4234)))))
STOP