aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGene Pasquet <dev@etenil.net>2026-07-26 01:00:46 +0100
committerGene Pasquet <dev@etenil.net>2026-07-26 01:00:46 +0100
commit244bb89c73d6829c68e2e7c3270d146493981fbc (patch)
treea7bc12a9771ed657996e1fe50fb14d8deeea4fdb
parent373b8212e7519c9b0ead6f144eef96cad072a7ba (diff)
First working version
-rw-r--r--all.lisp6
-rw-r--r--class.lisp43
-rw-r--r--frame.lisp23
3 files changed, 38 insertions, 34 deletions
diff --git a/all.lisp b/all.lisp
index 2830a7f..fa0b0d1 100644
--- a/all.lisp
+++ b/all.lisp
@@ -1,6 +1,6 @@
(uiop:define-package
- :simple-text-clim-frame/all
+ :solar-short/all
(:export)
(:mix-reexport
- :simple-text-clim-frame/frame
- :simple-text-clim-frame/class))
+ :solar-short/frame
+ :solar-short/class))
diff --git a/class.lisp b/class.lisp
index ba68fcc..fdc0beb 100644
--- a/class.lisp
+++ b/class.lisp
@@ -1,27 +1,24 @@
(uiop:define-package
- :simple-text-clim-frame/class
- (:export #:my-class #:my-display)
- (:import-from :asdf))
+ :solar-short/class
+ (:export #:book #:display-haiku)
+ (:import-from :asdf))
-(in-package :simple-text-clim-frame/class)
+(in-package :solar-short/class)
-(defclass my-class ()
- ((text-slot
- :initform #.(format
- nil
- "~{~a~^~%~}"
- (with-open-file
- (in (merge-pathnames
- #P"some.text"
- (asdf:system-source-directory
- "simple-text-clim-frame")))
- (loop for line = (read-line in nil nil)
- while line
- collect line))))))
+(defclass book ()
+ ((haikus
+ :initform (list "haiku 1"
+ "haiku 2"
+ "haiku 3"))
+ (current :initform 0)))
-(defmethod my-display ((obj my-class) stream)
- (with-slots
- (text-slot)
- obj
- (princ text-slot stream)))
-
+(defmethod display-haiku ((obj book) stream)
+ (with-slots (haikus current) obj
+ (princ (nth current haikus) stream)))
+
+;; (defmethod next-haiku ((book book))
+;; (setf (current book)
+;; (+ (if (= (current book) (length (haikus book)))
+;; 0
+;; 1)
+;; (current book))))
diff --git a/frame.lisp b/frame.lisp
index f8555e1..b65c631 100644
--- a/frame.lisp
+++ b/frame.lisp
@@ -1,19 +1,26 @@
(uiop:define-package
- :simple-text-clim-frame/frame
+ :solar-short/frame
(:export)
- (:mix-reexport :simple-text-clim-frame/class)
+ (:mix-reexport :solar-short/class)
(:mix :clim :clim-lisp))
-(in-package :simple-text-clim-frame/frame)
+(in-package :solar-short/frame)
(define-application-frame
- my-frame
- (my-class standard-application-frame)
+ read-haiku
+ (book standard-application-frame)
()
(:panes
- (title :title :display-string "My title")
- (app :application :display-function 'my-display))
+ (title :title :display-string "Solar short")
+ (app :application :display-function 'display-haiku)
+ (action-next :push-button :label "Next"))
(:layouts
(default
- (vertically () title app))))
+ (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)))))