CLIM mail archive

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

fancy higlighting of presentations



   Date: Mon, 14 Dec 92 16:45:48 EST
   From: jclose@potomac.ads.com (Jeff Close)
   Reply-To: jclose@ads.com

      Date: Mon, 14 Dec 1992 11:29-0500
      From: Bill Long <WJL@zermatt.lcs.mit.edu>

      Does anyone know how to make "highlighting" of presentations in the form
      of a cursor that tracks the pointer along the length of a presentation?
      I presume that tracking-pointer and highlight-applicable-presentation
      are involved, but lacking any examples of how they work, I am
      floundering.

      I am currently doing this in Clim 1.0 under Lucid, but should be able to
      upgrade if necessary.

   it sounds like (i'm not sure) you want to highlight a presentation
   such that the highlight is somewhat animated while the pres is
   highlighted -- perhaps a cursor following the cursor inside the
   highlight?  I don't know how you can do this with redefining
   clim:highlight-presentation, since I believe it is only called once
   (when the pres is scrolled on).  it sounds like you may have to use
   tracking pointer, check to see whether a presentation is highlighted,
   and draw a pointer-following glyph.  Is this occurring in some subset
   of the overall user activity?

Maybe you can build on the following:

(in-package :clim-user)

(defun track-em (win)
  (let (ox oy oleft otop oright obottom)
    (with-output-recording-options (win :record-p nil)
      (tracking-pointer (win)
        (:presentation (presentation x y) 
	  ;; Draw a cross-hair through the presentation
	  (with-bounding-rectangle* (left top right bottom) presentation
	    ;; First, erase last crosshair, if any;
	    (when ox
	      (draw-line* win oleft oy oright oy :ink +flipping-ink+)
	      (draw-line* win ox otop ox obottom :ink +flipping-ink+))
	    ;; Now draw this one
	    (draw-line* win left y right y :ink +flipping-ink+)
	    (draw-line* win x top x bottom :ink +flipping-ink+)
	    ;; remember where we drew it
	    (setq ox x oy y 
		  oleft left otop top
		  oright right obottom bottom)))
	(:pointer-motion ()
	  ;; If we move somewhere else, erase the crosshair
	  (when ox
	    (draw-line* win oleft oy oright oy :ink +flipping-ink+)
	    (draw-line* win ox otop ox obottom :ink +flipping-ink+)
	    (setq ox nil)))
	(:pointer-button-press ()
	  (when ox
	    (draw-line* win oleft oy oright oy :ink +flipping-ink+)
	    (draw-line* win ox otop ox obottom :ink +flipping-ink+)
	    (setq ox nil))
	  (return-from track-em))))))

(defun track-em-test (win)
  (window-clear win)
  ;; Put up a line and a circle
  (with-output-as-presentation (:stream win :object 5 :type 'integer)
    (draw-line* win 10 10 100 100))
  (with-output-as-presentation (:stream win :object 6 :type 'integer)
    (draw-circle* win 150 50 30))
  (force-output win)
  (track-em win)
  (force-output win))

0,,

References:

Main Index | Thread Index