(FILECREATED "19-Nov-86 15:46:45" {QV}<NOTECARDS>1.3K>LIBRARY>NCOPENEVENTSCARD.;8 4793   

      changes to:  (FNS NCOpen.CreateOpenEventsCard NCOpen.AddOpenEventsCardType)
		   (VARS NCOPENEVENTSCARDCOMS)

      previous date: " 5-May-86 19:19:32" {QV}<NOTECARDS>1.3K>LIBRARY>NCOPENEVENTSCARD.;5)


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

(PRETTYCOMPRINT NCOPENEVENTSCARDCOMS)

(RPAQQ NCOPENEVENTSCARDCOMS ((* * NoteCards Library Pakage to implement the Open Events card type. 
				  Used to allow NF to specify events that should happen at open time.)
			       (FNS NCOpen.AddOpenEventsCardType NCOpen.CreateOpenEventsCard 
				    NCOpen.EvaluateOpenEventsCard NCOpen.OpenNoteFileFn)
			       (P (NCOpen.AddOpenEventsCardType)
				  (PUTPROP (QUOTE OpenEvents)
					   (QUOTE Don'tForceFilingFlg)
					   T))
			       (GLOBALVARS NC.OpenNoteFileFns)
			       (ADDVARS (NC.OpenNoteFileFns NCOpen.OpenNoteFileFn))))
(* * NoteCards Library Pakage to implement the Open Events card type. Used to allow NF to 
specify events that should happen at open time.)

(DEFINEQ

(NCOpen.AddOpenEventsCardType
  (LAMBDA NIL                                                (* rht: "19-Nov-86 15:03")

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



          (* * fgh 5/2/86 First created.)


    (NC.AddCardType (QUOTE OpenEvents)
		      (QUOTE Text)
		      (BQUOTE ((MakeFn , (FUNCTION NCOpen.CreateOpenEventsCard))))
		      (BQUOTE ((LinkAnchorModesSupported NIL)
				 (DisplayedInMenuFlg T))))))

(NCOpen.CreateOpenEventsCard
  (LAMBDA (Card Title NoDisplayFlg)                          (* rht: "19-Nov-86 14:52")

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



          (* * rht&pmi 11/19/86: Fixed up NCP functions.)


    (LET* ((NoteFile (fetch (Card NoteFile) of Card))
	   OpenEventCard ReturnValue)
          (if (NCP.ValidCardP (SETQ OpenEventCard (NCP.LookupCardByName (QUOTE OpenEvents)
										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")
							     NoDisplayFlg))
		   (NCP.CardTitle Card "Open Events")
		   (NCP.RegisterCardByName (QUOTE OpenEvents)
					     (if (WINDOWP ReturnValue)
						 then (NCP.CoerceToCard ReturnValue)
					       else ReturnValue))
		   ReturnValue))))

(NCOpen.EvaluateOpenEventsCard
  (LAMBDA (Card)                                             (* fgh: " 5-May-86 19:19")

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



          (* * fgh 5/2/86 First created.)


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

(NCOpen.OpenNoteFileFn
  (LAMBDA (FileName NoteFile When)                           (* fgh: " 5-May-86 18:50")

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



          (* * fgh 5/2/86 First created.)


    (SELECTQ When
	       (AFTER (LET (OpenEventsCard (RegistryCard (fetch (NoteFile RegistryCard)
							    of (if (type? NoteFile NoteFile)
								     then NoteFile
								   else (NC.NoteFileFromFileName
									    FileName)))))
		           (if (AND (NCP.ValidCard RegistryCard)
					(HARRAYP (NCP.CardSubstance RegistryCard)))
			       then (if (NCP.ValidCard (SETQ OpenEventsCard
							       (NC.LookupCardByName RegistryCard
										      (QUOTE 
										       OpenEvents))))
					  then (NCOpen.EvaluateOpenEventsCard OpenEventsCard)
					else               (* The open events card is registered but is not 
							     valid, unregister it.)
					       (if OpenEventsCard
						   then (NC.UnregisterName RegistryCard
									       (QUOTE OpenEvents))))
				 )))
	       NIL)))
)
(NCOpen.AddOpenEventsCardType)
(PUTPROP (QUOTE OpenEvents)
	 (QUOTE Don'tForceFilingFlg)
	 T)
(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS NC.OpenNoteFileFns)
)

(ADDTOVAR NC.OpenNoteFileFns NCOpen.OpenNoteFileFn)
(PUTPROPS NCOPENEVENTSCARD COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (1104 4486 (NCOpen.AddOpenEventsCardType 1114 . 1588) (NCOpen.CreateOpenEventsCard 1590
 . 2830) (NCOpen.EvaluateOpenEventsCard 2832 . 3320) (NCOpen.OpenNoteFileFn 3322 . 4484)))))
STOP