diff --git a/clog.asd b/clog.asd index 02dca85..3b9fdf4 100644 --- a/clog.asd +++ b/clog.asd @@ -58,4 +58,5 @@ (:file "clog-builder-repl") (:file "image-to-data") (:file "quick-start") + (:file "threads") (:file "clog-builder-images"))) diff --git a/tools/clog-builder.lisp b/tools/clog-builder.lisp index 04254b6..b9ddbeb 100644 --- a/tools/clog-builder.lisp +++ b/tools/clog-builder.lisp @@ -2045,6 +2045,15 @@ of controls and double click to select control." :client-movement t))) (create-quick-start (window-content win)))) +(defun on-show-thread-viewer (obj) + "Open quick start" + (let* ((win (create-gui-window obj :title "Thread Viewer" + :top 40 :left 225 + :width 600 :height 400 + :client-movement t))) + (create-thread-list (window-content win)))) + + (defun on-open-file (obj) (let* ((app (connection-data-item obj "builder-app-data")) (win (create-gui-window obj :title "New Source Editor" @@ -2194,6 +2203,7 @@ of controls and double click to select control." (create-gui-menu-item file :content "New Application Template" :on-click 'on-new-app-template) (create-gui-menu-item src :content "New Source Editor" :on-click 'on-open-file) (create-gui-menu-item tools :content "Control Events" :on-click 'on-show-control-events-win) + (create-gui-menu-item tools :content "Thread Viewer" :on-click 'on-show-thread-viewer) (create-gui-menu-item tools :content "CLOG Builder REPL" :on-click 'on-repl) (create-gui-menu-item tools :content "Copy/Cut History" :on-click 'on-show-copy-history-win) (create-gui-menu-item tools :content "Image to HTML Data" :on-click 'on-image-to-data) diff --git a/tools/threads.clog b/tools/threads.clog new file mode 100644 index 0000000..4ef93c8 --- /dev/null +++ b/tools/threads.clog @@ -0,0 +1,10 @@ +
\ No newline at end of file diff --git a/tools/threads.lisp b/tools/threads.lisp new file mode 100644 index 0000000..9466368 --- /dev/null +++ b/tools/threads.lisp @@ -0,0 +1,19 @@ +(in-package "CLOG-TOOLS") +(defclass thread-list (clog:clog-panel) + ( (w3-table-1 :reader w3-table-1) +)) +(defun create-thread-list (clog-obj &key (hidden nil) (class nil) (html-id nil) (auto-place t)) + (let ((panel (change-class (clog:create-div clog-obj :content "
" + :hidden hidden :class class :html-id html-id :auto-place auto-place) 'thread-list))) + (setf (slot-value panel 'w3-table-1) (attach-as-child clog-obj "CLOGB3867860624" :clog-type 'CLOG:CLOG-TABLE :new-id t)) + (let ((target (w3-table-1 panel))) (declare (ignorable target)) (loop + (let ((threads (swank:list-threads))) + (dolist (thread threads) + (let ((tr (create-table-row target))) + (create-table-column tr :content (second thread)) + (create-table-column tr :content (third thread))))) + (sleep 1) + (setf (inner-html target) "") + (unless (visiblep target) + (return)))) + panel))