1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2025-02-11 07:30:34 +01:00

- [GUI] added contextual menu for links;

- [GUI] added command to add a link to the tour.
This commit is contained in:
cage 2023-04-12 17:48:12 +02:00
parent 92cac487ff
commit d3e5782104
3 changed files with 41 additions and 2 deletions

View File

@ -290,6 +290,21 @@
path
query))))
(defun contextual-menu-link-clrs (link-name link-value main-window)
(declare (ignore main-window))
(lambda ()
(let* ((popup-menu (gui:make-menu nil (_"link menu")))
(add-to-tour-button (gui:make-menubutton popup-menu
(_ "Add link to tour")
(lambda ()
(ev:with-enqueued-process-and-unblock ()
(comm:make-request :tour-add-link
1
link-value
link-name))))))
(declare (ignore add-to-tour-button))
(gui:popup popup-menu (gui:screen-mouse-x) (gui:screen-mouse-y)))))
(defun collect-ir-lines (request-iri main-window lines)
(with-accessors ((ir-lines ir-lines)
(ir-rendered-lines ir-rendered-lines)
@ -377,6 +392,10 @@
link-bg
(link-click-mouse-1-callback-clsr target-iri
main-window)
:button-3-callback
(contextual-menu-link-clrs link-name
link-value
main-window)
:over-callback
(lambda () (print-info-message target-iri))
:leave-callback

View File

@ -21,10 +21,12 @@
(shuffle-tour *gemini-window*))
(defun tour-add-link (link-value link-label)
(add-tour-link *gemini-window*
(progn
(add-tour-link *gemini-window*
(make-instance 'gemini-parser:gemini-link
:name link-label
:target link-value)))
:target link-value))
t))
(defun tour-pop-link ()
(a:when-let ((link (pop-tour-link *gemini-window*)))
@ -36,3 +38,20 @@
(defun clear-tour ()
(clear-tour-link *gemini-window*))
(defclass tour (box) ())
(defmethod yason:encode ((object tour) &optional (stream *standard-output*))
(let ((tour (unbox object)))
(let ((json:*symbol-encoder* #'json:encode-symbol-as-lowercase)
(yason:*list-encoder* #'yason:encode-plist)
(json:*symbol-key-encoder* #'json:encode-symbol-as-lowercase))
(yason:with-output (stream)
(yason:with-array ()
(yason:encode-array-element
(loop for tour-link in tour collect
(list :target (gemini-parser:target tour-link)
:name (json:encode (gemini-parser:name tour-link))))))))))
(defun tour-all-links ()
(make-instance 'tour :contents (links-tour *gemini-window*)))

View File

@ -106,6 +106,7 @@
'tour-delete-link
"iri" 0)
(gen-rpc "clear-tour" 'clear-tour)
(gen-rpc "tour-all-links" 'tour-all-links)
(gen-rpc "gemini-generate-bookmark-page" 'gemini-generate-bookmark-page)
(gen-rpc "gemini-bookmark-add" 'gemini-bookmark-add
"iri" 0