Fix with-painter
Annotate for file src/painter.lisp
2010-01-10 tobias 1 (in-package :cl-smoke.qt.gui)
2009-04-05 tobias 2
2010-01-23 tobias 3 (defmacro qt:with-painter ((painter &optional paint-device) &body body)
2009-04-05 tobias 4 "Binds a PAINTER instance for PAINT-DEVICE to PAINTER
2010-01-23 tobias 5 during the evaluation of BODY. Or when PAINT-DEVICE is not
19:48:00 ' 6 specified, saves and restored the state of PAINTER around BODY.
2009-04-05 tobias 7
2009-07-01 tobias 8 Makes sure the painter ends after BODY; thus preventing problems with
2009-07-22 tobias 9 still active and not yet garbage collected painters in CXX:PAINT-EVENT."
2010-01-25 tobias 10 (if paint-device
18:50:16 ' 11 `(let ((,painter (make-instance 'qt:painter :arg0 ,paint-device)))
' 12 (assert (cxx:is-active ,painter)
' 13 (,painter)
' 14 "Painter ~A for ~A is not active"
' 15 ,painter ,paint-device)
' 16 (unwind-protect
' 17 (progn ,@body)
' 18 (cxx:end ,painter)))
' 19 `(progn (cxx:save ,painter)
' 20 (unwind-protect
' 21 (progn ,@body)
' 22 (cxx:restore ,painter)))))