(FILECREATED "29-Mar-86 23:49:45" {PHYLUM}<SHRAGER>LISP>WINNER.;2 10784  

      changes to:  (FNS WM:WINDOW-NAME WM:WINDOW-TYPE)
                   (VARS WINNERCOMS)

      previous date: "29-Mar-86 22:50:16" {PHYLUM}<SHRAGER>LISP>WINNER.;1)


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

(PRETTYCOMPRINT WINNERCOMS)

(RPAQQ WINNERCOMS ((VARS WM:*WINDOW-TYPE-LOCS*)
                   (FNS WM:ADD-WINDOW-TO-OFF-SCREEN-LIST WM:GET-OFF-SCREEN-LOC WM:GET-ON-SCREEN-LOC 
                        WM:KILL-AND-SWAP-IN WM:MOVE-WINDOW-OFF-SCREEN WM:MOVE-WINDOW-ON-SCREEN 
                        WM:OFF-SCREEN-WINDOWS-OF-TYPE WM:REMEMEBER 
                        WM:REMOVE-WINDOW-FROM-OFF-SCREEN-LIST WM:RETRIEVE-WINDOW WM:SWAP-OUT 
                        WM:UPDATE-LOCS-ON-MOVE WM:WINDOW-NAME WM:WINDOW-TYPE)
                   (P (SETQ WM:*WINDOW-TYPE-LOCS* NIL)
                      [PUSH WindowMenuCommands (QUOTE (SwapOut (QUOTE WM:SWAP-OUT)
                                                             
                                               "Swaps a window out and puts one of the same type in."
                                                             (SUBITEMS ("Put Out" (QUOTE 
                                                                            WM:MOVE-WINDOW-OFF-SCREEN
                                                                                         )
                                                                              
                                                       "Puts a new window of an old type off screen."
                                                                              )
                                                                    ("Kill" (QUOTE 
                                                                                  WM:KILL-AND-SWAP-IN
                                                                                   )
                                                                           
                                                    "Closes this window and gets one from offscreen."
                                                                           )
                                                                    ("Remember" (QUOTE 
                                                                               WM:UPDATE-LOCS-ON-MOVE
                                                                                       )
                                                                           
                                                            "Remember where windows of this type go."
                                                                           ]
                      (PUSH BackgroundMenuCommands (QUOTE ("Retrieve" (QUOTE (WM:RETRIEVE-WINDOW))
                                                                 "Get an off screen window.")))
                      (SETQ WindowMenu NIL)
                      (SETQ BackgroundMenu NIL))))

(RPAQQ WM:*WINDOW-TYPE-LOCS* ((FILEBROWSER (444 347 570 453)
                                     (2444 2347 570 453)
                                     ({WINDOW}#53,162320 {WINDOW}#54,5554))
                              (TEDIT (206 19 645 595)
                                     (2206 2019 645 595)
                                     NIL)))
(DEFINEQ

(WM:ADD-WINDOW-TO-OFF-SCREEN-LIST
  [LAMBDA (W)                                                (* Jeff.Shrager "27-Mar-86 12:51")
    (LET* ((L (ASSOC (WM:WINDOW-TYPE W)
                     WM:*WINDOW-TYPE-LOCS*))
           (WLIST (CADDDR L)))
          (OR (MEMB W WLIST)
              (RPLACA (CDDDR L)
                     (CONS W WLIST])

(WM:GET-OFF-SCREEN-LOC
  [LAMBDA (W)                                                (* Jeff.Shrager "27-Mar-86 11:41")
    (CADDR (ASSOC (WM:WINDOW-TYPE W)
                  WM:*WINDOW-TYPE-LOCS*])

(WM:GET-ON-SCREEN-LOC
  [LAMBDA (W)                                                (* Jeff.Shrager "27-Mar-86 11:40")
    (CADR (ASSOC (WM:WINDOW-TYPE W)
                 WM:*WINDOW-TYPE-LOCS*])

(WM:KILL-AND-SWAP-IN
  [LAMBDA (W)                                                (* Jeff.Shrager "29-Mar-86 22:48")
    (CLOSEW W)
    (LET [(NAMES (for W in (WM:OFF-SCREEN-WINDOWS-OF-TYPE (WM:WINDOW-TYPE W))
                    collect (CONS (WM:WINDOW-NAME W)
                                  W]
         (COND
            [(CDR NAMES)
             (WM:MOVE-WINDOW-ON-SCREEN (CDR (MENU (create MENU
                                                         ITEMS ← NAMES]
            (NAMES (WM:MOVE-WINDOW-ON-SCREEN (CDAR NAMES])

(WM:MOVE-WINDOW-OFF-SCREEN
  [LAMBDA (W)                                                (* Jeff.Shrager "27-Mar-86 12:47")
    (SHAPEW W (WM:GET-OFF-SCREEN-LOC W))
    (WM:ADD-WINDOW-TO-OFF-SCREEN-LIST W])

(WM:MOVE-WINDOW-ON-SCREEN
  [LAMBDA (W)                                                (* Jeff.Shrager "27-Mar-86 12:49")
    (SHAPEW W (WM:GET-ON-SCREEN-LOC W))
    (WM:REMOVE-WINDOW-FROM-OFF-SCREEN-LIST W])

(WM:OFF-SCREEN-WINDOWS-OF-TYPE
  [LAMBDA (WTYPE)                                            (* Jeff.Shrager "27-Mar-86 12:47")
    (CADDDR (ASSOC WTYPE WM:*WINDOW-TYPE-LOCS*])

(WM:REMEMEBER
  [LAMBDA NIL                                                (* Jeff.Shrager "27-Mar-86 13:06")
    (WM:UPDATE-LOCS-ON-MOVE (WM:WINDOW-TYPE (WW))
           (WINDOWREGION (WW])

(WM:REMOVE-WINDOW-FROM-OFF-SCREEN-LIST
  [LAMBDA (W)                                                (* Jeff.Shrager "27-Mar-86 12:55")
    (LET* ((L (ASSOC (WM:WINDOW-TYPE W)
                     WM:*WINDOW-TYPE-LOCS*))
           (WLIST (CADDDR L)))
          (AND (MEMB W WLIST)
               (RPLACA (CDDDR L)
                      (REMOVE W WLIST])

(WM:RETRIEVE-WINDOW
  [LAMBDA NIL                                                (* Jeff.Shrager "28-Mar-86 09:45")
    (LET [(WTYPE (AND WM:*WINDOW-TYPE-LOCS* (MENU (create MENU
                                                         ITEMS ←(for I in WM:*WINDOW-TYPE-LOCS*
                                                                   collect (CAR I]
         (AND WTYPE (LET [(NAMES (for W in (WM:OFF-SCREEN-WINDOWS-OF-TYPE WTYPE)
                                    collect (CONS (WM:WINDOW-NAME W)
                                                  W]
                         (AND NAMES (WM:MOVE-WINDOW-ON-SCREEN (COND
                                                                 ((NULL (CDR NAMES))
                                                                  (CDAR NAMES))
                                                                 (T (CDR (MENU (create MENU
                                                                                      ITEMS ← NAMES])

(WM:SWAP-OUT
  [LAMBDA (W)                                                (* Jeff.Shrager "28-Mar-86 11:22")
    (LET* [(NAMES (for W in (WM:OFF-SCREEN-WINDOWS-OF-TYPE (WM:WINDOW-TYPE W))
                     collect (CONS (WM:WINDOW-NAME W)
                                   W)))
           (REPLACEMENT (AND NAMES (COND
                                      ((NULL (CDR NAMES))
                                       (CDAR NAMES))
                                      (T (CDR (MENU (create MENU
                                                           ITEMS ← NAMES]
          (WM:MOVE-WINDOW-OFF-SCREEN W)
          (AND REPLACEMENT (WM:MOVE-WINDOW-ON-SCREEN REPLACEMENT])

(WM:UPDATE-LOCS-ON-MOVE
  [LAMBDA (W)                                                (* Jeff.Shrager "28-Mar-86 09:38")
    (LET* ((WINDOW-TYPE (WM:WINDOW-TYPE W))
           (NEW-REGION (WINDOWREGION W))
           (LOC (ASSOC WINDOW-TYPE WM:*WINDOW-TYPE-LOCS*)))
          [COND
             ((NULL LOC)
              (SETQ LOC (LIST WINDOW-TYPE NIL NIL NIL))
              (SETQ WM:*WINDOW-TYPE-LOCS* (CONS LOC WM:*WINDOW-TYPE-LOCS*]
          
          (* * The locs entry is of the form (TYPE ON-SCREEN-LOC OFF-SCREEN-LOC 
          LIST-OF-OFF-SCREEN-WINDOWS) the off screen location is the same as the on 
          screen location plus 2000.0)

          (RPLACA (CDR LOC)
                 NEW-REGION)
          
          (* * Make sure this is constructed anew so that smashing it doesn't fuck up the 
          window.)

          (RPLACA (CDDR LOC)
                 (LIST (IPLUS 2000 (CAR NEW-REGION))
                       (IPLUS 2000 (CADR NEW-REGION))
                       (CADDR NEW-REGION)
                       (CADDDR NEW-REGION])

(WM:WINDOW-NAME
  [LAMBDA (W)                                                (* Jeff.Shrager "29-Mar-86 23:45")
    (SELECTQ (WM:WINDOW-TYPE W)
        (TEDIT (WINDOWPROP W (QUOTE TITLE)))
        (FILEBROWSER (FETCHFIELD (QUOTE (FILEBROWSER 14 POINTER))
                            (WINDOWPROP W (QUOTE FILEBROWSER))))
        NIL])

(WM:WINDOW-TYPE
  [LAMBDA (W)                                                (* Jeff.Shrager "29-Mar-86 23:35")
    (COND
       ((EQ (QUOTE \TEDIT.SHRINK.ICONCREATE)
            (WINDOWPROP W (QUOTE ICONFN)))
        (QUOTE TEDIT))
       ((WINDOWPROP W (QUOTE FILEBROWSER))
        (QUOTE FILEBROWSER])
)
(SETQ WM:*WINDOW-TYPE-LOCS* NIL)
[PUSH WindowMenuCommands (QUOTE (SwapOut (QUOTE WM:SWAP-OUT)
                                       "Swaps a window out and puts one of the same type in."
                                       (SUBITEMS ("Put Out" (QUOTE WM:MOVE-WINDOW-OFF-SCREEN)
                                                        
                                                       "Puts a new window of an old type off screen."
                                                        )
                                              ("Kill" (QUOTE WM:KILL-AND-SWAP-IN)
                                                     
                                                    "Closes this window and gets one from offscreen."
                                                     )
                                              ("Remember" (QUOTE WM:UPDATE-LOCS-ON-MOVE)
                                                     "Remember where windows of this type go."]
(PUSH BackgroundMenuCommands (QUOTE ("Retrieve" (QUOTE (WM:RETRIEVE-WINDOW))
                                           "Get an off screen window.")))
(SETQ WindowMenu NIL)
(SETQ BackgroundMenu NIL)
(PUTPROPS WINNER COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (3386 9531 (WM:ADD-WINDOW-TO-OFF-SCREEN-LIST 3396 . 3755) (WM:GET-OFF-SCREEN-LOC 3757 . 
3970) (WM:GET-ON-SCREEN-LOC 3972 . 4182) (WM:KILL-AND-SWAP-IN 4184 . 4765) (WM:MOVE-WINDOW-OFF-SCREEN 
4767 . 4992) (WM:MOVE-WINDOW-ON-SCREEN 4994 . 5222) (WM:OFF-SCREEN-WINDOWS-OF-TYPE 5224 . 5411) (
WM:REMEMEBER 5413 . 5623) (WM:REMOVE-WINDOW-FROM-OFF-SCREEN-LIST 5625 . 5994) (WM:RETRIEVE-WINDOW 5996
 . 7039) (WM:SWAP-OUT 7041 . 7768) (WM:UPDATE-LOCS-ON-MOVE 7770 . 8860) (WM:WINDOW-NAME 8862 . 9211) (
WM:WINDOW-TYPE 9213 . 9529)))))
STOP