Use overload by argument count for :cxx generic functions --> to head
src/mandelbrot/mandelbrotwidget.lisp
Sat Apr 3 19:19:09 CEST 2010 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Replace mudballs with ASDF and support the modular Smoke.
Sun May 24 23:29:56 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Work around null pointer for references bug
Fri Apr 17 17:30:05 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Use C++ style overload resolution.
Tue Apr 14 16:32:06 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* License
Sun Apr 12 15:34:59 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Use overload by argument count for :cxx generic functions
--- old-kde.examples/src/mandelbrot/mandelbrotwidget.lisp 2014-10-30 08:40:59.000000000 +0100
+++ new-kde.examples/src/mandelbrot/mandelbrotwidget.lisp 2014-10-30 08:40:59.000000000 +0100
@@ -1,5 +1,19 @@
-(in-package :kde.examples)
-(declaim (optimize (debug 3)))
+;;; Copyright (C) 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
+;;;
+;;; This program is free software: you can redistribute it and/or modify
+;;; it under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation, either version 3 of the License, or
+;;; (at your option) any later version.
+;;;
+;;; This program is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+(in-package :cl-smoke.kde.examples)
(defun zoom-in-factor ()
0.8)
@@ -38,8 +52,7 @@
qt:+queued-connection+))
(defun draw-rendering (painter widget)
- (cxx:set-pen painter (make-instance 'qt:color
- :args (list qt:+white+)))
+ (cxx:set-pen painter #xFFFFFF) ;; FIXME make qt:+white+ work
(cxx:draw-text painter (cxx:rect widget)
(value qt:+align-center+)
"Rendering initial image, please wait..."))
@@ -74,25 +87,23 @@
(pixmap widget))
(draw-scaled-pixmap painter widget)))
-(defmethod cxx:paint-event ((widget mandelbrotwidget) &rest args)
- (declare (ignore args))
+(defmethod cxx:paint-event ((widget mandelbrotwidget) event)
+ (declare (ignore event))
(qt:with-painter (painter widget)
(cxx:fill-rect painter (cxx:rect widget)
- (make-instance 'qt:brush :args (list
- (make-instance 'qt:color :args (list qt:+black+)))))
+ #x000) ;; FIXME qt:+black+
(if (null (pixmap widget))
(draw-rendering painter widget)
(draw-pixmap painter widget))))
-(defmethod cxx:resize-event ((widget mandelbrotwidget) &rest args)
- (declare (ignore args))
+(defmethod cxx:resize-event ((widget mandelbrotwidget) event)
+ (declare (ignore event))
(when (slot-boundp widget 'render)
(setf (stop-p *render-control*) t)
(join-thread (slot-value widget 'render)))
(queue-image widget))
-(defmethod cxx:key-press-event ((widget mandelbrotwidget) &rest args
- &aux (event (first args)))
+(defmethod cxx:key-press-event ((widget mandelbrotwidget) event)
(enum-cases (cxx:key event)
(qt:+key-up+
(scroll widget #C(0d0 -5d0)))
@@ -107,19 +118,17 @@
(qt:+key-minus+
(zoom widget (zoom-out-factor)))))
-(defmethod cxx:mouse-press-event ((widget mandelbrotwidget) &rest args
- &aux (event (first args)))
+(defmethod cxx:mouse-press-event ((widget mandelbrotwidget) event)
(when (enum= (cxx:button event) qt:+left-button+)
(setf (last-drag-pos widget) (complex (cxx:x event)
(cxx:y event)))))
-(defmethod cxx:wheel-event ((widget mandelbrotwidget) &rest args
- &aux (event (first args)))
+(defmethod cxx:wheel-event ((widget mandelbrotwidget) event)
(zoom widget (expt (zoom-in-factor) (/ (cxx:delta event) (* 8 15.0)))))
-(defmethod cxx:mouse-move-event ((widget mandelbrotwidget) &rest args
- &aux (event (first args)))
- (when (logand (cxx:buttons event) (value qt:+left-button+))
+(defmethod cxx:mouse-move-event ((widget mandelbrotwidget) event)
+ (when (and (logand (cxx:buttons event) (value qt:+left-button+))
+ (last-drag-pos widget))
(incf (pixmap-offset widget)
(- (complex (cxx:x event)
(cxx:y event))
@@ -128,8 +137,7 @@
(cxx:y event)))
(cxx:update widget)))
-(defmethod cxx:mouse-release-event ((widget mandelbrotwidget) &rest args
- &aux (event (first args)))
+(defmethod cxx:mouse-release-event ((widget mandelbrotwidget) event)
(when (enum= (cxx:button event) qt:+left-button+)
(incf (pixmap-offset widget)
(- (complex (cxx:x event)