From 420bc31015b24c2f042420ab1e3b550feaac0ea2 Mon Sep 17 00:00:00 2001 From: David Botton Date: Wed, 10 Feb 2021 00:48:30 -0500 Subject: [PATCH] Drop the custom boot file and use the new clog-gui --- clog-gui.lisp | 12 +++---- demos/03-demo.lisp | 39 +++++++++++++--------- static-files/demo/clogicon.png | Bin 1773 -> 0 bytes static-files/demo/clogwicon.png | Bin 2136 -> 0 bytes static-files/demo/frame.html | 56 -------------------------------- tutorial/22-tutorial.lisp | 26 +++++++++++++++ 6 files changed, 55 insertions(+), 78 deletions(-) delete mode 100644 static-files/demo/clogicon.png delete mode 100644 static-files/demo/clogwicon.png delete mode 100644 static-files/demo/frame.html create mode 100644 tutorial/22-tutorial.lisp diff --git a/clog-gui.lisp b/clog-gui.lisp index a87c8d7..0685fbc 100644 --- a/clog-gui.lisp +++ b/clog-gui.lisp @@ -66,18 +66,18 @@ clog-body.")) (defgeneric create-gui-menu-item (clog-gui-menu-drop-down &key content - on-click-handler + on-click class html-id) (:documentation "Attached a menu item to a CLOG-GUI-MENU-DROP-DOWN")) (defmethod create-gui-menu-item ((obj clog-obj) &key (content "") - (on-click-handler nil) + (on-click nil) (class "w3-bar-item w3-button") (html-id nil)) (let ((span (create-span obj :content content :class class :html-id html-id))) - (set-on-click span on-click-handler) + (set-on-click span on-click) (change-class span 'clog-gui-menu-item))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -103,14 +103,14 @@ icon ⤢ and full screen mode.")) ;;;;;;;;;;;;;;;;;;;;;;;;;; (defgeneric create-gui-menu-icon (clog-gui-menu-bar &key image-url - on-click-handler + on-click class html-id) (:documentation "Add icon as menu bar item.")) (defmethod create-gui-menu-icon ((obj clog-gui-menu-bar) &key (image-url "/img/clogwicon.png") - (on-click-handler nil) + (on-click nil) (class "w3-button w3-bar-item") (html-id nil)) (set-on-click @@ -121,4 +121,4 @@ icon ⤢ and full screen mode.")) image-url) :html-id html-id :clog-type 'clog-gui-menu-item) - on-click-handler)) + on-click)) diff --git a/demos/03-demo.lisp b/demos/03-demo.lisp index d85ac6b..7a2d0cd 100644 --- a/demos/03-demo.lisp +++ b/demos/03-demo.lisp @@ -1,6 +1,4 @@ ;;; As this demo uses eval do not run over the internet. -;;; See the accompanying boot file at -;;; https://github.com/rabbibotton/clog/blob/main/static-files/demo/frame.html (defpackage #:clog-user (:use #:cl #:clog) @@ -251,7 +249,7 @@ (let* ((app (connection-data-item obj "app-data")) (about (create-window (body app) "About" :content "
-
+
CLOG
The Common Lisp Omnificent GUI

Demo 3
@@ -264,20 +262,29 @@ (defun on-new-window (body) (let ((app (make-instance 'app-data))) (setf (connection-data-item body "app-data") app) - (setf (body app) body) - (set-on-click (attach-as-child body "ide-logo") #'do-ide-help-about) - (set-on-click (attach-as-child body "ide-file-new") #'do-ide-file-new) - (set-on-click (attach-as-child body "ide-file-open") #'do-ide-file-open) - (set-on-click (attach-as-child body "ide-file-save") #'do-ide-file-save) - (set-on-click (attach-as-child body "ide-file-save-as") #'do-ide-file-save-as) - (set-on-click (attach-as-child body "ide-edit-copy") #'do-ide-edit-copy) - (set-on-click (attach-as-child body "ide-edit-cut") #'do-ide-edit-cut) - (set-on-click (attach-as-child body "ide-edit-paste") #'do-ide-edit-paste) - (set-on-click (attach-as-child body "ide-lisp-eval-file") #'do-ide-lisp-eval-file) - (set-on-click (attach-as-child body "ide-help-about") #'do-ide-help-about) - (run body))) + (setf (body app) body)) + (clog-gui-initialize body) + (load-script (html-document body) "https://pagecdn.io/lib/ace/1.4.12/ace.js") + (add-class body "w3-teal") + (let* ((menu (create-gui-menu-bar body)) + (icon (create-gui-menu-icon menu :on-click #'do-ide-help-about)) + (file (create-gui-menu-drop-down menu :content "File")) + (edit (create-gui-menu-drop-down menu :content "Edit")) + (lisp (create-gui-menu-drop-down menu :content "Lisp")) + (help (create-gui-menu-drop-down menu :content "Help"))) + (create-gui-menu-item file :content "New" :on-click #'do-ide-file-new) + (create-gui-menu-item file :content "Open" :on-click #'do-ide-file-open) + (create-gui-menu-item file :content "Save" :on-click #'do-ide-file-save) + (create-gui-menu-item file :content "Save As" :on-click #'do-ide-file-save-as) + (create-gui-menu-item edit :content "Copy" :on-click #'do-ide-edit-copy) + (create-gui-menu-item edit :content "Cut" :on-click #'do-ide-edit-cut) + (create-gui-menu-item edit :content "Paste" :on-click #'do-ide-edit-paste) + (create-gui-menu-item lisp :content "Eval File" :on-click #'do-ide-lisp-eval-file) + (create-gui-menu-item help :content "About" :on-click #'do-ide-help-about) + (create-gui-menu-full-screen menu)) + (run body)) (defun start-demo () "Start demo." - (initialize #'on-new-window :boot-file "/demo/frame.html") + (initialize #'on-new-window) (open-browser)) diff --git a/static-files/demo/clogicon.png b/static-files/demo/clogicon.png deleted file mode 100644 index 070e074420434f815c97dd9920b794c9a97834bf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1773 zcmeAS@N?(olHy`uVBq!ia0y~yU{GLSV36TpV_;xlIJ8%Zfq{V~-O<;Pfnj4m_n$;o zkb-27AYTTCDm4a%h86~fUknTk4KElNN(~qoUL`OvSj}Ky5HFasE6|34fuSWe!ZXd+ zmqCkxfq{d8jggIknSp_Uk%5VUfl&y`W@KPslwtsx%*epN5XLACXU8#WK-DlYFtlef zuz>Y4Frge(^kS@*wkH}&M25w;xW@MN(M}mQY z=}BftL`j6Nk5zJhu3lnFep0GlMQ#B|7lTcORYh(=ZfZ%QLPc&)Ua?h$trA#;RbH_b zNLXJ<0j#7X+g2&UH$cHTzbI9~OwT~iK*^3vK|#T$C?(A*$i)q+y(lHkRw<*Tq`*pF zzr4I$uiRKKzbIYb(9+UU-@r)U$Vj&+B~7=uGOr}DLN~8i8Da>`9GBGMNl|99XI@EaQ9)5^Ng~J)xB<9Tpqu4il$n|b)eUnovKW$jkiV@0GAmMZB3v?a zQ}e*SG&M4`(Z?!-uG2X`C%-7TATc==6f|HhNJ8kU!S+NV>@hJlL$(J=2CCCWACwM| z(giqjAfiDoZgyNY`rzaVN~(5T3k~ljF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`q+fgbp>SPm*nTBmK0?s zd*+p-78MkwmL!4`4{94sJ+c_O`Ur#< z?aYk~3=9nP4M8N-Dr9MNt&#Y(B1=QH+USEa4N@ioCrXHDkc*ogmyJF+FN5;69hc!Z z%^n5@W<5_A#}E(Rx6^iKhd7F~mzx(Z4rJyud&Dfw>gt-SBO-FqZ0gk3rq-yN8aIBh z-?*XKbc4lZtxF)w#tlL|NfS7lj)X66ZB4kcXY$wIXV1O2+BrMr{knvwjrr$i8W%r1 z^ZH!Q$}jQ%9&%mD+FE26+pK*5LH=o#wU^vkmn~#Fom9CgM(=#$cKwpL#=IA2zBjGU zR@{F(Fucv{wzk8DG^4{hCaZ;>=3P-aVc#8ZJgr_fOFXAdcY{n`@P8KBX>Pkz7hYZ^ zq+z*5BF29%m+@VSf zroDOjz3=&Wn!{G_5D=KOcu!IM1AR@AK3f z&W1t8rJr8RT7Kzmz)_8iR-HcEs}nBpMU@>|wd9Y9n|9@`$P#l6)sNqnOpR;Qx7fbx zzt7_}P8K>vNw1&SF?4>rvzWh+$zG}@%ta%NJ*-I8JBxYwyVpJ%^3CQ7fd#8iIwySk zYopqRI zVjA+&XdC|n|2JVS&0i0^SO43ZednpG>A|?xxi{wR^jn+u)aY5$BD3U;Zol`0bzV3s zC*9x0!0+_^d-R43hF$-A^;8#bO7D%7Zu!8oc=LbWcl#%(U1+|ryh!Rxj@jh(CKl{{ zXXW3y7N=Lw-xlCL=iVE6?bN%ss}tGRu - - - - - - - - - - - - - - - -
- -
- -
- New - Open... - Save - Save as... -
-
-
- -
- Copy - Cut - Paste -
-
-
- -
- Eval Current File -
-
-
- -
- About CLOG Demo 3 -
-
- -
- - - diff --git a/tutorial/22-tutorial.lisp b/tutorial/22-tutorial.lisp new file mode 100644 index 0000000..8acdaf0 --- /dev/null +++ b/tutorial/22-tutorial.lisp @@ -0,0 +1,26 @@ +(defpackage #:clog-user + (:use #:cl #:clog) + (:export start-tutorial)) + +(in-package :clog-user) + +(defun on-new-window (body) + (clog-gui-initialize body) + (add-class body "w3-teal") + (let* ((menu (create-gui-menu-bar body)) + (icon (create-gui-menu-icon menu)) + (file (create-gui-menu-drop-down menu :content "File")) + (new (create-gui-menu-item file :content "New")) + (open (create-gui-menu-item file :content "Open")) + (save (create-gui-menu-item file :content "Save")) + (help (create-gui-menu-drop-down menu :content "Help")) + (about (create-gui-menu-item help :content "About")) + (fs (create-gui-menu-full-screen menu)))) + + (run body)) + +(defun start-tutorial () + "Start turtorial." + + (initialize #'on-new-window) + (open-browser))