(FILECREATED "20-Dec-85 18:02:24" {QV}<NOTECARDS>1.3K>FGHPATCH011.;1 4221   

      changes to:  (VARS FGHPATCH011COMS)
		   (FNS NC.MakeLink NC.InsertLinksInText))


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

(PRETTYCOMPRINT FGHPATCH011COMS)

(RPAQQ FGHPATCH011COMS ((* * Bug fixes from NCLINKS)
			  (FNS NC.MakeLink NC.InsertLinksInText)))
(* * Bug fixes from NCLINKS)

(DEFINEQ

(NC.MakeLink
  (LAMBDA (Window LinkLabel DestinationCard SourceCard DisplayMode AnchorMode Message NoDisplayFlg 
		  LinkToInsertAfter)                         (* fgh: "20-Dec-85 17:59")

          (* * Make a link from (OR Window SourceCard) to DestinationCard with linklabel of LinkLabel)



          (* * rht 1/12/85: If need to create a new card, then now shows card type menu near window of SourceID.)



          (* * rht 1/13/85: Added extra args Message and NoDisplayFlg.)



          (* * rht 3/26/85: Added LinkToInsertAfter arg which should be NIL or a link to insert the new To link after.
	  If NIL, then insert at front of ToLinks.)



          (* * kirk 9/23/85: took out GETPROMPTWINDOW call for asknotecardtype)



          (* * kirk: 14Nov85: changed NC.CoerceToID to to NC.CoerceToCard)



          (* * fgh 11/16/85 Changed from PROG to LET and used COND to contyrol returnmed value.)


    (LET (Link Type)
         (OR SourceCard (SETQ SourceCard (NC.CoerceToCard Window)))
         (OR Window (SETQ Window (NC.FetchWindow SourceCard)))
         (OR Message (SETQ Message "Please select the Card or Box to be linked to."))
         (OR DestinationCard (SETQ DestinationCard (NC.SelectNoteCards
		   T
		   (FUNCTION (LAMBDA (Card)
		       (COND
			 ((NOT (NC.SameCardP Card SourceCard))
			   T)
			 (T (NC.PrintMsg Window T "A Card/Box cannot link to itself. "
					   (CHARACTER 13)
					   "Selection ignored."
					   (CHARACTER 13))
			    NIL))))
		   NC.SelectingSingleCardMenu SourceCard NIL Message)))
         (COND
	   ((EQ DestinationCard (QUOTE *New% Card*))
	     (SETQ DestinationCard (AND (SETQ Type (NC.AskNoteCardType (WINDOWREGION Window)
									       ))
					    (NC.CoerceToCard (NC.MakeNoteCard
								 Type
								 (fetch (Card NoteFile)
								    of SourceCard)
								 NIL NoDisplayFlg))))))
         (COND
	   (DestinationCard (SETQ Link (create Link
						   UID ←(NC.MakeUID)
						   SourceCard ← SourceCard
						   DestinationCard ← DestinationCard
						   AnchorMode ← AnchorMode
						   Label ← LinkLabel
						   DisplayMode ←(OR DisplayMode (
									NC.DefaultLinkDisplayMode
									SourceCard))))
			    (NC.AddToLink Link LinkToInsertAfter)
			    (NC.AddFromLink Link)
			    Link)
	   (T NIL)))))

(NC.InsertLinksInText
  (LAMBDA (TextStream LinkLabel)                             (* fgh: "20-Dec-85 18:00")

          (* * Add several links to the text all with the same link label.)


    (PROG (Window SourceCard DestinationCards)
	    (SETQ SourceCard (NC.CoerceToCard (SETQ Window (WINDOW.FROM.TEDIT.THING 
										       TextStream))))
	    (SETQ DestinationCards (NC.SelectNoteCards NIL (FUNCTION (LAMBDA (Card)
							       (COND
								 ((NOT (NC.SameCardP Card 
										       SourceCard))
								   T)
								 (T (NC.PrintMsg (NC.FetchWindow
										     SourceCard)
										   T 
							    "A Card/Box cannot point to itself. "
										   (CHARACTER
										     13)
										   
									     "Selection ignored."
										   (CHARACTER
										     13))
								    NIL))))
							   NC.SelectingMultipleCardsMenu SourceCard 
							   NIL 
					     "Please select the Cards or Boxes to be pointed to."))
	    (NC.ClearMsg Window T)
	    (for DestinationCard in DestinationCards do (NC.InsertLinkInText TextStream 
										     LinkLabel 
										  DestinationCard 
										     SourceCard NIL)))
    ))
)
(PUTPROPS FGHPATCH011 COPYRIGHT ("Xerox Corporation" 1985))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (412 4139 (NC.MakeLink 422 . 2896) (NC.InsertLinksInText 2898 . 4137)))))
STOP