@@ -40,9 +40,9 @@ | |||
<ul class="dropdown-menu"> | |||
<li><a id="btn-sidebar" tabindex="-1" href="#"><i class="icon-ok pull-right"></i><i class="icon-list-alt"></i> Sidebar</a></li> | |||
<li class="divider"></li> | |||
<li><a id="btn-node-status" tabindex="-1" href="#"><i class="icon-ok pull-right"></i><i class="icon-info-sign"></i> Node Status</a></li> | |||
<li class="divider"></li> | |||
<li class="dropdown-submenu pull-left"><a tabindex="-1" href="#"><i class="icon-edit"></i> Import from...</a> | |||
<!-- <li><a id="btn-node-status" tabindex="-1" href="#"><i class="icon-ok pull-right"></i><i class="icon-info-sign"></i> Node Status</a></li> | |||
<li class="divider"></li> --> | |||
<!--<li class="dropdown-submenu pull-left"><a tabindex="-1" href="#"><i class="icon-edit"></i> Import from...</a> | |||
<ul class="dropdown-menu"> | |||
<li><a id="btn-import" tabindex="-1" href="#"><i class="icon-edit"></i> Clipboard...</a></li> | |||
<li id="flow-menu-parent" class="dropdown-submenu pull-left"> | |||
@@ -57,10 +57,10 @@ | |||
<li id="li-menu-export-library" class="disabled"><a id="btn-export-library" tabindex="-1" href="#"><i class="icon-book"></i> Library...</a></li> | |||
</ul> | |||
</li> | |||
<li class="divider"></li> | |||
<li><a id="btn-config-nodes" tabindex="-1" href="#"><i class="icon-th-list"></i> Configuration nodes...</a></li> | |||
<li class="divider"></li> | |||
<li class="dropdown-submenu pull-left"><a tabindex="-1" href="#"><i class="icon-th-large"></i> Workspaces</a> | |||
<li class="divider"></li>--> | |||
<!-- <li><a id="btn-config-nodes" tabindex="-1" href="#"><i class="icon-th-list"></i> Configuration nodes...</a></li> | |||
<li class="divider"></li>--> | |||
<!--<li class="dropdown-submenu pull-left"><a tabindex="-1" href="#"><i class="icon-th-large"></i> Workspaces</a> | |||
<ul id="workspace-menu-list" class="dropdown-menu"> | |||
<li><a id="btn-workspace-add" tabindex="-1" href="#"><i class="icon-plus"></i> Add</a></li> | |||
<li><a id="btn-workspace-edit" tabindex="-1" href="#"><i class="icon-edit"></i> Rename</a></li> | |||
@@ -68,13 +68,13 @@ | |||
<li class="divider"></li> | |||
</ul> | |||
</li> | |||
<li class="divider"></li> | |||
<li class="divider"></li>--> | |||
<li><a id="btn-keyboard-shortcuts" tabindex="-1" href="#"><i class="icon-question-sign"></i> Keyboard Shortcuts</a></li> | |||
<li><a id="btn-help" tabindex="-1" href="http://node-red.github.io/docs" target="_blank"><i class="icon-question-sign"></i> Help...</a></li> | |||
</ul> | |||
</div> | |||
<div class="btn-group pull-right"> | |||
<a id="btn-deploy" class="btn action-deploy disabled" href="#"><i id="btn-icn-deploy" class="icon-upload"></i> Deploy</a> | |||
<div class="btn-group pull-left"> | |||
<a id="btn-deploy" class="btn action-deploy disabled" href="#"><i id="btn-icn-deploy" class="icon-upload"></i>Export</a> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -91,7 +91,7 @@ | |||
<div id="workspace"> | |||
<ul id="workspace-tabs"></ul> | |||
<div id="workspace-add-tab"><a id="btn-workspace-add-tab" href="#"><i class="icon-plus"></i></a></div> | |||
<!--<div id="workspace-add-tab"><a id="btn-workspace-add-tab" href="#"><i class="icon-plus"></i></a></div>--> | |||
<div id="chart"></div> | |||
<div id="workspace-toolbar"> | |||
<div class="btn-group"> |
@@ -78,9 +78,9 @@ var RED = (function() { | |||
// sort by horizontal position, plus slight vertical position, | |||
// for well defined update order that follows signal flow | |||
nns.sort(function(a,b){ return (a.x + a.y/250) - (b.x + b.y/250); }); | |||
console.log(JSON.stringify(nns)); | |||
//console.log(JSON.stringify(nns)); | |||
var cpp = ""; | |||
var cpp = "// GUItool: begin automatically generated code\n"; | |||
// generate code for all audio processing nodes | |||
for (var i=0; i<nns.length; i++) { | |||
var n = nns[i]; | |||
@@ -92,7 +92,6 @@ var RED = (function() { | |||
for (var j=n.id.length; j<14; j++) cpp += " "; | |||
cpp += "//xy=" + n.x + "," + n.y + "\n"; | |||
} | |||
//console.log("save: node " + n.id + " " + node.outputs); | |||
} | |||
// generate code for all connections (aka wires or links) | |||
var cordcount = 1; | |||
@@ -107,11 +106,9 @@ var RED = (function() { | |||
if (wire) { | |||
var parts = wire.split(":"); | |||
if (parts.length == 2) { | |||
//console.log("save: wire " + n.id + ":" + j + " " + parts[0] + "-" + parts[1]); | |||
cpp += "AudioConnection patchCord" + cordcount + "("; | |||
var src = RED.nodes.node(n.id); | |||
var dst = RED.nodes.node(parts[0]); | |||
//console.log("save: src.outputs=" + src.outputs + ", dst._def.inputs=" + dst._def.inputs); | |||
if (j == 0 && parts[1] == 0 && src && src.outputs == 1 && dst && dst._def.inputs == 1) { | |||
cpp += n.id + ", " + parts[0]; | |||
} else { | |||
@@ -137,9 +134,25 @@ var RED = (function() { | |||
cpp += "//xy=" + n.x + "," + n.y + "\n"; | |||
} | |||
} | |||
cpp += "// GUItool: end automatically generated code\n"; | |||
//console.log(cpp); | |||
console.log(cpp); | |||
RED.view.state(RED.state.EXPORT); | |||
//mouse_mode = RED.state.EXPORT; | |||
$("#dialog-form").html($("script[data-template-name='export-clipboard-dialog']").html()); | |||
$("#node-input-export").val(cpp); | |||
$("#node-input-export").focus(function() { | |||
var textarea = $(this); | |||
textarea.select(); | |||
textarea.mouseup(function() { | |||
textarea.unbind("mouseup"); | |||
return false; | |||
}); | |||
}); | |||
$( "#dialog" ).dialog("option","title","Export nodes to clipboard").dialog( "open" ); | |||
$("#node-input-export").focus(); | |||
/* | |||
$("#btn-icn-deploy").removeClass('icon-upload'); | |||
$("#btn-icn-deploy").addClass('spinner'); | |||
RED.view.dirty(false); | |||
@@ -179,6 +192,7 @@ var RED = (function() { | |||
$("#btn-icn-deploy").removeClass('spinner'); | |||
$("#btn-icn-deploy").addClass('icon-upload'); | |||
}); | |||
*/ | |||
} | |||
} | |||