Browse Source

The Big Spawn/Actor Swap

main
Tony Garnock-Jones 5 years ago
parent
commit
28f337b6cc
  1. 34
      gui.rkt

34
gui.rkt

@ -93,7 +93,7 @@ @@ -93,7 +93,7 @@
(idle))
(actor #:name 'root-window
(spawn #:name 'root-window
(define c (costume #:id 'root (i:bitmap "oakura-beach-20081225.jpg")))
(define/query-value touching? #f (inbound (touching 'root)) #t)
(on #:when (touching?) (message (inbound (mouse-event 'right-down (mouse-state $x $y _ _ _))))
@ -176,8 +176,8 @@ @@ -176,8 +176,8 @@
(define v (layout-item-spec li))
(if (number? v) (exact->inexact v) v))
(actor #:name 'layout-driver
(during/actor (observe (layout-solution $container-id _ _ _))
(spawn #:name 'layout-driver
(during/spawn (observe (layout-solution $container-id _ _ _))
#:name (list 'layout container-id)
(stop-when (asserted (observe (layout-solution container-id (horizontal-layout _) _ _)))
(react (solve-hv-layout #f container-id)))
@ -272,7 +272,7 @@ @@ -272,7 +272,7 @@
(struct menu-separator (menu-id order) #:transparent)
(struct menu-item (menu-id order image message) #:transparent)
(actor #:name 'pop-up-menu-driver
(spawn #:name 'pop-up-menu-driver
(on (message (pop-up-menu-trigger $menu-id $x $y $x-pin $y-pin $release-event))
(run-pop-up-menu menu-id x y x-pin y-pin release-event)))
@ -283,7 +283,7 @@ @@ -283,7 +283,7 @@
(define normal (i:rectangle 1 1 "solid" (theme-menu-item-background-color)))
(define highlight (i:rectangle 1 1 "solid" (theme-menu-item-selected-background-color)))
(define separator (i:rectangle 1 1 "solid" (theme-menu-separator-color)))
(actor #:name instance-id
(spawn #:name instance-id
(assert (requested-layout-size instance-id #f))
(during (menu-item menu-id $order $sealed-image $msg)
(define item-id (gensym 'item))
@ -430,7 +430,7 @@ @@ -430,7 +430,7 @@
(assert (window-state window-id window-title (bounds)))
(assert (outbound (c (z) (bounds)))))
(actor #:name 'top-widget-monitor
(spawn #:name 'top-widget-monitor
(local-require data/heap)
(field [widget-heap (make-heap (lambda (a b) (<= (cdr a) (cdr b))))])
(on (asserted (outbound (<sprite> $id 'root $z _)))
@ -477,7 +477,7 @@ @@ -477,7 +477,7 @@
(begin-for-declarations
(define (message-box title init-x init-y body #:id id)
(define msg (system-text body))
(actor #:name (list 'message-box id)
(spawn #:name (list 'message-box id)
(field [x init-x]
[y init-y]
[width (max 250 (*width msg))]
@ -490,7 +490,7 @@ @@ -490,7 +490,7 @@
(*width msg)
(*height msg))))))))
(actor #:name 'test-window
(spawn #:name 'test-window
(field [x 140] [y 140] [width 400] [height 300])
(open-window 'w "Window Title" x y width height)
@ -519,7 +519,7 @@ @@ -519,7 +519,7 @@
;;---------------------------------------------------------------------------
(actor #:name 'fullscreen-menu-item
(spawn #:name 'fullscreen-menu-item
(field [fullscreen? #t])
(assert (menu-item/text 'system-menu -1
(if (fullscreen?)
@ -531,14 +531,14 @@ @@ -531,14 +531,14 @@
(fullscreen? (not (fullscreen?))))
(assert #:when (fullscreen?) (outbound 'fullscreen)))
(actor #:name 'quit-menu-item
(spawn #:name 'quit-menu-item
(assert (menu-item/text 'system-menu 0 "Quit" '(system-menu quit)))
(stop-when (message '(system-menu quit))
(actor (assert (outbound 'stop))))
(spawn (assert (outbound 'stop))))
(stop-when (message (inbound (key-event #\q #t _)))
(actor (assert (outbound 'stop)))))
(spawn (assert (outbound 'stop)))))
(actor #:name 'toolbar
(spawn #:name 'toolbar
(field [window-width 0] [window-height 0])
(on (asserted (inbound (window $w $h)))
@ -563,7 +563,7 @@ @@ -563,7 +563,7 @@
(translate ,pad ,pad)
(render-children)))))))
(actor #:name 'start-button
(spawn #:name 'start-button
(field [x 0] [y 0])
(define reqsize
(parameterize ((theme-button-y-padding 8)
@ -581,8 +581,8 @@ @@ -581,8 +581,8 @@
(send!
(pop-up-menu-trigger 'system-menu (real-part pt) (imag-part pt) 0 1 'left-up))))))
(actor #:name 'window-list-monitor
(during/actor (window-state $id $title _)
(spawn #:name 'window-list-monitor
(during/spawn (window-state $id $title _)
#:name (list 'window-list id)
(field [x 0] [y 0] [width #f] [height #f])
(define reqsize
@ -605,7 +605,7 @@ @@ -605,7 +605,7 @@
(on (message (button-click (list 'window-list id) _))
(send! (raise-widget id))))))
(actor #:name 'clock
(spawn #:name 'clock
(field [now (current-seconds)])
(on (message (inbound (frame-event _ $timestamp _ _)))
(define new (current-seconds))

Loading…
Cancel
Save