mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 02:30:42 -08:00
move builder external api to another file
This commit is contained in:
parent
a85f2b88a7
commit
da9ad8c83c
3 changed files with 46 additions and 43 deletions
1
clog.asd
vendored
1
clog.asd
vendored
|
|
@ -74,6 +74,7 @@
|
||||||
:components (;; clog-db-admin app
|
:components (;; clog-db-admin app
|
||||||
(:file "clog-db-admin")
|
(:file "clog-db-admin")
|
||||||
;; clog-builder code
|
;; clog-builder code
|
||||||
|
(:file "clog-builder-api")
|
||||||
(:file "clog-builder-settings")
|
(:file "clog-builder-settings")
|
||||||
(:file "clog-builder-settings-controls")
|
(:file "clog-builder-settings-controls")
|
||||||
(:file "clog-builder")
|
(:file "clog-builder")
|
||||||
|
|
|
||||||
45
tools/clog-builder-api.lisp
Normal file
45
tools/clog-builder-api.lisp
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
(in-package :clog-tools)
|
||||||
|
|
||||||
|
;; Control Record Utilities / Plugin API for controls
|
||||||
|
|
||||||
|
(defun control-info (control-type-name)
|
||||||
|
"Return the control-record for CONTROL-TYPE-NAME from supported controls. (Exported)"
|
||||||
|
(if (equal control-type-name "clog-data")
|
||||||
|
`(:name "clog-data"
|
||||||
|
:description "Panel Properties"
|
||||||
|
:events nil
|
||||||
|
:properties ((:name "panel name"
|
||||||
|
:attr "data-clog-name")
|
||||||
|
(:name "in-package"
|
||||||
|
:attr "data-in-package")
|
||||||
|
(:name "custom slots"
|
||||||
|
:attr "data-custom-slots")
|
||||||
|
(:name "width"
|
||||||
|
:get ,(lambda (control) (width control))
|
||||||
|
:setup :read-only)
|
||||||
|
(:name "height"
|
||||||
|
:setup :read-only
|
||||||
|
:get ,(lambda (control) (height control)))))
|
||||||
|
(find-if (lambda (x) (equal (getf x :name) control-type-name)) *supported-controls*)))
|
||||||
|
|
||||||
|
(defun add-supported-controls (control-records)
|
||||||
|
"Add a list of control-records to builder's supported controls. If control exists it is
|
||||||
|
replaced. (Exported)"
|
||||||
|
(dolist (r control-records)
|
||||||
|
(setf *supported-controls*
|
||||||
|
(append (remove-if (lambda (x)
|
||||||
|
(unless (equalp (getf x :name) "group")
|
||||||
|
(equal (getf x :name) (getf r :name))))
|
||||||
|
*supported-controls*)
|
||||||
|
(list r)))))
|
||||||
|
|
||||||
|
(defun reset-control-pallete (panel)
|
||||||
|
(let* ((app (connection-data-item panel "builder-app-data"))
|
||||||
|
(pallete (select-tool app)))
|
||||||
|
(when pallete
|
||||||
|
(setf (inner-html pallete) "")
|
||||||
|
(dolist (control *supported-controls*)
|
||||||
|
(if (equal (getf control :name) "group")
|
||||||
|
(add-select-optgroup pallete (getf control :description))
|
||||||
|
(add-select-option pallete (getf control :name) (getf control :description)))))))
|
||||||
|
|
||||||
|
|
@ -8,49 +8,6 @@
|
||||||
|
|
||||||
(in-package :clog-tools)
|
(in-package :clog-tools)
|
||||||
|
|
||||||
;; Control Record Utilities / Plugin API for controls
|
|
||||||
|
|
||||||
(defun control-info (control-type-name)
|
|
||||||
"Return the control-record for CONTROL-TYPE-NAME from supported controls. (Exported)"
|
|
||||||
(if (equal control-type-name "clog-data")
|
|
||||||
`(:name "clog-data"
|
|
||||||
:description "Panel Properties"
|
|
||||||
:events nil
|
|
||||||
:properties ((:name "panel name"
|
|
||||||
:attr "data-clog-name")
|
|
||||||
(:name "in-package"
|
|
||||||
:attr "data-in-package")
|
|
||||||
(:name "custom slots"
|
|
||||||
:attr "data-custom-slots")
|
|
||||||
(:name "width"
|
|
||||||
:get ,(lambda (control) (width control))
|
|
||||||
:setup :read-only)
|
|
||||||
(:name "height"
|
|
||||||
:setup :read-only
|
|
||||||
:get ,(lambda (control) (height control)))))
|
|
||||||
(find-if (lambda (x) (equal (getf x :name) control-type-name)) *supported-controls*)))
|
|
||||||
|
|
||||||
(defun add-supported-controls (control-records)
|
|
||||||
"Add a list of control-records to builder's supported controls. If control exists it is
|
|
||||||
replaced. (Exported)"
|
|
||||||
(dolist (r control-records)
|
|
||||||
(setf *supported-controls*
|
|
||||||
(append (remove-if (lambda (x)
|
|
||||||
(unless (equalp (getf x :name) "group")
|
|
||||||
(equal (getf x :name) (getf r :name))))
|
|
||||||
*supported-controls*)
|
|
||||||
(list r)))))
|
|
||||||
|
|
||||||
(defun reset-control-pallete (panel)
|
|
||||||
(let* ((app (connection-data-item panel "builder-app-data"))
|
|
||||||
(pallete (select-tool app)))
|
|
||||||
(when pallete
|
|
||||||
(setf (inner-html pallete) "")
|
|
||||||
(dolist (control *supported-controls*)
|
|
||||||
(if (equal (getf control :name) "group")
|
|
||||||
(add-select-optgroup pallete (getf control :description))
|
|
||||||
(add-select-option pallete (getf control :name) (getf control :description)))))))
|
|
||||||
|
|
||||||
;; Global Internal Config
|
;; Global Internal Config
|
||||||
|
|
||||||
(defparameter *app-mode* nil
|
(defparameter *app-mode* nil
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue