about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-08-15 20:49:25 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-08-15 20:49:25 -0700
commit6ed7c7b76a600e81901fcb63663a2f14293da34c (patch)
tree646aac25a242c5da3cdf18928ee8769016f05a35
parentde111e09272843c2ef12a6684e2a07d5a692550c (diff)
downloadmu-6ed7c7b76a600e81901fcb63663a2f14293da34c.tar.gz
2015 - ctrl-l: redraw screen
I'm starting to optimize screen-drawing. If I get it wrong, this will be
a work-around.
-rw-r--r--edit.mu34
1 files changed, 30 insertions, 4 deletions
diff --git a/edit.mu b/edit.mu
index 9e5f6892..ab22d0ad 100644
--- a/edit.mu
+++ b/edit.mu
@@ -4212,16 +4212,31 @@ recipe render-all [
   screen:address <- next-ingredient
   env:address:programming-environment-data <- next-ingredient
   hide-screen screen
-  #
-  recipes:address:editor-data <- get *env, recipes:offset
-  divider:number <- get *recipes, right:offset
-  divider <- add divider, 1
+  # top menu
+  width:number <- screen-width screen
+  draw-horizontal screen, 0, 0/left, width, 32/space, 0/black, 238/grey
+  button-start:number <- subtract width, 20
+  button-on-screen?:boolean <- greater-or-equal button-start, 0
+  assert button-on-screen?, [screen too narrow for menu]
+  screen <- move-cursor screen, 0/row, button-start
+  run-button:address:array:character <- new [ run (F4) ]
+  print-string screen, run-button, 255/white, 161/reddish
+  # error message
+  recipe-warnings:address:array:character <- get *env, recipe-warnings:offset
+  {
+    break-unless recipe-warnings
+    status:address:array:character <- new [errors found]
+    update-status screen, status, 1/red
+  }
+  # dotted line down the middle
+  divider:number, _ <- divide-with-remainder width, 2
   height:number <- screen-height screen
   draw-vertical screen, divider, 1/top, height, 9482/vertical-dotted
   #
   screen <- render-recipes screen, env
   screen <- render-sandbox-side screen, env
   #
+  recipes:address:editor-data <- get *env, recipes:offset
   current-sandbox:address:editor-data <- get *env, current-sandbox:offset
   sandbox-in-focus?:boolean <- get *env, sandbox-in-focus?:offset
   screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?
@@ -4306,6 +4321,17 @@ recipe update-cursor [
   reply screen/same-as-ingredient:0
 ]
 
+# ctrl-l - redraw screen (just in case it printed junk somehow)
+
+after +global-type [
+  {
+    ctrl-l?:boolean <- equal *c, 12/ctrl-l
+    break-unless ctrl-l?
+    screen <- render-all screen, env:address:programming-environment-data
+    loop +next-event:label
+  }
+]
+
 # ctrl-n - switch focus
 # todo: test this