(FILECREATED " 8-Jan-85 16:28:45" {PHYLUM}<NOTECARDS>RELEASE1.1>NCCARDS.;7 71614  

      changes to:  (FNS NC.CheckSources)

      previous date: "10-Dec-84 12:20:57" {PHYLUM}<NOTECARDS>RELEASE1.1>NCCARDS.;6)


(* Copyright (c) 1984, 1985 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT NCCARDSCOMS)

(RPAQQ NCCARDSCOMS ((* * Internal variables)
	(GLOBALVARS NC.SubBoxMarkerLabel NC.FiledCardMarkerLabel NC.PlaceMarkerDisplayFont 
		    NC.OrphanID NC.RootID NC.UnclassifiedID NC.LinkLabelsID)
	(VARS (NC.OrphanID (QUOTE NC00002))
	      (NC.RootID (QUOTE NC00001))
	      (NC.UnclassifiedID (QUOTE NC00003))
	      (NC.LinkLabelsID (QUOTE NC00004))
	      (NC.TopLevelCards (QUOTE (NC00001 NC00002 NC00003)))
	      (NC.SubBoxMarkerLabel "File Boxes")
	      (NC.FiledCardMarkerLabel "Note Cards")
	      (NC.PlaceMarkerDisplayFont (FONTCREATE (QUOTE HELVETICA)
						     12
						     (QUOTE ITALIC))))
	(* * Manipulate Note Card Representations)
	(FNS NC.SetNewCardFlg NC.FetchNewCardFlg NC.CoerceToID NC.ActivateCard NC.ActiveCardP 
	     NC.DeactivateCard NC.FetchFromLinks NC.FetchGlobalLinks NC.FetchLinksDirtyFlg 
	     NC.FetchPropList NC.FetchRegion NC.FetchRegionViewed NC.FetchScale NC.FetchSubstance 
	     NC.FetchTitle NC.FetchToLinks NC.FetchType NC.FetchWindow NC.IDP NC.MarkCardDirty 
	     NC.CardDirtyP NC.SetFromLinks NC.SetGlobalLinks NC.SetInitialPropList 
	     NC.SetLinksDirtyFlg NC.SetPropList NC.SetRegion NC.SetRegionViewed NC.SetScale 
	     NC.SetSubstance NC.SetTitle NC.SetToLinks NC.SetType NC.FetchTitleDirtyFlg 
	     NC.SetTitleDirtyFlg NC.FetchPropListDirtyFlg NC.SetPropListDirtyFlg NC.ShrinkFn)
	(* * Retrieve Note Card Info)
	(FNS NC.RetrieveFromLinks NC.RetrieveLinkLabels NC.RetrievePropList NC.RetrieveTitle 
	     NC.RetrieveToLinks NC.RetrieveGlobalLinks NC.RetrieveType)
	(* * General note card manipulations)
	(FNS NC.AddParents NC.AssignSources NC.AssignTitle NC.DeleteNoteCards NC.EditNoteCard 
	     NC.MakeNoteCard NC.FileNoteCard NC.QuitCard NC.CheckContentsHooks NC.CheckSources 
	     NC.CheckTitle NC.DeleteSource NC.DetermineContentsCards NC.DetermineSources 
	     NC.InsureProperFiling NC.QuitWithoutSaving NC.UnfileNoteCard NC.UpdateUpdateList 
	     NC.CollectReferences)
	(* * Prop List Editor)
	(RECORDS PropListItem)
	(FNS NC.AddPropToPropList NC.CloseAllPropListEditors NC.ClosePropListEditor 
	     NC.DelPropFromList NC.EditPropButtonFN NC.EditProperties NC.EditPropList 
	     NC.ExtractPropList NC.OpenPropListEditor NC.ProcessEditedPropList NC.PropListEditorOpenP 
	     NC.SelectProperty NC.ShowPointers NC.StringIsListP)
	(* * Unknown ?????????)
	(FNS NC.FetchBeingDeletedFlg NC.SetBeingDeletedFlg)
	(* * Place marker ImageObjects)
	(FNS NC.PlaceMarkerCopyFn NC.PlaceMarkerDisplayFn NC.PlaceMarkerGetFn 
	     NC.PlaceMarkerImageBoxFn NC.PlaceMarkerPutFn NC.MakePlaceMarker)))
(* * Internal variables)

(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS NC.SubBoxMarkerLabel NC.FiledCardMarkerLabel NC.PlaceMarkerDisplayFont NC.OrphanID 
	    NC.RootID NC.UnclassifiedID NC.LinkLabelsID)
)

(RPAQQ NC.OrphanID NC00002)

(RPAQQ NC.RootID NC00001)

(RPAQQ NC.UnclassifiedID NC00003)

(RPAQQ NC.LinkLabelsID NC00004)

(RPAQQ NC.TopLevelCards (NC00001 NC00002 NC00003))

(RPAQ NC.SubBoxMarkerLabel "File Boxes")

(RPAQ NC.FiledCardMarkerLabel "Note Cards")

(RPAQ NC.PlaceMarkerDisplayFont (FONTCREATE (QUOTE HELVETICA)
					    12
					    (QUOTE ITALIC)))
(* * Manipulate Note Card Representations)

