1
0
Fork 0

- allowed line-oriented-window to render unselected items with

different color than foreground;
- capured parsing errors when querying gempub library.
This commit is contained in:
cage 2021-08-28 14:02:03 +02:00
parent e9c140233b
commit baf3f4c1ea
7 changed files with 133 additions and 66 deletions

View File

@ -576,6 +576,11 @@ gempub-library-window.input.selected.background = yellow
gempub-library-window.input.selected.foreground = black gempub-library-window.input.selected.foreground = black
gempub-library-window.input.unselected.background = black
gempub-library-window.input.unselected.foreground = red
# chats # chats
#chat list window #chat list window

View File

@ -192,12 +192,12 @@
object) object)
(defun row->list-item (row) (defun row->list-item (row)
(join-with-strings* " " (join-with-strings* ", "
(db:row-title row) (db:row-title row)
(db:row-author row) (db:row-author row)
(db:row-published row))) (db:row-published row)))
(defun row->selected-list-item (row fg bg) (defun row->selected-list-item (row bg fg)
(tui:make-tui-string (row->list-item row) (tui:make-tui-string (row->list-item row)
:attributes (tui:attribute-bold) :attributes (tui:attribute-bold)
:fgcolor fg :fgcolor fg
@ -211,25 +211,32 @@
(redraw t) (redraw t)
(suggested-message-index 0)) (suggested-message-index 0))
(with-accessors ((rows rows) (with-accessors ((rows rows)
(selected-line-bg selected-line-bg) (selected-line-bg selected-line-bg)
(selected-line-fg selected-line-fg) (selected-line-fg selected-line-fg)
(query-rows query-rows)) object (unselected-line-bg unselected-line-bg)
(flet ((make-rows (rows bg fg) (unselected-line-fg unselected-line-fg)
(query-rows query-rows)) object
(flet ((make-rows (rows selected-bg selected-fg
unselected-bg unselected-fg)
(mapcar (lambda (row) (mapcar (lambda (row)
(make-instance 'line (make-instance 'line
:normal-text (row->unselected-list-item row) :normal-text (row->unselected-list-item row)
:selected-text (row->selected-list-item row fg bg) :selected-text (row->selected-list-item row
selected-bg
selected-fg)
:fields row :fields row
:normal-bg fg :normal-bg unselected-bg
:normal-fg bg :normal-fg unselected-fg
:selected-bg bg :selected-bg selected-bg
:selected-fg fg)) :selected-fg selected-fg))
rows))) rows)))
(with-croatoan-window (croatoan-window object) (with-croatoan-window (croatoan-window object)
(line-oriented-window:update-all-rows object (line-oriented-window:update-all-rows object
(make-rows query-rows (make-rows query-rows
selected-line-bg selected-line-bg
selected-line-fg)) selected-line-fg
unselected-line-bg
unselected-line-fg))
(when suggested-message-index (when suggested-message-index
(handler-bind ((conditions:out-of-bounds (handler-bind ((conditions:out-of-bounds
(lambda (e) (lambda (e)

View File

@ -392,6 +392,16 @@ this exact quantity would go beyond the length or rows or zero."
:initarg :selected-line-fg :initarg :selected-line-fg
:accessor selected-line-fg :accessor selected-line-fg
:documentation "The foreground color for a selected line") :documentation "The foreground color for a selected line")
(unselected-line-bg
:initform :blue
:initarg :unselected-line-bg
:accessor unselected-line-bg
:documentation "The background color for a unselected line")
(unselected-line-fg
:initform :red
:initarg :unselected-line-fg
:accessor unselected-line-fg
:documentation "The foreground color for a unselected line")
;; (line ;; (line
;; :initform :red ;; :initform :red
;; :initarg :selected-line-fg ;; :initarg :selected-line-fg

View File

@ -26,26 +26,32 @@
:accessor 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)
(with-accessors ((croatoan-window croatoan-window) (with-accessors ((croatoan-window croatoan-window)
(selected-line-bg selected-line-bg) (selected-line-bg selected-line-bg)
(selected-line-fg selected-line-fg)) window (selected-line-fg selected-line-fg)
(let* ((theme-style (swconf:form-style config-window-key)) (unselected-line-bg unselected-line-bg)
(fg (swconf:foreground theme-style)) (unselected-line-fg unselected-line-fg)) window
(bg (swconf:background theme-style)) (let* ((theme-style (swconf:form-style config-window-key))
(selected-fg (swconf:selected-foreground theme-style)) (fg (swconf:foreground theme-style))
(selected-bg (swconf:selected-background theme-style)) (bg (swconf:background theme-style))
(win-w (truncate (/ (win-width specials:*main-window*) 2))) (selected-fg (swconf:selected-foreground theme-style))
(win-h (truncate (/ (win-height specials:*main-window*) 2))) (selected-bg (swconf:selected-background theme-style))
(x (truncate (- (/ (win-width specials:*main-window*) 2) (unselected-fg (swconf:unselected-foreground theme-style))
(/ win-w 2)))) (unselected-bg (swconf:unselected-background theme-style))
(y (truncate (- (/ (win-height specials:*main-window*) 2) (win-w (truncate (/ (win-width specials:*main-window*) 2)))
(/ win-h 2))))) (win-h (truncate (/ (win-height specials:*main-window*) 2)))
(x (truncate (- (/ (win-width specials:*main-window*) 2)
(/ win-w 2))))
(y (truncate (- (/ (win-height specials:*main-window*) 2)
(/ win-h 2)))))
(setf (background croatoan-window) (setf (background croatoan-window)
(tui:make-win-background bg)) (tui:make-win-background bg))
(setf (bgcolor croatoan-window) bg) (setf (bgcolor croatoan-window) bg)
(setf (fgcolor croatoan-window) fg) (setf (fgcolor croatoan-window) fg)
(setf selected-line-fg selected-fg) (setf selected-line-fg selected-fg)
(setf selected-line-bg selected-bg) (setf selected-line-bg selected-bg)
(setf unselected-line-fg unselected-fg)
(setf unselected-line-bg unselected-bg)
(win-resize window win-w win-h) (win-resize window win-w win-h)
(win-move window x y) (win-move window x y)
window))) window)))

View File

@ -1241,7 +1241,9 @@
:input-background :input-background
:input-foreground :input-foreground
:selected-background :selected-background
:selected-foreground)) :selected-foreground
:unselected-background
:unselected-foreground))
(defpackage :tui-utils (defpackage :tui-utils
(:use (:use
@ -1955,6 +1957,8 @@
:simple-line-navigation-window :simple-line-navigation-window
:selected-line-bg :selected-line-bg
:selected-line-fg :selected-line-fg
:unselected-line-bg
:unselected-line-fg
:resync-rows-db :resync-rows-db
:make-blocking-list-dialog-window)) :make-blocking-list-dialog-window))

View File

@ -524,6 +524,7 @@
server server
message message
selected selected
unselected
deleted deleted
input input
read read
@ -1270,51 +1271,80 @@
(selected-foreground (selected-foreground
:initform :white :initform :white
:initarg :selected-foreground :initarg :selected-foreground
:accessor selected-foreground))) :accessor selected-foreground)
(unselected-background
:initform :black
:initarg :unselected-background
:accessor unselected-background)
(unselected-foreground
:initform :white
:initarg :unselected-foreground
:accessor unselected-foreground)))
(defmethod print-object ((object form-style) stream) (defmethod print-object ((object form-style) stream)
(print-unreadable-object (object stream :type t) (print-unreadable-object (object stream :type t)
(with-accessors ((background background) (with-accessors ((background background)
(foreground foreground) (foreground foreground)
(input-background input-background) (input-background input-background)
(input-foreground input-foreground) (input-foreground input-foreground)
(selected-background selected-background) (selected-background selected-background)
(selected-foreground selected-foreground)) object (selected-foreground selected-foreground)
(unselected-background unselected-background)
(unselected-foreground selected-foreground)) object
(format stream (format stream
"fg ~a bg ~a input-fg ~a input-bg ~a selected-fg ~a selected-bg ~a" "fg ~a bg ~a input-fg ~a input-bg ~a selected-fg ~a selected-bg ~a unselected-fg ~a unselected-bg ~a"
foreground foreground
background background
input-foreground input-foreground
input-background input-background
selected-foreground selected-foreground
selected-background)))) selected-background
unselected-foreground
unselected-background))))
(defun form-style (window-key) (defun form-style (window-key)
(make-instance 'form-style (let* ((bg (access:accesses *software-configuration*
:background (access:accesses *software-configuration* window-key
window-key +key-background+))
+key-background+) (fg (access:accesses *software-configuration*
:foreground (access:accesses *software-configuration* window-key
window-key +key-foreground+))
+key-foreground+) (unselected-fg (or (access:accesses *software-configuration*
:selected-background (access:accesses *software-configuration* window-key
window-key +key-input+
+key-input+ +key-unselected+
+key-selected+ +key-foreground+)
+key-background+) fg))
:selected-foreground (access:accesses *software-configuration* (unselected-bg (or (access:accesses *software-configuration*
window-key window-key
+key-input+ +key-input+
+key-selected+ +key-unselected+
+key-foreground+) +key-background+)
:input-background (access:accesses *software-configuration* bg)))
window-key (make-instance 'form-style
+key-input+ :background bg
+key-background+) :foreground fg
:input-foreground (access:accesses *software-configuration* :selected-background (access:accesses *software-configuration*
window-key window-key
+key-input+ +key-input+
+key-foreground+))) +key-selected+
+key-background+)
:selected-foreground (access:accesses *software-configuration*
window-key
+key-input+
+key-selected+
+key-foreground+)
:unselected-background unselected-bg
:unselected-foreground unselected-fg
:input-background (access:accesses *software-configuration*
window-key
+key-input+
+key-background+)
:input-foreground (access:accesses *software-configuration*
window-key
+key-input+
+key-foreground+))))
;;;;;; tests ;;;;;; tests
(defun trivial-configuration-missing-value-check () (defun trivial-configuration-missing-value-check ()

View File

@ -1613,9 +1613,13 @@ certificate).
(defun reset-timeline-pagination () (defun reset-timeline-pagination ()
"Removes the pagination data for current timeline and folder "Removes the pagination data for current timeline and folder
For each timeline the software keep tracks of the oldest and newest toot fetched from the instance, This way we can expand the messages thread from the point we left after the latest update. For each timeline the software keep tracks of the oldest and newest
toot fetched from the instance, This way we can expand the messages
thread from the point we left after the latest update.
This command will remove those limits so that we can just jump to the last messages posted on the instance and start expanding toots from there." This command will remove those limits so that we can just jump to the
last messages posted on the instance and start expanding toots from
there."
(let* ((timeline (thread-window:timeline-type *thread-window*)) (let* ((timeline (thread-window:timeline-type *thread-window*))
(folder (thread-window:timeline-folder *thread-window*))) (folder (thread-window:timeline-folder *thread-window*)))
(with-blocking-notify-procedure ((_ "Clearing pagination data")) (with-blocking-notify-procedure ((_ "Clearing pagination data"))
@ -2189,9 +2193,10 @@ gemini page the program is rendering."
(push-event (make-instance 'function-event (push-event (make-instance 'function-event
:payload :payload
(lambda () (lambda ()
(db-utils:with-ready-database (:connect nil) (tui:with-notify-errors
(gempub:open-gempub-library-window query) (db-utils:with-ready-database (:connect nil)
(focus-to-gempub-library-window))))))) (gempub:open-gempub-library-window query)
(focus-to-gempub-library-window))))))))
(ui:ask-string-input #'on-input-completed (ui:ask-string-input #'on-input-completed
:prompt (format nil (_ "Search criteria: "))))) :prompt (format nil (_ "Search criteria: ")))))