From ca8d13352b0f401584e9f35f92272be1b3784909 Mon Sep 17 00:00:00 2001 From: David Botton Date: Sun, 28 Apr 2024 09:46:00 -0400 Subject: [PATCH] move more functionality out of panel code --- tools/clog-builder-projects.lisp | 21 +++++++ tools/panel-projects.clog | 13 +---- tools/panel-projects.lisp | 94 ++++++++++++++------------------ 3 files changed, 65 insertions(+), 63 deletions(-) diff --git a/tools/clog-builder-projects.lisp b/tools/clog-builder-projects.lisp index 3c92d30..a5d5764 100644 --- a/tools/clog-builder-projects.lisp +++ b/tools/clog-builder-projects.lisp @@ -47,6 +47,27 @@ (setf (text-value (project-list panel)) "None") (projects-populate panel))))) +(defun projects-edit-asd (panel target) + (declare (ignore target)) + (let ((sel (text-value (project-list panel)))) + (on-open-file panel :open-file (asdf:system-source-file + (asdf:find-system sel))))) + +(defun projects-unload (panel target) + (declare (ignore target)) + (let ((sel (text-value (project-list panel)))) + (unless (equal sel "None") + (asdf:clear-system sel) + (setf (text-value (project-list panel)) "None") + (projects-populate panel)))) + +(defun projects-reload (panel target) + (declare (ignore target)) + (let ((sel (text-value (project-list panel)))) + (unless (equal sel "None") + (asdf:clear-system sel) + (projects-populate panel)))) + (defun projects-view-dir (panel) (let* ((sel (text-value (project-list panel)))) (if (equal sel "None") diff --git a/tools/panel-projects.clog b/tools/panel-projects.clog index f74e26b..55e868f 100644 --- a/tools/panel-projects.clog +++ b/tools/panel-projects.clog @@ -1,14 +1,5 @@ -
-" + "
+" :hidden hidden :class class :html-id html-id :auto-place auto-place) 'projects))) (setf (slot-value panel 'pop-panel-label) - (attach-as-child clog-obj "CLOGB3922698604" :clog-type + (attach-as-child clog-obj "CLOGB3923299241" :clog-type 'clog:clog-label :new-id t)) (setf (slot-value panel 'pop-panel) - (attach-as-child clog-obj "CLOGB3922698603" :clog-type + (attach-as-child clog-obj "CLOGB3923299240" :clog-type 'clog:clog-form-element :new-id t)) (setf (slot-value panel 'open-ext) - (attach-as-child clog-obj "CLOGB3922698602" :clog-type + (attach-as-child clog-obj "CLOGB3923299239" :clog-type 'clog:clog-form-element :new-id t)) (setf (slot-value panel 'ext-win-label) - (attach-as-child clog-obj "CLOGB3922698601" :clog-type + (attach-as-child clog-obj "CLOGB3923299238" :clog-type 'clog:clog-label :new-id t)) (setf (slot-value panel 'design-plugin) - (attach-as-child clog-obj "CLOGB3922698600" :clog-type + (attach-as-child clog-obj "CLOGB3923299237" :clog-type 'clog:clog-button :new-id t)) (setf (slot-value panel 'design-del-dep) - (attach-as-child clog-obj "CLOGB3922698599" :clog-type + (attach-as-child clog-obj "CLOGB3923299236" :clog-type 'clog:clog-button :new-id t)) (setf (slot-value panel 'design-add-dep) - (attach-as-child clog-obj "CLOGB3922698598" :clog-type + (attach-as-child clog-obj "CLOGB3923299235" :clog-type 'clog:clog-button :new-id t)) (setf (slot-value panel 'design-deps) - (attach-as-child clog-obj "CLOGB3922698597" :clog-type + (attach-as-child clog-obj "CLOGB3923299234" :clog-type 'clog:clog-select :new-id t)) (setf (slot-value panel 'design-deps-label) - (attach-as-child clog-obj "CLOGB3922698596" :clog-type + (attach-as-child clog-obj "CLOGB3923299233" :clog-type 'clog:clog-label :new-id t)) (setf (slot-value panel 'designtime-delete) - (attach-as-child clog-obj "CLOGB3922698595" :clog-type + (attach-as-child clog-obj "CLOGB3923299232" :clog-type 'clog:clog-button :new-id t)) (setf (slot-value panel 'designtime-add-lisp) - (attach-as-child clog-obj "CLOGB3922698594" :clog-type + (attach-as-child clog-obj "CLOGB3923299231" :clog-type 'clog:clog-button :new-id t)) (setf (slot-value panel 'designtime-add-clog) - (attach-as-child clog-obj "CLOGB3922698593" :clog-type + (attach-as-child clog-obj "CLOGB3923299230" :clog-type 'clog:clog-button :new-id t)) (setf (slot-value panel 'designtime-list) - (attach-as-child clog-obj "CLOGB3922698592" :clog-type + (attach-as-child clog-obj "CLOGB3923299229" :clog-type 'clog:clog-select :new-id t)) (setf (slot-value panel 'designtime-label) - (attach-as-child clog-obj "CLOGB3922698591" :clog-type + (attach-as-child clog-obj "CLOGB3923299228" :clog-type 'clog:clog-label :new-id t)) (setf (slot-value panel 'runtime-del-dep) - (attach-as-child clog-obj "CLOGB3922698590" :clog-type + (attach-as-child clog-obj "CLOGB3923299227" :clog-type 'clog:clog-button :new-id t)) (setf (slot-value panel 'runtime-add-dep) - (attach-as-child clog-obj "CLOGB3922698589" :clog-type + (attach-as-child clog-obj "CLOGB3923299226" :clog-type 'clog:clog-button :new-id t)) (setf (slot-value panel 'runtime-deps) - (attach-as-child clog-obj "CLOGB3922698588" :clog-type + (attach-as-child clog-obj "CLOGB3923299225" :clog-type 'clog:clog-select :new-id t)) (setf (slot-value panel 'dbl-click2) - (attach-as-child clog-obj "CLOGB3922698587" :clog-type + (attach-as-child clog-obj "CLOGB3923299224" :clog-type 'clog:clog-label :new-id t)) (setf (slot-value panel 'runtime-deps-label) - (attach-as-child clog-obj "CLOGB3922698586" :clog-type + (attach-as-child clog-obj "CLOGB3923299223" :clog-type 'clog:clog-label :new-id t)) (setf (slot-value panel 'runtime-dir) - (attach-as-child clog-obj "CLOGB3922698585" :clog-type + (attach-as-child clog-obj "CLOGB3923299222" :clog-type 'clog:clog-button :new-id t)) (setf (slot-value panel 'runtime-delete) - (attach-as-child clog-obj "CLOGB3922698584" :clog-type + (attach-as-child clog-obj "CLOGB3923299221" :clog-type 'clog:clog-button :new-id t)) (setf (slot-value panel 'runtime-add-lisp) - (attach-as-child clog-obj "CLOGB3922698583" :clog-type + (attach-as-child clog-obj "CLOGB3923299220" :clog-type 'clog:clog-button :new-id t)) (setf (slot-value panel 'runtime-list) - (attach-as-child clog-obj "CLOGB3922698582" :clog-type + (attach-as-child clog-obj "CLOGB3923299219" :clog-type 'clog:clog-select :new-id t)) (setf (slot-value panel 'dbl-click1) - (attach-as-child clog-obj "CLOGB3922698581" :clog-type + (attach-as-child clog-obj "CLOGB3923299218" :clog-type 'clog:clog-label :new-id t)) (setf (slot-value panel 'runtime-label) - (attach-as-child clog-obj "CLOGB3922698580" :clog-type + (attach-as-child clog-obj "CLOGB3923299217" :clog-type 'clog:clog-label :new-id t)) (setf (slot-value panel 'file-group) - (attach-as-child clog-obj "CLOGB3922698579" :clog-type + (attach-as-child clog-obj "CLOGB3923299216" :clog-type 'clog:clog-div :new-id t)) (setf (slot-value panel 'rerender-button) - (attach-as-child clog-obj "CLOGB3922698578" :clog-type + (attach-as-child clog-obj "CLOGB3923299215" :clog-type 'clog:clog-button :new-id t)) (setf (slot-value panel 'reload-project-button) - (attach-as-child clog-obj "CLOGB3922698577" :clog-type + (attach-as-child clog-obj "CLOGB3923299214" :clog-type 'clog:clog-button :new-id t)) (setf (slot-value panel 'unload-project-button) - (attach-as-child clog-obj "CLOGB3922698576" :clog-type + (attach-as-child clog-obj "CLOGB3923299213" :clog-type 'clog:clog-button :new-id t)) (setf (slot-value panel 'new-project-button) - (attach-as-child clog-obj "CLOGB3922698575" :clog-type + (attach-as-child clog-obj "CLOGB3923299212" :clog-type 'clog:clog-button :new-id t)) (setf (slot-value panel 'run-button) - (attach-as-child clog-obj "CLOGB3922698574" :clog-type + (attach-as-child clog-obj "CLOGB3923299211" :clog-type 'clog:clog-button :new-id t)) (setf (slot-value panel 'entry-point) - (attach-as-child clog-obj "CLOGB3922698573" :clog-type + (attach-as-child clog-obj "CLOGB3923299210" :clog-type 'clog:clog-form-element :new-id t)) (setf (slot-value panel 'entry-point-label) - (attach-as-child clog-obj "CLOGB3922698572" :clog-type + (attach-as-child clog-obj "CLOGB3923299209" :clog-type 'clog:clog-label :new-id t)) (setf (slot-value panel 'edit-asd) - (attach-as-child clog-obj "CLOGB3922698571" :clog-type + (attach-as-child clog-obj "CLOGB3923299208" :clog-type 'clog:clog-button :new-id t)) (setf (slot-value panel 'project-list) - (attach-as-child clog-obj "CLOGB3922698570" :clog-type + (attach-as-child clog-obj "CLOGB3923299207" :clog-type 'clog:clog-select :new-id t)) (setf (slot-value panel 'projects-label) - (attach-as-child clog-obj "CLOGB3922698569" :clog-type + (attach-as-child clog-obj "CLOGB3923299206" :clog-type 'clog:clog-label :new-id t)) (let ((target (projects-label panel))) (declare (ignorable target)) @@ -210,10 +210,7 @@ (clog:set-on-click (edit-asd panel) (lambda (target) (declare (ignorable target)) - (let ((sel (text-value (project-list panel)))) - (on-open-file panel :open-file - (asdf/system:system-source-file - (asdf/system:find-system sel)))))) + (projects-edit-asd panel target))) (clog:set-on-change (entry-point panel) (lambda (target) (declare (ignorable target)) @@ -229,18 +226,11 @@ (clog:set-on-click (unload-project-button panel) (lambda (target) (declare (ignorable target)) - (let ((sel (text-value (project-list panel)))) - (unless (equal sel "None") - (asdf:clear-system sel) - (setf (text-value (project-list panel)) "None") - (projects-populate panel))))) + (projects-unload panel target))) (clog:set-on-click (reload-project-button panel) (lambda (target) (declare (ignorable target)) - (let ((sel (text-value (project-list panel)))) - (unless (equal sel "None") - (asdf:clear-system sel) - (projects-populate panel))))) + (projects-reload panel target))) (clog:set-on-click (rerender-button panel) (lambda (target) (declare (ignorable target)) @@ -336,4 +326,4 @@ (declare (ignorable target)) (let ((sys (text-value (project-list panel)))) (projects-add-plugin panel sys)))) - panel)) + panel)) \ No newline at end of file