|
|
|
@ -5,9 +5,8 @@
|
|
|
|
|
(defvar *body*) |
|
|
|
|
|
|
|
|
|
(defun lift-search-window (body search) |
|
|
|
|
(let ((result (mapcar #'car (l:lift-search search))) |
|
|
|
|
(win (create-gui-window body))) |
|
|
|
|
(create-p (window-content win) |
|
|
|
|
(let ((result (mapcar #'car (l:lift-search search)))) |
|
|
|
|
(create-p body |
|
|
|
|
:content (str:join ", " (if result |
|
|
|
|
result |
|
|
|
|
'("No results")))))) |
|
|
|
@ -15,43 +14,22 @@
|
|
|
|
|
(defun ergebnis/se (n) |
|
|
|
|
(format nil "~A Ergebnis~A" n (if (= n 1) "" "se"))) |
|
|
|
|
|
|
|
|
|
(defun test (canvas) |
|
|
|
|
(create-gui-window canvas :title "Test" |
|
|
|
|
:height 400 |
|
|
|
|
:width 300)) |
|
|
|
|
|
|
|
|
|
(defun test (canvas) |
|
|
|
|
(let* ((win (window-content |
|
|
|
|
(create-gui-window canvas :title "Test" |
|
|
|
|
:height 300 |
|
|
|
|
:width 400))) |
|
|
|
|
(button (create-button win :content "click me!")) |
|
|
|
|
(div (create-div win))) |
|
|
|
|
(create-p div :content "foo") |
|
|
|
|
(set-on-click button (lambda (obj) |
|
|
|
|
(declare (ignore obj)) |
|
|
|
|
(format t "Clicked button!"))) |
|
|
|
|
div)) |
|
|
|
|
|
|
|
|
|
(defun search-in-bible (phrase bible canvas) |
|
|
|
|
(let* ((win (window-content |
|
|
|
|
(create-gui-window canvas |
|
|
|
|
:title (format nil "~A: ~A" |
|
|
|
|
d:*translation* |
|
|
|
|
phrase) |
|
|
|
|
:height 400 |
|
|
|
|
:width 500))) |
|
|
|
|
(lift-search (create-button win :content "Lift Search")) |
|
|
|
|
(div (create-div win)) |
|
|
|
|
(results (s:find-in-bible bible phrase))) |
|
|
|
|
(set-on-click lift-search (lambda (obj) |
|
|
|
|
(declare (ignore obj)) |
|
|
|
|
(lift-search-window canvas results))) |
|
|
|
|
(create-p div :content (ergebnis/se |
|
|
|
|
(length results))) |
|
|
|
|
(let ((content (create-web-content canvas)) |
|
|
|
|
(results (s:find-in-bible bible phrase))) |
|
|
|
|
(create-p content :content (format nil "<b>~A</b>" (ergebnis/se (length results)))) |
|
|
|
|
(let ((lift-search (create-web-panel content))) |
|
|
|
|
(set-on-click (create-button lift-search :content "Lift Search") |
|
|
|
|
(lambda (obj) |
|
|
|
|
(declare (ignore obj)) |
|
|
|
|
(lift-search-window lift-search results)))) |
|
|
|
|
(mapc (lambda (verse) |
|
|
|
|
(clog:set-on-click |
|
|
|
|
(v:verse-to-clog verse div :translation d:*translation*) |
|
|
|
|
(create-p content |
|
|
|
|
:content (format nil "<b>~A ~A:</b><br />~A" |
|
|
|
|
(v:bname verse) |
|
|
|
|
(v:chapter verse) |
|
|
|
|
(v:verse-to-string verse))) |
|
|
|
|
(lambda (obj) |
|
|
|
|
(declare (ignore obj)) |
|
|
|
|
(ch:load-chapter canvas |
|
|
|
@ -59,108 +37,63 @@
|
|
|
|
|
(v:chapter verse))))) |
|
|
|
|
results))) |
|
|
|
|
|
|
|
|
|
(defun %bible-book-or-chapter (bible book chapter) |
|
|
|
|
(if (string= book "") |
|
|
|
|
bible |
|
|
|
|
(let ((book (s:find-book bible book))) |
|
|
|
|
(if (string= chapter "") |
|
|
|
|
book |
|
|
|
|
(s:find-chapter book chapter))))) |
|
|
|
|
|
|
|
|
|
(defun search-with-chapter (window data) |
|
|
|
|
(let ((book (cadr (assoc "book" data :test #'string=))) |
|
|
|
|
(chapter (cadr (assoc "chapter" data :test #'string=))) |
|
|
|
|
(phrase (cadr (assoc "phrase" data :test #'string=)))) |
|
|
|
|
(search-in-bible phrase |
|
|
|
|
(%bible-book-or-chapter d:*bible* book chapter) |
|
|
|
|
window))) |
|
|
|
|
|
|
|
|
|
(defun searcher (window) |
|
|
|
|
(lambda (obj) |
|
|
|
|
(declare (ignore obj)) |
|
|
|
|
(form-dialog window "What do you want to search?" |
|
|
|
|
'(("Phrase" "phrase" :text) |
|
|
|
|
("Book" "book" :text) |
|
|
|
|
("Chapter" "chapter" :text)) |
|
|
|
|
(lambda (data) |
|
|
|
|
(search-with-chapter window data)) |
|
|
|
|
:title "Search a phrase"))) |
|
|
|
|
|
|
|
|
|
(defun reload (window) |
|
|
|
|
(lambda (obj) |
|
|
|
|
(declare (ignore obj)) |
|
|
|
|
(form-dialog window "Which bible do you want?" |
|
|
|
|
'(("Bible" "bible" :select (("Menge" :mng) |
|
|
|
|
("King James Version" :kjv) |
|
|
|
|
("Vulgata" :vul) |
|
|
|
|
("Greek Bible" :grb) |
|
|
|
|
("Elberfelder Übersetzung 1871" :elb1871) |
|
|
|
|
("NEÜ" :neue) |
|
|
|
|
("Luther 1545" :luth1545) |
|
|
|
|
("Luther 1912" :luth1912) |
|
|
|
|
("Schlachter 1951" :sch1951) |
|
|
|
|
("Ukrainische Version" :ukr)))) |
|
|
|
|
(lambda (results) |
|
|
|
|
(d:update-bible (cadar results)) |
|
|
|
|
:title "Load a Bible")))) |
|
|
|
|
(let ((dialog (clog-web-form window "Which bible do you want?" |
|
|
|
|
'(("Bible" "bible" :select (("Menge" :mng) |
|
|
|
|
("King James Version" :kjv) |
|
|
|
|
("Vulgata" :vul) |
|
|
|
|
("Greek Bible" :grb) |
|
|
|
|
("Elberfelder Übersetzung 1871" :elb1871) |
|
|
|
|
("NEÜ" :neue) |
|
|
|
|
("Luther 1545" :luth1545) |
|
|
|
|
("Luther 1912" :luth1912) |
|
|
|
|
("Schlachter 1951" :sch1951) |
|
|
|
|
("Ukrainische Version" :ukr)))) |
|
|
|
|
(lambda (results) |
|
|
|
|
(d:update-bible (form-result results "bible"))))))))) |
|
|
|
|
|
|
|
|
|
(defun load-book-or-chapter (canvas) |
|
|
|
|
(lambda (data) |
|
|
|
|
(ch:load-position canvas |
|
|
|
|
(second (assoc "pos" data :test #'string=))))) |
|
|
|
|
|
|
|
|
|
(defun get-chapter (window body) |
|
|
|
|
(defun get-chapter (body) |
|
|
|
|
(lambda (obj) |
|
|
|
|
(declare (ignore obj)) |
|
|
|
|
(form-dialog window "Which passage do you want?" |
|
|
|
|
(clog-web-form body "Which passage do you want?" |
|
|
|
|
'(("" "pos" :text)) |
|
|
|
|
(load-book-or-chapter body) |
|
|
|
|
:title "Load a Passage"))) |
|
|
|
|
|
|
|
|
|
(defun setup-window (body) |
|
|
|
|
(let ((window (create-gui-window body :title "background" |
|
|
|
|
:hidden t))) |
|
|
|
|
(window-normalize window) |
|
|
|
|
(window-center window) |
|
|
|
|
window)) |
|
|
|
|
|
|
|
|
|
(defun setup-menu-bar (body window) |
|
|
|
|
(let* ((mbar (create-gui-menu-bar body)) |
|
|
|
|
(drop-down (create-gui-menu-drop-down mbar |
|
|
|
|
:content "Options"))) |
|
|
|
|
(create-gui-menu-full-screen mbar) |
|
|
|
|
(create-gui-menu-item drop-down |
|
|
|
|
:content "Search" |
|
|
|
|
:on-click (searcher window)) |
|
|
|
|
(create-gui-menu-item drop-down |
|
|
|
|
:content "Get Chapter" |
|
|
|
|
:on-click (get-chapter window body)) |
|
|
|
|
(create-gui-menu-item drop-down |
|
|
|
|
:content "Load Bible" |
|
|
|
|
:on-click (reload window)) |
|
|
|
|
(create-gui-menu-item mbar |
|
|
|
|
:content "Close all windows" |
|
|
|
|
:on-click (lambda (obj) |
|
|
|
|
(declare (ignore obj)) |
|
|
|
|
(loop :for win = (current-window body) |
|
|
|
|
:if (or (null win) |
|
|
|
|
(string= (window-title win) |
|
|
|
|
"background")) |
|
|
|
|
:do (return) |
|
|
|
|
:do (window-close win)))) |
|
|
|
|
(create-gui-menu-item mbar |
|
|
|
|
:content "Save notes" |
|
|
|
|
:on-click (lambda (obj) |
|
|
|
|
(declare (ignore obj)) |
|
|
|
|
(d:persist))) |
|
|
|
|
(create-gui-menu-item mbar |
|
|
|
|
:content "Load notes" |
|
|
|
|
:on-click (lambda (obj) |
|
|
|
|
(declare (ignore obj)) |
|
|
|
|
(d:load-bibles))))) |
|
|
|
|
(load-book-or-chapter body)))) |
|
|
|
|
|
|
|
|
|
(defun setup-menu-bar (body) |
|
|
|
|
(let* ((form-space (create-web-content body)) |
|
|
|
|
(form2 (create-form form-space)) |
|
|
|
|
(bible (create-select form2 :label (create-label form2 :content "Choose your translation: "))) |
|
|
|
|
(_ (create-br form-space)) |
|
|
|
|
(form1 (create-form form-space)) |
|
|
|
|
(passage (create-form-element form1 :search :class "w3-input w3-border")) |
|
|
|
|
(__ (create-br form-space)) |
|
|
|
|
(form3 (create-form form-space)) |
|
|
|
|
(search (create-form-element form3 :search :class "w3-input w3-border"))) |
|
|
|
|
(declare (ignore _ __)) |
|
|
|
|
(add-select-options bible '("elb1871" "mng" "neue" "luth1545" "luth1912" "sch1951" "kjv" "vul" "grb" "ukr")) |
|
|
|
|
(set-on-change bible (lambda (obj) |
|
|
|
|
(declare (ignore obj)) |
|
|
|
|
(d:update-bible (value bible)))) |
|
|
|
|
(create-form-element form1 :submit :value "Get passage") |
|
|
|
|
(set-on-submit form1 |
|
|
|
|
(lambda (obj) |
|
|
|
|
(declare (ignore obj)) |
|
|
|
|
(ch:load-position body (value passage)))) |
|
|
|
|
(create-form-element form3 :submit :value "Search phrase") |
|
|
|
|
(set-on-submit form3 |
|
|
|
|
(lambda (obj) |
|
|
|
|
(declare (ignore obj)) |
|
|
|
|
(search-in-bible (value search) d:*bible* body))))) |
|
|
|
|
|
|
|
|
|
(defun on-new-window (body) |
|
|
|
|
(setf *body* body) |
|
|
|
|
(setf (title (html-document body)) "Bible") |
|
|
|
|
(clog-gui-initialize body) |
|
|
|
|
(setup-menu-bar body (setup-window body))) |
|
|
|
|
(clog-web-initialize body) |
|
|
|
|
(setup-menu-bar body)) |
|
|
|
|