stop button overload resolved.

This commit is contained in:
2026-04-13 09:57:42 +02:00
parent 2f0b91a6c6
commit 82fa80746c
3 changed files with 77 additions and 23 deletions

28
gui.rkt
View File

@@ -126,7 +126,8 @@
(string-replace (format "~a" stored-file) "\\" "/") (string-replace (format "~a" stored-file) "\\" "/")
(current-milliseconds)))) (current-milliseconds))))
(dbg-rktplayer "Html = ~a" html) (dbg-rktplayer "Html = ~a" html)
(send el set-innerHTML! html)))) (send el set-innerHTML! html)
)))
) )
) )
(dbg-rktplayer "Done updating track") (dbg-rktplayer "Done updating track")
@@ -135,14 +136,29 @@
) )
(define state #f) (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) (define (update-state st)
(unless (eq? st state) (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) (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% (define player (new player%
[time-updater update-time] [time-updater update-time]

View File

@@ -1,17 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools --> <svg
<svg width="800px" height="800px" viewBox="0 0 28 28" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"> width="800px"
height="800px"
<title>stop</title> viewBox="0 0 28 28"
<desc>Created with Sketch Beta.</desc> version="1.1"
<defs> id="svg1"
sodipodi:docname="stop.svg"
</defs> inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"> xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
<g id="Icon-Set" sketch:type="MSLayerGroup" transform="translate(-518.000000, -569.000000)" fill="#000000"> xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
<path d="M544,594 C544,594.553 543.553,595 543,595 L521,595 C520.447,595 520,594.553 520,594 L520,572 C520,571.448 520.447,571 521,571 L543,571 C543.553,571 544,571.448 544,572 L544,594 L544,594 Z M544,569 L520,569 C518.896,569 518,569.896 518,571 L518,595 C518,596.104 518.896,597 520,597 L544,597 C545.104,597 546,596.104 546,595 L546,571 C546,569.896 545.104,569 544,569 L544,569 Z" id="stop" sketch:type="MSShapeGroup"> xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
</path> xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
</g> <sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="1.11375"
inkscape:cx="399.55107"
inkscape:cy="400"
inkscape:window-width="1920"
inkscape:window-height="1129"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg1" />
<defs
id="defs1" />
<g
id="Page-1"
stroke="none"
stroke-width="1"
fill="none"
fill-rule="evenodd"
sketch:type="MSPage"
transform="matrix(0.93939394,0,0,0.95286196,0.72278339,0.65993266)">
<g
id="Icon-Set"
sketch:type="MSLayerGroup"
transform="translate(-518,-569)"
fill="#000000">
<path
d="m 544,594 c 0,0.553 -0.447,1 -1,1 h -22 c -0.553,0 -1,-0.447 -1,-1 v -22 c 0,-0.552 0.447,-1 1,-1 h 22 c 0.553,0 1,0.448 1,1 z m 0,-25 h -24 c -1.104,0 -2,0.896 -2,2 v 24 c 0,1.104 0.896,2 2,2 h 24 c 1.104,0 2,-0.896 2,-2 v -24 c 0,-1.104 -0.896,-2 -2,-2 z"
id="stop"
sketch:type="MSShapeGroup" />
</g> </g>
</g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -44,6 +44,7 @@
)) ))
(window (new rktplayer% [wv-context context])) (window (new rktplayer% [wv-context context]))
) )
(send window devtools)
window) window)
) )