mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-05 18:20:36 -08:00
Move demos and tutorials to their own packages
This commit is contained in:
parent
63586cfb0f
commit
2c7230356e
35 changed files with 75 additions and 83 deletions
4
FAQ
4
FAQ
|
|
@ -15,8 +15,8 @@ Q) I want to take an HTML snapshot of a clog created page:
|
|||
|
||||
(format t "=> ~A" (outer-html (document-element (html-document body))))
|
||||
|
||||
or (save-body-to-file)
|
||||
or see CLOG:SAVE-BODY-TO-FILE
|
||||
|
||||
Q) I want to know where the :CLOG tutorials, demos and sources.
|
||||
|
||||
Use (clog-install-dir)
|
||||
Use (clog:clog-install-dir)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(defpackage #:clog-user
|
||||
(defpackage #:clog-demo-1
|
||||
(:use #:cl #:clog)
|
||||
(:export start-demo))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-demo-1)
|
||||
|
||||
;; Game Display
|
||||
(defconstant display-width 375)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(defpackage #:clog-user
|
||||
(defpackage #:clog-demo-2
|
||||
(:use #:cl #:clog)
|
||||
(:export start-demo))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-demo-2)
|
||||
|
||||
(defvar *global-list-box-hash* (make-hash-table :test 'equalp)
|
||||
"Username to update function")
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
;;; As this demo uses eval do not run over the internet.
|
||||
;;; This app gives access to its users your local files.
|
||||
|
||||
(defpackage #:clog-user
|
||||
(defpackage #:clog-demo-3
|
||||
(:use #:cl #:clog #:clog-gui)
|
||||
(:export start-demo))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-demo-3)
|
||||
|
||||
(defclass app-data ()
|
||||
((copy-buf
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
;;;; Demo 4 - CMS Website
|
||||
|
||||
(defpackage #:clog-user
|
||||
(defpackage #:clog-demo-4
|
||||
(:use #:cl #:clog #:clog-web)
|
||||
(:export start-demo))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-demo-4)
|
||||
|
||||
;; Site Configuration
|
||||
(defparameter side-panel-size 200 "Size of menu")
|
||||
|
|
|
|||
|
|
@ -15,14 +15,7 @@ To load "clog":
|
|||
Load the demo:
|
||||
|
||||
```
|
||||
CL-USER> (load "/Users/dbotton/common-lisp/clog/demos/01-demo.lisp")
|
||||
#P"/Users/dbotton/common-lisp/clog/demos/01-demo.lisp"
|
||||
```
|
||||
|
||||
Start the demo:
|
||||
|
||||
```
|
||||
CL-USER> (clog-user:start-demo)
|
||||
CL-USER> (clog:run-demo 1)
|
||||
Hunchentoot server is started.
|
||||
Listening on 0.0.0.0:8080.
|
||||
HTTP listening on : 0.0.0.0:8080
|
||||
|
|
|
|||
|
|
@ -47,7 +47,9 @@
|
|||
(defun run-tutorial (num)
|
||||
"Run tutorial NUM"
|
||||
(load-tutorial num)
|
||||
(funcall (symbol-function (find-symbol "START-TUTORIAL" "CLOG-USER"))))
|
||||
(funcall (symbol-function (find-symbol
|
||||
"START-TUTORIAL"
|
||||
(format nil "CLOG-TUT-~A" num)))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;
|
||||
;; load-tutorial ;;
|
||||
|
|
@ -67,7 +69,9 @@
|
|||
(defun run-demo (num)
|
||||
"Run demo NUM"
|
||||
(load-demo num)
|
||||
(funcall (symbol-function (find-symbol "START-DEMO" "CLOG-USER"))))
|
||||
(funcall (symbol-function (find-symbol
|
||||
"START-DEMO"
|
||||
(format nil "CLOG-DEMO-~A" num)))))
|
||||
|
||||
;;;;;;;;;;;;;;;
|
||||
;; load-demo ;;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(defpackage #:clog-user ; Setup a package for our work to exist in
|
||||
(defpackage #:clog-tut-1 ; Setup a package for our work to exist in
|
||||
(:use #:cl #:clog) ; Use the Common Lisp language and CLOG
|
||||
(:export start-tutorial)) ; Export as public the start-tutorial function
|
||||
|
||||
(in-package :clog-user) ; Tell the "reader" we are in the clog-user package
|
||||
(in-package :clog-tut-1) ; Tell the "reader" we are in the clog-user package
|
||||
|
||||
|
||||
;; Define our CLOG application
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-2
|
||||
(:use #:cl #:clog)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-2)
|
||||
|
||||
(defun on-new-window (body)
|
||||
"On-new-window handler."
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-3
|
||||
(:use #:cl #:clog)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-3)
|
||||
|
||||
(defun on-new-window (body)
|
||||
"On-new-window handler."
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-4
|
||||
(:use #:cl #:clog)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-4)
|
||||
|
||||
(defun my-on-click (obj) ; obj in any event is the target of the event
|
||||
(setf (color obj) (rgb 0 255 0))) ; this makes it possible to reuse event handlers
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-5
|
||||
(:use #:cl #:clog)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-5)
|
||||
|
||||
(defun my-on-click (obj)
|
||||
;; Using connection-data-item it is possible to pass data that
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-6
|
||||
(:use #:cl #:clog)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-6)
|
||||
|
||||
(defun my-on-click (obj)
|
||||
(print "Event thread started") ; Every click will add a thread
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-7
|
||||
(:use #:cl #:clog)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-7)
|
||||
|
||||
(defun on-click (obj)
|
||||
(setf (text obj) "DEAD")
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-8
|
||||
(:use #:cl #:clog)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-8)
|
||||
|
||||
(defclass app-data ()
|
||||
((drag-mutex
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-9
|
||||
(:use #:cl #:clog)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-9)
|
||||
|
||||
(defun on-new-window (body)
|
||||
(setf (title (html-document body)) "Tutorial 9")
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-10
|
||||
(:use #:cl #:clog)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-10)
|
||||
|
||||
;;; A very brief example of using the canvas control.
|
||||
(defun on-new-window (body)
|
||||
|
|
|
|||
|
|
@ -29,11 +29,11 @@
|
|||
;;; We go in the browser to the file
|
||||
;;; "http://127.0.0.1:8080/tutorial/tut-11.html"
|
||||
|
||||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-11
|
||||
(:use #:cl #:clog)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-11)
|
||||
|
||||
(defun on-new-window (body)
|
||||
;; This will turn on debug output in the browser console.
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@
|
|||
;;;
|
||||
;;; See START-TUTORIAL below.
|
||||
|
||||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-12
|
||||
(:use #:cl #:clog)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-12)
|
||||
|
||||
(defun on-main (body)
|
||||
(let ((sb (create-style-block body)))
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-13
|
||||
(:use #:cl #:clog)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-13)
|
||||
|
||||
(defun start-tutorial ()
|
||||
"Start tutorial."
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-14
|
||||
(:use #:cl #:clog)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-14)
|
||||
|
||||
;;; HTML 5 local storage are the best way to stort client side data
|
||||
;;; and in general are a far better than cookies.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-15
|
||||
(:use #:cl #:clog)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-15)
|
||||
|
||||
;;; Brief demonstration of multimedia
|
||||
(defun on-new-window (body)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-16
|
||||
(:use #:cl #:clog)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-16)
|
||||
|
||||
;;; In previous tutorials we attached to an html file using bootstrap. For this tutorial we
|
||||
;;; are going to create a bootstrap 4.0 page just using CLOG.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-17
|
||||
(:use #:cl #:clog)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-17)
|
||||
|
||||
;;; In this tutorial we will use a CSS only alternative to bootstrap -
|
||||
;;; https://www.w3schools.com/w3css/default.asp
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-18
|
||||
(:use #:cl #:clog)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-18)
|
||||
|
||||
;; Demonstrate drag and drop
|
||||
(defun on-new-window (body)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-19
|
||||
(:use #:cl #:clog)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-19)
|
||||
|
||||
;;; In this tutorial we will see how to easily use a JavaScript
|
||||
;;; component. In the static-files directory there is a simple
|
||||
|
|
|
|||
|
|
@ -47,11 +47,11 @@
|
|||
(js-execute obj (format nil "JSLists.applyToList('~A', 'ALL');"
|
||||
(html-id obj))))
|
||||
|
||||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-20
|
||||
(:use #:cl #:clog)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-20)
|
||||
|
||||
(defun on-new-window (body)
|
||||
(clog-toggler:init-toggler body)
|
||||
|
|
|
|||
|
|
@ -42,11 +42,11 @@ on the drop-root."))
|
|||
(setf (hiddenp (drop-root new-obj)) t))))
|
||||
new-obj))
|
||||
|
||||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-21
|
||||
(:use #:cl #:clog)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-21)
|
||||
|
||||
(defun on-new-window (body)
|
||||
(let* ((drop-list (clog-drop-list:create-drop-list body :content "Top of tree"))
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-22
|
||||
(:use #:cl #:clog #:clog-gui) ; For this tutorial we include clog-gui
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-22)
|
||||
|
||||
;;; Demostrate a virtual desktop using CLOG GUI
|
||||
(defun on-file-count (obj)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-23
|
||||
(:use #:cl #:clog #:clog-gui)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-23)
|
||||
|
||||
;; This is a simple demo using semaphores to wait for user input
|
||||
;; ask demonstrates the mechanics in general and the modal dialog
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
;; In this tutorial we use clog-web to create a dynamic modern mobile
|
||||
;; compatible web page using various clog-web containers.
|
||||
|
||||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-24
|
||||
(:use #:cl #:clog #:clog-web)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-24)
|
||||
|
||||
(defun on-new-window (body)
|
||||
(clog-web-initialize body)
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@
|
|||
;;;; | |
|
||||
;;;; ---------------------------------------------------------
|
||||
|
||||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-25
|
||||
(:use #:cl #:clog #:clog-web)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-25)
|
||||
|
||||
(defun on-new-window (body)
|
||||
(clog-web-initialize body)
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@
|
|||
;;;; completely flexible in how you choose to use it.
|
||||
|
||||
|
||||
(defpackage #:clog-user
|
||||
(defpackage #:clog-tut-26
|
||||
(:use #:cl #:clog #:clog-web)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-26)
|
||||
|
||||
(defun on-new-window (body)
|
||||
(clog-web-initialize body)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
(defpackage #:clog-user
|
||||
;; This tutorial demonstrates the panel box layout method
|
||||
|
||||
(defpackage #:clog-tut-27
|
||||
(:use #:cl #:clog)
|
||||
(:export start-tutorial))
|
||||
|
||||
(in-package :clog-user)
|
||||
(in-package :clog-tut-27)
|
||||
|
||||
(defun on-new-window (body)
|
||||
(let* ((console (create-panel-box-layout body :left-width 200 :right-width 0))
|
||||
|
|
|
|||
|
|
@ -10,17 +10,10 @@ To load "clog":
|
|||
(:CLOG)
|
||||
```
|
||||
|
||||
Load the tutorial:
|
||||
Run the tutorial:
|
||||
|
||||
```
|
||||
CL-USER> (load "/Users/dbotton/common-lisp/clog/tutorial/01-tutorial.lisp")
|
||||
#P"/Users/dbotton/common-lisp/clog/tutorial/01-tutorial.lisp"
|
||||
```
|
||||
|
||||
Start the tutorial:
|
||||
|
||||
```
|
||||
CL-USER> (clog-user:start-tutorial)
|
||||
CL-USER> (clog:run-tutorial 1)
|
||||
Hunchentoot server is started.
|
||||
Listening on 0.0.0.0:8080.
|
||||
HTTP listening on : 0.0.0.0:8080
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue