|
|
@ -5,9 +5,8 @@ |
|
|
|
(defvar *body*) |
|
|
|
(defvar *body*) |
|
|
|
|
|
|
|
|
|
|
|
(defun lift-search-window (body search) |
|
|
|
(defun lift-search-window (body search) |
|
|
|
(let ((result (mapcar #'car (l:lift-search search))) |
|
|
|
(let ((result (mapcar #'car (l:lift-search search)))) |
|
|
|
(win (create-gui-window body))) |
|
|
|
(create-p body |
|
|
|
(create-p (window-content win) |
|
|
|
|
|
|
|
:content (str:join ", " (if result |
|
|
|
:content (str:join ", " (if result |
|
|
|
result |
|
|
|
result |
|
|
|
'("No results")))))) |
|
|
|
'("No results")))))) |
|
|
@ -15,43 +14,22 @@ |
|
|
|
(defun ergebnis/se (n) |
|
|
|
(defun ergebnis/se (n) |
|
|
|
(format nil "~A Ergebnis~A" n (if (= n 1) "" "se"))) |
|
|
|
(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) |
|
|
|
(defun search-in-bible (phrase bible canvas) |
|
|
|
(let* ((win (window-content |
|
|
|
(let ((content (create-web-content canvas)) |
|
|
|
(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))) |
|
|
|
(results (s:find-in-bible bible phrase))) |
|
|
|
(set-on-click lift-search (lambda (obj) |
|
|
|
(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)) |
|
|
|
(declare (ignore obj)) |
|
|
|
(lift-search-window canvas results))) |
|
|
|
(lift-search-window lift-search results)))) |
|
|
|
(create-p div :content (ergebnis/se |
|
|
|
|
|
|
|
(length results))) |
|
|
|
|
|
|
|
(mapc (lambda (verse) |
|
|
|
(mapc (lambda (verse) |
|
|
|
(clog:set-on-click |
|
|
|
(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) |
|
|
|
(lambda (obj) |
|
|
|
(declare (ignore obj)) |
|
|
|
(declare (ignore obj)) |
|
|
|
(ch:load-chapter canvas |
|
|
|
(ch:load-chapter canvas |
|
|
@ -59,37 +37,10 @@ |
|
|
|
(v:chapter verse))))) |
|
|
|
(v:chapter verse))))) |
|
|
|
results))) |
|
|
|
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) |
|
|
|
(defun reload (window) |
|
|
|
(lambda (obj) |
|
|
|
(lambda (obj) |
|
|
|
(declare (ignore obj)) |
|
|
|
(declare (ignore obj)) |
|
|
|
(form-dialog window "Which bible do you want?" |
|
|
|
(let ((dialog (clog-web-form window "Which bible do you want?" |
|
|
|
'(("Bible" "bible" :select (("Menge" :mng) |
|
|
|
'(("Bible" "bible" :select (("Menge" :mng) |
|
|
|
("King James Version" :kjv) |
|
|
|
("King James Version" :kjv) |
|
|
|
("Vulgata" :vul) |
|
|
|
("Vulgata" :vul) |
|
|
@ -101,66 +52,48 @@ |
|
|
|
("Schlachter 1951" :sch1951) |
|
|
|
("Schlachter 1951" :sch1951) |
|
|
|
("Ukrainische Version" :ukr)))) |
|
|
|
("Ukrainische Version" :ukr)))) |
|
|
|
(lambda (results) |
|
|
|
(lambda (results) |
|
|
|
(d:update-bible (cadar results)) |
|
|
|
(d:update-bible (form-result results "bible"))))))))) |
|
|
|
:title "Load a Bible")))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun load-book-or-chapter (canvas) |
|
|
|
(defun load-book-or-chapter (canvas) |
|
|
|
(lambda (data) |
|
|
|
(lambda (data) |
|
|
|
(ch:load-position canvas |
|
|
|
(ch:load-position canvas |
|
|
|
(second (assoc "pos" data :test #'string=))))) |
|
|
|
(second (assoc "pos" data :test #'string=))))) |
|
|
|
|
|
|
|
|
|
|
|
(defun get-chapter (window body) |
|
|
|
(defun get-chapter (body) |
|
|
|
(lambda (obj) |
|
|
|
(lambda (obj) |
|
|
|
(declare (ignore obj)) |
|
|
|
(declare (ignore obj)) |
|
|
|
(form-dialog window "Which passage do you want?" |
|
|
|
(clog-web-form body "Which passage do you want?" |
|
|
|
'(("" "pos" :text)) |
|
|
|
'(("" "pos" :text)) |
|
|
|
(load-book-or-chapter body) |
|
|
|
(load-book-or-chapter body)))) |
|
|
|
:title "Load a Passage"))) |
|
|
|
|
|
|
|
|
|
|
|
(defun setup-menu-bar (body) |
|
|
|
(defun setup-window (body) |
|
|
|
(let* ((form-space (create-web-content body)) |
|
|
|
(let ((window (create-gui-window body :title "background" |
|
|
|
(form2 (create-form form-space)) |
|
|
|
:hidden t))) |
|
|
|
(bible (create-select form2 :label (create-label form2 :content "Choose your translation: "))) |
|
|
|
(window-normalize window) |
|
|
|
(_ (create-br form-space)) |
|
|
|
(window-center window) |
|
|
|
(form1 (create-form form-space)) |
|
|
|
window)) |
|
|
|
(passage (create-form-element form1 :search :class "w3-input w3-border")) |
|
|
|
|
|
|
|
(__ (create-br form-space)) |
|
|
|
(defun setup-menu-bar (body window) |
|
|
|
(form3 (create-form form-space)) |
|
|
|
(let* ((mbar (create-gui-menu-bar body)) |
|
|
|
(search (create-form-element form3 :search :class "w3-input w3-border"))) |
|
|
|
(drop-down (create-gui-menu-drop-down mbar |
|
|
|
(declare (ignore _ __)) |
|
|
|
:content "Options"))) |
|
|
|
(add-select-options bible '("elb1871" "mng" "neue" "luth1545" "luth1912" "sch1951" "kjv" "vul" "grb" "ukr")) |
|
|
|
(create-gui-menu-full-screen mbar) |
|
|
|
(set-on-change bible (lambda (obj) |
|
|
|
(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)) |
|
|
|
(declare (ignore obj)) |
|
|
|
(loop :for win = (current-window body) |
|
|
|
(d:update-bible (value bible)))) |
|
|
|
:if (or (null win) |
|
|
|
(create-form-element form1 :submit :value "Get passage") |
|
|
|
(string= (window-title win) |
|
|
|
(set-on-submit form1 |
|
|
|
"background")) |
|
|
|
(lambda (obj) |
|
|
|
:do (return) |
|
|
|
|
|
|
|
:do (window-close win)))) |
|
|
|
|
|
|
|
(create-gui-menu-item mbar |
|
|
|
|
|
|
|
:content "Save notes" |
|
|
|
|
|
|
|
:on-click (lambda (obj) |
|
|
|
|
|
|
|
(declare (ignore obj)) |
|
|
|
(declare (ignore obj)) |
|
|
|
(d:persist))) |
|
|
|
(ch:load-position body (value passage)))) |
|
|
|
(create-gui-menu-item mbar |
|
|
|
(create-form-element form3 :submit :value "Search phrase") |
|
|
|
:content "Load notes" |
|
|
|
(set-on-submit form3 |
|
|
|
:on-click (lambda (obj) |
|
|
|
(lambda (obj) |
|
|
|
(declare (ignore obj)) |
|
|
|
(declare (ignore obj)) |
|
|
|
(d:load-bibles))))) |
|
|
|
(search-in-bible (value search) d:*bible* body))))) |
|
|
|
|
|
|
|
|
|
|
|
(defun on-new-window (body) |
|
|
|
(defun on-new-window (body) |
|
|
|
(setf *body* body) |
|
|
|
(setf *body* body) |
|
|
|
(setf (title (html-document body)) "Bible") |
|
|
|
(setf (title (html-document body)) "Bible") |
|
|
|
(clog-gui-initialize body) |
|
|
|
(clog-web-initialize body) |
|
|
|
(setup-menu-bar body (setup-window body))) |
|
|
|
(setup-menu-bar body)) |
|
|
|