mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 18:50:42 -08:00
turn off emcas and tab version on popups
This commit is contained in:
parent
b70a35d17b
commit
58c9f08880
4 changed files with 70 additions and 29 deletions
|
|
@ -630,20 +630,36 @@ them.")
|
||||||
(t
|
(t
|
||||||
(create-div body :content "Invalid Access")))))
|
(create-div body :content "Invalid Access")))))
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; enable-clog-popup ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defun enable-clog-popup (&key (path *clog-popup-path*) (boot-file "/boot.html"))
|
(defun enable-clog-popup (&key (path *clog-popup-path*) (boot-file "/boot.html"))
|
||||||
"Enable handling of clog enabled popups"
|
"Enable handling of clog enabled popups"
|
||||||
(set-on-new-window 'clog-popup-handler :path path :boot-file boot-file))
|
(set-on-new-window 'clog-popup-handler :path path :boot-file boot-file))
|
||||||
|
|
||||||
(defun open-clog-popup (obj &key (path *clog-popup-path*)
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; open-clog-popup ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defgeneric open-clog-popup (clog-obj &key path
|
||||||
|
add-sync-to-path
|
||||||
|
sync-key
|
||||||
|
name
|
||||||
|
specs
|
||||||
|
wait-timeout)
|
||||||
|
(:documentation "Open a new browser window/popup in most cases a tab.
|
||||||
|
Since they are controlled by clog you have full control of the new popups
|
||||||
|
and are more flexible than using open-windo. Returns the clog-body and the
|
||||||
|
clog-window in the same connnection as obj of the new window on the new
|
||||||
|
connection or nil if failed within :WAIT-TIMEOUT"))
|
||||||
|
|
||||||
|
(defmethod open-clog-popup ((obj clog-obj) &key (path *clog-popup-path*)
|
||||||
(add-sync-to-path t)
|
(add-sync-to-path t)
|
||||||
(sync-key (random-hex-string))
|
(sync-key (random-hex-string))
|
||||||
(name "_blank")
|
(name "_blank")
|
||||||
(specs "")
|
(specs "")
|
||||||
(wait-timeout 10))
|
(wait-timeout 10))
|
||||||
"Open a new browser window/popup in most cases a tab. Since they are controlled
|
|
||||||
by clog you have full control of the new popups and are more flexible than using
|
|
||||||
open-windo. Returns the clog-body and the clog-window in the same connnection as
|
|
||||||
obj of the new window on the new connection or nil if failed within :WAIT-TIMEOUT"
|
|
||||||
(let* ((sem (bordeaux-threads:make-semaphore))
|
(let* ((sem (bordeaux-threads:make-semaphore))
|
||||||
(mpath (if add-sync-to-path
|
(mpath (if add-sync-to-path
|
||||||
(format nil "~A?sync=~A" path sync-key)
|
(format nil "~A?sync=~A" path sync-key)
|
||||||
|
|
@ -659,12 +675,30 @@ obj of the new window on the new connection or nil if failed within :WAIT-TIMEOU
|
||||||
(values sem new-win))
|
(values sem new-win))
|
||||||
nil)))
|
nil)))
|
||||||
|
|
||||||
(defun clog-popup-openned (obj sync-key)
|
;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
"Used to notify open-clog-popup the new popup window is ready for custom
|
;; clog-popup-openned ;;
|
||||||
clog-popup handlers."
|
;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defgeneric clog-popup-openned (clog-obj sync-key)
|
||||||
|
(:documentation "Used to notify open-clog-popup the new popup window
|
||||||
|
is ready used for custom clog-popup handlers."))
|
||||||
|
|
||||||
|
(defmethod clog-popup-openned ((obj clog-obj) sync-key)
|
||||||
(let ((sem (gethash sync-key *clog-popup-sync-hash*)))
|
(let ((sem (gethash sync-key *clog-popup-sync-hash*)))
|
||||||
(cond (sem
|
(cond (sem
|
||||||
(setf (gethash sync-key *clog-popup-sync-hash*) (connection-body obj))
|
(setf (gethash sync-key *clog-popup-sync-hash*) (connection-body obj))
|
||||||
(bordeaux-threads:signal-semaphore sem))
|
(bordeaux-threads:signal-semaphore sem))
|
||||||
(t
|
(t
|
||||||
(create-div obj :content "Invalid Sync")))))
|
(create-div obj :content "Invalid Sync")))))
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; in-clog-popup-p ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defgeneric in-clog-popup-p (clog-obj)
|
||||||
|
(:documentation "Returns obj if clog-gui-window is a in a clog-popup window"))
|
||||||
|
|
||||||
|
(defmethod in-clog-popup-p ((obj clog-obj))
|
||||||
|
(when (connection-data-item obj "clog-popup")
|
||||||
|
obj))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -943,8 +943,9 @@ embedded in a native template application.)"
|
||||||
"CLOG Popups"
|
"CLOG Popups"
|
||||||
(*clog-popup-path* variable)
|
(*clog-popup-path* variable)
|
||||||
(enable-clog-popup function)
|
(enable-clog-popup function)
|
||||||
(open-clog-popup function)
|
(open-clog-popup generic-function)
|
||||||
(clog-popup-openned function)
|
(clog-popup-openned generic-function)
|
||||||
|
(in-clog-popup-p generic-function)
|
||||||
|
|
||||||
"CLOG-Window - CLOG Window Objects"
|
"CLOG-Window - CLOG Window Objects"
|
||||||
(clog-window class)
|
(clog-window class)
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,9 @@
|
||||||
(let ((app (connection-data-item obj "builder-app-data")))
|
(let ((app (connection-data-item obj "builder-app-data")))
|
||||||
(setf (connection-data-item pop "builder-app-data") app)
|
(setf (connection-data-item pop "builder-app-data") app)
|
||||||
(clog-gui-initialize pop :parent-desktop-obj obj)
|
(clog-gui-initialize pop :parent-desktop-obj obj)
|
||||||
|
(if open-file
|
||||||
(setf (title (html-document pop)) open-file)
|
(setf (title (html-document pop)) open-file)
|
||||||
|
(setf (title (html-document pop)) "CLOG Builder Source Editor"))
|
||||||
(on-open-file pop :open-file open-file :maximized t))
|
(on-open-file pop :open-file open-file :maximized t))
|
||||||
(on-open-file obj :open-file open-file)))
|
(on-open-file obj :open-file open-file)))
|
||||||
(open-window (window (connection-body obj))
|
(open-window (window (connection-body obj))
|
||||||
|
|
@ -97,8 +99,10 @@
|
||||||
(m-load (create-gui-menu-item m-file :content "load"))
|
(m-load (create-gui-menu-item m-file :content "load"))
|
||||||
(m-save (create-gui-menu-item m-file :content "save (cmd/ctrl-s)"))
|
(m-save (create-gui-menu-item m-file :content "save (cmd/ctrl-s)"))
|
||||||
(m-saveas (create-gui-menu-item m-file :content "save as.."))
|
(m-saveas (create-gui-menu-item m-file :content "save as.."))
|
||||||
(m-emacs (create-gui-menu-item m-file :content "open in emacs"))
|
(m-emacs (unless (in-clog-popup-p obj)
|
||||||
(m-ntab (create-gui-menu-item m-file :content "open in new tab"))
|
(create-gui-menu-item m-file :content "open in emacs")))
|
||||||
|
(m-ntab (unless (in-clog-popup-p obj)
|
||||||
|
(create-gui-menu-item m-file :content "open in new tab")))
|
||||||
(m-edit (create-gui-menu-drop-down menu :content "Edit"))
|
(m-edit (create-gui-menu-drop-down menu :content "Edit"))
|
||||||
(m-undo (create-gui-menu-item m-edit :content "undo (cmd/ctrl-z)"))
|
(m-undo (create-gui-menu-item m-edit :content "undo (cmd/ctrl-z)"))
|
||||||
(m-redo (create-gui-menu-item m-edit :content "redo (shift cmd/ctrl-z)"))
|
(m-redo (create-gui-menu-item m-edit :content "redo (shift cmd/ctrl-z)"))
|
||||||
|
|
@ -311,16 +315,18 @@
|
||||||
(setf last-date (file-write-date file-name))
|
(setf last-date (file-write-date file-name))
|
||||||
(sleep .5)
|
(sleep .5)
|
||||||
(remove-class btn-save "w3-animate-top"))))))))))
|
(remove-class btn-save "w3-animate-top"))))))))))
|
||||||
|
(when m-emacs
|
||||||
(set-on-click m-emacs (lambda (obj)
|
(set-on-click m-emacs (lambda (obj)
|
||||||
(when is-dirty
|
(when is-dirty
|
||||||
(save obj nil))
|
(save obj nil))
|
||||||
(swank:ed-in-emacs file-name)
|
(swank:ed-in-emacs file-name)
|
||||||
(window-close win)))
|
(window-close win))))
|
||||||
|
(when m-ntab
|
||||||
(set-on-click m-ntab (lambda (obj)
|
(set-on-click m-ntab (lambda (obj)
|
||||||
(when is-dirty
|
(when is-dirty
|
||||||
(save obj nil))
|
(save obj nil))
|
||||||
(window-close win)
|
(window-close win)
|
||||||
(on-open-file-ext obj :open-file file-name)))
|
(on-open-file-ext obj :open-file file-name))))
|
||||||
(set-on-window-can-close win
|
(set-on-window-can-close win
|
||||||
(lambda (obj)
|
(lambda (obj)
|
||||||
(cond (is-dirty
|
(cond (is-dirty
|
||||||
|
|
|
||||||
2
tools/preferences.lisp.sample
vendored
2
tools/preferences.lisp.sample
vendored
|
|
@ -10,7 +10,7 @@
|
||||||
;; Open panels and files in new browser tabs by default
|
;; Open panels and files in new browser tabs by default
|
||||||
(setf *open-external* nil)
|
(setf *open-external* nil)
|
||||||
;; Use clog-popup and extend desktop to popups
|
;; Use clog-popup and extend desktop to popups
|
||||||
(setf *open-external-using-clog-popups* nil)
|
(setf *open-external-using-clog-popups* t)
|
||||||
|
|
||||||
;; CLOG Panels
|
;; CLOG Panels
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue