(in-package :lol)(defclass chronometre (windoid)  ((name :initarg :name :initform nil :accessor name :type symbol)   (start-time :initarg :start-time :initform 0 :accessor start-time :type number)   (stop-time :initarg :stop-time :initform 0 :accessor stop-time :type number)   (Mstart-time :initarg :Mstart-time :initform 0 :accessor Mstart-time :type number)   (Mstop-time :initarg :Mstop-time :initform 0 :accessor Mstop-time :type number)   (color :initarg :color :initform *red-color* :accessor color :type t)   )  (:default-initargs    :close-box-p t    :view-size #@(150 85)    :view-font '("Times" 12 :PLAIN)  )  (:documentation   "Chronometre"  ))(defmethod initialize-instance :after ((self chronometre) &key)  (let ((start-button (make-instance 'button-dialog-item                        :view-position #@(10 5)                        :dialog-item-text "START"                        :view-font '("Times" 12 :PLAIN)                        :border-p t                        :dialog-item-action #'(lambda (x)                                                (declare (ignore x))                                                (setf (start-time self) (get-universal-time))                                                (set-dialog-item-text (view-named 'time self)                                                                      (format nil "00'00\""))                                                (set-part-color (view-named 'stop self) :text *red-color*)                                                (view-draw-contents self))))        (stop-button (make-instance 'button-dialog-item                       :view-position #@(10 25)                       :view-font '("Times" 12 :PLAIN)                       :dialog-item-text "STOP"                       :border-p t                       :view-nick-name 'stop                       :dialog-item-action #'(lambda (x)                                               ;(declare (ignore x))                                               (let (d)                                                (setf (stop-time self) (get-universal-time)                                                      d (- (stop-time self) (start-time self)))                                                (set-dialog-item-text (view-named 'time self)                                                                      (format nil "~S'~S\""                                                                              (floor (/ d 60))                                                                              (round (mod d 60)))))                                               (set-part-color x :text *black-color*)                                               (view-draw-contents self))))        (start-moment (make-instance 'button-dialog-item                        :view-position #@(10 45)                        :dialog-item-text "M start"                        :view-font '("Times" 12 :PLAIN)                        :border-p t                        :dialog-item-action #'(lambda (x)                                                (declare (ignore x))                                                (setf (Mstart-time self) (get-universal-time))                                                (set-dialog-item-text (view-named 'Mtime self)                                                                      (format nil "00'00\""))                                                (set-part-color (view-named 'Mstop self) :text *red-color*)                                                (view-draw-contents self))))        (stop-moment (make-instance 'button-dialog-item                       :view-position #@(10 65)                       :dialog-item-text "M stop"                       :view-font '("Times" 12 :PLAIN)                       :border-p t                       :view-nick-name 'Mstop                       :dialog-item-action #'(lambda (x)                                               (declare (ignore x))                                               (let (d (situation-window (find-situation-danser self)))                                                (setf (Mstop-time self) (get-universal-time)                                                      d (- (Mstop-time self) (Mstart-time self)))                                                (set-dialog-item-text (view-named 'Mtime self)                                                                      (format nil "~S'~S\""                                                                              (floor (/ d 60))                                                                              (round (mod d 60))))                                                (when situation-window                                                  (set-duration situation-window d))                                                )                                               (set-part-color (view-named 'Mstop self) :text *black-color*)                                                (view-draw-contents self))))        (time (make-instance 'static-text-dialog-item                       :view-position #@(80 15)                       :view-nick-name 'time                       :dialog-item-text "00'00\""                       :view-font '("Times" 24 :BOLD)))        (Mtime (make-instance 'static-text-dialog-item                       :view-position #@(80 55)                       :view-nick-name 'Mtime                       :dialog-item-text " 0'00\""                       :view-font '("Times" 24 :BOLD)))        (name (make-instance 'static-text-dialog-item                       :view-position #@(80 0)                       :view-nick-name 'Mtime                       :dialog-item-text (string (name self))                       :view-font '("Times" 10 :PLAIN)))        (info (make-instance 'button-dialog-item                       :view-position #@(140 0)                       :view-size #@(10 12)                       :dialog-item-text "c"                       :view-font '("Geneva" 9 :PLAIN)                       :border-p nil                       :dialog-item-action #'(lambda (x)                                               (declare (ignore x))                                               (let ((color (user-pick-color :color (color self))))                                                 (setf (color self) color)                                                 (set-back-color self (color self)))                                               (view-draw-contents self)                                               ))))    (set-part-color name :text *white-color*)    (set-part-color time :text *white-color*)    (set-part-color Mtime :text *white-color*)    (set-back-color self (color self))    (add-subviews self start-button stop-button start-moment stop-moment time Mtime name info)))#|(make-instance 'chronometre :color *red-color* :name 'dana)|#(defmethod find-situation-danser ((self chronometre)) (let ((situation-windows (or (windows :class 'situation-window) (windows :class 'run-window)))       w)   (setf w (find-if #'(lambda (x) (eq (class-name (class-of (danser (situation x))))                                      (name self)))                    situation-windows))   w))(defmethod durŽe ((self situation))  (datum (find-if #'(lambda (x) (eq (class-of x) (find-class 'durŽe)))                   (data self))))(defmethod set-duration ((self situation-window) (duration number))  (setf (datum (find-if #'(lambda (x) (eq (class-of x) (find-class 'durŽe)))                         (data (situation self)))) duration)  (set-dialog-item-text   (view-named 'data               (find-if #'(lambda (x) (eq (view-nick-name x) 'durŽe))                        (find-view1 (view-subviews self) 'dimension-edit-view)))   (format nil "~S" duration))  )(defmethod set-duration ((self run-window) (duration number))  (setf (datum (find-if #'(lambda (x) (eq (class-of x) (find-class 'durŽe)))                         (data (situation self)))) duration)  (set-dialog-item-text   (view-named 'data               (find-if #'(lambda (x) (eq (view-nick-name x) 'durŽe))                        (find-view1 (view-subviews self) 'run-dimension-edit-view)))   (format nil "~S" duration))  (view-draw-contents self)  )