(FILECREATED "27-Mar-87 14:39:50" {QV}<NOTECARDS>1.3K>NEXT>PMIPATCH024.;4 23635 changes to: (VARS PMIPATCH024COMS NCTableTop.LinkIconBitmap) (FNS NCTableTop.BringUpTableTop NCTableTop.CloseDownTableTop NCTableTop.RemakeTableTop NCTableTop.RecomputeTableTop NCTableTop.ComputeTableTop NCTableTop.RemakeTableTopSelectingNewCards NCTableTop.AddOpenEventsExpr NCTableTop.NoteFileWhenOpenedFn NCTableTop.MakeOrUpdateNoteFileTableTop NCTableTop.FixNoteFileOperationsMenus NCTableTop.CloseNoteFileSavingTableTop NCTableTop.CloseSessionSavingTableTops NCTableTop.MakeFn NCTableTop.EditFn NCTableTop.PutFn NCTableTop.GetFn NCTableTop.AddTableTopCard NCAddStub.TableTopCard) previous date: "27-Mar-87 11:09:52" {QV}<NOTECARDS>1.3K>NEXT>PMIPATCH024.;1) (* Copyright (c) 1987 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT PMIPATCH024COMS) (RPAQQ PMIPATCH024COMS ((* * pmi 3/27/87: Updated NCTABLETOP for new Session icon menus. Copy this patch file to NCTABLETOP on 1.3K>Library> when making a new sysout.) (* * Table top cards have substances containing card UIDs and screen regions. Following a link to a tabletop brings up its card in the stored regions.) (GLOBALVARS NCTableTop.LinkIconBitmap) (* * The following functions are exported, i.e. documented and callable from outside.) (FNS NCTableTop.BringUpTableTop NCTableTop.CloseDownTableTop NCTableTop.RemakeTableTop NCTableTop.RecomputeTableTop) (* * The rest are internal.) (FNS NCTableTop.ComputeTableTop NCTableTop.RemakeTableTopSelectingNewCards NCTableTop.AddOpenEventsExpr NCTableTop.NoteFileWhenOpenedFn NCTableTop.MakeOrUpdateNoteFileTableTop NCTableTop.FixNoteFileOperationsMenus NCTableTop.CloseNoteFileSavingTableTop NCTableTop.CloseSessionSavingTableTops) (FNS NCTableTop.MakeFn NCTableTop.EditFn NCTableTop.PutFn NCTableTop.GetFn) (FNS NCTableTop.AddTableTopCard) (BITMAPS NCTableTop.LinkIconBitmap) (RECORDS TableTopEntry) (P (NCTableTop.AddTableTopCard) (PUTPROP (QUOTE TableTop) (QUOTE ExtraLinkIconMenuItems) (QUOTE ((Run% TableTop (FUNCTION NCTableTop.BringUpTableTop) "Bring up the cards in destination's table top." (SUBITEMS (Close% Down% TableTop (FUNCTION NCTableTop.CloseDownTableTop) "Close the cards in destination's table top."))))) )) (FNS NCAddStub.TableTopCard) (P (NCTableTop.FixNoteFileOperationsMenus)))) (* * pmi 3/27/87: Updated NCTABLETOP for new Session icon menus. Copy this patch file to NCTABLETOP on 1.3K>Library> when making a new sysout.) (* * Table top cards have substances containing card UIDs and screen regions. Following a link to a tabletop brings up its card in the stored regions.) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS NCTableTop.LinkIconBitmap) ) (* * The following functions are exported, i.e. documented and callable from outside.) (DEFINEQ (NCTableTop.BringUpTableTop (LAMBDA (TableTopCardOrWindow) (* rht: "12-Feb-87 17:45") (* * Bring up all TableTopCard's cards in their proper positions.) (LET ((TableTopCard (NCP.CoerceToCard TableTopCardOrWindow))) (NC.ActivateCardAndDo TableTopCard (for TableTopEntry in (NCP.CardSubstance TableTopCard) do (LET ((Card (fetch (TableTopEntry Card) of TableTopEntry)) (Region (fetch (TableTopEntry Region) of TableTopEntry)) (ShrunkenWinPos (fetch (TableTopEntry ShrunkenWinPos) of TableTopEntry)) Win) (if (AND (NCP.ValidCardP Card) (REGIONP Region)) then (SETQ Win (NCP.OpenCard Card Region) ) (if (AND (fetch (TableTopEntry ShrunkenFlg) of TableTopEntry) (POSITIONP ShrunkenWinPos)) then (SHRINKW Win NIL ShrunkenWinPos))))) )))) (NCTableTop.CloseDownTableTop (LAMBDA (TableTopCardOrWindow) (* rht: "11-Feb-87 16:43") (* * Close all the cards in the table top.) (LET ((TableTopCard (NCP.CoerceToCard TableTopCardOrWindow))) (NC.ActivateCardAndDo TableTopCard (for TableTopEntry in (NCP.CardSubstance TableTopCard) bind Card when (NCP.ValidCardP (SETQ Card (fetch (TableTopEntry Card) of TableTopEntry))) do (NCP.CloseCards Card)))))) (NCTableTop.RemakeTableTop (LAMBDA (TableTopCardOrWindow ListOfCards) (* rht: "11-Feb-87 10:54") (* * Rebuild the substance of TableTopCard using a new list of cards.) (LET ((TableTopCard (NCP.CoerceToCard TableTopCardOrWindow))) (OR (NC.ActiveCardP TableTopCard) (NCP.CacheCards TableTopCard)) (NC.SetSubstance TableTopCard (NCTableTop.ComputeTableTop ListOfCards)) (NC.MarkCardDirty TableTopCard)))) (NCTableTop.RecomputeTableTop (LAMBDA (TableTopCardOrWindow) (* rht: "11-Feb-87 16:39") (* * Reusing the cards in the TableTopCard, recompute the substance based on the card's new shapes, positions, and totopw ordering.) (LET ((TableTopCard (NCP.CoerceToCard TableTopCardOrWindow))) (OR (NC.ActiveCardP TableTopCard) (NCP.CacheCards TableTopCard)) (NC.SetSubstance TableTopCard (NCTableTop.ComputeTableTop (for TableTopEntry in (NC.FetchSubstance TableTopCard) bind Card when (NCP.ValidCardP (SETQ Card (fetch (TableTopEntry Card) of TableTopEntry))) collect Card))) (NC.MarkCardDirty TableTopCard)))) ) (* * The rest are internal.) (DEFINEQ (NCTableTop.ComputeTableTop (LAMBDA (ListOfCards) (* rht: " 2-Mar-87 20:04") (* * This looks at all the open windows and computes the tabletop, a list of records containing card, windowregion, shrunken window position, and flag indicating whether window is shrunken. Only done for those entries in ListOfCards that have open windows. TOTOPW order is preserved.) (for Win in (OPENWINDOWS) bind Card IconFor IconWin when (AND (SETQ Card (NC.CoerceToCard (OR (SETQ IconFor (WINDOWPROP Win (QUOTE ICONFOR))) Win))) (FMEMB Card ListOfCards)) collect (create TableTopEntry Card ← Card Region ←(WINDOWPROP (OR IconFor Win) (QUOTE REGION)) ShrunkenWinPos ←(COND (IconFor (WINDOWPOSITION Win)) ((WINDOWP (SETQ IconWin (WINDOWPROP Win (QUOTE ICONWINDOW)))) (WINDOWPOSITION IconWin))) ShrunkenFlg ←(AND IconFor T))))) (NCTableTop.RemakeTableTopSelectingNewCards (LAMBDA (TableTopCardOrWindow) (* rht: "11-Feb-87 17:10") (* * Rebuild the substance of TableTopCard using a new list of cards provided by the user.) (LET ((TableTopCard (NCP.CoerceToCard TableTopCardOrWindow)) ListOfCards) (SETQ ListOfCards (NCP.SelectCards (NCP.CardWindow TableTopCard) NIL (FUNCTION NCP.ValidCardP) "Choose new cards for rebuilding table top." T)) (if (EQ ListOfCards (QUOTE CANCELLED)) then NIL else (NCTableTop.RemakeTableTop TableTopCard ListOfCards))))) (NCTableTop.AddOpenEventsExpr (LAMBDA (NoteFile) (* rht: "11-Feb-87 10:34") (* * Add an expression to the open events card for NoteFile, if it's not already there.) (if (NCP.OpenNoteFileP NoteFile) then (LET ((OpenEventSExp (QUOTE (PROGN (FILESLOAD (FROM NOTECARDS) NCTABLETOP) (NCTableTop.NoteFileWhenOpenedFn NoteFile)))) (OpenEventsCard (NCP.GetOpenEventsCard NoteFile)) OpenEventsCardWasCachedFlg) (* * Add call to NCHist.NoteFileWhenOpenedFn to the open events card substance.) (if (NOT (SETQ OpenEventsCardWasCachedFlg (NCP.ActiveCardP OpenEventsCard) )) then (NCP.CacheCards OpenEventsCard)) (if (NOT (MEMBER OpenEventSExp (NCP.CardSubstance OpenEventsCard))) then (NCP.CardSubstance OpenEventsCard (CONS OpenEventSExp (NCP.CardSubstance OpenEventsCard)))) (if (NOT OpenEventsCardWasCachedFlg) then (NCP.CloseCards OpenEventsCard))) else (NCP.ReportError "NCTableTop.AddOpenEventsExpr" (CONCAT "Can't add OpenEvents expression to closed notefile: " NoteFile))))) (NCTableTop.NoteFileWhenOpenedFn (LAMBDA (NoteFile) (* rht: "12-Feb-87 17:43") (* * Look for the TableTop card left from previous closing. If there is one, then bring it up.) (LET ((TableTopCard (NCP.LookupCardByName (QUOTE NoteFileTableTop) NoteFile))) (if (NCP.ValidCardP TableTopCard) then (OR (NC.ActiveCardP TableTopCard) (NCP.CacheCards TableTopCard)) (NCTableTop.BringUpTableTop TableTopCard) (* Smash substance so this table top won't be brought up next time notefile is opened.) (NCTableTop.RemakeTableTop TableTopCard NIL))))) (NCTableTop.MakeOrUpdateNoteFileTableTop (LAMBDA (NoteFile) (* rht: "11-Feb-87 17:03") (* * Looks for a notefile tabletop card in the registry. If there is one, then update its contents with new table top based on current open cards. Else make a new one and register it.) (LET ((TableTopCard (NCP.LookupCardByName (QUOTE NoteFileTableTop) NoteFile)) (OpenCards (for Win in (OPENWINDOWS) bind Card when (AND (NCP.ValidCardP (SETQ Card (NCP.CardFromWindow (OR (WINDOWPROP Win (QUOTE ICONFOR)) Win)))) (EQ NoteFile (NCP.CardNoteFile Card))) collect Card))) (if (NCP.ValidCardP TableTopCard) then (NCTableTop.RemakeTableTop TableTopCard OpenCards) else (SETQ TableTopCard (NCP.CreateCard (QUOTE TableTop) NoteFile (QUOTE NoteFileTableTop) T (QUOTE (Don'tRequireFilingFlg T)) NIL OpenCards)) (NCP.RegisterCardByName (QUOTE NoteFileTableTop) TableTopCard))))) (NCTableTop.FixNoteFileOperationsMenus (LAMBDA NIL (* pmi: "27-Mar-87 11:00") (* * Change the CloseNoteFile menu item to have a pull-across for Close saving notefile tabletop. Do the same for the CloseSession item.) (* * pmi 3/27/87: Updated for new Session icon menus.) (DECLARE (GLOBALVARS NC.NoteFileIconOperationsMenuItems NC.NoteFileOpsItems NC.NoteFileOpsMenu NC.NoteFileIconOpenOperations)) (LET ((NoteFileIconCloseItem (QUOTE (Close NIL "Closes this NoteFile." (SUBITEMS ( Close% w/o% confirm NIL "Close this notefile, but don't ask for user confirm before closing open cards.") ( Close% Saving% TableTop NCTableTop.CloseNoteFileSavingTableTop "Close this notefile, saving currently open cards in a tabletop."))))) (NoteFileOperationsCloseItem (QUOTE (% Close% (NC.DoNoteFileOp (QUOTE Close% NoteFile)) "Close a notefile." (SUBITEMS (Close% w/o% confirm (NC.DoNoteFileOp (QUOTE Close% w/o% confirm)) "Close a notefile w/o asking for user confirm before closing open cards.") (Close% All (NC.CloseSession) "Close all currently open NoteFiles") (Close% All% w/o% confirm ( NC.CloseSession NIL T) "Close all open notefiles w/o asking for user confirm before closing open cards.") (Close% Saving% TableTop (NC.DoNoteFileOp (FUNCTION NCTableTop.CloseNoteFileSavingTableTop)) "Close a notefile, saving currently open cards in a tabletop.") (Close% All% Saving% TableTops ( NCTableTop.CloseSessionSavingTableTops) "Close all open notefiles saving their tabletops."))))) ) (PUTASSOC (QUOTE Close) (CDR NoteFileIconCloseItem) NC.NoteFileIconOperationsMenuItems) (pushnew NC.NoteFileIconOpenOperations (QUOTE Close% Saving% TableTop)) (NC.MakeNoteFileIconOperationsMenus) (PUTASSOC (QUOTE % Close% ) (CDR NoteFileOperationsCloseItem) NC.NoteFileOpsItems) (SETQ NC.NoteFileOpsMenu NIL)))) (NCTableTop.CloseNoteFileSavingTableTop (LAMBDA (NoteFile NoteFileIconWindow) (* rht: "16-Feb-87 16:58") (* * Close down the notefile, but save table top first.) (NCTableTop.MakeOrUpdateNoteFileTableTop NoteFile) (NCTableTop.AddOpenEventsExpr NoteFile) (NC.CloseNoteFile NoteFile NoteFileIconWindow NIL NIL T))) (NCTableTop.CloseSessionSavingTableTops (LAMBDA NIL (* rht: "16-Feb-87 22:12") (* * Close all open notefiles saving their table tops.) (MAPHASH NC.NoteFilesHashArray (FUNCTION (LAMBDA (Value Key) (if (AND (type? NoteFile Value) (NC.NoteFileOpenP Value)) then (NCTableTop.CloseNoteFileSavingTableTop Value))))) (NC.PrintMsg NIL T "Done closing all NoteFiles."))) ) (DEFINEQ (NCTableTop.MakeFn (LAMBDA (TableTopCard Title NoDisplayFlg ListOfCards) (* rht: " 4-Feb-87 14:46") (* * Create a table top card substance. If ListOfCards is nil, ask user to select cards. Substance consists of list of pairs of card uid and screen window region. Note that OPENWINDOWS is used to get proper TOTOPW ordering or cards.) (LET (Window) (if (NOT NoDisplayFlg) then (SETQ Window (NC.MakeNewCardWindow TableTopCard (OR Title "Untitled") NIL NIL)) (NCP.SetUpTitleBar Window (NC.RetrieveType TableTopCard)) (WINDOWADDPROP Window (QUOTE SHRINKFN) (FUNCTION NC.GraphCardShrinkFn))) (OR (LISTP ListOfCards) (SETQ ListOfCards (NCP.SelectCards Window NIL (FUNCTION NCP.ValidCardP) "Choose cards for table top." T))) (if (EQ ListOfCards (QUOTE CANCELLED)) then (NC.DeactivateCard TableTopCard) (AND (WINDOWP Window) (CLOSEW Window)) NIL else (NC.SetSubstance TableTopCard (NCTableTop.ComputeTableTop ListOfCards)) (if NoDisplayFlg then TableTopCard else Window))))) (NCTableTop.EditFn (LAMBDA (TableTopCard Substance Region/Position) (* rht: " 4-Feb-87 14:46") (* * Bringing up a table top card, for now, means to bring up all its cards in their proper positions.) (LET (Window) (if (SETQ Window (NC.FetchWindow TableTopCard)) then (TOTOPW Window) (if Region/Position then (SHAPEW Window (NC.DetermineDisplayRegion TableTopCard Region/Position))) (RPTQ 2 (FLASHW Window)) else (SETQ Window (NC.MakeNewCardWindow TableTopCard (OR (NC.RetrieveTitle TableTopCard) "Untitled") NIL T)) (NCP.SetUpTitleBar Window (NC.RetrieveType TableTopCard)) (WINDOWADDPROP Window (QUOTE SHRINKFN) (FUNCTION NC.GraphCardShrinkFn))) Window))) (NCTableTop.PutFn (LAMBDA (TableTopCard Stream) (* rht: "12-Feb-87 18:16") (* * Write the table top substance down to the stream. The format is number of pairs, followed by pairs of uid and region.) (LET ((NoteFile (NCP.CardNoteFile TableTopCard)) (Substance (NCP.CardSubstance TableTopCard)) (StartLoc (GETFILEPTR Stream)) (NumRecords 0)) (NC.WritePtr Stream 0 3) (for TableTopEntry in Substance do (LET ((Card (fetch (TableTopEntry Card) of TableTopEntry)) (Region (fetch (TableTopEntry Region) of TableTopEntry)) (ShrunkenWinPos (fetch (TableTopEntry ShrunkenWinPos) of TableTopEntry)) (ShrunkenFlg (fetch (TableTopEntry ShrunkenFlg) of TableTopEntry)) Card) (if (AND (NCP.ValidCardP Card) (REGIONP Region) (OR (NULL ShrunkenFlg) (POSITIONP ShrunkenWinPos))) then (NC.WriteUID Stream (fetch (Card UID) of Card)) (NC.WritePtr Stream (fetch LEFT of Region) 2) (NC.WritePtr Stream (fetch BOTTOM of Region) 2) (NC.WritePtr Stream (fetch WIDTH of Region) 2) (NC.WritePtr Stream (fetch HEIGHT of Region) 2) (NC.WritePtr Stream (if ShrunkenFlg then (fetch XCOORD of ShrunkenWinPos) else 0) 2) (NC.WritePtr Stream (if ShrunkenFlg then (fetch YCOORD of ShrunkenWinPos) else 0) 2) (NC.WritePtr Stream (if ShrunkenFlg then 1 else 0) 1) (add NumRecords 1)))) (SETFILEPTR Stream StartLoc) (NC.WritePtr Stream NumRecords 3) (* Leave file ptr at eof.) (SETFILEPTR Stream -1) (* Return 1 to indicate this is version 1 substance format.) 1))) (NCTableTop.GetFn (LAMBDA (TableTopCard Length Stream VersionNum) (* rht: "12-Feb-87 18:18") (* * Read in the TableTop card/region pairs. Expect a length field first.) (LET ((NoteFile (NCP.CardNoteFile TableTopCard)) (NumEntries (NC.ReadPtr Stream 3))) (SELECTQ VersionNum (0 (* Old style table top format didn't store shrunken window info.) (for i from 1 to NumEntries collect (LET ((UID (NC.ReadUID Stream)) (Region (NC.ReadRegion Stream)) Card) (if (AND (type? UID UID) (NCP.ValidCardP (SETQ Card (NC.CardFromUID UID NoteFile))) (REGIONP Region)) then (create TableTopEntry Card ← Card Region ← Region ShrunkenWinPos ← NIL ShrunkenFlg ← NIL))))) (1 (* Latest table top substance format.) (for i from 1 to NumEntries collect (LET ((UID (NC.ReadUID Stream)) (Region (NC.ReadRegion Stream)) (ShrunkenWinPos (CREATEPOSITION (NC.ReadPtr Stream 2) (NC.ReadPtr Stream 2))) (ShrunkenIndicator (NC.ReadPtr Stream 1)) Card) (if (AND (type? UID UID) (NC.CardP (SETQ Card (NC.CardFromUID UID NoteFile))) (REGIONP Region) (POSITIONP ShrunkenWinPos)) then (create TableTopEntry Card ← Card Region ← Region ShrunkenWinPos ← ShrunkenWinPos ShrunkenFlg ←(EQ ShrunkenIndicator 1)) )))) (NCP.ReportError "NCTableTop.GetFn" (CONCAT "Improper substance version num: " VersionNum)))))) ) (DEFINEQ (NCTableTop.AddTableTopCard (LAMBDA NIL (* rht: "11-Feb-87 10:54") (* * Define the table top card type.) (DECLARE (GLOBALVARS NCTableTop.LinkIconBitmap)) (NC.AddCardType (QUOTE TableTop) (QUOTE NoteCard) (BQUOTE ((MakeFn , (FUNCTION NCTableTop.MakeFn)) (EditFn , (FUNCTION NCTableTop.EditFn)) (GetFn , (FUNCTION NCTableTop.GetFn)) (PutFn , (FUNCTION NCTableTop.PutFn)) (QuitFn , (FUNCTION NILL)) (DirtyPFn , (FUNCTION NILL)) (MarkDirtyFn , (FUNCTION NILL)))) (BQUOTE ((LinkAnchorModesSupported NIL) (DisplayedInMenuFlg T) (DefaultHeight 40) (DefaultWidth 150) (LinkIconAttachedBitMap , NCTableTop.LinkIconBitmap) (MiddleButtonMenuItems ((Recompute% TableTop (FUNCTION NCTableTop.RecomputeTableTop) "Recomputes this table top using current configuration of its cards." (SUBITEMS (New% Cards (FUNCTION NCTableTop.RemakeTableTopSelectingNewCards) "Recompute this table top using a new list of cards."))) (Bring% Up% TableTop (FUNCTION NCTableTop.BringUpTableTop) "Bring up the table top cards in proper layout.") (Close% Down% TableTop (FUNCTION NCTableTop.CloseDownTableTop) "Close all cards in the table top.")))))))) ) (RPAQ NCTableTop.LinkIconBitmap (READBITMAP)) (21 18 "OOOOOH@@" "H@@@@H@@" "HCOONH@@" "HFGLNH@@" "HNFDNH@@" "IINGJH@@" "KIOOBH@@" "KOONBH@@" "JH@BBH@@" "JH@BBH@@" "JH@BBH@@" "JH@BBH@@" "JH@BBH@@" "JH@BBH@@" "J@@B@H@@" "J@@B@H@@" "H@@@@H@@" "OOOOOH@@") [DECLARE: EVAL@COMPILE (RECORD TableTopEntry (Card Region ShrunkenWinPos ShrunkenFlg)) ] (NCTableTop.AddTableTopCard) (PUTPROP (QUOTE TableTop) (QUOTE ExtraLinkIconMenuItems) (QUOTE ((Run% TableTop (FUNCTION NCTableTop.BringUpTableTop) "Bring up the cards in destination's table top." (SUBITEMS (Close% Down% TableTop (FUNCTION NCTableTop.CloseDownTableTop) "Close the cards in destination's table top."))))) ) (DEFINEQ (NCAddStub.TableTopCard (LAMBDA NIL (* rht: " 4-Feb-87 14:47") (* * Add the tabletop card type stub.) (DECLARE (GLOBALVARS NCTableTop.LinkIconBitmap)) (NC.AddCardTypeStub (QUOTE TableTop) (QUOTE NoteCard) (QUOTE NCTABLETOP) NIL (BQUOTE ((DisplayedInMenuFlg T) (LinkIconAttachedBitMap , NCTableTop.LinkIconBitmap)))))) ) (NCTableTop.FixNoteFileOperationsMenus) (PUTPROPS PMIPATCH024 COPYRIGHT ("Xerox Corporation" 1987)) (DECLARE: DONTCOPY (FILEMAP (NIL (3121 6256 (NCTableTop.BringUpTableTop 3131 . 4304) (NCTableTop.CloseDownTableTop 4306 . 4915) (NCTableTop.RemakeTableTop 4917 . 5428) (NCTableTop.RecomputeTableTop 5430 . 6254)) (6292 14594 (NCTableTop.ComputeTableTop 6302 . 7411) (NCTableTop.RemakeTableTopSelectingNewCards 7413 . 8086 ) (NCTableTop.AddOpenEventsExpr 8088 . 9388) (NCTableTop.NoteFileWhenOpenedFn 9390 . 10158) ( NCTableTop.MakeOrUpdateNoteFileTableTop 10160 . 11335) (NCTableTop.FixNoteFileOperationsMenus 11337 . 13708) (NCTableTop.CloseNoteFileSavingTableTop 13710 . 14093) (NCTableTop.CloseSessionSavingTableTops 14095 . 14592)) (14595 20797 (NCTableTop.MakeFn 14605 . 15872) (NCTableTop.EditFn 15874 . 16759) ( NCTableTop.PutFn 16761 . 18836) (NCTableTop.GetFn 18838 . 20795)) (20798 22326 ( NCTableTop.AddTableTopCard 20808 . 22324)) (23045 23513 (NCAddStub.TableTopCard 23055 . 23511))))) STOP