[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
simple (?!) redisplay question
- To: slug@Warbucks.AI.SRI.COM
- Subject: simple (?!) redisplay question
- From: maglio%cogsci@ucsd.edu (Paul Maglio)
- Date: Wed, 27 Jun 1990 14:52:00 -0400
- Character-type-mappings: (1 0 (NIL 0) (SAGE:SANS-SERIF-BODY SAGE::TYPEWRITER :NORMAL) "CPTFONT")
- Fonts: CPTFONT, CPTFONT
Suppose I have a program framework with several configurations.
Suppose each configuration has a bunch of display panes, each of
which do incremental redisplay. Suppose each pane's displayer
carefully creates redisplay cache's using
dw:with-redisplayable-output.
The question is, why---when I switch configurations---do all my
presentations blink? I understand that it does redisplay in
several passes, but why does it erase and then redisplay each
object? Perhaps I'm doing something wrong. If I had sources I
could tell better. (I am running Genera 7.4 on a MacIvory).
Below is a simple example adapted from the documentation on
redisplay. If you wanna take a few seconds to see what I'm
talking about, wipe it into a buffer, compile it, and
select-<circle>. Click in the main window a few times to draw
some circles, then click on `other configuration.' Now click on
`other configuration' again. All the circles appear, then they
disappear, then they're back. For complex configurations with
lotsa panes, this blinking is quite a loss. What am I missing?
Thanks.
-Paul
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; -*- Mode: LISP; Syntax: Common-lisp; Package: USER; Base: 10 -*-
1(dw:define-program-framework circles
0 1:command-definer t
0 :select-key #\circle
1:command-table (:inherit-from nil
0 1:kbd-accelerator-p t)
0 1:top-level 0(circle-top-level)
1:panes ((display :display
0 1:redisplay-function 'draw-circles0-main1
0 1:incremental-redisplay t)
0 (listener :interactor)
1(menu :command-menu)
0(other 1:display
0 1:redisplay-function0 1'draw-circles0-other
1:incremental-redisplay0 1t)0)
1:state-variables ((circles 0(list (list 'main) (list 'random))))
1 0:configurations
1 0'((main (:layout (main :column 1display0 1menu0 listener))
1 0(:sizes (main (menu :ask-window scl::self :size-for-pane menu)
(listener 1 :lines)
:then (display :even))))
(random (:layout (random :column other 1menu0 listener))
(:sizes (random (menu :ask-window scl::self :size-for-pane menu)
(listener 1 :lines)
:then (other :even)))))
:configuration 'main)
(defun circle-top-level (instance)
(sys:standard-value-let ((lisp:*package* (find-package 'user)))
1(dw:default-command-top-level 0instance1)0))
1(defstruct circle
0 1center-x
0 1center-y
0 1radius)
0(defmacro circles-of (config)
`(second (find ,config 1circles0 :key #'first1)0))
(defmacro circle-alist (config)
`(find ,config 1circles0 :key #'first))
1(defmethod (draw-circles0-main1 circles) (stream)
0 1(dolist (circle 0(circles-of 'main))
1(dw:with-redisplayable-output
0 1(:unique-id circle :stream stream0 1:cache-value t)
0 1(dw:with-output-as-presentation
0 1(:object circle :type 'circle :stream stream)
0 1(graphics:draw-circle
0 1(circle-center-x circle) (circle-center-y circle)
0 1(circle-radius circle)
:stream stream)))))
(defmethod (draw-circles0-other1 circles) (stream)
0 1(dolist (circle 0(circles-of 'random))
1(dw:with-redisplayable-output
0 1(:unique-id circle :stream stream :cache-value t)
0 1(dw:with-output-as-presentation
0 1(:object circle :type 'circle :stream stream)
0 1(graphics:draw-circle
0 1(circle-center-x circle) (circle-center-y circle)
0 1(circle-radius circle)
:stream stream)))))
0
1(define-circles-command (com-delete-circle )
0 1((circle 'circle))
0 (let ((config (send (dw:program-frame dw:*program*) :configuration)))
1(set0f1 circles 0(list (circle-alist (other-config config))
(list config 1(delete circle 0(circles-of config1)0)1))0)))
(1define-circles-command0 (com-other-configuration 1:menu-accelerator0 t)
()
(let ((config (send (dw:program-frame dw:*program*) :configuration)))
(dw:set-program-frame-configuration (other-config config))))
(defun other-config (config)
(if (eq config 'main) 'random 'main))
1(define-presentation-to-command-translator0 1delete-this-circle
(circle)
(circle)
0 1`(com-delete-circle ,circle))
(define-circles-command (com-add-circle)
0 1((x 'number :default 100)
0 1(y 'number :default 100)
0 1(radius 'number :default 50))
0 (let ((config (send (dw:program-frame dw:*program*) :configuration)))
1(set0f1 circles 0(list (circle-alist (other-config config))
(list config (nconc (list 1(make-circle :center-x x
0 1:center-y y
0 1:radius radius)0)
(circles-of config1))0)))))
1(define-presentation-to-command-translator add-circle-here
0 1(dw:no-type0 1:documentation "Add a circle here.")
0 1(ignore &key x y)
0 1`(com-add-circle ,x ,y))
(define-circles-command (com-delete-all-circles :menu-accelerator t)
0 1()
0 1(set0f1 circles 0(list (list 'main) (list 'random)1))0)
1(compile-flavor-methods circles)
0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;