1
0
Fork 0

- [GUI] started with TOC rendering.

This commit is contained in:
cage 2023-03-18 20:27:24 +01:00
parent 82de38f891
commit 89969f1f91
6 changed files with 143 additions and 77 deletions

View File

@ -4,152 +4,168 @@
# gemini browser
gemini.favicon = "🌍"
gemini.favicon = "🌍"
gemini.main-window.foreground = white
gemini.main-window.foreground = white
gemini.main-window.background = black
gemini.main-window.background = black
# the font name
gemini.main-window.text.font = Sans
gemini.main-window.text.font = Sans
# positive number units in point, negatine units in pixel
gemini.main-window.text.size = 12
gemini.main-window.text.size = 12
# normal or bold
gemini.main-window.text.weight = normal
gemini.main-window.text.weight = normal
# roman or italic
gemini.main-window.text.slant = roman
gemini.main-window.text.slant = roman
# boolean value
gemini.main-window.text.underline = no
gemini.main-window.text.underline = no
# links
gemini.link.background = blue
gemini.link.background = blue
gemini.link.foreground = magenta
gemini.link.foreground = magenta
gemini.link.font = Sans
gemini.link.font = Sans
gemini.link.size = 12
gemini.link.size = 12
gemini.link.weight = bold
gemini.link.weight = bold
gemini.link.slant = roman
gemini.link.slant = roman
gemini.link.underline = yes
gemini.link.underline = yes
gemini.link.scheme.gemini.prefix = "→♊ "
gemini.link.scheme.gemini.prefix = "→♊ "
gemini.link.scheme.other.prefix = "→ "
gemini.link.scheme.other.prefix = "→ "
gemini.link.scheme.http.prefix = "→🕸 "
gemini.link.scheme.http.prefix = "→🕸 "
# quotation
gemini.quote.prefix = "🞂 "
gemini.quote.prefix = "🞂 "
gemini.quote.foreground = #ffffff
gemini.quote.foreground = #ffffff
gemini.quote.background = #ff00ff
gemini.quote.background = #ff00ff
gemini.quote.font = Serif
gemini.quote.font = Serif
gemini.quote.size = 12
gemini.quote.size = 12
gemini.quote.weight = bold
gemini.quote.weight = bold
gemini.quote.slant = italic
gemini.quote.slant = italic
gemini.quote.underline = yes
gemini.quote.underline = yes
gemini.quote.justification = right
gemini.quote.justification = right
# unordered list
gemini.bullet.prefix = "• "
gemini.bullet.prefix = "• "
# header level 1
gemini.h1.prefix = "🞓 "
gemini.h1.prefix = "🞓 "
gemini.h1.foreground = #ff0000
gemini.h1.foreground = #ff0000
gemini.h1.background = #ffff00
gemini.h1.background = #ffff00
gemini.h1.font = Sans
gemini.h1.font = Sans
gemini.h1.size = 20
gemini.h1.size = 20
gemini.h1.weight = bold
gemini.h1.weight = bold
gemini.h1.slant = roman
gemini.h1.slant = roman
gemini.h1.underline = yes
gemini.h1.underline = yes
gemini.h1.justification = center
gemini.h1.justification = center
# header level 2
gemini.h2.prefix = "🞐 "
gemini.h2.prefix = "🞐 "
gemini.h2.foreground = #00ffff
gemini.h2.foreground = #00ffff
gemini.h2.background = #ffffff
gemini.h2.background = #ffffff
gemini.h2.font = Sans
gemini.h2.font = Sans
gemini.h2.size = 15
gemini.h2.size = 15
gemini.h2.weight = bold
gemini.h2.weight = bold
gemini.h2.slant = roman
gemini.h2.slant = roman
gemini.h2.underline = yes
gemini.h2.underline = yes
gemini.h2.justification = right
gemini.h2.justification = right
# header level 3
gemini.h3.prefix = "🞎 "
gemini.h3.prefix = "🞎 "
gemini.h3.foreground = #0000ff
gemini.h3.foreground = #0000ff
gemini.h3.background = #ffffff
gemini.h3.background = #ffffff
gemini.h3.font = Sans
gemini.h3.font = Sans
gemini.h3.size = 12
gemini.h3.size = 12
gemini.h3.weight = bold
gemini.h3.weight = bold
gemini.h3.slant = roman
gemini.h3.slant = roman
gemini.h3.underline = yes
gemini.h3.underline = yes
gemini.h3.justification = center
gemini.h3.justification = center
#preformatted text
gemini.preformatted-text.foreground = #fed700
gemini.preformatted-text.foreground = #fed700
gemini.preformatted-text.background = white
gemini.preformatted-text.background = white
gemini.preformatted-text.font = Monospace
gemini.preformatted-text.font = Monospace
gemini.preformatted-text.size = 12
gemini.preformatted-text.size = 12
gemini.preformatted-text.weight = bold
gemini.preformatted-text.weight = bold
gemini.preformatted-text.slant = roman
gemini.preformatted-text.slant = roman
gemini.preformatted-text.underline = yes
gemini.preformatted-text.underline = yes
gemini.preformatted.justification = center
gemini.preformatted.justification = center
# Table of contents (TOC)
# width in chars
toc.width = 30
toc.font = Monospace
toc.size = 12
toc.weight = bold
toc.slant = roman
toc.underline = yes

