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.unselected.background = black
gempub-library-window.input.unselected.foreground = red
# chats
#chat list window

View File

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

View File

@ -392,6 +392,16 @@ this exact quantity would go beyond the length or rows or zero."
:initarg :selected-line-fg
:accessor selected-line-fg
: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
;; :initform :red
;; :initarg :selected-line-fg

View File

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

View File

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

View File

@ -524,6 +524,7 @@
server
message
selected
unselected
deleted
input
read
@ -1270,51 +1271,80 @@
(selected-foreground
:initform :white
: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)
(print-unreadable-object (object stream :type t)
(with-accessors ((background background)
(foreground foreground)
(input-background input-background)
(input-foreground input-foreground)
(selected-background selected-background)
(selected-foreground selected-foreground)) object
(with-accessors ((background background)
(foreground foreground)
(input-background input-background)
(input-foreground input-foreground)
(selected-background selected-background)
(selected-foreground selected-foreground)
(unselected-background unselected-background)
(unselected-foreground selected-foreground)) object
(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
background
input-foreground
input-background
selected-foreground
selected-background))))
selected-background
unselected-foreground
unselected-background))))
(defun form-style (window-key)
(make-instance 'form-style
:background (access:accesses *software-configuration*
window-key
+key-background+)
:foreground (access:accesses *software-configuration*
window-key
+key-foreground+)
:selected-background (access:accesses *software-configuration*
window-key
+key-input+
+key-selected+
+key-background+)
:selected-foreground (access:accesses *software-configuration*
window-key
+key-input+
+key-selected+
+key-foreground+)
:input-background (access:accesses *software-configuration*
window-key
+key-input+
+key-background+)
:input-foreground (access:accesses *software-configuration*
window-key
+key-input+
+key-foreground+)))
(let* ((bg (access:accesses *software-configuration*
window-key
+key-background+))
(fg (access:accesses *software-configuration*
window-key
+key-foreground+))
(unselected-fg (or (access:accesses *software-configuration*
window-key
+key-input+
+key-unselected+
+key-foreground+)
fg))
(unselected-bg (or (access:accesses *software-configuration*
window-key
+key-input+
+key-unselected+
+key-background+)
bg)))
(make-instance 'form-style
:background bg
:foreground fg
:selected-background (access:accesses *software-configuration*
window-key
+key-input+
+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
(defun trivial-configuration-missing-value-check ()

View File

@ -1613,9 +1613,13 @@ certificate).
(defun reset-timeline-pagination ()
"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*))
(folder (thread-window:timeline-folder *thread-window*)))
(with-blocking-notify-procedure ((_ "Clearing pagination data"))
@ -2189,9 +2193,10 @@ gemini page the program is rendering."
(push-event (make-instance 'function-event
:payload
(lambda ()
(db-utils:with-ready-database (:connect nil)
(gempub:open-gempub-library-window query)
(focus-to-gempub-library-window)))))))
(tui:with-notify-errors
(db-utils:with-ready-database (:connect nil)
(gempub:open-gempub-library-window query)
(focus-to-gempub-library-window))))))))
(ui:ask-string-input #'on-input-completed
:prompt (format nil (_ "Search criteria: ")))))