[graphic-forms-cvs] r109 - in trunk: . docs/manual src/demos/unblocked src/tests/uitoolkit src/uitoolkit/widgets

Author: junrue Date: Wed Apr 26 12:14:57 2006 New Revision: 109 Modified: trunk/README.txt trunk/docs/manual/api.texinfo trunk/src/demos/unblocked/unblocked-window.lisp trunk/src/tests/uitoolkit/event-tester.lisp trunk/src/uitoolkit/widgets/timer.lisp trunk/src/uitoolkit/widgets/widget-generics.lisp Log: made API change for timers -- use existing enable generic function instead of start/stop; miscellaneous doc updates Modified: trunk/README.txt ============================================================================== --- trunk/README.txt (original) +++ trunk/README.txt Wed Apr 26 12:14:57 2006 @@ -34,6 +34,12 @@ http://www.cs.northwestern.edu/academics/courses/325/readings/lisp-unit.html +Supported Common Lisp Implementations +------------------------------------- + +Graphic-Forms currently supports CLISP 2.38 and LispWorks 4.4.6. + + Known Problems -------------- @@ -46,7 +52,7 @@ http://sourceforge.net/tracker/index.php?func=detail&aid=1463994&group_id=1355&atid=101355 may result in intermittent GPFs when windows with layout managers are - resized or when timer objects are initialized. + resized or when timer objects are enabled. 2. Image loading currently requires installation of the ImageMagick library as described in the next section. I have tested with Windows @@ -60,10 +66,12 @@ not get disabled. However, the GFW:ENABLE function does otherwise work correctly for menu items. -4. Graphic-Forms supports CLISP 2.38 and LispWorks 4.4.6. The - intention is to support additional Lisp vendors, but currently - the library will not run on anything but CLISP or LW due to some - vendor-specific features that have to be used. +4. The src/demos/unblocked directory contains a start at a demo + program (a simple game where one clicks on block shapes to + score points, where the rest of the blocks fall down to fill + in the gaps). This demo program is not yet finished, but the + source code can still serve as sample code. + How To Configure and Build @@ -145,6 +153,8 @@ (in-package :gft) (run-tests) ;; runs the unit tests (many more to be added) + (gft::run-drawing-tester) + (gft::run-event-tester) (gft::run-image-tester) Modified: trunk/docs/manual/api.texinfo ============================================================================== --- trunk/docs/manual/api.texinfo (original) +++ trunk/docs/manual/api.texinfo Wed Apr 26 12:14:57 2006 @@ -415,18 +415,24 @@ @end quotation @end deftp +@anchor{timer} @deftp Class timer A timer is a non-windowed object that generates events at a regular -(adjustable) frequency. It derives from @ref{event-source}. -@deffn Reader id-of -@end deffn +(adjustable) frequency. Applications handle timer events by +implementing the @ref{event-timer} generic function. This class +derives from @ref{event-source}. @deffn Initarg :initial-delay -@end deffn -@deffn Reader initial-delay +This initarg accepts a milliseconds value specifying how much of a +delay should occur between the call to @ref{enable} the timer and the +first tick event. If specified, this value must be non-negative. @end deffn @deffn Initarg :delay -@end deffn -@deffn Accessor delay +This initarg accepts a milliseconds value specifying how much delay +should occur between subsequent tick events. If @code{:initial-delay} +was not specified, then this value will be used as the initial delay +time as well. Setting @code{:delay} to zero and setting +@code{:initial-delay} to a positive value has the effect of creating a +@emph{one-shot} timer. @end deffn @end deftp @@ -588,6 +594,7 @@ Implement this to respond to an object (or item within) being selected. @end deffn +@anchor{event-timer} @deffn GenericFunction event-timer dispatcher timer time Implement this to respond to a tick from a specific timer. @end deffn @@ -664,9 +671,11 @@ from display-relative coordinates to this object's coordinate system. @end deffn +@anchor{enable} @deffn GenericFunction enable self flag -Enables or disables the object, causing it to be redrawn with its -default look and allows it to be selected. +For widgets, this function enables or disables the object, causing it +to be redrawn with its default look and allows it to be selected. This +function is also used to start and stop @ref{timer}s. @end deffn @deffn GenericFunction enable-layout self flag @@ -817,14 +826,6 @@ parent's coordinate system. @end deffn -@deffn GenericFunction start self -Enable event generation at regular intervals. -@end deffn - -@deffn GenericFunction stop self -Stop producing events. -@end deffn - @deffn GenericFunction text self Returns the object's text. @end deffn Modified: trunk/src/demos/unblocked/unblocked-window.lisp ============================================================================== --- trunk/src/demos/unblocked/unblocked-window.lisp (original) +++ trunk/src/demos/unblocked/unblocked-window.lisp Wed Apr 26 12:14:57 2006 @@ -111,6 +111,7 @@ (let ((size (gfw:preferred-size *unblocked-win* -1 -1))) (setf (gfw:minimum-size *unblocked-win*) size) (setf (gfw:maximum-size *unblocked-win*) size)) + (new-unblocked nil nil nil nil) (gfw:show *unblocked-win* t))) (defun unblocked () Modified: trunk/src/tests/uitoolkit/event-tester.lisp ============================================================================== --- trunk/src/tests/uitoolkit/event-tester.lisp (original) +++ trunk/src/tests/uitoolkit/event-tester.lisp Wed Apr 26 12:14:57 2006 @@ -207,12 +207,12 @@ (declare (ignore disp item time rect)) (if *timer* (progn - (gfw:stop *timer*) + (gfw:enable *timer* nil) (setf *timer* nil) (setf *event-tester-text* "timer stopped by user")) (progn (setf *timer* (make-instance 'gfw:timer :delay 1000 :dispatcher (make-instance 'event-tester-echo-dispatcher))) - (gfw:start *timer*) + (gfw:enable *timer* t) (setf *event-tester-text* (format nil "timer ~d started init delay: ~d delay ~d" (gfw:id-of *timer*) Modified: trunk/src/uitoolkit/widgets/timer.lisp ============================================================================== --- trunk/src/uitoolkit/widgets/timer.lisp (original) +++ trunk/src/uitoolkit/widgets/timer.lisp Wed Apr 26 12:14:57 2006 @@ -108,18 +108,18 @@ (setf (slot-value self 'initial-delay) init-delay) (setf (slot-value self 'delay) delay))) -(defmethod start ((self timer)) - ;; use init-delay as the elapse interval for the very first - ;; tick; the interval will be adjusted (or the timer killed) - ;; as part of processing the first event - ;; - (let ((init-delay (initial-delay-of self))) - (if (> init-delay 0) - (reset-timer-to-delay self init-delay) - (reset-timer-to-delay self (delay-of self))))) - -(defmethod stop ((self timer)) - (remove-timer (thread-context) self)) ;; kill-timer will be called on the next tick +(defmethod enable ((self timer) flag) + (if flag + (progn + ;; use init-delay as the elapse interval for the very first + ;; tick; the interval will be adjusted (or the timer killed) + ;; as part of processing the first event + ;; + (let ((init-delay (initial-delay-of self))) + (if (> init-delay 0) + (reset-timer-to-delay self init-delay) + (reset-timer-to-delay self (delay-of self))))) + (remove-timer (thread-context) self))) ;; kill-timer will be called on the next tick (defmethod running-p ((self timer)) (get-timer (thread-context) (id-of self))) Modified: trunk/src/uitoolkit/widgets/widget-generics.lisp ============================================================================== --- trunk/src/uitoolkit/widgets/widget-generics.lisp (original) +++ trunk/src/uitoolkit/widgets/widget-generics.lisp Wed Apr 26 12:14:57 2006 @@ -330,15 +330,9 @@ (defgeneric size (self) (:documentation "Returns a size object describing the size of the object in its parent's coordinate system.")) -(defgeneric start (self) - (:documentation "Enable event generation at regular intervals.")) - (defgeneric step-increment (self) (:documentation "Return an integer representing the configured step size for the object.")) -(defgeneric stop (self) - (:documentation "Stop producing events.")) - (defgeneric text (self) (:documentation "Returns the object's text."))
participants (1)
-
junrue@common-lisp.net