diff --git a/tools/clog-builder.lisp b/tools/clog-builder.lisp index ba700df..c6c94e0 100644 --- a/tools/clog-builder.lisp +++ b/tools/clog-builder.lisp @@ -2066,7 +2066,7 @@ of controls and double click to select control." (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")) (win (create-gui-window obj :title "New Source Editor" :top 40 :left 225 @@ -2126,24 +2126,28 @@ of controls and double click to select control." (lambda (obj) (declare (ignore obj)) (clog-ace:resize ace))) - (set-on-click btn-load (lambda (obj) - (server-file-dialog obj "Load Source" (directory-namestring file-name) - (lambda (fname) - (window-focus win) - (when fname - (cond ((or (equalp (pathname-type fname) "lisp") - (equalp (pathname-type fname) "asd")) - (setf (clog-ace:mode ace) "ace/mode/lisp") - (setf lisp-file t) - (setf (current-editor-is-lisp app) t)) - (t - (setf lisp-file nil) - (setf (current-editor-is-lisp app) nil) - (setf (clog-ace:mode ace) (clog-ace:get-mode-from-extension ace fname)))) - (setf file-name fname) - (setf (window-title win) fname) - (setf (clog-ace:text-value ace) - (read-file fname))))))) + (flet ((open-file-name (fname) + (window-focus win) + (when fname + (cond ((or (equalp (pathname-type fname) "lisp") + (equalp (pathname-type fname) "asd")) + (setf (clog-ace:mode ace) "ace/mode/lisp") + (setf lisp-file t) + (setf (current-editor-is-lisp app) t)) + (t + (setf lisp-file nil) + (setf (current-editor-is-lisp app) nil) + (setf (clog-ace:mode ace) (clog-ace:get-mode-from-extension ace fname)))) + (setf file-name fname) + (setf (window-title win) fname) + (setf (clog-ace:text-value ace) + (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) (server-file-dialog obj "Save Source As.." file-name (lambda (fname) @@ -2214,8 +2218,9 @@ of controls and double click to select control." (setf (inner-html (files panel)) "") (dolist (n (asdf:module-components (asdf:find-system (text-value (loaded-systems panel))))) - (let ((name (asdf:coerce-name n))) - (add-select-option (files panel) name name)))) + (let ((name (asdf:component-relative-pathname n)) + (path (asdf:component-pathname n))) + (add-select-option (files panel) path name)))) (defun sys-browser-populate (panel) (setf (inner-html (class-box panel)) "") @@ -2372,6 +2377,10 @@ of controls and double click to select control." (lambda (obj) (declare (ignore obj)) (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 (lambda (obj) (declare (ignore obj)) diff --git a/tools/systems.clog b/tools/systems.clog index abbfb8c..b091fbe 100644 --- a/tools/systems.clog +++ b/tools/systems.clog @@ -1,6 +1,18 @@ - \ No newline at end of file +(asdf-browser-populate panel)"> \ No newline at end of file diff --git a/tools/systems.lisp b/tools/systems.lisp index d267c32..f7c6cd8 100644 --- a/tools/systems.lisp +++ b/tools/systems.lisp @@ -10,30 +10,30 @@ (let ((panel (change-class (clog:create-div clog-obj :content - "" + "" :hidden hidden :class class :html-id html-id :auto-place auto-place) 'asdf-systems))) (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)) (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)) (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)) (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)) (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)) (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)) (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)) (let ((target (sys-label panel))) (declare (ignorable target)) @@ -64,4 +64,31 @@ (setf (text-value (loaded-systems panel)) (text-value target)) (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))