Skip to content

Instantly share code, notes, and snippets.

@lokedhs
Created November 19, 2020 14:40
Show Gist options
  • Save lokedhs/6f6cb177f4d58a6941b2ae2fcf5b92ef to your computer and use it in GitHub Desktop.
Save lokedhs/6f6cb177f4d58a6941b2ae2fcf5b92ef to your computer and use it in GitHub Desktop.
#|
Here's the problem:
When the panel is initially created, all graphics are drawn correctly. In this simplified example
this means that there are two lines being drawn.
Next, I type a command in the interactor, which results in the REPAINT-ALL function being called again.
On the screen, only one of the lines is now drawn. The second one (the one inside the inner output record)
is inivisible, but I can make it appear by calling CLIM:REPAINT-SHEET.
|#
;;; The main panel is created like this
(defun create-panel ()
(clim:make-clim-stream-pane :type 'canvas-pane
:name name
:default-view +canvas-view+
:display-function 'repaint-all
:incremental-redisplay nil
:display-time t
:borders t))
;;; This is the relevant part of the redraw function
(defun repaint-all ()
(let ((obj ...)) ;; An object that should be drawn on the pane
(clim:with-output-as-presentation (pane obj (clim:presentation-type-of obj)
:view (clim:stream-default-view pane)
:allow-sensitive-inferiors t
:single-box t
:record-type 'canvas-object-record)
(let ((rec (clim:with-output-to-output-record (pane 'canvas-object-record-inner)
;; This is where all the real drawing takes place. I've replaced it with a
;; single call to DRAW-LINE for simplicity
;; This line becomes invisible
(clim:draw-line* pane 10 10 20 20)))
;; This line is still visible
(clim:draw-line* pane 0 0 100 50)
(clim:stream-add-output-record pane rec)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment