(FILECREATED "16-Feb-85 02:10:29" {PHYLUM}<NOTECARDS>RELEASE1.2>FGHPATCH003.;2 16876  

      changes to:  (FNS NC.AddSubstanceType NC.AddCardType)
		   (VARS FGHPATCH003COMS)

      previous date: "16-Feb-85 00:45:25" {PHYLUM}<NOTECARDS>RELEASE1.2>FGHPATCH003.;1)


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

(PRETTYCOMPRINT FGHPATCH003COMS)

(RPAQQ FGHPATCH003COMS ((E (SETQ NC.SystemDate (DATE)))
	(VARS NC.SystemDate)
	(* * Internal variables)
	(GLOBALVARS NC.CardTypes NC.SubstanceTypes NC.NoteCardTypeMenu)
	(* * Note Cards Type Mechanism)
	(RECORDS NoteCardType SubstanceType)
	(MACROS NC.Inherit)
	(FNS NC.SubstanceCopyFn NC.MakeSubstanceTypesList NC.MakeCardTypesList NC.MarkCardDirtyFn 
	     NC.AddSubstanceType NC.AddCardType NC.ListOfCardTypes NC.CollectReferencesFn 
	     NC.DelReferencesFn NC.EditFn NC.GetSubstanceFn NC.MakeCardFn NC.PutSubstanceFn 
	     NC.QuitCardFn NC.UpdateLinkIconsFn NC.SubstanceDirtyPFn NC.SubstanceMarkDirtyFn)
	(FNS NC.DefaultCardWidth NC.DefaultCardHeight NC.DefaultHeightFromType 
	     NC.DefaultWidthFromType)
	(P (NC.MakeSubstanceTypesList)
	   (NC.MakeCardTypesList))))

(RPAQQ NC.SystemDate "16-Feb-85 02:10:30")
(* * Internal variables)

(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS NC.CardTypes NC.SubstanceTypes NC.NoteCardTypeMenu)
)
(* * Note Cards Type Mechanism)

