(FILECREATED "30-Jun-86 16:44:43" {PHYLUM}MAGNIFIER.;13 19020 changes to: (FNS \SLOWMAGSHOW \EXPANDBITMAPBY4 \SLOWMAGSHOW1 MAGTRACK \FFAST4BIT \SLOWEXPANDBITMAPBY4) (MACROS MAGSHOW) (VARS MAGNIFIERCOMS) previous date: "27-Jun-86 17:39:52" {PHYLUM}MAGNIFIER.;11) (* Copyright (c) 1986 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT MAGNIFIERCOMS) (RPAQQ MAGNIFIERCOMS ((FNS MAGNIFYW MAGTRACK \EXPANDBITMAPBY4SLOW \SLOWMAGSHOW ONFOURGRID \EXPANDBITMAPBY4 \SLOWMAGSHOW1 \FFAST4BIT) (CURSORS EMPTYCURSOR) (MACROS MAGSHOW) (ADDVARS (BackgroundMenuCommands ("Magnifier" (MAGNIFYW) "for enlarging the screen around the cursor; click to start, click to stop."))) (VARS (BackgroundMenu)) (DECLARE: EVAL@COMPILE DONTCOPY DONTEVAL@LOAD (FILES (LOADCOMP) LLARRAYELT)))) (DEFINEQ (MAGNIFYW [LAMBDA (WIN) (* rrb "14-Mar-86 10:03") (PROG NIL (OR (WINDOWP WIN) (SETQ WIN (CREATEW (GETREGION 28 28 NIL (FUNCTION ONFOURGRID)) NIL 12))) (WINDOWPROP WIN (QUOTE BUTTONEVENTFN) (FUNCTION MAGTRACK)) (WINDOWPROP WIN (QUOTE NEWREGIONFN) (FUNCTION ONFOURGRID)) (* make the background black so that the part of the  window that isn't a multiple of 4 is black.) (DSPTEXTURE BLACKSHADE WIN]) (MAGTRACK [LAMBDA (WIN) (* rrb "30-Jun-86 15:30") (* * tracking function for a magnify window) (* * if the mouse goes down in the window, track until it goes down again.) (PROG ((WININTERIOR (DSPCLIPPINGREGION NIL WIN)) (WINEXTERIOR (WINDOWPROP WIN (QUOTE REGION))) MAGWIDTH MAGHEIGHT WIDTH HEIGHT NEARCURSORBITMAP EXPANDEDBITMAP CURX CURY LFT BTM MOUSEBEENUP WINLFT WINBTM WINRGHT WINTOP) (COND ((LASTMOUSESTATE UP) (RETURN))) (CLEARW WIN) (SETQ WINLFT (fetch (REGION LEFT) of WINEXTERIOR)) (SETQ WINBTM (fetch (REGION BOTTOM) of WINEXTERIOR)) (SETQ WINRGHT (fetch (REGION PRIGHT) of WINEXTERIOR)) (SETQ WINTOP (fetch (REGION PTOP) of WINEXTERIOR)) [SETQ NEARCURSORBITMAP (BITMAPCREATE (SETQ WIDTH (QUOTIENT (SETQ MAGWIDTH (fetch (REGION WIDTH) of WININTERIOR)) 4)) (SETQ HEIGHT (QUOTIENT (SETQ MAGHEIGHT (fetch (REGION HEIGHT) of WININTERIOR)) 4] (SETQ EXPANDEDBITMAP (BITMAPCREATE MAGWIDTH MAGHEIGHT)) [ERSETQ (RESETFORM (CURSOR EMPTYCURSOR) (until (COND (MOUSEBEENUP (MOUSESTATE (NOT UP))) ((MOUSESTATE UP) (SETQ MOUSEBEENUP T) NIL)) when (OR (NEQ CURX LASTMOUSEX) (NEQ CURY LASTMOUSEY)) do (AND LFT (DRAWGRAYBOX (DIFFERENCE LFT 2) (DIFFERENCE BTM 2) (PLUS LFT WIDTH 2) (PLUS BTM HEIGHT 2) (SCREENBITMAP) BLACKSHADE)) (SETQ CURX LASTMOUSEX) (SETQ CURY LASTMOUSEY) [SETQ LFT (IMAX 0 (IMIN (DIFFERENCE SCREENWIDTH WIDTH) (DIFFERENCE CURX (IQUOTIENT WIDTH 2] [SETQ BTM (IMAX 0 (IMIN (DIFFERENCE SCREENHEIGHT HEIGHT) (DIFFERENCE CURY (IQUOTIENT HEIGHT 2] (COND ((OR (GEQ LFT WINRGHT) (GEQ BTM WINTOP) (GREATERP WINLFT (PLUS LFT WIDTH)) (GREATERP WINBTM (PLUS BTM HEIGHT))) (* no overlap between cursor box and magnifier  window.) (MAGSHOW WIN LFT BTM WIDTH HEIGHT NEARCURSORBITMAP EXPANDEDBITMAP)) (T (\SLOWMAGSHOW WIN LFT BTM WIDTH HEIGHT NEARCURSORBITMAP EXPANDEDBITMAP WINLFT WINBTM WINRGHT WINTOP))) (DRAWGRAYBOX (DIFFERENCE LFT 2) (DIFFERENCE BTM 2) (PLUS LFT WIDTH 2) (PLUS BTM HEIGHT 2) (SCREENBITMAP) BLACKSHADE] (* erase box from screen.) (AND BTM (DRAWGRAYBOX (DIFFERENCE LFT 2) (DIFFERENCE BTM 2) (PLUS LFT WIDTH 2) (PLUS BTM HEIGHT 2) (SCREENBITMAP) BLACKSHADE]) (\EXPANDBITMAPBY4SLOW [LAMBDA (SOURCE TARGET) (* rrb "14-Mar-86 14:22") (* expands a bitmap by a factor of 4 into another  bitmap) (DECLARE (GLOBALVARS \4BITEXPANSIONTABLE)) (PROG (NUW (BMH (fetch BITMAPHEIGHT of SOURCE)) (BMW (fetch BITMAPWIDTH of SOURCE))) (SETQ NUW (ITIMES 4 BMW)) (for I from 0 to (SUB1 BMH) as C from 0 by 4 do (\FFAST4BIT (\ADDBASE (fetch BITMAPBASE of SOURCE) (ITIMES (IDIFFERENCE BMH (ADD1 I)) (fetch BITMAPRASTERWIDTH of SOURCE))) (\ADDBASE (fetch BITMAPBASE of TARGET) (ITIMES (IDIFFERENCE (fetch BITMAPHEIGHT of TARGET) (ADD1 C)) (fetch BITMAPRASTERWIDTH of TARGET))) (fetch BITMAPRASTERWIDTH of TARGET) (fetch (ARRAYP BASE) of \4BITEXPANSIONTABLE)) (* copy line once.) (BITBLT TARGET 0 C TARGET 0 (IPLUS C 1) NUW 1 (QUOTE INPUT) (QUOTE REPLACE)) (* copy both those lines.) (BITBLT TARGET 0 C TARGET 0 (IPLUS C 2) NUW 2 (QUOTE INPUT) (QUOTE REPLACE))) (RETURN TARGET]) (\SLOWMAGSHOW [LAMBDA (WIN X Y WID HGHT NEARCURSORBITMAP EXPANDEDBITMAP WINLFT WINBTM WINRIGHT WINTOP) (* rrb "30-Jun-86 16:35") (* * displays a magnified image of the area X Y in WIN but knows that there is an overlap) (* FOR NOW NOT IMPLEMENTED) (PROG ((SAVEBM (WINDOWPROP WIN (QUOTE IMAGECOVERED))) BOTTOMHEIGHT LEFTWIDTH) [COND [(GREATERP WINBTM Y) (* bottom of nearcursor overlaps window.) (* display the area below the overlap) (\SLOWMAGSHOW1 WIN (SCREENBITMAP) X Y NEARCURSORBITMAP WID (SETQ BOTTOMHEIGHT (DIFFERENCE WINBTM Y) ) 0 0 EXPANDEDBITMAP) (COND ((GREATERP WINLFT X) (* there is part of the screen to display before the  window.) (\SLOWMAGSHOW1 WIN (SCREENBITMAP) X (PLUS Y BOTTOMHEIGHT) NEARCURSORBITMAP (SETQ LEFTWIDTH (DIFFERENCE WINLFT X)) (DIFFERENCE HGHT BOTTOMHEIGHT) 0 (LLSH BOTTOMHEIGHT 2) EXPANDEDBITMAP) (* display the part under the window) (\SLOWMAGSHOW1 WIN SAVEBM 0 0 NEARCURSORBITMAP (DIFFERENCE WID LEFTWIDTH) (DIFFERENCE HGHT BOTTOMHEIGHT) (LLSH LEFTWIDTH 2) (LLSH BOTTOMHEIGHT 2) EXPANDEDBITMAP)) ((LESSP WINRIGHT (PLUS X WID)) (* there is screen to display after the window.) (* display the part under the window) (\SLOWMAGSHOW1 WIN SAVEBM (DIFFERENCE X WINLFT) 0 NEARCURSORBITMAP (SETQ LEFTWIDTH (DIFFERENCE WINRIGHT X)) (DIFFERENCE HGHT BOTTOMHEIGHT) 0 (LLSH BOTTOMHEIGHT 2) EXPANDEDBITMAP) (* display the part to the right of the mag window.) (\SLOWMAGSHOW1 WIN (SCREENBITMAP) WINRIGHT (PLUS Y BOTTOMHEIGHT) NEARCURSORBITMAP (DIFFERENCE WID LEFTWIDTH) (DIFFERENCE HGHT BOTTOMHEIGHT) (LLSH LEFTWIDTH 2) (LLSH BOTTOMHEIGHT 2) EXPANDEDBITMAP)) (T (* the width of the nearcursor area is completely  within the magnifier window;) (\SLOWMAGSHOW1 WIN SAVEBM (DIFFERENCE X WINLFT) 0 NEARCURSORBITMAP WID (DIFFERENCE HGHT BOTTOMHEIGHT) 0 (LLSH BOTTOMHEIGHT 2) EXPANDEDBITMAP] [(GREATERP (PLUS Y HGHT) WINTOP) (* top of nearcursor overlaps the magnifier window.) (* display the area above the overlap) (\SLOWMAGSHOW1 WIN (SCREENBITMAP) X WINTOP NEARCURSORBITMAP WID (DIFFERENCE HGHT (SETQ BOTTOMHEIGHT (DIFFERENCE WINTOP Y) )) 0 (LLSH BOTTOMHEIGHT 2) EXPANDEDBITMAP) (COND ((GREATERP WINLFT X) (* there is part of the screen to display before the  window.) (\SLOWMAGSHOW1 WIN (SCREENBITMAP) X Y NEARCURSORBITMAP (SETQ LEFTWIDTH (DIFFERENCE WINLFT X)) BOTTOMHEIGHT 0 0 EXPANDEDBITMAP) (* display the part under the window) (\SLOWMAGSHOW1 WIN SAVEBM 0 (DIFFERENCE Y WINBTM) NEARCURSORBITMAP (DIFFERENCE WID LEFTWIDTH) BOTTOMHEIGHT (LLSH LEFTWIDTH 2) 0 EXPANDEDBITMAP)) ((LESSP WINRIGHT (PLUS X WID)) (* there is screen to display after the window.) (* display the part under the window) (\SLOWMAGSHOW1 WIN SAVEBM (DIFFERENCE X WINLFT) (DIFFERENCE Y WINBTM) NEARCURSORBITMAP (SETQ LEFTWIDTH (DIFFERENCE WINRIGHT X)) BOTTOMHEIGHT 0 0 EXPANDEDBITMAP) (* display the part to the right of the mag window.) (\SLOWMAGSHOW1 WIN (SCREENBITMAP) WINRIGHT Y NEARCURSORBITMAP (DIFFERENCE WID LEFTWIDTH) BOTTOMHEIGHT (LLSH LEFTWIDTH 2) 0 EXPANDEDBITMAP)) (T (* the width of the nearcursor area is completely  within the magnifier window;) (\SLOWMAGSHOW1 WIN SAVEBM (DIFFERENCE X WINLFT) (DIFFERENCE Y WINBTM) NEARCURSORBITMAP WID BOTTOMHEIGHT 0 0 EXPANDEDBITMAP] (T (* whole height of nearcursor overlaps the magnifier  window.) (COND ((GREATERP WINLFT X) (* there is part of the screen to display before the  window.) (\SLOWMAGSHOW1 WIN (SCREENBITMAP) X Y NEARCURSORBITMAP (SETQ LEFTWIDTH (DIFFERENCE WINLFT X)) HGHT 0 0 EXPANDEDBITMAP) (* display the part under the window) (\SLOWMAGSHOW1 WIN SAVEBM 0 (DIFFERENCE Y WINBTM) NEARCURSORBITMAP (DIFFERENCE WID LEFTWIDTH) HGHT (LLSH LEFTWIDTH 2) 0 EXPANDEDBITMAP)) ((LESSP WINRIGHT (PLUS X WID)) (* there is screen to display after the window.) (* display the part under the window) (\SLOWMAGSHOW1 WIN SAVEBM (DIFFERENCE X WINLFT) (DIFFERENCE Y WINBTM) NEARCURSORBITMAP (SETQ LEFTWIDTH (DIFFERENCE WINRIGHT X)) HGHT 0 0 EXPANDEDBITMAP) (* display the part to the right of the mag window.) (\SLOWMAGSHOW1 WIN (SCREENBITMAP) WINRIGHT Y NEARCURSORBITMAP (DIFFERENCE WID LEFTWIDTH) HGHT (LLSH LEFTWIDTH 2) 0 EXPANDEDBITMAP)) (T (* the width of the nearcursor area is completely  within the magnifier window;) (\SLOWMAGSHOW1 WIN SAVEBM (DIFFERENCE X WINLFT) (DIFFERENCE Y WINBTM) NEARCURSORBITMAP WID HGHT 0 0 EXPANDEDBITMAP] (RETURN]) (ONFOURGRID [LAMBDA (FIXPT MOVEPT) (* rrb "14-Mar-86 10:08") (* makes sure that both points are on a mod of 4  grid.) (COND (MOVEPT (replace (POSITION XCOORD) of MOVEPT with (DIFFERENCE (fetch (POSITION XCOORD) of MOVEPT) (IMOD (fetch (POSITION XCOORD) of MOVEPT) 4))) (replace (POSITION YCOORD) of MOVEPT with (DIFFERENCE (fetch (POSITION YCOORD) of MOVEPT) (IMOD (fetch (POSITION YCOORD) of MOVEPT) 4))) MOVEPT) (T (replace (POSITION XCOORD) of FIXPT with (DIFFERENCE (fetch (POSITION XCOORD) of FIXPT) (IMOD (fetch (POSITION XCOORD) of FIXPT) 4))) (replace (POSITION YCOORD) of FIXPT with (DIFFERENCE (fetch (POSITION YCOORD) of FIXPT) (IMOD (fetch (POSITION YCOORD) of FIXPT) 4))) FIXPT]) (\EXPANDBITMAPBY4 [LAMBDA (SOURCE TARGET WIDTH HEIGHT) (* rrb "30-Jun-86 16:39") (* expands a bitmap by a factor of 4 into another  bitmap) (DECLARE (GLOBALVARS \4BITEXPANSIONTABLE)) (PROG ((NUW (ITIMES 4 WIDTH)) (NUH (ITIMES 4 HEIGHT)) (SOURCEBASE (fetch BITMAPBASE of SOURCE)) (TARGETBASE (fetch BITMAPBASE of TARGET)) (TARGETRASTERWIDTH (fetch BITMAPRASTERWIDTH of TARGET)) (TABLEBASE (fetch (ARRAYP BASE) of \4BITEXPANSIONTABLE))) (* clear out the part of the target that will be  used.) (BITBLT NIL NIL NIL TARGET 0 0 NUW NUH (QUOTE TEXTURE) (QUOTE REPLACE) 0) (for I from 1 to HEIGHT as SOURCEADDR from (TIMES (DIFFERENCE (fetch (BITMAP BITMAPHEIGHT) of SOURCE) HEIGHT) (fetch BITMAPRASTERWIDTH of SOURCE)) by (fetch BITMAPRASTERWIDTH of SOURCE) as TARGETADDR from (ITIMES (PLUS (DIFFERENCE (fetch (BITMAP BITMAPHEIGHT) of TARGET) NUH) 3) TARGETRASTERWIDTH) by (ITIMES 4 TARGETRASTERWIDTH) do (\FFAST4BIT (\ADDBASE SOURCEBASE SOURCEADDR) (\ADDBASE TARGETBASE TARGETADDR) (QUOTIENT (PLUS WIDTH 3) 4) TABLEBASE)) (* copy single lines once.) (BITBLT TARGET 0 0 TARGET 0 1 NUW NUH (QUOTE INPUT) (QUOTE PAINT)) (* copy both those lines.) (BITBLT TARGET 0 0 TARGET 0 2 NUW NUH (QUOTE INPUT) (QUOTE PAINT)) (RETURN TARGET]) (\SLOWMAGSHOW1 [LAMBDA (MAGW SOURCEBM SOURCEX SOURCEY TEMPBM WIDTH HEIGHT MAGWX MAGWY EXPANDEDBITMAP) (* rrb "30-Jun-86 16:41") (PROGN (* rrb "27-Jun-86 17:27") (* * displays a magnified image of the area SOURCEX SOURCEY in MAGW) (BITBLT SOURCEBM SOURCEX SOURCEY TEMPBM 0 0 WIDTH HEIGHT) (BITBLT (\EXPANDBITMAPBY4 TEMPBM EXPANDEDBITMAP WIDTH HEIGHT) 0 0 MAGW MAGWX MAGWY (LLSH WIDTH 2) (LLSH HEIGHT 2) (QUOTE INPUT) (QUOTE REPLACE]) (\FFAST4BIT [LAMBDA (A B N MAPBASE) (* rrb "14-Mar-86 14:22") (* DECLARATIONS: (BLOCKRECORD NIBBLE  ((N1 BITS 4) (N2 BITS 4) (N3 BITS 4)  (N4 BITS 4)))) (* homebrew version of \FAST4BIT that removes ELT and  is 60 percent faster.) (bind AW (I _ 0) for J from 0 do (SETQ AW (\ADDBASE A J)) (OR (IGREATERP N I) (RETURN)) (\PUTBASE B I (\GETBASE MAPBASE (fetch N1 of AW))) (OR (IGREATERP N (add I 1)) (RETURN)) (\PUTBASE B I (\GETBASE MAPBASE (fetch N2 of AW))) (OR (IGREATERP N (add I 1)) (RETURN)) (\PUTBASE B I (\GETBASE MAPBASE (fetch N3 of AW))) (OR (IGREATERP N (add I 1)) (RETURN)) (\PUTBASE B I (\GETBASE MAPBASE (fetch N4 of AW))) (add I 1]) ) (RPAQ EMPTYCURSOR (CURSORCREATE (READBITMAP) 0 7)) (16 16 "@@@@" "@@@@" "@@@@" "@@@@" "@@@@" "@@@@" "@@@@" "@@@@" "@@@@" "@@@@" "@@@@" "@@@@" "@@@@" "@@@@" "@@@@" "@@@@")(DECLARE: EVAL@COMPILE [PUTPROPS MAGSHOW MACRO ((WIN X Y WID HGHT NEARCURSORBITMAP EXPANDEDBITMAP) (* rrb "27-Jun-86 17:27") (* * displays a magnified image of the area X Y in WIN) (BITBLT (SCREENBITMAP) X Y NEARCURSORBITMAP 0 0 WID HGHT) (BITBLT (\EXPANDBITMAPBY4 NEARCURSORBITMAP EXPANDEDBITMAP WID HGHT) 0 0 WIN 0 0 (LLSH WID 2) (LLSH HGHT 2] ) (ADDTOVAR BackgroundMenuCommands ("Magnifier" (MAGNIFYW) "for enlarging the screen around the cursor; click to start, click to stop.")) (RPAQQ BackgroundMenu NIL) (DECLARE: EVAL@COMPILE DONTCOPY DONTEVAL@LOAD (FILESLOAD (LOADCOMP) LLARRAYELT) ) (PUTPROPS MAGNIFIER COPYRIGHT ("Xerox Corporation" 1986)) (DECLARE: DONTCOPY (FILEMAP (NIL (892 18116 (MAGNIFYW 902 . 1485) (MAGTRACK 1487 . 4808) (\EXPANDBITMAPBY4SLOW 4810 . 6275) (\SLOWMAGSHOW 6277 . 13057) (ONFOURGRID 13059 . 14336) (\EXPANDBITMAPBY4 14338 . 16360) ( \SLOWMAGSHOW1 16362 . 17018) (\FFAST4BIT 17020 . 18114))))) STOP