(FILECREATED "15-Apr-85 20:57:51" {PHYLUM}<NOTECARDS>RELEASE1.2>LIBRARY>NCSCREEN.;3 12413 changes to: (FNS SCREEN.LayoutCardsInSurround) previous date: "25-Mar-85 00:14:00" {PHYLUM}<NOTECARDS>RELEASE1.2>LIBRARY>NCSCREEN.;2) (* Copyright (c) 1984, 1985 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT NCSCREENCOMS) (RPAQQ NCSCREENCOMS ((* Functions for laying out cards on the screen.) (FNS SCREEN.LayoutCardsInSquare SCREEN.LayoutCardsInCascade SCREEN.GetCascadePosition SCREEN.LayoutCardsInSurround SCREEN.SurroundCardWithFileBoxContents SCREEN.MoveCardToPos SCREEN.MoveWinToPos SCREEN.WinLLCorner SCREEN.WinShrinkAndPlace SCREEN.WinLRCorner SCREEN.WinULCorner SCREEN.WinURCorner) (VARS (SCREEN.CascadeXSpace 3) (SCREEN.CascadeYSpace 8)) (GLOBALVARS SCREEN.CascadeXSpace SCREEN.CascadeYSpace))) (* Functions for laying out cards on the screen.) (DEFINEQ (SCREEN.LayoutCardsInSquare (LAMBDA (StartPos Cards) (* rht: " 3-Jan-85 01:07") (* * Layout the windows of Cards in a square with the upper left corner of the mess at StartPos.) (PROG ((NumCards (LENGTH Cards)) NumCols) (SETQ NumCols (FIX (SQRT NumCards))) (for Card in Cards bind (Pos ← StartPos) (Col ← 1) NextRowPos Win do (SCREEN.MoveCardToPos Card Pos) (SETQ Win (NCP.CardWindow Card)) (if (EQ Col 1) then (SETQ NextRowPos (SCREEN.WinLLCorner Win))) (if (EQ Col NumCols) then (SETQ Col 1) (SETQ Pos NextRowPos) else (SETQ Col (ADD1 Col)) (SETQ Pos (SCREEN.WinURCorner Win))) finally (GIVE.TTY.PROCESS Win))))) (SCREEN.LayoutCardsInCascade (LAMBDA (StartPos Cards) (* rht: " 3-Jan-85 19:54") (* * Layout the windows of Cards in a cascaded, overlapping deck with the upper left corner of the mess at StartPos.) (for Card in Cards bind (Pos ← StartPos) Win when (NCP.ValidCard Card) do (SCREEN.MoveCardToPos Card Pos) (SETQ Win (NCP.CardWindow Card)) (SETQ Pos (SCREEN.GetCascadePosition Win)) (GIVE.TTY.PROCESS Win)))) (SCREEN.GetCascadePosition (LAMBDA (Window) (* rht: " 3-Jan-85 19:52") (* * Returns the position near the upper left corner of Window to place the next window in a cascade.) (PROG ((Pos (SCREEN.WinULCorner Window)) (Region (WINDOWPROP Window (QUOTE REGION)))) (RETURN (create POSITION XCOORD ←(IPLUS (fetch (POSITION XCOORD) of Pos) (WINDOWPROP Window (QUOTE BORDER)) SCREEN.CascadeXSpace) YCOORD ←(IDIFFERENCE (IPLUS (fetch (REGION HEIGHT) of Region) (fetch (REGION BOTTOM) of Region)) (IPLUS (FONTPROP WindowTitleDisplayStream (QUOTE HEIGHT)) SCREEN.CascadeYSpace))))))) (SCREEN.LayoutCardsInSurround (LAMBDA (CenterCard Cards) (* rht: "15-Apr-85 20:32") (* * Arrange the given Cards around the CenterCard CenterCard. Returns the number of cards displayed.) (PROG (CenterRegion CenterWindow (RemainingCards Cards)) (SETQ CenterWindow (OR (NCP.CardWindow CenterCard) (NCP.BringUpCard CenterCard))) (if (NULL RemainingCards) then (GIVE.TTY.PROCESS CenterWindow) (RETURN (LENGTH Cards))) (SETQ CenterRegion (WINDOWPROP CenterWindow (QUOTE REGION))) (for bind Card Window (Pos ←(SCREEN.WinURCorner CenterWindow)) Region (RemainingEdge ←(fetch (REGION HEIGHT) of CenterRegion)) until (OR (MINUSP RemainingEdge) (NULL RemainingCards)) do (SETQ Card (CAR RemainingCards)) (SETQ RemainingCards (CDR RemainingCards)) (SCREEN.MoveCardToPos Card Pos (QUOTE UL)) (SETQ Pos (SCREEN.WinLLCorner (SETQ Window (NCP.CardWindow Card)))) (SETQ RemainingEdge (IDIFFERENCE RemainingEdge (fetch (REGION HEIGHT) of (WINDOWREGION Window))))) (if (NULL RemainingCards) then (GIVE.TTY.PROCESS CenterWindow) (RETURN (LENGTH Cards))) (for bind Card Window (Pos ←(SCREEN.WinULCorner CenterWindow)) Region (RemainingEdge ←(fetch (REGION HEIGHT) of CenterRegion)) until (OR (MINUSP RemainingEdge) (NULL RemainingCards)) do (SETQ Card (CAR RemainingCards)) (SETQ RemainingCards (CDR RemainingCards)) (SCREEN.MoveCardToPos Card Pos (QUOTE UR)) (SETQ Pos (SCREEN.WinLRCorner (SETQ Window (NCP.CardWindow Card)))) (SETQ RemainingEdge (IDIFFERENCE RemainingEdge (fetch (REGION HEIGHT) of (WINDOWREGION Window))))) (if (NULL RemainingCards) then (GIVE.TTY.PROCESS CenterWindow) (RETURN (LENGTH Cards))) (for bind Card Window (Pos ←(SCREEN.WinLLCorner CenterWindow)) Region (RemainingEdge ←(fetch (REGION WIDTH) of CenterRegion)) until (OR (MINUSP RemainingEdge) (NULL RemainingCards)) do (SETQ Card (CAR RemainingCards)) (SETQ RemainingCards (CDR RemainingCards)) (SCREEN.MoveCardToPos Card Pos (QUOTE UL)) (SETQ Pos (SCREEN.WinURCorner (SETQ Window (NCP.CardWindow Card)))) (SETQ RemainingEdge (IDIFFERENCE RemainingEdge (fetch (REGION WIDTH) of (WINDOWREGION Window))))) (GIVE.TTY.PROCESS CenterWindow) (RETURN (IDIFFERENCE (LENGTH Cards) (LENGTH RemainingCards)))))) (SCREEN.SurroundCardWithFileBoxContents (LAMBDA (Card Box) (* rht: "11-Feb-85 14:34") (* * Layout the children of Box around Card. If either arg is not present, ask user to select.) (PROG (Selection FileBoxChildren NumberOfChildren NumberDisplayed) (COND ((AND (NULL Card) (NULL Box)) (NCP.PrintMsg NIL T "Select center card and a filebox." (CHARACTER 13)) (OR (SETQ Selection (NCP.SelectCards)) (RETURN)) (SETQ Card (CAR Selection)) (SETQ Box (CADR Selection))) ((NULL Card) (NCP.PrintMsg NIL T "Select center card.") (OR (SETQ Card (CAR (NCP.SelectCards))) (RETURN))) ((NULL Box) (NCP.PrintMsg NIL T "Select FileBox.") (OR (SETQ Box (CAR (NCP.SelectCards))) (RETURN)))) (SETQ FileBoxChildren (NCP.FileBoxChildren Box)) (SETQ NumberOfChildren (LENGTH FileBoxChildren)) (SETQ NumberDisplayed (SCREEN.LayoutCardsInSurround Card FileBoxChildren)) (if (ILESSP NumberDisplayed NumberOfChildren) then (NC.PrintMsg NIL T "Only able to display " NumberDisplayed " out of " NumberOfChildren " total cards." (CHARACTER 13)))))) (SCREEN.MoveCardToPos (LAMBDA (Card Pos Corner) (* rht: "22-Mar-85 13:38") (* * Move a card's window such that its Corner corner is at Pos.) (PROG (Win) (if (NOT (SETQ Win (NCP.CardWindow Card))) then (SETQ Win (NCP.BringUpCard Card (create POSITION XCOORD ←(fetch (REGION WIDTH) of WHOLESCREEN) YCOORD ←(fetch (REGION HEIGHT) of WHOLESCREEN))))) (SCREEN.MoveWinToPos Win Pos Corner)))) (SCREEN.MoveWinToPos (LAMBDA (Win Pos Corner) (* rht: " 4-Jan-85 01:54") (* * Move a window such that its upper left corner is at Pos. Then possibly move it again to make sure it's all on the screen. Corner, if present, should be one of the litatoms UL, LL, UR, LR signifying which corner of the card should wind up at position Pos. Corner defaults to UL.) (PROG ((Region (WINDOWREGION Win))) (SELECTQ Corner (LL (MOVEW Win (fetch (POSITION XCOORD) of Pos) (fetch (POSITION YCOORD) of Pos))) (UR (MOVEW Win (IDIFFERENCE (fetch (POSITION XCOORD) of Pos) (fetch (REGION WIDTH) of Region)) (IDIFFERENCE (fetch (POSITION YCOORD) of Pos) (fetch (REGION HEIGHT) of Region)))) (LR (MOVEW Win (IDIFFERENCE (fetch (POSITION XCOORD) of Pos) (fetch (REGION WIDTH) of Region)) (fetch (POSITION YCOORD) of Pos))) (MOVEW Win (fetch (POSITION XCOORD) of Pos) (IDIFFERENCE (fetch (POSITION YCOORD) of Pos) (fetch (REGION HEIGHT) of Region)))) (SETQ Region (MAKEWITHINREGION (COPY (WINDOWREGION Win)) WHOLESCREEN)) (RETURN (MOVEW Win (fetch (REGION LEFT) of Region) (fetch (REGION BOTTOM) of Region)))))) (SCREEN.WinLLCorner (LAMBDA (Win) (* rht: "30-Oct-84 19:29") (* * Return the position of the lower left corner of Win.) (PROG ((Region (WINDOWREGION Win))) (RETURN (create POSITION XCOORD ←(fetch (REGION LEFT) of Region) YCOORD ←(fetch (REGION BOTTOM) of Region)))))) (SCREEN.WinShrinkAndPlace (LAMBDA (Win) (* rht: "27-Nov-84 12:14") (* * Shrink the given window, if not already shrunk, and place in the upper left corner of Win.) (PROG (ShrunkWin (WinULCorner (SCREEN.WinULCorner Win))) (RETURN (if (AND Win (SETQ ShrunkWin (SHRINKW Win NIL (create POSITION XCOORD ←(fetch (REGION WIDTH) of WHOLESCREEN) YCOORD ←(fetch (REGION HEIGHT) of WHOLESCREEN))))) then (SCREEN.MoveWinToPos ShrunkWin WinULCorner) ShrunkWin else Win))))) (SCREEN.WinLRCorner (LAMBDA (Win) (* rht: "30-Oct-84 19:30") (* * Return the position of the lower right corner of Win.) (PROG ((Region (WINDOWREGION Win))) (RETURN (create POSITION XCOORD ←(IPLUS (fetch (REGION LEFT) of Region) (fetch (REGION WIDTH) of Region)) YCOORD ←(fetch (REGION BOTTOM) of Region)))))) (SCREEN.WinULCorner (LAMBDA (Win) (* rht: "30-Oct-84 19:30") (* * Return the position of the upper left corner of Win.) (PROG ((Region (WINDOWREGION Win))) (RETURN (create POSITION XCOORD ←(fetch (REGION LEFT) of Region) YCOORD ←(IPLUS (fetch (REGION BOTTOM) of Region) (fetch (REGION HEIGHT) of Region))))))) (SCREEN.WinURCorner (LAMBDA (Win) (* rht: "30-Oct-84 19:30") (* * Return the position of the upper right corner of Win.) (PROG ((Region (WINDOWREGION Win))) (RETURN (create POSITION XCOORD ←(IPLUS (fetch (REGION LEFT) of Region) (fetch (REGION WIDTH) of Region)) YCOORD ←(IPLUS (fetch (REGION BOTTOM) of Region) (fetch (REGION HEIGHT) of Region))))))) ) (RPAQQ SCREEN.CascadeXSpace 3) (RPAQQ SCREEN.CascadeYSpace 8) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS SCREEN.CascadeXSpace SCREEN.CascadeYSpace) ) (PUTPROPS NCSCREEN COPYRIGHT ("Xerox Corporation" 1984 1985)) (DECLARE: DONTCOPY (FILEMAP (NIL (948 12165 (SCREEN.LayoutCardsInSquare 958 . 1838) (SCREEN.LayoutCardsInCascade 1840 . 2397) (SCREEN.GetCascadePosition 2399 . 3208) (SCREEN.LayoutCardsInSurround 3210 . 6162) ( SCREEN.SurroundCardWithFileBoxContents 6164 . 7562) (SCREEN.MoveCardToPos 7564 . 8145) ( SCREEN.MoveWinToPos 8147 . 9662) (SCREEN.WinLLCorner 9664 . 10059) (SCREEN.WinShrinkAndPlace 10061 . 10732) (SCREEN.WinLRCorner 10734 . 11189) (SCREEN.WinULCorner 11191 . 11646) (SCREEN.WinURCorner 11648 . 12163))))) STOP