mirror of
https://codeberg.org/cage/tinmop/
synced 2025-04-01 15:00:05 +02:00
- [GUI] changed test for checking a local file;
- [GUI] checked, when a image is inlined, if it comes from a local path, then try to figure out the format from the file's extension; - [GUI] [gempub] fixed inlining of cover file.
This commit is contained in:
parent
3ebe35da57
commit
65a368eddb
@ -115,6 +115,7 @@
|
||||
|
||||
(defun make-gempub-index (gempub-metadata)
|
||||
(let ((gempub-content-directory (extract-gempub (row-path gempub-metadata))))
|
||||
(values
|
||||
(cond
|
||||
((and (row-cover gempub-metadata)
|
||||
(row-index gempub-metadata))
|
||||
@ -125,7 +126,8 @@
|
||||
((row-index gempub-metadata)
|
||||
(row-index gempub-metadata))
|
||||
(t
|
||||
gempub-content-directory))))
|
||||
gempub-content-directory))
|
||||
(fs:cat-parent-dir gempub-content-directory "/"))))
|
||||
|
||||
(defun open-gempub-clsr (main-window gempub-frame)
|
||||
(lambda (e)
|
||||
@ -137,9 +139,11 @@
|
||||
(row (cev:enqueue-request-and-wait-results :gempub-file-id->row
|
||||
1
|
||||
ev:+standard-event-priority+
|
||||
id))
|
||||
(path (make-gempub-index row)))
|
||||
(client-main-window::open-iri path main-window nil)))))
|
||||
id)))
|
||||
(multiple-value-bind (path book-directory)
|
||||
(make-gempub-index row)
|
||||
(client-main-window::set-address-bar-text main-window book-directory)
|
||||
(client-main-window::open-iri path main-window nil))))))
|
||||
|
||||
(defun init-window (master main-window query-results)
|
||||
(client-main-window:hide-autocomplete-candidates main-window)
|
||||
|
@ -536,14 +536,22 @@
|
||||
(defun inline-image (main-window link-value line-index)
|
||||
(multiple-value-bind (file-path mime-type)
|
||||
(slurp-iri main-window (remove-standard-port link-value))
|
||||
(let ((image (cond
|
||||
((string= mime-type +mime-type-jpg+)
|
||||
(let* ((local-file (fs:file-exists-p file-path))
|
||||
(image (cond
|
||||
((or (string= mime-type +mime-type-jpg+)
|
||||
(and local-file
|
||||
(fs:has-extension file-path "jpg")
|
||||
(fs:has-extension file-path "jpeg")))
|
||||
(scale-jpeg main-window file-path))
|
||||
((member mime-type
|
||||
((or (member mime-type
|
||||
'("image/x-tga" "image/x-targa")
|
||||
:test #'string=)
|
||||
(and local-file
|
||||
(fs:has-extension file-path "tga")))
|
||||
(scale-targa main-window file-path))
|
||||
((string= mime-type +mime-type-png+)
|
||||
((or (string= mime-type +mime-type-png+)
|
||||
(and local-file
|
||||
(fs:has-extension file-path "png")))
|
||||
(scale-png main-window file-path))
|
||||
(t
|
||||
(gui:make-image file-path))))
|
||||
@ -1147,9 +1155,8 @@ local file paths."
|
||||
:status status)
|
||||
(client-stream-frame::refresh-all-streams
|
||||
(client-stream-frame::table stream-frame))))
|
||||
((or (null (iri:scheme parsed-iri))
|
||||
(string= (iri:scheme parsed-iri)
|
||||
constants:+file-scheme+))
|
||||
((or (fs:file-exists-p actual-iri)
|
||||
(fs:directory-exists-p actual-iri))
|
||||
(initialize-ir-lines main-window)
|
||||
(open-local-path (iri:path parsed-iri) main-window))
|
||||
(t
|
||||
|
Loading…
x
Reference in New Issue
Block a user