From 82fa80746cd56de8e6f3fc29019156207d6cd31a Mon Sep 17 00:00:00 2001 From: Hans Dijkema Date: Mon, 13 Apr 2026 09:57:42 +0200 Subject: [PATCH] stop button overload resolved. --- gui.rkt | 28 +++++++++++++---- gui/buttons/stop.svg | 71 +++++++++++++++++++++++++++++++++----------- rktplayer.rkt | 1 + 3 files changed, 77 insertions(+), 23 deletions(-) diff --git a/gui.rkt b/gui.rkt index ec7f762..dd4d0ca 100644 --- a/gui.rkt +++ b/gui.rkt @@ -126,7 +126,8 @@ (string-replace (format "~a" stored-file) "\\" "/") (current-milliseconds)))) (dbg-rktplayer "Html = ~a" html) - (send el set-innerHTML! html)))) + (send el set-innerHTML! html) + ))) ) ) (dbg-rktplayer "Done updating track") @@ -135,14 +136,29 @@ ) (define state #f) + (define current-play-image "buttons/play.svg") + + (define (set-play-button img) + (unless (string=? current-play-image img) + (set! current-play-image img) + (let ((btn (send this element 'play-img))) + (send btn set-attr! (list 'src img)) + ) + ) + ) + (define (update-state st) (unless (eq? st state) + (dbg-rktplayer "Changing to state ~a" st) + (unless (eq? state #f) ; Prevent setting src twice very fast + (if (eq? st 'playing) + (set-play-button "buttons/stop.svg") + (set-play-button "buttons/play.svg") + ) + ) (set! state st) - (if (eq? st 'playing) - (let ((btn (send this element 'play-img))) - (send btn set-attr! '(src "buttons/stop.svg"))) - (let ((btn (send this element 'play-img))) - (send btn set-attr! '(src "buttons/play.svg")))))) + ) + ) (define player (new player% [time-updater update-time] diff --git a/gui/buttons/stop.svg b/gui/buttons/stop.svg index 7ee7e6a..c4f597b 100644 --- a/gui/buttons/stop.svg +++ b/gui/buttons/stop.svg @@ -1,17 +1,54 @@ - - - - - stop - Created with Sketch Beta. - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + diff --git a/rktplayer.rkt b/rktplayer.rkt index 44625b5..a195ca2 100644 --- a/rktplayer.rkt +++ b/rktplayer.rkt @@ -44,6 +44,7 @@ )) (window (new rktplayer% [wv-context context])) ) + (send window devtools) window) )