summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPooja Soundalgekar2016-06-14 15:34:40 +0530
committerPooja Soundalgekar2016-06-14 15:34:40 +0530
commit3d576faafc9acd20b06055081da0b52da2c1e943 (patch)
treecd6e702c06b10e3decc63c22098a4620893bdf36
parentf3c1898f50a719ad07ff2e93035a7f5a59c73058 (diff)
downloadxcos-on-web-3d576faafc9acd20b06055081da0b52da2c1e943.tar.gz
xcos-on-web-3d576faafc9acd20b06055081da0b52da2c1e943.tar.bz2
xcos-on-web-3d576faafc9acd20b06055081da0b52da2c1e943.zip
Minor changes
-rw-r--r--details.js164
-rw-r--r--index.html169
2 files changed, 170 insertions, 163 deletions
diff --git a/details.js b/details.js
index 149031a..b7c2781 100644
--- a/details.js
+++ b/details.js
@@ -289,13 +289,11 @@ function getData() {
var dataObject = arguments[0];
var key;
var dataArray = [];
- for( key in dataObject ) {
- if(key != "height" && key != "width")
- {
- if( typeof dataObject[key].value === "undefined" ) {
+ for (key in dataObject) {
+ if (key != "height" && key != "width") {
+ if (typeof dataObject[key].value === "undefined") {
dataArray.push(dataObject[key].realPart);
- }
- else {
+ } else {
dataArray.push(dataObject[key].value);
}
}
@@ -538,6 +536,8 @@ function CFSCOPE() {
this.x = new standard_define(new ScilabDouble([80, 80]), model, exprs, gr_i); // 2 -> 80
this.x.graphics.style = new ScilabString(["CFSCOPE"]);
return new BasicBlock(this.x);
+ case "details":
+ return this.x;
}
}
@@ -600,82 +600,89 @@ function CMSCOPE() {
this.x = new standard_define(new ScilabDouble([80, 80]), model, exprs, gr_i); // 2 -> 80
this.x.graphics.style = new ScilabString(["CMSCOPE"]);
return new BasicBlock(this.x);
+ case "details":
+ return this.x;
}
}
function CLOCK_c() {
- var evtdly = EVTDLY_c("define");
- evtdly.graphics.orig = new ScilabDouble([320, 232]);
- evtdly.graphics.sz = new ScilabDouble([40, 40]);
- evtdly.graphics.flip = new ScilabBoolean([true]);
- evtdly.graphics.exprs = new ScilabString(["0.1"], ["0.1"]);
- evtdly.graphics.pein = new ScilabDouble([6]);
- evtdly.graphics.peout = new ScilabDouble([3]);
- evtdly.model.rpar = new ScilabDouble([0.1], [0.1]);
- evtdly.model.firing = new ScilabDouble([0.1]);
-
- evtdly.model.uid = new ScilabString([count]); // changed
- evtdly.doc = list(new ScilabString([count++]));
- evtdly.model.evtin = new ScilabDouble([-1]);
- evtdly.model.evtout = new ScilabDouble([-1]);
- evtdly.graphics.peout = new ScilabDouble([4]);
-
- var output_port = CLKOUT_f("define");
- output_port.graphics.orig = new ScilabDouble([399, 162]);
- output_port.graphics.sz = new ScilabDouble([20, 20]);
- output_port.graphics.flip = new ScilabBoolean([true]);
- output_port.graphics.exprs = new ScilabString(["1"]);
- output_port.graphics.pein = new ScilabDouble([5]);
- output_port.model.ipar = new ScilabDouble([1]);
-
- output_port.model.uid = new ScilabString([count]); // changed
- output_port.doc = list(new ScilabString([count++]));
-
- var split = CLKSPLIT_f("define");
- split.graphics.orig = new ScilabDouble([380.71066, 172]);
- split.graphics.pein = new ScilabDouble([3]);
- split.graphics.peout = new ScilabDouble([5], [6]);
- split.model.uid = new ScilabString([count]);
- split.doc = list(new ScilabString([count++]));
- split.graphics.pein = new ScilabDouble([4]); // changed
-
- var diagram = scicos_diagram();
- diagram.objs.push(output_port);
- diagram.objs.push(evtdly);
- diagram.objs.push(split);
- diagram.objs.push(scicos_link({
- xx: new ScilabDouble([340], [340], [380.71]),
- yy: new ScilabDouble([226.29], [172], [172]),
- ct: new ScilabDouble([5, -1]),
- from: new ScilabDouble([2, 1, 0]),
- to: new ScilabDouble([3, 1, 1])
- }));
- diagram.objs.push(scicos_link({
- xx: new ScilabDouble([380.71], [399]),
- yy: new ScilabDouble([172], [172]),
- ct: new ScilabDouble([5, -1]),
- from: new ScilabDouble([3, 1, 0]),
- to: new ScilabDouble([1, 1, 1])
- }));
- diagram.objs.push(scicos_link({
- xx: new ScilabDouble([380.71], [380.71], [340], [340]),
- yy: new ScilabDouble([172], [302], [302], [277.71]),
- ct: new ScilabDouble([5, -1]),
- from: new ScilabDouble([3, 2, 0]),
- to: new ScilabDouble([2, 1, 1])
- }));
- var x = scicos_block();
- this.x.gui = new ScilabString(["CLOCK_c"]);
- this.x.graphics.sz = new ScilabDouble([2, 2]);
- this.x.graphics.gr_i = new ScilabString([]);
- this.x.graphics.peout = new ScilabDouble([0]);
- this.x.model.sim = new ScilabString(["csuper"]);
- this.x.model.evtout = new ScilabDouble([1]);
- this.x.model.blocktype = new ScilabString(["h"]);
- this.x.model.firing = new ScilabBoolean([false]);
- this.x.model.dep_ut = new ScilabBoolean([false, false]);
- this.x.model.rpar = diagram;
- return new BasicBlock(this.x);
+ switch (arguments[0]) {
+ case "define":
+ var evtdly = EVTDLY_c("define");
+ evtdly.graphics.orig = new ScilabDouble([320, 232]);
+ evtdly.graphics.sz = new ScilabDouble([40, 40]);
+ evtdly.graphics.flip = new ScilabBoolean([true]);
+ evtdly.graphics.exprs = new ScilabString(["0.1"], ["0.1"]);
+ evtdly.graphics.pein = new ScilabDouble([6]);
+ evtdly.graphics.peout = new ScilabDouble([3]);
+ evtdly.model.rpar = new ScilabDouble([0.1], [0.1]);
+ evtdly.model.firing = new ScilabDouble([0.1]);
+
+ evtdly.model.uid = new ScilabString([count]); // changed
+ evtdly.doc = list(new ScilabString([count++]));
+ evtdly.model.evtin = new ScilabDouble([-1]);
+ evtdly.model.evtout = new ScilabDouble([-1]);
+ evtdly.graphics.peout = new ScilabDouble([4]);
+
+ var output_port = CLKOUT_f("define");
+ output_port.graphics.orig = new ScilabDouble([399, 162]);
+ output_port.graphics.sz = new ScilabDouble([20, 20]);
+ output_port.graphics.flip = new ScilabBoolean([true]);
+ output_port.graphics.exprs = new ScilabString(["1"]);
+ output_port.graphics.pein = new ScilabDouble([5]);
+ output_port.model.ipar = new ScilabDouble([1]);
+
+ output_port.model.uid = new ScilabString([count]); // changed
+ output_port.doc = list(new ScilabString([count++]));
+
+ var split = CLKSPLIT_f("define");
+ split.graphics.orig = new ScilabDouble([380.71066, 172]);
+ split.graphics.pein = new ScilabDouble([3]);
+ split.graphics.peout = new ScilabDouble([5], [6]);
+ split.model.uid = new ScilabString([count]);
+ split.doc = list(new ScilabString([count++]));
+ split.graphics.pein = new ScilabDouble([4]); // changed
+
+ var diagram = scicos_diagram();
+ diagram.objs.push(output_port);
+ diagram.objs.push(evtdly);
+ diagram.objs.push(split);
+ diagram.objs.push(scicos_link({
+ xx: new ScilabDouble([340], [340], [380.71]),
+ yy: new ScilabDouble([226.29], [172], [172]),
+ ct: new ScilabDouble([5, -1]),
+ from: new ScilabDouble([2, 1, 0]),
+ to: new ScilabDouble([3, 1, 1])
+ }));
+ diagram.objs.push(scicos_link({
+ xx: new ScilabDouble([380.71], [399]),
+ yy: new ScilabDouble([172], [172]),
+ ct: new ScilabDouble([5, -1]),
+ from: new ScilabDouble([3, 1, 0]),
+ to: new ScilabDouble([1, 1, 1])
+ }));
+ diagram.objs.push(scicos_link({
+ xx: new ScilabDouble([380.71], [380.71], [340], [340]),
+ yy: new ScilabDouble([172], [302], [302], [277.71]),
+ ct: new ScilabDouble([5, -1]),
+ from: new ScilabDouble([3, 2, 0]),
+ to: new ScilabDouble([2, 1, 1])
+ }));
+ this.x = scicos_block();
+ this.x.gui = new ScilabString(["CLOCK_c"]);
+ this.x.graphics.sz = new ScilabDouble([2, 2]);
+ this.x.graphics.gr_i = new ScilabString([]);
+ this.x.graphics.peout = new ScilabDouble([0]);
+ this.x.model.sim = new ScilabString(["csuper"]);
+ this.x.model.evtout = new ScilabDouble([1]);
+ this.x.model.blocktype = new ScilabString(["h"]);
+ this.x.model.firing = new ScilabBoolean([false]);
+ this.x.model.dep_ut = new ScilabBoolean([false, false]);
+ this.x.model.rpar = diagram;
+ return new BasicBlock(this.x);
+ case "details":
+ return this.x;
+ }
}
function EVTDLY_c() {
@@ -921,3 +928,4 @@ function zeros(n) {
return port;
}
+
diff --git a/index.html b/index.html
index 7630567..388b4ec 100644
--- a/index.html
+++ b/index.html
@@ -8,11 +8,11 @@
BODY {
font-family: Arial;
}
-
+
H1 {
font-size: 18px;
}
-
+
H2 {
font-size: 16px;
}
@@ -107,8 +107,8 @@
/*
@jiteshjha, @pooja
- Overrides mxGraphModel.getStyle to return a specific style
- for edges that reflects their target terminal.
+ Overrides mxGraphModel.getStyle to return a specific style
+ for edges that reflects their target terminal.
*/
graph.model.getStyle = function(cell) {
@@ -130,8 +130,8 @@
*/
var cellSource = cell.source;
- while(cellSource.isEdge() == true) {
- cellSource = cellSource.source;
+ while (cellSource.isEdge() == true) {
+ cellSource = cellSource.source;
}
if (cellSource.value == "ExplicitOutputPort" || cellSource.value == "ExplicitInputPort") {
style += ';' + 'ExplicitLink';
@@ -437,11 +437,10 @@
graph.getTooltipForCell = function(cell) {
var text = null;
- if(cell.isVertex() == true && cell.isConnectable() == false) {
- var name = cell.value.getAttribute('blockElementName');
+ if (cell.isVertex() == true && cell.isConnectable() == false) {
+ var name = cell.value.getAttribute('blockElementName');
var cellvar = window[name]('details');
// If cell is a block or port
-
if (cell.source == null && cell.target == null) {
if (cell.connectable) { // Cell is a port
// @ToDo: Port Number
@@ -450,14 +449,14 @@
// @ToDo: Block Name, Simulation, Flip, Mirror
// @ToDo: Number of Input, Output, Control, Command Ports
var inputport, outputport, controlport, commandport;
- if (cellvar.model.in.width == null)
+ if (cellvar.model.in.height == null)
inputport = 0;
else
- inputport = cellvar.model.in.width;
- if (cellvar.model.out.width == null)
+ inputport = cellvar.model.in.height;
+ if (cellvar.model.out.height == null)
outputport = 0;
else
- outputport = cellvar.model.out.width;
+ outputport = cellvar.model.out.height;
if (cellvar.model.evtin.width == null)
controlport = 0;
else
@@ -483,8 +482,9 @@
'h : ' + geometry.height + "\n";
}
}
- return text;
+
}
+ return text;
};
@@ -544,8 +544,8 @@
/*
- @pooja, @jiteshjha
- Create a custom rotate action for a selected cell.
+ @pooja, @jiteshjha
+ Create a custom rotate action for a selected cell.
*/
editor.addAction('rotateCustom', function(editor, cell) {
selectedCell = graph.getSelectionCell();
@@ -772,7 +772,7 @@
Maverick
This method is used for loading the stylesheet from the file.
Reference: http://www.w3schools.com/xsl/xsl_client.asp
- */
+ */
function loadXMLDoc(filename) {
if (window.ActiveXObject) {
@@ -790,13 +790,13 @@
/*
- Maverick
+ Maverick
The Export buttons in toolbar call this function with varying
arguments.
The third argument is used to decide which button is being
pressed.
- exportXML : 2 arguments
- exportXcos: 3 arguments
+ exportXML : 2 arguments
+ exportXcos: 3 arguments
*/
function displayXMLorXcos() {
var textarea = document.createElement('textarea');
@@ -1020,7 +1020,7 @@
// Executes when button 'btn' is clicked
btn.onclick = function() {
- console.log('Input: '+document.getElementById('textareaSetContext').value);
+ console.log('Input: ' + document.getElementById('textareaSetContext').value);
};
myform.appendChild(btn);
@@ -1152,16 +1152,16 @@
tm_tolerance: ["Tolerance on time", 1.0E-10],
integ_time_interval: ["Output window sizes", 1.00001E05],
solv_kind: ["Solver Kind", ["LSodar", "Sundials/CVODE - BDF - NEWTON",
- "Sundials/CVODE - BDF - FUNCTIONAL",
- "Sundials/CVODE - ADAMS - NEWTON",
- "Sundials/CVODE - ADAMS - FUNCTIONAL",
- "DOPRI5 - Dormand-Prince 4(5)",
- "RK45 - Runge-Kutta 4(5)",
- "Implicit RK45 - Implicit Runge-Kutta 4(5)",
- "CRANI - Crank-Nicolson 2(3)",
- "Sundials/IDA",
- "DDaskr - Newton",
- "DDaskr - GMRes"
+ "Sundials/CVODE - BDF - FUNCTIONAL",
+ "Sundials/CVODE - ADAMS - NEWTON",
+ "Sundials/CVODE - ADAMS - FUNCTIONAL",
+ "DOPRI5 - Dormand-Prince 4(5)",
+ "RK45 - Runge-Kutta 4(5)",
+ "Implicit RK45 - Implicit Runge-Kutta 4(5)",
+ "CRANI - Crank-Nicolson 2(3)",
+ "Sundials/IDA",
+ "DDaskr - Newton",
+ "DDaskr - GMRes"
]],
max_step_sze: ["Maximum step size(0 means no limit)", 0.0E00]
};
@@ -1194,32 +1194,31 @@
namelabel.innerHTML = defaultProperties[key][0];
myform.appendChild(namelabel);
- if(key == "solv_kind") {
+ if (key == "solv_kind") {
- //Here we create a "select" element (a drop down list).
- var newList = document.createElement("select");
- newList.style.cssText = "float:right";
- newList.setAttribute("id", key.toString());
- var dropdownItems = defaultProperties[key][1];
+ //Here we create a "select" element (a drop down list).
+ var newList = document.createElement("select");
+ newList.style.cssText = "float:right";
+ newList.setAttribute("id", key.toString());
+ var dropdownItems = defaultProperties[key][1];
- // Iterate over the dropdown options and create html elements
- dropdownItems.forEach(function (value, i) {
- option = document.createElement('option');
- option.value = i.toFixed(1);
- option.text = value;
- newList.appendChild(option);
- });
+ // Iterate over the dropdown options and create html elements
+ dropdownItems.forEach(function(value, i) {
+ option = document.createElement('option');
+ option.value = i.toFixed(1);
+ option.text = value;
+ newList.appendChild(option);
+ });
- myform.appendChild(newList);
+ myform.appendChild(newList);
- }
- else {
- var input = document.createElement("input");
- input.name = key;
- input.value = defaultProperties[key][1];
- input.setAttribute("id", key.toString());
- input.setAttribute("class", "fieldInput");
- myform.appendChild(input);
+ } else {
+ var input = document.createElement("input");
+ input.name = key;
+ input.value = defaultProperties[key][1];
+ input.setAttribute("id", key.toString());
+ input.setAttribute("class", "fieldInput");
+ myform.appendChild(input);
}
// Line break
@@ -1269,7 +1268,7 @@
for (var key in defaultProperties) {
if (defaultProperties.hasOwnProperty(key)) {
- propertiesObject[key] = document.getElementById(key.toString()).value;
+ propertiesObject[key] = document.getElementById(key.toString()).value;
}
}
console.log(propertiesObject);
@@ -1513,25 +1512,25 @@
var enc = new mxCodec(mxUtils.createXmlDocument());
var node = enc.encode(details);
//node.setAttribute('label',label);
- var temp=enc.encode(parent);
- node.setAttribute('parent',temp.getAttribute('id'));
+ var temp = enc.encode(parent);
+ node.setAttribute('parent', temp.getAttribute('id'));
v1 = graph.insertVertex(parent, null, node, x, y, 80, 80, 'ANDBLK');
createPorts(graph, v1, [], ['CONTROL', 'CONTROL'], [], ['COMMAND']);
} else if (name == 'CMSCOPE') {
- var details = CMSCOPE("define");
- var enc = new mxCodec(mxUtils.createXmlDocument());
- var node = enc.encode(details);
- //node.setAttribute('label',label);
- var temp=enc.encode(parent);
- node.setAttribute('parent',temp.getAttribute('id'));
- v1 = graph.insertVertex(parent, null, label, x, y, 80, 80, 'CMSCOPE');
+ var details = CMSCOPE("define");
+ var enc = new mxCodec(mxUtils.createXmlDocument());
+ var node = enc.encode(details);
+ //node.setAttribute('label',label);
+ var temp = enc.encode(parent);
+ node.setAttribute('parent', temp.getAttribute('id'));
+ v1 = graph.insertVertex(parent, null, node, x, y, 80, 80, 'CMSCOPE');
createPorts(graph, v1, ['EXPLICIT', 'EXPLICIT'], ['CONTROL'], [], []);
} else if (name == 'CONST_m') {
var details = CONST_m("define");
var enc = new mxCodec(mxUtils.createXmlDocument());
var node = enc.encode(details);
- var temp=enc.encode(parent);
- node.setAttribute('parent',temp.getAttribute('id'));
+ var temp = enc.encode(parent);
+ node.setAttribute('parent', temp.getAttribute('id'));
v1 = graph.insertVertex(parent, null, node, x, y, 80, 80, 'CONST_m');
createPorts(graph, v1, [], [], ['EXPLICIT'], []);
} else if (name == 'CONVERT') {
@@ -1659,24 +1658,24 @@
createPorts(graph, v1, ['EXPLICIT'], ['CONTROL'], ['EXPLICIT'], []);
} else if (name == 'CFSCOPE') {
var details = CFSCOPE("define");
- var enc = new mxCodec(mxUtils.createXmlDocument());
- var node = enc.encode(details);
- //node.setAttribute('label',label);
- var temp=enc.encode(parent);
- node.setAttribute('parent',temp.getAttribute('id'));
+ var enc = new mxCodec(mxUtils.createXmlDocument());
+ var node = enc.encode(details);
+ //node.setAttribute('label',label);
+ var temp = enc.encode(parent);
+ node.setAttribute('parent', temp.getAttribute('id'));
v1 = graph.insertVertex(parent, null, node, x, y, 80, 80, 'ANDBLK');
createPorts(graph, v1, [], ['CONTROL'], [], []);
}
-
+
// EVENTS
else if (name == 'CLOCK_c') {
- var details = CLOCK_c("define");
- var enc = new mxCodec(mxUtils.createXmlDocument());
- var node = enc.encode(details);
- //node.setAttribute('label',label);
- var temp=enc.encode(parent);
- node.setAttribute('parent',temp.getAttribute('id'));
- v1 = graph.insertVertex(parent, null, label, x, y, 80, 80, 'CLOCK_c');
+ var details = CLOCK_c("define");
+ var enc = new mxCodec(mxUtils.createXmlDocument());
+ var node = enc.encode(details);
+ //node.setAttribute('label',label);
+ var temp = enc.encode(parent);
+ node.setAttribute('parent', temp.getAttribute('id'));
+ v1 = graph.insertVertex(parent, null, node, x, y, 80, 80, 'CLOCK_c');
createPorts(graph, v1, [], [], [], ['COMMAND']);
} else if (name == 'SampleCLK') {
v1 = graph.insertVertex(parent, null, label, x, y, 80, 80, 'SampleCLK');
@@ -1977,7 +1976,7 @@
};
</script>
<!--
- Updates connection points before the routing is called.
+ Updates connection points before the routing is called.
-->
<script type="text/javascript">
// Computes the position of edge to edge connection points.
@@ -2150,7 +2149,7 @@
};
</script>
<!--
- Adds in-place highlighting for complete cell area (no hotspot).
+ Adds in-place highlighting for complete cell area (no hotspot).
-->
<script type="text/javascript">
mxConnectionHandlerCreateMarker = mxConnectionHandler.prototype.createMarker;
@@ -2176,7 +2175,7 @@
}
</script>
<!--
- Implements a perpendicular wires connection edge style
+ Implements a perpendicular wires connection edge style
-->
<script type="text/javascript">
mxEdgeStyle.WireConnector = function(state, source, target, hints, result) {
@@ -2272,10 +2271,10 @@
<!-- Page passes the container for the graph to the program -->
<body onload="main(document.getElementById('graphContainer'),
- document.getElementById('outlineContainer'),
- document.getElementById('toolbarContainer'),
- document.getElementById('sidebarContainer'),
- document.getElementById('statusContainer'));" style="margin:0px;">
+ document.getElementById('outlineContainer'),
+ document.getElementById('toolbarContainer'),
+ document.getElementById('sidebarContainer'),
+ document.getElementById('statusContainer'));" style="margin:0px;">
<!-- Creates a container for the splash screen -->
<div id="splash" style="position:absolute;top:0px;left:0px;width:100%;height:100%;background:white;z-index:1;">