View File

@ -209,3 +209,28 @@
(gen-conf-justification gemini swconf:+key-h3+)
(gen-conf-justification gemini swconf:+key-preformatted-text+)
(swconf:gen-simple-access (toc-width
:transform-value-fn (lambda (a)
(truncate (or (num-utils:safe-parse-number a)
80)))
:configuration-tree *client-configuration*)
swconf:+key-toc+
swconf:+key-width+)
(defun toc-font-configuration ()
(gui-goodies:make-font (access:accesses *client-configuration*
swconf:+key-toc+
+key-font+)
(access:accesses *client-configuration*
swconf:+key-toc+
+key-size+)
(access:accesses *client-configuration*
swconf:+key-toc+
+key-weight+)
(access:accesses *client-configuration*
swconf:+key-toc+
+key-slant+)
(not (swconf:false-value-p (access:accesses *client-configuration*
swconf:+key-toc+
+key-underline+)))))

View File

@ -112,7 +112,7 @@
(with-notify-errors
(apply #'comm:make-request method-name id args))))
(defun slurp-gemini-stream (iri stream-wrapper &key
(defun slurp-gemini-stream (main-window iri stream-wrapper &key
(use-cache t)
(process-function #'identity)
(aborting-function (constantly nil)))
@ -139,12 +139,27 @@
next-start-fetching)))
(loop-fetch (+ last-lines-fetched-count
next-start-fetching))))))))
(loop-fetch)))
(loop-fetch)
(let ((gui:*wish* gui-goodies:*gui-server*))
(let* ((toc-widget-width (gui:cget (gui:listbox (toc-listbox (toc-frame main-window)))
:width))
(toc-width (parse-integer toc-widget-width))
(toc (cev:enqueue-request-and-wait-results :gemini-table-of-contents
1
ev:+maximum-event-priority+
iri
toc-width)))
(misc:dbg "toc ~a" toc-width)
(loop for ct from 0
for toc-item in toc do
(gui:listbox-append (toc-listbox (toc-frame main-window))
(getf toc-item :text)))))))
(defun start-streaming-thread (iri &key
(use-cache t)
(process-function #'identity)
(status +stream-status-streaming+))
(defun start-streaming-thread (main-window iri
&key
(use-cache t)
(process-function #'identity)
(status +stream-status-streaming+))
(let ((existing-stream (find-db-stream-url iri)))
(when existing-stream
(stop-stream-thread existing-stream)
@ -158,7 +173,8 @@
(flet ((aborting-function ()
(eq (status stream-wrapper) +stream-status-canceled+)))
(let ((stream-thread (bt:make-thread (lambda ()
(slurp-gemini-stream iri
(slurp-gemini-stream main-window
iri
stream-wrapper
:use-cache use-cache
:process-function
@ -601,7 +617,8 @@
((gemini-client:gemini-file-stream-p meta)
(maybe-stop-steaming-stream-thread)
(clean-gemtext main-window)
(start-streaming-thread iri
(start-streaming-thread main-window
iri
:use-cache nil
:status status
:process-function
@ -689,6 +706,9 @@
(setf toc-listbox (make-instance 'gui:scrolled-listbox
:master object
:name nil))
(gui:configure (gui:listbox toc-listbox) :width (gui-conf:config-toc-width))
(gui:configure (gui:listbox toc-listbox)
:font (gui-conf:toc-font-configuration))
(gui:grid toc-listbox 0 0
:sticky :nswe
:ipadx +minimum-padding+

View File

@ -69,9 +69,10 @@
(gen-rpc "gemini-delete-certificate"
'gemini-delete-certificate
"cache-key" 0)
(gen-rpc "gemini-toc"
(gen-rpc "gemini-table-of-contents"
'gemini-table-of-contents
"iri" 0)
"iri" 0
"width" 1)
(gen-rpc "gemini-parse-local-file"
'gemini-parse-local-file
"path" 0)

View File

@ -3265,7 +3265,9 @@
:gemini-h1-justification
:gemini-h2-justification
:gemini-h3-justification
:gemini-preformatted-text-justification))
:gemini-preformatted-text-justification
:config-toc-width
:toc-font-configuration))
(defpackage :client-os-utils
(:use

View File

@ -997,10 +997,12 @@
(gen-win-key-access width +key-width+)
(defmacro gen-simple-access ((fn-name &key (transform-value-fn 'identity)) &rest keys)
(defmacro gen-simple-access ((fn-name &key
(transform-value-fn 'identity)
(configuration-tree '*software-configuration*))
&rest keys)
`(defun ,(misc:format-fn-symbol t "config-~a" fn-name) ()
(,transform-value-fn (access:accesses *software-configuration*
,@keys))))
(,transform-value-fn (access:accesses ,configuration-tree ,@keys))))
(gen-simple-access (delete-fetched-mentions-p
:transform-value-fn db-utils:db-not-nil-p)