(FILECREATED "26-Jun-84 14:11:09" {INDIGO}<LOOPS>SOURCES>LOOPSWINDOW.;26 28860  

      changes to:  (FNS Window.Destroy LoopsIcon.FileBrowse)

      previous date: "21-Jun-84 23:44:49" {INDIGO}<LOOPS>SOURCES>LOOPSWINDOW.;25)


(* Copyright (c) 1983, 1984 by Xerox Corporation)

(PRETTYCOMPRINT LOOPSWINDOWCOMS)

(RPAQQ LOOPSWINDOWCOMS ((CLASSES LoopsIcon Window)
	(METHODS LoopsIcon.BrowseObject LoopsIcon.FileBrowse LoopsIcon.NormalVideoRate 
		 LoopsIcon.PressScreen LoopsIcon.PressWindow LoopsIcon.PrintScreen 
		 LoopsIcon.PrintWindow LoopsIcon.Save LoopsIcon.SetUpDemo LoopsIcon.SetUpScreen 
		 LoopsIcon.TapeVideoRate LoopsIcon.UserExec Window.Blink Window.Bury 
		 Window.ButtonEventFn Window.CVItems Window.ChoiceMenu Window.Clear 
		 Window.ClearMenuCache Window.Close Window.CreateWindow Window.Destroy Window.GetProp 
		 Window.HasLispWindow Window.ItemMenu Window.LeftChoice Window.LeftSelection 
		 Window.MiddleChoice Window.MiddleSelection Window.Move Window.Open Window.Paint 
		 Window.Repaint Window.RightButtonFn Window.RightSelection Window.SetProp 
		 Window.SetRegion Window.Shape Window.Shape? Window.Shrink Window.Snap 
		 Window.TitleSelection Window.ToTop Window.Update Window.WhenMenuItemHeld)
	(FNS GetLispWindow InitLoopsWindow LoopsIconWindow PutLispWindow Window.WhenHeldFn 
	     WindowButtonEventFn WindowCloseFn WindowRightButtonFn)))
