|
From: <ma...@us...> - 2011-02-04 17:45:38
|
Revision: 275
http://openautomation.svn.sourceforge.net/openautomation/?rev=275&view=rev
Author: mayerch
Date: 2011-02-04 17:45:32 +0000 (Fri, 04 Feb 2011)
Log Message:
-----------
The parameter change functionallity allows to change the number and types of in- and outPorts now.
Note: if a port contains a connection and is removed now, the result is currently "undefined" (i.e. this case isn't handled yet...)
Modified Paths:
--------------
PyWireGate/trunk/logic_editor/backendCommunication.js
PyWireGate/trunk/logic_editor/gle/gle.block.js
Modified: PyWireGate/trunk/logic_editor/backendCommunication.js
===================================================================
--- PyWireGate/trunk/logic_editor/backendCommunication.js 2011-01-30 21:03:32 UTC (rev 274)
+++ PyWireGate/trunk/logic_editor/backendCommunication.js 2011-02-04 17:45:32 UTC (rev 275)
@@ -167,6 +167,24 @@
}
}
return [ {x: undefined, y: undefined}, {x: undefined, y: undefined} ];
+ },
+ 'postParameterUpdate': function( context, parameter ){
+ var inPorts = [];
+ for( i in parameter.inputs )
+ {
+ switch( parameter.inputs[i] )
+ {
+ case '+':
+ inPorts.push( { name: '+', type: 'event' } );
+ break;
+ case '-':
+ inPorts.push( { name: '-', type: 'event' } );
+ break;
+ default: // e.g. '|'
+ break;
+ }
+ }
+ return { inPorts: inPorts };
}
},
'inPorts': [
Modified: PyWireGate/trunk/logic_editor/gle/gle.block.js
===================================================================
--- PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-01-30 21:03:32 UTC (rev 274)
+++ PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-02-04 17:45:32 UTC (rev 275)
@@ -47,6 +47,7 @@
var outPorts = type.outPorts || [];
var parameters = type.parameters || {};
var parameter = type.parameter || createParameter( type.parameters );
+ var postParameterUpdateFn = maskOptions.postParameterUpdate;
var canvas = svg || $('#editor').svg('get');
var addEvent = interactive !== undefined ? interactive : true;
@@ -197,6 +198,19 @@
return retVal;
}
+ // gets called when any of the parameters were updated so that the behaviour
+ // can change, e.g. the number of ports could be changed
+ function postParameterUpdate()
+ {
+ if( postParameterUpdateFn == undefined ) return; // nothing to do
+
+ var change = postParameterUpdateFn( that, parameter );
+ if( change.inPorts !== undefined )
+ inPorts = change.inPorts;
+ if( change.outPorts !== undefined )
+ outPorts = change.outPorts;
+ }
+
// relocate itself on the canvas
function relocate()
{
@@ -371,6 +385,7 @@
parameter[ this.name ] = this.value;
});
$( this ).dialog( 'close' );
+ postParameterUpdate();
draw();
},
Cancel: function() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|