Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Amanda Ghassaei
DMDesign
Commits
e662a877
Commit
e662a877
authored
Sep 11, 2015
by
Amanda Ghassaei
Browse files
next line in send menu
parent
0fe5bf6c
Changes
3
Hide whitespace changes
Inline
Side-by-side
js/menus/SendMenuView.js
View file @
e662a877
...
...
@@ -19,9 +19,12 @@ define(['jquery', 'underscore', 'menuParent', 'serialComm', 'commPlist', 'text!s
_initialize
:
function
(){
this
.
listenTo
(
this
.
model
,
"
change:stockSimulationPlaying
"
,
this
.
render
);
this
.
listenTo
(
serialComm
,
"
change:isStreaming
"
,
this
.
render
);
this
.
listenTo
(
cam
,
"
change:simLineNumber
"
,
this
.
_drawGcodeHighlighter
);
this
.
listenTo
(
cam
,
"
change:simLineNumber
"
,
this
.
_lineNumChanged
);
this
.
nextLine
=
cam
.
get
(
"
simLineNumber
"
);
},
_startStream
:
function
(
e
){
...
...
@@ -44,12 +47,23 @@ define(['jquery', 'underscore', 'menuParent', 'serialComm', 'commPlist', 'text!s
_decrementLineNum
:
function
(
e
){
e
.
preventDefault
();
console
.
log
(
"
prev
"
);
var
nextLine
=
this
.
nextLine
-
1
;
if
(
nextLine
<
0
)
nextLine
=
0
;
this
.
_setNextLine
(
nextLine
);
},
_incrementLineNum
:
function
(
e
){
e
.
preventDefault
();
console
.
log
(
"
next
"
);
var
nextLine
=
this
.
nextLine
+
1
;
var
length
=
cam
.
get
(
"
dataOut
"
).
split
(
"
\n
"
).
length
;
if
(
nextLine
>
length
-
1
)
nextLine
=
length
-
1
;
this
.
_setNextLine
(
nextLine
);
},
_setNextLine
:
function
(
val
){
this
.
nextLine
=
val
;
$
(
"
#nextLine
"
).
val
(
this
.
nextLine
);
this
.
_drawGcodeHighlighter
(
val
);
},
_openSerialMonitor
:
function
(
e
){
...
...
@@ -57,8 +71,12 @@ define(['jquery', 'underscore', 'menuParent', 'serialComm', 'commPlist', 'text!s
serialComm
.
openSerialMonitor
();
},
_
drawGcodeHighlighter
:
function
(){
_
lineNumChanged
:
function
(){
var
lineNum
=
cam
.
get
(
"
simLineNumber
"
);
this
.
_setNextLine
(
lineNum
);
},
_drawGcodeHighlighter
:
function
(
lineNum
){
if
(
lineNum
==
0
)
return
;
var
code
=
cam
.
get
(
"
dataOut
"
).
split
(
"
\n
"
);
code
[
lineNum
]
=
"
<span id='gcodeHighlighter'>
"
+
code
[
lineNum
]
+
"
</span>
"
;
...
...
@@ -73,7 +91,7 @@ define(['jquery', 'underscore', 'menuParent', 'serialComm', 'commPlist', 'text!s
},
_makeTemplateJSON
:
function
(){
return
_
.
extend
(
serialComm
.
toJSON
(),
commPlist
,
cam
.
toJSON
(),
camPlist
);
return
_
.
extend
(
serialComm
.
toJSON
(),
commPlist
,
cam
.
toJSON
(),
camPlist
,
{
nextLine
:
this
.
nextLine
}
);
},
_render
:
function
(){
...
...
js/menus/templates/SendMenuView.html
View file @
e662a877
...
...
@@ -10,7 +10,7 @@
<
%
}
%
>
<br/>
<a
href=
"#"
id=
"openSerialMonitor"
class=
"btn btn-block btn-lg btn-default"
>
Open Serial Monitor
</a><br/>
Next Line:
<input
id=
"nextLine"
value=
""
placeholder=
"##"
class=
"intInput form-control unresponsiveInput"
type=
"text"
>
Next Line:
<input
id=
"nextLine"
value=
<%=
nextLine
%
>
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/>
...
...
js/models/SerialComm.js
View file @
e662a877
...
...
@@ -92,7 +92,6 @@ define(['underscore', 'backbone', 'socketio', 'machineState'], function(_, Backb
socket
.
on
(
'
connected
'
,
function
(
data
){
serialComm
.
set
(
"
connected
"
,
true
,
{
silent
:
true
});
console
.
log
(
data
);
_
.
each
(
_
.
keys
(
data
),
function
(
key
){
if
(
data
[
key
]
!==
null
)
serialComm
.
set
(
key
,
data
[
key
]);
});
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment