From c0f2b1894e2b765a68097e7752f833526b88a101 Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Fri, 28 Aug 2015 22:23:45 -0400
Subject: [PATCH] working on ui

---
 js/cam/Cam.js                        |  3 ++-
 js/menus/SendMenuView.js             | 34 ++++++++++++++++++++++++++++
 js/menus/templates/SendMenuView.html |  4 +++-
 js/models/AppState.js                |  3 +++
 4 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/js/cam/Cam.js b/js/cam/Cam.js
index a874d08c..7320fce5 100644
--- a/js/cam/Cam.js
+++ b/js/cam/Cam.js
@@ -215,7 +215,8 @@ define(['underscore', 'three', 'backbone', 'appState', 'latticeCAM', 'threeModel
 
         isVisible: function(){
             var currentTab = appState.get("currentTab");
-            return (currentTab == "assemblerSetup" || currentTab == "cam" || currentTab == "animate" || currentTab == "send"
+            var currentNav = appState.get("currentNav");
+            return (currentTab == "assemblerSetup" || currentTab == "cam" || currentTab == "animate" || currentNav == "navComm"
                 || currentTab == "editComponent");
         },
 
diff --git a/js/menus/SendMenuView.js b/js/menus/SendMenuView.js
index e76b6db2..db880c61 100644
--- a/js/menus/SendMenuView.js
+++ b/js/menus/SendMenuView.js
@@ -9,6 +9,11 @@ define(['jquery', 'underscore', 'commParentMenu', 'serialComm', 'commPlist', 'te
 
 
         events: {
+            "click #streamCommands":                                "_startStream",
+            "click #pauseStream":                                   "_pauseStream",
+            "click #stopMachine":                                   "_stopMachine",
+            "click #previousLineButton":                            "_decrementLineNum",
+            "click #nextLineButton":                                "_incrementLineNum"
         },
 
 
@@ -16,6 +21,35 @@ define(['jquery', 'underscore', 'commParentMenu', 'serialComm', 'commPlist', 'te
             this.isStreaming = false;
         },
 
+        _startStream: function(e){
+            e.preventDefault();
+            this.isStreaming = true;
+            this.render();
+        },
+
+        _pauseStream: function(e){
+            e.preventDefault();
+            this.isStreaming = false;
+            this.render();
+        },
+
+        _stopMachine: function(e){
+            e.preventDefault();
+            this.isStreaming = false;
+            serialComm.send("!");
+            this.render();
+        },
+
+        _decrementLineNum: function(e){
+            e.preventDefault();
+            console.log("prev");
+        },
+
+        _incrementLineNum: function(e){
+            e.preventDefault();
+            console.log("next");
+        },
+
         _makeTemplateJSON: function(){
             console.log("render");
             return _.extend(serialComm.toJSON(), commPlist, cam.toJSON(), camPlist, {streaming: this.isStreaming});
diff --git a/js/menus/templates/SendMenuView.html b/js/menus/templates/SendMenuView.html
index 7ea0bf98..9fde0f57 100644
--- a/js/menus/templates/SendMenuView.html
+++ b/js/menus/templates/SendMenuView.html
@@ -10,7 +10,9 @@
         <a href="#" id="stopMachine" class="btn pull-right btn-halfWidth btn-lg btn-danger">Stop</a><br/><br/>
         Incoming: &nbsp;&nbsp;<pre id="incomingSerialMessage"></pre><br/><br/>
         Out: &nbsp;&nbsp;<input id="sendSerialMessage" value="" placeholder="Send Message" class="seventyFiveWidth form-control unresponsiveInput" type="text"><br/><br/>
-        Next Line: &nbsp;&nbsp;<input id="nextLine" value="" placeholder="##" class="intInput form-control unresponsiveInput" type="text">Up/down<br/><br/>
+        Next Line: &nbsp;&nbsp;<input id="nextLine" value="" placeholder="##" class="intInput form-control unresponsiveInput" type="text">
+        <a href="#" id="previousLineButton" class="btn btn-lg btn-default">Prev</a>
+        <a href="#" id="nextLineButton" class="btn btn-lg btn-default">Next</a><br/><br/>
         <div id="gcodeEditor"><%= dataOut %></div><br/>
     <% } %>
 <% } else { %>
diff --git a/js/models/AppState.js b/js/models/AppState.js
index 60e6ac32..42790d02 100644
--- a/js/models/AppState.js
+++ b/js/models/AppState.js
@@ -117,6 +117,9 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu
                 this.set("highlighterIsVisible", false);
             } else if (navSelection == "navAssemble"){
                 this.set("highlighterIsVisible", false);
+            } else if (navSelection == "navComm"){
+                this.set("basePlaneIsVisible", false);
+                this.set("highlighterIsVisible", false);
             }
         },
 
-- 
GitLab