This commit is contained in:
David Botton 2024-06-25 20:34:33 -04:00
commit b1ddfe15b9
8 changed files with 67 additions and 30 deletions

10
LINUX.md vendored
View file

@ -29,3 +29,13 @@ sbcl --eval '(ql:quickload :clog/tools)' --eval '(clog-tools:clog-builder)'
- [Learn about CLOG](README.md)
- [Learn Common-Lisp](LEARN.md)
TIPS:
Install "sudo apt install xdg-utils wslu" to install xdg-open so that wsl
uses the windows browser. Also create or add to your %UserProfile% (home dir) a
file .wslconfig with below or networking though nat and even localhost access
is dog slow. (Windows 11 on)
```
[wsl2]
networkingMode=mirrored
```

10
README.md vendored
View file

@ -132,8 +132,14 @@ CL-USER> (ql:quickload :clog) ; if not already loaded
CL-USER> (clog:run-tutorial 1)
```
Tip for Windows WSL linux user. Install "sudo apt install xdg-utils wslu" to
install xdg-open so that run-tutorial uses the windows browser.
_Tips for Windows WSL linux_ Install "sudo apt install xdg-utils wslu" to
install xdg-open so that run-tutorial uses the windows browser. Also create
or add to your %UserProfile% (home dir) a file .wslconfig with
```
[wsl2]
networkingMode=mirrored
```
To see where the source, tutorial and demo files are:

View file

@ -8,9 +8,7 @@
`(:name "clog-data"
:description "Panel Properties"
:events nil
:properties ((:name "panel name"
:attr "data-clog-name")
(:name "in-package"
:properties ((:name "in-package"
:attr "data-in-package")
(:name "custom slots"
:attr "data-custom-slots")

View file

@ -8,7 +8,7 @@
(let* ((*default-title-class* *builder-title-class*)
(*default-border-class* *builder-border-class*)
(win (create-gui-window obj :title "Control CLOG Events"
:left 225
:left (+ *builder-left-panel-size* 5)
:height 200 :width 645
:has-pinner t :client-movement *client-side-movement*))
(content (window-content win))
@ -59,7 +59,7 @@
(let* ((*default-title-class* *builder-title-class*)
(*default-border-class* *builder-border-class*)
(win (create-gui-window obj :title "Control Client JavaScript Events"
:left 225
:left (+ *builder-left-panel-size* 5)
:height 200 :width 645
:has-pinner t :client-movement *client-side-movement*))
(content (window-content win))
@ -112,7 +112,7 @@
(let* ((*default-title-class* *builder-title-class*)
(*default-border-class* *builder-border-class*)
(win (create-gui-window obj :title "Control Client ParenScript Events"
:left 225
:left (+ *builder-left-panel-size* 5)
:height 200 :width 645
:has-pinner t :client-movement *client-side-movement*))
(content (window-content win))

View file

@ -49,10 +49,9 @@
(win (create-gui-window obj :title "Controls"
:has-pinner t
:keep-on-top t
:width 220))
:width *builder-left-panel-size*))
(content (window-content win))
(sheight (floor (/ (height content) 2)))
(swidth (floor (width content)))
(divider (create-panel content :top sheight :height 10 :left 0 :right 10
:class *builder-title-class*))
(control-list (create-panel content :height (- sheight 10) :left 0 :bottom 0 :right 10))
@ -63,6 +62,7 @@
(setf (control-list-win app) control-list)
(setf (select-tool app) pallete)
(set-on-window-close win (lambda (obj)
(declare (ignore obj))
(setf (controls-win app) nil)
(setf (select-tool app) nil)
(setf (control-list-win app) nil)))

View file

@ -44,6 +44,10 @@
obj))
(placer (when control
(get-placer control)))
(panel-id (attribute placer "data-panel-id"))
(panel (if (current-control app)
(attach-as-child obj panel-id)
obj))
(table (properties-list app)))
(when prop-win
(setf (inner-html table) "")
@ -76,19 +80,31 @@
(setf (attribute control (getf prop :attr)) (text obj))))
props))
(t (print "Configuration error."))))
(when (equal (getf info :name) "clog-data")
(push
`("panel name" ,(attribute control "data-clog-name")
nil
,(lambda (obj)
(let ((vname (text obj)))
(unless (equal vname "")
(when (equal (subseq vname 0 1) "(")
(setf vname (format nil "|~A|" vname)))
(setf (attribute control "data-clog-name") vname)
(on-populate-control-list-win panel :win win)
(when win
(setf (window-title win) vname))))))
props))
(when (current-control app)
(let* (panel-controls
(cname (attribute control "data-clog-name"))
(ctype (attribute control "data-clog-type"))
(panel-id (attribute placer "data-panel-id"))
(panel (attach-as-child obj panel-id)))
(ctype (attribute control "data-clog-type")))
(maphash (lambda (k v)
(declare (ignore k))
(let ((n (attribute v "data-clog-name"))
(p (attribute (parent-element v) "data-clog-name")))
(unless (or (equal cname n)
(equal cname p))
(push n panel-controls))))
(push n panel-controls))))
(get-control-list app panel-id))
(push (attribute panel "data-clog-name") panel-controls)
(push
@ -129,6 +145,7 @@
(when (equal (subseq vname 0 1) "(")
(setf vname (format nil "|~A|" vname)))
(setf (attribute control "data-clog-name") vname)
(on-populate-control-list-win panel :win win)
(when (equal (getf info :name) "clog-data")
(when win
(setf (window-title win) vname)))))))

View file

@ -510,7 +510,7 @@ not a temporarily attached one when using select-control."
(*default-title-class* *builder-title-class*)
(*default-border-class* *builder-border-class*)
ext-panel
(win (create-gui-window obj :top 40 :left 225
(win (create-gui-window obj :top 40 :left (+ *builder-left-panel-size* 5)
:width 645 :height 430
:client-movement *client-side-movement*))
(box (create-panel-box-layout (window-content win)
@ -536,15 +536,14 @@ not a temporarily attached one when using select-control."
(m-lisp (create-gui-menu-drop-down menu :content "Lisp"))
(m-rndr (create-gui-menu-item m-lisp :content "render form to lisp"))
(m-rndras (create-gui-menu-item m-lisp :content "render form to lisp as..."))
(m-rndr (create-gui-menu-item m-lisp :content "render form to lisp"))
(m-eval (create-gui-menu-item m-lisp :content "evaluate"))
(m-test (create-gui-menu-item m-lisp :content "evaluate and test"))
(m-events (create-gui-menu-drop-down menu :content "controls"))
(tmp (create-gui-menu-item m-events :content "show control properties" :on-click 'on-show-control-properties-win))
(tmp (create-gui-menu-item m-events :content "show controls window" :on-click 'on-show-control-list-win))
(tmp (create-gui-menu-item m-events :content "show CLOG events" :on-click 'on-show-control-events-win))
(tmp (create-gui-menu-item m-events :content "show JavaScript events" :on-click 'on-show-control-js-events-win))
(tmp (create-gui-menu-item m-events :content "show ParenScript events" :on-click 'on-show-control-ps-events-win))
(tmp1 (create-gui-menu-item m-events :content "show control properties" :on-click 'on-show-control-properties-win))
(tmp2 (create-gui-menu-item m-events :content "show controls window" :on-click 'on-show-control-list-win))
(tmp3 (create-gui-menu-item m-events :content "show CLOG events" :on-click 'on-show-control-events-win))
(tmp4 (create-gui-menu-item m-events :content "show JavaScript events" :on-click 'on-show-control-js-events-win))
(tmp5 (create-gui-menu-item m-events :content "show ParenScript events" :on-click 'on-show-control-ps-events-win))
(m-help (create-gui-menu-drop-down menu :content "Help"))
(m-helpk (create-gui-menu-item m-help :content "quick start"))
(tool-bar (create-div (top-panel box) :class *builder-title-class*))
@ -564,7 +563,6 @@ not a temporarily attached one when using select-control."
(spacer (create-span tool-bar :content "   "))
(btn-help (create-span tool-bar :content "?" :class "w3-tiny w3-ripple"))
(content (center-panel box))
(in-simulation nil)
(undo-chain nil)
(redo-chain nil)
(is-dirty nil)
@ -572,7 +570,7 @@ not a temporarily attached one when using select-control."
(file-name "")
(render-file-name "")
(panel-id (html-id content)))
(declare (ignore spacer))
(declare (ignore spacer tmp1 tmp2 tmp3 tmp4 tmp5))
(add-class menu "w3-small")
(setf (overflow (top-panel box)) :visible) ; let menus leave the top panel
(add-class (top-panel box) *builder-title-class*)
@ -644,7 +642,7 @@ not a temporarily attached one when using select-control."
(on-populate-control-properties-win content :win win :clear t)
(setf content nil)
(setf ext-panel nil)
(Window-close win)))
(window-close win)))
(set-on-click (create-gui-menu-item m-file :content "export as a boot html")
(lambda (obj)
(server-file-dialog obj "Export as a Boot HTML" "./"
@ -685,8 +683,11 @@ not a temporarily attached one when using select-control."
(set-on-window-focus win
(lambda (obj)
(declare (ignore obj))
(on-populate-control-properties-win content :win win)
(on-populate-control-list-win content :win win)))
(unless (eq (last-panel-editor app) win)
(progn
(on-populate-control-properties-win content :win win)
(on-populate-control-list-win content :win win)
(setf (last-panel-editor app) win)))))
(set-on-window-close win
(lambda (obj)
(declare (ignore obj))
@ -828,10 +829,11 @@ not a temporarily attached one when using select-control."
(setf is-dirty nil)
(clrhash (get-control-list app panel-id))
(on-populate-loaded-window content :win win)
(setf (window-title win) (attribute content "data-clog-name"))
(when ext-panel
(setf (title (html-document ext-panel)) (attribute content "data-clog-name")))
(setf (window-param win) fname)
(setf (window-title win) (attribute content "data-clog-name"))
(on-populate-control-properties-win content :win win)
(on-populate-control-list-win content :win win))
(load-file (obj)
(server-file-dialog obj "Load Panel" (directory-namestring (if (equal file-name "")

View file

@ -137,6 +137,10 @@ clog-builder window.")
:accessor control-list-win
:initform nil
:documentation "Current control list window")
(last-panel-editor
:accessor last-panel-editor
:initform nil
:documentation "Last editor panel focused, to avoid recalculations")
(control-pallete-win
:accessor control-pallete-win
:initform nil
@ -575,7 +579,7 @@ clog-builder window.")
(format t "~%If browser does not start go to http://127.0.0.1:~A~A" clog:*clog-port* open-url)
(open-browser :url (format nil "http://127.0.0.1:~A~A" clog:*clog-port* open-url))))
(defun clog-builder (&key (port 8080) (start-browser t)
(defun clog-builder (&key (host "0.0.0.0") (port 8080) (start-browser t)
app project dir static-root system clogframe)
"Start clog-builder.
:PROJECT - load ASDF Project, start its static root and set as current
@ -609,8 +613,8 @@ clog-builder window.")
(unless *app-mode*
(setf *app-mode* 0)))
(if static-root
(initialize nil :port port :static-root static-root)
(initialize nil :port port))
(initialize nil :host host :port port :static-root static-root)
(initialize nil :host host :port port))
(setf port clog:*clog-port*)
(set-on-new-window 'on-new-builder :path "/builder")
(set-on-new-window 'on-open-panel-window :path "/panel-editor")