(FILECREATED "27-Dec-85 03:00:49" {QV}<NOTECARDS>1.3K>NCGESTURES.;7 4410   

      changes to:  (FNS NC.GrabWindow)

      previous date: "23-Dec-85 00:21:09" {QV}<NOTECARDS>1.3K>NCGESTURES.;6)


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

(PRETTYCOMPRINT NCGESTURESCOMS)

(RPAQQ NCGESTURESCOMS ((* * Stuff for closing and moving windows by gesturing.)
			 (GLOBALVARS LASTMOUSEBUTTONS)
			 (FNS NC.GrabWindow)
			 (P (SETQ BACKGROUNDBUTTONEVENTFN (FUNCTION NC.GrabWindow)))))
(* * Stuff for closing and moving windows by gesturing.)

(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS LASTMOUSEBUTTONS)
)
(DEFINEQ

(NC.GrabWindow
  (LAMBDA NIL                                                (* fgh: "10-Sep-85 12:03")
    (PROG ((InOutList NIL)
	     Window WindowRegionLeft WindowRegionBottom WindowRegionWidth WindowRegionHeight INX INY 
	     OUTX OUTY)
	    (AND (NEQ LASTMOUSEBUTTONS 7)
		   (until (MOUSESTATE UP)
		      do (RESETLST
			     (RESETSAVE (CURSOR BOXCURSOR))
			     (until (OR (MOUSESTATE UP)
					    (NEQ Window (WHICHW)))
				do (BLOCK))
			     (SETQ InOutList (CONS (LIST Window LASTMOUSEX LASTMOUSEY)
						       InOutList))
			     (SETQ WindowRegionLeft (fetch (REGION LEFT)
							 of (WINDOWPROP Window (QUOTE REGION))))
			     (SETQ WindowRegionBottom (fetch (REGION BOTTOM)
							   of (WINDOWPROP Window (QUOTE REGION))
								 ))
			     (SETQ WindowRegionWidth (fetch (REGION WIDTH)
							  of (WINDOWPROP Window (QUOTE REGION)))
			       )
			     (SETQ WindowRegionHeight (fetch (REGION HEIGHT)
							   of (WINDOWPROP Window (QUOTE REGION))
								 ))
			     (SETQ OUTX (CADAR InOutList))
			     (SETQ OUTY (CADDAR InOutList))
			     (SETQ INX (CADR (CADR InOutList)))
			     (SETQ INY (CADDR (CADR InOutList)))
			     (COND
			       ((AND Window (NOT (LASTMOUSESTATE UP))
				       (AND (OR (AND (ILESSP INX (IPLUS WindowRegionLeft
										  (FTIMES .25 
										WindowRegionWidth)))
							   (ILESSP OUTX (IPLUS WindowRegionLeft
										   (FTIMES .25 
										WindowRegionWidth))))
						    (AND (IGREATERP INX (IPLUS WindowRegionLeft
										     (FTIMES .75 
										WindowRegionWidth)))
							   (IGREATERP OUTX (IPLUS 
										 WindowRegionLeft
										      (FTIMES
											.75 
										WindowRegionWidth)))))
					      (OR (AND (ILESSP INY (IPLUS WindowRegionBottom
										  (FTIMES .25 
									       WindowRegionHeight)))
							   (ILESSP OUTY (IPLUS WindowRegionBottom
										   (FTIMES .25 
									       WindowRegionHeight))))
						    (AND (IGREATERP INY (IPLUS 
									       WindowRegionBottom
										     (FTIMES .75 
									       WindowRegionHeight)))
							   (IGREATERP OUTY (IPLUS 
									       WindowRegionBottom
										      (FTIMES
											.75 
									       WindowRegionHeight)))))
					      ))
				 (MOVEW Window))
			       ((AND Window (NOT (LASTMOUSESTATE UP))
				       (for N from 3 to 3 by 2
					  always (AND (EQ Window (CAAR (NTH InOutList N)))
							  (NOT (INSIDEP
								   (CREATEREGION (IPLUS 
										 WindowRegionLeft 20)
										   (IPLUS 
									       WindowRegionBottom 20)
										   (IDIFFERENCE
										     
										WindowRegionWidth 40)
										   (IDIFFERENCE
										     
									       WindowRegionHeight 40))
								   (CADAR (NTH InOutList
										   (SUB1 N)))
								   (CADDAR (NTH InOutList
										    (SUB1 N))))))))
				 (CLOSEW Window)
				 (BLOCK)))
			     (SETQ Window (WHICHW))

          (* * Kludge to fix TEDIT image object button event fn bug.)


			     (COND
			       ((AND (WINDOWP Window)
				       TEDIT.SELPENDING
				       (EQ (WINDOWPROP Window (QUOTE TEXTOBJ))
					     TEDIT.SELPENDING))
				 (SETQ Window NIL)))))))))
)
(SETQ BACKGROUNDBUTTONEVENTFN (FUNCTION NC.GrabWindow))
(PUTPROPS NCGESTURES COPYRIGHT ("Xerox Corporation" 1984 1985))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (646 4268 (NC.GrabWindow 656 . 4266)))))
STOP