(FILECREATED " 8-Jun-86 23:40:25" {QV}<NOTECARDS>1.3K>FGHPATCH071.;3 8813   

      changes to:  (VARS FGHPATCH071COMS)
		   (FNS NC.AddCardType)

      previous date: " 8-Jun-86 23:18:23" {QV}<NOTECARDS>1.3K>FGHPATCH071.;1)


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

(PRETTYCOMPRINT FGHPATCH071COMS)

(RPAQQ FGHPATCH071COMS ((* * Fix to bug %#77 by removing designate sources/ delete sources from 
			     system)
			  (* * FROM NCTYPESMECH)
			  (FNS NC.AddCardType)
			  (VARS (NC.DefaultLeftButtonMenuItems
				  (BQUOTE ((Edit% Property% List (FUNCTION NC.EditProperties)
								 
					"Brings up an editor for the property list of this card.")
					   (Show% Links (FUNCTION NC.ShowLinks)
							
					   "Brings up a list of the links to and from this card.")
					   (Show% Info (FUNCTION NC.ShowInfo)
						       
			     "Brings up a window containing special information about this card."
						       (SUBITEMS (Indicate% NoteFile
								   (FUNCTION NC.AttachNoteFileName)
								   
							"Shows the name of this card's NoteFile.")))
					   (Designate% FileBoxes
					     (FUNCTION NC.AddParents)
					     "File this note card in one or more file boxes."
					     (SUBITEMS (Unfile% from% FileBoxes
							 (FUNCTION NC.UnfileNoteCard)
							 
					   "Remove this card from one or more of its file boxes.")))
					   (Assign% Title (FUNCTION NC.AssignTitle)
							  "Assigns a (new) title to this note card.")
					   (Title/FileBoxes (FUNCTION (LAMBDA (TextStream)
									      (NC.AssignTitle 
										       TextStream)
									      (NC.AddParents 
										       TextStream)))
							    
					    "Do both assigning of title and filing in fileboxes.")
					   , NC.LocalInsertLinkMenuItem
					   (Close% and% Save (FUNCTION CLOSEW)
							     
					  "Close this note card after saving it in the NoteFile."
							     (SUBITEMS (Close% and% Save
									 (FUNCTION CLOSEW)
									 
					  "Close this note card after saving it in the NoteFile.")
								       (Close% w/o% Saving
									 (FUNCTION 
									     NC.QuitWithoutSaving)
									 
		      "Close this note card without saving any changes made since the last Save.")
								       (Save% in% NoteFile
									 (FUNCTION NC.CardSaveFn)
									 
				       "Save this card in the NoteFile but don't close the card.")
								       (Delete% Card
									 (FUNCTION NC.DeleteNoteCards)
									 
						"Permenantly delete this card from the NoteFile.")))))
				  ))
			  (* * For this patch file only. Do not put in system.)
			  (P (NC.AddCardType (QUOTE NoteCard)
					     NIL
					     (BQUOTE ((CopyFn ,
							      (FUNCTION
								(LAMBDA (Card ToStream FromStream 
									      Length)
									(* Copy a card's substance 
									   using copybytes.)
									(LET* ((FromStartPtr
										 (GETFILEPTR 
										       FromStream))
									       (FromEndPtr
										 (PLUS Length 
										     FromStartPtr)))
									      (COPYBYTES FromStream 
											 ToStream 
										     FromStartPtr 
										       FromEndPtr)
									      T))))
						      (CollectLinksFn , (FUNCTION NILL))))
					     (BQUOTE ((LinkDisplayMode , (create LINKDISPLAYMODE 
										 ATTACHBITMAPFLG ← T))
						      (DefaultWidth 100)
						      (DefaultHeight 100)
						      (LinkIconAttachedBitMap , NC.TypelessIcon)
						      (LeftButtonMenuItems , 
								    NC.DefaultLeftButtonMenuItems)
						      (MiddleButtonMenuItems , 
								  NC.DefaultMiddleButtonMenuItems)))))
			  ))
