(FILECREATED "28-May-87 12:18:55" {QV}<NOTECARDS>1.3K>LIBRARY>NCTABLETOP.;28 25234  

      changes to:  (VARS NCTableTop.LinkIconBitmap NCTABLETOPCOMS)
		   (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: "23-Apr-87 21:39:49" {QV}<NOTECARDS>1.3K>NEXT>LIBRARY>NCTABLETOP.;3)


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

(PRETTYCOMPRINT NCTABLETOPCOMS)

(RPAQQ NCTABLETOPCOMS ((* * 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 NCTableTop.OpenEventsExpr 
				     NCTableTop.OldOpenEventsExprs)
			 (VARS (NCTableTop.OpenEventsExpr (QUOTE (PROGN (NC.LoadFileFromDirectories
									  (QUOTE NCTABLETOPCARD))
									(
NCTableTop.NoteFileWhenOpenedFn NoteFile))))
			       (NCTableTop.OldOpenEventsExprs (QUOTE ((PROGN (
NC.LoadFileFromDirectories NCTABLETOP)
									     (
NCTableTop.NoteFileWhenOpenedFn NoteFile))
								      (PROGN (FILESLOAD (FROM 
											NOTECARDS)
											NCTABLETOP)
									     (
NCTableTop.NoteFileWhenOpenedFn NoteFile))))))
			 (* * 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)
			 (* Add a CloseSavingTableTop item to the Close notefile menus.)
			 (P (NCTableTop.FixNoteFileOperationsMenus))))
(* * 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 NCTableTop.OpenEventsExpr NCTableTop.OldOpenEventsExprs)
)

(RPAQQ NCTableTop.OpenEventsExpr (PROGN (NC.LoadFileFromDirectories (QUOTE NCTABLETOPCARD))
					  (NCTableTop.NoteFileWhenOpenedFn NoteFile)))

(RPAQQ NCTableTop.OldOpenEventsExprs ((PROGN (NC.LoadFileFromDirectories NCTABLETOP)
					       (NCTableTop.NoteFileWhenOpenedFn NoteFile))
					(PROGN (FILESLOAD (FROM NOTECARDS)
							  NCTABLETOP)
					       (NCTableTop.NoteFileWhenOpenedFn NoteFile))))
(* * 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: "16-May-87 20:59")

          (* * 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: "16-May-87 20:12")

          (* * Add an expression to the open events card for NoteFile, if it's not already there.)



          (* * rht 4/17/87: Changed from FILESLOAD to call NC.LoadFileFromDirectories so that TTY window gets handled same as
	  rest of NoteCards.)


    (DECLARE (GLOBALVARS NCTableTop.OpenEventsExpr NCTableTop.OldOpenEventsExprs))
    (if (NCP.OpenNoteFileP NoteFile)
	then (LET ((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))

          (* * Remove any outdated tabletop OpenEvents expr's from the open events card substance, taking care not to dirty 
	  the substance unless necessary.)


		    (for OldOpenEventsExpr in NCTableTop.OldOpenEventsExprs bind Substance
		       when (MEMBER OldOpenEventsExpr (SETQ Substance (NCP.CardSubstance
					    OpenEventsCard)))
		       do (NCP.CardSubstance OpenEventsCard (REMOVE OldOpenEventsExpr Substance)
						 ))

          (* * Add the proper expression unless it's already there.)


		    (if (NOT (MEMBER NCTableTop.OpenEventsExpr (NCP.CardSubstance 
										   OpenEventsCard)))
			then (NCP.CardSubstance OpenEventsCard (CONS NCTableTop.OpenEventsExpr
									   (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: "30-Mar-87 23:31")

          (* * Close down the notefile, but save table top first.)



          (* * rht 3/30/87: Minor change to keep it from bugging about saving open cards.)


    (NCTableTop.MakeOrUpdateNoteFileTableTop NoteFile)
    (NCTableTop.AddOpenEventsExpr NoteFile)
    (NC.CloseNoteFile NoteFile NoteFileIconWindow 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: "23-Apr-87 21:33")

          (* * 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 DON'T))
	     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))))))
)



(* Add a CloseSavingTableTop item to the Close notefile menus.)

(NCTableTop.FixNoteFileOperationsMenus)
(PUTPROPS NCTABLETOP COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (3867 7002 (NCTableTop.BringUpTableTop 3877 . 5050) (NCTableTop.CloseDownTableTop 5052
 . 5661) (NCTableTop.RemakeTableTop 5663 . 6174) (NCTableTop.RecomputeTableTop 6176 . 7000)) (7038 
16118 (NCTableTop.ComputeTableTop 7048 . 8157) (NCTableTop.RemakeTableTopSelectingNewCards 8159 . 8832
) (NCTableTop.AddOpenEventsExpr 8834 . 10818) (NCTableTop.NoteFileWhenOpenedFn 10820 . 11588) (
NCTableTop.MakeOrUpdateNoteFileTableTop 11590 . 12765) (NCTableTop.FixNoteFileOperationsMenus 12767 . 
15138) (NCTableTop.CloseNoteFileSavingTableTop 15140 . 15617) (NCTableTop.CloseSessionSavingTableTops 
15619 . 16116)) (16119 22325 (NCTableTop.MakeFn 16129 . 17392) (NCTableTop.EditFn 17394 . 18279) (
NCTableTop.PutFn 18281 . 20356) (NCTableTop.GetFn 20358 . 22323)) (22326 23854 (
NCTableTop.AddTableTopCard 22336 . 23852)) (24573 25041 (NCAddStub.TableTopCard 24583 . 25039)))))
STOP