Commit 174b19df authored by Amanda Ghassaei's avatar Amanda Ghassaei

gcode line number

parent 0266c470
...@@ -192,7 +192,7 @@ hr { ...@@ -192,7 +192,7 @@ hr {
width: 100%; width: 100%;
background-color: rgba(255,255,255,0.5); background-color: rgba(255,255,255,0.5);
white-space: pre-wrap; white-space: pre-wrap;
padding: 15px 0 15px 20px; padding: 15px 0 15px 13px;
overflow: auto; overflow: auto;
} }
...@@ -518,4 +518,9 @@ label { ...@@ -518,4 +518,9 @@ label {
padding: 5px 10px 20px 10px; padding: 5px 10px 20px 10px;
font-size: 14px; font-size: 14px;
font-family: Courier, monospace; font-family: Courier, monospace;
}
.gCodeLineNum {
margin-right: 20px;
color: #B7B6B6;
} }
\ No newline at end of file
...@@ -114,6 +114,11 @@ define(['jquery', 'underscore', 'plist', 'backbone', 'lattice', 'appState', 'tex ...@@ -114,6 +114,11 @@ define(['jquery', 'underscore', 'plist', 'backbone', 'lattice', 'appState', 'tex
}, },
_setNumber: function($target, newVal){ _setNumber: function($target, newVal){
var min = $target.data("min");
var max = $target.data("max");
if (min !== undefined && (min > newVal)) newVal = min;
else if (max !== undefined && (max < newVal)) newVal = max;
var property = $target.data("property"); var property = $target.data("property");
if (!property) { if (!property) {
console.warn("no property associated with number input"); console.warn("no property associated with number input");
......
...@@ -20,6 +20,8 @@ define(['jquery', 'underscore', 'menuParent', 'serialComm', 'commPlist', 'text!s ...@@ -20,6 +20,8 @@ define(['jquery', 'underscore', 'menuParent', 'serialComm', 'commPlist', 'text!s
_initialize: function(){ _initialize: function(){
this.gcode = "";
this.listenTo(serialComm, "change", this._renderControls); this.listenTo(serialComm, "change", this._renderControls);
this.listenTo(cam, "change", this._renderControls); this.listenTo(cam, "change", this._renderControls);
this.listenTo(cam, "change:simLineNumber", this._lineNumChanged); this.listenTo(cam, "change:simLineNumber", this._lineNumChanged);
...@@ -76,9 +78,9 @@ define(['jquery', 'underscore', 'menuParent', 'serialComm', 'commPlist', 'text!s ...@@ -76,9 +78,9 @@ define(['jquery', 'underscore', 'menuParent', 'serialComm', 'commPlist', 'text!s
}, },
_drawGcodeHighlighter: function(lineNum){ _drawGcodeHighlighter: function(lineNum){
var code = cam.get("dataOut").split("\n"); var code = this.gcode.split("\n");
code[lineNum] = "<span id='gcodeHighlighter'>" + code[lineNum] + " </span>"; code[lineNum] = "<span id='gcodeHighlighter'>" + code[lineNum] + " </span>";
var newText = code.join("\n"); var newText = code.join('\n');
var $editor = $('#gcodeEditor'); var $editor = $('#gcodeEditor');
$editor.html(newText); $editor.html(newText);
var $highlighter = $("#gcodeHighlighter"); var $highlighter = $("#gcodeHighlighter");
...@@ -111,6 +113,12 @@ define(['jquery', 'underscore', 'menuParent', 'serialComm', 'commPlist', 'text!s ...@@ -111,6 +113,12 @@ define(['jquery', 'underscore', 'menuParent', 'serialComm', 'commPlist', 'text!s
_render: function(){ _render: function(){
this._setEditorHeight(); this._setEditorHeight();
var code = cam.get("dataOut").split("\n");
var newText = "";
_.each(code, function(line, num){
newText += '<span class="gCodeLineNum">' + num + '</span>' + line + '\n';
});
this.gcode = newText;
this._drawGcodeHighlighter(cam.get("simLineNumber")); this._drawGcodeHighlighter(cam.get("simLineNumber"));
this._renderControls(); this._renderControls();
}, },
......
...@@ -9,6 +9,6 @@ ...@@ -9,6 +9,6 @@
<span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span> <span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span>
Single step mode</label> Single step mode</label>
<a href="#" id="openSerialMonitor" class="btn btn-block btn-lg btn-default">Open Serial Monitor</a><br/> <a href="#" id="openSerialMonitor" class="btn btn-block btn-lg btn-default">Open Serial Monitor</a><br/>
Next Line: &nbsp;&nbsp;<input id="nextLine" data-property="simLineNumber" value="<%= simLineNumber %>" placeholder="##" class="intInput form-control cam" type="text"> Next Line: &nbsp;&nbsp;<input id="nextLine" data-property="simLineNumber" data-min="0" data-max="<%= dataOut.split('\n').length-1 %>" value="<%= simLineNumber %>" placeholder="##" class="intInput form-control cam" type="text">
&nbsp;&nbsp;<a href="#" id="previousLineButton" class="btn btn-lg btn-default"><span class="fui-triangle-up"></span></a> &nbsp;&nbsp;<a href="#" id="previousLineButton" class="btn btn-lg btn-default"><span class="fui-triangle-up"></span></a>
&nbsp;&nbsp;<a href="#" id="nextLineButton" class="btn btn-lg btn-default"><span class="fui-triangle-down"></span></a><br/><br/> &nbsp;&nbsp;<a href="#" id="nextLineButton" class="btn btn-lg btn-default"><span class="fui-triangle-down"></span></a><br/><br/>
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
You need to go through the Assemble workflow to setup your machine and create <%= allCamProcesses[camProcess] %> first. You need to go through the Assemble workflow to setup your machine and create <%= allCamProcesses[camProcess] %> first.
<% }else{ %> <% }else{ %>
<div id="sendControls"></div> <div id="sendControls"></div>
<div id="gcodeEditor"><%= dataOut %></div><br/> <div id="gcodeEditor"></div><br/>
<% } %> <% } %>
<% } else { %> <% } else { %>
Not connected, go back to setup tab and connect to Node server. Not connected, go back to setup tab and connect to Node server.
......
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