diff --git a/clog.asd b/clog.asd index e52b058..45d8827 100644 --- a/clog.asd +++ b/clog.asd @@ -64,10 +64,12 @@ (:file "sys-browser") (:file "projects") (:file "clog-builder-repl") + (:file "dir-view") ;; clog-builder code (:file "clog-builder-settings") (:file "clog-builder") (:file "clog-builder-projects") (:file "clog-builder-asdf-browser") (:file "clog-builder-sys-browser") + (:file "clog-builder-dir-win") (:file "clog-builder-images"))) diff --git a/tools/clog-builder-dir-win.lisp b/tools/clog-builder-dir-win.lisp new file mode 100644 index 0000000..ecf55cc --- /dev/null +++ b/tools/clog-builder-dir-win.lisp @@ -0,0 +1,25 @@ +(in-package :clog-tools) + +(defun populate-dir-win (panel d) + (let ((dir (directory-namestring (uiop:truename* d)))) + ;; Dirs + (setf (inner-html (folders panel)) "") + (add-select-option (folders panel) + (format nil "~A" dir) + (format nil ". (~A)" dir)) + (unless (or (equalp dir "/") (equalp dir #P"/")) + (add-select-option (folders panel) (format nil "~A../" dir) "..")) + (dolist (item (uiop:subdirectories dir)) + (add-select-option (folders panel) item item)) + ;; Files + (setf (inner-html (files panel)) "") + (dolist (item (uiop:directory-files (directory-namestring dir))) + (add-select-option (files panel) item (file-namestring item))))) + +(defun on-select-dir-win (panel) + (let ((item (value (files panel)))) + (cond ((and (> (length item) 5) + (equal (subseq item (- (length item) 5)) ".clog")) + (on-new-builder-panel panel :open-file item)) + (t + (on-open-file panel :open-file item))))) diff --git a/tools/clog-builder-projects.lisp b/tools/clog-builder-projects.lisp index c5d05a7..89f8410 100644 --- a/tools/clog-builder-projects.lisp +++ b/tools/clog-builder-projects.lisp @@ -11,7 +11,15 @@ (setf (text-value (project-list panel)) (current-project app)) (projects-populate panel)) (t - (setf (text-value (project-list panel)) "None"))))) + (setf (text-value (project-list panel)) "None") + (projects-populate panel))))) + +(defun projects-view-dir (panel) + (ignore-errors + (let* ((app (connection-data-item panel "builder-app-data")) + (sel (text-value (project-list panel))) + (sys (asdf:find-system (format nil "~A" sel)))) + (on-dir-win panel :dir (asdf:system-source-directory sys))))) (defun projects-run (panel) (let ((val (text-value (entry-point panel)))) diff --git a/tools/clog-builder.lisp b/tools/clog-builder.lisp index 2bf1ab4..1126696 100644 --- a/tools/clog-builder.lisp +++ b/tools/clog-builder.lisp @@ -2536,7 +2536,7 @@ of controls and double click to select control." :eval-in-package (text-value pac-line)))) (on-open-file obj :title-class "w3-blue" :title "file eval" :text result)))))))) (defun on-repl (obj) - "Open quick start" + "Open REPL" (let* ((win (create-gui-window obj :title "CLOG Builder REPL" :top 40 :left 225 :width 600 :height 400 @@ -2588,6 +2588,17 @@ of controls and double click to select control." :title-class "w3-red" :text c))))))) +(defun on-dir-win (obj &key dir) + "Open dir window" + (let* ((win (create-gui-window obj :title "Directory Window" + :top 40 :left 225 + :width 600 :height 400 + :client-movement t)) + (d (create-dir-view (window-content win)))) + (set-geometry d :units "%" :width 100 :height 100) + (when dir + (populate-dir-win d dir)))) + (defun on-new-builder (body) "Launch instance of the CLOG Builder" (set-html-on-close body "Connection Lost") @@ -2620,6 +2631,7 @@ of controls and double click to select control." (Create-gui-menu-item src :content "New System Browser" :on-click 'on-new-sys-browser) (create-gui-menu-item src :content "New ASDF System Browser" :on-click 'on-new-asdf-browser) (create-gui-menu-item tools :content "Control Events" :on-click 'on-show-control-events-win) + (create-gui-menu-item tools :content "Directory Window" :on-click 'on-dir-win) (create-gui-menu-item tools :content "List Callers" :on-click 'on-show-callers) (create-gui-menu-item tools :content "List Callees" :on-click 'on-show-callees) (create-gui-menu-item tools :content "Thread Viewer" :on-click 'on-show-thread-viewer) diff --git a/tools/dir-view.clog b/tools/dir-view.clog new file mode 100644 index 0000000..c8d44e8 --- /dev/null +++ b/tools/dir-view.clog @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/tools/dir-view.lisp b/tools/dir-view.lisp new file mode 100644 index 0000000..ca69b8e --- /dev/null +++ b/tools/dir-view.lisp @@ -0,0 +1,35 @@ +;;;; CLOG Builder generated code - modify original clog file +(in-package :clog-tools) +(defclass dir-view (clog:clog-panel) + ((files :reader files) (divider :reader divider) + (folders :reader folders))) +(defun create-dir-view + (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) + 'dir-view))) + (setf (slot-value panel 'files) + (attach-as-child clog-obj "CLOGB38710339135" :clog-type + 'clog:clog-select :new-id t)) + (setf (slot-value panel 'divider) + (attach-as-child clog-obj "CLOGB3871033756" :clog-type + 'clog:clog-div :new-id t)) + (setf (slot-value panel 'folders) + (attach-as-child clog-obj "CLOGB3871033758" :clog-type + 'clog:clog-select :new-id t)) + (let ((target (folders panel))) + (declare (ignorable target)) + (populate-dir-win panel "./")) + (clog:set-on-change (folders panel) + (lambda (target) + (declare (ignorable target)) + (populate-dir-win panel (value target)))) + (clog:set-on-double-click (files panel) + (lambda (target) + (declare (ignorable target)) + (on-select-dir-win panel))) + panel)) \ No newline at end of file diff --git a/tools/projects.clog b/tools/projects.clog index 597efc6..9b743a6 100644 --- a/tools/projects.clog +++ b/tools/projects.clog @@ -1,4 +1,4 @@ -