From f5c95ee2fa7c02c2c0d44df68b4328227408e8b1 Mon Sep 17 00:00:00 2001
From: David Botton
Date: Sun, 24 Jan 2021 17:32:06 -0500
Subject: [PATCH] Start of multimedia additions
---
README.md | 10 ++--
clog-docs.lisp | 22 +++----
clog-multimedia.lisp | 120 ++++++++++++++++++++++++++++++++++++++
clog.asd | 3 +-
clog.lisp | 11 ++++
doc/clog-manual.html | 24 ++++----
tutorial/15-tutorial.lisp | 17 ++++++
7 files changed, 175 insertions(+), 32 deletions(-)
create mode 100644 clog-multimedia.lisp
create mode 100644 tutorial/15-tutorial.lisp
diff --git a/README.md b/README.md
index afcd179..9e00bee 100644
--- a/README.md
+++ b/README.md
@@ -16,11 +16,11 @@ frameworks and website frameworks. The CLOG package starts up the
connectivity to the browser or other websocket client (often a browser
embedded in a native template application.)
-STATUS: CLOG is complete enough for most uses. While there are loose
-ends (multimedia, database integrations), CLOG is actually based on
-GNOGA, a framework I wrote for Ada in 2013 and used in commercial
-production code for the last 6 years, i.e. the techiniques CLOG uses
-are solid and proven.
+STATUS: CLOG is complete enough for most uses. See below for some
+enhacements bing worked on, CLOG is actually based on GNOGA, a
+framework I wrote for Ada in 2013 and used in commercial production
+code for the last 6 years, i.e. the techiniques CLOG uses are solid
+and proven.
Some potential applications for CLOG:
diff --git a/clog-docs.lisp b/clog-docs.lisp
index 14b177a..7a9d76b 100644
--- a/clog-docs.lisp
+++ b/clog-docs.lisp
@@ -13,17 +13,13 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defsection @clog-getting-started (:title "CLOG Getting Started")
-"# CLOG - The Common Lisp Omnificent GUI
+"CLOG - The Common Lisp Omnificent GUI
-## David Botton
+David Botton
License BSD 3-Clause License
-View the HTML Documentation:
-
-https://rabbibotton.github.io/clog/clog-manual.html
-
-### Introduction
+- Introduction
The Common Lisp Omnificent GUI, CLOG for short, uses web technology to
produce graphical user interfaces for applications locally or remotely.
@@ -32,11 +28,11 @@ frameworks and website frameworks. The CLOG package starts up the
connectivity to the browser or other websocket client (often a browser
embedded in a native template application.)
-STATUS: CLOG is complete enough for most uses. While there are loose
-ends (multimedia, database integrations), CLOG is actually based on
-GNOGA, a framework I wrote for Ada in 2013 and used in commercial
-production code for the last 6 years, i.e. the techiniques CLOG uses
-are solid and proven.
+STATUS: CLOG is complete enough for most uses. See the README.md for
+some enhacements bing worked on, CLOG is actually based on GNOGA, a
+framework I wrote for Ada in 2013 and used in commercial production
+code for the last 6 years, i.e. the techiniques CLOG uses are solid
+and proven.
Some potential applications for CLOG:
@@ -255,7 +251,7 @@ From clog-window
")
(defsection @clog-internals (:title "CLOG Framework internals and extensions")
-"## Responding to new java script DOM events
+"Responding to new java script DOM events
If there is no data for the event just changing the name of the event is
sufficient in this example:
diff --git a/clog-multimedia.lisp b/clog-multimedia.lisp
new file mode 100644
index 0000000..ccadf46
--- /dev/null
+++ b/clog-multimedia.lisp
@@ -0,0 +1,120 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;; CLOG - The Common Lisp Omnificent GUI ;;;;
+;;;; (c) 2020-2021 David Botton ;;;;
+;;;; License BSD 3 Clause ;;;;
+;;;; ;;;;
+;;;; clog-mulitmedia.lisp ;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(cl:in-package :clog)
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Implementation - clog-multimedia
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defclass clog-multimedia (clog-element)()
+ (:documentation "CLOG Multimedia base class."))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Implementation - clog-audio
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defclass clog-audio (clog-multimedia)()
+ (:documentation "CLOG Audio class."))
+
+;;;;;;;;;;;;;;;;;;
+;; create-audio ;;
+;;;;;;;;;;;;;;;;;;
+
+(defgeneric create-audio (clog-obj &key
+ source
+ controls
+ preload
+ autoplay
+ autoloop
+ muted
+ auto-place)
+ (:documentation "Create a CLOG Audio control"))
+
+(defmethod create-audio ((obj clog-obj)
+ &key (source "")
+ (controls t)
+ (preload nil)
+ (autoplay nil)
+ (autoloop nil)
+ (muted nil)
+ (auto-place t))
+ (create-child obj (format nil " "
+ (if (equal source "")
+ ""
+ (format nil " src='~A'" (escape-string source)))
+ (if controls
+ " controls"
+ "")
+ (if preload
+ " preload='auto'"
+ "")
+ (if autoplay
+ " autoplay"
+ "")
+ (if autoloop
+ " loop"
+ "")
+ (if muted
+ " muted"
+ ""))
+ :clog-type 'clog-audio :auto-place auto-place))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Implementation - clog-video
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defclass clog-video (clog-multimedia)()
+ (:documentation "CLOG Video class."))
+
+(defgeneric create-video (clog-obj &key
+ source
+ controls
+ preload
+ poster
+ autoplay
+ autoloop
+ muted
+ auto-place)
+(:documentation "Create a CLOG video control"))
+
+(defmethod create-video ((obj clog-obj)
+ &key (source "")
+ (controls t)
+ (preload nil)
+ (poster "")
+ (autoplay nil)
+ (autoloop nil)
+ (muted nil)
+ (auto-place t))
+ (create-child obj (format nil " "
+ (if (equal source "")
+ ""
+ (format nil " src='~A'" (escape-string source)))
+ (if controls
+ " controls"
+ "")
+ (if preload
+ " preload='auto'"
+ "")
+ (if (equal poster "")
+ ""
+ (format nil " poster='~A'" (escape-string poster)))
+ (if autoplay
+ " autoplay"
+ "")
+ (if autoloop
+ " loop"
+ "")
+ (if muted
+ " muted"
+ ""))
+ :clog-type 'clog-video :auto-place auto-place))
+
diff --git a/clog.asd b/clog.asd
index 2da0df0..dc1c43a 100644
--- a/clog.asd
+++ b/clog.asd
@@ -5,7 +5,7 @@
:author "David Botton "
:license "BSD"
- :version "0.2.0"
+ :version "0.8.0"
:serial t
:depends-on (#:clack #:websocket-driver #:alexandria #:hunchentoot #:cl-ppcre
#:bordeaux-threads #:trivial-open-browser
@@ -21,6 +21,7 @@
(:file "clog-element-common")
(:file "clog-canvas")
(:file "clog-form")
+ (:file "clog-multimedia")
(:file "clog-window")
(:file "clog-document")
(:file "clog-location")
diff --git a/clog.lisp b/clog.lisp
index b9133fb..9f3d0ff 100644
--- a/clog.lisp
+++ b/clog.lisp
@@ -37,6 +37,7 @@ embedded in a native template application.)"
(@clog-element-common section)
(@clog-form section)
(@clog-canvas section)
+ (@clog-multimedia section)
(@clog-body section)
(@clog-window section)
(@clog-document section)
@@ -430,6 +431,16 @@ embedded in a native template application.)"
(canvas-save generic-function)
(canvas-restore generic-function))
+(defsection @clog-multimedia (:title "CLOG Multimedia Objects")
+ "CLOG-Multimedia - Base Class for CLOG multimedia objects"
+ (clog-multimedia class)
+
+ (clog-audio class)
+ (create-audio generic-function)
+
+ (clog-video class)
+ (create-video generic-function))
+
(defsection @clog-body (:title "CLOG Body Objects")
"CLOG-Body - CLOG Body Objects"
(clog-body class)
diff --git a/doc/clog-manual.html b/doc/clog-manual.html
index 8ee4207..3c6d2ff 100644
--- a/doc/clog-manual.html
+++ b/doc/clog-manual.html
@@ -67,17 +67,15 @@ embedded in a native template application.)
-CLOG - The Common Lisp Omnificent GUI
+CLOG - The Common Lisp Omnificent GUI
-
+David Botton mailto:david@botton.com
License BSD 3-Clause License
-View the HTML Documentation:
-
-https://rabbibotton.github.io/clog/clog-manual.html
-
-Introduction
+
The Common Lisp Omnificent GUI, CLOG for short, uses web technology to
produce graphical user interfaces for applications locally or remotely.
@@ -86,11 +84,11 @@ frameworks and website frameworks. The CLOG package starts up the
connectivity to the browser or other websocket client (often a browser
embedded in a native template application.)
-STATUS: CLOG is complete enough for most uses. While there are loose
-ends (multimedia, database integrations), CLOG is actually based on
-GNOGA, a framework I wrote for Ada in 2013 and used in commercial
-production code for the last 6 years, i.e. the techiniques CLOG uses
-are solid and proven.
+STATUS: CLOG is complete enough for most uses. See the README.md for
+some enhacements bing worked on, CLOG is actually based on GNOGA, a
+framework I wrote for Ada in 2013 and used in commercial production
+code for the last 6 years, i.e. the techiniques CLOG uses are solid
+and proven.
Some potential applications for CLOG:
@@ -3765,7 +3763,7 @@ on-storage event is fired for changes to :local storage keys.
-Responding to new java script DOM events
+Responding to new java script DOM events
If there is no data for the event just changing the name of the event is
sufficient in this example:
diff --git a/tutorial/15-tutorial.lisp b/tutorial/15-tutorial.lisp
new file mode 100644
index 0000000..9432437
--- /dev/null
+++ b/tutorial/15-tutorial.lisp
@@ -0,0 +1,17 @@
+(defpackage #:clog-user
+ (:use #:cl #:clog)
+ (:export start-tutorial))
+
+(in-package :clog-user)
+
+(defun on-new-window (body)
+ (create-video body :source "https://www.w3schools.com/html/mov_bbb.mp4")
+ (create-audio body :source "https://www.w3schools.com/html/horse.ogg")
+
+ (run body))
+
+(defun start-tutorial ()
+ "Start turtorial."
+
+ (initialize #'on-new-window)
+ (open-browser))