1
0
Fork 0

- [GUI] removed menu shortcuts;

- [GUI] unfocus autocomplete entry when an url has been chosen;

- [GUI] unfocus gemtext window when a link has been clicked.
This commit is contained in:
cage 2023-05-14 16:25:13 +02:00
parent b237e4bd91
commit f2af236b78
1 changed files with 38 additions and 27 deletions

View File

@ -204,12 +204,12 @@
(defun initialize-menu (parent main-window) (defun initialize-menu (parent main-window)
(let* ((bar (gui:make-menubar parent)) (let* ((bar (gui:make-menubar parent))
(file (gui:make-menu bar (_ "File") :underline 0)) (file (gui:make-menu bar (_ "File")))
(tools (gui:make-menu bar (_ "Tools") :underline 0)) (tools (gui:make-menu bar (_ "Tools")))
(tour (gui:make-menu bar (_ "Tour") :underline 1)) (tour (gui:make-menu bar (_ "Tour")))
(bookmarks (gui:make-menu bar (_ "Bookmarks") :underline 0)) (bookmarks (gui:make-menu bar (_ "Bookmarks")))
(gemlogs (gui:make-menu bar (_ "Gemlogs") :underline 0)) (gemlogs (gui:make-menu bar (_ "Gemlogs")))
(help (gui:make-menu bar (_ "Help") :underline 0))) (help (gui:make-menu bar (_ "Help"))))
(gui:make-menubutton tools (gui:make-menubutton tools
(_ "Certificates") (_ "Certificates")
#'menu:show-certificates #'menu:show-certificates
@ -329,6 +329,7 @@
(with-accessors ((iri-entry iri-entry)) tool-bar (with-accessors ((iri-entry iri-entry)) tool-bar
(lambda () (lambda ()
(set-address-bar-text main-window link-value) (set-address-bar-text main-window link-value)
(gui:focus (toc-frame main-window))
(open-iri link-value main-window use-cache :status status))))) (open-iri link-value main-window use-cache :status status)))))
(defun absolutize-link (request-iri link-value) (defun absolutize-link (request-iri link-value)
@ -1030,6 +1031,7 @@
#$<KeyPress-Return>$ #$<KeyPress-Return>$
(lambda (e) (lambda (e)
(declare (ignore e)) (declare (ignore e))
(gui:focus toc-frame)
(funcall (open-iri-clsr main-window t))) (funcall (open-iri-clsr main-window t)))
:append nil) :append nil)
(gui:bind toc-listbox (gui:bind toc-listbox
@ -1262,32 +1264,38 @@
(client-configuration:get-keybinding :search) (client-configuration:get-keybinding :search)
(lambda (e) (lambda (e)
(declare (ignore e)) (declare (ignore e))
(funcall (menu:show-search-frame-clsr main-window)))) (funcall (menu:show-search-frame-clsr main-window)))
:exclusive t)
(gui:bind (gui:root-toplevel) (gui:bind (gui:root-toplevel)
(client-configuration:get-keybinding :stream) (client-configuration:get-keybinding :stream)
(lambda (e) (lambda (e)
(declare (ignore e)) (declare (ignore e))
(menu:show-streams))) (menu:show-streams))
:exclusive t)
(gui:bind (gui:root-toplevel) (gui:bind (gui:root-toplevel)
(client-configuration:get-keybinding :certificates) (client-configuration:get-keybinding :certificates)
(lambda (e) (lambda (e)
(declare (ignore e)) (declare (ignore e))
(menu:show-certificates))) (menu:show-certificates))
:exclusive t)
(gui:bind (gui:root-toplevel) (gui:bind (gui:root-toplevel)
(client-configuration:config-keybinding-tour-manage) (client-configuration:config-keybinding-tour-manage)
(lambda (e) (lambda (e)
(declare (ignore e)) (declare (ignore e))
(menu:show-tour))) (menu:show-tour))
:exclusive t)
(gui:bind (gui:root-toplevel) (gui:bind (gui:root-toplevel)
(client-configuration:get-keybinding :gemlog) (client-configuration:get-keybinding :gemlog)
(lambda (e) (lambda (e)
(declare (ignore e)) (declare (ignore e))
(menu:manage-gemlogs))) (menu:manage-gemlogs))
:exclusive t)
(gui:bind (gui:root-toplevel) (gui:bind (gui:root-toplevel)
(client-configuration:get-keybinding :about) (client-configuration:get-keybinding :about)
(lambda (e) (lambda (e)
(declare (ignore e)) (declare (ignore e))
(menu:help-about))) (menu:help-about))
:exclusive t)
(gui:bind (gui:root-toplevel) (gui:bind (gui:root-toplevel)
(client-configuration:get-keybinding :type-address) (client-configuration:get-keybinding :type-address)
(lambda (e) (lambda (e)
@ -1295,28 +1303,31 @@
(let* ((autocomplete-entry (iri-entry (tool-bar main-window))) (let* ((autocomplete-entry (iri-entry (tool-bar main-window)))
(entry (nodgui.mw:autocomplete-entry-widget autocomplete-entry))) (entry (nodgui.mw:autocomplete-entry-widget autocomplete-entry)))
(gui:focus entry) (gui:focus entry)
(gui:set-selection entry 0 :end)))) (gui:set-selection entry 0 :end)))
:exclusive t)
(gui:bind (gui:root-toplevel) (gui:bind (gui:root-toplevel)
(client-configuration:config-keybinding-tour-shuffle) (client-configuration:config-keybinding-tour-shuffle)
(lambda (e) (lambda (e)
(declare (ignore e)) (declare (ignore e))
(client-tour-window:enqueue-shuffle-tour))) (client-tour-window:enqueue-shuffle-tour))
:exclusive t)
(gui:bind (gui:root-toplevel) (gui:bind (gui:root-toplevel)
(client-configuration:config-keybinding-tour-next) (client-configuration:config-keybinding-tour-next)
(lambda (e) (lambda (e)
(declare (ignore e)) (declare (ignore e))
(funcall (tour-visit-next-iri-clsr main-window))))) (funcall (tour-visit-next-iri-clsr main-window)))
:exclusive t))
(defun init-main-window () (defun init-main-window ()
(let ((gui:*debug-tk* nil)) (setf gui:*debug-tk* nil)
(gui:with-nodgui (:title +program-name+) (gui:with-nodgui (:title +program-name+)
(icons:load-icons) (icons:load-icons)
(setf gui-goodies:*toplevel* gui:*tk*) (setf gui-goodies:*toplevel* gui:*tk*)
(setf gui-goodies:*gui-server* gui:*wish*) (setf gui-goodies:*gui-server* gui:*wish*)
(client-events:start-events-loop) (client-events:start-events-loop)
(let ((main-frame (make-instance 'main-frame))) (let ((main-frame (make-instance 'main-frame)))
(setf gui-goodies:*main-frame* main-frame) (setf gui-goodies:*main-frame* main-frame)
(initialize-menu gui:*tk* main-frame) (initialize-menu gui:*tk* main-frame)
(gui:grid main-frame 0 0 :sticky :nswe) (gui:grid main-frame 0 0 :sticky :nswe)
(initialize-keybindings main-frame) (initialize-keybindings main-frame)
(gui-goodies:gui-resize-grid-all gui-goodies:*toplevel*))))) (gui-goodies:gui-resize-grid-all gui-goodies:*toplevel*))))