(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP")
(FILECREATED " 3-Feb-88 11:34:35" {QV}<NOTECARDS>1.3LNEXT>PMIPATCH082.;2 32469  

      changes to%:  (FNS NC.DrawLinkOrPointerIcon)
                    (VARS PMIPATCH082COMS)

      previous date%: " 3-Feb-88 11:21:09" {QV}<NOTECARDS>1.3LNEXT>PMIPATCH082.;1)


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

(PRETTYCOMPRINT PMIPATCH082COMS)

(RPAQQ PMIPATCH082COMS (

(* ;;; "pmi 2/3/88: This patch reinstates a couple of changes made by RHT which I lost somehow.")

                        (DECLARE%: DONTCOPY (PROPS (PMIPATCH082 MAKEFILE-ENVIRONMENT)
                                                   (PMIPATCH082 FILETYPE)))
                        
          
          (* ;; "Changed in NCLINKS")

                        (FNS NC.ComputeLinkOrPointerImageBox NC.DrawLinkOrPointerIcon)))



(* ;;; "pmi 2/3/88: This patch reinstates a couple of changes made by RHT which I lost somehow.")

(DECLARE%: DONTCOPY 

(PUTPROPS PMIPATCH082 MAKEFILE-ENVIRONMENT (:PACKAGE "INTERLISP" :READTABLE "INTERLISP"))

(PUTPROPS PMIPATCH082 FILETYPE :BCOMPL)
)



(* ;; "Changed in NCLINKS")

(DEFINEQ

(NC.ComputeLinkOrPointerImageBox
  [LAMBDA (ImageStream LinkIconString AttachBitmapFlg Card RightMargin BorderWidthIncrement)
                                                             (* ; "Edited  3-Feb-88 10:56 by pmi")
          
          (* ;; "Compute the size of the image box needed to print a link or pointer icon.")
          
          (* ;; "pmi 11/3/87: Added ability to print new cross-file link icon, with bitmap attached to right side of link icon.")
          
          (* ;; " rht 1/21/88: Now takes extra BorderWidthIncrement argument which gets added in to calc of ScaledBorderWidth.")
          
          (* ;; "pmi 2/3/88: Did minor tweak to various things.  Added MultiLineIconFlg, which is set when we have boundary condition of title fitting on one line ONLY if we use the multi-line attached bitmap.")

    (DECLARE (GLOBALVARS NC.LinkIconMultiLineMode NC.LinkIconMaxWidth NC.LinkIconBorderWidth 
                    NC.LinkIconSpaceInnerX NC.LinkIconSpaceOuterX NC.LinkIconSpaceInnerY 
                    NC.LinkIconSpaceOuterY NC.LinkIconSpaceInterLine))
    (LET ((Scale (DSPSCALE NIL ImageStream))
          (BoxWidth 0)
          (Font (DSPFONT NIL ImageStream))
          CrossFileLinkFlg CrossFileLinkDestCard ActualCard Icon SavedIcon CrossFileLinkIcon 
          FontHeight ApproxBoxWidth MultiLineIconFlg LinkIconStrings ScaledIconHeight ScaledIconWidth 
          NumberOfLines XSize YSize ScaledLinkIconMaxWidth ScaledBorderWidth ScaledSpaceInnerX 
          ScaledSpaceOuterX ScaledSpaceInnerY ScaledSpaceOuterY ScaledSpaceInterLine 
          HalfScaledSpaceInterLine TotalEdgeSpaceY)
          
          (* ;; "FONTHEIGHT doesn't give us the maximum possilbe height of a font, so use (PLUS FontDescent FontAscent) instead.")

         (SETQ FontHeight (PLUS (FONTDESCENT Font)
                                (FONTASCENT Font)))
          
          (* ;; "Make temporaries of scaled vars.")

         (SETQ ScaledLinkIconMaxWidth (TIMES Scale NC.LinkIconMaxWidth))
         (SETQ ScaledBorderWidth (TIMES Scale (PLUS (OR (NUMBERP BorderWidthIncrement)
                                                        0)
                                                    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")
          
          (* ;; "Check to see if this link points to a card in another notefile.")

                  (if (EQ (NCP.CardType Card)
                          'CrossFileLink)
                      then (SETQ CrossFileLinkFlg T)
                           (if (SETQ CrossFileLinkDestCard (NCP.GetCrossFileLinkDestCard Card NIL T))
                               then (SETQ ActualCard CrossFileLinkDestCard)
                             else (SETQ ActualCard NIL))
                    else (SETQ CrossFileLinkFlg NIL)
                         (SETQ ActualCard Card)) 
          
          (* ;; "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 ScaledSpaceInnerX (STRINGWIDTH LinkIconString 
                                                                               Font)
                                                      ScaledSpaceInnerX)) 
          
          (* ;; "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 ActualCard 
                                                      ScaledIconHeight Scale))
                                    (SETQ SavedIcon Icon)
                                    (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 ActualCard 
                                                    ScaledIconHeight Scale))
                                  (SETQ SavedIcon Icon)
                                  (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
                                                           (if CrossFileLinkFlg
                                                               then ScaledIconWidth
                                                             else ScaledBorderWidth))
                                                  ScaledLinkIconMaxWidth))
                                      then 
          
          (* ;; "Now it doesn't fit.  Calculate Multi-line icon ")

                                           (SETQ MultiLineIconFlg T)
                                           (SETQ ScaledIconHeight (PLUS ScaledBorderWidth 
                                                                        ScaledSpaceInnerY FontHeight 
                                                                        HalfScaledSpaceInterLine))
                                           (SETQ Icon (NC.FetchLinkIconAttachedBitMap ActualCard 
                                                             ScaledIconHeight Scale))
                                           (SETQ SavedIcon (NC.FetchLinkIconAttachedBitMap
                                                            ActualCard
                                                            (PLUS ScaledBorderWidth ScaledSpaceInnerY 
                                                                  FontHeight ScaledSpaceInnerY 
                                                                  ScaledBorderWidth)
                                                            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 ActualCard ScaledIconHeight Scale
                                           ))
                         (SETQ SavedIcon Icon)
                         (SETQ ScaledIconHeight (TIMES Scale (BITMAPHEIGHT Icon)))
                         (SETQ ScaledIconWidth (TIMES Scale (BITMAPWIDTH Icon]
                  (SETQ CrossFileLinkIcon (if CrossFileLinkFlg
                                              then (NC.FetchCrossFileLinkIconAttachedBitMap Card 
                                                          CrossFileLinkDestCard ScaledIconHeight 
                                                          Scale)
                                            else NIL))
           else 
          
          (* ;; "No attached icon")

                (SETQ Icon NIL)
                (SETQ SavedIcon Icon)
                (SETQ CrossFileLinkIcon NIL)
                (SETQ ScaledIconHeight 0)
                (SETQ ScaledIconWidth 0))
          
          (* ;; "Now determine the actual size of the image box")

         [if (AND Icon (GREATERP (PLUS ScaledSpaceInnerX ScaledSpaceInnerX ScaledIconWidth
                                       (if CrossFileLinkIcon
                                           then ScaledIconWidth
                                         else ScaledBorderWidth))
                              ScaledLinkIconMaxWidth))
             then 
          
          (* ;; "If the width of the icon plus the width of the cross-file link icon (if any) plus the inner x's is greater than the ScaledLinkIconMaxWidth set by the user, set the box width to ScaledLinkIconMaxWidth plus the width of the outer x's.")

                  (SETQ XSize (PLUS ScaledSpaceOuterX ScaledSpaceOuterX ScaledLinkIconMaxWidth))
           elseif (ZEROP (NCHARS LinkIconString))
             then (if Icon
                      then 
          
          (* ;; "There is no text to print, so the box width is just the icon width plus the width of the cross-file link icon (if any) plus the outer x on each side")

                           (SETQ XSize (PLUS ScaledSpaceOuterX ScaledSpaceOuterX ScaledIconWidth
                                             (if CrossFileLinkIcon
                                                 then ScaledIconWidth
                                               else ScaledBorderWidth)))
                    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 LinkIconString Icon CrossFileLinkIcon 
                                             ImageStream))
                (if LinkIconStrings
                    then (SETQ NumberOfLines (LENGTH LinkIconStrings))
                         [if (GREATERP NumberOfLines 1)
                             then (SETQ BoxWidth (PLUS (STRINGWIDTH (CAR LinkIconStrings)
                                                              Font)
                                                       (if Icon
                                                           then ScaledIconWidth
                                                         else ScaledBorderWidth)
                                                       (if CrossFileLinkIcon
                                                           then ScaledIconWidth
                                                         else ScaledBorderWidth))) 
          
          (* ;; "Find the longest string for the width of the box")

                                  (for String in (CDR LinkIconStrings) bind PartStringWidth
                                     when (GREATERP (SETQ PartStringWidth (PLUS (STRINGWIDTH String 
                                                                                       Font)
                                                                                ScaledBorderWidth 
                                                                                ScaledBorderWidth))
                                                 BoxWidth) do (SETQ BoxWidth PartStringWidth))
                                  (SETQ YSize (PLUS TotalEdgeSpaceY TotalEdgeSpaceY (TIMES 
                                                                                        NumberOfLines 
                                                                                           FontHeight
                                                                                           )
                                                    (TIMES (SUB1 NumberOfLines)
                                                           ScaledSpaceInterLine)))
                           else 
          
          (* ;; "It's possible to have a string that won't fit on one line with a single line icon, but will fit if we use the multi-line icon.  In this case, we have to fool it into thinking it has another line.")

                                [if (AND MultiLineIconFlg (EQ NumberOfLines 1))
                                    then (SETQ NumberOfLines (ADD1 NumberOfLines))
                                         (SETQ YSize (PLUS TotalEdgeSpaceY TotalEdgeSpaceY
                                                           (TIMES NumberOfLines FontHeight)
                                                           (TIMES (SUB1 NumberOfLines)
                                                                  ScaledSpaceInterLine]
                                (SETQ BoxWidth (PLUS (STRINGWIDTH (CAR LinkIconStrings)
                                                            Font)
                                                     (if Icon
                                                         then ScaledIconWidth
                                                       else ScaledBorderWidth)
                                                     (if CrossFileLinkIcon
                                                         then ScaledIconWidth
                                                       else ScaledBorderWidth]
                         (SETQ XSize (MIN (PLUS BoxWidth ScaledSpaceOuterX ScaledSpaceOuterX 
                                                ScaledSpaceInnerX ScaledSpaceInnerX)
                                          (PLUS 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])

(NC.DrawLinkOrPointerIcon
  [LAMBDA (ImageStream ImageBox LinkIconString AttachBitmapFlg Card PointerStyleFlg 
                 BorderWidthIncrement)                       (* ; "Edited  3-Feb-88 11:33 by pmi")
          
          (* ;; "Draw the icon representing either a link or a pointer object.")
          
          (* ;; "pmi 11/3/87: Added ability to print new cross-file link icon, with bitmap attached to right side of link icon.")
          
          (* ;; " rht 1/21/88: Now takes extra BorderWidthIncrement argument which gets added in to calc of ScaledBorderWidth.")
          
          (* ;; "pmi 2/3/88: Did minor tweak to part that notices that the icon(s) won't fit in the width defined by NC.LinkIconMaxWidth.  Added MultiLineIconFlg, which is set when we have boundary condition of title fitting on one line ONLY if we use the multi-line attached bitmap.")

    (DECLARE (GLOBALVARS NC.LinkIconMultiLineMode NC.LinkIconMaxWidth NC.LinkIconSpaceInnerX 
                    NC.LinkIconSpaceOuterX NC.LinkIconSpaceInnerY NC.LinkIconSpaceOuterY 
                    NC.LinkIconSpaceInterLine NC.LinkIconBorderWidth NC.PointerIconDashingStyle))
    (PROG ((Scale (DSPSCALE NIL ImageStream))
           (Font (DSPFONT NIL ImageStream))
           Dashing FontDescent FontAscent FontHeight Left Bottom Top CrossFileLinkFlg 
           CrossFileLinkDestCard ActualCard Icon SavedIcon CrossFileLinkIcon LinkIconStrings 
           ApproxBoxWidth ApproxBoxHeight MultiLineIconFlg BoxWidth BoxHeight ScaledIconHeight 
           ScaledIconWidth XPosition ScaledLinkIconMaxWidth ScaledBorderWidth ScaledSpaceInnerX 
           ScaledSpaceOuterX ScaledSpaceInnerY ScaledSpaceOuterY ScaledSpaceInterLine 
           HalfScaledSpaceInterLine BottomOfLine)
          
          (* ;; "Make temporaries of scaled variables")

          (SETQ ScaledLinkIconMaxWidth (TIMES Scale NC.LinkIconMaxWidth))
          (SETQ ScaledBorderWidth (TIMES Scale (PLUS (OR (NUMBERP BorderWidthIncrement)
                                                         0)
                                                     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 FontDescent (FONTDESCENT Font))
          (SETQ FontAscent (FONTASCENT Font))
          
          (* ;; 
          "Force recalculation of this link icon's image box if a BorderWidthIncrement is provided.")

          (if (NUMBERP BorderWidthIncrement)
              then (NC.ComputeLinkOrPointerImageBox ImageStream LinkIconString AttachBitmapFlg Card 
                          BorderWidthIncrement))
          
          (* ;; "FONTHEIGHT doesn't give us the maximum possilbe height of a font, so use (PLUS FontDescent FontAscent) instead.")

          (SETQ FontHeight (PLUS FontDescent FontAscent))
          
          (* ;; "Indicate Pointer vs Link using dashing style.")

          (if PointerStyleFlg
              then (SETQ Dashing NC.PointerIconDashingStyle))
          
          (* ;; "Set up the icon, if displayed")

          (if AttachBitmapFlg
              then 
          
          (* ;; "Attached icon")
          
          (* ;; "Check to see if this link points to a card in another notefile.")

                   (if (EQ (NCP.CardType Card)
                           'CrossFileLink)
                       then (SETQ CrossFileLinkFlg T)
                            (if (SETQ CrossFileLinkDestCard (NCP.GetCrossFileLinkDestCard Card NIL T)
                                 )
                                then (SETQ ActualCard CrossFileLinkDestCard)
                              else (SETQ ActualCard NIL))
                     else (SETQ CrossFileLinkFlg NIL)
                          (SETQ ActualCard Card)) 
          
          (* ;; 
     "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)) 
          
          (* ;; 
       "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 MultiLineIconFlg T)
                                     (SETQ ScaledIconHeight (PLUS ScaledBorderWidth ScaledSpaceInnerY 
                                                                  FontHeight HalfScaledSpaceInterLine
                                                                  ))
                                     (SETQ Icon (NC.FetchLinkIconAttachedBitMap ActualCard 
                                                       ScaledIconHeight Scale))
                                     (SETQ SavedIcon (NC.FetchLinkIconAttachedBitMap ActualCard
                                                            (PLUS ScaledBorderWidth ScaledSpaceInnerY 
                                                                  FontHeight ScaledSpaceInnerY 
                                                                  ScaledBorderWidth)
                                                            Scale))
                              else 
          
          (* ;; "Calculate height for Single line icon")

                                   (SETQ ScaledIconHeight (PLUS ScaledBorderWidth ScaledSpaceInnerY 
                                                                FontHeight ScaledSpaceInnerY 
                                                                ScaledBorderWidth))
                                   (SETQ Icon (NC.FetchLinkIconAttachedBitMap ActualCard 
                                                     ScaledIconHeight Scale))
                                   (SETQ SavedIcon Icon))
                            (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 ActualCard ScaledIconHeight 
                                            Scale))
                          (SETQ SavedIcon Icon)
                          (SETQ ScaledIconHeight (TIMES Scale (BITMAPHEIGHT Icon)))
                          (SETQ ScaledIconWidth (TIMES Scale (BITMAPWIDTH Icon]
                   (SETQ CrossFileLinkIcon (if CrossFileLinkFlg
                                               then (NC.FetchCrossFileLinkIconAttachedBitMap Card 
                                                           CrossFileLinkDestCard ScaledIconHeight 
                                                           Scale)
                                             else NIL))
            else 
          
          (* ;; "No attached icon")

                 (SETQ Icon NIL)
                 (SETQ SavedIcon Icon)
                 (SETQ CrossFileLinkIcon NIL)
                 (SETQ ScaledIconHeight 0)
                 (SETQ ScaledIconWidth 0))
          
          (* ;; "Now determine the text to be printed")

          (if (AND Icon (GREATERP (PLUS ScaledSpaceInnerX ScaledSpaceInnerX ScaledIconWidth
                                        (if CrossFileLinkIcon
                                            then ScaledIconWidth
                                          else ScaledBorderWidth))
                               ScaledLinkIconMaxWidth))
              then 
          
          (* ;; "If the width of the icon(s)/borders plus the inner x's is greater than the ScaledLinkIconMaxWidth set by the user, set the icons and text to NIL")

                   (SETQ Icon NIL)
                   (SETQ SavedIcon Icon)
                   (SETQ CrossFileLinkIcon 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 LinkIconString Icon 
                                              CrossFileLinkIcon ImageStream)))
          
          (* ;; "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 (if CrossFileLinkIcon
                                       then ScaledIconWidth
                                     else ScaledBorderWidth)
                                   ScaledIconWidth ScaledSpaceInnerX ScaledSpaceInnerX)
                             ScaledLinkIconMaxWidth))
              then 
          
          (* ;; "Put out the icon bitmap, but only if the width of the icon(s)/borders plus the inner 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 (ZEROP (NCHARS LinkIconString))
                       then 
          
          (* ;; "Display the cross-file link icon, if necessary")

                            (if CrossFileLinkIcon
                                then (BITBLT CrossFileLinkIcon 0 0 ImageStream
                                            (DIFFERENCE (PLUS Left BoxWidth)
                                                   ScaledIconWidth)
                                            (DIFFERENCE Top ScaledIconHeight))) 
          
          (* ;; "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)
          (if LinkIconStrings
              then (if (OR (GREATERP (LENGTH LinkIconStrings)
                                  1)
                           MultiLineIconFlg)
                       then (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 for multiple lines of text.")

                            (NC.DrawInnerBox Left Bottom BoxWidth BoxHeight ScaledBorderWidth NIL 
                                   ImageStream Dashing Icon CrossFileLinkIcon ScaledIconWidth 
                                   ScaledIconHeight)
                     else (DSPYPOSITION (PLUS Bottom ScaledBorderWidth ScaledSpaceInnerY FontDescent)
                                 ImageStream)
                          (PRIN1 (CAR LinkIconStrings)
                                 ImageStream) 
          
          (* ;; "Draw the box for a single line of text.")

                          (NC.DrawInnerBox (PLUS Left ScaledIconWidth)
                                 Bottom
                                 (DIFFERENCE BoxWidth (if CrossFileLinkIcon
                                                          then (PLUS ScaledIconWidth ScaledIconWidth)
                                                        else ScaledIconWidth))
                                 BoxHeight ScaledBorderWidth NIL ImageStream Dashing Icon 
                                 CrossFileLinkIcon)))
          
          (* ;; "Display the cross-file link icon, if necessary")

          (if CrossFileLinkIcon
              then (BITBLT CrossFileLinkIcon 0 0 ImageStream (DIFFERENCE (PLUS Left BoxWidth)
                                                                    ScaledIconWidth)
                          (DIFFERENCE Top ScaledIconHeight])
)
(PUTPROPS PMIPATCH082 COPYRIGHT ("Xerox Corporation" 1988))
(DECLARE%: DONTCOPY
  (FILEMAP (NIL (1205 32386 (NC.ComputeLinkOrPointerImageBox 1215 . 16765) (NC.DrawLinkOrPointerIcon 
16767 . 32384)))))
STOP