Commit 2794776d authored by Brian Guadalupe's avatar Brian Guadalupe

Made program line highlight change color based on TM state

parent 19fcba12
...@@ -44,8 +44,12 @@ ...@@ -44,8 +44,12 @@
(tape-cell tape-idx (tape-at tm tape-idx) (tape-cell tape-idx (tape-at tm tape-idx)
(= tape-idx (tape-pos tape)))))))) (= tape-idx (tape-pos tape))))))))
(define YELLOW (make-color 240 198 116))
(define GREEN (make-color 185 202 74))
(define RED (make-color 204 102 102))
; render single line from program listing ; render single line from program listing
(define (program-line linestr [in-focus? #f]) (define (program-line linestr state [in-focus? #f])
(overlay/align "left" "middle" (overlay/align "left" "middle"
(text/font linestr (text/font linestr
18 "black" 18 "black"
...@@ -53,7 +57,10 @@ ...@@ -53,7 +57,10 @@
"modern" "normal" "normal" #f) "modern" "normal" "normal" #f)
(rectangle (* TAPE-WIDTH 40) 30 "solid" (rectangle (* TAPE-WIDTH 40) 30 "solid"
(if in-focus? (if in-focus?
(make-color 240 198 116) (match state
['accept GREEN]
['reject RED]
['running YELLOW])
"white")))) "white"))))
; display 10 lines at a time ; display 10 lines at a time
...@@ -70,7 +77,8 @@ ...@@ -70,7 +77,8 @@
"" ""
;(string-append (~r i #:min-width 4) " " ;(string-append (~r i #:min-width 4) " "
(stmt->string (stmt->string
(vector-ref (tm-config-program tm) i)));) (vector-ref (tm-config-program tm) i)))
(tm-config-state tm)
(= i (tm-config-line-no tm))))))) (= i (tm-config-line-no tm)))))))
(define (render-status tm) (define (render-status tm)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment