|
From: <ma...@us...> - 2011-01-14 23:51:04
|
Revision: 248
http://openautomation.svn.sourceforge.net/openautomation/?rev=248&view=rev
Author: mayerch
Date: 2011-01-14 23:50:58 +0000 (Fri, 14 Jan 2011)
Log Message:
-----------
Inital support for bigger target areas (inkl. preparation for non square blocks)
Modified Paths:
--------------
PyWireGate/trunk/logic_editor/backendCommunication.js
PyWireGate/trunk/logic_editor/gle/gle.block.js
PyWireGate/trunk/logic_editor/gle/gle.connection.js
PyWireGate/trunk/logic_editor/logicEditor.js
Modified: PyWireGate/trunk/logic_editor/backendCommunication.js
===================================================================
--- PyWireGate/trunk/logic_editor/backendCommunication.js 2011-01-14 22:39:21 UTC (rev 247)
+++ PyWireGate/trunk/logic_editor/backendCommunication.js 2011-01-14 23:50:58 UTC (rev 248)
@@ -54,6 +54,34 @@
],
'outPorts': [],
'parameters':{}
+ },
+ 'sink2': {
+ 'width': 100,
+ 'height': 100,
+ 'rotation': 0,
+ 'flip': false,
+ 'color': [0.0, 0.0, 0.0],
+ 'background': [1.0, 1.0, 1.0],
+ 'inPorts': [
+ {
+ 'name': 'in',
+ 'type': 'event'
+ },
+ {
+ 'name': 'in',
+ 'type': 'event'
+ },
+ {
+ 'name': 'in',
+ 'type': 'event'
+ },
+ {
+ 'name': 'in',
+ 'type': 'event'
+ }
+ ],
+ 'outPorts': [],
+ 'parameters':{}
}
},
'mathLib': {
Modified: PyWireGate/trunk/logic_editor/gle/gle.block.js
===================================================================
--- PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-01-14 22:39:21 UTC (rev 247)
+++ PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-01-14 23:50:58 UTC (rev 248)
@@ -103,6 +103,7 @@
} else {
canvas.rect( body, 0, 0, width, height, style );
}
+ if( addEvent ) editorConnectionPointCreate( body, undefined, undefined );
// extend the style for the ports...
style.cursor = 'crosshair';
@@ -297,10 +298,13 @@
////////////////
function editorConnectionPointCreate( obj, portType, portNumber )
{
- $(obj).bind( 'mousedown', {
- portType :portType,
- portNumber:portNumber
- }, editorConnectionPointDrag );
+ if( portType !== undefined && portNumber !== undefined )
+ {
+ $(obj).bind( 'mousedown', {
+ portType :portType,
+ portNumber:portNumber
+ }, editorConnectionPointDrag );
+ }
$(obj).bind( 'mouseover', {
portType :portType,
portNumber:portNumber
@@ -352,11 +356,42 @@
function editorConnectionPointOverPort( event )
{
console.log( 'eCPOP', event.data.portType );
- overPort = {
- block : that,
- type : event.data.portType,
- number: event.data.portNumber
- };
+ if( event.data.portType !== undefined && event.data.portNumber !== undefined )
+ {
+ overPort = {
+ block : that,
+ type : event.data.portType,
+ number: event.data.portNumber
+ };
+ } else {
+ var ex = event.pageX - $('#editor')[0].offsetLeft;
+ var ey = event.pageY - $('#editor')[0].offsetTop;
+ var distance = function( pos )
+ {
+ return (ex-pos[0])*(ex-pos[0]) + (ey-pos[1])*(ey-pos[1]);
+ }
+ if( connectionLookingForInPort )
+ {
+ var smallestDistance = 1e99;
+ var smallestDistancePort = -1;
+ for( var i = 0; i < inPorts.length; i++ )
+ {
+ var dist = distance( that.inPortPos(i) );
+ if( dist < smallestDistance )
+ {
+ smallestDistance = dist;
+ smallestDistancePort = i;
+ }
+ }
+ overPort = {
+ block : that,
+ type : 'inPort',
+ number: smallestDistancePort
+ };
+ } else {
+ // FIXME ADD outPort
+ }
+ }
}
function editorConnectionPointOverPortOut( event )
Modified: PyWireGate/trunk/logic_editor/gle/gle.connection.js
===================================================================
--- PyWireGate/trunk/logic_editor/gle/gle.connection.js 2011-01-14 22:39:21 UTC (rev 247)
+++ PyWireGate/trunk/logic_editor/gle/gle.connection.js 2011-01-14 23:50:58 UTC (rev 248)
@@ -130,7 +130,7 @@
function editorDragMouseMove( event )
{
var ed = event.data;
- console.log('cDMM', ed );
+ //console.log('cDMM', ed );
if( ed.extend )
{
that.lastMove( [ed.origx - ed.startx + event.pageX, ed.origy - ed.starty + event.pageY], false );
@@ -139,30 +139,6 @@
paths[ed.obj[1]].path[ed.obj[2]][1] = ed.origy - ed.starty + event.pageY;
draw();
}
- /*
- if( 'move' == event.data.type )
- {
- relocate(); // shortcut
- } else {
- if( width < 10 ) width = 10; // sanity...
- if( height < 10 ) height = 10; // sanity...
- draw();
- }
-
- $.each( inPorts, function(i){
- if( 'connection' in this )
- {
- this.connection.lastMove( that.inPortPos( i ), true );
- }
- });
-
- $.each( outPorts, function(i){
- if( 'connection' in this )
- {
- this.connection.firstMove( that.outPortPos( i ) );
- }
- });
- */
}
function editorDragMouseUp( event )
Modified: PyWireGate/trunk/logic_editor/logicEditor.js
===================================================================
--- PyWireGate/trunk/logic_editor/logicEditor.js 2011-01-14 22:39:21 UTC (rev 247)
+++ PyWireGate/trunk/logic_editor/logicEditor.js 2011-01-14 23:50:58 UTC (rev 248)
@@ -19,6 +19,7 @@
// global variables
var overPort = false;
+var connectionLookingForInPort = true; // only relevant in connection drawing mode
var maxX = 500; // the biggest x value of the current view
var maxY = 0; // the biggest y value of the current view
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-01-16 11:51:13
|
Revision: 251
http://openautomation.svn.sourceforge.net/openautomation/?rev=251&view=rev
Author: mayerch
Date: 2011-01-16 11:51:06 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
Correctly handle a scrolled working pane by using the new universal getCoordinate
Modified Paths:
--------------
PyWireGate/trunk/logic_editor/gle/gle.block.js
PyWireGate/trunk/logic_editor/logicEditor.js
Modified: PyWireGate/trunk/logic_editor/gle/gle.block.js
===================================================================
--- PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-01-15 22:38:32 UTC (rev 250)
+++ PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-01-16 11:51:06 UTC (rev 251)
@@ -335,10 +335,8 @@
function editorConnectionPointMouseMove( event )
{
- //console.log( event.data.con );
- var x = event.pageX - $('#editor')[0].offsetLeft;
- var y = event.pageY - $('#editor')[0].offsetTop;
- event.data.con.lastMove( [x, y] );
+ var c = getCoordinate( event );
+ event.data.con.lastMove( [c.x, c.y] );
}
function editorConnectionPointMouseUp( event )
@@ -364,11 +362,10 @@
number: event.data.portNumber
};
} else {
- var ex = event.pageX - $('#editor')[0].offsetLeft;
- var ey = event.pageY - $('#editor')[0].offsetTop;
+ var c = getCoordinate( event );
var distance = function( pos )
{
- return (ex-pos[0])*(ex-pos[0]) + (ey-pos[1])*(ey-pos[1]);
+ return (c.x-pos[0])*(c.x-pos[0]) + (c.y-pos[1])*(c.y-pos[1]);
}
if( connectionLookingForInPort )
{
Modified: PyWireGate/trunk/logic_editor/logicEditor.js
===================================================================
--- PyWireGate/trunk/logic_editor/logicEditor.js 2011-01-15 22:38:32 UTC (rev 250)
+++ PyWireGate/trunk/logic_editor/logicEditor.js 2011-01-16 11:51:06 UTC (rev 251)
@@ -143,11 +143,9 @@
{
if( ui.draggable.data('element') )
{
- var svg = $('#editor').svg('get');
- var x = ui.position.left - this.offsetLeft;
- var y = ui.position.top - this.offsetTop ;
- var data = $.extend( true, {x:x, y:y}, ui.draggable.data('element') );
- drawElement( svg, data );
+ var c = getCoordinate( {pageX: ui.position.left, pageY: ui.position.top} );
+ var data = $.extend( true, c, ui.draggable.data('element') );
+ drawElement( $('#editor').svg('get'), data );
}
}
@@ -162,10 +160,11 @@
jQuery(document).ready(function(){
getCoordinate = (function()
{
- var svg = $('#editor svg'); // quasi static variable
+ var editor = $('#editor'); // quasi static variable
return function( event ) {
- var o = svg.offset();
- return {x: event.pageX - o.left, y: event.pageY - o.top};
+ var o = editor.offset();
+ return {x: event.pageX - o.left + editor.scrollLeft(),
+ y: event.pageY - o.top + editor.scrollTop () };
};
})();
});
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-01-16 12:23:42
|
Revision: 253
http://openautomation.svn.sourceforge.net/openautomation/?rev=253&view=rev
Author: mayerch
Date: 2011-01-16 12:23:36 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
* Changed tree view to use only local icons
* Added correctly sized (= 16x16) block icon
Modified Paths:
--------------
PyWireGate/trunk/logic_editor/logicEditor.js
Added Paths:
-----------
PyWireGate/trunk/logic_editor/icon/16/
PyWireGate/trunk/logic_editor/icon/16/code-block.png
Added: PyWireGate/trunk/logic_editor/icon/16/code-block.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/16/code-block.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: PyWireGate/trunk/logic_editor/logicEditor.js
===================================================================
--- PyWireGate/trunk/logic_editor/logicEditor.js 2011-01-16 12:17:49 UTC (rev 252)
+++ PyWireGate/trunk/logic_editor/logicEditor.js 2011-01-16 12:23:36 UTC (rev 253)
@@ -39,27 +39,27 @@
json_data : {
data : [
{
- data : "A node",
+ data : 'System 1',
attr : { rel : 'logic' },
children : [
{
- data: 'My Child',
+ data: 'Subsystem 1',
attr: { rel: 'subsystem' },
children : [
{
- data: 'My second child',
+ data: 'Subsubsystem',
attr: { rel: 'subsystem' }
}
]
},
- "Child 1",
- "Child 2"
+ 'Subsystem 2',
+ 'Subsystem 3'
]
},
{
attr : { rel : 'logic' },
data : {
- title : "Long format demo",
+ title : 'System 2',
attr : { href : "#" }
}
}
@@ -72,8 +72,8 @@
},
types: {
types: {
- logic : { icon: { image: "http://static.jstree.com/v.1.0rc/_docs/_drive.png" } },
- subsystem: { icon: { image: "http://static.jstree.com/v.1.0rc/_docs/syntax/help.png" } }
+ logic : { icon: { image: 'icon/16/code-block.png' } },
+ subsystem: { icon: { image: 'icon/16/code-block.png' } }
}
}
});
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-01-16 15:10:47
|
Revision: 257
http://openautomation.svn.sourceforge.net/openautomation/?rev=257&view=rev
Author: mayerch
Date: 2011-01-16 15:10:41 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
Initial support for zooming
Modified Paths:
--------------
PyWireGate/trunk/logic_editor/index.html
PyWireGate/trunk/logic_editor/logicEditor.css
PyWireGate/trunk/logic_editor/logicEditor.js
Modified: PyWireGate/trunk/logic_editor/index.html
===================================================================
--- PyWireGate/trunk/logic_editor/index.html 2011-01-16 12:56:51 UTC (rev 256)
+++ PyWireGate/trunk/logic_editor/index.html 2011-01-16 15:10:41 UTC (rev 257)
@@ -20,8 +20,9 @@
</head>
<body>
<div id="header" class="ui-layout-north">
- <h1>Example SVG based Logic Engine Editor</h1>
- Toolbar...
+ <img class="toolbarButton" src="icon/32/zoom-out.png" onClick="zoomEditor(-1)"/>
+ <img class="toolbarButton" src="icon/32/zoom-original.png" onClick="zoomEditor(10)" />
+ <img class="toolbarButton" src="icon/32/zoom-in.png" onClick="zoomEditor(+1)" />
</div>
<div id="structureContainer" class="ui-layout-west">
<h2>Structure area</h2>
Modified: PyWireGate/trunk/logic_editor/logicEditor.css
===================================================================
--- PyWireGate/trunk/logic_editor/logicEditor.css 2011-01-16 12:56:51 UTC (rev 256)
+++ PyWireGate/trunk/logic_editor/logicEditor.css 2011-01-16 15:10:41 UTC (rev 257)
@@ -15,6 +15,25 @@
font-size: 12pt;
}
+.toolbarButton {
+ padding: 4px;
+ margin: 2px;
+ border-width: 1px;
+ border-color: #222;
+ border-radius: 6px;
+ -moz-border-radius: 6px;
+ -webkit-border-radius: 6px;
+}
+
+.toolbarButton:hover {
+ border-style: outset;
+ margin: 1px;
+}
+.toolbarButton:active {
+ border-style: inset;
+ margin: 1px;
+}
+
.libName {
font-size: 11pt;
font-weight: bold;
Modified: PyWireGate/trunk/logic_editor/logicEditor.js
===================================================================
--- PyWireGate/trunk/logic_editor/logicEditor.js 2011-01-16 12:56:51 UTC (rev 256)
+++ PyWireGate/trunk/logic_editor/logicEditor.js 2011-01-16 15:10:41 UTC (rev 257)
@@ -22,6 +22,7 @@
var connectionLookingForInPort = true; // only relevant in connection drawing mode
var maxX = 0; // the biggest x value of the current view
var maxY = 0; // the biggest y value of the current view
+var zoomLevel = 10; // 1 = biggest, +inf = smallest
$(function() {
$('body').layout({
@@ -78,6 +79,9 @@
}
});
+ // prevent the toolbar images to be dragged around
+ $('img.toolbarButton').bind('dragstart', function(event) { event.preventDefault(); });
+
drawLibrary();
$('#editor').svg().
droppable({drop: editorDrop}).
@@ -196,4 +200,36 @@
y: event.pageY - o.top + editor.scrollTop () };
};
})();
-});
\ No newline at end of file
+});
+
+/**
+ * Zoom the editor canvas.
+ * level == -1 : zoom out
+ * level == 0 : NOP
+ * level == +1 : zoom in
+ * level > 1 : zoom to that value, 10 = 100% = 1:1
+ */
+function zoomEditor( level )
+{
+ if( level > 1 )
+ zoomLevel = level;
+ else
+ zoomLevel -= level;
+ var editor = $('#editor'); // quasi static variable
+ var svg = $('#editor svg')[0];
+ var x = Math.max( maxX, editor.innerWidth() );
+ var y = Math.max( maxY, editor.innerHeight() );
+ var factor = Math.pow(Math.sqrt(2),10-zoomLevel);// Math.log(-10+zoomLevel) / Math.log( 2 );
+ if( zoomLevel < 10 )
+ {
+ svg.width.baseVal.value = x* factor;
+ svg.height.baseVal.value = y* factor;
+ svg.viewBox.baseVal.width = x;
+ svg.viewBox.baseVal.height = y;
+ } else {
+ svg.width.baseVal.value = x;
+ svg.height.baseVal.value = y;
+ svg.viewBox.baseVal.width = x / factor;
+ svg.viewBox.baseVal.height = y / factor;
+ }
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-01-16 15:39:24
|
Revision: 258
http://openautomation.svn.sourceforge.net/openautomation/?rev=258&view=rev
Author: mayerch
Date: 2011-01-16 15:39:18 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
* Initial setup of status bar
* Limit zoomlevel to (huge!) 3200%
Modified Paths:
--------------
PyWireGate/trunk/logic_editor/index.html
PyWireGate/trunk/logic_editor/logicEditor.js
Modified: PyWireGate/trunk/logic_editor/index.html
===================================================================
--- PyWireGate/trunk/logic_editor/index.html 2011-01-16 15:10:41 UTC (rev 257)
+++ PyWireGate/trunk/logic_editor/index.html 2011-01-16 15:39:18 UTC (rev 258)
@@ -33,5 +33,8 @@
<h2>Element Library</h2>
<div id="library"></div>
</div>
+ <div id="status" class="ui-layout-south">
+ <div id="zoom">Zoom: <span id="zoomLevel">100%</span></div>
+ </div>
</body>
</html>
Modified: PyWireGate/trunk/logic_editor/logicEditor.js
===================================================================
--- PyWireGate/trunk/logic_editor/logicEditor.js 2011-01-16 15:10:41 UTC (rev 257)
+++ PyWireGate/trunk/logic_editor/logicEditor.js 2011-01-16 15:39:18 UTC (rev 258)
@@ -32,8 +32,10 @@
editor.width.baseVal.value = Math.max( maxX, state.innerWidth );
editor.height.baseVal.value = Math.max( maxY, state.innerHeight );
},
- north__closable: false,
- north__resizable: false
+ north__closable : false,
+ north__resizable: false,
+ south__closable : false,
+ south__resizable: false
});
$('#structureTree').jstree({
plugins : [ 'json_data', 'themes', 'types' ],
@@ -215,11 +217,14 @@
zoomLevel = level;
else
zoomLevel -= level;
+ zoomLevel = zoomLevel < 0 ? 0 : zoomLevel; // limit to huge 3200%
+
var editor = $('#editor'); // quasi static variable
var svg = $('#editor svg')[0];
var x = Math.max( maxX, editor.innerWidth() );
var y = Math.max( maxY, editor.innerHeight() );
- var factor = Math.pow(Math.sqrt(2),10-zoomLevel);// Math.log(-10+zoomLevel) / Math.log( 2 );
+ var factor = Math.pow(Math.sqrt(2),10-zoomLevel);
+ $('#zoomLevel').html( (100*factor).toFixed() + '%' );
if( zoomLevel < 10 )
{
svg.width.baseVal.value = x* factor;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-01-16 21:08:53
|
Revision: 259
http://openautomation.svn.sourceforge.net/openautomation/?rev=259&view=rev
Author: mayerch
Date: 2011-01-16 21:08:47 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
* Added new block: sum
* Added ability to have non horizontal inports and outports
* Added ability for custom funtion that calculates the port position
* Changed some coordinates from Array [x,y] towards Object {x:x,y:y}
Modified Paths:
--------------
PyWireGate/trunk/logic_editor/backendCommunication.js
PyWireGate/trunk/logic_editor/gle/gle.block.js
PyWireGate/trunk/logic_editor/gle/gle.connection.js
PyWireGate/trunk/logic_editor/logicEditor.js
Modified: PyWireGate/trunk/logic_editor/backendCommunication.js
===================================================================
--- PyWireGate/trunk/logic_editor/backendCommunication.js 2011-01-16 15:39:18 UTC (rev 258)
+++ PyWireGate/trunk/logic_editor/backendCommunication.js 2011-01-16 21:08:47 UTC (rev 259)
@@ -95,8 +95,8 @@
'mask': [
{ 'type': 'move', 'x': 0.999, 'y': 0.5 }, // just to show what's possible
{ 'type': 'line', 'x': 0 , 'y': 0.999 },
- { 'type': 'line', 'x': 0 , 'y': 0 }
- // auto close
+ { 'type': 'line', 'x': 0 , 'y': 0 },
+ { 'type': 'close' }
],
'maskOptions': {
'showLabel': false
@@ -119,6 +119,79 @@
'type': 'float'
}
]
+ },
+ 'sum': {
+ 'width': 100,
+ 'height': 100,
+ 'rotation': 0,
+ 'flip': false,
+ 'color': [0.0, 0.0, 0.0],
+ 'background': [1.0, 1.0, 1.0],
+ 'mask': [
+ { 'type': 'move', 'x': 0 , 'y': 0.495 },
+ { 'type': 'arc' , 'x': 0 , 'y': 0.01 ,
+ 'rx': 50, 'ry': 50, 'xRotate':0, 'large':true, 'clockwise': true,
+ 'relative': true
+ },
+ { 'type': 'close' }
+ ],
+ 'maskOptions': {
+ 'showLabel': true,
+ 'inPortPos': function( nr, block, options, parameter ){
+ var x = block.getX();
+ var y = block.getY();
+ var width = block.getWidth();
+ var height = block.getHeight();
+ var type = parameter.inputs.split('');
+ if( type.length < 1 )
+ return [
+ { x: x , y: y + height / 2 },
+ { x: x-10, y: y + height / 2 }
+ ];
+ for( var i = 0; i < type.length; i++ )
+ {
+ if( type[i] != '|' )
+ {
+ if( nr == 0 )
+ {
+ var angle = Math.PI * (0.5 + i / (type.length-1));
+ var s = Math.sin( angle );
+ var c = Math.cos( angle );
+ return [ { x: x + width * 0.5 * ( 1 + c ),
+ y: y + height * 0.5 * ( 1 - s ) },
+ { x: x + width * 0.5 + (width +5) * 0.5 * c,
+ y: y + height * 0.5 - (height+5) * 0.5 * s }
+ ];
+ }
+ nr--;
+ }
+ }
+ return [ {x: undefined, y: undefined}, {x: undefined, y: undefined} ];
+ }
+ },
+ 'inPorts': [
+ {
+ 'name': '+',
+ 'type': 'event'
+ },
+ {
+ 'name': '+',
+ 'type': 'event'
+ }
+ ],
+ 'outPorts': [
+ {
+ 'name': 'out',
+ 'type': 'event'
+ }
+ ],
+ 'parameters': [
+ {
+ 'name': 'inputs',
+ 'type': 'string',
+ 'default': '|++'
+ }
+ ]
}
}
};
Modified: PyWireGate/trunk/logic_editor/gle/gle.block.js
===================================================================
--- PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-01-16 15:39:18 UTC (rev 258)
+++ PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-01-16 21:08:47 UTC (rev 259)
@@ -46,6 +46,7 @@
var inPorts = type.inPorts || [];
var outPorts = type.outPorts || [];
var parameters = type.parameters || {};
+ var parameter = type.parameter || createParameter( type.parameters );
var canvas = svg || $('#editor').svg('get');
var addEvent = interactive !== undefined ? interactive : true;
@@ -79,7 +80,8 @@
};
// Draw the body
- var body = canvas.group( g, {'transform':'translate(6,1)'} );
+ //var body = canvas.group( g, {'transform':'translate(6,1)'} );
+ var body = canvas.group( g );
if( mask )
{
var path = canvas.createPath();
@@ -97,9 +99,17 @@
case 'line':
path.line( sx, sy );
break;
+
+ case 'arc':
+ path.arc( obj.rx, obj.ry, obj.xRotate, obj.large, obj.clockwise, sx, sy, obj.relative );
+ break;
+
+ case 'close':
+ path.close();
+ break;
}
}
- canvas.path( body, path.close(), style );
+ canvas.path( body, path, style );
} else {
canvas.rect( body, 0, 0, width, height, style );
}
@@ -112,25 +122,45 @@
// Draw the inports
var inPortsLength = inPorts.length;
$.each( inPorts, function(i){
- var y = 1 + height * (0.5 + i)/inPortsLength;
+ var p = that.inPortPos( i );
+ p[0].x -= x; p[0].y -= y; // translate back as we are in a transform
+ p[1].x -= x; p[1].y -= y; // translate back as we are in a transform
if( 'connection' in this )
- canvas.line( g, 0, y, 6, y, style );
- else
- editorConnectionPointCreate( canvas.polyline( g, [[1, y-4],[6, y],[1, y+4]], style ), 'inPort', i );
+ canvas.line( g, p[0].x, p[0].y, p[1].x, p[1].y, style );
+ else {
+ var parameter = {
+ stroke: '#ff0000',//colorByArray( origin.getColor() ),
+ 'marker-end' : 'url(#EmptyInPort)'
+ };
+ editorConnectionPointCreate(
+ canvas.line( g, p[1].x, p[1].y, p[0].x, p[0].y, parameter )
+ , 'inPort', i );
+ }
if( maskOptions.showLabel )
- canvas.text( g, 10, y, this.name, {'dominant-baseline':'middle','text-anchor':'start'} );
+ canvas.text( g, 2*p[0].x-p[1].x, 2*p[0].y-p[1].y, this.name,
+ {'dominant-baseline':'middle','text-anchor':'start'} );
});
// Draw the outports
var outPortsLength = outPorts.length;
$.each( outPorts, function(i){
- var y = 1 + height * (0.5 + i)/outPortsLength;
+ var p = that.outPortPos( i );
+ p[0].x -= x; p[0].y -= y; // translate back as we are in a transform
+ p[1].x -= x; p[1].y -= y; // translate back as we are in a transform
if( 'connection' in this )
- canvas.line( g, width+6, y, width+12, y, style );
+ canvas.line( g, p[0].x, p[0].y, p[1].x, p[1].y, style );
else
- editorConnectionPointCreate( canvas.polyline( g, [[width+6, y-4],[width+11, y],[width+6, y+4]], style ), 'outPort', i );
+ //editorConnectionPointCreate( canvas.polyline( g, [[width+6, y-4],[width+11, y],[width+6, y+4]], style ), 'outPort', i );
+ var parameter = {
+ stroke: '#ff0000',//colorByArray( origin.getColor() ),
+ 'marker-start' : 'url(#EmptyOutPort)'
+ };
+ editorConnectionPointCreate(
+ canvas.line( g, p[0].x, p[0].y, p[1].x, p[1].y, parameter )
+ , 'outPort', i );
if( maskOptions.showLabel )
- canvas.text( g, width, y, this.name, {'dominant-baseline':'middle','text-anchor':'end'} );
+ canvas.text( g, 2*p[0].x-p[1].x, 2*p[0].y-p[1].y, this.name,
+ {'dominant-baseline':'middle','text-anchor':'end'} );
});
// shotcut
@@ -144,13 +174,23 @@
editorDrag( g, g ); // move
// Draw the handles
- editorDrag( g, canvas.rect( g, 5-outset , -outset , 1+inset+outset, 1+inset+outset, {class:'nw-resize'} ) );
- editorDrag( g, canvas.rect( g, 6+width-inset, -outset , 1+inset+outset, 1+inset+outset, {class:'ne-resize'} ) );
- editorDrag( g, canvas.rect( g, 5-outset , height+1-inset, 1+inset+outset, 1+inset+outset, {class:'sw-resize'} ) );
- editorDrag( g, canvas.rect( g, 6+width-inset, height+1-inset, 1+inset+outset, 1+inset+outset, {class:'se-resize'} ) );
+ editorDrag( g, canvas.rect( g, -outset , -outset , inset+outset, inset+outset, {class:'nw-resize'} ) );
+ editorDrag( g, canvas.rect( g, width-inset, -outset , inset+outset, inset+outset, {class:'ne-resize'} ) );
+ editorDrag( g, canvas.rect( g, -outset , height-inset, inset+outset, inset+outset, {class:'sw-resize'} ) );
+ editorDrag( g, canvas.rect( g, width-inset, height-inset, inset+outset, inset+outset, {class:'se-resize'} ) );
}
+ function createParameter( structure )
+ {
+ var retVal = {};
+ for( var i = 0; i < structure.length; i++ )
+ {
+ retVal[ structure[i].name ] = structure[i].default;
+ }
+ return retVal;
+ }
+
// relocate itself on the canvas
function relocate()
{
@@ -227,14 +267,14 @@
//if( 'connection' in this )
if( this.connection !== undefined )
{
- this.connection.lastMove( that.inPortPos( i ), true );
+ this.connection.lastMove( that.inPortPos( i )[0], true );
}
});
$.each( outPorts, function(i){
if( 'connection' in this )
{
- this.connection.firstMove( that.outPortPos( i ) );
+ this.connection.firstMove( that.outPortPos( i )[0] );
}
});
}
@@ -266,11 +306,21 @@
}
this.inPortPos = function( number )
{
- return [ x , y + 1 + height * (0.5 + number) / inPorts.length ];
+ if( maskOptions.inPortPos !== undefined )
+ {
+ return maskOptions.inPortPos( number, that, maskOptions, parameter );
+ } else
+ return [
+ { x: x , y: y + height * (0.5 + number) / inPorts.length },
+ { x: x - 5, y: y + height * (0.5 + number) / inPorts.length }
+ ];
}
this.outPortPos = function( number )
{
- return [ x + width + 10, y + 1 + height * (0.5 + number) / outPorts.length ];
+ return [
+ { x: x + width , y: y + height * (0.5 + number) / outPorts.length },
+ { x: x + width + 5, y: y + height * (0.5 + number) / outPorts.length }
+ ];
}
// Dump this Block in JSON notation to serialize it
@@ -319,10 +369,11 @@
console.log( 'Block: eCPD', event );
var pn = event.data.portNumber;
var pt = event.data.portType;
+ var op = that.outPortPos( pn )[0];
var c = new Connection({
origin : that,
originPortNumber: pn,
- paths : [{path:[that.outPortPos( pn )]}]
+ paths : [{path:[ [op.x, op.y] ]}]
});
that.setConnection( pt, pn,c );
///???
@@ -336,8 +387,7 @@
function editorConnectionPointMouseMove( event )
{
- var c = getCoordinate( event );
- event.data.con.lastMove( [c.x, c.y] );
+ event.data.con.lastMove( getCoordinate( event ) );
}
function editorConnectionPointMouseUp( event )
@@ -366,7 +416,7 @@
var c = getCoordinate( event );
var distance = function( pos )
{
- return (c.x-pos[0])*(c.x-pos[0]) + (c.y-pos[1])*(c.y-pos[1]);
+ return (c.x-pos.x)*(c.x-pos.x) + (c.y-pos.y)*(c.y-pos.y);
}
if( connectionLookingForInPort )
{
@@ -374,7 +424,7 @@
var smallestDistancePort = -1;
for( var i = 0; i < inPorts.length; i++ )
{
- var dist = distance( that.inPortPos(i) );
+ var dist = distance( that.inPortPos(i)[0] );
if( dist < smallestDistance )
{
smallestDistance = dist;
Modified: PyWireGate/trunk/logic_editor/gle/gle.connection.js
===================================================================
--- PyWireGate/trunk/logic_editor/gle/gle.connection.js 2011-01-16 15:39:18 UTC (rev 258)
+++ PyWireGate/trunk/logic_editor/gle/gle.connection.js 2011-01-16 21:08:47 UTC (rev 259)
@@ -133,7 +133,7 @@
//console.log('cDMM', ed );
if( ed.extend )
{
- that.lastMove( [ed.origx - ed.startx + event.pageX, ed.origy - ed.starty + event.pageY], false );
+ that.lastMove( {x:ed.origx - ed.startx + event.pageX, y:ed.origy - ed.starty + event.pageY}, false );
} else {
paths[ed.obj[1]].path[ed.obj[2]][0] = ed.origx - ed.startx + event.pageX;
paths[ed.obj[1]].path[ed.obj[2]][1] = ed.origy - ed.starty + event.pageY;
@@ -186,20 +186,20 @@
var op = overPort;
if( !force && op && op.type == 'inPort' )
{
- pos = op.block.inPortPos( op.number );
+ pos = op.block.inPortPos( op.number )[0];
}
if( force || (op && op.type == 'inPort') )
{
paths[branch].target = op;
- if( Math.abs( start[1] - pos[1] ) > 1.0 )
- paths[branch].path.push( [ (pos[0]+start[0])/2, start[1] ] );
- paths[branch].path.push( [ (pos[0]+start[0])/2, pos[1] ] );
+ if( Math.abs( start[1] - pos.y ) > 1.0 )
+ paths[branch].path.push( [ (pos.x+start[0])/2, start[1] ] );
+ paths[branch].path.push( [ (pos.x+start[0])/2, pos.y ] );
} else {
paths[branch].target = undefined;
- if( Math.abs( start[1] - pos[1] ) > 1.0 )
- paths[branch].path.push( [ pos[0], start[1] ] );
+ if( Math.abs( start[1] - pos.y ) > 1.0 )
+ paths[branch].path.push( [ pos.x, start[1] ] );
}
- paths[branch].path.push( pos );
+ paths[branch].path.push( [pos.x, pos.y] );
draw();
}
Modified: PyWireGate/trunk/logic_editor/logicEditor.js
===================================================================
--- PyWireGate/trunk/logic_editor/logicEditor.js 2011-01-16 15:39:18 UTC (rev 258)
+++ PyWireGate/trunk/logic_editor/logicEditor.js 2011-01-16 21:08:47 UTC (rev 259)
@@ -104,6 +104,22 @@
line(-10.0, 0.0).
close()
);
+ marker = svg.marker( defs, 'EmptyInPort', 0.0, 0.0, 10, 10, 'auto', {style:'overflow:visible'} );
+ var path = svg.createPath();
+ svg.path( marker, path.
+ move(-5.0,-5.0).
+ line( 0.0, 0.0).
+ line(-5.0, 5.0).
+ close()
+ );
+ marker = svg.marker( defs, 'EmptyOutPort', 0.0, 0.0, 10, 10, 'auto', {style:'overflow:visible'} );
+ var path = svg.createPath();
+ svg.path( marker, path.
+ move( 0.0,-5.0).
+ line( 5.0, 0.0).
+ line( 0.0, 5.0).
+ close()
+ );
});
function drawLibrary()
@@ -113,11 +129,11 @@
$.each( this, function( element ){
var entry = $('<div class="libEntry"><div class="libEntryName">'+element+'</div></div>');
var obj = this;
- var width = this.width+16;
- var height = this.height+6;
+ var width = this.width+20;
+ var height = this.height+20;
entry.prepend(
$('<div style="width:'+width+'px;height:'+height+'px;" ></div>').
- svg({onLoad:function(svg){drawElement(svg,obj,false);},settings:{width:width,height:height}}).
+ svg({onLoad:function(svg){drawElement(svg,obj,false);},settings:{width:width,height:height,viewBox:'-10 -10 '+width+' '+height}}).
data( 'element', obj ).
draggable({helper: function (e,ui) {
return $(this).clone().appendTo('body').css('zIndex',5).show();
@@ -205,6 +221,15 @@
});
/**
+ * Calculate the current zoom factor
+ * a zoom factor of 10 equals 100%
+ */
+function zoomFactor()
+{
+ return Math.pow( Math.sqrt(2), 10-zoomLevel );
+}
+
+/**
* Zoom the editor canvas.
* level == -1 : zoom out
* level == 0 : NOP
@@ -223,12 +248,12 @@
var svg = $('#editor svg')[0];
var x = Math.max( maxX, editor.innerWidth() );
var y = Math.max( maxY, editor.innerHeight() );
- var factor = Math.pow(Math.sqrt(2),10-zoomLevel);
+ var factor = zoomFactor();
$('#zoomLevel').html( (100*factor).toFixed() + '%' );
- if( zoomLevel < 10 )
+ if( factor > 1 )
{
- svg.width.baseVal.value = x* factor;
- svg.height.baseVal.value = y* factor;
+ svg.width.baseVal.value = x * factor;
+ svg.height.baseVal.value = y * factor;
svg.viewBox.baseVal.width = x;
svg.viewBox.baseVal.height = y;
} else {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-01-16 21:31:19
|
Revision: 260
http://openautomation.svn.sourceforge.net/openautomation/?rev=260&view=rev
Author: mayerch
Date: 2011-01-16 21:31:13 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
Much bigger handle to start connection (+ little clean up)
Modified Paths:
--------------
PyWireGate/trunk/logic_editor/gle/gle.block.js
PyWireGate/trunk/logic_editor/logicEditor.css
Modified: PyWireGate/trunk/logic_editor/gle/gle.block.js
===================================================================
--- PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-01-16 21:08:47 UTC (rev 259)
+++ PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-01-16 21:31:13 UTC (rev 260)
@@ -128,12 +128,8 @@
if( 'connection' in this )
canvas.line( g, p[0].x, p[0].y, p[1].x, p[1].y, style );
else {
- var parameter = {
- stroke: '#ff0000',//colorByArray( origin.getColor() ),
- 'marker-end' : 'url(#EmptyInPort)'
- };
editorConnectionPointCreate(
- canvas.line( g, p[1].x, p[1].y, p[0].x, p[0].y, parameter )
+ canvas.line( g, p[1].x, p[1].y, p[0].x, p[0].y, {'marker-end': 'url(#EmptyInPort)'} )
, 'inPort', i );
}
if( maskOptions.showLabel )
@@ -149,18 +145,18 @@
p[1].x -= x; p[1].y -= y; // translate back as we are in a transform
if( 'connection' in this )
canvas.line( g, p[0].x, p[0].y, p[1].x, p[1].y, style );
- else
- //editorConnectionPointCreate( canvas.polyline( g, [[width+6, y-4],[width+11, y],[width+6, y+4]], style ), 'outPort', i );
- var parameter = {
- stroke: '#ff0000',//colorByArray( origin.getColor() ),
- 'marker-start' : 'url(#EmptyOutPort)'
- };
+ else {
+ canvas.line( g, p[0].x, p[0].y, p[1].x, p[1].y, {'marker-start': 'url(#EmptyOutPort)'})
editorConnectionPointCreate(
- canvas.line( g, p[0].x, p[0].y, p[1].x, p[1].y, parameter )
- , 'outPort', i );
- if( maskOptions.showLabel )
- canvas.text( g, 2*p[0].x-p[1].x, 2*p[0].y-p[1].y, this.name,
- {'dominant-baseline':'middle','text-anchor':'end'} );
+ canvas.rect( g,
+ p[0].x, p[0].y-2*inset, 2*(inset+outset), 2*(inset+outset),
+ {'class':'hiddenHandle'} ),
+ 'outPort', i
+ );
+ if( maskOptions.showLabel )
+ canvas.text( g, 2*p[0].x-p[1].x, 2*p[0].y-p[1].y, this.name,
+ {'dominant-baseline':'middle','text-anchor':'end'} );
+ }
});
// shotcut
Modified: PyWireGate/trunk/logic_editor/logicEditor.css
===================================================================
--- PyWireGate/trunk/logic_editor/logicEditor.css 2011-01-16 21:08:47 UTC (rev 259)
+++ PyWireGate/trunk/logic_editor/logicEditor.css 2011-01-16 21:31:13 UTC (rev 260)
@@ -64,6 +64,10 @@
cursor: sw-resize;
}
+.hiddenHandle {
+ opacity: 0;
+}
+
.ui-layout-pane { /* all 'panes' */
border: 1px solid #BBB;
overflow: auto;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-01-22 13:30:18
|
Revision: 262
http://openautomation.svn.sourceforge.net/openautomation/?rev=262&view=rev
Author: mayerch
Date: 2011-01-22 13:30:12 +0000 (Sat, 22 Jan 2011)
Log Message:
-----------
* make handles work in zoomed mode
* fix bug that didn't show labels once a port was connected
* removed unnecessary stub lines on connected block ports
* optimized connection redrawing (change instead of delete and paint)
Modified Paths:
--------------
PyWireGate/trunk/logic_editor/gle/gle.block.js
PyWireGate/trunk/logic_editor/gle/gle.connection.js
PyWireGate/trunk/logic_editor/logicEditor.css
PyWireGate/trunk/logic_editor/logicEditor.js
Modified: PyWireGate/trunk/logic_editor/gle/gle.block.js
===================================================================
--- PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-01-20 21:01:22 UTC (rev 261)
+++ PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-01-22 13:30:12 UTC (rev 262)
@@ -126,7 +126,7 @@
p[0].x -= x; p[0].y -= y; // translate back as we are in a transform
p[1].x -= x; p[1].y -= y; // translate back as we are in a transform
if( 'connection' in this )
- canvas.line( g, p[0].x, p[0].y, p[1].x, p[1].y, style );
+ ;//canvas.line( g, p[0].x, p[0].y, p[1].x, p[1].y, style );
else {
editorConnectionPointCreate(
canvas.line( g, p[1].x, p[1].y, p[0].x, p[0].y, {'marker-end': 'url(#EmptyInPort)'} )
@@ -144,7 +144,7 @@
p[0].x -= x; p[0].y -= y; // translate back as we are in a transform
p[1].x -= x; p[1].y -= y; // translate back as we are in a transform
if( 'connection' in this )
- canvas.line( g, p[0].x, p[0].y, p[1].x, p[1].y, style );
+ ;//canvas.line( g, p[0].x, p[0].y, p[1].x, p[1].y, style );
else {
canvas.line( g, p[0].x, p[0].y, p[1].x, p[1].y, {'marker-start': 'url(#EmptyOutPort)'})
editorConnectionPointCreate(
@@ -153,10 +153,10 @@
{'class':'hiddenHandle'} ),
'outPort', i
);
- if( maskOptions.showLabel )
- canvas.text( g, 2*p[0].x-p[1].x, 2*p[0].y-p[1].y, this.name,
- {'dominant-baseline':'middle','text-anchor':'end'} );
}
+ if( maskOptions.showLabel )
+ canvas.text( g, 2*p[0].x-p[1].x, 2*p[0].y-p[1].y, this.name,
+ {'dominant-baseline':'middle','text-anchor':'end'} );
});
// shotcut
Modified: PyWireGate/trunk/logic_editor/gle/gle.connection.js
===================================================================
--- PyWireGate/trunk/logic_editor/gle/gle.connection.js 2011-01-20 21:01:22 UTC (rev 261)
+++ PyWireGate/trunk/logic_editor/gle/gle.connection.js 2011-01-22 13:30:12 UTC (rev 262)
@@ -49,13 +49,10 @@
function draw()
{
var classList = 'connection';
- if( g )
+ if( !g ) // no lines yet? Create it...
{
- classList = g.getAttribute('class');
- g.parentNode.removeChild( g ); // delete the old representation
+ g = canvas.group( { 'class':classList } );
}
- g = canvas.group( { 'class':classList } );
-
var parameter = {
class: classList,
stroke: colorByArray( origin.getColor() ),
@@ -63,14 +60,21 @@
'marker-end' : 'url(#ArrowEnd)',
fill: 'none'
};
+
+ var lines = $(g).find( 'polyline' );
for( var i in paths )
{
+ if( lines[i] === undefined )
+ lines[i] = canvas.polyline( g, [], parameter );
+
+ lines[i].setAttribute('points', paths[i].path.join(',') );
if( paths[i].target == undefined || origin == undefined )
- parameter['stroke-dasharray'] = '1,3';
+ lines[i].setAttribute('stroke-dasharray', '1,3' );
else
- parameter['stroke-dasharray'] = 'none';
- var x = canvas.polyline( g, paths[i].path, parameter );
+ lines[i].setAttribute('stroke-dasharray', 'none' );
}
+ for( var i = lines.length-1; i > paths.length; i-- )
+ lines.remove( i );
// shotcut
function connectionDrag( obj, handle )
@@ -78,6 +82,8 @@
$(handle).bind( 'mousedown', {obj:obj}, connectionDragMouseDown );
}
+ // delete old handles
+ $(g).find('rect').remove();
// Draw the handles
for( var i in paths )
{
@@ -130,13 +136,30 @@
function editorDragMouseMove( event )
{
var ed = event.data;
+ var pos = getCoordinate(event);
//console.log('cDMM', ed );
if( ed.extend )
{
- that.lastMove( {x:ed.origx - ed.startx + event.pageX, y:ed.origy - ed.starty + event.pageY}, false );
+ that.lastMove( pos, false );
} else {
- paths[ed.obj[1]].path[ed.obj[2]][0] = ed.origx - ed.startx + event.pageX;
- paths[ed.obj[1]].path[ed.obj[2]][1] = ed.origy - ed.starty + event.pageY;
+ var path = paths[ed.obj[1]].path;
+ var i = parseInt( ed.obj[2] );
+ if( path[i-1] !== undefined )
+ {
+ if( Math.abs( path[i-1][0] - path[i][0] ) < 1.0 )
+ path[i-1][0] = pos.x;
+ if( Math.abs( path[i-1][1] - path[i][1] ) < 1.0 )
+ path[i-1][1] = pos.y;
+ }
+ if( path[i+1] !== undefined )
+ {
+ if( Math.abs( path[i+1][0] - path[i][0] ) < 1.0 )
+ path[i+1][0] = pos.x;
+ if( Math.abs( path[i+1][1] - path[i][1] ) < 1.0 )
+ path[i+1][1] = pos.y;
+ }
+ path[i][0] = pos.x;
+ path[i][1] = pos.y;
draw();
}
}
@@ -181,6 +204,7 @@
this.lastMove = function( pos, force )
{
+ if( lastFixed < 0 ) lastFixed = 0; // sanity check...
while( paths[branch].path.length > lastFixed+1 )
paths[branch].path.pop();
var start = paths[branch].path[ paths[branch].path.length - 1 ];
Modified: PyWireGate/trunk/logic_editor/logicEditor.css
===================================================================
--- PyWireGate/trunk/logic_editor/logicEditor.css 2011-01-20 21:01:22 UTC (rev 261)
+++ PyWireGate/trunk/logic_editor/logicEditor.css 2011-01-22 13:30:12 UTC (rev 262)
@@ -68,6 +68,11 @@
opacity: 0;
}
+polyline.connection {
+ stroke-width: 1;
+ fill : none;
+}
+
.ui-layout-pane { /* all 'panes' */
border: 1px solid #BBB;
overflow: auto;
Modified: PyWireGate/trunk/logic_editor/logicEditor.js
===================================================================
--- PyWireGate/trunk/logic_editor/logicEditor.js 2011-01-20 21:01:22 UTC (rev 261)
+++ PyWireGate/trunk/logic_editor/logicEditor.js 2011-01-22 13:30:12 UTC (rev 262)
@@ -202,10 +202,7 @@
if( y > maxY ) maxY = y;
});
maxX += extraSpace; maxY += extraSpace;
- var editor = $('#editor');
- var svg = $('#editor svg')[0];
- svg.width.baseVal.value = Math.max( maxX, editor.innerWidth() );
- svg.height.baseVal.value = Math.max( maxY, editor.innerHeight() );
+ zoomEditor( 0 ); // resize with current zoom level
}
jQuery(document).ready(function(){
@@ -214,8 +211,9 @@
var editor = $('#editor'); // quasi static variable
return function( event ) {
var o = editor.offset();
- return {x: event.pageX - o.left + editor.scrollLeft(),
- y: event.pageY - o.top + editor.scrollTop () };
+ var factor = zoomFactor();
+ return {x: (event.pageX - o.left + editor.scrollLeft()) / factor,
+ y: (event.pageY - o.top + editor.scrollTop ()) / factor};
};
})();
});
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-01-22 20:48:35
|
Revision: 266
http://openautomation.svn.sourceforge.net/openautomation/?rev=266&view=rev
Author: mayerch
Date: 2011-01-22 20:48:26 +0000 (Sat, 22 Jan 2011)
Log Message:
-----------
remove debuging output
Modified Paths:
--------------
PyWireGate/trunk/logic_editor/gle/gle.block.js
PyWireGate/trunk/logic_editor/gle/gle.connection.js
PyWireGate/trunk/logic_editor/logicEditor.js
Modified: PyWireGate/trunk/logic_editor/gle/gle.block.js
===================================================================
--- PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-01-22 15:20:19 UTC (rev 265)
+++ PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-01-22 20:48:26 UTC (rev 266)
@@ -196,9 +196,9 @@
function editorDragMouseDown( event )
{
- console.log( 'eDMD', event );
+ //console.log( 'eDMD', event );
var classList = this.getAttribute('class').split(' ');
- console.log( 'eDMD', classList );
+ //console.log( 'eDMD', classList );
var type = 'move';
for( var i = 0; i < classList.length; i++ )
if( classList[i] != '' && classList[i] != 'selected' && classList[i] != 'block' ) type = classList[i];
@@ -364,7 +364,7 @@
function editorConnectionPointDrag( event )
{
- console.log( 'Block: eCPD', event );
+ //console.log( 'Block: eCPD', event );
var pn = event.data.portNumber;
var pt = event.data.portType;
var op = that.outPortPos( pn )[0];
@@ -390,7 +390,7 @@
function editorConnectionPointMouseUp( event )
{
- console.log( 'eCPMU' );
+ //console.log( 'eCPMU' );
$(document).unbind( 'mousemove', editorConnectionPointMouseMove );
$(document).unbind( 'mouseup' , editorConnectionPointMouseUp );
var target = event.data.con.lastTarget();
@@ -402,7 +402,7 @@
function editorConnectionPointOverPort( event )
{
- console.log( 'eCPOP', event.data.portType );
+ //console.log( 'eCPOP', event.data.portType );
if( event.data.portType !== undefined && event.data.portNumber !== undefined )
{
overPort = {
@@ -442,7 +442,7 @@
function editorConnectionPointOverPortOut( event )
{
- console.log( 'eCPOPO' );
+ //console.log( 'eCPOPO' );
overPort = false;
}
}
Modified: PyWireGate/trunk/logic_editor/gle/gle.connection.js
===================================================================
--- PyWireGate/trunk/logic_editor/gle/gle.connection.js 2011-01-22 15:20:19 UTC (rev 265)
+++ PyWireGate/trunk/logic_editor/gle/gle.connection.js 2011-01-22 20:48:26 UTC (rev 266)
@@ -102,10 +102,10 @@
function connectionDragMouseDown( event )
{
- console.log( 'cDMD', event );
+ //console.log( 'cDMD', event );
var classList = this.getAttribute('class').split(' ');
- console.log( 'cDMD', classList );
- console.log( 'cDMD', event.data.obj );
+ //console.log( 'cDMD', classList );
+ //console.log( 'cDMD', event.data.obj );
var path = paths[ event.data.obj[1] ].path;
var extend = event.data.obj[2] == path.length - 1
@@ -204,7 +204,7 @@
Math.abs( paths[0].path[1][0] - paths[0].path[2][0] ) < 1.0 &&
Math.abs( paths[0].path[1][1] - paths[0].path[2][1] ) < 1.0 )
{
- console.log( 'firstMove', paths[0].path.length );
+ //console.log( 'firstMove', paths[0].path.length );
lastFixed -= 2;
paths[0].path.shift(); // remove front
paths[0].path.shift(); // remove first identical
Modified: PyWireGate/trunk/logic_editor/logicEditor.js
===================================================================
--- PyWireGate/trunk/logic_editor/logicEditor.js 2011-01-22 15:20:19 UTC (rev 265)
+++ PyWireGate/trunk/logic_editor/logicEditor.js 2011-01-22 20:48:26 UTC (rev 266)
@@ -264,19 +264,23 @@
////////////////////////
// FIXME - delete it later, this are just helpers for debugging
-function _showEvents( target )
+function _showEvents( target, doLog )
{
var count = 0;
- jQuery.each($(target || '*'), function(j){
+ jQuery.each($(target || '*'), function(j,element){
//console.log( j, this );
var that = this;
var d = $(this).data();
if( d.events )
{
- console.log( count, this );
+ console.log( count, element );
jQuery.each( d.events, function( i, handler ){
//console.log( j, i, handler[0].handler.toString() );
console.log( count, i, handler[0].handler );
+ if( doLog )
+ {
+ $(element).bind( i, function(){} );
+ }
});
count++;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-01-30 15:19:42
|
Revision: 272
http://openautomation.svn.sourceforge.net/openautomation/?rev=272&view=rev
Author: mayerch
Date: 2011-01-30 15:19:36 +0000 (Sun, 30 Jan 2011)
Log Message:
-----------
* Bug fix: resize of masked blockes that were using an arc
* resized gain and sum block
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-23 21:17:35 UTC (rev 271)
+++ PyWireGate/trunk/logic_editor/backendCommunication.js 2011-01-30 15:19:36 UTC (rev 272)
@@ -86,8 +86,8 @@
},
'mathLib': {
'gain': {
- 'width': 100,
- 'height': 100,
+ 'width': 75,
+ 'height': 75,
'rotation': 0,
'flip': false,
'color': [0.0, 0.0, 0.0],
@@ -121,8 +121,8 @@
]
},
'sum': {
- 'width': 100,
- 'height': 100,
+ 'width': 50,
+ 'height': 50,
'rotation': 0,
'flip': false,
'color': [0.0, 0.0, 0.0],
@@ -130,7 +130,7 @@
'mask': [
{ 'type': 'move', 'x': 0 , 'y': 0.495 },
{ 'type': 'arc' , 'x': 0 , 'y': 0.01 ,
- 'rx': 50, 'ry': 50, 'xRotate':0, 'large':true, 'clockwise': true,
+ 'rx': 0.5, 'ry': 0.5, 'xRotate':0, 'large':true, 'clockwise': true,
'relative': true
},
{ 'type': 'close' }
Modified: PyWireGate/trunk/logic_editor/gle/gle.block.js
===================================================================
--- PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-01-23 21:17:35 UTC (rev 271)
+++ PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-01-30 15:19:36 UTC (rev 272)
@@ -101,7 +101,9 @@
break;
case 'arc':
- path.arc( obj.rx, obj.ry, obj.xRotate, obj.large, obj.clockwise, sx, sy, obj.relative );
+ var rx = scaleRelPos( obj.rx, width );
+ var ry = scaleRelPos( obj.ry, height );
+ path.arc( rx, ry, obj.xRotate, obj.large, obj.clockwise, sx, sy, obj.relative );
break;
case 'close':
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-01-30 15:47:09
|
Revision: 273
http://openautomation.svn.sourceforge.net/openautomation/?rev=273&view=rev
Author: mayerch
Date: 2011-01-30 15:47:02 +0000 (Sun, 30 Jan 2011)
Log Message:
-----------
Added new stub block (an integral) and extended the drawing mechanism for that
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 15:19:36 UTC (rev 272)
+++ PyWireGate/trunk/logic_editor/backendCommunication.js 2011-01-30 15:47:02 UTC (rev 273)
@@ -93,7 +93,7 @@
'color': [0.0, 0.0, 0.0],
'background': [1.0, 1.0, 1.0],
'mask': [
- { 'type': 'move', 'x': 0.999, 'y': 0.5 }, // just to show what's possible
+ { 'type': 'move', 'x': 0.999, 'y': 0.5 }, // it must allways start with a move!
{ 'type': 'line', 'x': 0 , 'y': 0.999 },
{ 'type': 'line', 'x': 0 , 'y': 0 },
{ 'type': 'close' }
@@ -192,6 +192,49 @@
'default': '|++'
}
]
+ },
+ 'integral': {
+ 'width': 75,
+ 'height': 75,
+ 'rotation': 0,
+ 'flip': false,
+ 'color': [0.0, 0.0, 0.0],
+ 'background': [1.0, 1.0, 1.0],
+ 'mask': [
+ { 'type': 'move', 'x': 0 , 'y': 0 }, // it must allways start with a move!
+ { 'type': 'line', 'x': 0 , 'y': 0.999 },
+ { 'type': 'line', 'x': 0.999, 'y': 0.999 },
+ { 'type': 'line', 'x': 0.999, 'y': 0 },
+ { 'type': 'close' },
+ { 'type': 'new', 'fill': 'none' },
+ { 'type': 'move', 'x': 0.55 , 'y': 0.1 },
+ { 'type': 'arc' , 'x': 0.50 , 'y': 0.1 ,
+ 'rx': 0.025, 'ry': 0.025, 'xRotate':0, 'large':true, 'clockwise': false,
+ 'relative': false
+ },
+ { 'type': 'line', 'x': 0.5 , 'y': 0.9 },
+ { 'type': 'arc' , 'x': 0.45 , 'y': 0.9 ,
+ 'rx': 0.025, 'ry': 0.025, 'xRotate':0, 'large':true, 'clockwise': true,
+ 'relative': false
+ }
+ ],
+ 'maskOptions': {
+ 'showLabel': false
+ },
+ 'inPorts': [
+ {
+ 'name': 'in',
+ 'type': 'event'
+ }
+ ],
+ 'outPorts': [
+ {
+ 'name': 'out',
+ 'type': 'event'
+ }
+ ],
+ 'parameters': [
+ ]
}
}
};
Modified: PyWireGate/trunk/logic_editor/gle/gle.block.js
===================================================================
--- PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-01-30 15:19:36 UTC (rev 272)
+++ PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-01-30 15:47:02 UTC (rev 273)
@@ -109,6 +109,12 @@
case 'close':
path.close();
break;
+
+ case 'new': // start a new path
+ canvas.path( body, path, style );
+ if( obj.fill !== undefined ) style.fill = obj.fill;
+ path = canvas.createPath();
+ break;
}
}
canvas.path( body, path, style );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-01-30 21:03:39
|
Revision: 274
http://openautomation.svn.sourceforge.net/openautomation/?rev=274&view=rev
Author: mayerch
Date: 2011-01-30 21:03:32 +0000 (Sun, 30 Jan 2011)
Log Message:
-----------
Initial support for parameter dialogs
Modified Paths:
--------------
PyWireGate/trunk/logic_editor/gle/gle.block.js
PyWireGate/trunk/logic_editor/index.html
Added Paths:
-----------
PyWireGate/trunk/logic_editor/lib/images/
PyWireGate/trunk/logic_editor/lib/images/ui-bg_flat_0_aaaaaa_40x100.png
PyWireGate/trunk/logic_editor/lib/images/ui-bg_flat_75_ffffff_40x100.png
PyWireGate/trunk/logic_editor/lib/images/ui-bg_glass_55_fbf9ee_1x400.png
PyWireGate/trunk/logic_editor/lib/images/ui-bg_glass_65_ffffff_1x400.png
PyWireGate/trunk/logic_editor/lib/images/ui-bg_glass_75_dadada_1x400.png
PyWireGate/trunk/logic_editor/lib/images/ui-bg_glass_75_e6e6e6_1x400.png
PyWireGate/trunk/logic_editor/lib/images/ui-bg_glass_95_fef1ec_1x400.png
PyWireGate/trunk/logic_editor/lib/images/ui-bg_highlight-soft_75_cccccc_1x100.png
PyWireGate/trunk/logic_editor/lib/images/ui-icons_222222_256x240.png
PyWireGate/trunk/logic_editor/lib/images/ui-icons_2e83ff_256x240.png
PyWireGate/trunk/logic_editor/lib/images/ui-icons_454545_256x240.png
PyWireGate/trunk/logic_editor/lib/images/ui-icons_888888_256x240.png
PyWireGate/trunk/logic_editor/lib/images/ui-icons_cd0a0a_256x240.png
PyWireGate/trunk/logic_editor/lib/jquery-ui.css
Modified: PyWireGate/trunk/logic_editor/gle/gle.block.js
===================================================================
--- PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-01-30 15:47:02 UTC (rev 273)
+++ PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-01-30 21:03:32 UTC (rev 274)
@@ -121,6 +121,8 @@
} else {
canvas.rect( body, 0, 0, width, height, style );
}
+ if( addEvent && !$.isEmptyObject(parameters) )
+ $(body).dblclick(that.showParameterMenu);
editorConnectionPointCreate( body, undefined, undefined );
// extend the style for the ports...
@@ -347,6 +349,40 @@
};
}
+ this.showParameterMenu = function()
+ {
+ //alert('sPM');
+ var dialog = $('<div title="Change parameters"></div>');
+ for( var i = 0; i < parameters.length; i++ )
+ {
+ var line = '<label for="' + parameters[i].name + '">' + parameters[i].name + '</label>';
+ line += '<input type="' + parameters[i].type + '" ';
+ line += ' name="' + parameters[i].name + '" ';
+ line += ' value="' + parameter[ parameters[i].name ] + '" ';
+ line += ' class="text ui-widget-content ui-corner-all" />';
+
+ dialog.append( $( line ) );
+ }
+ dialog.dialog({
+ modal: true,
+ buttons: {
+ OK : function() {
+ $('.ui-dialog input').each(function(){
+ parameter[ this.name ] = this.value;
+ });
+ $( this ).dialog( 'close' );
+ draw();
+ },
+ Cancel: function() {
+ $( this ).dialog( 'close' );
+ }
+ },
+ close: function() {}
+
+ });
+
+ }
+
// finally draw itself:
draw();
Modified: PyWireGate/trunk/logic_editor/index.html
===================================================================
--- PyWireGate/trunk/logic_editor/index.html 2011-01-30 15:47:02 UTC (rev 273)
+++ PyWireGate/trunk/logic_editor/index.html 2011-01-30 21:03:32 UTC (rev 274)
@@ -6,6 +6,7 @@
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Graphical Logic Editor</title>
<link rel="stylesheet" href="logicEditor.css" type="text/css" />
+ <link rel="stylesheet" href="lib/jquery-ui.css" type="text/css" />
<script type="text/javascript" src="lib/jquery-1.4.4.js"></script>
<script type="text/javascript" src="lib/jquery-ui-1.8.7.custom.min.js"></script>
<script type="text/javascript" src="lib/jquery.svg.js"></script>
Added: PyWireGate/trunk/logic_editor/lib/images/ui-bg_flat_0_aaaaaa_40x100.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/lib/images/ui-bg_flat_0_aaaaaa_40x100.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/lib/images/ui-bg_flat_75_ffffff_40x100.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/lib/images/ui-bg_flat_75_ffffff_40x100.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/lib/images/ui-bg_glass_55_fbf9ee_1x400.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/lib/images/ui-bg_glass_55_fbf9ee_1x400.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/lib/images/ui-bg_glass_65_ffffff_1x400.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/lib/images/ui-bg_glass_65_ffffff_1x400.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/lib/images/ui-bg_glass_75_dadada_1x400.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/lib/images/ui-bg_glass_75_dadada_1x400.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/lib/images/ui-bg_glass_75_e6e6e6_1x400.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/lib/images/ui-bg_glass_75_e6e6e6_1x400.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/lib/images/ui-bg_glass_95_fef1ec_1x400.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/lib/images/ui-bg_glass_95_fef1ec_1x400.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/lib/images/ui-bg_highlight-soft_75_cccccc_1x100.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/lib/images/ui-bg_highlight-soft_75_cccccc_1x100.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/lib/images/ui-icons_222222_256x240.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/lib/images/ui-icons_222222_256x240.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/lib/images/ui-icons_2e83ff_256x240.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/lib/images/ui-icons_2e83ff_256x240.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/lib/images/ui-icons_454545_256x240.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/lib/images/ui-icons_454545_256x240.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/lib/images/ui-icons_888888_256x240.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/lib/images/ui-icons_888888_256x240.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/lib/images/ui-icons_cd0a0a_256x240.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/lib/images/ui-icons_cd0a0a_256x240.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/lib/jquery-ui.css
===================================================================
--- PyWireGate/trunk/logic_editor/lib/jquery-ui.css (rev 0)
+++ PyWireGate/trunk/logic_editor/lib/jquery-ui.css 2011-01-30 21:03:32 UTC (rev 274)
@@ -0,0 +1,573 @@
+/*
+ * jQuery UI CSS Framework 1.8.9
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Theming/API
+ */
+
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden { display: none; }
+.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
+.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+.ui-helper-clearfix { display: inline-block; }
+/* required comment for clearfix to work in Opera \*/
+* html .ui-helper-clearfix { height:1%; }
+.ui-helper-clearfix { display:block; }
+/* end clearfix */
+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled { cursor: default !important; }
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+
+
+/*
+ * jQuery UI CSS Framework 1.8.9
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Theming/API
+ *
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
+ */
+
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
+.ui-widget .ui-widget { font-size: 1em; }
+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
+.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
+.ui-widget-content a { color: #222222; }
+.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
+.ui-widget-header a { color: #222222; }
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
+.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
+.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
+.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }
+.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
+.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
+.ui-widget :active { outline: none; }
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
+.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
+.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
+.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
+.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
+.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
+.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
+.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
+.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
+.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
+.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
+.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
+.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
+.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
+.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
+
+/* positioning */
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background-position: -16px -144px; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-off { background-position: -96px -144px; }
+.ui-icon-radio-on { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-start { background-position: -80px -160px; }
+/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; }
+.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
+.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
+.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
+.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
+.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }
+
+/* Overlays */
+.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
+.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*
+ * jQuery UI Resizable 1.8.9
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Resizable#theming
+ */
+.ui-resizable { position: relative;}
+.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
+.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
+.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
+.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
+.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
+.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
+.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
+.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
+.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
+.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
+ * jQuery ...
[truncated message content] |
|
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.
|
|
From: <ma...@us...> - 2011-02-04 19:54:05
|
Revision: 276
http://openautomation.svn.sourceforge.net/openautomation/?rev=276&view=rev
Author: mayerch
Date: 2011-02-04 19:53:58 +0000 (Fri, 04 Feb 2011)
Log Message:
-----------
Add stub at the connection target
Modified Paths:
--------------
PyWireGate/trunk/logic_editor/backendCommunication.js
PyWireGate/trunk/logic_editor/gle/gle.block.js
PyWireGate/trunk/logic_editor/gle/gle.connection.js
Modified: PyWireGate/trunk/logic_editor/backendCommunication.js
===================================================================
--- PyWireGate/trunk/logic_editor/backendCommunication.js 2011-02-04 17:45:32 UTC (rev 275)
+++ PyWireGate/trunk/logic_editor/backendCommunication.js 2011-02-04 19:53:58 UTC (rev 276)
@@ -159,8 +159,8 @@
var c = Math.cos( angle );
return [ { x: x + width * 0.5 * ( 1 + c ),
y: y + height * 0.5 * ( 1 - s ) },
- { x: x + width * 0.5 + (width +5) * 0.5 * c,
- y: y + height * 0.5 - (height+5) * 0.5 * s }
+ { x: x + width * 0.5 + (width +40) * 0.5 * c,
+ y: y + height * 0.5 - (height+40) * 0.5 * s }
];
}
nr--;
Modified: PyWireGate/trunk/logic_editor/gle/gle.block.js
===================================================================
--- PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-02-04 17:45:32 UTC (rev 275)
+++ PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-02-04 19:53:58 UTC (rev 276)
@@ -144,7 +144,7 @@
, 'inPort', i );
}
if( maskOptions.showLabel )
- canvas.text( g, 2*p[0].x-p[1].x, 2*p[0].y-p[1].y, this.name,
+ canvas.text( g, 1.2*p[0].x-0.2*p[1].x, 1.2*p[0].y-0.2*p[1].y, this.name,
{'dominant-baseline':'middle','text-anchor':'start'} );
});
@@ -166,7 +166,7 @@
);
}
if( maskOptions.showLabel )
- canvas.text( g, 2*p[0].x-p[1].x, 2*p[0].y-p[1].y, this.name,
+ canvas.text( g, 1.2*p[0].x-0.2*p[1].x, 1.2*p[0].y-0.2*p[1].y, this.name,
{'dominant-baseline':'middle','text-anchor':'end'} );
});
@@ -331,15 +331,15 @@
return maskOptions.inPortPos( number, that, maskOptions, parameter );
} else
return [
- { x: x , y: y + height * (0.5 + number) / inPorts.length },
- { x: x - 5, y: y + height * (0.5 + number) / inPorts.length }
+ { x: x , y: y + height * (0.5 + number) / inPorts.length },
+ { x: x - 20, y: y + height * (0.5 + number) / inPorts.length }
];
}
this.outPortPos = function( number )
{
return [
- { x: x + width , y: y + height * (0.5 + number) / outPorts.length },
- { x: x + width + 5, y: y + height * (0.5 + number) / outPorts.length }
+ { x: x + width , y: y + height * (0.5 + number) / outPorts.length },
+ { x: x + width + 20, y: y + height * (0.5 + number) / outPorts.length }
];
}
Modified: PyWireGate/trunk/logic_editor/gle/gle.connection.js
===================================================================
--- PyWireGate/trunk/logic_editor/gle/gle.connection.js 2011-02-04 17:45:32 UTC (rev 275)
+++ PyWireGate/trunk/logic_editor/gle/gle.connection.js 2011-02-04 19:53:58 UTC (rev 276)
@@ -217,9 +217,11 @@
}
//console.log( 'extend', dir, i, path.length, lastFixed, path, lastPoint );
var op = overPort;
+ var prePos = undefined;
if( op && op.type == 'inPort' )
{
- pos = op.block.inPortPos( op.number )[0];
+ pos = op.block.inPortPos( op.number )[1];
+ prePos = op.block.inPortPos( op.number )[0];
paths[branch].target = op;
} else
paths[branch].target = undefined;
@@ -263,6 +265,8 @@
break;
}
path.push( [ pos.x, pos.y ] );
+ if( prePos )
+ path.push( [ prePos.x, prePos.y ] );
} else {
if( path[i-1] !== undefined )
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-02-04 21:12:00
|
Revision: 277
http://openautomation.svn.sourceforge.net/openautomation/?rev=277&view=rev
Author: mayerch
Date: 2011-02-04 21:11:53 +0000 (Fri, 04 Feb 2011)
Log Message:
-----------
Make connections selectable
Modified Paths:
--------------
PyWireGate/trunk/logic_editor/gle/gle.connection.js
PyWireGate/trunk/logic_editor/logicEditor.css
Modified: PyWireGate/trunk/logic_editor/gle/gle.connection.js
===================================================================
--- PyWireGate/trunk/logic_editor/gle/gle.connection.js 2011-02-04 19:53:58 UTC (rev 276)
+++ PyWireGate/trunk/logic_editor/gle/gle.connection.js 2011-02-04 21:11:53 UTC (rev 277)
@@ -66,14 +66,19 @@
var lines = $(g).find( 'polyline' );
for( var i in paths )
{
- if( lines[i] === undefined )
- lines[i] = canvas.polyline( g, [], parameter );
+ if( lines[i*2] === undefined )
+ {
+ lines[i*2 ] = canvas.polyline( g, [], {fill:'none',style:'opacity:0;stroke:#fff;stroke-width:5px'} );
+ $( lines[i*2] ).click( function(){editorSelect(g);} );
+ lines[i*2+1] = canvas.polyline( g, [], parameter );
+ }
- lines[i].setAttribute('points', paths[i].path.join(',') );
+ lines[i*2 ].setAttribute('points', paths[i].path.join(',') );
+ lines[i*2+1].setAttribute('points', paths[i].path.join(',') );
if( paths[i].target == undefined || origin == undefined )
- lines[i].setAttribute('stroke-dasharray', '1,3' );
+ lines[i*2+1].setAttribute('stroke-dasharray', '1,3' );
else
- lines[i].setAttribute('stroke-dasharray', 'none' );
+ lines[i*2+1].setAttribute('stroke-dasharray', 'none' );
}
for( var i = lines.length-1; i > paths.length; i-- )
lines.remove( i );
Modified: PyWireGate/trunk/logic_editor/logicEditor.css
===================================================================
--- PyWireGate/trunk/logic_editor/logicEditor.css 2011-02-04 19:53:58 UTC (rev 276)
+++ PyWireGate/trunk/logic_editor/logicEditor.css 2011-02-04 21:11:53 UTC (rev 277)
@@ -40,11 +40,11 @@
margin-top: 1em;
}
-.ne-resize, .nw-resize, .se-resize, .sw-resize {
+.ne-resize, .nw-resize, .se-resize, .sw-resize, .move {
display: none;
}
-.selected .ne-resize, .selected .nw-resize, .selected .se-resize, .selected .sw-resize {
+.selected .ne-resize, .selected .nw-resize, .selected .se-resize, .selected .sw-resize, .selected .move {
display: inline;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-02-04 22:09:18
|
Revision: 279
http://openautomation.svn.sourceforge.net/openautomation/?rev=279&view=rev
Author: mayerch
Date: 2011-02-04 22:09:12 +0000 (Fri, 04 Feb 2011)
Log Message:
-----------
Initial support for deleting selected elements
Modified Paths:
--------------
PyWireGate/trunk/logic_editor/index.html
PyWireGate/trunk/logic_editor/logicEditor.js
Added Paths:
-----------
PyWireGate/trunk/logic_editor/lib/jquery.hotkeys.js
Modified: PyWireGate/trunk/logic_editor/index.html
===================================================================
--- PyWireGate/trunk/logic_editor/index.html 2011-02-04 21:25:52 UTC (rev 278)
+++ PyWireGate/trunk/logic_editor/index.html 2011-02-04 22:09:12 UTC (rev 279)
@@ -12,6 +12,7 @@
<script type="text/javascript" src="lib/jquery.svg.js"></script>
<script type="text/javascript" src="lib/jquery.layout.js"></script>
<script type="text/javascript" src="lib/jquery.jstree.js"></script>
+ <script type="text/javascript" src="lib/jquery.hotkeys.js"></script>
<script type="text/javascript" src="backendCommunication.js"></script>
<script type="text/javascript" src="gle/gle.block.js"></script>
<script type="text/javascript" src="gle/gle.connection.js"></script>
Added: PyWireGate/trunk/logic_editor/lib/jquery.hotkeys.js
===================================================================
--- PyWireGate/trunk/logic_editor/lib/jquery.hotkeys.js (rev 0)
+++ PyWireGate/trunk/logic_editor/lib/jquery.hotkeys.js 2011-02-04 22:09:12 UTC (rev 279)
@@ -0,0 +1,99 @@
+/*
+ * jQuery Hotkeys Plugin
+ * Copyright 2010, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ *
+ * Based upon the plugin by Tzury Bar Yochay:
+ * http://github.com/tzuryby/hotkeys
+ *
+ * Original idea by:
+ * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
+*/
+
+(function(jQuery){
+
+ jQuery.hotkeys = {
+ version: "0.8",
+
+ specialKeys: {
+ 8: "backspace", 9: "tab", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause",
+ 20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home",
+ 37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del",
+ 96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7",
+ 104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/",
+ 112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8",
+ 120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 191: "/", 224: "meta"
+ },
+
+ shiftNums: {
+ "`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&",
+ "8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<",
+ ".": ">", "/": "?", "\\": "|"
+ }
+ };
+
+ function keyHandler( handleObj ) {
+ // Only care when a possible input has been specified
+ if ( typeof handleObj.data !== "string" ) {
+ return;
+ }
+
+ var origHandler = handleObj.handler,
+ keys = handleObj.data.toLowerCase().split(" ");
+
+ handleObj.handler = function( event ) {
+ // Don't fire in text-accepting inputs that we didn't directly bind to
+ if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) ||
+ event.target.type === "text") ) {
+ return;
+ }
+
+ // Keypress represents characters, not special keys
+ var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[ event.which ],
+ character = String.fromCharCode( event.which ).toLowerCase(),
+ key, modif = "", possible = {};
+
+ // check combinations (alt|ctrl|shift+anything)
+ if ( event.altKey && special !== "alt" ) {
+ modif += "alt+";
+ }
+
+ if ( event.ctrlKey && special !== "ctrl" ) {
+ modif += "ctrl+";
+ }
+
+ // TODO: Need to make sure this works consistently across platforms
+ if ( event.metaKey && !event.ctrlKey && special !== "meta" ) {
+ modif += "meta+";
+ }
+
+ if ( event.shiftKey && special !== "shift" ) {
+ modif += "shift+";
+ }
+
+ if ( special ) {
+ possible[ modif + special ] = true;
+
+ } else {
+ possible[ modif + character ] = true;
+ possible[ modif + jQuery.hotkeys.shiftNums[ character ] ] = true;
+
+ // "$" can be triggered as "Shift+4" or "Shift+$" or just "$"
+ if ( modif === "shift+" ) {
+ possible[ jQuery.hotkeys.shiftNums[ character ] ] = true;
+ }
+ }
+
+ for ( var i = 0, l = keys.length; i < l; i++ ) {
+ if ( possible[ keys[i] ] ) {
+ return origHandler.apply( this, arguments );
+ }
+ }
+ };
+ }
+
+ jQuery.each([ "keydown", "keyup", "keypress" ], function() {
+ jQuery.event.special[ this ] = { add: keyHandler };
+ });
+
+})( jQuery );
\ No newline at end of file
Modified: PyWireGate/trunk/logic_editor/logicEditor.js
===================================================================
--- PyWireGate/trunk/logic_editor/logicEditor.js 2011-02-04 21:25:52 UTC (rev 278)
+++ PyWireGate/trunk/logic_editor/logicEditor.js 2011-02-04 22:09:12 UTC (rev 279)
@@ -120,6 +120,8 @@
line( 0.0, 5.0).
close()
);
+
+ $(document).bind('keydown', 'del', function(){ $('.selected').remove(); });
});
function drawLibrary()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-02-05 20:59:15
|
Revision: 280
http://openautomation.svn.sourceforge.net/openautomation/?rev=280&view=rev
Author: mayerch
Date: 2011-02-05 20:59:08 +0000 (Sat, 05 Feb 2011)
Log Message:
-----------
Allow masked blocks to display text - which might be italic and/or bold, as well as positioned left, middle or right.
If it contains $<parameter> it will be replaced by the current value of the parameter
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-02-04 22:09:12 UTC (rev 279)
+++ PyWireGate/trunk/logic_editor/backendCommunication.js 2011-02-05 20:59:08 UTC (rev 280)
@@ -96,7 +96,9 @@
{ 'type': 'move', 'x': 0.999, 'y': 0.5 }, // it must allways start with a move!
{ 'type': 'line', 'x': 0 , 'y': 0.999 },
{ 'type': 'line', 'x': 0 , 'y': 0 },
- { 'type': 'close' }
+ { 'type': 'close' },
+ { 'type': 'new', 'fill': 'none' },
+ { 'type': 'text', 'x': 0.4, 'y': 0.55, 'text': '$gain', 'styling':['middle'] }
],
'maskOptions': {
'showLabel': false
@@ -116,7 +118,8 @@
'parameters': [
{
'name': 'gain',
- 'type': 'float'
+ 'type': 'float',
+ 'default': 1.0
}
]
},
@@ -234,7 +237,9 @@
{ 'type': 'arc' , 'x': 0.45 , 'y': 0.9 ,
'rx': 0.025, 'ry': 0.025, 'xRotate':0, 'large':true, 'clockwise': true,
'relative': false
- }
+ },
+ { 'type': 'text', 'x': 0.6, 'y': 0.5, 'text': 'd' },
+ { 'type': 'text', 'x': 0.6, 'y': 0.5, 'text': '\u2002t', 'styling':['italic'] }
],
'maskOptions': {
'showLabel': false
Modified: PyWireGate/trunk/logic_editor/gle/gle.block.js
===================================================================
--- PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-02-04 22:09:12 UTC (rev 279)
+++ PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-02-05 20:59:08 UTC (rev 280)
@@ -107,6 +107,35 @@
path.arc( rx, ry, obj.xRotate, obj.large, obj.clockwise, sx, sy, obj.relative );
break;
+ case 'text':
+ var param = {'text-anchor':'start'};
+ for( var thisStyle in obj.styling )
+ {
+ switch( obj.styling[thisStyle] )
+ {
+ case 'italic':
+ param['font-style'] = 'italic';
+ break;
+ case 'bold':
+ param['font-weight'] = 'bold';
+ break;
+ case 'left':
+ param['text-anchor'] = 'start';
+ break;
+ case 'middle':
+ param['text-anchor'] = 'middle';
+ break;
+ case 'right':
+ param['text-anchor'] = 'end';
+ break;
+ }
+ }
+ var text = obj.text;
+ for( var p in parameter )
+ text = text.replace( '$' + p, parameter[p] );
+ canvas.text( body, sx, sy, text, param );
+ break;
+
case 'close':
path.close();
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|