mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 10:40:45 -08:00
syncing of property and event access
This commit is contained in:
parent
9f5d1b9df7
commit
e96960a2c3
1 changed files with 131 additions and 111 deletions
|
|
@ -26,22 +26,22 @@
|
|||
:accessor select-tool
|
||||
:initform nil
|
||||
:documentation "Select tool")
|
||||
(control-lists
|
||||
:accessor control-lists
|
||||
:initform (make-hash-table :test #'equalp)
|
||||
:documentation "Panel to Control List hash table")
|
||||
(properties-list
|
||||
:accessor properties-list
|
||||
:initform nil
|
||||
:documentation "Property list in properties window")
|
||||
(control-properties-win
|
||||
:accessor control-properties-win
|
||||
:initform nil
|
||||
:documentation "Current control properties window")
|
||||
(events-list
|
||||
:accessor events-list
|
||||
:initform nil
|
||||
:documentation "Property list in events window")
|
||||
(properties-lock
|
||||
:accessor properties-lock
|
||||
:initform (bordeaux-threads:make-lock)
|
||||
:documentation "Sync properties and event list")
|
||||
(control-properties-win
|
||||
:accessor control-properties-win
|
||||
:initform nil
|
||||
:documentation "Current control properties window")
|
||||
(control-events-win
|
||||
:accessor control-events-win
|
||||
:initform nil
|
||||
|
|
@ -53,18 +53,29 @@
|
|||
(control-pallete-win
|
||||
:accessor control-pallete-win
|
||||
:initform nil
|
||||
:documentation "Current control pallete window")))
|
||||
:documentation "Current control pallete window")
|
||||
(control-lists
|
||||
:accessor control-lists
|
||||
:initform (make-hash-table :test #'equalp)
|
||||
:documentation "Panel to Control List hash table")
|
||||
(control-lists-lock
|
||||
:accessor control-lists-lock
|
||||
:initform (bordeaux-threads:make-lock)
|
||||
:documentation "Protect the control list")))
|
||||
|
||||
;; Cross page syncing
|
||||
|
||||
(defparameter *app-sync-hash* (make-hash-table :test #'equal)
|
||||
(defvar *app-sync-hash* (make-hash-table :test #'equal)
|
||||
"Exchange app instance with new external pages")
|
||||
(defvar *app-sync-lock* (bordeaux-threads:make-lock)
|
||||
"Protect app-sync hash tables")
|
||||
|
||||
;; Control-List utilities
|
||||
|
||||
(defun init-control-list (app panel-id)
|
||||
"Initialize new control list for PANEL-ID on instance of APP."
|
||||
(setf (gethash panel-id (control-lists app)) (make-hash-table :test #'equalp)))
|
||||
(bordeaux-threads:with-lock-held ((control-lists-lock app))
|
||||
(setf (gethash panel-id (control-lists app)) (make-hash-table :test #'equalp))))
|
||||
|
||||
(defun destroy-control-list (app panel-id)
|
||||
"Destroy the control-list on PANEL-ID"
|
||||
|
|
@ -76,8 +87,9 @@
|
|||
|
||||
(defun add-to-control-list (app panel-id control)
|
||||
"Add a CONTROL on to control-list on PANEL-ID"
|
||||
(bordeaux-threads:with-lock-held ((control-lists-lock app))
|
||||
(let ((html-id (format nil "~A" (html-id control))))
|
||||
(setf (gethash html-id (get-control-list app panel-id)) control)))
|
||||
(setf (gethash html-id (get-control-list app panel-id)) control))))
|
||||
|
||||
(defun get-from-control-list (app panel-id html-id)
|
||||
"Get control identified my HTML-ID from control-list on PANEL-ID"
|
||||
|
|
@ -85,7 +97,8 @@
|
|||
|
||||
(defun remove-from-control-list (app panel-id html-id)
|
||||
"Remove a control identified by HTML-ID from control-list on PANEL-ID"
|
||||
(remhash html-id (get-control-list app panel-id)))
|
||||
(bordeaux-threads:with-lock-held ((control-lists-lock app))
|
||||
(remhash html-id (get-control-list app panel-id))))
|
||||
|
||||
(defun remove-deleted-from-control-list (app panel-id)
|
||||
"Remove any deleted control from control-list"
|
||||
|
|
@ -450,9 +463,10 @@ not a temporary attached one when using select-control."
|
|||
(defun on-populate-control-properties-win (obj &key win)
|
||||
"Populate the control properties for the current control"
|
||||
;; obj if current-control is nil must be content
|
||||
(let ((app (connection-data-item obj "builder-app-data")))
|
||||
(bordeaux-threads:with-lock-held ((properties-lock app))
|
||||
(on-populate-control-events-win obj)
|
||||
(let* ((app (connection-data-item obj "builder-app-data"))
|
||||
(prop-win (control-properties-win app))
|
||||
(let* ((prop-win (control-properties-win app))
|
||||
(control (if (current-control app)
|
||||
(current-control app)
|
||||
obj))
|
||||
|
|
@ -539,7 +553,7 @@ not a temporary attached one when using select-control."
|
|||
(set-geometry placer :top (position-top control)
|
||||
:left (position-left control)
|
||||
:width (client-width control)
|
||||
:height (client-height control)))))))))))
|
||||
:height (client-height control)))))))))))))
|
||||
|
||||
(defun on-populate-loaded-window (content &key win)
|
||||
"Setup html imported in to CONTENT for use with Builder"
|
||||
|
|
@ -988,10 +1002,12 @@ of controls and double click to select control."
|
|||
(panel-id (html-id content)))
|
||||
;; sync new window with app
|
||||
(setf (connection-data-item body "builder-app-data") app)
|
||||
(remhash panel-uid *app-sync-hash*)
|
||||
(bordeaux-threads:with-lock-held (*app-sync-lock*)
|
||||
(remhash panel-uid *app-sync-hash*))
|
||||
(funcall (gethash (format nil "~A-link" panel-uid) *app-sync-hash*) content)
|
||||
(setf win (gethash (format nil "~A-win" panel-uid) *app-sync-hash*))
|
||||
(remhash (format nil "~A-win" panel-uid) *app-sync-hash*)
|
||||
(bordeaux-threads:with-lock-held (*app-sync-lock*)
|
||||
(remhash (format nil "~A-win" panel-uid) *app-sync-hash*))
|
||||
|
||||
;; setup window and page
|
||||
(setf-next-id content 1)
|
||||
|
|
@ -1195,14 +1211,18 @@ of controls and double click to select control."
|
|||
(txt-link (create-div txt-area
|
||||
:content (format nil "<br><center>~A</center>" link)))
|
||||
content panel-id)
|
||||
(setf (gethash panel-uid *app-sync-hash*) app)
|
||||
(setf (gethash (format nil "~A-win" panel-uid) *app-sync-hash*) win)
|
||||
(bordeaux-threads:with-lock-held (*app-sync-lock*)
|
||||
(setf (gethash panel-uid *app-sync-hash*) app))
|
||||
(bordeaux-threads:with-lock-held (*app-sync-lock*)
|
||||
(setf (gethash (format nil "~A-win" panel-uid) *app-sync-hash*) win))
|
||||
(bordeaux-threads:with-lock-held (*app-sync-lock*)
|
||||
(setf (gethash (format nil "~A-link" panel-uid) *app-sync-hash*)
|
||||
(lambda (obj)
|
||||
(setf content obj)
|
||||
(setf panel-id (html-id content))
|
||||
(destroy txt-area)
|
||||
(remhash (format nil "~A-link" panel-uid) *app-sync-hash*)))
|
||||
(bordeaux-threads:with-lock-held (*app-sync-lock*)
|
||||
(remhash (format nil "~A-link" panel-uid) *app-sync-hash*)))))
|
||||
(unless url-launch
|
||||
(open-browser :url link))))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue