mirror of
https://codeberg.org/cage/tinmop/
synced 2025-02-17 08:10:36 +01:00
- [GUI] added command for the 'back' button;
- [RPC] fixed function to get the IRI loaded before the latest one; - [GUI] refactored some code about main window's callbacks; - [GUI] highlighted TOC entries when the mouse pointer is over the widget.
This commit is contained in:
parent
2787544c2f
commit
f9afbd64e0
@ -53,7 +53,7 @@
|
||||
(new-history (misc:safe-all-but-last-elt history)))
|
||||
(setf (gemini-metadata-history metadata)
|
||||
new-history)
|
||||
(misc:safe-last-elt history))))
|
||||
(misc:safe-last-elt new-history))))
|
||||
|
||||
(defun maybe-initialize-metadata (window)
|
||||
(when (not (gemini-metadata-p (message-window:metadata window)))
|
||||
|
@ -690,7 +690,9 @@
|
||||
(gui:bind toc-listbox
|
||||
#$<<ListboxSelect>>$
|
||||
(toc-callback-clsr main-window))
|
||||
(setf (gui:command go-button) (open-iri-clsr main-window t))))))
|
||||
(setf (gui:command go-button) (open-iri-clsr main-window t))
|
||||
(setf (gui:command reload-button) (reload-iri-clsr main-window))
|
||||
(setf (gui:command back-button) (back-iri-clsr main-window))))))
|
||||
|
||||
(defun reload-iri-clsr (main-window)
|
||||
(lambda ()
|
||||
@ -699,8 +701,18 @@
|
||||
(let* ((iri (trim-blanks (gui:text iri-entry))))
|
||||
(open-iri iri main-window nil))))))
|
||||
|
||||
(defmethod initialize-instance :after ((object tool-bar)
|
||||
&key (main-window nil) &allow-other-keys)
|
||||
(defun back-iri-clsr (main-window)
|
||||
(lambda ()
|
||||
(with-accessors ((tool-bar tool-bar)) main-window
|
||||
(with-accessors ((iri-entry iri-entry)) tool-bar
|
||||
(let ((iri-visited (cev:enqueue-request-and-wait-results :gemini-pop-url-from-history
|
||||
1
|
||||
ev:+standard-event-priority+)))
|
||||
(when (string-not-empty-p iri-visited)
|
||||
(setf (gui:text iri-entry) iri-visited)
|
||||
(open-iri iri-visited main-window t)))))))
|
||||
|
||||
(defmethod initialize-instance :after ((object tool-bar) &key &allow-other-keys)
|
||||
(with-accessors ((iri-entry iri-entry)
|
||||
(back-button back-button)
|
||||
(reload-button reload-button)
|
||||
@ -711,10 +723,7 @@
|
||||
:master object
|
||||
:autocomplete-function (autocomplete-iri-clsr object)))
|
||||
(setf back-button (make-instance 'gui:button :master object :image icons:*back*))
|
||||
(setf reload-button (make-instance 'gui:button
|
||||
:master object
|
||||
:image icons:*refresh*
|
||||
:command (reload-iri-clsr main-window)))
|
||||
(setf reload-button (make-instance 'gui:button :master object :image icons:*refresh*))
|
||||
(setf go-button (make-instance 'gui:button :master object :image icons:*open-iri*))
|
||||
(setf up-button (make-instance 'gui:button :master object :image icons:*up*))
|
||||
(gui-goodies:attach-tooltips (back-button (_ "go back"))
|
||||
@ -739,12 +748,26 @@
|
||||
:initarg :toc-data
|
||||
:accessor toc-data)))
|
||||
|
||||
(defun setup-on-motion-higlight-toc-entry (toc-listbox)
|
||||
(with-accessors ((listbox gui:listbox)) toc-listbox
|
||||
(gui:bind listbox
|
||||
#$<Motion>$
|
||||
(lambda (event)
|
||||
(let* ((y (gui:event-y event))
|
||||
(selected-index (gui:listbox-nearest listbox y)))
|
||||
(gui:listbox-clear listbox)
|
||||
(gui:listbox-select listbox selected-index))))))
|
||||
|
||||
(defmethod initialize-instance :after ((object toc-frame) &key &allow-other-keys)
|
||||
(with-accessors ((toc-listbox toc-listbox)
|
||||
(toc-data toc-data)) object
|
||||
(setf toc-listbox (make-instance 'gui:scrolled-listbox
|
||||
:master object
|
||||
:name nil))
|
||||
(setf toc-listbox
|
||||
(make-instance 'gui:scrolled-listbox
|
||||
:cursor (gui:find-cursor :hand2)
|
||||
:master object
|
||||
:name nil
|
||||
:select-mode :single))
|
||||
(setup-on-motion-higlight-toc-entry toc-listbox)
|
||||
(gui:configure (gui:listbox toc-listbox) :width (gui-conf:config-toc-minimum-width))
|
||||
(gui:configure (gui:listbox toc-listbox)
|
||||
:font (gui-conf:toc-font-configuration))
|
||||
@ -795,7 +818,7 @@
|
||||
(info-frame info-frame)
|
||||
(info-text info-text)
|
||||
(gemtext-widget gemtext-widget)) object
|
||||
(setf tool-bar (make-instance 'tool-bar :master object :main-window object))
|
||||
(setf tool-bar (make-instance 'tool-bar :master object))
|
||||
(setf toc-frame (make-instance 'toc-frame :master object))
|
||||
(setf gemtext-widget (make-instance 'gui:scrolled-text
|
||||
:master object
|
||||
|
Loading…
x
Reference in New Issue
Block a user