(DEFINEQ

(NC.SetNewCardFlg
  (LAMBDA (ID Value)                                         (* NoteCards% User " 6-Jun-84 17:29")
                                                             (* Set the new card flg of ID to Value)
    (PUTPROP ID (QUOTE NoteCardNewCard)
	     Value)))

(NC.FetchNewCardFlg
  (LAMBDA (ID)                                               (* NoteCards% User " 6-Jun-84 17:30")
                                                             (* Return the value of the new card flg of ID)
    (GETPROP ID (QUOTE NoteCardNewCard))))

(NC.CoerceToID
  (LAMBDA (WindowOrTextStreamOrID)                           (* fgh: "19-Oct-84 14:32")

          (* * Get the ID of WindowOrTextStreamOrID)


    (PROG (Window)
          (RETURN (COND
		    ((NC.IDP WindowOrTextStreamOrID)
		      WindowOrTextStreamOrID)
		    ((WINDOWP WindowOrTextStreamOrID)
		      (NC.IDFromWindow WindowOrTextStreamOrID))
		    ((TEXTSTREAMP WindowOrTextStreamOrID)
		      (AND (SETQ Window (fetch (TEXTOBJ \WINDOW) of (TEXTOBJ WindowOrTextStreamOrID)))
			   (NC.IDFromWindow Window)))
		    (T (NC.ReportError "NC.CoerceToID " (CONCAT 
							 "Arg not Window or TextStream or ID:   "
								WindowOrTextStreamOrID))))))))

(NC.ActivateCard
  (LAMBDA (ID)                                               (* fgh: "15-Feb-84 00:33")
    (PUTPROP ID (QUOTE NoteCardActive)
	     T)))

(NC.ActiveCardP
  (LAMBDA (ID)                                               (* fgh: "15-Feb-84 00:35")
    (AND (GETPROP ID (QUOTE NoteCardActive))
	 (GETPROP ID (QUOTE NoteCardType)))))

(NC.DeactivateCard
  (LAMBDA (ID DeleteTypeAndTitleFlg)                         (* fgh: "23-Oct-84 16:41")

          (* * Remove all the information from the prop list of the NoteCard ID, except for the title which usually statys 
	  cached.)


    (PROG NIL
          (REMPROP ID (QUOTE NoteCardRegion))
          (REMPROP ID (QUOTE NoteCardActive))
          (REMPROP ID (QUOTE NoteCardFromLinks))
          (REMPROP ID (QUOTE NoteCardToLinks))
          (REMPROP ID (QUOTE NoteCardPropList))
          (REMPROP ID (QUOTE NoteCardGlobalLinks))
          (REMPROP ID (QUOTE NoteCardLinksDirty))
          (REMPROP ID (QUOTE SKETCH))
          (REMPROP ID (QUOTE NoteCardSketchScale))
          (REMPROP ID (QUOTE NoteCardRegionViewed))
          (REMPROP ID (QUOTE NoteCardNewCard))
          (REMPROP ID (QUOTE NoteCardTitleDirty))
          (REMPROP ID (QUOTE NoteCardPropListDirty))
          (REMPROP ID (QUOTE VALUE))
          (COND
	    (DeleteTypeAndTitleFlg (REMPROP ID (QUOTE NoteCardTitle))
				   (REMPROP ID (QUOTE NoteCardType))))
          (SET ID))))

(NC.FetchFromLinks
  (LAMBDA (ID)                                               (* fgh: "16-Feb-84 00:14")
    (GETPROP ID (QUOTE NoteCardFromLinks))))

(NC.FetchGlobalLinks
  (LAMBDA (ID)                                               (* fgh: "23-Apr-84 19:45")
    (GETPROP ID (QUOTE NoteCardGlobalLinks))))

(NC.FetchLinksDirtyFlg
  (LAMBDA (ID)                                               (* fgh: "23-Apr-84 19:59")
    (GETPROP ID (QUOTE NoteCardLinksDirty))))

(NC.FetchPropList
  (LAMBDA (ID)                                               (* fgh: "15-Feb-84 23:57")
    (GETPROP ID (QUOTE NoteCardPropList))))

(NC.FetchRegion
  (LAMBDA (ID)                                               (* fgh: "15-Feb-84 18:19")
    (GETPROP ID (QUOTE NoteCardRegion))))

(NC.FetchRegionViewed
  (LAMBDA (ID)                                               (* fgh: "28-Apr-84 19:45")
    (GETPROP ID (QUOTE NoteCardRegionViewed))))

(NC.FetchScale
  (LAMBDA (ID)                                               (* fgh: "28-Apr-84 19:46")
    (GETPROP ID (QUOTE NoteCardSketchScale))))

(NC.FetchSubstance
  (LAMBDA (ID)                                               (* fgh: "10-Oct-84 21:57")

          (* * Return the substance of card ID)


    (EVAL ID)))

(NC.FetchTitle
  (LAMBDA (ID)                                               (* fgh: "14-Feb-84 21:55")
    (GETPROP ID (QUOTE NoteCardTitle))))

(NC.FetchToLinks
  (LAMBDA (ID)                                               (* fgh: "16-Feb-84 00:14")
    (GETPROP ID (QUOTE NoteCardToLinks))))

(NC.FetchType
  (LAMBDA (ID)                                               (* fgh: "13-Feb-84 21:13")
    (GETPROP ID (QUOTE NoteCardType))))

(NC.FetchWindow
  (LAMBDA (ID)                                               (* rht: " 7-Nov-84 20:55")

          (* * Given an ID of a card, return the open window containing that card.)


    (PROG ((NoteCardType (NC.FetchType ID)))
          (RETURN (COND
		    ((NC.ActiveCardP ID)
		      (for Window in (OPENWINDOWS) when (OR (EQ ID (WINDOWPROP Window (QUOTE 
										       NoteCardID)))
							    (EQ ID (WINDOWPROP (WINDOWPROP
										 Window
										 (QUOTE ICONFOR))
									       (QUOTE NoteCardID))))
			 do (RETURN (COND
				      ((EQ ID (WINDOWPROP Window (QUOTE NoteCardID)))
					Window)
				      (T (WINDOWPROP Window (QUOTE ICONFOR)))))))
		    (T NIL))))))

(NC.IDP
  (LAMBDA (ID)                                               (* fgh: "13-Feb-84 21:11")
    (AND (EQ (NCHARS ID)
	     7)
	 (EQ (SUBATOM ID 1 2)
	     (QUOTE NC))
	 (FIXP (SUBATOM ID 3))
	 (ILESSP (SUBATOM ID 3)
		 NC.IndexSizeInEntries))))

(NC.MarkCardDirty
  (LAMBDA (ID ResetFlg)                                      (* fgh: "22-Oct-84 12:42")
                                                             (* Mark card specified by ID as being DIRTY and needing
							     to be writtent to the database)
    (APPLY* (NC.MarkCardDirtyFn (NC.FetchType ID))
	    ID ResetFlg)))

(NC.CardDirtyP
  (LAMBDA (ID)                                               (* fgh: "23-Oct-84 12:33")

          (* * Return T if card ID has been changed.)


    (APPLY* (NC.SubstanceDirtyPFn (NC.FetchType ID))
	    ID)))

(NC.SetFromLinks
  (LAMBDA (ID Links)                                         (* fgh: "16-Feb-84 00:13")
    (PUTPROP ID (QUOTE NoteCardFromLinks)
	     Links)))

(NC.SetGlobalLinks
  (LAMBDA (ID GlobalLinks)                                   (* fgh: "23-Apr-84 19:44")
    (PUTPROP ID (QUOTE NoteCardGlobalLinks)
	     GlobalLinks)))

(NC.SetInitialPropList
  (LAMBDA (ID DatabaseStream)                                (* fgh: "27-Mar-84 00:45")
    (NC.SetPropList ID (NCONC (LIST (QUOTE Sources)
				    NIL)
			      (NC.FetchPropList ID)))))

(NC.SetLinksDirtyFlg
  (LAMBDA (ID Value)                                         (* fgh: "23-Apr-84 19:52")
    (PUTPROP ID (QUOTE NoteCardLinksDirty)
	     Value)))

(NC.SetPropList
  (LAMBDA (ID PropList)                                      (* fgh: "16-Feb-84 00:02")
    (PUTPROP ID (QUOTE NoteCardPropList)
	     PropList)))

(NC.SetRegion
  (LAMBDA (ID Region)                                        (* fgh: "15-Feb-84 18:19")
    (PUTPROP ID (QUOTE NoteCardRegion)
	     Region)))

(NC.SetRegionViewed
  (LAMBDA (ID RegionValue)                                   (* fgh: "28-Apr-84 19:44")
    (PUTPROP ID (QUOTE NoteCardRegionViewed)
	     RegionValue)))

(NC.SetScale
  (LAMBDA (ID ScaleValue)                                    (* fgh: "28-Apr-84 19:46")
    (PUTPROP ID (QUOTE NoteCardSketchScale)
	     ScaleValue)))

(NC.SetSubstance
  (LAMBDA (ID Substance)                                     (* fgh: "10-Oct-84 22:03")

          (* * Set the substance of card ID to be substance)


    (SET ID Substance)))

(NC.SetTitle
  (LAMBDA (ID Title)                                         (* fgh: "14-Feb-84 21:54")
    (PUTPROP ID (QUOTE NoteCardTitle)
	     Title)))

(NC.SetToLinks
  (LAMBDA (ID Links)                                         (* fgh: "16-Feb-84 00:14")
    (PUTPROP ID (QUOTE NoteCardToLinks)
	     Links)))

(NC.SetType
  (LAMBDA (ID NoteCardType)                                  (* fgh: " 2-Mar-84 23:05")
    (PUTPROP ID (QUOTE NoteCardType)
	     NoteCardType)))

(NC.FetchTitleDirtyFlg
  (LAMBDA (ID)                                               (* fgh: " 5-Oct-84 22:18")
    (GETPROP ID (QUOTE NoteCardTitleDirty))))

(NC.SetTitleDirtyFlg
  (LAMBDA (ID Value)                                         (* fgh: " 5-Oct-84 22:20")
    (PUTPROP ID (QUOTE NoteCardTitleDirty)
	     Value)))

(NC.FetchPropListDirtyFlg
  (LAMBDA (ID)                                               (* fgh: " 5-Oct-84 22:19")
    (GETPROP ID (QUOTE NoteCardPropListDirty))))

(NC.SetPropListDirtyFlg
  (LAMBDA (ID Value)                                         (* fgh: " 5-Oct-84 22:21")
    (PUTPROP ID (QUOTE NoteCardPropListDirty)
	     Value)))

(NC.ShrinkFn
  (LAMBDA NIL                                                (* NoteCards% User " 8-Jun-84 17:53")
                                                             (* SHRINKFN for all NoteCards and FileBoxes.
							     For now just the default title icon.)
    NIL))
)
(* * Retrieve Note Card Info)

(DEFINEQ

(NC.RetrieveFromLinks
  (LAMBDA (ID DatabaseStream)                                (* fgh: "11-Apr-84 22:16")
                                                             (* Get or Fetch the from links for the card ID)
    (COND
      ((NC.ActiveCardP ID)
	(NC.FetchFromLinks ID))
      (T (WITH.MONITOR (NC.FetchMonitor DatabaseStream)
		       (NC.GetLinks ID DatabaseStream)
		       (PROG1 (NC.FetchFromLinks ID)
			      (NC.DeactivateCard ID)))))))

(NC.RetrieveLinkLabels
  (LAMBDA (DatabaseStream SystemLinksFlg)                    (* NoteCards% User "21-Jun-84 19:57")
                                                             (* Retrieve the list of link labels used in database 
							     specified by DatabaseStream.
							     Include system maintained links only when specified by 
							     SystemLinksFlg)
    (UNION (AND SystemLinksFlg NC.SystemLinkLabels)
	   (for Label in (NC.GetLinkLabels DatabaseStream) when (OR SystemLinksFlg
								    (NULL (NC.SystemLinkLabelP Label))
								    )
	      collect Label))))

(NC.RetrievePropList
  (LAMBDA (ID DatabaseStream)                                (* fgh: "22-Mar-84 12:48")
                                                             (* Fetch or get the prop list for the note card 
							     specified by ID)
    (COND
      ((NC.ActiveCardP ID)
	(NC.FetchPropList ID))
      (T (NC.GetPropList ID DatabaseStream)))))

(NC.RetrieveTitle
  (LAMBDA (ID DatabaseStream)                                (* fgh: " 9-Apr-84 19:37")
                                                             (* If note card specified by ID is active then fetch 
							     its title. Otherwise activate the card, fetch title and
							     then deactivate the card.)
    (OR (NC.FetchTitle ID)
	(NC.SetTitle ID (NC.GetTitle ID DatabaseStream)))))

(NC.RetrieveToLinks
  (LAMBDA (ID DatabaseStream)                                (* fgh: "11-Apr-84 22:26")
                                                             (* Get or Fetch the from links for the card ID)
    (COND
      ((NC.ActiveCardP ID)
	(NC.FetchToLinks ID))
      (T (WITH.MONITOR (NC.FetchMonitor DatabaseStream)
		       (NC.GetLinks ID DatabaseStream)
		       (PROG1 (NC.FetchToLinks ID)
			      (NC.DeactivateCard ID)))))))

(NC.RetrieveGlobalLinks
  (LAMBDA (ID DatabaseStream)                                (* fgh: " 2-Oct-84 17:21")

          (* * Fetch or get the global links of ID)


    (COND
      ((NC.ActiveCardP ID)
	(NC.FetchGlobalLinks ID))
      (T (NC.GetLinks ID DatabaseStream)
	 (PROG1 (NC.FetchGlobalLinks ID)
		(NC.DeactivateCard ID))))))

(NC.RetrieveType
  (LAMBDA (ID DatabaseStream)                                (* fgh: " 2-Oct-84 17:49")
                                                             (* Get or Fetch NoteCardType of ID)
    (COND
      ((NC.FetchType ID))
      (T (NC.GetType ID DatabaseStream)))))
)
(* * General note card manipulations)

