Silas Vedder
2 years ago
7 changed files with 108 additions and 32 deletions
@ -0,0 +1,57 @@
|
||||
(in-package #:cl-bible.chapter) |
||||
|
||||
(defun book/chapter-window (canvas title) |
||||
(let* ((win (window-content |
||||
(create-gui-window canvas |
||||
:title title |
||||
:height 400 |
||||
:width 650))) |
||||
(mbar (create-gui-menu-bar win)) |
||||
(drop-down (create-gui-menu-drop-down mbar :content "Translations"))) |
||||
(values (create-div win) |
||||
drop-down))) |
||||
|
||||
(defmacro translations-drop-down () |
||||
`(progn |
||||
,@(mapcar |
||||
(lambda (translation) |
||||
`(labels ((verse-to-clog (verse) |
||||
(v:verse-to-clog verse |
||||
div |
||||
:translation ,(second translation))) |
||||
(hide-verse (verse) (setf (hiddenp verse) t)) |
||||
(callback (obj) |
||||
(declare (ignore obj)) |
||||
(mapc #'hide-verse display) |
||||
(setf display (mapcar #'verse-to-clog verses)))) |
||||
(create-gui-menu-item drop-down |
||||
:content ,(first translation) |
||||
:on-click #'callback))) |
||||
d:*translations*))) |
||||
|
||||
(defun display-chapter-or-book (canvas title verses) |
||||
(multiple-value-bind (div drop-down) |
||||
(book/chapter-window canvas title) |
||||
(flet ((verse-to-clog (verse) |
||||
(v:verse-to-clog verse |
||||
div |
||||
:translation d:*translation*))) |
||||
(let ((display (mapcar #'verse-to-clog verses))) |
||||
(translations-drop-down))))) |
||||
|
||||
(defun load-chapter (canvas book chapter) |
||||
(display-chapter-or-book canvas |
||||
(format nil "~A: ~A ~A" |
||||
d:*translation* |
||||
book |
||||
chapter) |
||||
(s:find-chapter |
||||
(s:find-book d:*bible* book) |
||||
chapter))) |
||||
|
||||
(defun load-book (canvas book) |
||||
(display-chapter-or-book canvas |
||||
(format nil "~A: ~A" |
||||
d:*translation* |
||||
book) |
||||
(s:find-book d:*bible* book))) |
Loading…
Reference in new issue