1
0
Fork 0

- [GUI] completed inilining of image one by one.

This commit is contained in:
cage 2023-05-13 11:54:52 +02:00
parent 319aa164fd
commit 6b12729128
5 changed files with 41 additions and 17 deletions

View File

@ -365,8 +365,8 @@
(slurp-iri redirect-iri main-window))))
((gemini-client:header-success-p status-code)
(ev:with-enqueued-process-and-unblock ()
(comm:make-request :gemini-save-url-db-history 1 iri)
(slurp-non-text-data main-window iri :try-to-open nil)))))))
(comm:make-request :gemini-save-url-db-history 1 iri))
(slurp-non-text-data main-window iri :try-to-open nil))))))
(defun contextual-menu-link-clrs (link-name link-value main-window line-count)
(labels ((add-to-tour-callback ()
@ -393,25 +393,43 @@
link-value)
:bold t)
(client-bookmark-window:init-window main-window link-value))))
(inline-possible-p ()
(inline-image-p (link-value)
(or (re:scan "(?i)jpg$" link-value)
(re:scan "(?i)jpeg$" link-value)
(re:scan "(?i)png$" link-value)
(re:scan "(?i)gif$" link-value)
(re:scan "(?i)bmp$" link-value)
(re:scan "(?i)tga$" link-value)))
(inline-possible-p (link-value)
(inline-image-p link-value))
(inline-type (link-value)
(when (inline-image-p link-value)
:inline-image))
(open-inline-callback ()
(if (inline-possible-p)
(if (inline-possible-p link-value)
(let* ((file-path (slurp-iri main-window link-value))
(image (gui:make-image file-path))
(coordinates `(+ (:line ,line-count :char 0) 1 :lines)))
(gui:insert-image (gemtext-widget main-window) image coordinates))
(gui:insert-image (gemtext-widget main-window) image coordinates)
(with-accessors ((ir-lines ir-lines)
(ir-rendered-lines ir-rendered-lines)) main-window
(let* ((parent-line (elt ir-lines (- line-count 1)))
(new-line (copy-list parent-line)))
(setf (getf new-line :type) (inline-type link-value))
(setf ir-lines
(fresh-vector-insert@ ir-lines
new-line
line-count))
(setf ir-rendered-lines
(fresh-vector-insert@ ir-lines
""
line-count)))))
(funcall (link-click-mouse-1-callback-clsr link-value main-window)))))
(lambda ()
(let* ((popup-menu (gui:make-menu nil (_"link menu")))
(x (gui:screen-mouse-x))
(y (gui:screen-mouse-y)))
(when (inline-possible-p)
(when (inline-possible-p link-value)
(gui:make-menubutton popup-menu (_ "Inline") #'open-inline-callback))
(gui:make-menubutton popup-menu (_ "Add link to bookmarks") #'bookmark-link-callback)
(gui:make-menubutton popup-menu (_ "Add link to tour") #'add-to-tour-callback)
@ -519,9 +537,9 @@
(lambda () (print-info-message "")))
(gui:append-line gemtext-widget "")))))
(render-line (key text line-number &key (wrap :word))
(let ((font (key->font key))
(justification (key->justification key))
(start-index `(:line ,line-number :char 0)))
(let ((font (key->font key))
(justification (key->justification key))
(start-index `(:line ,line-number :char 0)))
(gui:append-text gemtext-widget text)
(gui:append-line gemtext-widget "")
(multiple-value-bind (background foreground)

View File

@ -18,7 +18,7 @@
:text iri
:column-values
(list stream-status
(to-s (getf row :octet-count)))
(to-s (getf row :octect-count)))
:index gui:+treeview-last-index+)))
(gui:treeview-insert-item tree :item tree-row)))
(gui:treeview-refit-columns-width (gui-goodies:tree stream-frame))
@ -37,7 +37,7 @@
:master object
:pack '(:side :top :expand t :fill :both)
:columns (list (_ "Status")
(_ "Number of octets downloaded")))))
(_ "Number of octects downloaded")))))
(setf tree treeview)
(gui:treeview-heading tree gui:+treeview-first-column-id+
:text (_ "Address"))

View File

@ -312,7 +312,7 @@
(cons "download-iri" download-iri)
(cons "start-time" actual-start-time)
(cons "support-file" support-file)
(cons "octet-count" octect-count)
(cons "octect-count" octect-count)
(cons "port" port)
(cons "status-code" status-code)
(cons "status-code-description" status-code-description)

View File

@ -616,12 +616,12 @@ to the array"
(declare (optimize (speed 3) (safety 1) (debug 0)))
(*cat vector v))
(defun fresh-list-insert@ (a v pos)
(defun fresh-list-insert@ (list value pos)
(declare (optimize (speed 3) (safety 1) (debug 0)))
(declare (list a))
(lcat (subseq a 0 pos)
(list v)
(subseq a pos)))
(declare (list list))
(lcat (subseq list 0 pos)
(list value)
(subseq list pos)))
(defun fresh-list-subst@ (a v pos)
(declare (optimize (speed 3) (safety 1) (debug 0)))
@ -630,6 +630,11 @@ to the array"
(list v)
(subseq a (1+ pos))))
(defun fresh-vector-insert@ (a v pos)
(vcat (subseq a 0 pos)
(vector v)
(subseq a (1+ pos))))
(eval-when (:compile-toplevel :load-toplevel :execute)
(defun make-array-frame (size &optional (el nil) (type t) (simplep nil))
"All elements points to the same address/reference!"

View File

@ -171,6 +171,7 @@
:vcat
:fresh-list-insert@
:fresh-list-subst@
:fresh-vector-insert@
:make-array-frame
:make-fresh-array
:sequence->list