clog-gui-initialize can be set with use-clog-debugger

This commit is contained in:
David Botton 2024-04-04 16:22:01 -04:00
parent eca4c2dd43
commit 9eef74a803
4 changed files with 182 additions and 164 deletions

View file

@ -47,7 +47,9 @@
"Aborting this old connection since receiving a reconnection request.")
(t (c)
(when *verbose-output*
(format t "Failed to close the old connection when establishing reconnection. This can be normal: The old connection could probably don't work for the client, so the client is requesting to reconnect.~%Condition - ~A.~&"
(format t "Failed to close the old connection when establishing reconnection. ~
This can be normal: The old connection could probably don't work for the client, ~
so the client is requesting to reconnect.~%Condition - ~A.~&"
c))))
(setf (gethash id *connection-ids*) connection)
(setf (gethash connection *connections*) id))
@ -113,7 +115,10 @@
(event (when event-hash
(gethash event-id event-hash))))
(when event
(funcall event data)))
(let* ((debug-hook (gethash "clog-debug" event-hash)))
(if debug-hook
(funcall debug-hook event data)
(funcall event data)))))
(handler-case
(let* ((event-hash (get-connection-data connection-id))
(event (when event-hash

View file

@ -218,12 +218,16 @@
(defun clog-gui-initialize (clog-body &key
(body-left-offset 0)
(body-right-offset 0)
(use-clog-debugger nil)
(w3-css-url "/css/w3.css")
(jquery-ui-css "/css/jquery-ui.css")
(jquery-ui "/js/jquery-ui.js"))
"Initializes clog-gui and installs a clog-gui object on connection.
If W3-CSS-URL has not been loaded before is installed unless is nil.
BODY-LEFT-OFFSET and BODY-RIGHT-OFFSET limit width on maximize."
BODY-LEFT-OFFSET and BODY-RIGHT-OFFSET limit width on maximize. If
use-clog-debugger then a graphical debugger is set for all events.
NOTE: use-clog-debugger should not be set for security issues
on non-secure environments."
(let ((app (create-clog-gui clog-body)))
(setf (body-left-offset app) body-left-offset)
(setf (body-right-offset app) body-right-offset))
@ -237,7 +241,12 @@ BODY-LEFT-OFFSET and BODY-RIGHT-OFFSET limit width on maximize."
(when jquery-ui-css
(load-css (html-document clog-body) jquery-ui-css))
(when jquery-ui
(load-script (html-document clog-body) jquery-ui)))
(load-script (html-document clog-body) jquery-ui))
(when use-clog-debugger
(setf (connection-data-item clog-body "clog-debug")
(lambda (event data)
(with-clog-debugger (clog-body)
(funcall event data))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Implementation - Menus

View file

@ -57,6 +57,9 @@ the same as the clog directy this overides the relative paths used in them.")
(setf (connection-data-item body "clog-path") path)
(setf (connection-data-item body "clog-body") body)
(setf (connection-data-item body "clog-sync") (bordeaux-threads:make-lock))
;; clog-debug is called for every with (event data)
;; see clog-gui:clog-gui-initialize
(setf (connection-data-item body "clog-debug") nil)
(funcall on-new-window body))
(put-br (html-document body) "No route to on-new-window")))))

View file

@ -326,8 +326,9 @@ clog-builder window.")
(open-ext (form-data-item (form-get-data body) "open-ext")))
(setf (connection-data-item body "builder-app-data") app)
(setf (title (html-document body)) "CLOG Builder")
(clog-gui-initialize body)
(clog-gui-initialize body :use-clog-debugger t)
(add-class body *builder-window-desktop-class*)
(with-clog-debugger (body)
(when *builder-window-show-static-root-class*
(setf (z-index (create-panel body :positioning :fixed
:bottom 0 :left 0
@ -490,7 +491,7 @@ clog-builder window.")
"")))
(when *app-mode*
(incf *app-mode*))
(run body)
(run body))
(when *app-mode*
(decf *app-mode*)
(when (<= *app-mode* 0)