(FILECREATED "10-Jan-85 19:05:04" {ERIS}<LISPUSERS>MACWINDOW.;4 4726   

      changes to:  (FNS REGION-DISTANCE MACWINDOW.ZOOMBOX)
		   (VARS MACWINDOW.SPEED MACWINDOWCOMS)

      previous date: " 1-Jan-85 17:59:02" {ERIS}<LISPUSERS>MACWINDOW.;5)


(* Copyright (c) 1984, 1985 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])

(MACWINDOW.ZOOMBOX
  [LAMBDA (IW TOWHAT ICONPOSITION)                           (* mpl "10-Jan-85 18:51")
    (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))
          (SETQ PP (WINDOWPROP IW (QUOTE ICONFOR)))
          [COND
	    [(OR TOWHAT ICONPOSITION)
	      (COND
		((WINDOWP TOWHAT)
		  (SETQ PP (WINDOWPROP TOWHAT (QUOTE REGION)))
		  (GO AROUND))
		(T (SETQ PP (create REGION
				    LEFT ←(fetch (POSITION XCOORD) of ICONPOSITION)
				    BOTTOM ←(fetch (POSITION YCOORD) of ICONPOSITION)
				    WIDTH ←(fetch BITMAPWIDTH of TOWHAT)
				    HEIGHT ←(fetch BITMAPHEIGHT of TOWHAT]
	    (T (COND
		 ((NOT PP)
		   (SETQ PP (WINDOWPROP IW (QUOTE ICONWINDOW)))
                                                             (* Can't handle the case of a window with no icon yet.
							     Don't know where it will be!)
		   (COND
		     ((NOT PP)
		       (RETURN]
          (SETQ PP (WINDOWPROP PP (QUOTE REGION)))
      AROUND
          (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)
		    (BLOCK NIL TIMER)))
          (DRAWGRAYBOX ZOOMXL ZOOMYB ZOOMXR ZOOMYT])

(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])

(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))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (551 4362 (MACWINDOW.ZOOM2 561 . 750) (MACWINDOW.ZOOMBOX 752 . 3008) (MACWINDOW.ZOOMSTEP
 3010 . 3582) (REGION-DISTANCE 3584 . 4360)))))
STOP