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

presentations



Ok, all you presentations wizards out there.  Since people seem to love
questions about simple concrete examples, I've composed some.

Consider

(defun 1test-1 0()
  (graphics:with-room-for-graphics (*standard-output* 100)
    (let ((outer (graphics:with-output-as-graphics-presentation
		   (*standard-output* :object 'foo :type 'sys:expression)
		   (graphics:draw-rectangle 0 0 100 100 :filled nil)
		   (let ((inner (graphics:with-output-as-graphics-presentation
				  (*standard-output* :object 'bar :type 'sys:expression)
				  (graphics:draw-rectangle 0 45 10 55))))
		     (sleep 1)
		     (graphics:erase-graphics-presentation inner)
		     (setq inner (graphics:with-output-as-graphics-presentation
				   (*standard-output* :object 'bar :type 'sys:expression)
				   (graphics:draw-rectangle 90 45 100
55))))))))))

When executed in a Lisp Listener dynamic window, this seems to work
correctly.  The little inner box moves from the left side of the outer
box to the right side.  Everything gets erased and incrementally redrawn
very neatly, and both the inner and outer boxes are mouse sensitive. 
Now, consider this 

(defun 1test-2 0()
  (graphics:with-room-for-graphics (*standard-output* 100)
    (let ((outer (graphics:with-output-as-graphics-presentation
		   (*standard-output* :object 'foo :type 'sys:expression)
		   (graphics:draw-rectangle 0 0 100 100 :filled nil)
		   (let ((inner (graphics:with-output-as-graphics-presentation
				  (*standard-output* :object 'bar :type 'sys:expression)
				  (graphics:draw-rectangle 0 45 10 55))))
		     (sleep 1)
		     (graphics:replacing-graphics-presentation (*standard-output* inner)
		       (graphics:draw-rectangle 90 45 100 55)))))))))

According to the document examiner, I would expect this to work even
better.  That is, less consing and "minimized flicker."  However, for
me, it leaves a munged image of the outer box.  Also, the inner box is
no longer individually selectable--moving the mouse over it causes both
boxes to be highlighted.

Now consider this.  This uses some undocumented code
(dw::displayed-presentation-add-inferior and (setf
(dw:presentation-superior inner) outer)).

(defun 1test-3 0()
  (graphics:with-room-for-graphics (*standard-output* 100)
    (let* ((outer (graphics:with-output-as-graphics-presentation
		    (*standard-output* :object 'foo :type 'sys:expression)
		    (graphics:draw-rectangle 0 0 100 100 :filled nil)))
	   (inner (graphics:with-output-as-graphics-presentation
		    (*standard-output* :object 'bar :type 'sys:expression)
		    (graphics:draw-rectangle 0 45 10 55))))
      (dw::displayed-presentation-add-inferior outer inner)
      (setf (dw:presentation-superior inner) outer)
      (sleep 1)
      (graphics:erase-graphics-presentation inner)
      (setq inner (graphics:with-output-as-graphics-presentation
		    (*standard-output* :object 'bar :type 'sys:expression)
		    (graphics:draw-rectangle 90 45 100 55)))
      (dw::displayed-presentation-add-inferior outer inner)
      (setf (dw:presentation-superior inner) outer))))

This one seems to work just fine, but if I move the mouse to where the
inner box used to be on the left, I get a ghost--the invisible
presentation highlights.  Does anybody know a technique that works like
this to add inferiors after the fact?  I'd like to use such a technique
to incrementally add, remove, and update inferiors.

  -- Paul Vaughan