asdf system browser - done

This commit is contained in:
David Botton 2022-07-31 01:43:01 -04:00
parent afea47a06c
commit b68d7663cc
3 changed files with 79 additions and 31 deletions

View file

@ -2066,7 +2066,7 @@ of controls and double click to select control."
(create-thread-list (window-content win)))) (create-thread-list (window-content win))))
(defun on-open-file (obj) (defun on-open-file (obj &key open-file)
(let* ((app (connection-data-item obj "builder-app-data")) (let* ((app (connection-data-item obj "builder-app-data"))
(win (create-gui-window obj :title "New Source Editor" (win (create-gui-window obj :title "New Source Editor"
:top 40 :left 225 :top 40 :left 225
@ -2126,9 +2126,7 @@ of controls and double click to select control."
(lambda (obj) (lambda (obj)
(declare (ignore obj)) (declare (ignore obj))
(clog-ace:resize ace))) (clog-ace:resize ace)))
(set-on-click btn-load (lambda (obj) (flet ((open-file-name (fname)
(server-file-dialog obj "Load Source" (directory-namestring file-name)
(lambda (fname)
(window-focus win) (window-focus win)
(when fname (when fname
(cond ((or (equalp (pathname-type fname) "lisp") (cond ((or (equalp (pathname-type fname) "lisp")
@ -2143,7 +2141,13 @@ of controls and double click to select control."
(setf file-name fname) (setf file-name fname)
(setf (window-title win) fname) (setf (window-title win) fname)
(setf (clog-ace:text-value ace) (setf (clog-ace:text-value ace)
(read-file fname))))))) (read-file fname)))))
(when open-file
(open-file-name open-file))
(set-on-click btn-load (lambda (obj)
(server-file-dialog obj "Load Source" (directory-namestring file-name)
(lambda (fname)
(open-file-name fname))))))
(set-on-click btn-save (lambda (obj) (set-on-click btn-save (lambda (obj)
(server-file-dialog obj "Save Source As.." file-name (server-file-dialog obj "Save Source As.." file-name
(lambda (fname) (lambda (fname)
@ -2214,8 +2218,9 @@ of controls and double click to select control."
(setf (inner-html (files panel)) "") (setf (inner-html (files panel)) "")
(dolist (n (asdf:module-components (dolist (n (asdf:module-components
(asdf:find-system (text-value (loaded-systems panel))))) (asdf:find-system (text-value (loaded-systems panel)))))
(let ((name (asdf:coerce-name n))) (let ((name (asdf:component-relative-pathname n))
(add-select-option (files panel) name name)))) (path (asdf:component-pathname n)))
(add-select-option (files panel) path name))))
(defun sys-browser-populate (panel) (defun sys-browser-populate (panel)
(setf (inner-html (class-box panel)) "") (setf (inner-html (class-box panel)) "")
@ -2372,6 +2377,10 @@ of controls and double click to select control."
(lambda (obj) (lambda (obj)
(declare (ignore obj)) (declare (ignore obj))
(open-window (window body) "https://github.com/rabbibotton/clog/blob/main/LEARN.md"))) (open-window (window body) "https://github.com/rabbibotton/clog/blob/main/LEARN.md")))
(create-gui-menu-item help :content "L1sp Search" :on-click
(lambda (obj)
(declare (ignore obj))
(open-window (window body) "http://l1sp.org/html/")))
(create-gui-menu-item help :content "Lisp in Y Minutes" :on-click (create-gui-menu-item help :content "Lisp in Y Minutes" :on-click
(lambda (obj) (lambda (obj)
(declare (ignore obj)) (declare (ignore obj))

View file

@ -1,6 +1,18 @@
<data id="I3868121043" data-in-package="clog-tools" data-custom-slots="" data-clog-next-id="10" data-clog-title="asdf-systems"></data><label for="CLOGB38680930412" data-clog-type="label" data-clog-for="loaded-systems" data-clog-name="sys-label" style="box-sizing: content-box; position: absolute; left: 10px; top: 7.99716px;">Loaded Systems:</label><select data-clog-type="listbox" size="4" data-clog-name="loaded-systems" style="box-sizing: content-box; position: absolute; left: 10px; top: 38px; width: 239.716px; height: 261.341px;" data-on-create="(dolist (n (asdf:already-loaded-systems)) <data id="I3868233999" data-in-package="clog-tools" data-custom-slots="" data-clog-next-id="10" data-clog-title="asdf-systems"></data><label for="CLOGB38680930412" data-clog-type="label" data-clog-for="loaded-systems" data-clog-name="sys-label" style="box-sizing: content-box; position: absolute; left: 10px; top: 7.99716px;">Loaded Systems:</label><select data-clog-type="listbox" size="4" data-clog-name="loaded-systems" style="box-sizing: content-box; position: absolute; left: 10px; top: 38px; width: 239.716px; height: 261.341px;" data-on-create="(dolist (n (asdf:already-loaded-systems))
(add-select-option target n n)) (add-select-option target n n))
(setf (text-value target) &quot;clog&quot;) (setf (text-value target) &quot;clog&quot;)
(asdf-browser-populate panel)" data-on-change="(asdf-browser-populate panel)"></select><label for="CLOGB38680988074" data-clog-type="label" data-clog-for="deps" data-clog-name="deps-label" style="box-sizing: content-box; position: absolute; left: 265px; top: 8px;" class="">Depends On:</label><select data-clog-type="listbox" size="4" data-clog-name="deps" style="box-sizing: content-box; position: absolute; left: 265px; top: 39.9858px; width: 310.361px; height: 76.3494px;" data-on-double-click="(setf (text-value (loaded-systems panel)) (asdf-browser-populate panel)" data-on-change="(asdf-browser-populate panel)"></select><label for="CLOGB38680988074" data-clog-type="label" data-clog-for="deps" data-clog-name="deps-label" style="box-sizing: content-box; position: absolute; left: 265px; top: 8px;" class="">Depends On:</label><select data-clog-type="listbox" size="4" data-clog-name="deps" style="box-sizing: content-box; position: absolute; left: 265px; top: 39.9858px; width: 310.361px; height: 76.3494px;" data-on-double-click="(setf (text-value (loaded-systems panel))
(text-value target)) (text-value target))
(asdf-browser-populate panel)"></select><label for="" data-clog-type="label" data-clog-for="" data-clog-name="files-label" style="box-sizing: content-box; position: absolute; left: 265px; top: 126px; width: 98.108px; height: 21.5px;">Files:</label><select data-clog-type="listbox" size="4" data-clog-name="files" style="box-sizing: content-box; position: absolute; left: 265px; top: 151.991px; width: 311.562px; height: 146.932px;"></select><input type="TEXT" value="" data-clog-type="input" data-clog-name="source-file" style="box-sizing: content-box; position: absolute; left: 10px; top: 309.996px; width: 560.727px; height: 22.5px;"> (asdf-browser-populate panel)"></select><label for="" data-clog-type="label" data-clog-for="" data-clog-name="files-label" style="box-sizing: content-box; position: absolute; left: 265px; top: 126px; width: 98.108px; height: 21.5px;">Files:</label><select data-clog-type="listbox" size="4" data-clog-name="files" style="box-sizing: content-box; position: absolute; left: 265px; top: 151.991px; width: 311.562px; height: 146.932px;" data-on-double-click="(let ((disp (select-text target))
(item (text-value target)))
(cond ((equal (subseq item (1- (length item))) &quot;/&quot;)
(setf (inner-html (files panel)) &quot;&quot;)
(dolist (n (asdf:module-components
(asdf:find-component
(asdf:find-system (text-value (loaded-systems panel)))
(subseq disp 0 (1- (length disp))))))
(let ((name (asdf:component-relative-pathname n))
(path (asdf:component-pathname n)))
(add-select-option (files panel) path name))))
(t
(on-open-file panel :open-file item))))"></select><input type="TEXT" value="" data-clog-type="input" data-clog-name="source-file" style="box-sizing: content-box; position: absolute; left: 10px; top: 309.996px; width: 560.727px; height: 22.5px;">

View file

@ -10,30 +10,30 @@
(let ((panel (let ((panel
(change-class (change-class
(clog:create-div clog-obj :content (clog:create-div clog-obj :content
"<label for=\"CLOGB38680930412\" style=\"box-sizing: content-box; position: absolute; left: 10px; top: 7.99716px;\" id=\"CLOGB3868120991\" data-clog-name=\"sys-label\">Loaded Systems:</label><select size=\"4\" style=\"box-sizing: content-box; position: absolute; left: 10px; top: 38px; width: 239.716px; height: 261.341px;\" id=\"CLOGB3868120992\" data-clog-name=\"loaded-systems\"></select><label for=\"CLOGB38680988074\" style=\"box-sizing: content-box; position: absolute; left: 265px; top: 8px;\" class=\"\" id=\"CLOGB3868120993\" data-clog-name=\"deps-label\">Depends On:</label><select size=\"4\" style=\"box-sizing: content-box; position: absolute; left: 265px; top: 39.9858px; width: 310.361px; height: 76.3494px;\" id=\"CLOGB3868120994\" data-clog-name=\"deps\"></select><label for=\"\" style=\"box-sizing: content-box; position: absolute; left: 265px; top: 126px; width: 98.108px; height: 21.5px;\" id=\"CLOGB3868120995\" data-clog-name=\"files-label\">Files:</label><select size=\"4\" style=\"box-sizing: content-box; position: absolute; left: 265px; top: 151.991px; width: 311.562px; height: 146.932px;\" id=\"CLOGB3868120996\" data-clog-name=\"files\"></select><input type=\"TEXT\" value=\"\" style=\"box-sizing: content-box; position: absolute; left: 10px; top: 309.996px; width: 560.727px; height: 22.5px;\" id=\"CLOGB3868120997\" data-clog-name=\"source-file\">" "<label for=\"CLOGB38680930412\" style=\"box-sizing: content-box; position: absolute; left: 10px; top: 7.99716px;\" id=\"CLOGB3868233956\" data-clog-name=\"sys-label\">Loaded Systems:</label><select size=\"4\" style=\"box-sizing: content-box; position: absolute; left: 10px; top: 38px; width: 239.716px; height: 261.341px;\" id=\"CLOGB3868233957\" data-clog-name=\"loaded-systems\"></select><label for=\"CLOGB38680988074\" style=\"box-sizing: content-box; position: absolute; left: 265px; top: 8px;\" class=\"\" id=\"CLOGB3868233958\" data-clog-name=\"deps-label\">Depends On:</label><select size=\"4\" style=\"box-sizing: content-box; position: absolute; left: 265px; top: 39.9858px; width: 310.361px; height: 76.3494px;\" id=\"CLOGB3868233959\" data-clog-name=\"deps\"></select><label for=\"\" style=\"box-sizing: content-box; position: absolute; left: 265px; top: 126px; width: 98.108px; height: 21.5px;\" id=\"CLOGB3868233960\" data-clog-name=\"files-label\">Files:</label><select size=\"4\" style=\"box-sizing: content-box; position: absolute; left: 265px; top: 151.991px; width: 311.562px; height: 146.932px;\" id=\"CLOGB3868233961\" data-clog-name=\"files\"></select><input type=\"TEXT\" value=\"\" style=\"box-sizing: content-box; position: absolute; left: 10px; top: 309.996px; width: 560.727px; height: 22.5px;\" id=\"CLOGB3868233962\" data-clog-name=\"source-file\">"
:hidden hidden :class class :html-id html-id :hidden hidden :class class :html-id html-id
:auto-place auto-place) :auto-place auto-place)
'asdf-systems))) 'asdf-systems)))
(setf (slot-value panel 'source-file) (setf (slot-value panel 'source-file)
(attach-as-child clog-obj "CLOGB3868120997" :clog-type (attach-as-child clog-obj "CLOGB3868233962" :clog-type
'clog:clog-form-element :new-id t)) 'clog:clog-form-element :new-id t))
(setf (slot-value panel 'files) (setf (slot-value panel 'files)
(attach-as-child clog-obj "CLOGB3868120996" :clog-type (attach-as-child clog-obj "CLOGB3868233961" :clog-type
'clog:clog-select :new-id t)) 'clog:clog-select :new-id t))
(setf (slot-value panel 'files-label) (setf (slot-value panel 'files-label)
(attach-as-child clog-obj "CLOGB3868120995" :clog-type (attach-as-child clog-obj "CLOGB3868233960" :clog-type
'clog:clog-label :new-id t)) 'clog:clog-label :new-id t))
(setf (slot-value panel 'deps) (setf (slot-value panel 'deps)
(attach-as-child clog-obj "CLOGB3868120994" :clog-type (attach-as-child clog-obj "CLOGB3868233959" :clog-type
'clog:clog-select :new-id t)) 'clog:clog-select :new-id t))
(setf (slot-value panel 'deps-label) (setf (slot-value panel 'deps-label)
(attach-as-child clog-obj "CLOGB3868120993" :clog-type (attach-as-child clog-obj "CLOGB3868233958" :clog-type
'clog:clog-label :new-id t)) 'clog:clog-label :new-id t))
(setf (slot-value panel 'loaded-systems) (setf (slot-value panel 'loaded-systems)
(attach-as-child clog-obj "CLOGB3868120992" :clog-type (attach-as-child clog-obj "CLOGB3868233957" :clog-type
'clog:clog-select :new-id t)) 'clog:clog-select :new-id t))
(setf (slot-value panel 'sys-label) (setf (slot-value panel 'sys-label)
(attach-as-child clog-obj "CLOGB3868120991" :clog-type (attach-as-child clog-obj "CLOGB3868233956" :clog-type
'clog:clog-label :new-id t)) 'clog:clog-label :new-id t))
(let ((target (sys-label panel))) (let ((target (sys-label panel)))
(declare (ignorable target)) (declare (ignorable target))
@ -64,4 +64,31 @@
(setf (text-value (loaded-systems panel)) (setf (text-value (loaded-systems panel))
(text-value target)) (text-value target))
(asdf-browser-populate panel))) (asdf-browser-populate panel)))
(clog:set-on-double-click (files panel)
(lambda (target)
(declare (ignorable target))
(let ((disp (select-text target))
(item (text-value target)))
(cond
((equal (subseq item (1- (length item)))
"/")
(setf (inner-html (files panel)) "")
(dolist
(n
(asdf/component:module-components
(asdf/component:find-component
(asdf/system:find-system
(text-value
(loaded-systems panel)))
(subseq disp 0
(1- (length disp))))))
(let ((name
(asdf/component:component-relative-pathname
n))
(path
(asdf/component:component-pathname
n)))
(add-select-option (files panel) path
name))))
(t (on-open-file panel :open-file item))))))
panel)) panel))