[DECLARE: EVAL@COMPILE 

(RECORD NoteCardType (TypeName SuperType SubstanceType MakeCardFn EditCardFn QuitCardFn GetCardFn 
			       PutCardFn CopyCardFn MarkCardDirtyFn CardDirtyPFn CollectLinksInCardFn 
			       DeleteLinksInCardFn UpdateLinkIconsInCardFn InsertLinkInCardFn 
			       TranslateWindowPositionToCardPositionFn LinkDisplayMode 
			       CardDefaultWidth CardDefaultHeight CardLinkAnchorModesSupported 
			       CardDisplayedInMenuFlg))

(RECORD SubstanceType (SubstanceName CreateSubstanceFn EditSubstanceFn QuitSubstanceFn GetSubstanceFn 
				     PutSubstanceFn CopySubstanceFn MarkSubstanceDirtyFn 
				     SubstanceDirtyPFn CollectLinksInSubstanceFn 
				     DeleteLinksInSubstanceFn UpdateLinkIconsInSubstanceFn 
				     InsertLinkInSubstanceFn 
				     TranslateWindowPositionToSubstancePositionFn 
				     SubstanceDefaultWidth SubstanceDefaultHeight 
				     SubstanceLinkAnchorModesSupported))
]
(DECLARE: EVAL@COMPILE 

(PUTPROPS NC.Inherit MACRO ((NC.Fn CardFn SubstanceFn CardTypeVariableName)
	   (PROG (SaveCardType (AtomCardType (COND
					       ((NLISTP CardTypeVariableName)
						 CardTypeVariableName)
					       (T (CAR CardTypeVariableName)))))
	         (RETURN (OR (for CardType in NC.CardTypes when (EQ AtomCardType (fetch (NoteCardType
											  TypeName)
										    of CardType))
				do (SETQ SaveCardType CardType)
				   (RETURN (OR (fetch (NoteCardType CardFn) of CardType)
					       (AND (fetch (NoteCardType SuperType) of CardType)
						    (NC.Fn (LIST (fetch (NoteCardType SuperType)
								    of CardType))))))
				finally (NC.ReportError (MKSTRING (QUOTE NC.Fn))
							(CONCAT "Unknown note card type:  " 
								NoteCardType ".")))
			     (AND (NLISTP CardTypeVariableName)
				  (fetch (SubstanceType SubstanceFn)
				     of (for SubstanceType in NC.SubstanceTypes
					   when (EQ (fetch (NoteCardType SubstanceType) of 
										     SaveCardType)
						    (fetch (SubstanceType SubstanceName)
						       of SubstanceType))
					   do (RETURN SubstanceType)))))))))
)
(DEFINEQ

(NC.SubstanceCopyFn
  (LAMBDA (NoteCardType)                                     (* fgh: "19-Oct-84 11:57")

          (* * Return the function that does a byte-wise copy of NoteCardType substance from one stream to another.)


    (NC.Inherit NC.SubstanceCopyFn CopyCardFn CopySubstanceFn NoteCardType)))

(NC.MakeSubstanceTypesList
  (LAMBDA NIL                                                (* fgh: "12-Feb-85 23:18")

          (* * Make the initial list of substance types.)


    (SETQ NC.SubstanceTypes NIL)
    (QUOTE Done)))

(NC.MakeCardTypesList
  (LAMBDA NIL                                                (* fgh: "12-Feb-85 23:18")

          (* * Make initial set of card types.)


    (SETQ NC.CardTypes (LIST (create NoteCardType
				     TypeName ←(QUOTE NoteCard)
				     SuperType ← NIL
				     SubstanceType ← NIL
				     MakeCardFn ← NIL
				     EditCardFn ← NIL
				     QuitCardFn ← NIL
				     GetCardFn ← NIL
				     PutCardFn ← NIL
				     CopyCardFn ← NIL
				     MarkCardDirtyFn ← NIL
				     CardDirtyPFn ← NIL
				     CollectLinksInCardFn ← NIL
				     DeleteLinksInCardFn ← NIL
				     UpdateLinkIconsInCardFn ← NIL
				     LinkDisplayMode ←(QUOTE Icon)
				     CardDefaultWidth ← NIL
				     CardDefaultHeight ← NIL)))
    (SETQ NC.NoteCardTypeMenu)))

(NC.MarkCardDirtyFn
  (LAMBDA (NoteCardType)                                     (* fgh: "22-Oct-84 12:41")

          (* * Return the fuinction that marks a card of type NoteCardType dirty.)


    (NC.Inherit NC.MarkCardDirtyFn MarkCardDirtyFn MarkSubstanceDirtyFn NoteCardType)))

(NC.AddSubstanceType
  (LAMBDA (SubstanceName FnsAssocList VarsAssocList)         (* fgh: "16-Feb-85 01:35")

          (* * Add a substance ttype to the lists of substance types.)


    (PROG (NewType)
          (COND
	    ((NULL SubstanceName)
	      (NC.ReportError "NC.AddSubstanceType" "Illegal substance type name: NIL")))

          (* * Remove old instance of SubstanceType)


          (for SubstanceType in NC.SubstanceTypes when (EQ (fetch (SubstanceType SubstanceName)
							      of SubstanceType)
							   SubstanceName)
	     do (SETQ NC.SubstanceTypes (REMOVE SubstanceType NC.SubstanceTypes)))

          (* * Add new SubstanceType to NC.SubstanceTypes list)


          (SETQ NC.SubstanceTypes (CONS (SETQ NewType (create SubstanceType
							      SubstanceName ← SubstanceName
							      CreateSubstanceFn ←(CADR
								(ASSOC (QUOTE CreateSubstanceFn)
								       FnsAssocList))
							      EditSubstanceFn ←(CADR
								(ASSOC (QUOTE EditSubstanceFn)
								       FnsAssocList))
							      QuitSubstanceFn ←(CADR
								(ASSOC (QUOTE QuitSubstanceFn)
								       FnsAssocList))
							      GetSubstanceFn ←(CADR
								(ASSOC (QUOTE GetSubstanceFn)
								       FnsAssocList))
							      PutSubstanceFn ←(CADR
								(ASSOC (QUOTE PutSubstanceFn)
								       FnsAssocList))
							      CopySubstanceFn ←(CADR
								(ASSOC (QUOTE CopySubstanceFn)
								       FnsAssocList))
							      MarkSubstanceDirtyFn ←(CADR
								(ASSOC (QUOTE MarkSubstanceDirtyFn)
								       FnsAssocList))
							      SubstanceDirtyPFn ←(CADR
								(ASSOC (QUOTE SubstanceDirtyPFn)
								       FnsAssocList))
							      CollectLinksInSubstanceFn ←(CADR
								(ASSOC (QUOTE 
									CollectLinksInSubstanceFn)
								       FnsAssocList))
							      DeleteLinksInSubstanceFn ←(CADR
								(ASSOC (QUOTE 
									 DeleteLinksInSubstanceFn)
								       FnsAssocList))
							      UpdateLinkIconsInSubstanceFn ←(CADR
								(ASSOC (QUOTE 
								     UpdateLinkIconsInSubstanceFn)
								       FnsAssocList))
							      InsertLinkInSubstanceFn ←(CADR
								(ASSOC (QUOTE InsertLinkInSubstanceFn)
								       FnsAssocList))
							      
						     TranslateWindowPositionToSubstancePositionFn ←(
								CADR (ASSOC (QUOTE 
						     TranslateWindowPositionToSubstancePositionFn)
									    FnsAssocList))
							      SubstanceDefaultWidth ←(CADR
								(ASSOC (QUOTE SubstanceDefaultWidth)
								       VarsAssocList))
							      SubstanceDefaultHeight ←(CADR
								(ASSOC (QUOTE SubstanceDefaultHeight)
								       VarsAssocList))
							      SubstanceLinkAnchorModesSupported ←(
								CADR (ASSOC (QUOTE 
								SubstanceLinkAnchorModesSupported)
									    VarsAssocList))))
					NC.SubstanceTypes))
          (RETURN NewType))))

(NC.AddCardType
  (LAMBDA (TypeName SuperType SubstanceType FnsAssocList VarsAssocList)
                                                             (* fgh: "16-Feb-85 01:36")

          (* * Create a new note acrd type and link it into the card type heirarchy.)


    (PROG (NewType)
          (COND
	    ((NULL TypeName)
	      (NC.ReportError "NC.AddCardType" "Illegal type name: NIL"))
	    ((for Type in NC.CardTypes never (EQ (fetch (NoteCardType TypeName) of Type)
						 SuperType))
	      (NC.ReportError "NC.AddCardType" (CONCAT "Unknown type in super type field:  " 
						       SuperType)))
	    ((for Substance in NC.SubstanceTypes never (EQ SubstanceType (fetch (SubstanceType 
										    SubstanceName)
									    of Substance)))
	      (NC.ReportError "NC.AddCardType" (CONCAT "Unknown substance type field:  " 
						       SubstanceType))))

          (* * Remove old instance of this NoteCardType)


          (for CardType in NC.CardTypes when (EQ (fetch (NoteCardType TypeName) of CardType)
						 TypeName)
	     do (SETQ NC.CardTypes (REMOVE CardType NC.CardTypes)))

          (* * Create new NoteCardType)


          (SETQ NC.CardTypes
	    (NCONC1 NC.CardTypes
		    (SETQ NewType (create NoteCardType
					  TypeName ← TypeName
					  SuperType ← SuperType
					  SubstanceType ← SubstanceType
					  MakeCardFn ←(CADR (ASSOC (QUOTE MakeCardFn)
								   FnsAssocList))
					  EditCardFn ←(CADR (ASSOC (QUOTE EditCardFn)
								   FnsAssocList))
					  QuitCardFn ←(CADR (ASSOC (QUOTE QuitCardFn)
								   FnsAssocList))
					  GetCardFn ←(CADR (ASSOC (QUOTE GetCardFn)
								  FnsAssocList))
					  PutCardFn ←(CADR (ASSOC (QUOTE PutCardFn)
								  FnsAssocList))
					  CopyCardFn ←(CADR (ASSOC (QUOTE CopyCardFn)
								   FnsAssocList))
					  MarkCardDirtyFn ←(CADR (ASSOC (QUOTE MarkCardDirtyFn)
									FnsAssocList))
					  CardDirtyPFn ←(CADR (ASSOC (QUOTE CardDirtyPFn)
								     FnsAssocList))
					  CollectLinksInCardFn ←(CADR (ASSOC (QUOTE 
									     CollectLinksInCardFn)
									     FnsAssocList))
					  DeleteLinksInCardFn ←(CADR (ASSOC (QUOTE 
									      DeleteLinksInCardFn)
									    FnsAssocList))
					  UpdateLinkIconsInCardFn ←(CADR (ASSOC (QUOTE 
									  UpdateLinkIconsInCardFn)
										FnsAssocList))
					  InsertLinkInCardFn ←(CADR (ASSOC (QUOTE InsertLinkInCardFn)
									   FnsAssocList))
					  TranslateWindowPositionToCardPositionFn ←(CADR
					    (ASSOC (QUOTE TranslateWindowPositionToCardPositionFn)
						   FnsAssocList))
					  LinkDisplayMode ←(CADR (ASSOC (QUOTE LinkDisplayMode)
									VarsAssocList))
					  CardDefaultHeight ←(CADR (ASSOC (QUOTE DefaultHeight)
									  VarsAssocList))
					  CardDefaultWidth ←(CADR (ASSOC (QUOTE DefaultWidth)
									 VarsAssocList))
					  CardLinkAnchorModesSupported ←(CADR (ASSOC (QUOTE 
								     CardLinkAnchorModesSupported)
										     VarsAssocList))
					  CardDisplayedInMenuFlg ←(CADR (ASSOC (QUOTE 
									   CardDisplayedInMenuFlg)
									       VarsAssocList))))))
          (SETQ NC.NoteCardTypeMenu)
          (RETURN NewType))))

(NC.ListOfCardTypes
  (LAMBDA NIL                                                (* fgh: "23-Oct-84 15:41")

          (* * Return a list of the note card types)



          (* * Special processing for older types to make them not all caps.)


    (bind TypeName for CardType in NC.CardTypes when (AND CardType (NEQ (SETQ TypeName
									  (fetch (NoteCardType 
											 TypeName)
									     of CardType))
									(QUOTE NoteCard)))
       collect TypeName)))

(NC.CollectReferencesFn
  (LAMBDA (NoteCardType)                                     (* fgh: "19-Oct-84 12:02")

          (* * Return the function that will collect the links in a substance of NoteCardType)


    (NC.Inherit NC.CollectReferencesFn CollectLinksInCardFn CollectLinksInSubstanceFn NoteCardType)))

(NC.DelReferencesFn
  (LAMBDA (NoteCardType)                                     (* fgh: "19-Oct-84 12:03")

          (* * Return the function that deletes references to a card from another card of a given type.)


    (NC.Inherit NC.DelReferencesFn DeleteLinksInCardFn DeleteLinksInSubstanceFn NoteCardType)))

(NC.EditFn
  (LAMBDA (NoteCardType)                                     (* fgh: "18-Oct-84 23:03")

          (* * Return the function to call the editor on substances of type NoteCardtype)


    (NC.Inherit NC.EditFn EditCardFn EditSubstanceFn NoteCardType)))

(NC.GetSubstanceFn
  (LAMBDA (NoteCardType)                                     (* fgh: "18-Oct-84 23:11")

          (* * Return the funcion for getting the substance of NoteCardType from a databasestream)


    (NC.Inherit NC.GetSubstanceFn GetCardFn GetSubstanceFn NoteCardType)))

(NC.MakeCardFn
  (LAMBDA (NoteCardType)                                     (* fgh: "19-Oct-84 11:48")

          (* * Return the function that will make a the type specific part of cards of NoteCardType.)


    (NC.Inherit NC.MakeCardFn MakeCardFn CreateSubstanceFn NoteCardType)))

(NC.PutSubstanceFn
  (LAMBDA (NoteCardType)                                     (* fgh: "19-Oct-84 16:20")

          (* * Return the Put Substance Fn for NoteCardType)


    (NC.Inherit NC.PutSubstanceFn PutCardFn PutSubstanceFn NoteCardType)))

(NC.QuitCardFn
  (LAMBDA (NoteCardType)                                     (* fgh: "22-Oct-84 12:31")

          (* * Return the function that foreces a note card of NoteCardType to quit or stop)


    (NC.Inherit NC.QuitCardFn QuitCardFn QuitSubstanceFn NoteCardType)))

(NC.UpdateLinkIconsFn
  (LAMBDA (NoteCardType)                                     (* fgh: "24-Oct-84 18:36")

          (* * Return the function for updating the link icons in a card of NoteCardType)


    (NC.Inherit NC.UpdateLinkIconsFn UpdateLinkIconsInCardFn UpdateLinkIconsInSubstanceFn 
		NoteCardType)))

(NC.SubstanceDirtyPFn
  (LAMBDA (NoteCardType)                                     (* fgh: "19-Oct-84 11:58")

          (* * Return the function that determines DirtyP for the substance of NoteCardType)


    (NC.Inherit NC.SubstanceDirtyPFn CardDirtyPFn SubstanceDirtyPFn NoteCardType)))

(NC.SubstanceMarkDirtyFn
  (LAMBDA (NoteCardType)                                     (* fgh: "12-Oct-84 23:12")

          (* * Return the function that marks a or unamrks card of NoteCardType dirty)


    (COND
      ((NC.TeditBasedP NoteCardType)
	(FUNCTION NC.MarkTextDirty))
      ((NC.SketchBasedP NoteCardType)
	(FUNCTION NC.MarkSketchDirty))
      ((NC.GrapherBasedP NoteCardType)
	(FUNCTION NC.MarkGraphDirty))
      (T (NC.ReportError "NC.SubstanceMarkDirtyFn" (CONCAT NoteCardType ":  Unknown note card type."))
	 ))))
)
(DEFINEQ

(NC.DefaultCardWidth
  (LAMBDA (ID)                                               (* fgh: " 4-Feb-85 23:27")

          (* * Determine the default width for card ID from its CardType)


    (PROG ((Type (NC.FetchType ID)))
          (RETURN (NC.DefaultWidthFromType Type)))))

(NC.DefaultCardHeight
  (LAMBDA (ID)                                               (* fgh: " 4-Feb-85 23:28")

          (* * Determine the default height for card ID from its CardType)


    (PROG ((Type (NC.FetchType ID)))
          (RETURN (NC.DefaultHeightFromType Type)))))

(NC.DefaultHeightFromType
  (LAMBDA (NoteCardType)                                     (* fgh: " 4-Feb-85 22:48")
    (NC.Inherit NC.DefaultHeightFromType CardDefaultHeight SubstanceDefaultHeight NoteCardType)))

(NC.DefaultWidthFromType
  (LAMBDA (NoteCardType)                                     (* fgh: " 4-Feb-85 22:49")
    (NC.Inherit NC.DefaultWidthFromType CardDefaultWidth SubstanceDefaultWidth NoteCardType)))
)
(NC.MakeSubstanceTypesList)
(NC.MakeCardTypesList)
(PUTPROPS FGHPATCH003 COPYRIGHT ("Xerox Corporation" 1985))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (3611 15681 (NC.SubstanceCopyFn 3621 . 3938) (NC.MakeSubstanceTypesList 3940 . 4187) (
NC.MakeCardTypesList 4189 . 4988) (NC.MarkCardDirtyFn 4990 . 5283) (NC.AddSubstanceType 5285 . 8395) (
NC.AddCardType 8397 . 11884) (NC.ListOfCardTypes 11886 . 12415) (NC.CollectReferencesFn 12417 . 12740)
 (NC.DelReferencesFn 12742 . 13065) (NC.EditFn 13067 . 13339) (NC.GetSubstanceFn 13341 . 13636) (
NC.MakeCardFn 13638 . 13932) (NC.PutSubstanceFn 13934 . 14191) (NC.QuitCardFn 14193 . 14476) (
NC.UpdateLinkIconsFn 14478 . 14801) (NC.SubstanceDirtyPFn 14803 . 15104) (NC.SubstanceMarkDirtyFn 
15106 . 15679)) (15682 16743 (NC.DefaultCardWidth 15692 . 15995) (NC.DefaultCardHeight 15997 . 16303) 
(NC.DefaultHeightFromType 16305 . 16524) (NC.DefaultWidthFromType 16526 . 16741)))))
STOP