Improved cut and paste nested

This commit is contained in:
David Botton 2022-01-30 22:07:30 -05:00
parent e96960a2c3
commit 8a77a3d8ee

View file

@ -50,6 +50,10 @@
:accessor control-list-win
:initform nil
:documentation "Current control list window")
(control-list-win-lock
:accessor control-list-win-lock
:initform (bordeaux-threads:make-lock)
:documentation "Sync control-list-win list")
(control-pallete-win
:accessor control-pallete-win
:initform nil
@ -390,14 +394,13 @@ not a temporary attached one when using select-control."
(name (attribute data "data-clog-title"))
(next-id (attribute data "data-clog-next-id"))
(package (attribute data "data-in-package")))
(when name
(unless (equalp next-id "undefined")
(setf-next-id content next-id))
(unless (equalp package "undefined")
(setf (attribute content "data-in-package") package))
(unless (equalp name "undefined")
(setf (attribute content "data-clog-name") name)
(destroy data))))
(destroy data)))
(labels ((add-siblings (control)
(let (dct)
(loop
@ -562,8 +565,9 @@ not a temporary attached one when using select-control."
(defun on-populate-control-list-win (content)
"Populate the control-list-window to allow drag and drop adjust of order
of controls and double click to select control."
(let ((app (connection-data-item content "builder-app-data"))
(panel-id (html-id content))
(let ((app (connection-data-item content "builder-app-data")))
(bordeaux-threads:with-lock-held ((control-list-win-lock app))
(let ((panel-id (html-id content))
(last-ctl nil))
(when (control-list-win app)
(let ((win (window-content (control-list-win app))))
@ -638,7 +642,7 @@ of controls and double click to select control."
:drag-data (html-id control))
(add-siblings (first-child control) (format nil "~A→" sim))))
(setf control (next-sibling control))))))
(add-siblings (first-child content) ""))))))
(add-siblings (first-child content) ""))))))))
;; Menu handlers
@ -827,7 +831,7 @@ of controls and double click to select control."
(format nil
"var z=~a.clone();~
z.find('*').each(function(){if($(this).attr('id') !== undefined && ~
if($(this).attr('id').substring(0,5)=='CLOGB'){$(this).removeAttr('id')}});~
$(this).attr('id').substring(0,5)=='CLOGB'){$(this).removeAttr('id')}});~
z.html()"
(clog::jquery content)))
fname)
@ -892,6 +896,12 @@ of controls and double click to select control."
(set-on-click btn-copy (lambda (obj)
(declare (ignore obj))
(when (current-control app)
(maphash
(lambda (html-id control)
(declare (ignore html-id))
(place-inside-bottom-of (bottom-panel box)
(get-placer control)))
(get-control-list app panel-id))
(setf (copy-buf app)
(js-query content
(format nil
@ -899,7 +909,12 @@ of controls and double click to select control."
z.find('*').each(function(){if($(this).attr('id') !== undefined && ~
$(this).attr('id').substring(0,5)=='CLOGB'){$(this).removeAttr('id')}});~
z.html()"
(clog::jquery (current-control app))))))))
(clog::jquery (current-control app)))))
(maphash
(lambda (html-id control)
(declare (ignore html-id))
(place-after control (get-placer control)))
(get-control-list app panel-id)))))
(set-on-click btn-paste (lambda (obj)
(declare (ignore obj))
(when (copy-buf app)
@ -912,8 +927,7 @@ of controls and double click to select control."
:custom-query (copy-buf app))))
(setup-control content control :win win)
(select-control control)
(add-sub-controls control content :win win)
(on-populate-control-list-win content)))))
(add-sub-controls control content :win win)))))
(set-on-click btn-del (lambda (obj)
(declare (ignore obj))
(when (current-control app)
@ -1073,6 +1087,12 @@ of controls and double click to select control."
(set-on-click btn-copy (lambda (obj)
(declare (ignore obj))
(when (current-control app)
(maphash
(lambda (html-id control)
(declare (ignore html-id))
(place-inside-bottom-of (bottom-panel box)
(get-placer control)))
(get-control-list app panel-id))
(setf (copy-buf app)
(js-query content
(format nil
@ -1080,7 +1100,12 @@ of controls and double click to select control."
z.find('*').each(function(){if($(this).attr('id') !== undefined && ~
$(this).attr('id').substring(0,5)=='CLOGB'){$(this).removeAttr('id')}});~
z.html()"
(clog::jquery (current-control app))))))))
(clog::jquery (current-control app)))))
(maphash
(lambda (html-id control)
(declare (ignore html-id))
(place-after control (get-placer control)))
(get-control-list app panel-id)))))
(set-on-click btn-paste (lambda (obj)
(declare (ignore obj))
(when (copy-buf app)
@ -1093,8 +1118,7 @@ of controls and double click to select control."
:custom-query (copy-buf app))))
(setup-control content control :win win)
(select-control control)
(add-sub-controls control content :win win)
(on-populate-control-list-win content)))))
(add-sub-controls control content :win win)))))
(set-on-click btn-del (lambda (obj)
(declare (ignore obj))
(when (current-control app)