mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-08 11:40:18 -08:00
directory and file buttons
This commit is contained in:
parent
2dbc39481e
commit
09aa23bac8
6 changed files with 230 additions and 123 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
(defun populate-dir-win (panel d)
|
(defun populate-dir-win (panel d)
|
||||||
(let ((dir (directory-namestring (uiop:truename* d))))
|
(let ((dir (directory-namestring (uiop:truename* d))))
|
||||||
|
(setf (current-dir panel) dir)
|
||||||
;; Dirs
|
;; Dirs
|
||||||
(setf (inner-html (folders panel)) "")
|
(setf (inner-html (folders panel)) "")
|
||||||
(add-select-option (folders panel)
|
(add-select-option (folders panel)
|
||||||
|
|
@ -18,8 +19,56 @@
|
||||||
|
|
||||||
(defun on-select-dir-win (panel)
|
(defun on-select-dir-win (panel)
|
||||||
(let ((item (value (files panel))))
|
(let ((item (value (files panel))))
|
||||||
|
(unless (equal item "")
|
||||||
(cond ((and (> (length item) 5)
|
(cond ((and (> (length item) 5)
|
||||||
(equal (subseq item (- (length item) 5)) ".clog"))
|
(equal (subseq item (- (length item) 5)) ".clog"))
|
||||||
(on-new-builder-panel panel :open-file item))
|
(on-new-builder-panel panel :open-file item))
|
||||||
(t
|
(t
|
||||||
(on-open-file panel :open-file item)))))
|
(on-open-file panel :open-file item))))))
|
||||||
|
|
||||||
|
(defun on-delete-dir-win (panel)
|
||||||
|
(let ((item (value (files panel))))
|
||||||
|
(unless (equal item "")
|
||||||
|
(confirm-dialog panel (format nil "Delete ~A?" item)
|
||||||
|
(lambda (result)
|
||||||
|
(when result
|
||||||
|
(uiop:delete-file-if-exists item)
|
||||||
|
(populate-dir-win panel (directory-namestring item))))))))
|
||||||
|
|
||||||
|
(defun on-new-dir-dir-win (panel)
|
||||||
|
(input-dialog panel "Name of new directory?"
|
||||||
|
(lambda (result)
|
||||||
|
(when result
|
||||||
|
(ensure-directories-exist (format nil "~A~A/" (current-dir panel) result))
|
||||||
|
(populate-dir-win panel (current-dir panel))))
|
||||||
|
:title "New Directory"))
|
||||||
|
|
||||||
|
(defun on-delete-dir-dir-win (panel d)
|
||||||
|
(let ((dir (directory-namestring (uiop:truename* d))))
|
||||||
|
(confirm-dialog panel (format nil "Delete ~A?" dir)
|
||||||
|
(lambda (result)
|
||||||
|
(when result
|
||||||
|
(handler-case
|
||||||
|
(uiop:delete-empty-directory dir)
|
||||||
|
(error ()
|
||||||
|
(alert-toast panel "Directory Delete Failure"
|
||||||
|
(format nil "Failed to delete ~A, perhaps not empty." dir))))
|
||||||
|
(populate-dir-win panel (current-dir panel)))))))
|
||||||
|
|
||||||
|
(defun on-rename-dir-dir-win (panel d)
|
||||||
|
(input-dialog panel "Rename directory to?"
|
||||||
|
(lambda (result)
|
||||||
|
(when result
|
||||||
|
(rename-file d (format nil "~A~A/" (current-dir panel) result))
|
||||||
|
(populate-dir-win panel (current-dir panel))))
|
||||||
|
:title "Rename Directory"))
|
||||||
|
|
||||||
|
(defun on-rename-dir-win (panel)
|
||||||
|
(let ((item (value (files panel))))
|
||||||
|
(unless (equal item "")
|
||||||
|
(input-dialog panel "Rename file to?"
|
||||||
|
(lambda (result)
|
||||||
|
(when result
|
||||||
|
(rename-file item (format nil "~A~A" (directory-namestring item) result))
|
||||||
|
(populate-dir-win panel (current-dir panel))))
|
||||||
|
:title "Rename File"))))
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,12 @@
|
||||||
(projects-populate panel)))))
|
(projects-populate panel)))))
|
||||||
|
|
||||||
(defun projects-view-dir (panel)
|
(defun projects-view-dir (panel)
|
||||||
(ignore-errors
|
|
||||||
(let* ((app (connection-data-item panel "builder-app-data"))
|
(let* ((app (connection-data-item panel "builder-app-data"))
|
||||||
(sel (text-value (project-list panel)))
|
(sel (text-value (project-list panel))))
|
||||||
(sys (asdf:find-system (format nil "~A" sel))))
|
(if (equal sel "None")
|
||||||
(on-dir-win panel :dir (asdf:system-source-directory sys)))))
|
(on-dir-win panel)
|
||||||
|
(let ((sys (asdf:find-system (format nil "~A" sel))))
|
||||||
|
(on-dir-win panel :dir (asdf:system-source-directory sys))))))
|
||||||
|
|
||||||
(defun projects-run (panel)
|
(defun projects-run (panel)
|
||||||
(let ((val (text-value (entry-point panel))))
|
(let ((val (text-value (entry-point panel))))
|
||||||
|
|
|
||||||
2
tools/dir-view.clog
vendored
2
tools/dir-view.clog
vendored
|
|
@ -1 +1 @@
|
||||||
<data id="I3872103154" data-in-package="clog-tools" data-custom-slots="" data-clog-next-id="6" data-clog-title="dir-view"></data><select data-clog-type="listbox" size="4" data-clog-name="folders" style="box-sizing: content-box; position: absolute; left: 10px; top: 10px; right: 10px; height: 150px; overflow: auto;" data-on-create="(populate-dir-win panel "./")" data-on-change="(populate-dir-win panel (value target))"></select><div data-clog-type="div" data-clog-name="divider" style="box-sizing: content-box; position: absolute; left: 10px; height: 5px; background-attachment: scroll; background-color: rgb(0, 0, 0); right: 10px; top: 166px;"></div><select data-clog-type="listbox" size="4" data-clog-name="files" style="box-sizing: content-box; position: absolute; inset: 175px 10px 10px; overflow: auto;" data-on-double-click="(on-select-dir-win panel)"></select>
|
<data id="I3872110834" data-in-package="clog-tools" data-custom-slots="(current-dir :accessor current-dir :initform ".")" data-clog-next-id="21" data-clog-title="dir-view"></data><select data-clog-type="listbox" size="4" data-clog-name="folders" style="box-sizing: content-box; position: absolute; left: 10px; top: 10px; right: 10px; height: 115px; overflow: auto;" data-on-create="(populate-dir-win panel "./")" data-on-mouse-double-click="(populate-dir-win panel (value target))"></select><div data-clog-type="div" data-clog-name="divider" style="box-sizing: content-box; position: absolute; left: 10px; height: 5px; background-attachment: scroll; background-color: rgb(0, 0, 0); right: 10px; top: 166px;"></div><select data-clog-type="listbox" size="4" data-clog-name="files" style="box-sizing: content-box; position: absolute; inset: 175px 10px 40px; overflow: auto;" data-on-double-click="(on-select-dir-win panel)"></select><input type="BUTTON" value="Open" data-clog-type="fbutton" data-clog-name="open-dir-button" style="box-sizing: content-box; position: absolute; left: 10px; top: 132px; width: 70px;" data-on-click="(populate-dir-win panel (value (folders panel)))"><input type="BUTTON" value="New" data-clog-type="fbutton" data-clog-name="new-dir-button" style="box-sizing: content-box; position: absolute; left: 100px; top: 132px; width: 70px;" data-on-click="(on-new-dir-dir-win panel)"><input type="BUTTON" value="Delete" data-clog-type="fbutton" data-clog-name="del-dir-button" style="box-sizing: content-box; position: absolute; left: 190px; top: 132px; width: 70px;" data-on-click="(on-delete-dir-dir-win panel (value (folders panel)))"><input type="BUTTON" value="Rename" data-clog-type="fbutton" data-clog-name="rename-dir-button" style="box-sizing: content-box; position: absolute; left: 280px; top: 132px; width: 70px;" data-on-click="(on-rename-dir-dir-win panel (value (folders panel)))"><input type="BUTTON" value="Open" data-clog-type="fbutton" data-clog-name="open-button" style="box-sizing: content-box; position: absolute; left: 10px; bottom: 5px; width: 70px;" data-on-click="(on-select-dir-win panel)"><input type="BUTTON" value="Delete" data-clog-type="fbutton" data-clog-name="del-button" style="box-sizing: content-box; position: absolute; left: 100px; bottom: 5px; width: 70px;" data-on-click="(on-delete-dir-win panel)"><input type="BUTTON" value="Rename" data-clog-type="fbutton" data-clog-name="rename-button" style="box-sizing: content-box; position: absolute; left: 190px; bottom: 5px; width: 70px;" data-on-click="(on-rename-dir-win panel)">
|
||||||
|
|
@ -1,35 +1,92 @@
|
||||||
;;;; CLOG Builder generated code - modify original clog file
|
;;;; CLOG Builder generated code - modify original clog file
|
||||||
(in-package :clog-tools)
|
(in-package :clog-tools)
|
||||||
(defclass dir-view (clog:clog-panel)
|
(defclass dir-view (clog:clog-panel)
|
||||||
((files :reader files) (divider :reader divider)
|
((rename-button :reader rename-button)
|
||||||
(folders :reader folders)))
|
(del-button :reader del-button) (open-button :reader open-button)
|
||||||
|
(rename-dir-button :reader rename-dir-button)
|
||||||
|
(del-dir-button :reader del-dir-button)
|
||||||
|
(new-dir-button :reader new-dir-button)
|
||||||
|
(open-dir-button :reader open-dir-button) (files :reader files)
|
||||||
|
(divider :reader divider) (folders :reader folders)
|
||||||
|
(current-dir :accessor current-dir :initform ".")))
|
||||||
(defun create-dir-view
|
(defun create-dir-view
|
||||||
(clog-obj &key (hidden nil) (class nil) (html-id nil) (auto-place t))
|
(clog-obj &key (hidden nil) (class nil) (html-id nil) (auto-place t))
|
||||||
(let ((panel
|
(let ((panel
|
||||||
(change-class
|
(change-class
|
||||||
(clog:create-div clog-obj :content
|
(clog:create-div clog-obj :content
|
||||||
"<select size=\"4\" style=\"box-sizing: content-box; position: absolute; left: 10px; top: 10px; right: 10px; height: 150px; overflow: auto;\" id=\"CLOGB3872102944\" data-clog-name=\"folders\"></select><div style=\"box-sizing: content-box; position: absolute; left: 10px; height: 5px; background-attachment: scroll; background-color: rgb(0, 0, 0); right: 10px; top: 166px;\" id=\"CLOGB3872102945\" data-clog-name=\"divider\"></div><select size=\"4\" style=\"box-sizing: content-box; position: absolute; inset: 175px 10px 10px; overflow: auto;\" id=\"CLOGB3872102946\" data-clog-name=\"files\"></select>"
|
"<select size=\"4\" style=\"box-sizing: content-box; position: absolute; left: 10px; top: 10px; right: 10px; height: 115px; overflow: auto;\" id=\"CLOGB3872109090\" data-clog-name=\"folders\"></select><div style=\"box-sizing: content-box; position: absolute; left: 10px; height: 5px; background-attachment: scroll; background-color: rgb(0, 0, 0); right: 10px; top: 166px;\" id=\"CLOGB3872109091\" data-clog-name=\"divider\"></div><select size=\"4\" style=\"box-sizing: content-box; position: absolute; inset: 175px 10px 40px; overflow: auto;\" id=\"CLOGB3872109092\" data-clog-name=\"files\"></select><input type=\"BUTTON\" value=\"Open\" style=\"box-sizing: content-box; position: absolute; left: 10px; top: 132px; width: 70px;\" id=\"CLOGB3872109093\" data-clog-name=\"open-dir-button\"><input type=\"BUTTON\" value=\"New\" style=\"box-sizing: content-box; position: absolute; left: 100px; top: 132px; width: 70px;\" id=\"CLOGB3872109094\" data-clog-name=\"new-dir-button\"><input type=\"BUTTON\" value=\"Delete\" style=\"box-sizing: content-box; position: absolute; left: 190px; top: 132px; width: 70px;\" id=\"CLOGB387210909815\" data-clog-name=\"del-dir-button\"><input type=\"BUTTON\" value=\"Rename\" style=\"box-sizing: content-box; position: absolute; left: 280px; top: 132px; width: 70px;\" id=\"CLOGB387211008317\" data-clog-name=\"rename-dir-button\"><input type=\"BUTTON\" value=\"Open\" style=\"box-sizing: content-box; position: absolute; left: 10px; bottom: 5px; width: 70px;\" id=\"CLOGB3872109095\" data-clog-name=\"open-button\"><input type=\"BUTTON\" value=\"Delete\" style=\"box-sizing: content-box; position: absolute; left: 100px; bottom: 5px; width: 70px;\" id=\"CLOGB3872109096\" data-clog-name=\"del-button\"><input type=\"BUTTON\" value=\"Rename\" style=\"box-sizing: content-box; position: absolute; left: 190px; bottom: 5px; width: 70px;\" id=\"CLOGB387211077419\" data-clog-name=\"rename-button\">"
|
||||||
:hidden hidden :class class :html-id html-id
|
:hidden hidden :class class :html-id html-id
|
||||||
:auto-place auto-place)
|
:auto-place auto-place)
|
||||||
'dir-view)))
|
'dir-view)))
|
||||||
|
(setf (slot-value panel 'rename-button)
|
||||||
|
(attach-as-child clog-obj "CLOGB387211077419" :clog-type
|
||||||
|
'clog:clog-form-element :new-id t))
|
||||||
|
(setf (slot-value panel 'del-button)
|
||||||
|
(attach-as-child clog-obj "CLOGB3872109096" :clog-type
|
||||||
|
'clog:clog-form-element :new-id t))
|
||||||
|
(setf (slot-value panel 'open-button)
|
||||||
|
(attach-as-child clog-obj "CLOGB3872109095" :clog-type
|
||||||
|
'clog:clog-form-element :new-id t))
|
||||||
|
(setf (slot-value panel 'rename-dir-button)
|
||||||
|
(attach-as-child clog-obj "CLOGB387211008317" :clog-type
|
||||||
|
'clog:clog-form-element :new-id t))
|
||||||
|
(setf (slot-value panel 'del-dir-button)
|
||||||
|
(attach-as-child clog-obj "CLOGB387210909815" :clog-type
|
||||||
|
'clog:clog-form-element :new-id t))
|
||||||
|
(setf (slot-value panel 'new-dir-button)
|
||||||
|
(attach-as-child clog-obj "CLOGB3872109094" :clog-type
|
||||||
|
'clog:clog-form-element :new-id t))
|
||||||
|
(setf (slot-value panel 'open-dir-button)
|
||||||
|
(attach-as-child clog-obj "CLOGB3872109093" :clog-type
|
||||||
|
'clog:clog-form-element :new-id t))
|
||||||
(setf (slot-value panel 'files)
|
(setf (slot-value panel 'files)
|
||||||
(attach-as-child clog-obj "CLOGB3872102946" :clog-type
|
(attach-as-child clog-obj "CLOGB3872109092" :clog-type
|
||||||
'clog:clog-select :new-id t))
|
'clog:clog-select :new-id t))
|
||||||
(setf (slot-value panel 'divider)
|
(setf (slot-value panel 'divider)
|
||||||
(attach-as-child clog-obj "CLOGB3872102945" :clog-type
|
(attach-as-child clog-obj "CLOGB3872109091" :clog-type
|
||||||
'clog:clog-div :new-id t))
|
'clog:clog-div :new-id t))
|
||||||
(setf (slot-value panel 'folders)
|
(setf (slot-value panel 'folders)
|
||||||
(attach-as-child clog-obj "CLOGB3872102944" :clog-type
|
(attach-as-child clog-obj "CLOGB3872109090" :clog-type
|
||||||
'clog:clog-select :new-id t))
|
'clog:clog-select :new-id t))
|
||||||
(let ((target (folders panel)))
|
(let ((target (folders panel)))
|
||||||
(declare (ignorable target))
|
(declare (ignorable target))
|
||||||
(populate-dir-win panel "./"))
|
(populate-dir-win panel "./"))
|
||||||
(clog:set-on-change (folders panel)
|
(clog:set-on-mouse-double-click (folders panel)
|
||||||
(lambda (target)
|
(lambda (target data)
|
||||||
(declare (ignorable target))
|
(declare (ignorable target data))
|
||||||
(populate-dir-win panel (value target))))
|
(populate-dir-win panel (value target))))
|
||||||
(clog:set-on-double-click (files panel)
|
(clog:set-on-double-click (files panel)
|
||||||
(lambda (target)
|
(lambda (target)
|
||||||
(declare (ignorable target))
|
(declare (ignorable target))
|
||||||
(on-select-dir-win panel)))
|
(on-select-dir-win panel)))
|
||||||
|
(clog:set-on-click (open-dir-button panel)
|
||||||
|
(lambda (target)
|
||||||
|
(declare (ignorable target))
|
||||||
|
(populate-dir-win panel (value (folders panel)))))
|
||||||
|
(clog:set-on-click (new-dir-button panel)
|
||||||
|
(lambda (target)
|
||||||
|
(declare (ignorable target))
|
||||||
|
(on-new-dir-dir-win panel)))
|
||||||
|
(clog:set-on-click (del-dir-button panel)
|
||||||
|
(lambda (target)
|
||||||
|
(declare (ignorable target))
|
||||||
|
(on-delete-dir-dir-win panel
|
||||||
|
(value (folders panel)))))
|
||||||
|
(clog:set-on-click (rename-dir-button panel)
|
||||||
|
(lambda (target)
|
||||||
|
(declare (ignorable target))
|
||||||
|
(on-rename-dir-dir-win panel
|
||||||
|
(value (folders panel)))))
|
||||||
|
(clog:set-on-click (open-button panel)
|
||||||
|
(lambda (target)
|
||||||
|
(declare (ignorable target))
|
||||||
|
(on-select-dir-win panel)))
|
||||||
|
(clog:set-on-click (del-button panel)
|
||||||
|
(lambda (target)
|
||||||
|
(declare (ignorable target))
|
||||||
|
(on-delete-dir-win panel)))
|
||||||
|
(clog:set-on-click (rename-button panel)
|
||||||
|
(lambda (target)
|
||||||
|
(declare (ignorable target))
|
||||||
|
(on-rename-dir-win panel)))
|
||||||
panel))
|
panel))
|
||||||
Loading…
Add table
Add a link
Reference in a new issue