|
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.
|