(FILECREATED "26-Mar-86 17:32:31" {QV}<NOTECARDS>1.3K>RHTPATCH035.;1 3076   

      changes to:  (VARS RHTPATCH035COMS))


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

(PRETTYCOMPRINT RHTPATCH035COMS)

(RPAQQ RHTPATCH035COMS ((* * Fix to NCUTILITIES)
			  (FNS NC.MoveWindowOntoScreen)))
(* * Fix to NCUTILITIES)

(DEFINEQ

(NC.MoveWindowOntoScreen
  (LAMBDA (Window)                                           (* rht: "26-Mar-86 17:29")
                                                             (* Make sure a window and all its attachments are on 
							     the screen.)

          (* * rht 8/28/85: Hacked to handle very big card windows that together with attached windows might be too big to 
	  fit on screen.)



          (* * kirk 12Feb86 Added room for scroll bars.)



          (* * rht 3/4/86: Changed to use RELMOVEW because otherwise it screws up when there's an attached window on the left
	  or bottom of the window.)


    (PROG (OldWindowRegion NewWindowRegion OldTop OldBottom NewLeft NewTop)
	    (if (AND (WINDOWP Window)
			 (NOT (SUBREGIONP WHOLEDISPLAY (SETQ OldWindowRegion (WINDOWREGION
						  Window)))))
		then (SETQ NewWindowRegion (COPY OldWindowRegion))
		       (SETQ OldTop (fetch (REGION TOP) of NewWindowRegion))
		       (if (GREATERP (fetch (REGION RIGHT) of NewWindowRegion)
					 (fetch (REGION RIGHT) of WHOLEDISPLAY))
			   then (SETQ NewLeft (replace (REGION LEFT) of NewWindowRegion
						     with (DIFFERENCE (fetch (REGION RIGHT)
									     of WHOLEDISPLAY)
									  (fetch (REGION WIDTH)
									     of NewWindowRegion)))))
		       (if (MINUSP (OR NewLeft (fetch (REGION LEFT) of NewWindowRegion)))
			   then (replace (REGION LEFT) of NewWindowRegion with 20))
		       (if (MINUSP (SETQ OldBottom (fetch (REGION BOTTOM) of 
										  NewWindowRegion)))
			   then (replace (REGION BOTTOM) of NewWindowRegion with 20)
				  (SETQ NewTop (PLUS OldTop (MINUS OldBottom))))
		       (if (GREATERP (OR NewTop (fetch (REGION TOP) of NewWindowRegion))
					 (fetch (REGION TOP) of WHOLEDISPLAY))
			   then (replace (REGION BOTTOM) of NewWindowRegion
				     with (DIFFERENCE (fetch (REGION TOP) of WHOLEDISPLAY)
							  (fetch (REGION HEIGHT) of 
										  NewWindowRegion))))
		       (RELMOVEW Window (create POSITION
						    XCOORD ←(DIFFERENCE (fetch (REGION LEFT)
									     of NewWindowRegion)
									  (fetch (REGION LEFT)
									     of OldWindowRegion))
						    YCOORD ←(DIFFERENCE (fetch (REGION BOTTOM)
									     of NewWindowRegion)
									  (fetch (REGION BOTTOM)
									     of OldWindowRegion)))))
      )))
)
(PUTPROPS RHTPATCH035 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (351 2994 (NC.MoveWindowOntoScreen 361 . 2992)))))
STOP