From e60b886c7d9b76428da6678861ea51dc9662dd1f Mon Sep 17 00:00:00 2001 From: cage Date: Fri, 4 Mar 2022 14:20:14 +0100 Subject: [PATCH] - changed sizes and title of window that shows tour links. --- src/open-attach-window.lisp | 40 +++++++++++++++++++++---------- src/open-message-link-window.lisp | 14 +++++++---- src/ui-goodies.lisp | 4 +++- 3 files changed, 41 insertions(+), 17 deletions(-) diff --git a/src/open-attach-window.lisp b/src/open-attach-window.lisp index 6a018de..c83dc2a 100644 --- a/src/open-attach-window.lisp +++ b/src/open-attach-window.lisp @@ -25,7 +25,7 @@ :initarg :status-id :accessor status-id))) -(defun refresh-view-links-window-config (window config-window-key) +(defun refresh-view-links-window-config (window config-window-key &key (center-position nil)) (with-accessors ((croatoan-window croatoan-window) (selected-line-bg selected-line-bg) (selected-line-fg selected-line-fg) @@ -41,17 +41,33 @@ (reference-window (if command-line:*gemini-full-screen-mode* *gemini-toc-window* *thread-window*)) - (win-w (if command-line:*gemini-full-screen-mode* - (- (win-width *main-window*) - (win-width reference-window)) - (win-width reference-window))) - (win-h (if command-line:*gemini-full-screen-mode* - (swconf:config-gemini-fullscreen-links-height) - (win-height reference-window))) - (x (if command-line:*gemini-full-screen-mode* - (win-width reference-window) - (win-x reference-window))) - (y 0)) + (win-w (cond + (command-line:*gemini-full-screen-mode* + (- (win-width *main-window*) + (win-width reference-window))) + (center-position + (truncate (/ (win-width reference-window) 2))) + (t + (win-width reference-window)))) + (win-h (cond + (command-line:*gemini-full-screen-mode* + (swconf:config-gemini-fullscreen-links-height)) + (center-position + (truncate (/ (win-height reference-window) 2))) + (t + (win-height reference-window)))) + (x (cond + (command-line:*gemini-full-screen-mode* + (win-width reference-window)) + (center-position + (truncate (- (/ (win-width *main-window*) 2) + (/ win-w 2)))) + (t + (win-x reference-window)))) + (y (if command-line:*gemini-full-screen-mode* + 0 + (truncate (- (/ (win-height *main-window*) 2) + (/ win-h 2)))))) (setf (background croatoan-window) (tui:make-win-background bg)) (setf (bgcolor croatoan-window) bg) diff --git a/src/open-message-link-window.lisp b/src/open-message-link-window.lisp index 34afd56..da53200 100644 --- a/src/open-message-link-window.lisp +++ b/src/open-message-link-window.lisp @@ -103,11 +103,16 @@ title-window border-window open-links-window) - ()) + ((center-position + :initform nil + :initarg :center-position + :reader center-position-p + :writer (setf center-position)))) (defmethod refresh-config :after ((object open-gemini-document-link-window)) (open-attach-window:refresh-view-links-window-config object - swconf:+key-open-message-link-window+)) + swconf:+key-open-message-link-window+ + :center-position (center-position-p object))) (defmethod resync-rows-db ((object open-gemini-document-link-window) &key @@ -193,13 +198,14 @@ (error () (ui:error-message (_ "Invalid regular expression"))))) -(defun init-gemini-links (links) +(defun init-gemini-links (links &key (title (_ "Links")) (center-position nil)) (let* ((low-level-window (make-croatoan-window :enable-function-keys t))) (setf *open-message-link-window* (make-instance 'open-gemini-document-link-window + :center-position center-position :top-row-padding 0 :top-horizontal-padding 1 - :title (_ "Links") + :title title :links links :single-row-height 2 :uses-border-p t diff --git a/src/ui-goodies.lisp b/src/ui-goodies.lisp index 183d5d1..8624b89 100644 --- a/src/ui-goodies.lisp +++ b/src/ui-goodies.lisp @@ -2236,7 +2236,9 @@ gemini://gemini.circumlunar.space/docs/companion/subscription.gmi (defun show-tour-links () "Show a link window with all the links in the tour queue." - (open-message-link-window:init-gemini-links (reverse tour)) + (open-message-link-window:init-gemini-links (reverse tour) + :title (_ "Current links tour") + :center-position t) (focus-to-open-message-link-window)) (defun save-selected-message-in-tour ()