(FILECREATED "26-Apr-86 13:49:13" {ERIS}<LISPUSERS>LISPCORE>MACWINDOW.;4 5327   

      changes to:  (VARS MACWINDOWCOMS)

      previous date: "22-Apr-86 14:29:47" {ERIS}<LISPUSERS>LISPCORE>MACWINDOW.;3)


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

(PRETTYCOMPRINT MACWINDOWCOMS)

(RPAQQ MACWINDOWCOMS ((FNS MACWINDOW.ZOOM2 MACWINDOW.ZOOMBOX MACWINDOW.ZOOMSTEP REGION-DISTANCE)
                      (INITVARS (MACWINDOW.ZOOMSTEPTIME 10)
                             (MACWINDOW.SPEED 15)
                             (MACWINDOW.ZOOMGRAY 42405))
                      (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)                           (* edited: "15-Apr-86 23:46")
    (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 (SCREENBITMAP)
                 MACWINDOW.ZOOMGRAY])

(MACWINDOW.ZOOMSTEP
  [LAMBDA (M C)                                              (* edited: "15-Apr-86 23:46")
    (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 (SCREENBITMAP)
                     MACWINDOW.ZOOMGRAY)))
    (DRAWGRAYBOX ZOOMXL ZOOMYB ZOOMXR ZOOMYT (SCREENBITMAP)
           MACWINDOW.ZOOMGRAY])

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

(RPAQ? MACWINDOW.ZOOMSTEPTIME 10)

(RPAQ? MACWINDOW.SPEED 15)

(RPAQ? MACWINDOW.ZOOMGRAY 42405)

(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 (641 4920 (MACWINDOW.ZOOM2 651 . 840) (MACWINDOW.ZOOMBOX 842 . 3501) (MACWINDOW.ZOOMSTEP
 3503 . 4140) (REGION-DISTANCE 4142 . 4918)))))
STOP