(DEFCLASSES LoopsIcon Window)
[DEFCLASS LoopsIcon
   (MetaClass Class Edited:                                  (* dgb: "21-Apr-84 09:20"))
   (Supers Window)
   (ClassVariables (RightButtonItems (Move))
		   [MiddleButtonItems ((PrintScreen (PrintScreen (PrintScreen PressScreen))
						    " Print or Press Screen")
				       (PrintWindow (PrintWindow (PrintWindow PressWindow)))
				       (Browse (FileBrowse (FileBrowse BrowseObject]
		   [LeftButtonItems ((UserExec UserExec 
					       "Add a new process running the user executive")
				     (SetUpScreen (SetUpScreen (SetUpScreen SetUpDemo)))
				     (VideoRate (NormalVideoRate (NormalVideoRate TapeVideoRate]
		   (Prototype #&(LoopsIcon "ATT0.lVC1.←5@.27")))
   (InstanceVariables (window #(NIL LoopsIconWindow NoUpdatePermitted) doc 
                                                             (* Creates the icon and put it in as window)
			      )
		      (savedValue NIL doc                    (* value used by inspector on saving)))]

[DEFCLASS Window
   (MetaClass Class Edited:                                  (* dgb: " 5-May-84 05:43")
	      doc                                            (* A Loops object which represents a window)
	      )
   (Supers Object)
   (ClassVariables (TitleItems NIL doc                       (* special items to be done if in title part of window)
			       )
		   (LeftButtonItems ((Update (QUOTE Update)
					     "Update window to agree with object IVs"))
				    doc                      (* Items to be done if Left button is selected in main 
							     window)
				    )
		   (MiddleButtonItems NIL doc                (* Items to be done if Middle button is selected in main
							     window))
		   (RightButtonItems (Close Snap Paint Clear Bury Repaint Move Shape Shrink)
				     doc                     (* Items to be done if Right button is selected)
				     ))
   (InstanceVariables (left NIL doc                          (* left position of window))
		      (bottom NIL doc                        (* bottom position of window))
		      (width 12 doc                          (* inner width of window, not counting border)
			     )
		      (height 12 doc                         (* inner height of window, not counting border)
			      )
		      (window #(NIL GetLispWindow PutLispWindow) doc 

          (* * Holds real window. Ensured to be window by GetLispWindow PutLispWindow)

)
		      (title NIL doc                         (* If not NIL will be put in title of window)
			     )
		      (menus T DontSave Any Title NIL LeftButtonItems NIL MiddleButtonItems NIL 
			     TitleItems NIL doc              (* Cache For Saved Menus. Will Cache Menus only if value
							     is T)))]

[METH LoopsIcon  BrowseObject NIL
      (* Put up a browser starting on selected object)]


[METH LoopsIcon  FileBrowse NIL
      (* Browse selected file)]


[METH LoopsIcon  NormalVideoRate NIL
      (* Set refresh rate to normal)]


[METH LoopsIcon  PressScreen NIL
      (* Save screen on file)]


[METH LoopsIcon  PressWindow NIL
      (* Send Window to requested Press File)]


[METH LoopsIcon  PrintScreen NIL
      (* Print full Screen on FullPress Printer)]


[METH LoopsIcon  PrintWindow (window file host scalefactor rotation)
      (* Print Selected Window)]


[METH LoopsIcon  Save (savedValue)
      (* save value)]


[METH LoopsIcon  SetUpDemo NIL
      NIL]


[METH LoopsIcon  SetUpScreen NIL
      (* Method to set up screen)]


[METH LoopsIcon  TapeVideoRate NIL
      (* Set screen rate for taping)]


[METH LoopsIcon  UserExec NIL
      (* Add a new process running the User Exec)]


[METH Window  Blink (numBlinks)
      (* Turn Window inverted, dismiss for 200, and return it to normal)]


[METH Window  Bury NIL
      (* Calls BURYW on window)]


[METH Window  ButtonEventFn NIL
      NIL]


[METH Window  CVItems (itemCV)
      (* Get item list for menu)]


[METH Window  ChoiceMenu (itemCV)
      NIL]


[METH Window  Clear NIL
      (* Calls CLEARW on window)]


[METH Window  ClearMenuCache NIL
      (* Delete Menus saved on menus)]


[METH Window  Close NIL
      (* Close the window)]


[METH Window  CreateWindow NIL
      (* Create the Lisp window for this window)]


[METH Window  Destroy NIL
      (* get property from window)]


[METH Window  GetProp (prop)
      (* get property from window)]


[METH Window  HasLispWindow NIL
      (* Checks if a Lisp window has ever been created for this Loops Window)]


[METH Window  ItemMenu NIL
      NIL]


[METH Window  LeftChoice NIL
      (* Get the choices from the LeftButtonItems)]


[METH Window  LeftSelection NIL
      (* Make choice for Left Button down)]


[METH Window  MiddleChoice NIL
      (* Make choice for Middle Button down)]


[METH Window  MiddleSelection NIL
      (* Do MiddleButtonItems on selection)]


[METH Window  Move (xOrPos y)
      (* Move the window)]


[METH Window  Open NIL
      (* Open the window)]


[METH Window  Paint NIL
      (* Calls paint on window)]


[METH Window  Repaint (reg alwaysFlg)
      (* Calls Update on window)]


[METH Window  RightButtonFn NIL
      NIL]


[METH Window  RightSelection NIL
      (* Do RightButtonItems on selection.)]


[METH Window  SetProp (prop value)
      (* set value in real window)]


[METH Window  SetRegion (region dontUpdateFlg)
      (* Make Loops Window have region parameters)]


[METH Window  Shape (newRegion)
      (* Shapes outside of region to specified shape. %.)]


[METH Window  Shape? NIL
      (* Returns the current region for window)]


[METH Window  Shrink (towhat iconPos expandFn)
      (* Calls SHRINKW on window)]


[METH Window  Snap NIL
      (* Takes snapshot of screen)]


[METH Window  TitleSelection NIL
      (* Do TitleItems if selected in title area)]


[METH Window  ToTop NIL
      (* Open window and then bring it to top)]


[METH Window  Update NIL
      (* make the IV window be a window with properties consistent with ivs)]


[METH Window  WhenMenuItemHeld (item menu key)
      (* What to do when the menu item is held)]


(DEFINEQ

(LoopsIcon.BrowseObject
  [LAMBDA (self)                                             (* dgb: "18-Apr-84 09:59")
                                                             (* Put up a browser starting on selected object)
    (PROG ((name (PromptRead "Please tell me the name of the root object")))
          (COND
	    (name (←New
		    ($ ClassBrowser)
		    Show name))
	    (T (PROMPT "No object name given"])

(LoopsIcon.FileBrowse
  [LAMBDA (self)                                             (* dgb: "26-Jun-84 13:54")
                                                             (* Browse selected file)
    (PROG [(fileName (MENU (create MENU
				   ITEMS ←(CONS (QUOTE **newFile**)
						FILELST]
          [COND
	    ((EQ fileName (QUOTE **newFile**))
	      (SETQ fileName (U-CASE (PromptRead "Please tell me the name of the file to browse"]
          (COND
	    (fileName (←New
			($ FileBrowser)
			File fileName T))
	    (T (PROMPT "No file given"])

(LoopsIcon.NormalVideoRate
  [LAMBDA (self)                                             (* dgb: "18-Apr-84 07:48")
                                                             (* Set refresh rate to normal)
    (VIDEORATE (QUOTE NORMAL])

(LoopsIcon.PressScreen
  [LAMBDA (self)                                             (* dgb: "18-Apr-84 08:33")
                                                             (* Save screen on file)
    (PROG ((file (PromptRead "Please tell me name of file for screen picture.")))
          (COND
	    (file (HARDCOPYW (SCREENBITMAP)
			     file))
	    (T (PROMPT "Not Saved"])

(LoopsIcon.PressWindow
  [LAMBDA (self)                                             (* dgb: "18-Apr-84 08:32")
                                                             (* Send Window to requested Press File)
    (PROG ((file (PromptRead "Please tell me name of file for window.")))
          (COND
	    (file (HARDCOPYW (SELECTW)
			     file))
	    (T (PROMPT "Not Saved"])

(LoopsIcon.PrintScreen
  [LAMBDA (self)                                             (* dgb: "18-Apr-84 08:28")
                                                             (* Print full Screen on FullPress Printer)
    (AND (← self FullPressPrinter)
	 (HARDCOPYW (SCREENBITMAP])

(LoopsIcon.PrintWindow
  [LAMBDA (self)                                             (* dgb: "18-Apr-84 08:25")
                                                             (* Print Selected Window)
    (AND (← self FullPressPrinter)
	 (HARDCOPYW (SELECTW])

(LoopsIcon.Save
  [LAMBDA (self savedValue)                                  (* dgb: "16-May-84 20:33")
                                                             (* save value)
    (←@
      savedValue savedValue])

(LoopsIcon.SetUpDemo
  [LAMBDA (self)                                             (* dgb: "17-Apr-84 23:51")
                                                             (* Set up the demo screen if you can)
    (COND
      ((DEFINEDP (QUOTE SetUpDemo))
	(SetUpDemo))
      (T (RINGBELLS)
	 (PROMPTPRINT "SetUpDemo Undefined  --  Can't Set up Demo"])

(LoopsIcon.SetUpScreen
  [LAMBDA (self)                                             (* dgb: "17-Apr-84 20:23")
                                                             (* Method to set up screen)
    (SetUpScreen])

(LoopsIcon.TapeVideoRate
  [LAMBDA (self)                                             (* dgb: "18-Apr-84 08:05")
                                                             (* Set screen rate for taping)
    (VIDEORATE (QUOTE TAPE])

(LoopsIcon.UserExec
  [LAMBDA (self)                                             (* dgb: "18-Apr-84 08:46")
                                                             (* Add a new process running the User Exec)
    (DEL.PROCESS (QUOTE UserExec))
    (ADD.PROCESS (QUOTE (USEREXEC))
		 (QUOTE RESTARTABLE)
		 T
		 (QUOTE NAME)
		 (QUOTE UserExec])

(Window.Blink
  [LAMBDA (self numBlinks)                                   (* dgb: "13-JUN-83 11:48")
                                                             (* Turn Window inverted, dismiss for 200, and return it 
							     to normal)
    (for from 1 to numBlinks
       do (DISMISS 250)
	  (BITBLT NIL NIL NIL (@ window)
		  NIL NIL NIL NIL (QUOTE TEXTURE)
		  (QUOTE INVERT)
		  BLACKSHADE)
	  (DISMISS 250)
	  (BITBLT NIL NIL NIL (@ window)
		  NIL NIL NIL NIL (QUOTE TEXTURE)
		  (QUOTE INVERT)
		  BLACKSHADE])

(Window.Bury
  [LAMBDA (self)                                             (* dgb: "26-JAN-83 10:51")
                                                             (* Calls BURYW on window)
    (BURYW (@ window])

(Window.ButtonEventFn
  [LAMBDA (self window)                                      (* dgb: "21-Apr-84 08:40")
                                                             (* Called when there is a button event in a Loops 
							     Window)
    (OR [ERSETQ (COND
		  ((NULL (INSIDEP (DSPCLIPPINGREGION NIL window)
				  (LASTMOUSEX window)
				  (LASTMOUSEY window)))
		    (← self TitleSelection))
		  ((MOUSESTATE LEFT)
		    (← self LeftSelection))
		  ((MOUSESTATE MIDDLE)
		    (← self MiddleSelection]
	(PROGN (RINGBELLS)
	       (PROMPTPRINT "Error under Mouse Process"])

(Window.CVItems
  [LAMBDA (self itemCV)                                      (* dgb: "17-Apr-84 14:44")
                                                             (* Get item list for menu)
    (GetClassValue self itemCV])

(Window.ChoiceMenu
  [LAMBDA (self itemCV)                                      (* dgb: "17-Apr-84 19:56")
                                                             (* Create a menu which allows subitems to be displayed.
							     Cache it in the menus field of the browser under the 
							     property name itemCV)
    (PROG (items (menu (GetValue self (QUOTE menus)
				 itemCV)))
          (COND
	    ((type? MENU menu)
	      (RETURN menu))
	    ((NLISTP (SETQ items (← self CVItems itemCV)))
	      (RETURN NIL)))
          (SETQ menu (create MENU
			     ITEMS ← items
			     WHENSELECTEDFN ←(QUOTE SubItemSelection)
			     SUBITEMFN ←(QUOTE DualSubItems)
			     WHENHELDFN ←(QUOTE Window.WhenHeldFn)
			     CHANGEOFFSETFLG ← T))           (* Cache menu if menus is T)
          (AND (@ menus)
	       (PutValue self (QUOTE menus)
			 menu itemCV))
          (RETURN menu])

(Window.Clear
  [LAMBDA (self)                                             (* dgb: "26-JAN-83 10:51")
                                                             (* Calls CLEARW on window)
    (CLEARW (@ window])

(Window.ClearMenuCache
  [LAMBDA (self)                                             (* dgb: "17-Apr-84 19:43")
                                                             (* Delete Menus saved on menus)
    (for prop in (← self List (QUOTE IVPROPS)
		    (QUOTE menus))
       do (PutValue self (QUOTE menus)
		    NIL prop))
    self])

(Window.Close
  [LAMBDA (self)                                             (* dgb: "19-JAN-83 19:47")
                                                             (* Close the window)
    (CLOSEW (@ window])

(Window.CreateWindow
  [LAMBDA (self)                                             (* dgb: "21-Jun-84 23:11")
                                                             (* Create the Lisp window for this window but don't open
							     it)
    (CREATEW (CREATEREGION (OR (@ left)
			       LASTMOUSEX)
			   (OR (@ bottom)
			       LASTMOUSEY)
			   (OR (@ width)
			       9)
			   (OR (@ height)
			       9))
	     (@ title)
	     NIL T])

(Window.Destroy
  [LAMBDA (self)                                             (* dgb: "26-Jun-84 13:18")
                                                             (* Remove ButtonFns and close window on Destroying)
    (PROG [(w (GetIVHere self (QUOTE window]
          (COND
	    (w                                               (* there is a window)
	       (SETQ w (@ window))
	       (WINDOWPROP w (QUOTE LoopsWindow)
			   NIL)
	       (WINDOWPROP w (QUOTE RightButtonFn)
			   NIL)
	       (WINDOWPROP w (QUOTE ButtonEventFn)
			   NIL)
	       (CLOSEW w)))
          (←Super
	    self Destroy])

(Window.GetProp
  [LAMBDA (self prop)                                        (* dgb: "19-JAN-83 19:48")
                                                             (* get property from window)
    (WINDOWPROP (@ window)
		prop])

(Window.HasLispWindow
  [LAMBDA (self)                                             (* dgb: "29-JUN-83 17:01")
                                                             (* Checks if a Lisp window has ever been created for 
							     this Loops Window)
    (NEQ NotSetValue (GetIVHere self (QUOTE window])

(Window.ItemMenu
  [LAMBDA (self items title)                                 (* dgb: "21-Apr-84 09:31")
                                                             (* Create a simnple (one level) menu which will not 
							     overflow height of screen)
    (create MENU
	    ITEMS ← items
	    MENUCOLUMNS ←(ADD1 (IQUOTIENT (ITIMES (FONTHEIGHT MENUFONT)
						  (LENGTH items))
					  750))
	    TITLE ← title
	    CHANGEOFFSETFLG ← T])

(Window.LeftChoice
  [LAMBDA (self)                                             (* dgb: "17-Apr-84 14:59")
                                                             (* Get the choices from the LeftButtonItems)
    (PROG [(menu (← self ChoiceMenu (QUOTE LeftButtonItems]
          (RETURN (AND menu (MENU menu])

(Window.LeftSelection
  [LAMBDA (self)                                             (* dgb: "17-Apr-84 15:19")
                                                             (* Make choice for Left Button down)
    (PROG ((choice (← self LeftChoice)))
          (RETURN (AND choice (←!
			 self choice])

(Window.MiddleChoice
  [LAMBDA (self)                                             (* dgb: "17-Apr-84 15:22")
                                                             (* Make choice for Middle Button down)
    (PROG [(menu (← self ChoiceMenu (QUOTE MiddleButtonItems]
          (RETURN (AND menu (MENU menu])

(Window.MiddleSelection
  [LAMBDA (self)                                             (* dgb: "17-Apr-84 15:23")
                                                             (* Do MiddleButtonItems on selection)
    (PROG ((choice (← self MiddleChoice)))
          (RETURN (AND choice (←!
			 self choice])

(Window.Move
  [LAMBDA (self xOrPos y)                                    (* dgb: "18-Apr-84 00:16")
                                                             (* Move the window)
    (PROG ((oldRegion (WINDOWPROP (@ window)
				  (QUOTE REGION)))
	   (newPos (MOVEW (@ window)
			  xOrPos y)))
          (←@
	    left
	    (fetch XCOORD of newPos))
          (←@
	    bottom
	    (fetch YCOORD of newPos))                        (* Update image if it started partly off screen)
          (OR (SUBREGIONP (CONSTANT (create REGION
					    LEFT ← 0
					    BOTTOM ← 0
					    WIDTH ← SCREENWIDTH
					    HEIGHT ← SCREENHEIGHT))
			  oldRegion)
	      (← self Update))
          (RETURN newPos])

(Window.Open
  [LAMBDA (self)                                             (* dgb: "26-Apr-84 08:24")
                                                             (* Open the window)
    (OR (ACTIVEWP (@ window))
	(PROGN (← self Update)
	       (OPENW (@ window])

(Window.Paint
  [LAMBDA (self)                                             (* dgb: "26-JAN-83 10:50")
                                                             (* Calls paint on window)
    (PAINTW (@ window])

(Window.Repaint
  [LAMBDA (self reg alwaysFlg)                               (* dgb: "26-JAN-83 23:46")
                                                             (* Calls Update on window)
    (← self Update])

(Window.RightButtonFn
  [LAMBDA (self)                                             (* dgb: "21-Apr-84 09:01")
                                                             (* Call Right Selection for options)
    (← self RightSelection])

(Window.RightSelection
  [LAMBDA (self)                                             (* dgb: "17-Apr-84 15:46")
                                                             (* Do RightButtonItems on selection.)
    (PROG [choice (menu (← self ChoiceMenu (QUOTE RightButtonItems]
          (SETQ choice (AND menu (MENU menu)))
          (RETURN (AND choice (←!
			 self choice])

(Window.SetProp
  [LAMBDA (self prop value)                                  (* dgb: "12-Jun-84 09:58")
                                                             (* set value in real window)
    (WINDOWPROP (@ window)
		prop value])

(Window.SetRegion
  [LAMBDA (self region dontUpdateFlg)                        (* dgb: "17-Apr-84 19:40")
                                                             (* Make Loops Window have region parameters)
    (←@
      left
      (fetch LEFT of region))
    (←@
      bottom
      (fetch BOTTOM of region))
    (←@
      width
      (fetch WIDTH of region))
    (←@
      height
      (fetch HEIGHT of region))
    (OR dontUpdateFlg (← self Update))
    self])

(Window.Shape
  [LAMBDA (self newRegion)                                   (* dgb: "28-JAN-83 12:11")
                                                             (* Shapes outside of region to specified shape.
							     %.)
    (PROG (d)
          (SHAPEW (@ window)
		  newRegion)
          (SETQ d (WINDOWPROP (@ window)
			      (QUOTE REGION)))
          (←@
	    left
	    (fetch LEFT of d))
          (←@
	    bottom
	    (fetch BOTTOM of d))
          (←@
	    width
	    (WINDOWPROP (@ window)
			(QUOTE WIDTH)))
          (←@
	    height
	    (WINDOWPROP (@ window)
			(QUOTE HEIGHT)))
          (← self Update)
          (RETURN d])

(Window.Shape?
  [LAMBDA (self)                                             (* dgb: "26-JAN-83 11:21")
                                                             (* Returns the current region for window)
    (WINDOWPROP (@ window)
		(QUOTE REGION])

(Window.Shrink
  [LAMBDA (self towhat iconPos expandFn)                     (* dgb: "26-JAN-83 10:53")
                                                             (* Calls SHRINKW on window)
    (SHRINKW (@ window)
	     towhat iconPos expandFn])

(Window.Snap
  [LAMBDA (self)                                             (* sm: " 9-SEP-83 14:27")
                                                             (* Takes snapshot of screen)
    (SNAPW])

(Window.TitleSelection
  [LAMBDA (self)                                             (* dgb: "17-Apr-84 15:35")
                                                             (* Do TitleItems if selected in title area)
    (PROG (menu choice)
          (SETQ choice (OR (AND (SETQ menu (← self ChoiceMenu (QUOTE TitleItems)))
				(MENU menu))
			   (RETURN NIL)))
          (RETURN (←!
		    self choice])

(Window.ToTop
  [LAMBDA (self)                                             (* dgb: "26-Apr-84 08:20")
                                                             (* Open window and then bring it to top)
    (TOTOPW (@ window])

(Window.Update
  [LAMBDA (self)                                             (* dgb: "13-OCT-83 22:06")
                                                             (* make the IV window be a window with properties 
							     consistent with ivs)
    (PROG (region border (window (@ window)))
          (SETQ border (WINDOWPROP window (QUOTE BORDER)))   (* create a region if width and height known)
          (AND [NOT (EQUAL (@ title)
			   (WINDOWPROP window (QUOTE TITLE]
	       (WINDOWPROP window (QUOTE TITLE)
			   (@ title)))
          [AND (@ width)
	       (@ height)
	       (SETQ region (create REGION
				    LEFT ←(OR (@ left)
					      (←@
						left LASTMOUSEX))
				    BOTTOM ←(OR (@ bottom)
						(←@
						  bottom LASTMOUSEY))
				    WIDTH ←(WIDTHIFWINDOW (@ width)
							  border)
				    HEIGHT ←(HEIGHTIFWINDOW (@ height)
							    (@ title)
							    border]
          (AND region [NOT (EQUAL region (WINDOWPROP window (QUOTE REGION]
	       (SHAPEW window region])

(Window.WhenMenuItemHeld
  [LAMBDA (self item menu key)                               (* dgb: "18-Apr-84 08:10")
                                                             (* What to do when the menu item is held)
    (PROMPTPRINT (OR [COND
		       ((NLISTP item)                        (* Get method documentation from object or browser)
			 (GetMethod (Class self)
				    item
				    (QUOTE doc)))
		       ((CDDR item)
			 (CADDR item))
		       ((NLISTP (CADR item))
			 (GetMethod (Class self)
				    (CADR item)
				    (QUOTE doc)))
		       ((GetMethod (Class self)
				   (CAADR item)
				   (QUOTE doc]
		     "When released this item will be selected"])
)
(DEFINEQ

(GetLispWindow
  [LAMBDA (self varName localSt propName activeVal type)     (* dgb: "26-Apr-84 08:23")
                                                             (* This is a getFn for Window to insure a window is a 
							     real Lisp window.)
    (COND
      ((NOT (WINDOWP localSt))                               (* replace the local state with a window, associating 
							     this object with the window)
	(SETQ localSt (PutLocalState activeVal (InitLoopsWindow self (← self CreateWindow))
				     self varName propName type)))
      (T                                                     (* Ensure one is always using a Loops connected window)
	 (WINDOWPROP localSt (QUOTE LoopsWindow)
		     self)))
    localSt])

(InitLoopsWindow
  [LAMBDA (self window pos)                                  (* dgb: "26-Apr-84 08:19")
                                                             (* Initialize the Lisp window with correct EventFns)
    (AND pos (MOVEW window pos))
    (WINDOWPROP window (QUOTE LoopsWindow)
		self)
    (← self SetRegion (WINDOWPROP window (QUOTE REGION))
       (QUOTE DontUpdate))
    (WINDOWPROP window (QUOTE RIGHTBUTTONFN)
		(QUOTE WindowRightButtonFn))
    (WINDOWPROP window (QUOTE BUTTONEVENTFN)
		(QUOTE WindowButtonEventFn))
    window])

(LoopsIconWindow
  [LAMBDA (self varName localSt propName activeVal type)     (* dgb: "21-Apr-84 09:19")
                                                             (* This is a getFn. The value of this getFn is returned 
							     as the value of the enclosing GetValue.)
    [OR (WINDOWP localSt)
	(PutValueOnly self varName (create activeValue
					   localState ←(SETQ localSt (InitLoopsWindow self
										      (ICONW 
										 BlackLoopsIconBM 
										  LoopsIconShadow 
										loopsIconPosition)))
					   getFn ←(QUOTE LoopsIconWindow)
					   putFn ←(QUOTE NoUpdatePermitted]
    localSt])

(PutLispWindow
  [LAMBDA (self varName newValue propName activeVal type)    (* dgb: "17-Apr-84 15:04")
                                                             (* Initializes the window with the correct button fns)
    (PutLocalState activeVal (InitLoopsWindow self (OR (WINDOWP newValue)
						       (ERROR newValue "should be window")))
		   self varName propName type])

(Window.WhenHeldFn
  [LAMBDA (item menu key)                                    (* dgb: "17-Apr-84 20:00")
                                                             (* Send to window the message to respond to time out on 
							     menu)
    (← windowForMenu WhenMenuItemHeld item menu key])

(WindowButtonEventFn
  [LAMBDA (window)                                           (* dgb: "21-Apr-84 08:41")
    (PROG [i itemName (windowForMenu (WINDOWPROP window (QUOTE LoopsWindow]
          (DECLARE (SPECVARS windowForMenu))
          (OR windowForMenu (RETURN))
          (TOTOPW window)
          (RETURN (← windowForMenu ButtonEventFn window])

(WindowCloseFn
  [LAMBDA (window)                                           (* dgb: "18-Apr-84 07:37")
                                                             (* Remove link back to LoopsWindow)
    (WINDOWPROP window (QUOTE LoopsWindow)
		NIL])

(WindowRightButtonFn
  [LAMBDA (window)                                           (* dgb: "21-Apr-84 09:01")
    (PROG [i (windowForMenu (WINDOWPROP window (QUOTE LoopsWindow]
          (DECLARE (SPECVARS windowForMenu))
          (OR windowForMenu (RETURN))
          (TOTOPW window)
          (← windowForMenu RightButtonFn])
)
(PUTPROPS LOOPSWINDOW COPYRIGHT ("Xerox Corporation" 1983 1984))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (7678 25118 (LoopsIcon.BrowseObject 7688 . 8113) (LoopsIcon.FileBrowse 8115 . 8679) (
LoopsIcon.NormalVideoRate 8681 . 8930) (LoopsIcon.PressScreen 8932 . 9319) (LoopsIcon.PressWindow 9321
 . 9711) (LoopsIcon.PrintScreen 9713 . 10003) (LoopsIcon.PrintWindow 10005 . 10273) (LoopsIcon.Save 
10275 . 10504) (LoopsIcon.SetUpDemo 10506 . 10868) (LoopsIcon.SetUpScreen 10870 . 11100) (
LoopsIcon.TapeVideoRate 11102 . 11347) (LoopsIcon.UserExec 11349 . 11709) (Window.Blink 11711 . 12266)
 (Window.Bury 12268 . 12490) (Window.ButtonEventFn 12492 . 13087) (Window.CVItems 13089 . 13325) (
Window.ChoiceMenu 13327 . 14250) (Window.Clear 14252 . 14477) (Window.ClearMenuCache 14479 . 14840) (
Window.Close 14842 . 15061) (Window.CreateWindow 15063 . 15524) (Window.Destroy 15526 . 16145) (
Window.GetProp 16147 . 16388) (Window.HasLispWindow 16390 . 16714) (Window.ItemMenu 16716 . 17177) (
Window.LeftChoice 17179 . 17504) (Window.LeftSelection 17506 . 17818) (Window.MiddleChoice 17820 . 
18143) (Window.MiddleSelection 18145 . 18462) (Window.Move 18464 . 19198) (Window.Open 19200 . 19474) 
(Window.Paint 19476 . 19700) (Window.Repaint 19702 . 19926) (Window.RightButtonFn 19928 . 20176) (
Window.RightSelection 20178 . 20566) (Window.SetProp 20568 . 20815) (Window.SetRegion 20817 . 21328) (
Window.Shape 21330 . 22007) (Window.Shape? 22009 . 22271) (Window.Shrink 22273 . 22532) (Window.Snap 
22534 . 22748) (Window.TitleSelection 22750 . 23164) (Window.ToTop 23166 . 23405) (Window.Update 23407
 . 24428) (Window.WhenMenuItemHeld 24430 . 25116)) (25119 28773 (GetLispWindow 25129 . 25889) (
InitLoopsWindow 25891 . 26454) (LoopsIconWindow 26456 . 27092) (PutLispWindow 27094 . 27487) (
Window.WhenHeldFn 27489 . 27801) (WindowButtonEventFn 27803 . 28166) (WindowCloseFn 28168 . 28430) (
WindowRightButtonFn 28432 . 28771)))))
STOP