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