summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--details.js40
-rw-r--r--finalmodsheet.xsl34
-rw-r--r--index.html68
-rw-r--r--jquery/farbtastic.js2
-rw-r--r--setup.js2
5 files changed, 91 insertions, 55 deletions
diff --git a/details.js b/details.js
index 034325c..05aa080 100644
--- a/details.js
+++ b/details.js
@@ -90,10 +90,10 @@ function scicos_graphics() {
this.id = options.id || new ScilabString([""]);
this.in_implicit = options.in_implicit || new ScilabDouble();
this.out_implicit = options.out_implicit || new ScilabDouble(); // There is only one!
- this.in_style = options.in_style || new ScilabString();
- this.out_style = options.out_style || new ScilabString();
- this.in_label = options.in_label || new ScilabString();
- this.out_label = options.out_label || new ScilabString();
+ this.in_style = options.in_style || new ScilabDouble();
+ this.out_style = options.out_style || new ScilabDouble();
+ this.in_label = options.in_label || new ScilabDouble();
+ this.out_label = options.out_label || new ScilabDouble();
this.style = options.style || new ScilabString();
return mlist(graphics_type, this.graphics, this.orig, this.sz, this.flip, this.theta, this.exprs, this.pin, this.pout, this.pein, this.peout, this.gr_i, this.id, this.in_implicit, this.out_implicit, this.in_style, this.out_style, this.in_label, this.out_label, this.style);
@@ -270,7 +270,7 @@ function ScilabDouble() {
for (i = 0; i < this.height; i++) {
for (j = 0; j < this.width; j++) {
this["data" + i + j] = new data();
- this["data" + i + j].realPart = array[i][j];
+ this["data" + i + j].realPart = array[i][j].toFixed(1);
this["data" + i + j].line = i;
this["data" + i + j].column = j;
}
@@ -818,47 +818,47 @@ function BasicBlock() {
if (options.model.sim instanceof Array) {
this.simulationFunctionName = getData(options.model.sim[0])[0];
var func_type;
- switch (getData(options.model.sim[1])[0]) {
- case -2:
+ switch (getData(options.model.sim[1])[0].toString()) {
+ case "-2.0":
func_type = "ESELECT";
break;
- case -1:
+ case "-1.0":
func_type = "IFTHENELSE";
break;
- case 1:
+ case "1.0":
func_type = "TYPE_1";
break;
- case 2:
+ case "2.0":
func_type = "TYPE_2";
break;
- case 3:
+ case "3.0":
func_type = "TYPE_3";
break;
- case 4:
+ case "4.0":
func_type = "C_OR_FORTRAN";
break;
- case 5:
+ case "5.0":
func_type = "SCILAB";
break;
- case 99:
+ case "99.0":
func_type = "DEBUG";
break;
- case 1001:
+ case "1001.0":
func_type = "DYNAMIC_FORTRAN_1";
break;
- case 2001:
+ case "2001.0":
func_type = "DYNAMIC_C_1";
break;
- case 2004:
+ case "2004.0":
func_type = "DYNAMIC_EXPLICIT_4";
break;
- case 10001:
+ case "10001.0":
func_type = "OLDBLOCKS";
break;
- case 10004:
+ case "10004.0":
func_type = "IMPLICIT_C_OR_FORTRAN";
break;
- case 30004:
+ case "30004.0":
func_type = "MODELICA";
break;
}
diff --git a/finalmodsheet.xsl b/finalmodsheet.xsl
index e331a57..56e95b3 100644
--- a/finalmodsheet.xsl
+++ b/finalmodsheet.xsl
@@ -7,6 +7,7 @@ Authors: Maverick & Karma
<!--
NOTES:
Look for TAG:Break1!!!
+ TAG:Break2!!!
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no" />
@@ -183,17 +184,23 @@ Look for TAG:Break1!!!
<xsl:value-of select="@scilabClass" />
</xsl:attribute>
</xsl:if>
- <xsl:if test="@varName">
+ <!-- <xsl:if test="@varName">
<xsl:attribute name="varName">
<xsl:value-of select="@varName" />
</xsl:attribute>
- </xsl:if>
+ </xsl:if> -->
<xsl:apply-templates />
</xsl:element>
</xsl:template>
+
+ <!-- Maverick -->
+ <!-- TAG:Break2
+ The template handles the 'as' attribute rather loosely and demands
+ proper handling.
+ -->
<xsl:template name="Array" match="Array">
<xsl:element name="Array">
- <xsl:if test="name(..)='BasicBlock'">
+ <xsl:if test="name(..)='BasicBlock' or @as='context'">
<xsl:if test="@as">
<xsl:attribute name="as">
<xsl:value-of select="@as" />
@@ -1685,11 +1692,12 @@ Look for TAG:Break1!!!
<xsl:value-of select="@style" />
</xsl:attribute>
</xsl:if>
- <xsl:if test="@value">
+ <!-- <xsl:if test="@value">
<xsl:attribute name="value">
<xsl:value-of select="@value" />
</xsl:attribute>
- </xsl:if>
+ </xsl:if> -->
+
<xsl:if test="@visbile">
<xsl:attribute name="visbile">
<xsl:value-of select="@visbile" />
@@ -1792,11 +1800,11 @@ Look for TAG:Break1!!!
<xsl:value-of select="@style" />
</xsl:attribute>
</xsl:if>
- <xsl:if test="@value">
+ <!-- <xsl:if test="@value">
<xsl:attribute name="value">
<xsl:value-of select="@value" />
</xsl:attribute>
- </xsl:if>
+ </xsl:if> -->
<xsl:if test="@visible">
<xsl:attribute name="visible">
<xsl:value-of select="@visible" />
@@ -1864,11 +1872,11 @@ Look for TAG:Break1!!!
<xsl:value-of select="@style" />
</xsl:attribute>
</xsl:if>
- <xsl:if test="@value">
+ <!-- <xsl:if test="@value">
<xsl:attribute name="value">
<xsl:value-of select="@value" />
</xsl:attribute>
- </xsl:if>
+ </xsl:if> -->
<xsl:if test="@visible">
<xsl:attribute name="visible">
<xsl:value-of select="@visible" />
@@ -1936,11 +1944,11 @@ Look for TAG:Break1!!!
<xsl:value-of select="@style" />
</xsl:attribute>
</xsl:if>
- <xsl:if test="@value">
+ <!-- <xsl:if test="@value">
<xsl:attribute name="value">
<xsl:value-of select="@value" />
</xsl:attribute>
- </xsl:if>
+ </xsl:if> -->
<xsl:if test="@visible">
<xsl:attribute name="visible">
<xsl:value-of select="@visible" />
@@ -2008,11 +2016,11 @@ Look for TAG:Break1!!!
<xsl:value-of select="@style" />
</xsl:attribute>
</xsl:if>
- <xsl:if test="@value">
+ <!-- <xsl:if test="@value">
<xsl:attribute name="value">
<xsl:value-of select="@value" />
</xsl:attribute>
- </xsl:if>
+ </xsl:if> -->
<xsl:if test="@visible">
<xsl:attribute name="visible">
<xsl:value-of select="@visible" />
diff --git a/index.html b/index.html
index 6bc89f0..d9b12a6 100644
--- a/index.html
+++ b/index.html
@@ -511,13 +511,13 @@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// https://jgraph.github.io/mxgraph/docs/js-api/files/model/mxCell-js.html
// Uncomment this block to see XML tags work
- /*graph.convertValueToString = function(cell)
+ graph.convertValueToString = function(cell)
{
if (mxUtils.isNode(cell.value))
{
return cell.getAttribute('label', '');
}
- };*/
+ };
var cellLabelChanged = graph.cellLabelChanged;
graph.cellLabelChanged = function(cell, newValue, autoSize) {
@@ -825,7 +825,9 @@
var enc = new mxCodec(mxUtils.createXmlDocument());
var node = enc.encode(diagRoot);
- textarea.value = mxUtils.getPrettyXml(node);
+ var str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+mxUtils.getPrettyXml(node);
+
+ textarea.value=str;
if (arguments[2] == null) {
showModalWindow(graph, 'XML', textarea, 410, 440);
@@ -867,7 +869,9 @@
Maverick
Using resultDocument.documentElement to remove an additional tag "<#document>" created by the XSLTProcessor.
*/
- textarea.value = mxUtils.getPrettyXml(resultDocument.documentElement);
+ var str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n"+mxUtils.getPrettyXml(resultDocument.documentElement);
+
+ textarea.value=str.replace(/\n\n/g,"\n");
showModalWindow(graph, 'Xcos', textarea, 410, 440);
}
});
@@ -991,6 +995,7 @@
using this function.
*/
+
function XcosDiagram(context, model, attributes) {
this.context = context;
this.model = model;
@@ -1050,10 +1055,17 @@
btn.name = "submit";
btn.setAttribute("id", "buttonSetContext");
- var contextValue = context("get");
+ var contextValue = handleContext("get");
var displayValue = "";
- for (i in contextValue) {
+
+ /*
+ Maverick
+ Modified the for loop because only requirement was to
+ traverse the array of 'contextValue' and not all the
+ elements of it.
+ */
+ for (var i=0;i<contextValue.length;i++) {
displayValue += contextValue[i] + "\n";
}
if (contextValue != "") {
@@ -1092,7 +1104,8 @@
}
diagRoot.context = contextValues;
- context("set", contextValues);
+ diagRoot.context.scilabClass="String[]";
+ handleContext("set", contextValues);
wind.destroy();
};
@@ -1103,8 +1116,9 @@
function showPropertiesWindow(graph, cell) {
-
- var defaultProperties = {
+ var name = cell.getAttribute('blockElementName');
+ var defaultProperties = window[name]("get");
+ /*{
nbr_curves: ["Number of curves", 1],
clrs: ["color (>0) or mark (<0)", [1, 2, 3, 4, 5, 6, 7, 13]],
siz: ["line or mark size", [1, 1, 1, 1, 1, 1, 1, 1]],
@@ -1116,7 +1130,7 @@
vec_z: ["Zmin and Zmax", [-15, 15]],
param3ds: ["Alpha and Theta", [50, 280]],
N: ["Buffer size", 2]
- };
+ };*/
//var defaultProperties=window["CONST_m"]("get");
@@ -1187,6 +1201,17 @@
propertiesObject[key] = document.getElementById(key.toString()).value;
}
}
+ var details = window[name]("set",cell.value,propertiesObject);
+ var enc = new mxCodec();
+ var node = enc.encode(details);
+ node.setAttribute('label',getData(details.exprs)[0]);
+ cell.value = node;
+ /*
+ Maverick
+ We have changed the value of the cell, but the change won't be reflected
+ unless the graph is refreshed.
+ */
+ graph.refresh();
wind.destroy();
};
myform.appendChild(btn);
@@ -1601,7 +1626,7 @@
var details = ANDBLK("define");
var enc = new mxCodec(mxUtils.createXmlDocument());
var node = enc.encode(details);
- //node.setAttribute('label',label);
+ 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');
@@ -1610,7 +1635,7 @@
var details = CMSCOPE("define");
var enc = new mxCodec(mxUtils.createXmlDocument());
var node = enc.encode(details);
- //node.setAttribute('label',label);
+ 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');
@@ -1619,6 +1644,7 @@
var details = CONST_m("define");
var enc = new mxCodec(mxUtils.createXmlDocument());
var node = enc.encode(details);
+ node.setAttribute('label',"1");
var temp = enc.encode(parent);
node.setAttribute('parent', temp.getAttribute('id'));
v1 = graph.insertVertex(parent, null, node, x, y, 80, 80, 'CONST_m');
@@ -1747,7 +1773,7 @@
var details = CFSCOPE("define");
var enc = new mxCodec(mxUtils.createXmlDocument());
var node = enc.encode(details);
- //node.setAttribute('label',label);
+ 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');
@@ -1758,7 +1784,7 @@
var details = CLOCK_c("define");
var enc = new mxCodec(mxUtils.createXmlDocument());
var node = enc.encode(details);
- //node.setAttribute('label',label);
+ 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');
@@ -1974,7 +2000,7 @@
var x = 0;
var y = (i / (leftNumber + 1)).toFixed(4);
var portType = leftArray[i - 1];
- createInputPort(graph, block, x, y, portType, 'left');
+ createInputPort(graph, block, x, y, portType, 'left', i);
}
}
if (topNumber != 0) {
@@ -1982,7 +2008,7 @@
var x = (i / (topNumber + 1)).toFixed(4);
var y = 0;
var portType = topArray[i - 1];
- createInputPort(graph, block, x, y, portType, 'top');
+ createInputPort(graph, block, x, y, portType, 'top', i);
}
}
};
@@ -1995,7 +2021,7 @@
var x = 1;
var y = (i / (rightNumber + 1)).toFixed(4);
var portType = rightArray[i - 1];
- createOutputPort(graph, block, x, y, portType, 'right');
+ createOutputPort(graph, block, x, y, portType, 'right', i);
}
}
if (bottomNumber != 0) {
@@ -2003,12 +2029,12 @@
var x = (i / (bottomNumber + 1)).toFixed(4);
var y = 1;
var portType = bottomArray[i - 1];
- createOutputPort(graph, block, x, y, portType, 'bottom');
+ createOutputPort(graph, block, x, y, portType, 'bottom', i);
}
}
};
- function createInputPort(graph, block, x, y, portType, position) {
+ function createInputPort(graph, block, x, y, portType, position, ordering) {
var port = null;
if (portType == 'COMMAND') {
port = graph.insertVertex(block, null, 'CommandPort', x, y, 10, 10, 'CommandPort', true);
@@ -2025,10 +2051,11 @@
} else if (position == 'left') {
port.geometry.offset = new mxPoint(-10, -6);
}
+ port.ordering=ordering;
}
};
- function createOutputPort(graph, block, x, y, portType, position) {
+ function createOutputPort(graph, block, x, y, portType, position, ordering) {
var port = null;
if (portType == 'COMMAND') {
port = graph.insertVertex(block, null, 'CommandPort', x, y, 10, 10, 'CommandPort', true);
@@ -2046,6 +2073,7 @@
if (position == 'right') {
port.geometry.offset = new mxPoint(0, -6);
}
+ port.ordering=ordering;
}
};
diff --git a/jquery/farbtastic.js b/jquery/farbtastic.js
index d8b5ad9..8463cb7 100644
--- a/jquery/farbtastic.js
+++ b/jquery/farbtastic.js
@@ -336,7 +336,7 @@ jQuery._farbtastic = function (container, callback) {
$('*', e).mousedown(fb.mousedown);
// Init color
- fb.setColor('#000000');
+ fb.setColor('#c24747');
// Set linked elements/callback
if (callback) {
diff --git a/setup.js b/setup.js
index 74271fb..e1527fb 100644
--- a/setup.js
+++ b/setup.js
@@ -48,7 +48,7 @@ function setup() {
}
}
-function context() {
+function handleContext() {
if (arguments[0] == "get") {
return expressionArray;
} else if (arguments[0] == "set") {