CLIM mail archive

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

REPLAY-OUTPUT-RECORD question



    Date: Fri, 1 Jul 1994 07:41 PDT
    From: Scott McKay <swm@harlequin.com>

       Date: Thu, 30 Jun 1994 16:41-0700
       From: Gregory M Anderson <gma@BITTERROOT.apl.washington.edu>

	   Date: Thu, 30 Jun 1994 11:00 PDT
	   From: Scott McKay <swm@harlequin.com>

	      Date: Thu, 30 Jun 1994 09:54-0700
	      From: Gregory M Anderson <gma@bitterroot.apl.washington.edu>

		  Date: Wed, 29 Jun 1994 18:31 PDT
		  From: rdp@netcom.com (Robert Pfeiffer)

		      Date: Wed, 29 Jun 1994 16:37 PDT
		      From: Gregory M Anderson <gma@BITTERROOT.apl.washington.edu>

		      Did you ever get an answer to your question?  I've been wondering
		      the same thing, and have some thoughts, but no answers.
		      Maybe we could bash heads

		  Unfortunately, no answer has been forthcoming. I'm  still optimistic that
		  someone will provide a simple solution to this. It just can't be that
		  difficult, can it?

	      Well, I'm not sure, but I do know that I tried several unsuccessful methods.

	      I've looked at the output record contents, and I don't think that output records 
	      have enough information to be able change their color, shape, and so on.  I believe
	      the presentation is required.  So I tried erasing the output record (no problem)
	      and drawing a new one in its place (again no problem), but I can't seem to get
	      the new record to replace the old correctly in the history, and redisplays break
	      on (the new?) output record.  

	      To implement this, I stored the original output record in the objects being presented using

	      (setf (output-record object)
		      (UPDATING-OUTPUT (stream :unique-id object :cache-value (color color))
				       (present object 'type :stream stream))

	      I used the following to erase the record:

		  (erase-output-record (output-record object) stream)
		  ;; not sure whether or not to use this 
		  ;; (delete-output-record (output-record object) parent)

	      Here is where it gets fuzzy, candidates I've tried to get new the record displayed are:

		(present object 'type:stream stream)
		(redisplay (output-record object) stream)
		(replay-output-record (output-record object) stream)

	      So I'm stuck.

	   I would have done this to create the record

	    (setf (output-record object)
		  (updating-output (stream)
		    (updating-output (stream :unique-id object :cache-value (color color))
		      (present object 'type :stream stream))))

	   and then simply used REDISPLAY on the cached record.

	   You don't need to dink around with erasing or replaying.

       1) What is the purpose of the outer updating-output (stream)?

    It's subtle, but if you reread the documentation on incremental
    redisplay carefully, you'll see that we attempted to describe this.
    The outermost call in UPDATING-OUTPUT is special in that it indicates
    that inner output records are subject to redisplay.  Inner calls to
    UPDATING-OUTPUT indicate "cache points" so that incremental redisplay
    can work more efficiently.  So if you want to use REDISPLAY and have
    it work well, you really need at least two levels of calls to
    UPDATING-OUTPUT.  Dynamic Windows used the extra macro REDISPLAYER (I
    think it was called that) to achieve the same thing.

Right, I have an :incremental-redisplay t in the pane definition, and that 
supplies the outermost updating-output, does it not?  So why do you save the
output of the outer updating-output, instead of the inner one, i.e.
	  (updating-output (stream)
	    (setf (output-record object)
		    (updating-output (stream :unique-id object :cache-value (color color))
		      (present object 'type :stream stream))))
In my application the updating-output forms you are are seeing are inside other 
updating-outputs.  

If you get a chance, I would appreciate your insights into the following question
as well.

       2) I finally deduced that replay reruns the appropriate presentation method
	  but I can't figure out how to get the presentation method to redraw the
	  record in the right place.  At first I didn't have the test for (output-record spot),
	  and that didn't work.  So I've been trying to find out what the position is without
	  success.  This is what I have so far:

       (loop for beam fixnum from 0 below (elt (array-dimensions data) 0)
	  do
	 (loop for sector fixnum from 0 below (elt (array-dimensions data) 1)
	       for spot = (aref data beam sector)
	    do
	   (setf
	       (beam spot) beam
	       (sector spot) sector
	       (output-record spot)
		  (UPDATING-OUTPUT (stream)
		     (UPDATING-OUTPUT (stream :unique-id spot :cache-value (color spot))
		       (present spot `((spot) :size ,cell-size) :stream stream :view +data-navigator-view+))))))



       (define-presentation-method present
				   (spot (type spot) stream
					 (view data-navigator-view) &key)
	 ;; Note, size is a spot presentation type option, and is bound within the present
	 (with-slots (beam sector color) spot
	   (let ((dx (/ size 2))
		 (dy (/ size 2)))
	     (if (output-record spot)

		 (with-slots (clim-utils::left clim-utils::top clim-utils::right clim-utils::bottom) (output-record spot)
		   (multiple-value-bind (xoff yoff)
		       (convert-from-relative-to-absolute-coordinates stream (output-record-parent (output-record spot)))
		     (with-translation (stream xoff yoff)
		   (draw-rectangle* stream clim-utils::left clim-utils::top clim-utils::right clim-utils::bottom :filled t :ink color))))

		 (with-translation (stream (* beam size) (* sector size))
		   (draw-rectangle* stream (- dx) (- dy) dx dy :filled t :ink color))
		 ))))


References:

Main Index | Thread Index