mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 02:30:42 -08:00
fixed current window issues
This commit is contained in:
parent
36642642f0
commit
fbbab97b39
4 changed files with 98 additions and 45 deletions
|
|
@ -1267,7 +1267,7 @@ Note: z-index only works on Elements with Position Type of absolute,
|
||||||
relative and fixed."))
|
relative and fixed."))
|
||||||
|
|
||||||
(defmethod z-index ((obj clog-element))
|
(defmethod z-index ((obj clog-element))
|
||||||
(style obj "z-index"))
|
(parse-integer (style obj "z-index") :junk-allowed t))
|
||||||
|
|
||||||
(defgeneric set-z-index (clog-element value)
|
(defgeneric set-z-index (clog-element value)
|
||||||
(:documentation "Set z-index VALUE for CLOG-ELEMENT"))
|
(:documentation "Set z-index VALUE for CLOG-ELEMENT"))
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,11 @@
|
||||||
:documentation "Location of the left side or width relative to pointer during drag")
|
:documentation "Location of the left side or width relative to pointer during drag")
|
||||||
(drag-y
|
(drag-y
|
||||||
:accessor drag-y
|
:accessor drag-y
|
||||||
:documentation "Location of the top or height relative to pointer during drag")))
|
:documentation "Location of the top or height relative to pointer during drag")
|
||||||
|
(on-window-change
|
||||||
|
:accessor on-window-change
|
||||||
|
:initform nil
|
||||||
|
:documentation "Fired when foreground window changed.")))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; create-clog-gui ;;
|
;; create-clog-gui ;;
|
||||||
|
|
@ -179,7 +183,49 @@ icon ⤢ and full screen mode."))
|
||||||
on-click))
|
on-click))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Implementation - Windows
|
;; Implementation - Window System
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; current-window ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defgeneric current-window (clog-obj)
|
||||||
|
(:documentation "Get the current selected clog-gui-window"))
|
||||||
|
|
||||||
|
(defmethod current-window ((obj clog-obj))
|
||||||
|
(let ((app (connection-data-item obj "clog-gui")))
|
||||||
|
(current-win app)))
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; set-on-window-change ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defgeneric set-on-window-change (clog-obj handler)
|
||||||
|
(:documentation "Set the on-window-change HANDLER.
|
||||||
|
The on-window-change clog-obj received is the new window"))
|
||||||
|
|
||||||
|
(defmethod set-on-window-change ((obj clog-obj) handler)
|
||||||
|
(let ((app (connection-data-item obj "clog-gui")))
|
||||||
|
(setf (on-window-change app) handler)))
|
||||||
|
|
||||||
|
(defmethod fire-on-window-change (obj app)
|
||||||
|
"Fire handler if set. Change the value of current-win to clog-obj (Private)"
|
||||||
|
(unless obj
|
||||||
|
(let (new-order
|
||||||
|
(order -9999))
|
||||||
|
(maphash (lambda (key value)
|
||||||
|
(setf new-order (z-index value))
|
||||||
|
(when (>= new-order order)
|
||||||
|
(setf order new-order)
|
||||||
|
(setf obj value)))
|
||||||
|
(windows app))))
|
||||||
|
(setf (current-win app) obj)
|
||||||
|
(when (on-window-change app)
|
||||||
|
(funcall (on-window-change app) obj)))
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; Implementation - Individual Windows
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defclass clog-gui-window (clog-element)
|
(defclass clog-gui-window (clog-element)
|
||||||
|
|
@ -261,7 +307,7 @@ icon ⤢ and full screen mode."))
|
||||||
(t
|
(t
|
||||||
(format t "Warning - invalid data-drag-type attribute")))
|
(format t "Warning - invalid data-drag-type attribute")))
|
||||||
(setf (z-index (drag-obj app)) (incf (last-z app)))
|
(setf (z-index (drag-obj app)) (incf (last-z app)))
|
||||||
(setf (current-win app) (drag-obj app))
|
(fire-on-window-change (drag-obj app) app)
|
||||||
(setf (drag-y app) (- pointer-y obj-top))
|
(setf (drag-y app) (- pointer-y obj-top))
|
||||||
(setf (drag-x app) (- pointer-x obj-left)))
|
(setf (drag-x app) (- pointer-x obj-left)))
|
||||||
(cond (perform-drag
|
(cond (perform-drag
|
||||||
|
|
@ -366,22 +412,12 @@ icon ⤢ and full screen mode."))
|
||||||
(when (fire-on-window-can-close win)
|
(when (fire-on-window-can-close win)
|
||||||
(remhash (format nil "~A" html-id) (windows app))
|
(remhash (format nil "~A" html-id) (windows app))
|
||||||
(remove-from-dom win)
|
(remove-from-dom win)
|
||||||
|
(fire-on-window-change nil app)
|
||||||
(fire-on-window-close win))))
|
(fire-on-window-close win))))
|
||||||
(setf (gethash (format nil "~A" html-id) (windows app)) win)
|
(setf (gethash (format nil "~A" html-id) (windows app)) win)
|
||||||
(setf (current-win app) win)
|
(fire-on-window-change win app)
|
||||||
win))
|
win))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;
|
|
||||||
;; current-window ;;
|
|
||||||
;;;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
(defgeneric current-window (clog-obj)
|
|
||||||
(:documentation "Get the current selected clog-gui-window"))
|
|
||||||
|
|
||||||
(defmethod current-window ((obj clog-obj))
|
|
||||||
(let ((app (connection-data-item obj "clog-gui")))
|
|
||||||
(current-win app)))
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;
|
||||||
;; window-title ;;
|
;; window-title ;;
|
||||||
;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
|
|
||||||
|
|
@ -665,8 +665,11 @@ embedded in a native template application.)"
|
||||||
(create-gui-menu-full-screen generic-function)
|
(create-gui-menu-full-screen generic-function)
|
||||||
(create-gui-menu-icon generic-function)
|
(create-gui-menu-icon generic-function)
|
||||||
|
|
||||||
"CLOG-GUI - Windows"
|
"CLOG-GUI - Window System"
|
||||||
(current-window generic-function)
|
(current-window generic-function)
|
||||||
|
(set-on-window-change generic-function)
|
||||||
|
|
||||||
|
"CLOG-GUI - Individual Windows"
|
||||||
(clog-gui-window class)
|
(clog-gui-window class)
|
||||||
(create-gui-window generic-function)
|
(create-gui-window generic-function)
|
||||||
(window-title generic-function)
|
(window-title generic-function)
|
||||||
|
|
|
||||||
|
|
@ -89,46 +89,60 @@
|
||||||
(defun do-ide-file-save (obj)
|
(defun do-ide-file-save (obj)
|
||||||
(if (equalp (window-title (current-window obj)) "New Window")
|
(if (equalp (window-title (current-window obj)) "New Window")
|
||||||
(do-ide-file-save-as obj)
|
(do-ide-file-save-as obj)
|
||||||
(write-file (js-query obj (format nil "editor_~A.getValue()"
|
(let* ((cw (current-window obj))
|
||||||
(html-id (current-window obj))))
|
(fname (window-title cw)))
|
||||||
(window-title (current-window obj)))))
|
(write-file (js-query obj (format nil "editor_~A.getValue()"
|
||||||
|
(html-id cw)))
|
||||||
|
fname)
|
||||||
|
(setf (window-title cw) "SAVED")
|
||||||
|
(sleep 2)
|
||||||
|
(setf (window-title cw) fname))))
|
||||||
|
|
||||||
(defun do-ide-file-save-as (obj)
|
(defun do-ide-file-save-as (obj)
|
||||||
(let ((cw (current-window obj)))
|
(let ((cw (current-window obj)))
|
||||||
(get-file-name obj "Save As.."
|
(when cw
|
||||||
(lambda (fname)
|
(get-file-name obj "Save As.."
|
||||||
(setf (window-title cw) fname)
|
(lambda (fname)
|
||||||
(write-file (js-query obj (format nil "editor_~A.getValue()"
|
(setf (window-title cw) fname)
|
||||||
(html-id cw)))
|
(write-file (js-query obj (format nil "editor_~A.getValue()"
|
||||||
fname)))))
|
(html-id cw)))
|
||||||
|
fname))))))
|
||||||
|
|
||||||
|
|
||||||
(defun do-ide-edit-copy (obj)
|
(defun do-ide-edit-copy (obj)
|
||||||
(let* ((app (connection-data-item obj "app-data")))
|
(let ((cw (current-window obj)))
|
||||||
(setf (copy-buf app) (js-query obj (format nil "editor_~A.getCopyText();"
|
(when cw
|
||||||
(html-id (current-window obj)))))))
|
(let* ((app (connection-data-item obj "app-data")))
|
||||||
|
(setf (copy-buf app) (js-query obj (format nil "editor_~A.getCopyText();"
|
||||||
|
(html-id cw))))))))
|
||||||
|
|
||||||
(defun do-ide-edit-cut (obj)
|
(defun do-ide-edit-cut (obj)
|
||||||
(do-ide-edit-copy obj)
|
(let ((cw (current-window obj)))
|
||||||
(js-execute obj (format nil "editor_~A.execCommand('cut')"
|
(when cw
|
||||||
(html-id (current-window obj)))))
|
(do-ide-edit-copy obj)
|
||||||
|
(js-execute obj (format nil "editor_~A.execCommand('cut')"
|
||||||
|
(html-id cw))))))
|
||||||
|
|
||||||
(defun do-ide-edit-paste (obj)
|
(defun do-ide-edit-paste (obj)
|
||||||
(let* ((app (connection-data-item obj "app-data")))
|
(let ((cw (current-window obj)))
|
||||||
(js-execute obj (format nil "editor_~A.execCommand('paste', '~A')"
|
(when cw
|
||||||
(html-id (current-window obj))
|
(let ((app (connection-data-item obj "app-data")))
|
||||||
(escape-string (copy-buf app))))))
|
(js-execute obj (format nil "editor_~A.execCommand('paste', '~A')"
|
||||||
|
(html-id cw)
|
||||||
|
(escape-string (copy-buf app))))))))
|
||||||
|
|
||||||
(defun do-ide-lisp-eval-file (obj)
|
(defun do-ide-lisp-eval-file (obj)
|
||||||
(let* ((form-string (js-query obj (format nil "editor_~A.getValue()"
|
(let ((cw (current-window obj)))
|
||||||
(html-id (current-window obj)))))
|
(when cw
|
||||||
(result (capture-eval form-string)))
|
(let* ((form-string (js-query obj (format nil "editor_~A.getValue()"
|
||||||
|
(html-id (current-window obj)))))
|
||||||
|
(result (capture-eval form-string)))
|
||||||
|
|
||||||
(do-ide-file-new obj)
|
(do-ide-file-new obj)
|
||||||
(js-execute obj (format nil "editor_~A.setValue('~A');editor_~A.moveCursorTo(0,0);"
|
(js-execute obj (format nil "editor_~A.setValue('~A');editor_~A.moveCursorTo(0,0);"
|
||||||
(html-id (current-window obj))
|
(html-id cw)
|
||||||
(escape-string result)
|
(escape-string result)
|
||||||
(html-id (current-window obj))))))
|
(html-id cw)))))))
|
||||||
|
|
||||||
(defun do-ide-help-about (obj)
|
(defun do-ide-help-about (obj)
|
||||||
(let* ((app (connection-data-item obj "app-data"))
|
(let* ((app (connection-data-item obj "app-data"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue