about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-11-27 13:03:05 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-11-27 13:03:05 -0800
commitdc89309339a2331d83e5b0b9db3cfe6c811be73b (patch)
tree2ca88c0358317b1d407a46df297d174f6ef9d1b3
parent9baf76ec488a0216db746db8e89c31a1821e3200 (diff)
downloadmu-dc89309339a2331d83e5b0b9db3cfe6c811be73b.tar.gz
3697
Decouple programming environment initialization from rendering. This
helps make clear that we only need the width from screen during
initialization.
-rw-r--r--edit/004-programming-environment.mu15
-rw-r--r--html/edit/004-programming-environment.mu.html15
2 files changed, 4 insertions, 26 deletions
diff --git a/edit/004-programming-environment.mu b/edit/004-programming-environment.mu
index 3e6d016a..2a2dcdfa 100644
--- a/edit/004-programming-environment.mu
+++ b/edit/004-programming-environment.mu
@@ -21,23 +21,13 @@ container environment [
   sandbox-in-focus?:bool  # false => cursor in recipes; true => cursor in current-sandbox
 ]
 
-def new-programming-environment screen:&:screen, initial-recipe-contents:text, initial-sandbox-contents:text -> result:&:environment, screen:&:screen [
+def new-programming-environment screen:&:screen, initial-recipe-contents:text, initial-sandbox-contents:text -> result:&:environment [
   local-scope
   load-ingredients
   width:num <- screen-width screen
-  height:num <- screen-height screen
-  # top menu
   result <- new environment:type
-  draw-horizontal screen, 0, 0/left, width, 32/space, 0/black, 238/grey
-  button-start:num <- subtract width, 20
-  button-on-screen?:bool <- greater-or-equal button-start, 0
-  assert button-on-screen?, [screen too narrow for menu]
-  screen <- move-cursor screen, 0/row, button-start
-  print screen, [ run (F4) ], 255/white, 161/reddish
-  # dotted line down the middle
-  divider:num, _ <- divide-with-remainder width, 2
-  draw-vertical screen, divider, 1/top, height, 9482/vertical-dotted
   # recipe editor on the left
+  divider:num, _ <- divide-with-remainder width, 2
   recipes:&:editor <- new-editor initial-recipe-contents, 0/left, divider/right
   # sandbox editor on the right
   sandbox-left:num <- add divider, 1
@@ -291,7 +281,6 @@ def render-without-moving-cursor screen:&:screen, editor:&:editor -> last-row:nu
   return row, column, screen/same-as-ingredient:0, editor/same-as-ingredient:1
 ]
 
-
 scenario point-at-multiple-editors [
   local-scope
   trace-until 100/app  # trace too long
diff --git a/html/edit/004-programming-environment.mu.html b/html/edit/004-programming-environment.mu.html
index ed1bd4ad..8b6e4c62 100644
--- a/html/edit/004-programming-environment.mu.html
+++ b/html/edit/004-programming-environment.mu.html
@@ -56,23 +56,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color
   sandbox-in-focus?:bool  <span class="Comment"># false =&gt; cursor in recipes; true =&gt; cursor in current-sandbox</span>
 ]
 
-<span class="muRecipe">def</span> new-programming-environment screen:&amp;:screen, initial-recipe-contents:text, initial-sandbox-contents:text<span class="muRecipe"> -&gt; </span>result:&amp;:environment, screen:&amp;:screen [
+<span class="muRecipe">def</span> new-programming-environment screen:&amp;:screen, initial-recipe-contents:text, initial-sandbox-contents:text<span class="muRecipe"> -&gt; </span>result:&amp;:environment [
   <span class="Constant">local-scope</span>
   <span class="Constant">load-ingredients</span>
   width:num <span class="Special">&lt;-</span> screen-width screen
-  height:num <span class="Special">&lt;-</span> screen-height screen
-  <span class="Comment"># top menu</span>
   result <span class="Special">&lt;-</span> new <span class="Constant">environment:type</span>
-  draw-horizontal screen,<span class="Constant"> 0</span>, <span class="Constant">0/left</span>, width, <span class="Constant">32/space</span>, <span class="Constant">0/black</span>, <span class="Constant">238/grey</span>
-  button-start:num <span class="Special">&lt;-</span> subtract width,<span class="Constant"> 20</span>
-  button-on-screen?:bool <span class="Special">&lt;-</span> greater-or-equal button-start,<span class="Constant"> 0</span>
-  assert button-on-screen?, <span class="Constant">[screen too narrow for menu]</span>
-  screen <span class="Special">&lt;-</span> move-cursor screen, <span class="Constant">0/row</span>, button-start
-  print screen, <span class="Constant">[ run (F4) ]</span>, <span class="Constant">255/white</span>, <span class="Constant">161/reddish</span>
-  <span class="Comment"># dotted line down the middle</span>
-  divider:num, _ <span class="Special">&lt;-</span> divide-with-remainder width,<span class="Constant"> 2</span>
-  draw-vertical screen, divider, <span class="Constant">1/top</span>, height, <span class="Constant">9482/vertical-dotted</span>
   <span class="Comment"># recipe editor on the left</span>
+  divider:num, _ <span class="Special">&lt;-</span> divide-with-remainder width,<span class="Constant"> 2</span>
   recipes:&amp;:editor <span class="Special">&lt;-</span> new-editor initial-recipe-contents, <span class="Constant">0/left</span>, divider/right
   <span class="Comment"># sandbox editor on the right</span>
   sandbox-left:num <span class="Special">&lt;-</span> add divider,<span class="Constant"> 1</span>
@@ -326,7 +316,6 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color
   <span class="muControl">return</span> row, column, screen/same-as-ingredient:0, editor/same-as-ingredient:1
 ]
 
-
 <span class="muScenario">scenario</span> point-at-multiple-editors [
   <span class="Constant">local-scope</span>
   trace-until <span class="Constant">100/app</span>  <span class="Comment"># trace too long</span>