From 9d19de2bcf143b501aaf72b8ea3c09c853f5b37e Mon Sep 17 00:00:00 2001 From: cage Date: Fri, 14 Apr 2023 15:09:38 +0200 Subject: [PATCH] - [GUI] added commands to shuffle the tour. --- data/icons/fmw_dice.png | Bin 0 -> 2114 bytes src/gui/client/icons.lisp | 7 ++++- src/gui/client/main-window.lisp | 8 +++++- src/gui/client/tour-window.lisp | 26 ++++++++++++++---- .../server/public-api-gemini-tour-links.lisp | 4 ++- src/package.lisp | 7 ++--- 6 files changed, 40 insertions(+), 12 deletions(-) create mode 100644 data/icons/fmw_dice.png diff --git a/data/icons/fmw_dice.png b/data/icons/fmw_dice.png new file mode 100644 index 0000000000000000000000000000000000000000..19e4fa6f48827ef75c5705932f66596ad2825c33 GIT binary patch literal 2114 zcmV-I2)*}-P)+ENI#rKw0#NW2EWZH&F%wa2r&Gt=|k*#SG)DYTV3(%rjv?!DhR_k7>|?j0=% z0{lN8Q+_l}yPi4PGs)z_YF*#S$qz*@i@<>~-+$y=nM@a(*SsoC6u3qL`t!-;=D1;O zGGlg2+_GT$G*Ch->VQ)ypqO`i9M9YHa3-^xul@g)fYwn}b-%4?8{_eKTY0h?wqZb@ znu1R-^@s~g^L3K)%gW$-9wswma2)3aHwZd5j*tItE>&hF@OWiqVxgw}fMA;w4Gr-` zT^($W%a4p8C>9YAz;|5)Lc-@FbsZYPb=!tUf|_X}#yKwSW;rK2IOven?yeyC$(CF$ zI~M`{`9#$>tiazCPb8MtwYDNzUytI@Ac~hR5jfI2fKLUMbabHdw%e#Zy-&d0>C-s3 zaU*mppcD~dOdV!zEzDE{GQ-0d>Fk7)&AwC6^gRz}$M=eh%qST5B@zd#ni|*M_=)9+ z5yZXFjl#QU)anc|7%L6sihaxEYb}&N2uVrXl=r5g=0xrZNWO6KB9b+=NZq{(c}-h> z{_pSn>V>}Gn{CPUga{&;+R#qK>AKlUe7#tgV0b|T;39~zS)B(xB8h6_qDFx>^w zI90?&EV0H$*o#|{%X_F=xe6yXZ^9QHCm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e&%dRbpa1hxfXA(K9%VvwrZKZ41;&erF1T@~ literal 0 HcmV?d00001 diff --git a/src/gui/client/icons.lisp b/src/gui/client/icons.lisp index 09f33ff..b2ea5d3 100644 --- a/src/gui/client/icons.lisp +++ b/src/gui/client/icons.lisp @@ -36,6 +36,8 @@ (a:define-constant +bus-go+ "fmw_bus-go" :test #'string=) +(a:define-constant +dice+ "fmw_dice" :test #'string=) + (defparameter *search* nil) (defparameter *back* nil) @@ -70,6 +72,8 @@ (defparameter *bus-go* nil) +(defparameter *dice* nil) + (defun load-icon (filename) (let ((path (if (not (re:scan "(?i)png$" filename)) (res:get-data-file (fs:cat-parent-dir +icon-dir+ @@ -96,4 +100,5 @@ (setf *arrow-up* (load-icon +arrow-up+)) (setf *arrow-down* (load-icon +arrow-down+)) (setf *cross* (load-icon +cross+)) - (setf *bus-go* (load-icon +bus-go+))) + (setf *bus-go* (load-icon +bus-go+)) + (setf *dice* (load-icon +dice+))) diff --git a/src/gui/client/main-window.lisp b/src/gui/client/main-window.lisp index 574c392..75b59ba 100644 --- a/src/gui/client/main-window.lisp +++ b/src/gui/client/main-window.lisp @@ -197,13 +197,14 @@ (let* ((bar (gui:make-menubar parent)) (file (gui:make-menu bar (_ "File") :underline 0)) (tools (gui:make-menu bar (_ "Tools") :underline 0)) + (tour (gui:make-menu bar (_ "Tour") :underline 0)) (bookmarks (gui:make-menu bar (_ "Bookmarks") :underline 0)) (help (gui:make-menu bar (_ "Help") :underline 0))) (gui:make-menubutton tools (_ "Certificates") #'menu:show-certificates :underline 0) (gui:make-menubutton tools (_ "Streams") #'menu:show-streams :underline 0) (gui:make-menubutton tools (_ "Search") (menu:show-search-frame-clsr main-window) :underline 1) - (gui:make-menubutton tools (_ "Tour") #'menu:show-tour :underline 0) + (gui:make-menubutton file (_ "Quit") #'menu:quit :underline 0) (gui:make-menubutton help (_ "About") #'menu:help-about :underline 0) (gui:make-menubutton bookmarks @@ -213,6 +214,11 @@ (gui:make-menubutton bookmarks (_ "Manage") (menu:manage-bookmarks-clsr main-window) + :underline 0) + (gui:make-menubutton tour (_ "Manage") #'menu:show-tour :underline 0) + (gui:make-menubutton tour + (_ "Shuffle") + (lambda () (client-tour-window:enqueue-shuffle-tour)) :underline 0))) (defclass tool-bar (gui:frame) diff --git a/src/gui/client/tour-window.lisp b/src/gui/client/tour-window.lisp index 51e87f9..073b281 100644 --- a/src/gui/client/tour-window.lisp +++ b/src/gui/client/tour-window.lisp @@ -50,6 +50,16 @@ (let ((new-rows (all-rows))) (resync-rows tour-frame new-rows))))))) +(defun enqueue-shuffle-tour () + (ev:with-enqueued-process-and-unblock () + (comm:make-request :tour-shuffle 1))) + +(defun shuffle-tour-clsr (tour-frame) + (lambda () + (enqueue-shuffle-tour) + (let ((new-rows (all-rows))) + (resync-rows tour-frame new-rows)))) + (defun init-window (master) (gui:with-toplevel (toplevel :master master :title (_ "Tour")) (gui:transient toplevel master) @@ -58,8 +68,14 @@ (delete-button (make-instance 'gui:button :master buttons-frame :image icons:*document-delete* - :command (delete-tour-clsr table)))) - (gui-goodies:attach-tooltips (delete-button (_ "delete selected links"))) - (gui:grid table 0 0 :sticky :nwe) - (gui:grid buttons-frame 1 0 :sticky :s) - (gui:grid delete-button 0 0 :sticky :s)))) + :command (delete-tour-clsr table))) + (shuffle-button (make-instance 'gui:button + :master buttons-frame + :image icons:*dice* + :command (shuffle-tour-clsr table)))) + (gui-goodies:attach-tooltips (delete-button (_ "delete selected links")) + (shuffle-button (_ "shuffle selected links"))) + (gui:grid table 0 0 :sticky :nwe) + (gui:grid buttons-frame 1 0 :sticky :s) + (gui:grid delete-button 0 0 :sticky :s) + (gui:grid shuffle-button 0 1 :sticky :s)))) diff --git a/src/gui/server/public-api-gemini-tour-links.lisp b/src/gui/server/public-api-gemini-tour-links.lisp index d3f3310..bc0b8e6 100644 --- a/src/gui/server/public-api-gemini-tour-links.lisp +++ b/src/gui/server/public-api-gemini-tour-links.lisp @@ -18,7 +18,9 @@ (in-package :json-rpc-communication) (defun tour-shuffle () - (shuffle-tour *gemini-window*)) + (progn + (shuffle-tour *gemini-window*) + t)) (defun tour-add-link (link-value link-label) (progn diff --git a/src/package.lisp b/src/package.lisp index 64b6c05..64e47e5 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -3338,7 +3338,8 @@ :*arrow-up* :*arrow-down* :*cross* - :*bus-go*)) + :*bus-go* + :*dice*)) (defpackage :validation (:use @@ -3455,9 +3456,7 @@ (:gui-shapes :nodgui.shapes) (:menu :client-menu-command)) (:export - :certificate-frame - :tree - :rows + :enqueue-shuffle-tour :init-window)) (defpackage :client-stream-window