CLIM mail archive

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

REPLAY-OUTPUT-RECORD question



    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)?

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))
	  ))))


Follow-Ups: References:

Main Index | Thread Index