diff options
| author | Gene Pasquet <dev@etenil.net> | 2026-07-26 10:23:43 +0100 |
|---|---|---|
| committer | Gene Pasquet <dev@etenil.net> | 2026-07-26 10:23:43 +0100 |
| commit | 198fcf265413929632580504ab91abc7460e6f31 (patch) | |
| tree | 06b9338db11d6d707694b7180be30eb60b02aa51 | |
| parent | 244bb89c73d6829c68e2e7c3270d146493981fbc (diff) | |
Fixes
| -rw-r--r-- | class.lisp | 18 | ||||
| -rw-r--r-- | frame.lisp | 16 |
2 files changed, 19 insertions, 15 deletions
@@ -1,6 +1,6 @@ (uiop:define-package :solar-short/class - (:export #:book #:display-haiku) + (:export #:book #:display-haiku #:next-haiku) (:import-from :asdf)) (in-package :solar-short/class) @@ -14,11 +14,15 @@ (defmethod display-haiku ((obj book) stream) (with-slots (haikus current) obj + (format *standard-output* "haiku num: ~a" current) (princ (nth current haikus) stream))) -;; (defmethod next-haiku ((book book)) -;; (setf (current book) -;; (+ (if (= (current book) (length (haikus book))) -;; 0 -;; 1) -;; (current book)))) +(defmethod next-haiku ((obj book)) + (with-slots (haikus current) obj + (format *standard-output* "increasing current") + (let ((factor (if (= current (length haikus)) 0 1))) + (format *standard-output* "increment factor: ~a" factor) + (finish-output *standard-output*) + (setf current + (+ factor + current))))) @@ -13,14 +13,14 @@ (:panes (title :title :display-string "Solar short") (app :application :display-function 'display-haiku) - (action-next :push-button :label "Next")) + (action-next :push-button :label "Next" + :activate-callback (lambda (gadget) (com-next)))) (:layouts (default (vertically () title app action-next)))) - -;; (define-read-haiku-command (com-next :name t) -;; ((book 'book)) -;; (with-application-frame (frame) -;; (let ((book (book frame))) -;; (when book -;; (next-haiku book))))) + +(define-read-haiku-command (com-next :name "Next") + () + (with-application-frame (frame) + (next-haiku frame) + (redisplay-frame frame))) |
