summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAMIT KUMAR YADAV2016-06-18 15:12:13 +0530
committerAMIT KUMAR YADAV2016-06-18 15:12:13 +0530
commit120a9524148c1c5795c662e1309860ec716befd0 (patch)
treea1047ab2078ba07b28517d5700e1f20cbb5c0661
parentc6d924032bd9fa4e4517a368a4c5e15f5ad1a98c (diff)
parent6dc05aec13c6c3c7081b3a03656a15401c97a88f (diff)
downloadxcos-on-web-120a9524148c1c5795c662e1309860ec716befd0.tar.gz
xcos-on-web-120a9524148c1c5795c662e1309860ec716befd0.tar.bz2
xcos-on-web-120a9524148c1c5795c662e1309860ec716befd0.zip
Merge remote-tracking branch 'upstream/master'
-rw-r--r--css/common.css23
-rw-r--r--details.js49
-rw-r--r--finalmodsheet.xsl97
-rw-r--r--index.html796
-rw-r--r--jquery/farbtastic.js2
-rw-r--r--setup.js2
-rw-r--r--styles/Xcos-style.xml8
7 files changed, 536 insertions, 441 deletions
diff --git a/css/common.css b/css/common.css
index 5300635..82f5e94 100644
--- a/css/common.css
+++ b/css/common.css
@@ -1,3 +1,14 @@
+body {
+ font-family: Arial;
+}
+
+h1 {
+ font-size: 18px;
+}
+
+h2 {
+ font-size: 16px;
+}
div.mxRubberband {
position: absolute;
overflow: hidden;
@@ -196,3 +207,15 @@ td.mxPopupMenuIcon {
margin-left: 160px;
width: 50px;
}
+
+.boldButton {
+ font-weight: bold;
+}
+
+.italicButton {
+ font-style: italic;
+}
+
+.underlineButton {
+ text-decoration: underline;
+}
diff --git a/details.js b/details.js
index acc2dd0..8c54590 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;
}
@@ -301,6 +301,15 @@ function getData() {
return dataArray;
}
+function modelica(){
+ var model=[];
+ var inputs=[];
+ var outputs=[];
+ var parameters=list([],list());
+ var mo=tlist(["modelica","model","inputs","outputs","parameters"],model,inputs,outputs,parameters);
+ return mo;
+}
+
function CONST_m() {
switch (arguments[0]) {
@@ -809,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 c64dc05..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" />
@@ -150,6 +151,19 @@ Look for TAG:Break1!!!
</xsl:otherwise>
</xsl:choose>
</xsl:when>
+ <xsl:when test="@name">
+ <xsl:choose>
+ <xsl:when test="@name='ExplicitLink'">
+ <xsl:call-template name="ExplicitLink" />
+ </xsl:when>
+ <xsl:when test="@name='ImplicitLink'">
+ <xsl:call-template name="ImplicitLink" />
+ </xsl:when>
+ <xsl:when test="@name='CommandControlLink'">
+ <xsl:call-template name="CommandControlLink" />
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
<xsl:otherwise>
<!-- Style not present -->
<xsl:copy-of select="." />
@@ -170,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" />
@@ -388,9 +408,19 @@ Look for TAG:Break1!!!
<xsl:value-of select="@id" />
</xsl:attribute>
</xsl:if>
- <xsl:if test="@style">
- <xsl:attribute name="style">
- <xsl:value-of select="@style" />
+ <xsl:if test="@parent">
+ <xsl:attribute name="parent">
+ <xsl:value-of select="@parent" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@source">
+ <xsl:attribute name="source">
+ <xsl:value-of select="@source" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@target">
+ <xsl:attribute name="target">
+ <xsl:value-of select="@target" />
</xsl:attribute>
</xsl:if>
<xsl:apply-templates />
@@ -638,14 +668,19 @@ Look for TAG:Break1!!!
<xsl:value-of select="@id" />
</xsl:attribute>
</xsl:if>
- <xsl:if test="@style">
- <xsl:attribute name="style">
- <xsl:value-of select="@style" />
+ <xsl:if test="@parent">
+ <xsl:attribute name="parent">
+ <xsl:value-of select="@parent" />
</xsl:attribute>
</xsl:if>
- <xsl:if test="@value">
- <xsl:attribute name="value">
- <xsl:value-of select="@value" />
+ <xsl:if test="@source">
+ <xsl:attribute name="source">
+ <xsl:value-of select="@source" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@target">
+ <xsl:attribute name="target">
+ <xsl:value-of select="@target" />
</xsl:attribute>
</xsl:if>
<xsl:apply-templates />
@@ -878,14 +913,19 @@ Look for TAG:Break1!!!
<xsl:value-of select="@id" />
</xsl:attribute>
</xsl:if>
- <xsl:if test="@style">
- <xsl:attribute name="style">
- <xsl:value-of select="@style" />
+ <xsl:if test="@parent">
+ <xsl:attribute name="parent">
+ <xsl:value-of select="@parent" />
</xsl:attribute>
</xsl:if>
- <xsl:if test="@value">
- <xsl:attribute name="value">
- <xsl:value-of select="@value" />
+ <xsl:if test="@source">
+ <xsl:attribute name="source">
+ <xsl:value-of select="@source" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@target">
+ <xsl:attribute name="target">
+ <xsl:value-of select="@target" />
</xsl:attribute>
</xsl:if>
<xsl:apply-templates />
@@ -1652,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" />
@@ -1759,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" />
@@ -1831,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" />
@@ -1903,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" />
@@ -1975,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..ebca018 100644
--- a/index.html
+++ b/index.html
@@ -4,19 +4,6 @@
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<title>Xcos</title>
- <style type="text/css" media="screen">
- BODY {
- font-family: Arial;
- }
-
- H1 {
- font-size: 18px;
- }
-
- H2 {
- font-size: 16px;
- }
- </style>
<!-- Loads and initializes the library -->
<script type="text/javascript" src="jquery/jquery-1.8.2.js"></script>
@@ -32,6 +19,7 @@
<script type="text/javascript" src="setup.js"></script>
<script type="text/javascript" src="json2.js"></script>
<script type="text/javascript">
+
function main(container, outline, toolbar, sidebar, status) {
// Checks if the browser is supported
if (!mxClient.isBrowserSupported()) {
@@ -122,33 +110,34 @@
graph.model.getStyle = function(cell) {
var style = null;
if (cell != null) {
-
// Get style for the recently created mxCell.
style = mxGraphModel.prototype.getStyle.apply(this, arguments);
-
// If the mxCell is an edge and if it's a fully formed edge
if (this.isEdge(cell) && cell.source != null) {
var target = this.getTerminal(cell, false);
-
if (target != null) {
-
/* cell.name attribute defines the link name
so that it can be parsed in the XML during
XSLT transformation.
*/
-
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';
+ if(style == null) {
+ style = 'ExplicitLink' + ';';
+ }
cell.name = "ExplicitLink";
} else if (cellSource.value == "ImplicitOutputPort" || cellSource.value == "ImplicitInputPort") {
- style += ';' + 'ImplicitLink';
+ if(style == null) {
+ style = 'ImplicitLink' + ';';
+ }
cell.name = "ImplicitLink";
} else if (cellSource.value == "CommandPort" || cellSource.value == "ControlPort") {
- style += ';' + 'CommandControlLink';
+ if(style == null) {
+ style = 'CommandControlLink' + ';';
+ }
cell.name = "CommandControlLink";
}
}
@@ -174,15 +163,14 @@
var edgeformat = menu.addItem('Format', null, null);
menu.addItem('Border Color', 'images/draw-brush.png', function() {
- // @ToDo: Pooja: Functionality to be put.
showColorWheel(graph, cell, 'edgeStrokeColor');
}, edgeformat);
menu.addItem('Text and Text Font', 'images/edit.png', function() {
- alert('Edit...'); // @ToDo: Pooja: Functionality to be put.
+ showTextEditWindow(graph, cell);
}, edgeformat);
menu.addItem('Text Color', 'images/edit.png', function() {
- alert('Edit...'); // @ToDo: Pooja: Functionality to be put.
+ showColorWheel(graph, cell, 'edgeTextColor');
}, edgeformat);
} else {
@@ -268,135 +256,81 @@
var config = mxUtils.load('config/keyhandler-commons.xml').getDocumentElement();
editor.configure(config);
- // @jiteshjha, @pooja
- /*
- The code creates a function that informs the undoManager of an undoable edit
- and binds it to the undo event of mxGraphModel and mxGraphView
- using mxEventSource.addListener.
- */
- var undoManager = new mxUndoManager();
- var listener = function(sender, evt) {
- undoManager.undoableEditHappened(evt.getProperty('edit'));
- };
- graph.getModel().addListener(mxEvent.UNDO, listener);
- graph.getModel().addListener(mxEvent.REDO, listener);
- graph.getView().addListener(mxEvent.UNDO, listener);
- graph.getView().addListener(mxEvent.REDO, listener);
-
- editor.addAction('undoCustom', function(editor, cell) {
- undoManager.undo();
- });
-
- editor.addAction('redoCustom', function(editor, cell) {
- undoManager.redo();
- });
/*
- For every click on the graph, check if the selected mxCell is the recently created edge,
- and then check if that edge satisfies one of the port constraints.
-
+ For a new edge on the graph, check if that edge satisfies one of the port constraints.
*/
- graph.addListener(mxEvent.CLICK, function(sender, evt) {
- var selectedEdgeObject = graph.getSelectionCell();
- if (selectedEdgeObject != null && selectedEdgeObject.isEdge() == true) {
-
- var selectedEdgeObject = graph.getSelectionCell();
- var target = selectedEdgeObject.target;
- var source;
-
- if (selectedEdgeObject != null && selectedEdgeObject.isEdge() == true) {
- function getEdgeId(edgeObject) {
- while (edgeObject.source != null && edgeObject.source.isEdge() == true) {
- edgeObject = edgeObject.source;
- }
- return edgeObject.source;
- }
+ graph.addEdge = function(edge, parent, source, target, index) {
- if (selectedEdgeObject.isEdge() == true) {
- source = getEdgeId(selectedEdgeObject);
- }
- if (source != null && target != null) {
- if (!(((source.value == "ExplicitOutputPort" && target.value == "ExplicitInputPort") ||
- (source.value == "ExplicitInputPort" && target.value == "ExplicitOutputPort") ||
- (source.value == "ImplicitOutputPort" && target.value == "ImplicitInputPort") ||
- (source.value == "ImplicitInputPort" && target.value == "ImplicitOutputPort") ||
- (source.value == "CommandPort" && target.value == "ControlPort") ||
- (source.value == "ControlPort" && target.value == "CommandPort")) &&
- (source.getEdgeCount() <= 1 && source.isVertex() == true &&
- target.getEdgeCount() <= 1 && target.isVertex() == true)
- )) {
-
- if (!(source.getEdgeCount() <= 1 && source.isVertex() == true &&
- target.getEdgeCount() <= 1 && target.isVertex() == true)) {
- alert("Port is already connected, please select an please select an unconnected port or a valid link");
- } else if (source.value == "ImplicitInputPort") {
- alert("Implicit data input port must be connected to implicit data output port");
- } else if (source.value == "ImplicitOutputPort") {
- alert("Implicit data output port must be connected to implicit data input port");
- } else if (source.value == "ExplicitOutputPort") {
- alert("Explicit data output port must be connected to explicit data input port");
- } else if (source.value == "ExplicitInputPort") {
- alert("Explicit data input port must be connected to explicit data output port");
- } else if (source.value = "ControlPort") {
- alert("Control port must be connected to command port");
- } else if (source.value = "CommandPort") {
- alert("Command port must be connected to control port");
- }
+ var edgeSource = source;
- /*
- Remove last mxEvent from the undoManager history stack,
- Store all the remaining undo mxEvents into a temporary array,
- clears the history, and readds the mxEvents into the undoManager history stack.
- */
- editor.execute('undo');
-
- // Remove the last element from the history array.
- undoManager.history.splice(-1, 1);
-
- // storage[] -> temporary array
- var storage = [];
- for (i in undoManager.history) {
- if (undoManager.history[i] != null) {
- storage.push(undoManager.history[i])
- }
- }
+ // If the source of the edge is also an edge, find the port.
+ while (edgeSource.isEdge() == true) {
+ edgeSource = edgeSource.source;
+ }
+
+ // If the edge violates any port constraints, return null.
+ if(!((edgeSource.getEdgeCount() == 0 && edgeSource.isVertex() &&
+ target.getEdgeCount() == 0 && target.isVertex()) ||
+ (edgeSource.getEdgeCount() <= 1 && source.isEdge()))) {
+ alert("Port is already connected, please select an please select an unconnected port or a valid link");
+ }
+ else if(edgeSource.value == "ExplicitOutputPort" && target.value != "ExplicitInputPort") {
+ alert("Explicit data output port must be connected to explicit data input port");
+ }
+ else if(edgeSource.value == "ExplicitInputPort" && target.value != "ExplicitOutputPort") {
+ alert("Explicit data input port must be connected to explicit data output port");
+ }
+ else if(edgeSource.value == "ImplicitOutputPort" && target.value != "ImplicitInputPort") {
+ alert("Implicit data output port must be connected to implicit data input port");
+ }
+ else if(edgeSource.value == "ImplicitInputPort" && target.value != "ImplicitOutputPort") {
+ alert("Implicit data input port must be connected to implicit data output port");
+ }
+ else if(edgeSource.value == "CommandPort" && target.value != "ControlPort") {
+ alert("Command port must be connected to control port");
+ }
+ else if(edgeSource.value == "ControlPort" && target.value != "CommandPort") {
+ alert("Control port must be connected to command port");
+ }
+ else {
+ // If the edge is legit, return the edge.
+ return mxGraph.prototype.addEdge.apply(this, arguments);
+ }
- // Clear the undoManager history, and reset the undoManager pointer to avoid any undo of null events.
- undoManager.clear();
+ return null;
+ }
- // Move the remaning mxEvents back into the undoManager history stack.
- for (i in storage) {
- if (storage[i] != null) {
- undoManager.undoableEditHappened(storage[i]);
- }
- }
- }
+ // Shows a "modal" window when double clicking a vertex.
+ graph.dblClick = function(evt, cell) {
+ // Do not fire a DOUBLE_CLICK event here as mxEditor will
+ // consume the event and start the in-place editor.
+ if (this.isEnabled() &&
+ !mxEvent.isConsumed(evt) &&
+ cell != null &&
+ this.isCellEditable(cell)) {
+ if (!this.isHtmlLabel(cell)) {
+ this.startEditingAtCell(cell);
+ } else {
+ /*
+ var content = document.createElement('div');
+ content.innerHTML = this.convertValueToString(cell);
+ showModalWindow(this, 'Properties', content, 400, 300);
+ */
+ if(cell.isVertex() == true) {
+ showPropertiesWindow(graph, cell);
}
}
}
- });
-
- // Disables drag-and-drop into non-swimlanes.
- graph.isValidDropTarget = function(cell, cells, evt) {
- return this.isSwimlane(cell);
- };
-
- // Disables drilling into non-swimlanes.
- graph.isValidRoot = function(cell) {
- return this.isValidDropTarget(cell);
- }
-
- // Does not allow selection of locked cells
- graph.isCellSelectable = function(cell) {
- return !this.isCellLocked(cell);
+ // Disables any default behaviour for the double click
+ mxEvent.consume(evt);
};
// Returns a shorter label if the cell is collapsed and no
// label for expanded groups
graph.getLabel = function(cell) {
var tmp = mxGraph.prototype.getLabel.apply(this, arguments); // "supercall"
-
if (this.isCellLocked(cell)) {
// Returns an empty label but makes sure an HTML
// element is created for the label (for event
@@ -404,12 +338,10 @@
return '';
} else if (this.isCellCollapsed(cell)) {
var index = tmp.indexOf('</h1>');
-
if (index > 0) {
tmp = tmp.substring(0, index + 5);
}
}
-
return tmp;
}
@@ -427,35 +359,6 @@
return !this.isSwimlane(cell);
}
- // To disable the folding icon, use the following code:
- graph.isCellFoldable = function(cell) {
- return false;
- }
-
- // Shows a "modal" window when double clicking a vertex.
- graph.dblClick = function(evt, cell) {
- // Do not fire a DOUBLE_CLICK event here as mxEditor will
- // consume the event and start the in-place editor.
- if (this.isEnabled() &&
- !mxEvent.isConsumed(evt) &&
- cell != null &&
- this.isCellEditable(cell)) {
- if (!this.isHtmlLabel(cell)) {
- this.startEditingAtCell(cell);
- } else {
- /*
- var content = document.createElement('div');
- content.innerHTML = this.convertValueToString(cell);
- showModalWindow(this, 'Properties', content, 400, 300);
- */
- showPropertiesWindow(graph, cell);
- }
- }
-
- // Disables any default behaviour for the double click
- mxEvent.consume(evt);
- };
-
graph.getTooltipForCell = function(cell) {
var text = null;
if (cell.isVertex() == true && cell.isConnectable() == false) {
@@ -562,159 +465,6 @@
});
- /*
- @pooja, @jiteshjha
- Create a custom rotate action for a selected cell.
- */
- editor.addAction('rotateCustom', function(editor, cell) {
- selectedCell = graph.getSelectionCell();
- if (selectedCell != null) {
- var cells = [];
- cells.push(selectedCell);
- for (var i = 0; i < selectedCell.getChildCount(); i++)
- cells.push(selectedCell.getChildAt(i));
- graph.getModel().beginUpdate();
- try {
- for (var i = 0; i < cells.length; i++) {
- var cell = cells[i];
- if (cell.isVertex() == true) {
- var geo = graph.getCellGeometry(cell);
-
- if (geo != null) {
- // Rotates the size and position in the geometry
- geo = geo.clone();
- geo.x += geo.width / 2 - geo.height / 2;
- geo.y += geo.height / 2 - geo.width / 2;
- var tmp = geo.width;
- geo.width = geo.height;
- geo.height = tmp;
- graph.getModel().setGeometry(cell, geo);
- // Reads the current direction and advances by 90 degrees
- var state = graph.view.getState(cell);
-
- if (state != null) {
- if (cell.isConnectable() == true) {
- if (cell.value == "ExplicitOutputPort" || cell.value == "ImplicitOutputPort") {
- var dir = state.style[mxConstants.STYLE_DIRECTION] || 'east';
- var geoCell = cell.getGeometry();
- if (dir == 'east' || dir == 'west') {
- var temp = geoCell.x;
- geoCell.x = geoCell.y - 0.0625;
- geoCell.y = temp + 0.0625;
- cell.setGeometry(geoCell);
- if (dir == 'east')
- dir = 'south';
- else
- dir = 'north';
- } else if (dir == 'south' || dir == 'north') {
-
- geoCell.y = geoCell.x + 0.0625;
- if (dir == 'south') {
- dir = 'west';
- geoCell.x = 0 - 0.125;
- } else {
- dir = 'east';
- geoCell.x = 1;
- }
- cell.setGeometry(geoCell);
- }
- } else if (cell.value == "ExplicitInputPort" || cell.value == "ImplicitInputPort") {
- var dir = state.style[mxConstants.STYLE_DIRECTION] || 'east';
- var geoCell = cell.getGeometry();
- if (dir == 'south' || dir == 'north') {
- geoCell.y = geoCell.x - 0.0625;
- if (dir == 'south') {
- dir = 'west';
- geoCell.x = 1 + 0.125;
- } else {
- dir = 'east';
- geoCell.x = 0;
- }
- cell.setGeometry(geoCell);
- } else if (dir == 'east' || dir == 'west') {
- geoCell = geoCell.clone();
- var temp = geoCell.x;
- geoCell.x = parseFloat(geoCell.y) + 0.0625;
- geoCell.y = temp - 0.0625;
- cell.setGeometry(geoCell);
- if (dir == 'east')
- dir = 'south';
- else
- dir = 'north';
- }
- } else if (cell.value == 'CommandPort') {
- var dir = state.style[mxConstants.STYLE_DIRECTION] || 'east';
- var geoCell = cell.getGeometry();
- if (dir == 'south' || dir == 'north') {
- var temp = geoCell.x;
- geoCell.x = geoCell.y + 0.0625;
- geoCell.y = temp - 0.0625;
- cell.setGeometry(geoCell);
- if (dir == 'south')
- dir = 'west';
- else
- dir = 'east';
- } else if (dir == 'east' || dir == 'west') {
- geoCell.y = parseFloat(geoCell.x) - 0.0625;
- if (dir == 'east') {
- dir = 'south';
- geoCell.x = 0 - 0.0625;
- } else {
- dir = 'north';
- geoCell.x = 1 + 0.0625;
- }
- cell.setGeometry(geoCell);
- }
- } else if (cell.value == 'ControlPort') {
- var dir = state.style[mxConstants.STYLE_DIRECTION] || 'east';
- var geoCell = cell.getGeometry();
- if (dir == 'south' || dir == 'north') {
- var temp = geoCell.x;
- geoCell.x = geoCell.y - 0.0625;
- geoCell.y = temp + 0.0625;
- cell.setGeometry(geoCell);
- if (dir == 'south')
- dir = 'west';
- else
- dir = 'east';
- } else if (dir == 'east' || dir == 'west') {
- geoCell.y = parseFloat(geoCell.x) + 0.0625;
- if (dir == 'east') {
- dir = 'south';
-
- geoCell.x = 1 + 0.0625;
- } else {
- dir = 'north';
- geoCell.x = 0 - 0.0625;
- }
- cell.setGeometry(geoCell);
- }
- }
- } else {
- var dir = state.style[mxConstants.STYLE_DIRECTION] || 'east';
-
- if (dir == 'east') {
- dir = 'south';
- } else if (dir == 'south') {
- dir = 'west';
- } else if (dir == 'west') {
- dir = 'north';
- } else if (dir == 'north') {
- dir = 'east';
- }
- }
- graph.setCellStyles(mxConstants.STYLE_DIRECTION, dir, [cell]);
- }
- }
- }
- }
- } finally {
- graph.getModel().endUpdate();
- }
- }
- }, null, null, 'Ctrl+R');
-
-
// @jiteshjha, @pooja
/*
On selection and deletion of any block, 'deleteBlock'
@@ -777,8 +527,9 @@
toolbar.appendChild(spacer.cloneNode(true));
- addToolbarButton(editor, toolbar, 'undoCustom', '', 'images/undo.png');
- addToolbarButton(editor, toolbar, 'redoCustom', '', 'images/redo.png');
+ addToolbarButton(editor, toolbar, 'delete', '', 'images/delete2.png');
+ addToolbarButton(editor, toolbar, 'undo', '', 'images/undo.png');
+ addToolbarButton(editor, toolbar, 'redo', '', 'images/redo.png');
toolbar.appendChild(spacer.cloneNode(true));
addToolbarButton(editor, toolbar, 'show', 'Show', 'images/camera.png');
@@ -825,7 +576,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 +620,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);
}
});
@@ -983,6 +738,57 @@
}
};
+ /*
+ @jiteshjha
+ styleToObject(style) converts style string into an object.
+ Format : First item in the object will be 'default: linkStyle',
+ and the rest of items will be of the style 'mxConstants:value'
+ */
+
+ function styleToObject(style) {
+
+ var defaultStyle = style.substring(0, style.indexOf(';'));
+ var styleObject = {
+ "default" : defaultStyle
+ };
+ var remainingStyle = style.substring(style.indexOf(';') + 1);
+
+ /*
+ remainingStyle is the string without the default style.
+ For every key:value pair in the string,
+ extract the key(string before '=') and the value
+ (string before ';'), set the key:value pair into styleObject
+ and remainingStyle is set to a string without the key:value pair.
+ */
+ while(remainingStyle.length > 0) {
+ var indexOfKey = remainingStyle.indexOf('=');
+ var key = remainingStyle.substring(0, indexOfKey);
+ remainingStyle = remainingStyle.substring(indexOfKey + 1);
+ var indexOfValue = remainingStyle.indexOf(';');
+ var value = remainingStyle.substring(0, indexOfValue);
+ styleObject[key] = value;
+ remainingStyle = remainingStyle.substring(indexOfValue + 1);
+ }
+
+ return styleObject;
+ }
+
+ /*
+ @jiteshjha
+ styleToObject(style) converts the object back to the style string.
+ */
+ function objectToStyle(object) {
+ var style = "";
+ for (var key in object) {
+ if(key.toString() == "default") {
+ style += object[key] + ';';
+ }
+ else {
+ style += (key + '=' + object[key] + ';');
+ }
+ }
+ return style;
+ }
/*
Maverick
@@ -991,6 +797,7 @@
using this function.
*/
+
function XcosDiagram(context, model, attributes) {
this.context = context;
this.model = model;
@@ -1050,10 +857,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 != "") {
@@ -1063,7 +877,6 @@
}
- var wind = null;
// Executes when button 'btn' is clicked
btn.onclick = function() {
@@ -1092,19 +905,21 @@
}
diagRoot.context = contextValues;
- context("set", contextValues);
+ diagRoot.context.scilabClass="String[]";
+ handleContext("set", contextValues);
wind.destroy();
};
myform.appendChild(btn);
content.appendChild(myform);
- wind = showModalWindow(graph, 'Set Context', content, 450, 350);
+ var wind = showModalWindow(graph, 'Set Context', content, 450, 350);
};
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 +931,7 @@
vec_z: ["Zmin and Zmax", [-15, 15]],
param3ds: ["Alpha and Theta", [50, 280]],
N: ["Buffer size", 2]
- };
+ };*/
//var defaultProperties=window["CONST_m"]("get");
@@ -1175,7 +990,7 @@
btn.innerHTML = 'Submit';
btn.type = "button";
btn.name = "submit";
- var wind = null;
+
// Executes when button 'btn' is clicked
btn.onclick = function() {
var propertiesObject = {
@@ -1187,6 +1002,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);
@@ -1212,10 +1038,231 @@
height = 135 + 26 * defaultProperties.length + 15;
content.appendChild(myform);
- wind = showModalWindow(graph, 'Properties', content, 450, height);
+ var wind = showModalWindow(graph, 'Properties', content, 450, height);
};
/*
+ @jiteshjha
+ Creates a dialog box related to the edge label properties.
+ The properties implemented are : edge label, label fontStyle,
+ label fontSize, label fontStyle.
+ */
+
+
+ function showTextEditWindow(graph, cell) {
+ var fontFamilyList = {
+ "Arial" : 0,
+ "Dialog" : 1,
+ "Verdana" : 2,
+ "Times New Roman" : 3
+ }
+ var defaultProperties = {
+ text: ["Text", "text"],
+ fontFamily : ["Font Family", fontFamilyList],
+ fontSize: ["fontSize", 20]
+ };
+
+ var style = graph.getModel().getStyle(cell);
+ var styleObject = styleToObject(style);
+ if ('fontSize' in styleObject) {
+ defaultProperties['fontSize'][1] = styleObject['fontSize'];
+ }
+ if (cell.value != "") {
+ defaultProperties['text'][1] = cell.value;
+ }
+
+ // Create basic structure for the form
+ var content = document.createElement('div');
+ content.setAttribute("id", "contentProperties");
+
+ // Heading of content
+ var heading = document.createElement('h2');
+ heading.innerHTML = "Text and Text Font";
+ heading.id = "headingProperties"
+ content.appendChild(heading);
+
+ // Add Form
+ var myform = document.createElement("form");
+ myform.method = "post";
+ myform.id = "formProperties";
+
+ // Line break
+ var linebreak = document.createElement('br');
+ myform.appendChild(linebreak);
+
+ for (var key in defaultProperties) {
+ if (defaultProperties.hasOwnProperty(key)) {
+
+ // Input Title
+ var fieldName = defaultProperties[key];
+ var namelabel = document.createElement('label');
+ namelabel.innerHTML = defaultProperties[key][0];
+ myform.appendChild(namelabel);
+
+ if(key == "fontFamily") {
+ //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];
+
+ for(var item in dropdownItems) {
+ if (dropdownItems.hasOwnProperty(item)) {
+ option = document.createElement('option');
+ option.value = item;
+ option.text = item;
+ option.setAttribute("id", item);
+ newList.appendChild(option);
+ }
+ }
+
+ var selectedFontFamily = 0;
+ var styleObject = styleToObject(style);
+ if ('fontFamily' in styleObject) {
+ selectedFontFamily = styleObject['fontFamily'];
+ }
+ newList.selectedIndex = dropdownItems[selectedFontFamily];
+ 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);
+ }
+ // Line break
+ var linebreak = document.createElement('br');
+ myform.appendChild(linebreak);
+
+ // Line break
+ var linebreak = document.createElement('br');
+ myform.appendChild(linebreak);
+ }
+ }
+
+ // Line break
+ var linebreak = document.createElement('br');
+ myform.appendChild(linebreak);
+
+ /*
+ changeFontStyle function sets the style for given fontStyle and toggles with the active class
+ for "set" type, and toggles with the active class for "get" type.
+ */
+ function changeFontStyle(type, graph, cell, button, bit) {
+ var style = graph.getModel().getStyle(cell);
+ var trigger = document.getElementById(button);
+ var styleObject = styleToObject(style);
+ var previousValue = 1;
+ if ('fontStyle' in styleObjesct) {
+ previousValue = styleObject['fontStyle'];
+
+ // To get a bit mask:
+ var mask = 1 << bit; // Get the 1st element
+
+ if(type == "get") {
+ // toggle the bit
+ previousValue ^= mask;
+ trigger.classList.toggle(button);
+ styleObject['fontStyle'] = previousValue;
+ style = objectToStyle(styleObject);
+ graph.getModel().setStyle(cell, style);
+ }
+ else if(type == "set") {
+ if ((previousValue & mask) != 0) {
+ trigger.classList.toggle(button);
+ }
+ }
+ }
+ }
+
+ // Button - Bold
+ var btn = document.createElement("button");
+ btn.innerHTML = 'Bold';
+ btn.setAttribute("id", "boldButton");
+ btn.type = "button";
+ btn.name = "submit";
+ btn.onclick = function() {
+ changeFontStyle("get", graph, cell, 'boldButton', 0);
+ }
+ myform.appendChild(btn);
+
+ // Button - Italics
+ var btn = document.createElement("button");
+ btn.innerHTML = 'Italic';
+ btn.setAttribute("id", "italicButton");
+ btn.type = "button";
+ btn.name = "submit";
+ btn.onclick = function() {
+ changeFontStyle("get", graph, cell, 'italicButton', 1);
+ }
+ myform.appendChild(btn);
+
+ // Button - Underline
+ var btn = document.createElement("button");
+ btn.innerHTML = 'Underline';
+ btn.setAttribute("id", "underlineButton");
+ btn.type = "button";
+ btn.name = "submit";
+ btn.onclick = function() {
+ changeFontStyle("get", graph, cell, 'underlineButton', 2);
+ }
+ myform.appendChild(btn);
+
+ // Line break
+ var linebreak = document.createElement('br');
+ myform.appendChild(linebreak);
+
+ // Line break
+ var linebreak = document.createElement('br');
+ myform.appendChild(linebreak);
+
+ // Button - Submit
+ var btn = document.createElement("button");
+ btn.innerHTML = 'Submit';
+ btn.type = "button";
+ btn.name = "submit";
+
+ // Executes when button 'btn' is clicked
+ btn.onclick = function() {
+ var propertiesObject = {
+ id: cell.id
+ };
+ for (var key in defaultProperties) {
+ if (defaultProperties.hasOwnProperty(key)) {
+ propertiesObject[key] = document.getElementById(key.toString()).value;
+ }
+ }
+ var style = graph.getModel().getStyle(cell);
+ var styleObject = styleToObject(style);
+ styleObject['fontSize'] = propertiesObject['fontSize'];
+ styleObject['fontFamily'] = propertiesObject['fontFamily'];
+ style = objectToStyle(styleObject);
+ graph.getModel().setStyle(cell, style);
+ graph.getModel().setValue(cell, propertiesObject['text']);
+ wind.destroy();
+ };
+ myform.appendChild(btn);
+
+ // Base heights without fields : 135 px
+ height = 135 + 26 * defaultProperties.length + 15;
+ content.appendChild(myform);
+ var wind = showModalWindow(graph, 'Text and Text font', content, 450, height);
+
+ /*
+ @jiteshjha
+ If any fontStyle(Bold, Italic, Underline) has already been implemented
+ for the selected edge label, add the respective active class to that button.
+ */
+
+ if('fontStyle' in styleObject) {
+ changeFontStyle("set", graph, cell, 'boldButton', 0);
+ changeFontStyle("set", graph, cell, 'italicButton', 1);
+ changeFontStyle("set", graph, cell, 'underlineButton', 2);
+ }
+ };
+ /*
@jiteshjha, @pooja
showSetupWindow dialog box
*/
@@ -1334,8 +1381,6 @@
btn.type = "button";
btn.name = "submit";
- var wind = null;
-
// Executes when button 'btn' is clicked
btn.onclick = function() {
var propertiesObject = {};
@@ -1388,30 +1433,25 @@
height = 135 + 26 * defaultProperties.length + 15;
content.appendChild(myform);
- wind = showModalWindow(graph, 'Set Parameters', content, 450, height);
+ var wind = showModalWindow(graph, 'Set Parameters', content, 450, height);
};
function showColorWheel(graph, cell, selectProperty) {
-
// Create basic structure for the form
var content = document.createElement('div');
content.setAttribute("id", "colorProperties");
-
// Add Form
var myform = document.createElement("form");
myform.method = "";
myform.setAttribute("id", "formProperties");
-
// Line break
var linebreak = document.createElement('br');
myform.appendChild(linebreak);
-
// Input Title
var fieldName = 'Color';
var namelabel = document.createElement('label');
namelabel.innerHTML = fieldName;
myform.appendChild(namelabel);
-
// Input
var input = document.createElement("input");
input.name = fieldName;
@@ -1419,15 +1459,12 @@
input.style.cssText = 'float: right;';
input.setAttribute("id", "color");
myform.appendChild(input);
-
// Line break
var linebreak = document.createElement('br');
myform.appendChild(linebreak);
-
// Line break
var linebreak = document.createElement('br');
myform.appendChild(linebreak);
-
// Line break
var linebreak = document.createElement('br');
myform.appendChild(linebreak);
@@ -1437,54 +1474,36 @@
// Line break
var linebreak = document.createElement('br');
myform.appendChild(linebreak);
-
// Button - Submit
var btn = document.createElement("button");
btn.innerHTML = 'Submit';
btn.type = "button";
btn.name = "submit";
btn.style.cssText = 'margin-left: 75px';
-
- var wind = null;
// Executes when button 'btn' is clicked
btn.onclick = function() {
var input = document.getElementById('color').value;
+ var style = graph.getModel().getStyle(cell);
+ var styleObject = styleToObject(style);
if (selectProperty == "edgeStrokeColor") {
- var style = graph.getModel().getStyle(cell);
- if (style == null) {
- style = 'strokeColor=' + input;
- graph.getModel().setStyle(cell, style);
- } else {
- style = style.replace(/strokeColor=#[a-fA-F0-9]{6,}/g, "strokeColor=" + input);
- graph.getModel().setStyle(cell, style);
- }
+ styleObject['strokeColor'] = input;
} else if (selectProperty == "bgColor") {
graph.container.style.backgroundColor = input;
} else if (selectProperty == "vertexStrokeColor") {
- var style = graph.getModel().getStyle(cell);
- if (style.indexOf('strokeColor') > -1) {
- style = style.replace(/strokeColor=#[a-fA-F0-9]{6,}/g, "strokeColor=" + input);
- graph.getModel().setStyle(cell, style);
- } else {
- style = style + ';' + 'strokeColor=' + input;
- graph.getModel().setStyle(cell, style);
- }
+ styleObject['strokeColor'] = input;
} else if (selectProperty == "vertexFillColor") {
- var style = graph.getModel().getStyle(cell);
- if (style.indexOf('fillColor') > -1) {
- style = style.replace(/fillColor=#[a-fA-F0-9]{6,}/g, "fillColor=" + input);
- graph.getModel().setStyle(cell, style);
- } else {
- style = style + ';' + 'fillColor=' + input;
- graph.getModel().setStyle(cell, style);
- }
+ styleObject['fillColor'] = input;
}
+ else if(selectProperty == "edgeTextColor") {
+ styleObject['fontColor'] = input;
+ }
+ style = objectToStyle(styleObject);
+ graph.getModel().setStyle(cell, style);
wind.destroy();
};
myform.appendChild(btn);
-
content.appendChild(myform);
- wind = showModalWindow(graph, 'Diagram background...', content, 285, 340);
+ var wind = showModalWindow(graph, 'Diagram background...', content, 285, 340);
// Invokes the farbtastic functionality
$(document).ready(function() {
$('#picker').farbtastic('#color');
@@ -1601,7 +1620,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 +1629,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 +1638,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 +1767,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 +1778,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 +1994,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 +2002,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 +2015,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 +2023,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 +2045,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 +2067,7 @@
if (position == 'right') {
port.geometry.offset = new mxPoint(0, -6);
}
+ port.ordering=ordering;
}
};
@@ -2054,8 +2076,6 @@
var root = req.getDocumentElement();
var dec = new mxCodec(root.ownerDocument);
dec.decode(root, graph.stylesheet);
- var style = graph.getStylesheet().getDefaultEdgeStyle();
- style['edgeStyle'] = 'wireEdgeStyle';
};
</script>
<!--
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") {
diff --git a/styles/Xcos-style.xml b/styles/Xcos-style.xml
index 49d984e..39bced0 100644
--- a/styles/Xcos-style.xml
+++ b/styles/Xcos-style.xml
@@ -108,11 +108,13 @@
<!-- To have rounded links -->
<!-- <add as="rounded" value="1"/> -->
<!-- <add as="edgeStyle" value="elbowEdgeStyle"/> -->
+ <add as="edgeStyle" value="wireEdgeStyle"/>
<add as="elbow" value="horizontal"/>
<add as="shape" value="connector"/>
<add as="labelBackgroundColor" value="white"/>
<add as="endArrow" value="classicnone"/>
- <add as="fontSize" value="10"/>
+ <add as="fontSize" value="20"/>
+ <add as="fontStyle" value="0"/>
<add as="align" value="center"/>
<add as="verticalAlign" value="middle"/>
<add as="strokeColor" value="black"/>
@@ -612,7 +614,7 @@
</add>
<add as="M_freq" extend="blockWithLabel">
<add as="displayedLabel" value="Multiple&lt;BR&gt; frequency"/>
-
+
</add>
<add as="ANDBLK" extend="Icon">
</add>
@@ -720,7 +722,7 @@
</add>
<add as="RELATIONALOP" extend="blockWithLabel">
<add as="displayedLabel" value="Relational&lt;BR&gt; op : &amp;&lt;"/>
- <!-- new value for the label defined in the interface function of block -->
+ <!-- new value for the label defined in the interface function of block -->
</add>
<add as="TEXT_f" extend="Label">
<!-- <add as="displayedLabel" value="Text"/> -->