(FILECREATED "21-Nov-86 20:47:57" {QV}<NOTECARDS>1.3K>LIBRARY>NCOPENEVENTSLISTCARD.;3 5072   

      changes to:  (VARS NCOPENEVENTSLISTCARDCOMS)
		   (FNS NCOpenL.AddOpenEventsListCard NCOpenL.OpenEventsListMakeFn 
			NCOpenL.EvaluateOpenEventsListCard NCOpenL.OpenNoteFileFn 
			NCOpenL.GetOpenEventsListCard)

      previous date: "21-Nov-86 12:26:54" {QV}<NOTECARDS>1.3K>LIBRARY>NCOPENEVENTSLISTCARD.;2)


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

(PRETTYCOMPRINT NCOPENEVENTSLISTCARDCOMS)

(RPAQQ NCOPENEVENTSLISTCARDCOMS ((* * NoteCards Library Pakage to implement the OpenEventsList card 
				      type. Used to allow NF to specify events that should happen at 
				      open time. This differs from OpenEvents card type in that it 
				      inherits from List card rather than Text card. That means that 
				      currently there is no EditFn.)
				   (FNS NCOpenL.AddOpenEventsListCard NCOpenL.OpenEventsListMakeFn 
					NCOpenL.EvaluateOpenEventsListCard NCOpenL.OpenNoteFileFn 
					NCOpenL.GetOpenEventsListCard)
				   (P (NCOpenL.AddOpenEventsListCard)
				      (PUTPROP (QUOTE OpenEventsList)
					       (QUOTE Don'tForceFilingFlg)
					       T))
				   (GLOBALVARS NC.OpenNoteFileFns)
				   (ADDVARS (NC.OpenNoteFileFns NCOpenL.OpenNoteFileFn))))
(* * NoteCards Library Pakage to implement the OpenEventsList card type. Used to allow NF to 
specify events that should happen at open time. This differs from OpenEvents card type in that 
it inherits from List card rather than Text card. That means that currently there is no EditFn.
)

(DEFINEQ

(NCOpenL.AddOpenEventsListCard
  (LAMBDA NIL                                                (* rht: "21-Nov-86 12:15")

          (* * Add OpenEventsList card type to card type list)


    (NCP.CreateCardType (QUOTE OpenEventsList)
			  (QUOTE List)
			  (BQUOTE ((MakeFn , (FUNCTION NCOpenL.OpenEventsListMakeFn))))
			  (BQUOTE ((LinkAnchorModesSupported NIL)
				     (DisplayedInMenuFlg NIL))))))

(NCOpenL.OpenEventsListMakeFn
  (LAMBDA (Card Title NoDisplayFlg)                          (* rht: "21-Nov-86 12:18")

          (* * If one doesn't exist, create an OpenEventsList card, otherwise bring up the old one.)


    (LET ((NoteFile (fetch (Card NoteFile) of Card))
	  OpenEventCard ReturnValue)
         (if (NCP.ValidCardP (SETQ OpenEventCard (NCP.LookupCardByName (QUOTE 
										   OpenEventsList)
									       NoteFile)))
	     then 

          (* * An open events card exists already, bring it up as required and return NIL)


		    (if NoDisplayFlg
			then (NCP.CacheCards OpenEventCard)
		      else (NCP.OpenCard OpenEventCard))
		    NIL
	   else 

          (* * Create a Text card and register it under the name OpenEvents)


		  (SETQ ReturnValue (NCP.ApplySuperTypeFn MakeFn Card (OR Title 
									      "Open Events List")
							    NoDisplayFlg))
		  (NCP.CardTitle Card "Open Events List")
		  (NCP.RegisterCardByName (QUOTE OpenEventsList)
					    (if (WINDOWP ReturnValue)
						then (NCP.CoerceToCard ReturnValue)
					      else ReturnValue))
		  ReturnValue))))

(NCOpenL.EvaluateOpenEventsListCard
  (LAMBDA (Card)                                             (* rht: "21-Nov-86 12:19")

          (* * Evaluate the contents of an OpenEventsList card.)


    (NC.PrintMsg NIL NIL "Evaluating the Open Events List card")
    (LET ((NoteFile (fetch (Card NoteFile) of Card)))
         (ERSETQ (for Item in (NCP.CardSubstance Card) do (ERRORSET Item))))))

(NCOpenL.OpenNoteFileFn
  (LAMBDA (FileName NoteFile When)                           (* rht: "21-Nov-86 19:21")

          (* * If When = AFTER then read and eval the OpenEventsList card.)


    (SELECTQ When
	       (AFTER (OR (type? NoteFile NoteFile)
			    (SETQ NoteFile (NC.NoteFileFromFileName FileName)))
		      (LET ((OpenEventsCard (NCP.LookupCardByName (QUOTE OpenEventsList)
								    NoteFile)))
		           (if (NCP.ValidCardP OpenEventsCard)
			       then (NCOpenL.EvaluateOpenEventsListCard OpenEventsCard))))
	       NIL)))

(NCOpenL.GetOpenEventsListCard
  (LAMBDA (NoteFile)                                         (* rht: "21-Nov-86 19:14")

          (* * Create an OpenEventsList card if there isn't one already.)


    (LET ((Card (NCP.LookupCardByName (QUOTE OpenEventsList)
					NoteFile)))
         (if (NCP.ValidCardP Card)
	     then Card
	   else (NCP.CreateCard (QUOTE OpenEventsList)
				    NoteFile NIL T)))))
)
(NCOpenL.AddOpenEventsListCard)
(PUTPROP (QUOTE OpenEventsList)
	 (QUOTE Don'tForceFilingFlg)
	 T)
(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS NC.OpenNoteFileFns)
)

(ADDTOVAR NC.OpenNoteFileFns NCOpenL.OpenNoteFileFn)
(PUTPROPS NCOPENEVENTSLISTCARD COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (1600 4755 (NCOpenL.AddOpenEventsListCard 1610 . 2046) (NCOpenL.OpenEventsListMakeFn 
2048 . 3265) (NCOpenL.EvaluateOpenEventsListCard 3267 . 3704) (NCOpenL.OpenNoteFileFn 3706 . 4307) (
NCOpenL.GetOpenEventsListCard 4309 . 4753)))))
STOP