(DEFINEQ

(NC.AddParents
  (LAMBDA (WindowOrTextStream)                               (* rht: " 8-Dec-84 16:59")

          (* Add a subtopic link from a contents card specified by the user to the contents card specified by 
	  WindowOrTextStream. But first check to make sure that this would not introduce any circularities in the contents 
	  lattice.)



          (* * rht 12/8/84: Massive shaving. Now calls NC.MakeChildLink to do the tough work.)


    (PROG (ID NewParents (Window (WINDOW.FROM.TEDIT.THING WindowOrTextStream)))
          (SETQ ID (NC.IDFromWindow Window))
          (NC.PrintMsg Window T " Please select the new parent FileBox(es)." (CHARACTER 13))
          (SETQ NewParents (NC.SelectNoteCards NIL (FUNCTION NC.ContentsCardP)
					       NC.SelectingParentsMenu ID))
          (if (NULL (AND NewParents ID (for ParentID in NewParents bind OneHook
					  when (NC.MakeChildLink ID ParentID Window)
					  do (SETQ OneHook T) finally (RETURN OneHook))))
	      then (NC.PrintMsg Window NIL "No appropriate FileBoxes chosen." (CHARACTER 13)
				"Hence no parents added."
				(CHARACTER 13)))
          (AND (GETPROMPTWINDOW Window NIL NIL T)
	       (PROG1 (DISMISS 5000)
		      (NC.ClearMsg Window T))))))

(NC.AssignSources
  (LAMBDA (WindowOrTextStream)                               (* fgh: "25-May-84 19:41")
                                                             (* Called from title bar menus.
							     Assign a new source link to this card.
							     Destination to be specified by the user.)
    (PROG (ID (Window (WINDOW.FROM.TEDIT.THING WindowOrTextStream)))
          (SETQ ID (NC.IDFromWindow Window))
          (SETQ Sources (NC.DetermineSources PSA.Database NIL ID))
          (for Source in Sources do (NC.AddSourceLink ID Source PSA.Database))
          (NC.SetLinksDirtyFlg ID T)
          (NC.ClearMsg Window T))))

(NC.AssignTitle
  (LAMBDA (WindowOrTextStreamOrID NoClearMsgFlg NewTitle)    (* rht: "16-Oct-84 15:03")

          (* * Change the title of the card specified by the WindowOrTextStreamOrID)


    (PROG (ID ContainingCardID Window)
          (COND
	    ((WINDOWP WindowOrTextStreamOrID)
	      (SETQ Window WindowOrTextStreamOrID)
	      (SETQ ID (NC.IDFromWindow Window)))
	    ((TEXTSTREAMP WindowOrTextStreamOrID)
	      (SETQ Window (WINDOW.FROM.TEDIT.THING WindowOrTextStreamOrID))
	      (SETQ ID (NC.IDFromWindow Window)))
	    ((NC.IDP WindowOrTextStreamOrID)
	      (SETQ ID WindowOrTextStreamOrID)
	      (SETQ Window (NC.FetchWindow ID))))
          (SETQ NewTitle (OR (STRINGP NewTitle)
			     (AND NewTitle (OR (LITATOM NewTitle)
					       (NUMBERP NewTitle))
				  (MKSTRING NewTitle))
			     (NC.AskUser (CONCAT "Enter the title for this card" (CHARACTER 13))
					 "-->  " NIL (NULL NoClearMsgFlg)
					 Window)))
          (AND (NULL NewTitle)
	       (RETURN))
          (NC.SetTitle ID NewTitle)
          (NC.PutTitle ID PSA.Database)
          (AND (WINDOWP Window)
	       (WINDOWPROP Window (QUOTE TITLE)
			   NewTitle))
          (for FromLink in (NC.RetrieveFromLinks ID PSA.Database)
	     do (AND (NC.ActiveCardP (SETQ ContainingCardID (fetch (NOTECARDLINK SOURCEID)
							       of FromLink)))
		     (WINDOWP (NC.FetchWindow ContainingCardID))
		     (NC.UpdateLinkImages ContainingCardID ID))))))

(NC.DeleteNoteCards
  (LAMBDA (CardTextStreamWindowOrID NoCheckFlg DontClearFlg)
                                                             (* rht: " 3-Dec-84 10:52")
                                                             (* Delete note cards. If no card specified then get a 
							     list of note cards to be deleted.
							     Then delete these cards.)
    (PROG (Cards)
          (SETQ Cards (COND
	      ((NULL CardTextStreamWindowOrID)
		(NC.PrintMsg NIL T "Please select the Note Cards to be deleted." (CHARACTER 13))
		(NC.SelectNoteCards NIL NIL NC.DeleteSelectingMenu))
	      (T CardTextStreamWindowOrID)))
          (for Card in (MKLIST Cards)
	     do (SETQ ID (NC.CoerceToID Card))
		(COND
		  ((NULL ID))
		  ((FMEMB ID NC.TopLevelCards)
		    (NC.PrintMsg (NC.FetchWindow ID)
				 T "You cannot delete this FileBox." (CHARACTER 13))
		    (DISMISS 1000)
		    (NC.ClearMsg (NC.FetchWindow ID)
				 T))
		  (T (AND (OR NoCheckFlg (PROG1 (FMEMB (MKATOM (NC.AskUser 
							  "Are you sure you want to delete this?"
									   " -- " "Yes" (NULL 
										     DontClearFlg)
									   (NC.FetchWindow ID)))
						       (QUOTE (Y y Yes YES)))
						(NC.ClearMsg)))
			  (RESETLST (RESETSAVE (CURSOR WAITINGCURSOR))
				    (WITH.MONITOR (NC.FetchMonitor PSA.Database)
						  (NC.SetBeingDeletedFlg ID T)
						  (PROG (ToLinks FromLinks Window)
						        (if (NC.ActiveCardP ID)
							    then (SETQ Window (NC.FetchWindow ID))
								 (AND Window (NC.GreyCard ID))
								 (NC.CloseAllPropListEditors ID)
								 (NC.QuitCard ID T))
						        (NC.GetLinks ID PSA.Database)
						        (SETQ ToLinks (NC.FetchToLinks ID))
						        (SETQ FromLinks (NC.FetchFromLinks ID))
						        (NC.SetToLinks ID NIL)
						        (NC.SetFromLinks ID NIL)
						        (for ToLink in ToLinks
							   do (NC.DelFromLink ToLink PSA.Database))
						        (for FromLink in FromLinks
							   do (NC.DelToLink FromLink PSA.Database)
							      (NC.DelReferencesToCard
								(fetch (NOTECARDLINK SOURCEID)
								   of FromLink)
								ID PSA.Database)))
						  (NC.MarkCardDeleted ID PSA.Database)
						  (NC.DeactivateCard ID T)
						  (NC.SetBeingDeletedFlg ID NIL))))))))))

(NC.EditNoteCard
  (LAMBDA (ID Region/Position)                               (* fgh: "12-Nov-84 18:31")

          (* * Bring the already created NoteCard specified by ID onto the screen at Region or Position specified by 
	  Region/Position)


    (RESETLST (RESETSAVE (CURSOR WAITINGCURSOR))
	      (PROG (Substance NoteCardType Window)
		    (COND
		      ((NC.ActiveCardP ID)
			(SETQ Substance (NC.FetchSubstance ID)))
		      (T (SETQ Substance (NC.FetchSubstance (NC.GetNoteCard ID PSA.Database)))))
		    (SETQ NoteCardType (NC.FetchType ID))
		    (OR (WINDOWP (SETQ Window (APPLY* (NC.EditFn NoteCardType)
						      ID Substance Region/Position)))
			(RETURN Window))
		    (WINDOWADDPROP Window (QUOTE CLOSEFN)
				   (FUNCTION NC.QuitCard)
				   (QUOTE FIRST))
		    (WINDOWPROP Window (QUOTE NoteCardID)
				ID)
		    (RETURN Window)))))

(NC.MakeNoteCard
  (LAMBDA (NoteCardType Title NoDisplayFlg TypeSpecificArgs ID)
                                                             (* rht: " 6-Dec-84 14:32")
                                                             (* Make a new note card of type NoteCardType.
							     If type note specified, ask the user.)
    (PROG (ReturnValue CopyID Window)
          (AND (SETQ NoteCardType (OR NoteCardType (NC.AskNoteCardType)))
	       (RESETLST (RESETSAVE (CURSOR WAITINGCURSOR))
			 (OR (NC.IDP ID)
			     (SETQ ID (NC.GetNewID PSA.Database)))
			 (NC.SetNewCardFlg ID T)
			 (NC.ActivateCard ID)
			 (OR (NC.FetchType ID)
			     (NC.SetType ID NoteCardType))
			 (COND
			   ((OR (ERSETQ (SETQ ReturnValue (APPLY* (NC.MakeCardFn NoteCardType)
								  ID Title NoDisplayFlg 
								  TypeSpecificArgs)))
				(SETPROPLIST ID NIL))
			     (SETQ Window (WINDOWP ReturnValue))
			     (COND
			       ((NULL (NC.FetchTitle ID))
				 (SETQ Title (NC.SetTitle ID (SETQ Title
							    (COND
							      ((STRINGP Title)
								Title)
							      ((AND Title (OR (LITATOM Title)
									      (NUMBERP Title)))
								(MKSTRING Title))
							      (T "Untitled")))))
				 (AND Window (WINDOWPROP Window (QUOTE TITLE)
							 Title)))
			       (T (NC.SetTitle ID (MKSTRING (NC.FetchTitle ID)))))
			     (COND
			       (Window (WINDOWADDPROP Window (QUOTE CLOSEFN)
						      (FUNCTION NC.QuitCard)
						      (QUOTE FIRST))
				       (WINDOWPROP Window (QUOTE NoteCardID)
						   ID)))
			     (NC.SetTitleDirtyFlg ID T)      (* Reset the type in case of recursive calls change the
							     type. Always want the highest level type in a recursive
							     descent)
			     (NC.SetType ID NoteCardType)    (* Insure that a link ptr is set up during the first 
							     save)
			     (NC.SetLinksDirtyFlg ID T)
			     (NC.SetPropListDirtyFlg ID T)))))
          (RETURN ReturnValue))))

(NC.FileNoteCard
  (LAMBDA (WindowOrTextStream)                               (* fgh: "26-Mar-84 23:43")
                                                             (* Called from title bar menus -
							     adds card containing TextStream to a Contents Card or 
							     Cards)
    (PROG ((ID (NC.IDFromWindow (WINDOW.FROM.TEDIT.THING WindowOrTextStream))))
          (NC.CheckTitle ID PSA.Database)
          (NC.MakeContentsHooks ID PSA.Database T))))

(NC.QuitCard
  (LAMBDA (WindowOrTextStreamOrID CallCloseWFlg)             (* rht: " 3-Dec-84 10:59")

          (* * Force note card specified by ID to quit or stop)


    (PROG (Window (ID (NC.CoerceToID WindowOrTextStreamOrID)))
          (SETQ Window (NC.FetchWindow ID))
          (AND Window (WINDOWDELPROP Window (QUOTE CLOSEFN)
				     (FUNCTION NC.QuitCard)))
          (RETURN (PROG1 (APPLY* (NC.QuitCardFn (NC.FetchType ID))
				 ID)
			 (AND CallCloseWFlg Window (CLOSEW Window)))))))

(NC.CheckContentsHooks
  (LAMBDA (ID DatabaseStream)                                (* rht: " 9-Dec-84 18:48")
                                                             (* Check to make sure this card has a contents hook of 
							     some sort. If not, hook it up to a contents card.)

          (* * rht 12/8/84: Now checks whether both cards *and* fileboxes have been filed.)



          (* * rht 12/9/84: Now files in orphan filebox if NC.ForceFiling flag is off, without bothering the user.)


    (COND
      ((AND (NOT (FMEMB ID NC.TopLevelCards))
	    (for Link in (NC.FetchFromLinks ID) never (FMEMB (fetch (NOTECARDLINK LINKLABEL)
								of Link)
							     (QUOTE (FiledCard SubBox)))))
	(if NC.ForceFilingFlg
	    then (NC.PrintMsg (NC.FetchWindow ID)
			      T "This card is not currently filed in a FileBox." (CHARACTER 13))
		 (NC.MakeContentsHooks ID DatabaseStream)
	  else (NC.PrintMsg (NC.FetchWindow ID)
			    T "This card is not currently filed in a FileBox." (CHARACTER 13)
			    "It is being filed in the Orphan FileBox.")
	       (NC.HookToOrphanCard ID NC.OrphanID DatabaseStream))))))

(NC.CheckSources
  (LAMBDA (ID DatabaseStream)                                (* fgh: " 8-Jan-85 16:25")

          (* Called when quitting a note card. Check to make sure that the sources are appropriately set for this note card.
	  If not, get the source information from the default setting or from the user.)


    (PROG (Sources)
          (SETQ Sources (for Link in (NC.FetchGlobalLinks ID) when (EQ NC.SourceLinkLabel
								       (fetch (NOTECARDLINK LINKLABEL)
									  of Link))
			   collect Link))
          (COND
	    ((NOT (NC.ContentsCardP ID))
	      (NC.PrintMsg (NC.FetchWindow ID)
			   T "This card has no designated sources." (CHARACTER 13))
	      (SETQ Sources (NC.DetermineSources DatabaseStream T ID))
	      (for Source in Sources do (NC.AddSourceLink ID Source DatabaseStream))
	      (NC.SetLinksDirtyFlg ID T))))))

(NC.CheckTitle
  (LAMBDA (ID DatabaseStream)                                (* rht: " 6-Dec-84 19:01")
                                                             (* If card specified by ID has no title, ask the user 
							     for a title.)

          (* * rht 11/19/84: Now checks NC.ForceTitlesFlg before griping.)



          (* * rht 12/6/84: Now sends ID rather than Window to NC.AssignTitle.)


    (PROG (Title (Window (NC.FetchWindow ID)))
          (COND
	    ((AND NC.ForceTitlesFlg (OR (NULL (NC.FetchTitle ID))
					(EQUAL "Untitled" (NC.FetchTitle ID))))
	      (NC.PrintMsg Window T "This note card has no title." (CHARACTER 13))
	      (NC.AssignTitle ID T))
	    ((AND (NULL NC.ForceTitlesFlg)
		  (NULL (NC.FetchTitle ID)))
	      (NC.AssignTitle ID NIL "Untitled"))))))

(NC.DeleteSource
  (LAMBDA (WindowOrTextStream)                               (* fgh: " 5-Oct-84 12:18")
                                                             (* Called from title bar menus.
							     Deletes source/s/ for the card specified by 
							     WindowOrTextStream)
    (PROG ((Window (WINDOW.FROM.TEDIT.THING WindowOrTextStream))
	   ID Sources EditWindow)
          (SETQ ID (NC.IDFromWindow Window))
          (SETQ Sources (for Link in (NC.FetchGlobalLinks ID)
			   when (AND (EQ NC.SourceLinkLabel (fetch (NOTECARDLINK LINKLABEL)
							       of Link))
				     (NEQ (fetch (NOTECARDLINK DESTINATIONID) of Link)
					  (QUOTE NC00000)))
			   collect Link))
          (COND
	    ((NULL Sources)
	      (NC.PrintMsg Window T "This card has no sources." (CHARACTER 13))
	      (SPAWN.MOUSE)
	      (DISMISS 2000)
	      (NC.ClearMsg Window T))
	    (T (SETQ EditWindow (NC.OpenPropListEditor Window (LIST (QUOTE Source% TO)
								    Sources)
						       "Sources" T T))
	       (until (WINDOWPROP EditWindow (QUOTE TEXTOBJ)) do (BLOCK))
	       (NC.PrintMsg Window T "Select source(s) to be deleted." (CHARACTER 13))
	       (SETQ Sources (NC.SelectNoteCards NIL NIL NC.DeleteSelectingMenu ID))
	       (NC.ClearMsg Window T)
	       (NC.ClosePropListEditor EditWindow (QUOTE NoSave))
	       (for ToBeDeletedLink in (NC.FetchGlobalLinks ID)
		  when (AND (EQ NC.SourceLinkLabel (fetch (NOTECARDLINK LINKLABEL) of ToBeDeletedLink)
				)
			    (FMEMB (fetch (NOTECARDLINK DESTINATIONID) of ToBeDeletedLink)
				   Sources))
		  do (NC.DelToLink ToBeDeletedLink PSA.Database)
		     (NC.DelFromLink ToBeDeletedLink PSA.Database))
	       (NC.SetGlobalLinks ID (for Link in (NC.FetchGlobalLinks ID)
					when (NOT (FMEMB (fetch (NOTECARDLINK DESTINATIONID)
							    of Link)
							 Sources))
					collect Link)))))))

(NC.DetermineContentsCards
  (LAMBDA (DatabaseStream OptionalFilingFlg ID)              (* rht: " 7-Dec-84 20:53")

          (* Returns a list of contents cards for filing a card. The rule used for the choice is: First ask the user.
	  If the user returns NIL, then use the Orphan Note Card)



          (* * rht 8/1/84: Changed so that user can't file a card twice in the same box.)


    (PROG ((ParentIDs (for Link in (NC.FetchFromLinks ID) when (EQ (fetch (NOTECARDLINK LINKLABEL)
								      of Link)
								   NC.FiledCardLinkLabel)
			 collect (fetch (NOTECARDLINK SOURCEID) of Link)))
	   (Window (NC.FetchWindow ID)))
          (RETURN (COND
		    ((PROGN (NC.PrintMsg Window NIL "Please select the Boxes to file this card in."
					 (CHARACTER 13)
					 (COND
					   (ParentIDs "")
					   (T (CONCAT "NoBox files it in the ToBeFiled box."
						      (CHARACTER 13)))))
			    (SETQ NewParents (NC.SelectNoteCards NIL NIL (COND
								   (ParentIDs NC.SelectingParentsMenu)
								   (T NC.SelectingContentsMenu))
								 ID))
			    (for NewParentID in NewParents unless (AND (FMEMB NewParentID ParentIDs)
								       (NC.PrintMsg Window T
										    (NC.FetchTitle
										      ID)
										    
									     " already filed in "
										    (NC.FetchTitle
										      NewParentID)
										    (CHARACTER 13)))
			       collect NewParentID)))
		    ((AND (NOT OptionalFilingFlg)
			  (NOT ParentIDs))
		      (NC.PrintMsg Window T "No Box has been specified." (CHARACTER 13)
				   "Filing this card in the ToBeFiled Box."
				   (CHARACTER 13))
		      (LIST NC.UnclassifiedID)))))))

(NC.DetermineSources
  (LAMBDA (DatabaseStream NoSourceOptionFlg ID)              (* fgh: "13-Aug-84 23:42")

          (* Returns a list of source cards according to the following rule: Ask the user. If the user returns no source 
	  cards, use all open source cards on the screen. Otherwise, return NIL)


    (PROG (Selections (Window (NC.FetchWindow ID)))
          (NC.PrintMsg Window NIL "Select source(s) for this card." (CHARACTER 13)
		       "NoSource" " to indicate no source." (CHARACTER 13))
          (SETQ Selections (NC.SelectNoteCards NIL NIL NC.SelectingSourcesMenu ID))
          (NC.ClearMsg Window)
          (AND (IGREATERP (LENGTH Selections)
			  1)
	       (DREMOVE (QUOTE NC00000)
			Selections))
          (RETURN Selections))))

(NC.InsureProperFiling
  (LAMBDA (ID DatabaseStream)                                (* rht: " 9-Dec-84 18:40")
                                                             (* Called when any type of note card is being quitted 
							     from, i.e., closed)

          (* * rht 12/9/84: Moved check of the NC.ForceFiling flag into NC.CheckContentsHooks.)


    (COND
      ((NULL (NC.FetchBeingDeletedFlg ID))
	(NC.CheckTitle ID DatabaseStream)
	(AND NC.ForceSourcesFlg (NC.CheckSources ID DatabaseStream))
	(NC.CheckContentsHooks ID DatabaseStream)))))

(NC.QuitWithoutSaving
  (LAMBDA (WindowOrTextStream DatabaseStream)                (* fgh: " 5-Oct-84 12:07")

          (* Quit from a note card without saving its contents on the database. But must make sure that any updates that would
	  have been done to this card even if it had been on the database are carried out on the old image currently on the 
	  database)


    (PROG ((Window (WINDOW.FROM.TEDIT.THING WindowOrTextStream))
	   ID FromLinks ToLinks DeletedLinks Process TextObj)
          (OR (STREAMP DatabaseStream)
	      (SETQ DatabaseStream PSA.Database))
          (SETQ ID (NC.IDFromWindow Window))
          (SETQ FromLinks (NC.FetchFromLinks ID))
          (SETQ ToLinks (NC.FetchToLinks ID))
          (COND
	    ((FMEMB (MKATOM (NC.AskUser "Are you sure you want to flush your changes?" " -- " "Yes" T 
					Window))
		    (QUOTE (Y y Yes YES)))
	      (COND
		((NC.IDP (NC.GetNoteCard ID DatabaseStream))
                                                             (* Want to keep current from links in case they were 
							     updated while this card was up)
		  (NC.SetFromLinks ID FromLinks)             (* Delete the back links from all links that are not in
							     the old to link set.)
		  (bind (OldLinks ←(NC.FetchToLinks ID)) for Link in ToLinks
		     when (NOT (FMEMB Link OldLinks)) do (NC.DelFromLink Link DatabaseStream T))
                                                             (* Check to make sure none of the old To links point to
							     a deleted card. If so, replace with a deleted marker.)
		  (SETQ ToLinks (NC.FetchToLinks ID))
		  (SETQ DeletedLinks (bind DestinationID for Link in ToLinks
					when (PROGN (SETQ DestinationID (fetch (NOTECARDLINK 
										    DESTINATIONID)
									   of Link))
						    (AND (NOT (NC.ActiveCardP DestinationID))
							 (EQ (QUOTE DELETED)
							     (NC.GetType DestinationID DatabaseStream)
							     )))
					collect (NC.DelReferencesToCard ID DestinationID 
									DatabaseStream)
						DestinationID))
		  (NC.SetToLinks ID (LDIFFERENCE ToLinks DeletedLinks))
                                                             (* Put away the links)
		  (NC.PutLinks ID DatabaseStream)            (* If body changed, Put it away)
		  (AND DeletedLinks (NC.PutNoteCard ID DatabaseStream))
                                                             (* KILL the process behind the editing window)
		  (SETQ Process (WINDOWPROP Window (QUOTE PROCESS)))
                                                             (* Remove all the NoteCards close fns)
		  (for CloseFn in (MKLIST (WINDOWPROP Window (QUOTE CLOSEFN)))
		     when (EQ (SUBATOM CloseFn 1 3)
			      (QUOTE NC.))
		     do (WINDOWDELPROP Window (QUOTE CLOSEFN)
				       CloseFn))             (* If this is a Tedit Window, prevent TEdit from 
							     closing the database file)
		  (COND
		    ((SETQ TextObj (WINDOWPROP Window (QUOTE TEXTOBJ)))
		      (replace (TEXTOBJ TXTFILE) of TextObj with NIL)
		      (replace (TEXTOBJ \DIRTY) of TextObj with NIL)))
                                                             (* Close the window)
		  (CLOSEW Window)
		  (AND Process (DEL.PROCESS Process)))
		(T                                           (* If the card has never beenm written to the database 
							     quit w/o saving is equivalent to delteing the card.)
		   (NC.PrintMsg Window T "This card has never been saved." (CHARACTER 13)
				"It will be deleted from the database."
				(CHARACTER 13))
		   (NC.DeleteNoteCards ID NIL T))))))))

(NC.UnfileNoteCard
  (LAMBDA (WindowOrTextStream)                               (* fgh: " 8-Nov-84 16:49")
                                                             (* Take a notecard out of a file box.
							     Called fom title bar menu.)
    (PROG (Links ID Window EditWindow)
          (SETQ Window (WINDOW.FROM.TEDIT.THING WindowOrTextStream))
          (SETQ ID (NC.IDFromWindow Window))
          (SETQ Links (bind SourceID for Link in (NC.FetchFromLinks ID)
			 when (EQ (fetch (NOTECARDLINK LINKLABEL) of Link)
				  NC.FiledCardLinkLabel)
			 collect (PROGN (replace (NOTECARDLINK DISPLAYMODE) of Link
					   with (QUOTE SourceTitle))
					Link)))
          (NC.PrintMsg Window T "Please select the file box(es) from which to remove this card. "
		       (CHARACTER 13))
          (SETQ EditWindow (NC.OpenPropListEditor WindowOrTextStream (LIST (QUOTE FileBoxes)
									   Links)
						  "List of File Boxes" T T))
          (BLOCK)
          (SETQ FileBoxes (NC.SelectNoteCards NIL (FUNCTION (LAMBDA (LinkOrID)
						  (COND
						    ((LISTP LinkOrID)
						      (NC.ContentsCardP (fetch (NOTECARDLINK SOURCEID)
									   of LinkOrID)))
						    (T (NC.ContentsCardP LinkOrID)))))
					      NC.SelectingParentsMenu ID T))
          (NC.ClosePropListEditor EditWindow (QUOTE NoSave))
          (DISMISS)
          (NC.ClearMsg Window T)
          (for Box in FileBoxes do (NC.DelReferencesToCard (COND
							     ((LISTP Box)
							       (fetch (NOTECARDLINK SOURCEID)
								  of Box))
							     (T Box))
							   ID PSA.Database))
          (for Link in Links when (OR (FMEMB (fetch (NOTECARDLINK SOURCEID) of Link)
					     FileBoxes)
				      (MEMBER Link FileBoxes))
	     do (NC.DelToLink Link PSA.Database)
		(NC.DelFromLink Link PSA.Database)))))

(NC.UpdateUpdateList
  (LAMBDA (ID)                                               (* fgh: " 5-Oct-84 22:28")
                                                             (* Update the list of update authors and times for the 
							     note card specified by ID)
    (COND
      ((NC.ActiveCardP ID)
	(COND
	  ((NULL (NC.FetchPropList ID))
	    (NC.SetPropList ID (LIST (QUOTE Updates)
				     (LIST (LIST USERNAME (DATE))))))
	  (T (LISTPUT (NC.FetchPropList ID)
		      (QUOTE Updates)
		      (CONS (LIST USERNAME (DATE))
			    (LISTGET (NC.FetchPropList ID)
				     (QUOTE Updates))))))
	(NC.SetPropListDirtyFlg ID T))
      (T (NC.ReportError "NC.UpdateUpdateList" (CONCAT ID ": Card not active on screen"))))))

(NC.CollectReferences
  (LAMBDA (ID CheckAndDeleteFlg DatabaseStream ReturnLinkIconsFlg ReturnLocationsFlg)
                                                             (* fgh: "23-Oct-84 11:52")

          (* * Collect all the links in a card specified by ID. RETURNS the CONS of a list of link identifiers {described 
	  below} and a dirtyflg that is non-NIL if the Substance of ID has been modified {i.e., when a non-valid link is found
	  and CheckAndDeleteFlg is NIL}. IF CheckAndDeleteFlg is non-NIL checks for valid links and deletes those that are not
	  valid. If ReturnLinkIconsFlg is NIL, returns link icons. Otherwise, returns links. If ReturnLinkIconsFlg is NIL, 
	  returns just the links/link icons. Otherwise, returns the CONS of link/link icon and the type-specific location of 
	  the link icon in the card.)


    (COND
      ((NC.ActiveCardP ID)
	(APPLY* (NC.CollectReferencesFn (NC.FetchType ID))
		ID CheckAndDeleteFlg DatabaseStream ReturnLinkIconsFlg ReturnLocationsFlg))
      (T (NC.ReportError "NC.CollectReferences" (CONCAT "Attempt to call with inactive card:  " ID))))
    ))
)
(* * Prop List Editor)

[DECLARE: EVAL@COMPILE 

(RECORD PropListItem (PropertyName Value OriginalListFlg AllowEditFlg AllowSelectFlg ButtonFn))
]
(DEFINEQ

(NC.AddPropToPropList
  (LAMBDA (editW)                                            (* fgh: "13-Aug-84 23:46")
                                                             (* Add a new prop to the propList being edited in 
							     editW)
    (PROG (selectedObject propName propValue insertPtr insertChars beginPtr
			  (stream (WINDOWPROP editW (QUOTE TEXTSTREAM)))
			  (tobj (WINDOWPROP editW (QUOTE TEXTOBJ))))
          (SETQ propName (MKATOM (NC.AskUser "New Property Name is = " NIL NIL T editW)))
          (NC.PrintMsg editW NIL (CHARACTER 13))
          (SETQ propValue (NC.AskUser "This property's value is = " NIL NIL NIL editW))
                                                             (* Insert these values into the editW)
                                                             (* Position just before selected button)
          (NC.PrintMsg editW T "Please select a property before which to insert this new property."
		       (CHARACTER 13))
          (SETQ selectedObject (NC.SelectProperty editW))
          (NC.ClearMsg editW T)
          (AND (NULL selectedObject)
	       (RETURN NIL))
          (SETQ insertPtr (TEDIT.FIND.OBJECT tobj selectedObject))
          (SETQ beginPtr insertPtr)                          (* Insert a button with this property name)
          (TEDIT.INSERT.OBJECT (MBUTTON.CREATE propName (FUNCTION NC.EditPropButtonFN)
					       (FONTCREATE (QUOTE HELVETICA)
							   10
							   (QUOTE BOLD)))
			       stream insertPtr)             (* Spacer between Prop and Value)
          (add insertPtr 1)
          (TEDIT.INSERT stream (CHARACTER 9)
			insertPtr)
          (TEDIT.LOOKS (TEXTOBJ stream)
		       (QUOTE (PROTECTED ON))
		       insertPtr 1)
          (add insertPtr 1)                                  (* Create a new field (Copied from JBS's 
							     \TEXTMENU.DOC.CREATE))
          (TEDIT.INSERT stream (CONCAT "  {}" (CHARACTER 13))
			insertPtr)
          (TEDIT.LOOKS (TEXTOBJ stream)
		       (QUOTE (PROTECTED ON))
		       insertPtr 5)
          (TEDIT.LOOKS (TEXTOBJ stream)
		       (QUOTE (PROTECTED ON SELECTPOINT ON))
		       (IPLUS insertPtr 2)
		       1)
          (TEDIT.INSERT stream (MKSTRING propValue)
			(IPLUS insertPtr 3))
          (TEDIT.LOOKS (TEXTOBJ stream)
		       (QUOTE (PROTECTED OFF SELECTPOINT OFF))
		       (IPLUS insertPtr 3)
		       (NCHARS (MKSTRING propValue)))
          (add insertPtr (NCHARS (MKSTRING propValue)))
          (add insertPtr 5))))

(NC.CloseAllPropListEditors
  (LAMBDA (ID)                                               (* fgh: " 7-May-84 18:30")
                                                             (* Force all prop list editors open on card ID to close
							     without saving changes.)
    (for AttachedWindow in (ALLATTACHEDWINDOWS (NC.FetchWindow ID)) when (WINDOWPROP AttachedWindow
										     (QUOTE 
										   PropListEditor))
       do (NC.ClosePropListEditor AttachedWindow (QUOTE NoSave))
	  (BLOCK))))

(NC.ClosePropListEditor
  (LAMBDA (Window SaveFlg)                                   (* NoteCards% User " 7-Jun-84 15:25")

          (* Close the prop list editor, saving or not saving the edited prop list as specified by the SaveFlg or by the user 
	  if SaveFlg is NIL)


    (PROG (TextObj Answered OldPropList NewPropList)
          (DETACHWINDOW Window)
          (SETQ TextObj (WINDOWPROP Window (QUOTE TEXTOBJ)))
          (SETQ OldPropList (WINDOWPROP Window (QUOTE PROPERTYLIST.BEING.EDITED)))
          (AND TextObj (COND
		 ((EQ SaveFlg (QUOTE Save))
		   (SETQ NewPropList (NC.ExtractPropList Window))
		   (NC.ProcessEditedPropList NewPropList OldPropList))
		 ((EQ SaveFlg (QUOTE NoSave)))
		 ((EQ (WINDOWPROP Window (QUOTE PropListEditor))
		      (QUOTE ShowOnly)))
		 (T (until Answered do (SELECTQ (MENU (OR (AND (BOUNDP (QUOTE NC.SavePropEditMenu))
							       (type? MENU NC.SavePropEditMenu)
							       NC.SavePropEditMenu)
							  (SETQ NC.SavePropEditMenu
							    (create MENU
								    ITEMS ←(QUOTE (Save% Changes
										    Cancel% Changes))
								    TITLE ← "Property Edits?"
								    CENTERFLG ← T))))
						(Save% Changes (SETQ NewPropList (NC.ExtractPropList
								   Window))
							       (NC.ProcessEditedPropList NewPropList 
										      OldPropList)
							       (SETQ Answered T))
						(Cancel% Changes (SETQ Answered T))
						NIL)))))
          (WINDOWPROP Window (QUOTE TEDIT.MENU)
		      NIL)
          (WINDOWPROP Window (QUOTE TEDIT.PROPS)
		      NIL)
          (WINDOWPROP Window (QUOTE PropListEditor)
		      NIL)
          (WINDOWDELPROP Window (QUOTE CLOSEFN)
			 (FUNCTION NC.ClosePropListEditor))
          (COND
	    (TextObj (replace (TEXTOBJ \DIRTY) of TextObj with NIL)
		     (\TEDIT.QUIT (fetch (TEXTOBJ \WINDOW) of TextObj))
		     (until (fetch (TEXTOBJ EDITFINISHEDFLG) of TextObj) do (BLOCK)))))))

(NC.DelPropFromList
  (LAMBDA (editW)                                            (* fgh: "13-Aug-84 23:44")
    (PROG ((tobj (WINDOWPROP editW (QUOTE TEXTOBJ)))
	   (stream (WINDOWPROP editW (QUOTE TEXTSTREAM)))
	   selectedObject)
          (NC.PrintMsg editW T "Please select property to be deleted.")
          (SETQ selectedObject (NC.SelectProperty editW))
          (NC.ClearMsg editW T)
          (COND
	    ((COND
		((NOT (IMAGEOBJPROP selectedObject (QUOTE EditPropListNoDelete)))
		  (SETQ CH# (TEDIT.FIND.OBJECT tobj selectedObject))
		  (MBUTTON.FIND.NEXT.FIELD tobj CH#)         (* Delete everything between the imageobj and the 
							     end-of-line.)
		  (TEDIT.LOOKS tobj (QUOTE (PROTECTED OFF))
			       CH#
			       (IPLUS 3 (IDIFFERENCE (fetch CHLIM of (fetch SCRATCHSEL of tobj))
						     CH#)))
		  (TEDIT.DELETE stream CH# (IPLUS 3 (IDIFFERENCE (fetch CHLIM
								    of (fetch SCRATCHSEL
									  of tobj))
								 CH#)))
		  (TEDIT.SETSEL stream (GETEOFPTR stream)
				0
				(QUOTE RIGHT)))
		(T (NC.PrintMsg editW T "Selected property:value pair cannot be deleted."
				(CHARACTER 13)))))))))

(NC.EditPropButtonFN
  (LAMBDA (imageObject sel window)                           (* fgh: "20-Apr-84 21:17")
                                                             (* This is the default function called whenever the 
							     user selects a button in the NC.EditPropList window.)
    (WINDOWPROP window (QUOTE SelectedObject)
		imageObject)))

(NC.EditProperties
  (LAMBDA (TextStream)                                       (* fgh: "23-Apr-84 20:48")
                                                             (* Open a property list editor for the card 
							     corresponding to TextStream.
							     Called from Title bar menus.)
    (PROG ((ID (NC.IDFromWindow (WINDOW.FROM.TEDIT.THING TextStream))))
          (NC.OpenPropListEditor TextStream (APPEND (NC.FetchPropList ID)
						    (LIST (QUOTE ID)
							  ID))
				 "Edit Property List"))))

(NC.EditPropList
  (LAMBDA (propList window showOnlyFlg)                      (* fgh: "25-Oct-84 20:52")

          (* * propList is a list of RECORDS of type PropListItem)



          (* * Edit a property list using the TEDIT menu-based editor. The var window is the window to use.
	  If none supplied, get one from user.)


    (PROG (menuStream textObj editW button (font (FONTCREATE (QUOTE HELVETICA)
							     8))
		      (CH# 1)
		      (ENDCH# 1))                            (* Init the editList and the propFnsList)
                                                             (* Create a TEDITMenu that reflects the structure of 
							     the proplist)
          (SETQ menuStream
	    (\TEXTMENU.DOC.CREATE
	      (for X in propList
		 join (NCONC (LIST (LIST (QUOTE MB.BUTTON)
					 (MKSTRING (fetch (PropListItem PropertyName) of X))
					 (OR (fetch (PropListItem ButtonFn) of X)
					     (FUNCTION NC.EditPropButtonFN))))
			     (COND
			       ((NOT (IMAGEOBJP (fetch (PropListItem Value) of X)))
				 (COND
				   ((fetch (PropListItem AllowEditFlg) of X)
				     (LIST (LIST (QUOTE MB.TEXT)
						 (CONCAT (CHARACTER 9)
							 "  ["
							 (MKSTRING (fetch (PropListItem Value)
								      of X))
							 "]"
							 (CHARACTER 13))
						 font)))
				   (T (LIST (LIST (QUOTE MB.TEXT)
						  (CHARACTER 9)
						  font)
					    (LIST (QUOTE MB.INSERT)
						  (MKSTRING (fetch (PropListItem Value) of X)))
					    (LIST (QUOTE MB.TEXT)
						  (CHARACTER 13)
						  font)))))
			       (T (LIST (LIST (QUOTE MB.TEXT)
					      (CHARACTER 9)
					      font)
					(LIST (QUOTE MB.INSERT))
					(LIST (QUOTE MB.TEXT)
					      (CHARACTER 13)
					      font))))))))
          (SETQ textObj (TEXTOBJ menuStream))                (* Go back and insert the ImageObjects into their value
							     fields.)
          (SETQ CH# 0)
          (for prop in propList when (OR (IMAGEOBJP (fetch (PropListItem Value) of prop))
					 (NULL (fetch (PropListItem AllowEditFlg) of prop)))
	     do (MBUTTON.FIND.NEXT.FIELD textObj (SETQ CH# (ADD1 CH#)))
		(SETQ CH# (fetch CH# of (fetch SCRATCHSEL of textObj)))
		(COND
		  ((IMAGEOBJP (CADR prop))
		    (TEDIT.INSERT.OBJECT (fetch (PropListItem Value) of prop)
					 menuStream CH#))))
          (SETQ CH# 0)
          (for prop in propList
	     do (SETQ button (MBUTTON.FIND.NEXT.BUTTON textObj (ADD1 CH#)))
		(SETQ CH# (CDR button))                      (* If the buttonProtect flag is on, protect the button)
		(AND (fetch (PropListItem AllowSelectFlg) of prop)
		     (IMAGEOBJPROP (CAR button)
				   (QUOTE EditPropListNoDelete)
				   T)))                      (* Set up window and window title)
          (SETQ editW (COND
	      (window window)
	      (T (CREATEW (GETREGION)
			  "Edit Property List"))))           (* Point to the proplist being edited so we can update 
							     it when this menu is closed.
							     (See NC.CloseEditPropListWindow))
          (WINDOWPROP editW (QUOTE PROPERTYLIST.BEING.EDITED)
		      propList)                              (* Set the right margin to very-far-away.
							     Prevents stuff from wrapping around)
          (TEDIT.PARALOOKS textObj (QUOTE (RIGHTMARGIN 1000 TABS (50 (80 . LEFT))))
			   1
			   (GETFILEINFO menuStream (QUOTE LENGTH)))
                                                             (* Set the first tab so the fields will line up 
							     correctly)
                                                             (* Set selection to the top -- make it look pretty)
          (replace (SELECTION SET) of (fetch (TEXTOBJ SEL) of textObj) with NIL)
          (TEDIT menuStream editW NIL (LIST (QUOTE MENU)
					    (create MENU
						    ITEMS ←(COND
						      (showOnlyFlg
							(QUOTE (("Quit" (NC.ClosePropListEditor
									  W
									  (QUOTE NoSave))
									
								"Quit from pointer list display."))))
						      (T (QUOTE (("Add New Property" (
NC.AddPropToPropList W)
										     
					       "Add a new property to this card's property list.")
								  ("Delete Selected Property"
								    (NC.DelPropFromList W)
								    
				       "Delete selected property from this card's property list.")
								  ("Quit w/o Saving Changes"
								    (NC.ClosePropListEditor
								      W
								      (QUOTE NoSave))
								    
					   "Quit from property list edit. Changes are not saved.")
								  ("Quit - Saving Changes"
								    (NC.ClosePropListEditor
								      W
								      (QUOTE Save))
								    
						  "Quit from property list editor. Save changes.")))))
						    ))))))

(NC.ExtractPropList
  (LAMBDA (editW)                                            (* fgh: "31-May-84 19:19")
                                                             (* Exctract the prop list from the TextStream in prop 
							     list editor window editW)
    (PROG ((tobj (WINDOWPROP editW (QUOTE TEXTOBJ)))
	   menuStream button propName (propValue T)
	   EOL
	   (CH# 1)
	   (propList (WINDOWPROP editW (QUOTE PROPERTYLIST.BEING.EDITED))))
                                                             (* Move through each field/value pair in menu.
							     Update each PROP in the list.)
                                                             (* For each property in the list, move to the next 
							     field, and drop its value into the field slot.)
          (SETQ menuStream (fetch STREAMHINT of tobj))       (* for each button in the menu do)
          (RETURN (while (SETQ button (MBUTTON.FIND.NEXT.BUTTON tobj CH#))
		     collect                                 (* Convert the name of the button into the property 
							     name)
                                                             (* Set up the looks of the fields so that 
							     MBUTTON.NEXT.FIELD will work correctly -- Real kludge 
							     to get around limitations in TEditMenu stuff)
			     (TEDIT.LOOKS tobj (QUOTE (PROTECTED ON SELECTPOINT ON))
					  (IPLUS 4 (CDR button))
					  1)
			     (COND
			       ((SETQ EOL (MBUTTON.FIND.NEXT.BUTTON tobj (IPLUS 4 (CDR button))))
				 (SETQ EOL (IDIFFERENCE (CDR EOL)
							2)))
			       (T (SETQ EOL (SUB1 (TEDIT.FIND tobj (CHARACTER 13)
							      (CDR button))))))
			     (TEDIT.LOOKS tobj (QUOTE (PROTECTED OFF))
					  (IPLUS 4 (CDR button))
					  (IDIFFERENCE EOL (IPLUS 4 (CDR button))))
                                                             (* Get the name of the property from the butrton)
			     (SETQ propName (IMAGEOBJPROP (CAR button)
							  (QUOTE MBTEXT)))
                                                             (* Now get its value by reading the next field)
			     (SETQ propValue (MBUTTON.NEXT.FIELD.AS.TEXT.OR.IMAGEOBJ tobj
										     (CDR button)))
			     (COND
			       ((NULL propValue)
				 (SETQ propValue (fetch (PropListItem Value) of (FASSOC propName 
											propList))))
			       ((IMAGEOBJP propValue))
			       ((NC.StringIsListP propValue 0)
                                                             (* This string should really be interpreted as a LIST)
				 (SETQ propValue (READ propValue)))
			       (T                            (* This really is a string)
				  (SETQ propValue (MKATOM propValue))))
                                                             (* Keep track of where that property was in the menu 
							     stream)
			     (SETQ CH# (ADD1 (CDR button)))
			     (LIST propName propValue))))))

(NC.OpenPropListEditor
  (LAMBDA (WindowOrTextStream PropList Title ShowOnlyFlg MakeImageObjFlg)
                                                             (* fgh: " 8-Nov-84 15:45")
                                                             (* Open a property list editor above the card specified
							     by TextStream , which is either a TextStream or a 
							     Window)
    (PROG ((Window (WINDOW.FROM.TEDIT.THING WindowOrTextStream))
	   EditWindow ID)                                    (* Make sure there is no prop list editor already 
							     there)
          (AND (NC.PropListEditorOpenP Window)
	       (RETURN))
          (SETQ ID (NC.IDFromWindow Window))                 (* FOR each prop/value pair with LISTP value.
							     Make a series of individual prop/value pairs 
							     corresponding to the elements of the LISTP)
          (SETQ PropList (for Item on PropList by (CDDR Item)
			    join (COND
				   ((NLISTP (CADR Item))
				     (LIST (create PropListItem
						   PropertyName ←(CAR Item)
						   Value ←(CADR Item)
						   OriginalListFlg ← NIL
						   AllowEditFlg ← NIL
						   AllowSelectFlg ← NIL
						   ButtonFn ← NIL)))
				   (T (for Element in (CADR Item) collect (create PropListItem
										  PropertyName ←(CAR
										    Item)
										  Value ← Element
										  OriginalListFlg ← T
										  AllowEditFlg ← NIL
										  AllowSelectFlg ← 
										  NIL
										  ButtonFn ← NIL))))))
                                                             (* If specified, translate all NOTECARDLINK values into
							     Image Objects for display.)
          (AND MakeImageObjFlg (for Item in PropList when (type? NOTECARDLINK (fetch (PropListItem
										       Value)
										 of Item))
				  do (replace (PropListItem Value) of Item
					with (NC.MakeLinkIcon (fetch (PropListItem Value)
								 of Item)))))
                                                             (* Indicate which properties can be edited by user.)
          (for Item in PropList do (COND
				     ((FMEMB (fetch (PropListItem PropertyName) of Item)
					     (QUOTE (ID Updates)))
				       (replace (PropListItem AllowEditFlg) of Item with T)
				       (replace (PropListItem AllowSelectFlg) of Item with T))
				     (ShowOnlyFlg (replace (PropListItem AllowEditFlg) of Item
						     with NIL)
						  (replace (PropListItem AllowSelectFlg)
						     of Item with T))
				     (T (replace (PropListItem AllowEditFlg) of Item with NIL)
					(replace (PropListItem AllowSelectFlg) of Item with NIL))))
                                                             (* Call the prop list editor)
          (ATTACHWINDOW (SETQ EditWindow (CREATEW (CREATEREGION 1000 2000 100 100)
						  (OR Title "Edit Property List")
						  NIL T))
			Window
			(QUOTE TOP)
			(QUOTE JUSTIFY))
          (WINDOWADDPROP EditWindow (QUOTE CLOSEFN)
			 (FUNCTION NC.ClosePropListEditor))
          (WINDOWPROP EditWindow (QUOTE PropListEditor)
		      (COND
			(ShowOnlyFlg (QUOTE ShowOnly))
			(T T)))
          (NC.EditPropList PropList EditWindow ShowOnlyFlg)
          (RETURN EditWindow))))

(NC.ProcessEditedPropList
  (LAMBDA (EditedPropList OldPropList)                       (* fgh: " 5-Oct-84 22:27")
                                                             (* Take an edited prop list and set the prop list of 
							     the card as required.)
    (PROG (ID NewPropList Prop ListItem)
          (SETQ ID (fetch (PropListItem Value) of (FASSOC (QUOTE ID)
							  OldPropList)))
          (for Item in EditedPropList
	     do (SETQ Prop (fetch (PropListItem PropertyName) of Item))
		(SETQ oldItem (FASSOC Prop OldPropList))
		(COND
		  ((EQ Prop (QUOTE ID)))
		  ((NULL NewPropList)
		    (SETQ NewPropList (LIST Prop (COND
					      ((fetch (PropListItem OriginalListFlg) of oldItem)
						(LIST (CADR Item)))
					      (T (CADR Item))))))
		  ((SETQ Value (LISTGET NewPropList Prop))
		    (LISTPUT NewPropList Prop (COND
			       ((LISTP Value)
				 (NCONC1 Value (CADR Item)))
			       (T (LIST (CADR Item)
					Value)))))
		  (T (LISTPUT NewPropList Prop (COND
				((fetch (PropListItem OriginalListFlg) of oldItem)
				  (LIST (CADR Item)))
				(T (CADR Item)))))))
          (NC.SetPropList ID NewPropList)
          (NC.SetPropListDirtyFlg ID T)
          (NC.MarkCardDirty ID))))

(NC.PropListEditorOpenP
  (LAMBDA (Window)                                           (* NoteCards% User "17-Jun-84 15:13")
                                                             (* Is there a prop list editor opened on this window?)
    (for AttachedWindow in (ALLATTACHEDWINDOWS Window) thereis (WINDOWPROP AttachedWindow
									   (QUOTE PropListEditor)))))

(NC.SelectProperty
  (LAMBDA (Window)                                           (* fgh: "20-Apr-84 21:44")
                                                             (* Select one of the properties in prop list editor 
							     window Window)
    (PROG ((ClippingRegion (DSPCLIPPINGREGION NIL Window)))
          (WINDOWPROP Window (QUOTE SelectedObject)
		      NIL)
          (until (WINDOWPROP Window (QUOTE SelectedObject))
	     do (until (AND (MOUSESTATE LEFT)
			    (EQ (WHICHW LASTMOUSEX LASTMOUSEY)
				Window)))
		(COND
		  ((INSIDEP ClippingRegion (LASTMOUSEX Window)
			    (LASTMOUSEY Window))
		    (APPLY* (WINDOWPROP Window (QUOTE BUTTONEVENTFN))
			    Window))))
          (AND (EQ TEDIT.SELPENDING (WINDOWPROP Window (QUOTE TEXTOBJ)))
	       (SETQ TEDIT.SELPENDING))
          (RETURN (WINDOWPROP Window (QUOTE SelectedObject)
			      NIL)))))

(NC.ShowPointers
  (LAMBDA (TextStream)                                       (* rht: "20-Nov-84 00:37")
                                                             (* Open an inspector for the links for note card 
							     specified by TextStream above the window for the note 
							     card.)
    (PROG (Links (ID (NC.IDFromWindow (WINDOW.FROM.TEDIT.THING TextStream))))
          (SETQ Links (NCONC (for Link in (NC.FetchToLinks ID)
				join (LIST (CONCAT (fetch (NOTECARDLINK LINKLABEL) of Link)
						   " TO ")
					   (LIST (create NOTECARDLINK copying Link DISPLAYMODE ←(
										QUOTE Title)))))
			     (for Link in (NC.FetchFromLinks ID)
				join (LIST (CONCAT (fetch (NOTECARDLINK LINKLABEL) of Link)
						   " FROM ")
					   (LIST (create NOTECARDLINK copying Link DISPLAYMODE ←(
										QUOTE Title)
									      SOURCEID ←(fetch
										(NOTECARDLINK 
										    DESTINATIONID)
											   of Link)
									      DESTINATIONID ←(fetch
										(NOTECARDLINK 
											 SOURCEID)
												of
												 Link)
							 ))))))
          (NC.OpenPropListEditor TextStream Links "List of Links" T T))))

(NC.StringIsListP
  (LAMBDA (string parenCount)                                (* dmr: "20-Mar-84 23:46")
                                                             (* T if string has a balanced number of 
							     (and). Var "parenCount" counts open parens.)
    (PROG (nextParen)
          (COND
	    ((NULL string)
	      (COND
		((ZEROP parenCount)
		  (RETURN T))
		(T (RETURN NIL)))))
          (SETQ nextParen (STRPOSL (QUOTE (%( %)))
				   string))
          (COND
	    ((NULL nextParen)
	      (RETURN NIL)))
          (COND
	    ((EQ (CHARCODE "(")
		 (EVAL (BQUOTE (CHARCODE , (SUBSTRING string nextParen nextParen)))))
	      (RETURN (NC.StringIsListP (SUBSTRING string (ADD1 nextParen))
					(ADD1 parenCount)))))
          (COND
	    ((EQ (CHARCODE ")")
		 (EVAL (BQUOTE (CHARCODE , (SUBSTRING string nextParen nextParen)))))
	      (RETURN (NC.StringIsListP (SUBSTRING string (ADD1 nextParen))
					(SUB1 parenCount)))))
          (BREAK))))
)
(* * Unknown ?????????)

(DEFINEQ

(NC.FetchBeingDeletedFlg
  (LAMBDA (ID)                                               (* fgh: "26-Mar-84 20:47")
    (GETPROP ID (QUOTE BeingDeleted))))

(NC.SetBeingDeletedFlg
  (LAMBDA (ID Value)                                         (* fgh: "26-Mar-84 20:46")
    (PUTPROP ID (QUOTE BeingDeleted)
	     Value)))
)
(* * Place marker ImageObjects)

(DEFINEQ

(NC.PlaceMarkerCopyFn
  (LAMBDA (ImageObj)                                         (* fgh: " 5-Mar-84 23:22")
    (NC.MakePlaceMarker (IMAGEOBJPROP ImageObj (QUOTE OBJECTDATUM)))))

(NC.PlaceMarkerDisplayFn
  (LAMBDA (ImageObj Stream)                                  (* rht: " 7-Dec-84 19:33")

          (* * rht 9/24/84: Now works for press and interpress as well as screen.)


    (PROG ((Label (IMAGEOBJPROP ImageObj (QUOTE OBJECTDATUM)))
	   (Scale (DSPSCALE NIL Stream))
	   (Font (FONTCREATE (QUOTE HELVETICA)
			     12
			     (QUOTE ITALIC)
			     NIL Stream)))
          (RELMOVETO (ITIMES Scale 3)
		     0 Stream)
          (DSPFONT (PROG1 (DSPFONT Font Stream)
			  (PRIN1 (U-CASE Label)
				 Stream))
		   Stream))))

(NC.PlaceMarkerGetFn
  (LAMBDA (FileStream TextStream)                            (* fgh: " 5-Mar-84 23:25")
    (NC.MakePlaceMarker (READ FileStream))))

(NC.PlaceMarkerImageBoxFn
  (LAMBDA (ImageObj Stream)                                  (* rht: " 7-Dec-84 19:33")

          (* * rht 9/24/84: Now scales the box dimensions so can go to press and interpress.)


    (PROG ((Font (FONTCREATE (QUOTE HELVETICA)
			     12
			     (QUOTE ITALIC)
			     NIL Stream))
	   (Label (IMAGEOBJPROP ImageObj (QUOTE OBJECTDATUM)))
	   (Scale (DSPSCALE NIL Stream)))
          (RETURN (create IMAGEBOX
			  XSIZE ←(IPLUS (TIMES 6 Scale)
					(STRINGWIDTH (U-CASE Label)
						     Font))
			  YSIZE ←(IPLUS (TIMES 18 Scale)
					(FONTPROP Font (QUOTE HEIGHT)))
			  YDESC ←(IPLUS (TIMES 3 Scale)
					(FONTPROP Font (QUOTE DESCENT)))
			  XKERN ← 0)))))

(NC.PlaceMarkerPutFn
  (LAMBDA (ImageObj FileStream)                              (* fgh: "29-Feb-84 19:15")
    (PROG ((Label (IMAGEOBJPROP ImageObj (QUOTE OBJECTDATUM))))
          (PRIN2 (MKSTRING Label)
		 FileStream))))

(NC.MakePlaceMarker
  (LAMBDA (Label)                                            (* fgh: " 5-Mar-84 01:43")
    (IMAGEOBJCREATE Label (IMAGEFNSCREATE (FUNCTION NC.PlaceMarkerDisplayFn)
					  (FUNCTION NC.PlaceMarkerImageBoxFn)
					  (FUNCTION NC.PlaceMarkerPutFn)
					  (FUNCTION NC.PlaceMarkerGetFn)
					  (FUNCTION NC.PlaceMarkerCopyFn)
					  (FUNCTION NILL)
					  (FUNCTION NILL)
					  (FUNCTION NILL)
					  (FUNCTION NILL)
					  (FUNCTION NILL)))))
)
(PUTPROPS NCCARDS COPYRIGHT ("Xerox Corporation" 1984 1985))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (3533 13347 (NC.SetNewCardFlg 3543 . 3835) (NC.FetchNewCardFlg 3837 . 4126) (
NC.CoerceToID 4128 . 4871) (NC.ActivateCard 4873 . 5043) (NC.ActiveCardP 5045 . 5260) (
NC.DeactivateCard 5262 . 6486) (NC.FetchFromLinks 6488 . 6655) (NC.FetchGlobalLinks 6657 . 6828) (
NC.FetchLinksDirtyFlg 6830 . 7002) (NC.FetchPropList 7004 . 7169) (NC.FetchRegion 7171 . 7332) (
NC.FetchRegionViewed 7334 . 7507) (NC.FetchScale 7509 . 7674) (NC.FetchSubstance 7676 . 7865) (
NC.FetchTitle 7867 . 8026) (NC.FetchToLinks 8028 . 8191) (NC.FetchType 8193 . 8350) (NC.FetchWindow 
8352 . 9156) (NC.IDP 9158 . 9454) (NC.MarkCardDirty 9456 . 9821) (NC.CardDirtyP 9823 . 10070) (
NC.SetFromLinks 10072 . 10249) (NC.SetGlobalLinks 10251 . 10438) (NC.SetInitialPropList 10440 . 10678)
 (NC.SetLinksDirtyFlg 10680 . 10862) (NC.SetPropList 10864 . 11042) (NC.SetRegion 11044 . 11216) (
NC.SetRegionViewed 11218 . 11407) (NC.SetScale 11409 . 11589) (NC.SetSubstance 11591 . 11800) (
NC.SetTitle 11802 . 11971) (NC.SetToLinks 11973 . 12146) (NC.SetType 12148 . 12322) (
NC.FetchTitleDirtyFlg 12324 . 12496) (NC.SetTitleDirtyFlg 12498 . 12680) (NC.FetchPropListDirtyFlg 
12682 . 12860) (NC.SetPropListDirtyFlg 12862 . 13050) (NC.ShrinkFn 13052 . 13345)) (13384 16560 (
NC.RetrieveFromLinks 13394 . 13892) (NC.RetrieveLinkLabels 13894 . 14545) (NC.RetrievePropList 14547
 . 14935) (NC.RetrieveTitle 14937 . 15380) (NC.RetrieveToLinks 15382 . 15874) (NC.RetrieveGlobalLinks 
15876 . 16251) (NC.RetrieveType 16253 . 16558)) (16605 43531 (NC.AddParents 16615 . 17979) (
NC.AssignSources 17981 . 18685) (NC.AssignTitle 18687 . 20322) (NC.DeleteNoteCards 20324 . 22844) (
NC.EditNoteCard 22846 . 23820) (NC.MakeNoteCard 23822 . 26004) (NC.FileNoteCard 26006 . 26506) (
NC.QuitCard 26508 . 27076) (NC.CheckContentsHooks 27078 . 28315) (NC.CheckSources 28317 . 29272) (
NC.CheckTitle 29274 . 30158) (NC.DeleteSource 30160 . 32287) (NC.DetermineContentsCards 32289 . 34095)
 (NC.DetermineSources 34097 . 34924) (NC.InsureProperFiling 34926 . 35528) (NC.QuitWithoutSaving 35530
 . 39489) (NC.UnfileNoteCard 39491 . 41531) (NC.UpdateUpdateList 41533 . 42362) (NC.CollectReferences 
42364 . 43529)) (43688 68536 (NC.AddPropToPropList 43698 . 46444) (NC.CloseAllPropListEditors 46446 . 
47007) (NC.ClosePropListEditor 47009 . 49160) (NC.DelPropFromList 49162 . 50455) (NC.EditPropButtonFN 
50457 . 50832) (NC.EditProperties 50834 . 51398) (NC.EditPropList 51400 . 56588) (NC.ExtractPropList 
56590 . 59754) (NC.OpenPropListEditor 59756 . 63283) (NC.ProcessEditedPropList 63285 . 64693) (
NC.PropListEditorOpenP 64695 . 65098) (NC.SelectProperty 65100 . 66094) (NC.ShowPointers 66096 . 67402
) (NC.StringIsListP 67404 . 68534)) (68567 68927 (NC.FetchBeingDeletedFlg 68577 . 68745) (
NC.SetBeingDeletedFlg 68747 . 68925)) (68966 71531 (NC.PlaceMarkerCopyFn 68976 . 69176) (
NC.PlaceMarkerDisplayFn 69178 . 69797) (NC.PlaceMarkerGetFn 69799 . 69968) (NC.PlaceMarkerImageBoxFn 
69970 . 70756) (NC.PlaceMarkerPutFn 70758 . 71010) (NC.MakePlaceMarker 71012 . 71529)))))
STOP