CLIM mail archive

[Prev][Next][Index][Thread]

filling-output and cells



    Date: Mon, 5 Oct 1992 18:50 EDT
    From: Bill York <york%oakland-hills@lucid.com>

       Date: Fri, 2 Oct 92 19:09:04 EDT
       From: Clinton Hyde <chyde@chesapeake.ads.com>

       I'm trying to use filling-output inside a cell, and have the resulting
       text centered both x and Y. it appears not to be centering.

       anyway, I want the text exactly centered across multiple linebreaks,
       and the circle is to be centered with the text, as [very] roughly
       shown. i've used :align-x and :align-y with :centered.

       is this a bug?

    Well, it's not really a bug.  The :align options to formatting-cell
    say what to do with the contents of a cell that isn't as wide as the
    widest cell in the column.  That is, for a cell that doesn't fill all
    the space allocated for cells in that column, should we push the cell
    to the left, right or center of the column.

    What you want is for the individual filled lines that filling-output
    produces to be centered.  This feature would have to be added to
    filling output.

I agree that this feature is not unreasonable, but it would be very
difficult to modify FILLING-OUTPUT to do this, because FILLING-OUTPUT
only buffers a single line at a time.  I am reluctant to try to make
FILLING-OUTPUT do too much, because then people will start expecting
it to be more and more like a text formatter (don't laugh! people
wanted Dynamic Windows' FILLING-OUTPUT to be a text formatter).

    This modification of your code example should run stand-alone.
    Contrast:

    (print-patient-pp-data
      win 
      '(("long string one" "long string two" "long string three")
	("one" "two" "three"))
      :left)

    with:

    (print-patient-pp-data
      win 
      '(("long string one" "long string two" "long string three")
	("one" "two" "three"))
      :right)


    (DEFUN print-patient-pp-data (stream list-of-lists-of-strings
					 &optional (x-align :left))
      (window-clear stream)
      (clim:formatting-table (STREAM 
			       :inter-row-spacing 20
			       :equalize-column-widths t
			       :multiple-columns 6
			       :multiple-columns-inter-column-spacing '(50 :pixel))

	(dolist (row list-of-lists-of-strings)
	  (clim:formatting-row (STREAM)
	    (dolist (pp row)
	      (clim:formatting-cell (STREAM :align-x x-align :align-y :center)
		(clim:with-output-as-presentation (:object pp :stream stream :single-box t)
		  ;;now draw the circle...
		  (clim:draw-circle* stream 25 25 50
				     :filled t
				     :ink clim:+flipping-ink+
				     ))
		;;drawing the string MUST occur after the circle.
		;;now draw the text, inverting the bits over the rectangle and the circle.
		(clim:with-drawing-options (stream :ink clim:+flipping-ink+
						   )
		  (clim:with-text-family (:sans-serif stream)
		    (clim:filling-output (stream :fill-width '(100 :pixel))
					 (princ pp stream))
		    ))
		))
	    )))
      (force-output stream)
      )




0,,

References:

Main Index | Thread Index