(* * Fix to bug %#77 by removing designate sources/ delete sources from system)

(* * FROM NCTYPESMECH)

(DEFINEQ

(NC.AddCardType
  (LAMBDA (TypeName SuperType FnsAssocList VarsAssocList)    (* fgh: " 8-Jun-86 23:35")

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



          (* * fgh 1/31/86 Updated to handle card type hash table.)



          (* * fgh 2/3/86 Updated to do inheritance at definition time rather than at access time.)


    (LET (NewType (MainFieldNames (CONSTANT (for FieldName in (RECORDFIELDNAMES (QUOTE
											  
										     NoteCardType))
						 when (NEQ (QUOTE InheritedFlg)
							       (SUBATOM FieldName -12 -1))
						 collect FieldName))))
         (COND
	   ((NULL TypeName)
	     (NC.ReportError "NC.AddCardType" "Illegal type name: NIL"))
	   ((AND (NEQ TypeName (QUOTE NoteCard))
		   (NULL (NC.CardTypeRecord SuperType)))
	     (NC.ReportError "NC.AddCardType" (CONCAT "Unknown type in super type field:  " 
							  SuperType))))

          (* * Create new NoteCardType)


         (SETQ NewType (create NoteCardType
				   TypeName ← TypeName
				   SuperType ← SuperType))
         (for AssocPair in (APPEND FnsAssocList VarsAssocList) when (FMEMB (CAR AssocPair)
										     MainFieldNames)
	    do 

          (* * Set the proper field to the given value)


		 (RECORDACCESS (BQUOTE (NoteCardType , (CAR AssocPair)))
				 NewType NIL (QUOTE replace)
				 (CADR AssocPair))

          (* * Set the corresponding InheritedFlg to indicate that this field is not inherited.)


		 (RECORDACCESS (BQUOTE (NoteCardType , (PACK* (CAR AssocPair)
								    (QUOTE InheritedFlg))))
				 NewType NIL (QUOTE replace)
				 NIL))

          (* * Inherit any NIL fields from super type record.)


         (AND SuperType (NC.InheritFieldsFromSuperType NewType))

          (* * Propagate any changes downward to the subtypes of this type.)


         (NC.PropagateCardTypeFieldsDownward NewType)

          (* * Stash the new card type record, reset the menu and then return.)


         (PUTHASH TypeName NewType NC.CardTypes)
         (SETQ NC.NoteCardTypeMenu)
     NewType)))
)

(RPAQ NC.DefaultLeftButtonMenuItems (BQUOTE ((Edit% Property% List (FUNCTION NC.EditProperties)
								     
					"Brings up an editor for the property list of this card.")
					       (Show% Links (FUNCTION NC.ShowLinks)
							    
					   "Brings up a list of the links to and from this card.")
					       (Show% Info (FUNCTION NC.ShowInfo)
							   
			     "Brings up a window containing special information about this card."
							   (SUBITEMS (Indicate% NoteFile
								       (FUNCTION 
									    NC.AttachNoteFileName)
								       
							"Shows the name of this card's NoteFile.")))
					       (Designate% FileBoxes
						 (FUNCTION NC.AddParents)
						 "File this note card in one or more file boxes."
						 (SUBITEMS (Unfile% from% FileBoxes
							     (FUNCTION NC.UnfileNoteCard)
							     
					   "Remove this card from one or more of its file boxes.")))
					       (Assign% Title (FUNCTION NC.AssignTitle)
							      
						       "Assigns a (new) title to this note card.")
					       (Title/FileBoxes (FUNCTION (LAMBDA (TextStream)
										  (NC.AssignTitle
										    TextStream)
										  (NC.AddParents
										    TextStream)))
								
					    "Do both assigning of title and filing in fileboxes.")
					       , NC.LocalInsertLinkMenuItem
					       (Close% and% Save
						 (FUNCTION CLOSEW)
						 
					  "Close this note card after saving it in the NoteFile."
						 (SUBITEMS (Close% and% Save (FUNCTION CLOSEW)
									     
					  "Close this note card after saving it in the NoteFile.")
							   (Close% w/o% Saving
							     (FUNCTION NC.QuitWithoutSaving)
							     
		      "Close this note card without saving any changes made since the last Save.")
							   (Save% in% NoteFile
							     (FUNCTION NC.CardSaveFn)
							     
				       "Save this card in the NoteFile but don't close the card.")
							   (Delete% Card (FUNCTION NC.DeleteNoteCards)
									 
						"Permenantly delete this card from the NoteFile.")))))
)
(* * For this patch file only. Do not put in system.)

(NC.AddCardType (QUOTE NoteCard)
		NIL
		(BQUOTE ((CopyFn , (FUNCTION (LAMBDA (Card ToStream FromStream Length)
						     (* Copy a card's substance using copybytes.)
						     (LET* ((FromStartPtr (GETFILEPTR FromStream))
							    (FromEndPtr (PLUS Length FromStartPtr)))
							   (COPYBYTES FromStream ToStream 
								      FromStartPtr FromEndPtr)
							   T))))
			 (CollectLinksFn , (FUNCTION NILL))))
		(BQUOTE ((LinkDisplayMode , (create LINKDISPLAYMODE ATTACHBITMAPFLG ← T))
			 (DefaultWidth 100)
			 (DefaultHeight 100)
			 (LinkIconAttachedBitMap , NC.TypelessIcon)
			 (LeftButtonMenuItems , NC.DefaultLeftButtonMenuItems)
			 (MiddleButtonMenuItems , NC.DefaultMiddleButtonMenuItems))))
(PUTPROPS FGHPATCH071 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (3673 5954 (NC.AddCardType 3683 . 5952)))))
STOP