(FILECREATED "18-Feb-87 11:38:19" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH201.;1 9121   

      changes to:  (VARS RHTPATCH201COMS))


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

(PRETTYCOMPRINT RHTPATCH201COMS)

(RPAQQ RHTPATCH201COMS ((* * Fixes bug #376: Changing link display mode and changing card title 
			     from link icon both check for read-only notefile.)
			  (* * Changes to NCLINKS)
			  (FNS NC.ChangeLinkDisplayMode NC.ChangeCardTitleFromLinkIcon)))
(* * Fixes bug #376: Changing link display mode and changing card title from link icon both 
check for read-only notefile.)

(* * Changes to NCLINKS)

(DEFINEQ

(NC.ChangeLinkDisplayMode
  (LAMBDA (LinkOrLinkIcon Window NewDisplayMode)             (* rht: "18-Feb-87 11:28")

          (* * Change the display mode of the NOTECARDLINK defined by LinkOrLinkIcon. Have the user choose the new display 
	  mode.)



          (* * NOTE: assumes that the SourceID card of the link is active, i.e., the substance and links are cached for this 
	  card.)



          (* * rht 2/1/85: Now doesn't do all the work if new display mode is same as the old one. Or if user doesn't make a 
	  selection from the menu.)



          (* * kef 8/8/86: Now does the write through to the NoteFile even if the card is active, but not being edited.
	  Also, in the case of doing the write through, puts only the from links.)



          (* * fgh 8/30/86 Adapted to call NC.IfCardPartNotBusy.)



          (* * rht 9/29/86: Changed Ken's call to NC.CardBeingEditedP to NC.ActiveCardP and other minor changes.)



          (* * rht 2/18/87: Added check for readonly notefile to fix bug #376.)


    (LET (Card DestinationCard Link LinkIcon GlobalLinkFlg OldDisplayMode)
         (if (NC.LinkIconImageObjP LinkOrLinkIcon)
	     then (SETQ Link (NC.FetchLinkFromLinkIcon LinkOrLinkIcon))
		    (SETQ LinkIcon LinkOrLinkIcon)
	   else (SETQ Link LinkOrLinkIcon)
		  (OR (SETQ GlobalLinkFlg (NC.GlobalLinkP Link))
			(SETQ LinkIcon (NC.FetchLinkIconForLink Link))))
         (SETQ Card (fetch (Link SourceCard) of Link))
         (SETQ OldDisplayMode (fetch (Link DisplayMode) of Link))
         (if (NC.CheckForNotReadOnly Card Window "Can't change display mode for links in ")
	     then (COND
		      ((WINDOWP Window))
		      ((NC.ActiveCardP Card)
			(SETQ Window (NC.FetchWindow Card))))

          (* * Get new display mode from user)


		    (SETQ DestinationCard (fetch (Link DestinationCard) of Link))
		    (NC.IfCardPartNotBusy
		      DestinationCard
		      (QUOTE FROMLINKS)
		      (if (NOT NewDisplayMode)
			  then (SETQ NewDisplayMode
				   (NC.DisplayModeFromStylesheetSelections
				     (STYLESHEET (CREATE.STYLE (QUOTE ITEMS)
								   (LIST
								     (create MENU
									       ITEMS ←(QUOTE
										 (Yes No Float)))
								     (create MENU
									       ITEMS ←(QUOTE
										 (Yes No Float)))
								     (create MENU
									       ITEMS ←(QUOTE
										 (Yes No Float))))
								   (QUOTE ITEM.TITLES)
								   (QUOTE (Title?%  LinkType?%  
										    AttachBitmap?))
								   (QUOTE ITEM.TITLE.FONT)
								   (FONTCOPY MENUFONT (QUOTE
										 WEIGHT)
									       (QUOTE BOLD))
								   (QUOTE SELECTIONS)
								   (
							   NC.StylesheetSelectionsFromDisplayMode
								     OldDisplayMode)
								   (QUOTE NEED.NOT.FILL.IN)
								   NIL
								   (QUOTE TITLE)
								   (QUOTE Display% Mode?)
								   (QUOTE POSITION)
								   (create POSITION
									     XCOORD ← LASTMOUSEX
									     YCOORD ← LASTMOUSEY))))))
		      (if (OR (NULL NewDisplayMode)
				  (EQUAL NewDisplayMode OldDisplayMode))
			  then 

          (* * If new display mode is same as old, then bail out.)


				 NIL
			else 

          (* * Update link in LinkIcon or in global links list)


			       (if GlobalLinkFlg
				   then (for GlobalLink in (NC.FetchGlobalLinks Card)
					     when (NC.SameLinkP Link GlobalLink)
					     do (replace (Link DisplayMode) of GlobalLink
						     with NewDisplayMode))
					  (NC.SetLinksDirtyFlg Card T)
				 else (replace (Link DisplayMode) of (NC.FetchLinkFromLinkIcon
									     LinkIcon)
					   with NewDisplayMode)
					(NC.MarkCardDirty Card))

          (* * Update link in ToLinks List of Source card)


			       (for ToLink in (NC.FetchToLinks Card) when (NC.SameLinkP
										    Link ToLink)
				  do (replace (Link DisplayMode) of ToLink with 
										   NewDisplayMode))
			       (NC.SetLinksDirtyFlg Card T) 

          (* * Update Link in FromLinks list of Destination card)


			       (if (NC.ActiveCardP DestinationCard)
				   then (for FromLink in (NC.FetchFromLinks DestinationCard)
					     when (NC.SameLinkP Link FromLink)
					     do (replace (Link DisplayMode) of FromLink
						     with NewDisplayMode))
					  (NC.SetLinksDirtyFlg DestinationCard T)
				 else (WITH.MONITOR (NC.FetchMonitor (fetch (Card NoteFile)
									    of DestinationCard))
						      (NC.GetLinks DestinationCard)
						      (for FromLink in (NC.FetchFromLinks
									     DestinationCard)
							 when (NC.SameLinkP Link FromLink)
							 do (replace (Link DisplayMode)
								 of FromLink with NewDisplayMode))
						      (NC.PutFromLinks DestinationCard)
						      (NC.DeactivateCard DestinationCard)))

          (* * Update the image in any active window for Card)


			       (if (AND (WINDOWP Window)
					    (NOT (NC.TEditBasedP (NC.RetrieveType Card))))
				   then (NC.UpdateLinkImages Window (fetch (Link 
										  DestinationCard)
									   of Link)))
                                                             (* This causes tedit to redisplay the screen.)
			       (QUOTE CHANGED)))))))

(NC.ChangeCardTitleFromLinkIcon
  (LAMBDA (LinkIcon Window)                                  (* rht: "18-Feb-87 11:34")

          (* * From a link icon sitting in Window, change the title of the link's destination card.)



          (* * kirk 14Nov85: deleted use of PSA.Database)



          (* * fgh 6/4/86 Fixed so that moves card back to original location if moved to be on screen.
	  This fixes a bug in TEdit that'll mess up the screen if a window is mived under a ImageObj ButtonEventInFn.)



          (* * kef 7/16/86: Added mechanism for grabbing the write permission on the TITLE of the destination card.)



          (* * kef 7/30/86: Modified to check for Client's concept of whether he owns the write lock or not, thus deciding 
	  whether or not to setup the release of the write lock afterwards.)



          (* * fgh 8/30/86 Adpated to use NC.IfCardPartNotBusy.)



          (* * rht 11/13/86: Now checks for crossfile links and bails out.)



          (* * rht 2/18/87: Added check for readonly notefile to fix bug #376.)


    (LET (Link Card DestinationCard OldTitle NewTitle)
         (RESETLST (RESETSAVE NIL (BQUOTE (MOVEW , Window , (LOWERLEFT (WINDOWPROP
										   Window
										   (QUOTE REGION))))
						))
		     (if (NC.LinkIconImageObjP LinkIcon)
			 then
			  (SETQ Link (NC.FetchLinkFromLinkIcon LinkIcon))
			  (SETQ Card (fetch (Link SourceCard) of Link))
			  (SETQ DestinationCard (fetch (Link DestinationCard) of Link))
			  (if (NC.CheckForNotReadOnly Card Window 
							  "Can't change titles for cards in ")
			      then
			       (if (NC.CrossFileLinkCardP DestinationCard)
				   then (NC.PrintMsg Window T 
					    "Can't change card title from a cross notefile link.")
					  (DISMISS 1500)
					  (NC.ClearMsg Window T)
					  NIL
				 else (NC.IfCardPartNotBusy
					  DestinationCard
					  (QUOTE TITLE)
					  (if (SETQ NewTitle
						  (NC.AskUser (CONCAT 
							  "Enter new title for card with title '"
									  (NC.RetrieveTitle 
										  DestinationCard)
									  "'"
									  (CHARACTER 13))
								"-->  "
								(if (AND (STREQUAL
									       (SETQ OldTitle
										 (NC.RetrieveTitle
										   DestinationCard))
									       "Untitled")
									     (NC.FetchNewCardFlg
									       DestinationCard))
								    then NIL
								  else OldTitle)
								T Window))
					      then (NC.AssignTitle DestinationCard NIL NewTitle)
						     (QUOTE CHANGED))))))))))
)
(PUTPROPS RHTPATCH201 COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (655 9039 (NC.ChangeLinkDisplayMode 665 . 6337) (NC.ChangeCardTitleFromLinkIcon 6339 . 
9037)))))
STOP