(FILECREATED "27-Feb-87 15:53:12" {QV}<NOTECARDS>1.3K>NEXT>PMIPATCH019.;3 27915  

      changes to:  (VARS PMIPATCH019COMS)
		   (FNS NC.LinkIconDisplayFn NC.LinkIconImageBoxFn)

      previous date: "26-Feb-87 17:14:08" {QV}<NOTECARDS>1.3K>NEXT>PMIPATCH019.;1)


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

(PRETTYCOMPRINT PMIPATCH019COMS)

(RPAQQ PMIPATCH019COMS ((* * pmi 2/27/87: Fixed bug 439: problem with displaying box for null 
			     titles, and bug 445: problem with only displaying the attached bitmap.)
			  (* * Functions changed in NCLINKS)
			  (FNS NC.LinkIconDisplayFn NC.LinkIconImageBoxFn)))
(* * pmi 2/27/87: Fixed bug 439: problem with displaying box for null titles, and bug 445: 
problem with only displaying the attached bitmap.)

(* * Functions changed in NCLINKS)

(DEFINEQ

(NC.LinkIconDisplayFn
  (LAMBDA (ImageObj ImageStream StreamType TextStream Scale)
                                                             (* pmi: "27-Feb-87 10:57")

          (* * Display a link icon)



          (* * rht 11/13/84: Made width of box lines also scale dependent.)



          (* * rht 12/4/84: Hacked so type-dependent icons come out optionally to left of text.)



          (* * rht 2/9/85: Changed to use new display mode format.)



          (* * fgh 2/5/86 Added call to NC.FetchLinkIconAttachedBitMap)



          (* * rht & fgh 5/9/86: Massive hacking to display coords, etc.)



          (* * fgh 5/9/86 Added DSPFONT kludge after TypeIcon BITBLT to get around bug in PRESS BITBLT.
	  Bug reported as AR #5630.0)



          (* * rht 5/10/86: Rearranged order of expressions a bit and added arg to call to NC.FetchLinkIconAttachedBitMap in 
	  order to get a bitmap with correct height for the box we're drawing.)



          (* * rht 8/7/86: Now passes Scale argument to NC.FetchLinkIconAttachedBitMap. Also uses the Title and Label args if
	  non-nil. If not, then recomputes them more sensibly.)



          (* * rht 8/25/86: Fixed improperly placed comment.)



          (* * pmi 2/11/87: Overhauled to accommodate multi-line link icons)



          (* * pmi 2/27/87: Fixed problems with only displaying the attached bitmap and with displaying null titles)


    (DECLARE (GLOBALVARS NC.LinkIconMultiLineMode NC.LinkIconMaxWidth NC.LinkIconSpaceInnerX 
			     NC.LinkIconSpaceOuterX NC.LinkIconAttachBitmapFlg NC.LinkIconSpaceInnerY 
			     NC.LinkIconSpaceOuterY NC.LinkIconSpaceInterLine NC.LinkIconBorderWidth 
			     NC.LinkIconShowLinkTypeFlg NC.LinkIconShowTitleFlg))
    (RESETLST (RESETSAVE NIL (BQUOTE (DSPFONT , (DSPFONT NC.LinkIconFont ImageStream)
						      , ImageStream)))
		(PROG ((Scale (DSPSCALE NIL ImageStream))
			 (Link (NC.FetchLinkFromLinkIcon ImageObj))
			 Font FontHeight FontAscent FontDescent Left Bottom Top ShowTitleFlg 
			 LinkDisplayMode AttachBitmapFlg DisplayType Window Card Title Label 
			 LinkIconString LinkIconStrings BoxWidth BoxHeight ImageBox Icon 
			 ScaledIconHeight ScaledIconWidth XPosition ScaledLinkIconMaxWidth 
			 ScaledBorderWidth ScaledSpaceInnerX ScaledSpaceOuterX ScaledSpaceInnerY 
			 ScaledSpaceOuterY ScaledSpaceInterLine HalfScaledSpaceInterLine)
		        (SETQ Font (DSPFONT NIL ImageStream))
		        (SETQ FontHeight (FONTHEIGHT Font))

          (* * Determine what type of Display to do)


		        (SETQ DisplayType (fetch (Link DisplayMode) of Link))
		        (SETQ ShowTitleFlg (fetch (LINKDISPLAYMODE SHOWTITLEFLG) of DisplayType)
			  )
		        (SETQ Card (if (EQ ShowTitleFlg (QUOTE SOURCE))
					 then (fetch (Link SourceCard) of Link)
				       else (fetch (Link DestinationCard) of Link)))
		        (SETQ LinkDisplayMode (fetch (LINKDISPLAYMODE SHOWLINKTYPEFLG)
						   of DisplayType))
		        (SETQ AttachBitmapFlg (fetch (LINKDISPLAYMODE ATTACHBITMAPFLG)
						   of DisplayType))
		        (SETQ AttachBitmapFlg (if (EQ AttachBitmapFlg (QUOTE FLOAT))
						    then NC.LinkIconAttachBitmapFlg
						  else AttachBitmapFlg))

          (* * Construct the text for the link icon)


		        (SETQ Title (if (AND ShowTitleFlg (OR (NEQ ShowTitleFlg
									     (QUOTE FLOAT))
								      NC.LinkIconShowTitleFlg))
					  then (NC.RetrieveTitle Card)
					else NIL))
		        (SETQ Label (AND (COND
					       ((EQ LinkDisplayMode (QUOTE FLOAT))
						 NC.LinkIconShowLinkTypeFlg)
					       (T LinkDisplayMode))
					     (fetch (Link Label) of Link)))
		        (SETQ LinkIconString (CONCAT (COND
							   (Label (CONCAT "<" Label ">"))
							   (T ""))
							 (COND
							   ((AND Label Title)
							     " ")
							   (T ""))
							 (OR Title "")))

          (* * Make temporaries of scaled variables)


		        (SETQ ScaledLinkIconMaxWidth (TIMES Scale NC.LinkIconMaxWidth))
		        (SETQ ScaledBorderWidth (TIMES Scale NC.LinkIconBorderWidth))
		        (SETQ ScaledSpaceInnerX (TIMES Scale NC.LinkIconSpaceInnerX))
		        (SETQ ScaledSpaceOuterX (TIMES Scale NC.LinkIconSpaceOuterX))
		        (SETQ ScaledSpaceInnerY (TIMES Scale NC.LinkIconSpaceInnerY))
		        (SETQ ScaledSpaceOuterY (TIMES Scale NC.LinkIconSpaceOuterY))
		        (SETQ ScaledSpaceInterLine (TIMES Scale NC.LinkIconSpaceInterLine))
		        (SETQ HalfScaledSpaceInterLine (IQUOTIENT ScaledSpaceInterLine 2))

          (* * Set up the icon, if displayed)


		        (SETQ ImageBox (IMAGEOBJPROP ImageObj (QUOTE BOUNDBOX)))
		        (if AttachBitmapFlg
			    then 

          (* * Attached icon)



          (* * Use an estimate of the width and height to tell if the box contains more than one line of text)


				   (if NC.LinkIconMultiLineMode
				       then 

          (* * Multi-line link icons are enabled)


					      (SETQ ApproxBoxWidth (PLUS ScaledSpaceOuterX 
									     ScaledBorderWidth 
									     ScaledSpaceInnerX
									     (STRINGWIDTH 
										   LinkIconString 
											    Font)
									     ScaledSpaceInnerX 
									     ScaledBorderWidth 
									     ScaledSpaceOuterX))
					      (SETQ ApproxBoxHeight
						(PLUS ScaledSpaceOuterY ScaledBorderWidth 
							ScaledSpaceInnerY FontHeight 
							ScaledSpaceInnerY ScaledBorderWidth 
							ScaledSpaceOuterY))
					      (if ImageBox
						  then 

          (* * The image box has already been calculated. Use the box height to determine if Multi-line or Single line.
	  Calculate the correct bitmap.)


							 (SETQ BoxHeight (fetch (IMAGEBOX
										      YSIZE)
									      of ImageBox))
							 (if (GREATERP BoxHeight ApproxBoxHeight)
							     then 
                                                             (* Calculate height for Multi-line icon)
								    (SETQ ScaledIconHeight
								      (PLUS ScaledBorderWidth 
									      ScaledSpaceInnerY 
									      FontHeight 
									 HalfScaledSpaceInterLine))
							   else 
                                                             (* Calculate height for Single line icon)
								  (SETQ ScaledIconHeight
								    (PLUS ScaledBorderWidth 
									    ScaledSpaceInnerY 
									    FontHeight 
									    ScaledSpaceInnerY 
									    ScaledBorderWidth)))
							 (SETQ Icon (
							     NC.FetchLinkIconAttachedBitMap Card 
										 ScaledIconHeight 
											    Scale))
							 (SETQ ScaledIconHeight
							   (TIMES Scale (BITMAPHEIGHT Icon)))
							 (SETQ ScaledIconWidth (TIMES
							     Scale
							     (BITMAPWIDTH Icon)))
						else 

          (* * The image box must be calculated)


						       (if (GREATERP ApproxBoxWidth 
									 ScaledLinkIconMaxWidth)
							   then 
                                                             (* Calculate Multi-line icon)
								  (SETQ ScaledIconHeight
								    (PLUS ScaledBorderWidth 
									    ScaledSpaceInnerY 
									    FontHeight 
									 HalfScaledSpaceInterLine))
								  (SETQ Icon (
								   NC.FetchLinkIconAttachedBitMap
								      Card ScaledIconHeight Scale))
								  (SETQ ScaledIconHeight
								    (TIMES Scale (BITMAPHEIGHT
									       Icon)))
								  (SETQ ScaledIconWidth
								    (TIMES Scale (BITMAPWIDTH
									       Icon)))
							 else 
                                                             (* Calculate Single line icon)
								(SETQ ScaledIconHeight
								  (PLUS ScaledBorderWidth 
									  ScaledSpaceInnerY 
									  FontHeight 
									  ScaledSpaceInnerY 
									  ScaledBorderWidth))
								(SETQ Icon (
								   NC.FetchLinkIconAttachedBitMap
								    Card ScaledIconHeight Scale))
								(SETQ ScaledIconHeight
								  (TIMES Scale (BITMAPHEIGHT
									     Icon)))
								(SETQ ScaledIconWidth
								  (TIMES Scale (BITMAPWIDTH
									     Icon)))

          (* * Now see if total width, including the icon, will still fit if this is a Single line)


								(if (AND (NOT (STREQUAL
										      LinkIconString 
										      ""))
									     (GREATERP
									       (PLUS ApproxBoxWidth 
										  ScaledIconWidth)
									       ScaledLinkIconMaxWidth)
									     )
								    then 
                                                             (* Now it doesn't fit. Calculate Multi-line icon)
									   (SETQ ScaledIconHeight
									     (PLUS 
										ScaledBorderWidth 
										ScaledSpaceInnerY 
										     FontHeight 
									 HalfScaledSpaceInterLine))
									   (SETQ Icon
									     (
								   NC.FetchLinkIconAttachedBitMap
									       Card ScaledIconHeight 
									       Scale))
									   (SETQ ScaledIconHeight
									     (TIMES Scale
										      (BITMAPHEIGHT
											Icon)))
									   (SETQ ScaledIconWidth
									     (TIMES Scale
										      (BITMAPWIDTH
											Icon))))))
				     else 

          (* * Multi-line link icons are disabled)


					    (SETQ ScaledIconHeight (PLUS ScaledBorderWidth 
									     ScaledSpaceInnerY 
									     FontHeight 
									     ScaledSpaceInnerY 
									     ScaledBorderWidth))
					    (SETQ Icon (NC.FetchLinkIconAttachedBitMap Card 
										 ScaledIconHeight 
											   Scale))
					    (SETQ ScaledIconHeight (TIMES Scale (BITMAPHEIGHT
										Icon)))
					    (SETQ ScaledIconWidth (TIMES Scale (BITMAPWIDTH
									       Icon))))
			  else 

          (* * No attached icon)


				 (SETQ Icon NIL)
				 (SETQ ScaledIconHeight 0)
				 (SETQ ScaledIconWidth 0))

          (* * Now determine the text to be printed)


		        (if (AND Icon (GREATERP (PLUS ScaledIconWidth ScaledSpaceOuterX 
							      ScaledSpaceOuterX)
						      ScaledLinkIconMaxWidth))
			    then 

          (* If the width of the icon plus the outer x's is greater than the ScaledLinkIconMaxWidth set by the user, set the 
	  icon and text to NIL)


				   (SETQ Icon NIL)
				   (SETQ ScaledIconHeight 0)
				   (SETQ ScaledIconWidth 0)
				   (SETQ LinkIconStrings (LIST ""))
			  elseif (STREQUAL LinkIconString "")
			    then                           (* There is no text to print, so set it to the null 
							     string)
				   (SETQ LinkIconStrings (LIST ""))
			  else 

          (* * Have the text parsed into separate lines)


				 (SETQ LinkIconStrings (NC.CreateLinkIconStrings Link 
										   LinkIconString 
										     Icon ImageStream)
				   ))

          (* * Get the image box info for this icon)


		        (SETQ ImageBox
			  (OR ImageBox
				(NC.LinkIconImageBoxFn ImageObj ImageStream NIL NIL NIL DisplayType 
							 Title Label LinkIconString Icon 
							 LinkIconStrings)))

          (* * Compute all the size values.)


		        (SETQ Bottom (PLUS (DIFFERENCE (DSPYPOSITION NIL ImageStream)
							     (fetch (IMAGEBOX YDESC)
								of ImageBox))
					       ScaledSpaceOuterY))
		        (SETQ BoxHeight (DIFFERENCE (fetch (IMAGEBOX YSIZE) of ImageBox)
							(PLUS ScaledSpaceOuterY ScaledSpaceOuterY)))
		        (SETQ Top (PLUS Bottom BoxHeight))
		        (SETQ Left (PLUS (DSPXPOSITION NIL ImageStream)
					     ScaledSpaceOuterX))
		        (SETQ BoxWidth (DIFFERENCE (fetch (IMAGEBOX XSIZE) of ImageBox)
						       (PLUS ScaledSpaceOuterX ScaledSpaceOuterX)))

          (* * Display the icon, if possible)


		        (if (AND Icon (LEQ (PLUS ScaledIconWidth ScaledSpaceOuterX 
							 ScaledSpaceOuterX)
						 ScaledLinkIconMaxWidth))
			    then 

          (* Put out the icon bitmap, but only if the width of the icon plus the outer x's does not exceed the 
	  LinkIconMaxWidth set by the user.)


				   (BITBLT Icon 0 0 ImageStream Left (DIFFERENCE Top 
										 ScaledIconHeight))

          (* DSPFONT is a kludge to get around bug in PRESS BITBLT which sets the width of a space char to NIL.
	  Bug reported as AR #5630.0)


				   (DSPFONT Font ImageStream)
				   (if (NOT (OR Label Title))
				       then                (* Quit because just a typeicon)
					      (RETURN))
			  else                             (* There isn't enough space for the icon, so set it to
							     NIL)
				 (SETQ Icon NIL)
				 (SETQ ScaledIconWidth 0))

          (* * Enter the appropriate text.)


		        (SETQ XPosition (PLUS Left (if Icon
							   then ScaledIconWidth
							 else ScaledBorderWidth)
						  ScaledSpaceInnerX))
		        (DSPXPOSITION XPosition ImageStream)
		        (SETQ FontDescent (FONTDESCENT Font))
		        (if LinkIconStrings
			    then (if (GREATERP (LENGTH LinkIconStrings)
						     1)
				       then (SETQ FontAscent (FONTASCENT Font))
					      (SETQ BottomOfLine (DIFFERENCE Top
										 (PLUS 
										ScaledBorderWidth 
										ScaledSpaceInnerY 
										       FontAscent)))
					      (SETQ XPosition (PLUS Left ScaledSpaceInnerX 
									ScaledBorderWidth))
					      (for String in LinkIconStrings
						 do (DSPYPOSITION BottomOfLine ImageStream)
						      (PRIN1 String ImageStream)
						      (SETQ BottomOfLine
							(DIFFERENCE BottomOfLine
								      (PLUS FontDescent 
									     ScaledSpaceInterLine 
									      FontAscent)))
						      (DSPXPOSITION XPosition ImageStream))

          (* * Draw the box.)


					      (NC.DrawInnerBox Left Bottom BoxWidth BoxHeight 
								 ScaledBorderWidth NIL ImageStream 
								 Icon ScaledIconWidth 
								 ScaledIconHeight)
				     else (DSPYPOSITION (PLUS Bottom ScaledBorderWidth 
								    ScaledSpaceInnerY FontDescent)
							    ImageStream)
					    (PRIN1 (CAR LinkIconStrings)
						     ImageStream)

          (* * Draw the box.)


					    (NC.DrawInnerBox (PLUS Left ScaledIconWidth)
							       Bottom
							       (DIFFERENCE BoxWidth ScaledIconWidth)
							       BoxHeight ScaledBorderWidth NIL 
							       ImageStream Icon)))))))

(NC.LinkIconImageBoxFn
  (LAMBDA (ImageObj ImageStream CurrentX RightMargin DummyArg DisplayType Title Label LinkIconString 
		    Icon LinkIconStrings)                    (* pmi: "27-Feb-87 10:57")

          (* * rht 9/20/84: Now scales result before returning by proper amount depending on stream type.
	  e.g. for PRESS and INTERPRESS.)



          (* * rht 11/13/84: In computation of XSIZE, extra width is figured using characters in the font, "nn", rather than 
	  absolute pixel count.)



          (* * rht 2/9/85: Now uses new displaymode format.)



          (* * rht 5/9/86: Note that RightMargin non-nil signals a TEdit stream.)



          (* * rht & fgh 5/9/86: Massive hacking to display coords, etc.)



          (* * rht 5/10/86: Rearranged order of expressions a bit and added arg to call to NC.FetchLinkIconAttachedBitMap in 
	  order to get a bitmap with correct height for the box we're drawing.)



          (* * rht 8/7/86: Now passes Scale argument to NC.FetchLinkIconAttachedBitMap. Also uses the Title and Label args if
	  non-nil. If not, then recomputes them more sensibly.)



          (* * rht 8/25/85: Fixed improperly placed comment.)



          (* * rg 11/18/86: Added TotalEdgeSpaceY to local vars declaration)



          (* * pmi 2/6/87: Overhauled to accommodate multi-line link icons)



          (* * pmi 2/27/87: Fixed problems with only displaying the attached bitmap and with displaying null titles)


    (DECLARE (GLOBALVARS NC.LinkIconMultiLineMode NC.LinkIconMaxWidth NC.LinkIconSpaceInnerX 
			     NC.LinkIconSpaceOuterX NC.LinkIconAttachBitmapFlg NC.LinkIconSpaceInnerY 
			     NC.LinkIconSpaceOuterY NC.LinkIconSpaceInterLine NC.LinkIconBorderWidth 
			     NC.LinkIconShowLinkTypeFlg NC.LinkIconShowTitleFlg))
    (RESETLST (RESETSAVE NIL (BQUOTE (DSPFONT , (DSPFONT NC.LinkIconFont ImageStream)
						      , ImageStream)))
		(LET ((Link (NC.FetchLinkFromLinkIcon ImageObj))
		      (Scale (DSPSCALE NIL ImageStream))
		      (StringWidth 0)
		      Card Font FontHeight ShowTitleFlg AttachBitmapFlg LinkDisplayMode 
		      ApproxBoxWidth ScaledIconHeight ScaledIconWidth NumberOfLines YSize 
		      ScaledLinkIconMaxWidth ScaledBorderWidth ScaledSpaceInnerX ScaledSpaceOuterX 
		      ScaledSpaceInnerY ScaledSpaceOuterY ScaledSpaceInterLine 
		      HalfScaledSpaceInterLine TotalEdgeSpaceY)
		     (SETQ Font (DSPFONT NIL ImageStream))
		     (SETQ FontHeight (FONTHEIGHT Font))

          (* * Determine what type of Display to do)


		     (OR DisplayType (SETQ DisplayType (fetch (Link DisplayMode) of Link)))
		     (SETQ ShowTitleFlg (fetch (LINKDISPLAYMODE SHOWTITLEFLG) of DisplayType))
		     (SETQ Card (if (EQ ShowTitleFlg (QUOTE SOURCE))
				      then (fetch (Link SourceCard) of Link)
				    else (fetch (Link DestinationCard) of Link)))
		     (SETQ LinkDisplayMode (fetch (LINKDISPLAYMODE SHOWLINKTYPEFLG) of 
										      DisplayType))
		     (SETQ AttachBitmapFlg (fetch (LINKDISPLAYMODE ATTACHBITMAPFLG) of 
										      DisplayType))
		     (SETQ AttachBitmapFlg (if (EQ AttachBitmapFlg (QUOTE FLOAT))
						 then NC.LinkIconAttachBitmapFlg
					       else AttachBitmapFlg))

          (* * Construct the text for the link icon)


		     (if (NOT LinkIconString)
			 then (OR Title (SETQ Title (if (AND ShowTitleFlg
								       (OR (NEQ ShowTitleFlg
										    (QUOTE FLOAT))
									     NC.LinkIconShowTitleFlg))
							      then (NC.RetrieveTitle Card)
							    else NIL)))
				(OR Label (SETQ Label (AND (if (EQ LinkDisplayMode
									     (QUOTE FLOAT))
								     then 
								       NC.LinkIconShowLinkTypeFlg
								   else LinkDisplayMode)
								 (fetch (Link Label) of Link))))
				(SETQ LinkIconString (CONCAT (COND
								   (Label (CONCAT "<" Label ">"))
								   (T ""))
								 (COND
								   ((AND Label Title)
								     " ")
								   (T ""))
								 (OR Title ""))))

          (* * Make temporaries of scaled vars.)


		     (SETQ ScaledLinkIconMaxWidth (TIMES Scale NC.LinkIconMaxWidth))
		     (SETQ ScaledBorderWidth (TIMES Scale NC.LinkIconBorderWidth))
		     (SETQ ScaledSpaceInnerX (TIMES Scale NC.LinkIconSpaceInnerX))
		     (SETQ ScaledSpaceOuterX (TIMES Scale NC.LinkIconSpaceOuterX))
		     (SETQ ScaledSpaceInnerY (TIMES Scale NC.LinkIconSpaceInnerY))
		     (SETQ ScaledSpaceOuterY (TIMES Scale NC.LinkIconSpaceOuterY))
		     (SETQ ScaledSpaceInterLine (TIMES Scale NC.LinkIconSpaceInterLine))
		     (SETQ HalfScaledSpaceInterLine (IQUOTIENT ScaledSpaceInterLine 2))

          (* *)


		     (SETQ TotalEdgeSpaceY (PLUS ScaledBorderWidth ScaledSpaceOuterY 
						     ScaledSpaceInnerY))
		     (SETQ YSize (PLUS TotalEdgeSpaceY TotalEdgeSpaceY FontHeight))

          (* * Set up the icon, if displayed)


		     (if AttachBitmapFlg
			 then 

          (* * Attached icon)



          (* * Use an estimate of the width to tell if the box contains more than one line of text)


				(if NC.LinkIconMultiLineMode
				    then 

          (* * Multi-line link icons are enabled)


					   (SETQ ApproxBoxWidth (PLUS ScaledSpaceOuterX 
									  ScaledBorderWidth 
									  ScaledSpaceInnerX
									  (STRINGWIDTH 
										   LinkIconString 
											 Font)
									  ScaledSpaceInnerX 
									  ScaledBorderWidth 
									  ScaledSpaceOuterX))

          (* * The image box must be calculated)


					   (if (GREATERP ApproxBoxWidth ScaledLinkIconMaxWidth)
					       then        (* Calculate Multi-line icon)
						      (SETQ ScaledIconHeight
							(PLUS ScaledBorderWidth ScaledSpaceInnerY 
								FontHeight HalfScaledSpaceInterLine))
						      (SETQ Icon (NC.FetchLinkIconAttachedBitMap
							  Card ScaledIconHeight Scale))
						      (SETQ ScaledIconHeight (TIMES Scale
											(
										     BITMAPHEIGHT
											  Icon)))
						      (SETQ ScaledIconWidth (TIMES Scale
										       (BITMAPWIDTH
											 Icon)))
					     else          (* Calculate Single line icon)
						    (SETQ ScaledIconHeight
						      (PLUS ScaledBorderWidth ScaledSpaceInnerY 
							      FontHeight ScaledSpaceInnerY 
							      ScaledBorderWidth))
						    (SETQ Icon (NC.FetchLinkIconAttachedBitMap
							Card ScaledIconHeight Scale))
						    (SETQ ScaledIconHeight (TIMES Scale
										      (BITMAPHEIGHT
											Icon)))
						    (SETQ ScaledIconWidth (TIMES Scale
										     (BITMAPWIDTH
										       Icon)))

          (* * Now see if total width, including the icon, will still fit if this is a Single line)


						    (if (AND (NOT (STREQUAL LinkIconString "")
									)
								 (GREATERP (PLUS ApproxBoxWidth 
										  ScaledIconWidth)
									     ScaledLinkIconMaxWidth))
							then 
                                                             (* Now it doesn't fit. Calculate Multi-line icon)
							       (SETQ ScaledIconHeight
								 (PLUS ScaledBorderWidth 
									 ScaledSpaceInnerY FontHeight 
									 HalfScaledSpaceInterLine))
							       (SETQ Icon (
								   NC.FetchLinkIconAttachedBitMap
								   Card ScaledIconHeight Scale))
							       (SETQ ScaledIconHeight
								 (TIMES Scale (BITMAPHEIGHT
									    Icon)))
							       (SETQ ScaledIconWidth
								 (TIMES Scale (BITMAPWIDTH Icon)))
							  ))
				  else 

          (* * Multi-line link icons are disabled)


					 (SETQ ScaledIconHeight (PLUS ScaledBorderWidth 
									  ScaledSpaceInnerY 
									  FontHeight 
									  ScaledSpaceInnerY 
									  ScaledBorderWidth))
					 (SETQ Icon (NC.FetchLinkIconAttachedBitMap Card 
										 ScaledIconHeight 
											Scale))
					 (SETQ ScaledIconHeight (TIMES Scale (BITMAPHEIGHT
									     Icon)))
					 (SETQ ScaledIconWidth (TIMES Scale (BITMAPWIDTH Icon)))
				      )
		       else 

          (* * No attached icon)


			      (SETQ Icon NIL)
			      (SETQ ScaledIconHeight 0)
			      (SETQ ScaledIconWidth 0))

          (* * Now determine the actual size of the image box)


		     (if (AND Icon (GREATERP (PLUS ScaledIconWidth ScaledSpaceOuterX 
							   ScaledSpaceOuterX)
						   ScaledLinkIconMaxWidth))
			 then 

          (* If the width of the icon plus the outer x's is greater than the ScaledLinkIconMaxWidth set by the user, set the 
	  box width to ScaledLinkIconMaxWidth)


				(SETQ XSize ScaledLinkIconMaxWidth)
		       elseif (STREQUAL LinkIconString "")
			 then (if Icon
				    then                   (* There is no text to print, so the box width is just
							     the icon width plus the outer x on each side)
					   (SETQ XSize (PLUS ScaledIconWidth ScaledSpaceOuterX 
								 ScaledSpaceOuterX))
				  else 

          (* There is no text or Icon to print, so the box width is just the inner x, border width, and outer x on each side)


					 (SETQ XSize (PLUS ScaledSpaceInnerX ScaledSpaceInnerX 
							       ScaledBorderWidth ScaledBorderWidth 
							       ScaledSpaceOuterX ScaledSpaceOuterX)))
		       else                                (* Have the text parsed into separate lines)
			      (SETQ LinkIconStrings (NC.CreateLinkIconStrings Link LinkIconString 
										  Icon ImageStream))
			      (if LinkIconStrings
				  then (SETQ NumberOfLines (LENGTH LinkIconStrings))
					 (if (GREATERP NumberOfLines 1)
					     then (SETQ StringWidth (PLUS (STRINGWIDTH
										  (CAR 
										  LinkIconStrings)
										  Font)
										ScaledIconWidth))
                                                             (* Find the longest string for the width of the box)
						    (for String in (CDR LinkIconStrings)
						       bind PartStringWidth
						       when (GREATERP (SETQ PartStringWidth
									    (STRINGWIDTH String 
											   Font))
									  StringWidth)
						       do (SETQ StringWidth PartStringWidth))
						    (SETQ YSize (PLUS TotalEdgeSpaceY 
									  TotalEdgeSpaceY
									  (TIMES NumberOfLines 
										   FontHeight)
									  (TIMES (SUB1 
										    NumberOfLines)
										   
									     ScaledSpaceInterLine)))
					   else (SETQ StringWidth (PLUS (STRINGWIDTH
										(CAR 
										  LinkIconStrings)
										Font)
									      ScaledIconWidth)))
					 (SETQ XSize (MIN (PLUS StringWidth ScaledSpaceOuterX 
								      ScaledSpaceOuterX 
								      ScaledSpaceInnerX 
								      ScaledSpaceInnerX
								      (if Icon
									  then ScaledBorderWidth
									else (PLUS 
										ScaledBorderWidth 
										ScaledBorderWidth)))
							      (PLUS (TIMES Scale 
									   ScaledLinkIconMaxWidth)
								      ScaledSpaceOuterX 
								      ScaledSpaceOuterX)))))
		     (create IMAGEBOX
			       XSIZE ← XSize
			       YSIZE ← YSize
			       YDESC ←(COND
				 (RightMargin                (* This is in a TEdittextstream)
					      (PLUS (FONTDESCENT Font)
						      TotalEdgeSpaceY))
				 (T 0))
			       XKERN ← 0)))))
)
(PUTPROPS PMIPATCH019 COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (837 27833 (NC.LinkIconDisplayFn 847 . 15943) (NC.LinkIconImageBoxFn 15945 . 27831)))))
STOP