diff onlypaths/js/vmlrenderer_mini.js @ 46:26c2b3ad21c7 laserkard

[svn r47] saving progresswww.cinemassacre.com/new/?page_id=30
author rlm
date Sun, 31 Jan 2010 12:33:33 -0500
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/onlypaths/js/vmlrenderer_mini.js	Sun Jan 31 12:33:33 2010 -0500
     1.3 @@ -0,0 +1,2348 @@
     1.4 +/*----------------------------------------------------------------------------
     1.5 + VMLRENDERER 1.0
     1.6 + VML Renderer For RichDraw
     1.7 + -----------------------------------------------------------------------------
     1.8 + Created by Mark Finkle (mark.finkle@gmail.com)
     1.9 + Implementation of VML based renderer.
    1.10 + -----------------------------------------------------------------------------
    1.11 + Copyright (c) 2006 Mark Finkle
    1.12 +
    1.13 + This program is  free software;  you can redistribute  it and/or  modify it
    1.14 + under the terms of the MIT License.
    1.15 +
    1.16 + Permission  is hereby granted,  free of charge, to  any person  obtaining a
    1.17 + copy of this software and associated documentation files (the "Software"),
    1.18 + to deal in the  Software without restriction,  including without limitation
    1.19 + the  rights to use, copy, modify,  merge, publish, distribute,  sublicense,
    1.20 + and/or  sell copies  of the  Software, and to  permit persons to  whom  the
    1.21 + Software is  furnished  to do  so, subject  to  the  following  conditions:
    1.22 + The above copyright notice and this  permission notice shall be included in
    1.23 + all copies or substantial portions of the Software.
    1.24 +
    1.25 + THE SOFTWARE IS PROVIDED "AS IS",  WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    1.26 + IMPLIED,  INCLUDING BUT NOT LIMITED TO  THE WARRANTIES  OF MERCHANTABILITY,
    1.27 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    1.28 + AUTHORS OR  COPYRIGHT  HOLDERS BE  LIABLE FOR  ANY CLAIM,  DAMAGES OR OTHER
    1.29 + LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT, TORT OR  OTHERWISE,  ARISING
    1.30 + FROM,  OUT OF OR  IN  CONNECTION  WITH  THE  SOFTWARE OR THE  USE OR  OTHER
    1.31 + DEALINGS IN THE SOFTWARE.
    1.32 + -----------------------------------------------------------------------------
    1.33 + Dependencies:
    1.34 + History:
    1.35 + 2006-04-05 | Created
    1.36 + --------------------------------------------------------------------------*/
    1.37 +
    1.38 +
    1.39 +
    1.40 +function VMLRenderer() {
    1.41 +	this.base = AbstractRenderer;
    1.42 +}
    1.43 +
    1.44 +
    1.45 +VMLRenderer.prototype = new AbstractRenderer;
    1.46 +
    1.47 +
    1.48 +VMLRenderer.prototype.init = function(elem) 
    1.49 + {
    1.50 +  this.container = elem;
    1.51 +  // this.container.style.overflow = 'hidden';
    1.52 +  this.container.unselectable = "on";
    1.53 +  // Add VML includes and namespace
    1.54 +  elem.ownerDocument.namespaces.add("v", "urn:schemas-microsoft-com:vml");
    1.55 +  var style = elem.ownerDocument.createStyleSheet();
    1.56 +  style.addRule('v\\:*', "behavior: url(#default#VML); display:inline-block");
    1.57 +  //NOT VML biewBox
    1.58 +  //http://blogs.msdn.com/ie/archive/2008/03/18/webbrowser-control-rendering-modes-in-ie8.aspx 
    1.59 + } 
    1.60 + 
    1.61 +VMLRenderer.prototype.view = function(left,top,width,height,viewBox) {
    1.62 + if(mode=='preview')
    1.63 +  {  
    1.64 +
    1.65 +   var tokens = viewBox.split(' ');       
    1.66 +   var prx=100;  
    1.67 +   this.container.style.top =(parseInt(document.getElementById('FRONT').style.height)-height)/2+'px' 
    1.68 +   this.container.style.left =(parseInt(document.getElementById('FRONT').style.width)-width)/2+'px' 
    1.69 +
    1.70 +   this.container.style.width = width;//document.getElementById('FRONT').style.width; 
    1.71 +   this.container.style.height =height;//document.getElementById('FRONT').style.height;     
    1.72 +
    1.73 + 
    1.74 +   canvasLeft = left;
    1.75 +   canvasTop = top; 
    1.76 +   canvasWidth = width;
    1.77 +   canvasHeight = height; 
    1.78 +   zoominit = viewBox;  
    1.79 +   zoominit1 = viewBox;
    1.80 +   zoominit2 = viewBox;
    1.81 +   var tokens = zoominit.split(' ');   
    1.82 +   proporx = width/tokens[2];
    1.83 +   propory = height/tokens[3];
    1.84 +   /* var x=parseFloat(tokens[0])-prx;
    1.85 +   var y=parseFloat(tokens[1])-prx;
    1.86 +   var w=parseFloat(tokens[2])+prx;
    1.87 +   var h=parseFloat(tokens[3])+prx;
    1.88 +   workspace= x+''+y+''+w+''+h;  
    1.89 +   //zoominit = workspace;
    1.90 +   */  
    1.91 +   //VMLviewBox('',left,top,width,height)
    1.92 +  } 
    1.93 +   else
    1.94 +  {    
    1.95 +  
    1.96 +    //
    1.97 +           this.container.style.top =0+'px'; 
    1.98 +
    1.99 +      var tokens = viewBox.split(' '); 
   1.100 +      proporImage= (parseFloat(tokens[2])-parseFloat(tokens[0]))/(parseFloat(tokens[3])-parseFloat(tokens[1])); 
   1.101 +        var marginx=(parseInt(document.getElementById('FRONT').style.width)-(parseFloat(tokens[2])-parseFloat(tokens[0])))/2;
   1.102 +        var marginy=(parseInt(document.getElementById('FRONT').style.height)-(parseFloat(tokens[3])-parseFloat(tokens[1])))/2;
   1.103 +        var x=(parseFloat(tokens[0])-marginx);
   1.104 +        var y=(parseFloat(tokens[1])-marginy);
   1.105 +        var w=(parseFloat(tokens[2])+marginx*2);
   1.106 +        var h=(parseFloat(tokens[3])+marginy*2); 
   1.107 +        //alert(tokens[3]+' '+tokens[1]+' / '+(parseFloat(tokens[3])-parseFloat(tokens[1]))+' '+parseInt(document.getElementById('FRONT').style.height)+' /'+h+' '+height);
   1.108 +        //if(h>=parseInt(document.getElementById('FRONT').style.height)){h=parseInt(document.getElementById('FRONT').style.height);}
   1.109 +        //if(h>=parseInt(document.getElementById('FRONT').style.height)){y=0;h=600;}//parseInt(document.getElementById('FRONT').style.height)*2}
   1.110 +        //zoominit = x+' '+y+' '+w+' '+h;  
   1.111 +   canvasLeft = 0;
   1.112 +   canvasTop = 0; 
   1.113 +   canvasWidth = w;
   1.114 +   canvasHeight = h;   
   1.115 +   //proporx =  w/tokens[2];
   1.116 +   //propory = h/tokens[3];
   1.117 +
   1.118 +   this.container.style.left =canvasLeft+'px' 
   1.119 +   this.container.style.top =canvasTop+'px' 
   1.120 +
   1.121 +   this.container.style.width = canvasWidth;//document.getElementById('FRONT').style.width; 
   1.122 +   this.container.style.height =canvasHeight;//document.getElementById('FRONT').style.height;     
   1.123 +        zoominit1 = canvasLeft+' '+canvasTop+' '+canvasWidth+' '+canvasHeight;
   1.124 +        zoominit2= x+' '+y+' '+w+' '+h;    
   1.125 +       //VMLviewBox('',x,canvasTop,w,h)
   1.126 +        //this.rectCanvas(x,y,w,h,zoominit)
   1.127 +       // this.rectCanvas(x,y,canvasWidth,canvasHeight,zoominit2)
   1.128 +       // zoominit = viewBox;
   1.129 +  }
   1.130 +}
   1.131 +
   1.132 +VMLRenderer.prototype.zoomFrame = function(zoom){ 
   1.133 +   myOPF.viewBox=zoom;  
   1.134 +   load(myOPF,c);
   1.135 +   document.getElementById("source").value=myOPF.toJSONString();
   1.136 +}
   1.137 +VMLRenderer.prototype.rectDoc = function(viewBox) {
   1.138 +     var tokens2 = zoominit2.split(' ');    
   1.139 +     var tokens = zoominit.split(' ');
   1.140 +  var shape = document.getElementById('rectDoc');
   1.141 +  if (shape) {
   1.142 +    this.remove(shape);
   1.143 +  } 
   1.144 +  var rect=this.container.ownerDocument.createElement('v:rect');
   1.145 +  rect.id='rectDoc';
   1.146 +  rect.style.position = 'absolute';
   1.147 +  rect.style.left =-parseInt(tokens2[0]); 
   1.148 +  rect.style.top = -parseInt(tokens2[1]);
   1.149 +  rect.style.width = parseInt(tokens[2]);
   1.150 +  rect.style.height = parseInt(tokens[3]);
   1.151 +  rect.setAttribute('filled', 'false');
   1.152 +   rect.setAttribute('stroked', 'true'); 
   1.153 +  rect.setAttribute('strokeweight', 2); 
   1.154 +  rect.setAttribute('strokecolor',"#ff0000"); 
   1.155 +   this.container.appendChild(rect);
   1.156 +   //this.container.insertBefore(rect, this.container.firstChild );
   1.157 +  //alert(docx+' '+docy+' '+docw+' '+doch+' '+viewBox)   
   1.158 +  }
   1.159 +VMLRenderer.prototype.rectCanvas = function(docx,docy,docw,doch,viewBox) {
   1.160 +  
   1.161 +     var tokens = zoominit1.split(' ');    
   1.162 +  var shape = document.getElementById('rectCanvas');
   1.163 +  if (shape) {
   1.164 +    this.remove(shape);
   1.165 +  }
   1.166 +  
   1.167 +  var rect=this.container.ownerDocument.createElement('v:rect');
   1.168 +  rect.id='rectBackground'; 
   1.169 +  rect.style.position = 'absolute';
   1.170 +  rect.style.left = tokens[0] ;
   1.171 +  rect.style.top =tokens[1];
   1.172 +  rect.style.width=tokens[2];
   1.173 +  rect.style.height= tokens[3] ;  
   1.174 +  rect.setAttribute('filled', 'true');
   1.175 +  rect.setAttribute('fillcolor',"#666666"); 
   1.176 +  rect.setAttribute('stroked', 'false');  
   1.177 +  
   1.178 +   this.container.insertBefore(rect, this.container.firstChild );
   1.179 +  
   1.180 +}
   1.181 +
   1.182 +VMLRenderer.prototype.removeAll = function(){
   1.183 +	while (this.container.hasChildNodes()) {
   1.184 +		this.container.removeChild(this.container.firstChild);
   1.185 +	}
   1.186 +}   
   1.187 +
   1.188 +function VMLviewBox(container,left,top,width,height){
   1.189 +  var tokens = zoominit2.split(' ');  
   1.190 +  left *= proporx;
   1.191 +  left = left - parseFloat(tokens[0]);
   1.192 +  top *= propory; 
   1.193 +  top = top - parseFloat(tokens[1]);   
   1.194 +  width *= proporx;
   1.195 +  height *= propory; 
   1.196 +  
   1.197 +  return {"x":parseFloat(Math.round(left)), "y":parseFloat(Math.round(top)), "w":parseFloat(Math.round(width)), "h":parseFloat(Math.round(height))};
   1.198 +}   
   1.199 +function VMLviewBox1(container,left,top,width,height){
   1.200 +  var tokens = zoominit2.split(' ');  
   1.201 +  left *= proporx;
   1.202 +  left = left - parseFloat(tokens[0]);
   1.203 +  top *= propory; 
   1.204 +  top = top - parseFloat(tokens[1]);   
   1.205 +  width *= proporx;
   1.206 +  height *= propory; 
   1.207 +  
   1.208 +  return {"x":parseFloat(Math.round(left)), "y":parseFloat(Math.round(top)), "w":parseFloat(Math.round(width)), "h":parseFloat(Math.round(height))};
   1.209 +}   
   1.210 +
   1.211 +VMLRenderer.prototype.create = function(shape, fillColor, lineColor, fillOpac, lineOpac, lineWidth, left, top, width, height, textMessaje, textSize, textFamily, imageHref, points, transform, parent) {
   1.212 +   var tokens = zoominit2.split(' ');  
   1.213 +   var zoom=VMLviewBox(this.container,left,top,width,height);
   1.214 +   left=zoom.x;  
   1.215 +   top=zoom.y;
   1.216 +   width=zoom.w;
   1.217 +   height=zoom.h;
   1.218 +
   1.219 +   var zoom=VMLviewBox(this.container,left,top,textSize,textSize);
   1.220 +   if(zoom.w<1){zoom.w=1}
   1.221 +   textSize=zoom.h;  
   1.222 +
   1.223 +   var zoom=VMLviewBox(this.container,left,top,lineWidth*2/3,lineWidth);
   1.224 +   if(zoom.w<1){zoom.w=1}
   1.225 +   lineWidth=zoom.w;  
   1.226 +
   1.227 +
   1.228 +   var vml;
   1.229 +
   1.230 +   var shap=1;
   1.231 +  if (shape == 'rect') {
   1.232 +    vml = this.container.ownerDocument.createElement('v:rect');  
   1.233 +    vml.style.position = 'absolute';
   1.234 +    vml.style.left = left; 
   1.235 +    vml.style.top = top;
   1.236 +    vml.style.width = width;
   1.237 +    vml.style.height = height;
   1.238 +  }
   1.239 +  else if (shape == 'roundrect') {
   1.240 +            vml = this.container.ownerDocument.createElement('v:roundrect'); 
   1.241 +            vml.style.position = 'absolute';
   1.242 +            vml.style.left = left;
   1.243 +            vml.style.top = top;
   1.244 +            vml.style.width = width;    
   1.245 +            vml.style.height = height;
   1.246 +            vml.setAttribute('arcsize', '20%');   
   1.247 +            
   1.248 +  }
   1.249 +  else if (shape == 'ellipse') {
   1.250 +    vml = this.container.ownerDocument.createElement('v:oval');  
   1.251 +    vml.style.left = left;
   1.252 +    vml.style.top = top;
   1.253 +    vml.style.width = width; 
   1.254 +    vml.style.height = height;
   1.255 +    vml.style.position = 'absolute';
   1.256 +  }
   1.257 +  else if (shape == 'line') {
   1.258 +    vml = this.container.ownerDocument.createElement('v:line'); 
   1.259 +    vml.style.position = 'absolute';
   1.260 +    vml.setAttribute('from', left-80 + 'px,' + top + 'px');
   1.261 +    vml.setAttribute('to', (left-80+width) + 'px,' + (top+height) + 'px');
   1.262 +
   1.263 +  }   
   1.264 +  else if (shape == 'polyline') {
   1.265 +    vml = this.container.ownerDocument.createElement('v:polyline');
   1.266 +    vml.setAttribute("points", points); 
   1.267 +    
   1.268 +  }    
   1.269 +  else if (shape == 'path') 
   1.270 +   {   
   1.271 +    vml = this.container.ownerDocument.createElement('v:shape');  
   1.272 +    var tokens = zoominit1.split(' ');  
   1.273 +    var tokens1 = zoominit1.split(' ');         
   1.274 +    var tokens2 = zoominit2.split(' ');   
   1.275 +    tokens[0]=0;
   1.276 +    tokens[1]=0;
   1.277 +    var path=points;
   1.278 +    path=path.replace(/, /g, ','); 
   1.279 +    path=path.replace(/ ,/g, ',');
   1.280 +    var ps =path.split(" ")
   1.281 +    var pcc = "";
   1.282 +   
   1.283 +    var re = /^[-]?\d*\.?\d*$/; 
   1.284 +    var contArc=0; 
   1.285 +    var isArc=false;
   1.286 +    for(var i = 0; i < ps.length; i++)
   1.287 +    { 
   1.288 +     if(ps[i].indexOf(',')>0){  
   1.289 +      
   1.290 +       var point =ps[i].split(","); 
   1.291 +       var char1=point[0].substring(0,1); 
   1.292 +     
   1.293 +       if (!char1.match(re))        
   1.294 +        { 
   1.295 +           var num0= parseFloat(point[0].substring(1));
   1.296 +           var zoom=VMLviewBox(this.container,num0+(parseInt(tokens2[0])*proporx),0,parseInt(tokens2[2]),parseInt(tokens2[3]));
   1.297 +           num0=zoom.x;  
   1.298 +   
   1.299 +           var text=char1;
   1.300 +        }else{ 
   1.301 +            var num0= parseFloat(point[0]);
   1.302 +            var zoom=VMLviewBox(this.container,num0+(parseInt(tokens2[0])*proporx),0,parseInt(tokens2[2]),parseInt(tokens2[3]));
   1.303 +            num0=zoom.x;  
   1.304 +  
   1.305 +        }  
   1.306 +       point[1]= parseFloat(point[1]);  
   1.307 +       var zoom=VMLviewBox(this.container,0,point[1],parseInt(tokens2[2]),parseInt(tokens2[3]));
   1.308 +       point[1]=zoom.y;  
   1.309 +       var cx=num0; 
   1.310 +       var cy=point[1]+parseInt(tokens2[1]);   
   1.311 +       pcc+=text+cx+','+cy+' ';
   1.312 +     }
   1.313 +      else
   1.314 +     {  
   1.315 +        pcc+=ps[i]+' ';
   1.316 +     }
   1.317 +   
   1.318 +    }
   1.319 +   ////////////////////   
   1.320 +    var thispath=pcc;
   1.321 +    thispath=thispath.replace(/M/g,'m');
   1.322 +    thispath=thispath.replace(/C/g,'c');  
   1.323 +    thispath=thispath.replace(/L/g,'l'); 
   1.324 +    thispath=thispath.replace(/z/g,'x');      
   1.325 +   
   1.326 +   //document.getElementById('source').value=points+'\r\n'+thispath +'\r\n'+'________'+'\r\n'
   1.327 +   var zoom=VMLviewBox(this.container,tokens[0],tokens[1],tokens[2],tokens[3]);
   1.328 +   
   1.329 +    vml.style.position="absolute";  
   1.330 +    vml.style.width= zoom.w+"px";
   1.331 +    vml.style.height=zoom.h+"px";
   1.332 +    vml.style.left=zoom.x+"px";  
   1.333 +    vml.style.top=zoom.y+"px";    
   1.334 +    vml.setAttribute('coordsize', zoom.w+','+zoom.h); 
   1.335 + 
   1.336 +    var path01 = this.container.ownerDocument.createElement('v:path');  
   1.337 +    path01.setAttribute("v", thispath+' e'); 
   1.338 + 
   1.339 + 
   1.340 +    
   1.341 +    vml.appendChild(path01)
   1.342 +    
   1.343 +   }
   1.344 +   
   1.345 +   else if (shape == 'controlpath')
   1.346 +   {
   1.347 +    
   1.348 +    vml = this.container.ownerDocument.createElement('v:shape');  
   1.349 +      vml.style.position="absolute";  
   1.350 +    vml.style.width= 700+"px";
   1.351 +    vml.style.height=500+"px";
   1.352 +    vml.style.left=left+"px";  
   1.353 +    vml.style.top=top+"px";  
   1.354 +    vml.setAttribute('coordsize', '700,500');   
   1.355 +     
   1.356 +    var path01 = this.container.ownerDocument.createElement('v:path');  
   1.357 +    path01.setAttribute('v', 'm '+left+','+top+' c'+(left+1)+','+(top+1)+' e ');  
   1.358 +
   1.359 +     vml.appendChild(path01)
   1.360 +    } 
   1.361 +    else if (shape == 'image') {   
   1.362 +     var data =imageHref;//document.forms[0].option_text_message.value;
   1.363 +     vml = this.container.ownerDocument.createElement('v:image'); 
   1.364 +     vml.setAttribute('src',imageHref);
   1.365 +     vml.style.position="absolute";  
   1.366 +     vml.style.width=width+"px";
   1.367 +     vml.style.height=height+"px";
   1.368 +     vml.style.left=left+"px";  
   1.369 +     vml.style.top=top+"px";  
   1.370 +     vml.style.margin=0+"px";  
   1.371 +     vml.style.padding=0+"px";  
   1.372 +     if (fillColor != ''  || fillColor != 'none') {
   1.373 +       vml.setAttribute('filled', 'false');
   1.374 +       vml.setAttribute('fillcolor', fillColor);
   1.375 +     }
   1.376 +     else {
   1.377 +       vml.setAttribute('filled', 'false');
   1.378 +     }
   1.379 +    vml.setAttribute('strokeweight','0px');// parseFloat(lineWidth)+'px');
   1.380 +   vml.setAttribute('stroked', 'false');  
   1.381 +   vml.setAttribute('strokecolor','#000000');//lineColor);
   1.382 +   
   1.383 +   
   1.384 +    }
   1.385 +    
   1.386 + else if (shape == 'text') 
   1.387 +  {   
   1.388 +   
   1.389 +    var data =textMessaje;
   1.390 +    vml = this.container.ownerDocument.createElement('v:shape');
   1.391 +    vml.style.position="absolute";  
   1.392 +    //vml.setAttribute('coordorigin',left+', '+top);
   1.393 +     //vml.style.coorsize= '';
   1.394 +     coordorigin="0, 0"
   1.395 +    vml.style.width= textSize+'px';//tokens[2]+'px'
   1.396 +    vml.style.height=textSize+'px';
   1.397 +    vml.style.left=(left+"px");  
   1.398 +    vml.style.top=(top-(textSize*1/4)+"px");  
   1.399 +    vml.style.margin=0+"px"; 
   1.400 +     vml.style.padding=0+"px";  
   1.401 +     vml.setAttribute('path','m '+0+' '+0+' r '+(textSize*data.length)+' '+0+' e'); 
   1.402 +     var textPathObj = this.container.ownerDocument.createElement("v:textpath");
   1.403 +     textPathObj.setAttribute('string', data); 
   1.404 +      textPathObj.setAttribute('fitshape','false'); 
   1.405 +     textPathObj.setAttribute('trim', 'false'); 
   1.406 +     textPathObj.setAttribute('fitpath', 'false');
   1.407 +     textPathObj.setAttribute('on','true');  
   1.408 +     textPathObj.style.fontFamily=textFamily;  
   1.409 +     textPathObj.style.fontSize=textSize+'px'; 
   1.410 +     textPathObj.setAttribute('vTextKern','true');  
   1.411 +     textPathObj.setAttribute('text-align','center');  
   1.412 +     
   1.413 +      var pathObj = this.container.ownerDocument.createElement("v:path");
   1.414 +     pathObj.setAttribute('textpathok', 'true');  
   1.415 +      vml.appendChild(textPathObj);  
   1.416 +     vml.appendChild(pathObj);  
   1.417 +    
   1.418 +    
   1.419 +  }    
   1.420 +
   1.421 +
   1.422 +    
   1.423 + else if (shape == 'texto') 
   1.424 +  {  
   1.425 +    vml = this.container.ownerDocument.createElement('v:shape');
   1.426 +    vml.style.position="absolute";  
   1.427 +   
   1.428 +     vml.style.coordsize=1000+', '+1000;
   1.429 +    vml.style.width= 1000;
   1.430 +    vml.style.height=1000;
   1.431 +    vml.style.left=left;  
   1.432 +    vml.style.top=top-parseFloat(textSize);  
   1.433 +     
   1.434 +     vml.style.padding=0;  
   1.435 +    var textBox = this.container.ownerDocument.createElement("v:textbox");
   1.436 +     textBox.setAttribute('mso-rotate-with-shape',true)
   1.437 +     var divtext = this.container.ownerDocument.createElement("div");  
   1.438 +     divtext.style.coordorigin=0+', '+(0);      
   1.439 +     divtext.style.margin=0;   
   1.440 +     divtext.style.fontFamily=textFamily; 
   1.441 +     divtext.style.margin=0; 
   1.442 +     divtext.style.padding=0; 
   1.443 +     divtext.style.vRotateLetters=true;
   1.444 +     divtext.style.fontSize=parseFloat(textSize); 
   1.445 +    
   1.446 +     
   1.447 +           
   1.448 +    
   1.449 +
   1.450 +     
   1.451 +    divtext.style.color=fillColor;
   1.452 +     
   1.453 +     
   1.454 +     
   1.455 +     
   1.456 +     
   1.457 +     //divtext.setAttribute('v-rotate-letters','true');
   1.458 +    if(transform.indexOf('rotate')>=0)
   1.459 +    {
   1.460 +     
   1.461 +      myRotate1=transform.split('rotate(');
   1.462 +      myRotate2=myRotate1[1].split(')');  
   1.463 +      myRotate3=myRotate2[0].split(',');  
   1.464 +     
   1.465 +      //divtext.setAttribute('mso-rotate',myRotate3[0]);
   1.466 +      //textBox.style.msoRotate= myRotate3[0];
   1.467 +      //textBox.style.centerX=myRotate3[1]; 
   1.468 +      //textBox.style.centerY=myRotate3[2];
   1.469 +      //vml.style.rotation= myRotate3[0];
   1.470 +      //vml.style.centerX=myRotate3[1]; 
   1.471 +      //vml.style.centerY=myRotate3[2];
   1.472 +        vml.setAttribute('rotation',myRotate3[0]+'Deg'); 
   1.473 +    }        
   1.474 +
   1.475 +     divtext.innerHTML=textMessaje;
   1.476 +     textBox.appendChild(divtext);       
   1.477 +    
   1.478 +     vml.appendChild(textBox);  
   1.479 +    
   1.480 +  }    
   1.481 +    else if (shape == 'group') {   
   1.482 +    vml = this.container.ownerDocument.createElement('v:group'); 
   1.483 +    vml.style.left=left+"px";  
   1.484 +    vml.style.top=top+"px";  
   1.485 +  }
   1.486 + 
   1.487 +  if(shape == 'zoom') 
   1.488 +  {
   1.489 +        
   1.490 +  }else
   1.491 +  {   
   1.492 +    if(transform.indexOf('rotate')>=0)
   1.493 +    {
   1.494 +      myRotate1=transform.split('rotate(');
   1.495 +      myRotate2=myRotate1[1].split(')');  
   1.496 +      myRotate3=myRotate2[0].split(',');  
   1.497 +     
   1.498 +       vml.style.rotation= myRotate3[0]+'Deg';
   1.499 +       vml.style.centerX=myRotate3[1]; 
   1.500 +       vml.style.centerY=myRotate3[2];
   1.501 +       
   1.502 +    }                                     
   1.503 +       
   1.504 +        if(shape != 'image' )
   1.505 +         {      
   1.506 +         
   1.507 +                   if (fillColor != ''  || fillColor != 'none') 
   1.508 +                    {
   1.509 +                      vml.setAttribute('filled', 'true');
   1.510 +                      vml.setAttribute('fillcolor', fillColor); 
   1.511 +                      
   1.512 +                    }
   1.513 +                     else 
   1.514 +                    {
   1.515 +                      vml.setAttribute('filled', 'false');
   1.516 +                    }
   1.517 +
   1.518 +         
   1.519 +                if(lineWidth==0 || lineWidth=='none' || lineColor== 'none' )    
   1.520 +                {
   1.521 +                  vml.setAttribute('stroked', 'false');  
   1.522 +                }
   1.523 +                 else 
   1.524 +                {  
   1.525 +                
   1.526 +                  vml.setAttribute('stroked', 'true');
   1.527 +                  vml.setAttribute('strokecolor', lineColor);
   1.528 +                  vml.setAttribute('strokeweight', lineWidth);
   1.529 +                  var stroke = this.container.ownerDocument.createElement('v:stroke'); 
   1.530 +                  stroke.setAttribute("opacity", parseFloat(lineOpac));
   1.531 +                  vml.appendChild(stroke);
   1.532 +                }
   1.533 +
   1.534 +               if (fillOpac != '') 
   1.535 +                { 
   1.536 +                  if (fillOpac == 'none' || fillColor=='none'){fillOpac=0;}
   1.537 +                  var fill = this.container.ownerDocument.createElement('v:fill'); 
   1.538 +                  fill.setAttribute("opacity",parseFloat(fillOpac));  
   1.539 +                  //alert(fillOpac)
   1.540 +                  vml.appendChild(fill);
   1.541 +                }
   1.542 +          }     
   1.543 +  } 
   1.544 +  if(parent==''){
   1.545 +   this.container.appendChild(vml);
   1.546 +  }else{     
   1.547 +   var parentShape = document.getElementById(parent);
   1.548 +   parentShape.appendChild(vml);
   1.549 +  }  
   1.550 +   //var parentDoc = document.getElementById('mydraw');
   1.551 +   //parentDoc.appendChild(vml);
   1.552 +  return vml;
   1.553 +};
   1.554 +
   1.555 +
   1.556 +VMLRenderer.prototype.zoom = function(clicx,clicy)
   1.557 + { 
   1.558 + }
   1.559 +
   1.560 +VMLRenderer.prototype.datacreate = function(fillColor, lineColor, fillOpac, lineOpac, lineWidth, left, top, width, height, textMessaje, textSize, textFamily, imageHref, transform) 
   1.561 + {
   1.562 + }
   1.563 +
   1.564 +VMLRenderer.prototype.duplicate = function(shape) 
   1.565 + {
   1.566 +   var vml;
   1.567 +   vml =shape.cloneNode(false);
   1.568 +   //vml.setAttribute('fillcolor', "#aa00aa");
   1.569 +   //vml.setAttribute('filled', "false");
   1.570 +   this.container.appendChild(vml);
   1.571 +  return vml;
   1.572 +  
   1.573 + };
   1.574 +
   1.575 +
   1.576 +
   1.577 +VMLRenderer.prototype.index = function(shape,order) {  
   1.578 + 
   1.579 +     if(order==-1)
   1.580 +      {
   1.581 +        this.container.appendChild( shape );
   1.582 +      }
   1.583 +      if(order==0){
   1.584 +     
   1.585 +         this.container.insertBefore( shape, shape.parentNode.firstChild );
   1.586 +      } 
   1.587 + 
   1.588 +   if(order==1 || order==2)
   1.589 +    {
   1.590 +         var id=shape.getAttribute('id');
   1.591 +        //alert(id);
   1.592 +        
   1.593 +        
   1.594 +        var numNodes=this.container.childNodes.length;
   1.595 +        //alert(numNodes);
   1.596 +          
   1.597 +        var num=0;
   1.598 +        for(var i = 1; i < numNodes; i++)
   1.599 +         {                                                   
   1.600 +           
   1.601 +           var etiq=this.container.childNodes[i].getAttribute('id');
   1.602 +           if (etiq==id)
   1.603 +            { 
   1.604 +                num=i; 
   1.605 +               
   1.606 +            }                                                    
   1.607 +          } 
   1.608 +          //alert(num);    
   1.609 +          if(order==1) 
   1.610 +           {   
   1.611 +              if((num-1)>=-1)
   1.612 +               {  
   1.613 +                this.container.insertBefore( shape, this.container.childNodes[num-1]);
   1.614 +               } 
   1.615 +           }
   1.616 +          if(order==2){ 
   1.617 +               if((num+1)<numNodes)
   1.618 +               {
   1.619 +                  this.container.insertBefore( shape, this.container.childNodes[num+2]);
   1.620 +               }
   1.621 +          } 
   1.622 +          
   1.623 +    } 
   1.624 +    
   1.625 +    
   1.626 +    
   1.627 +}
   1.628 +VMLRenderer.prototype.remove = function(shape) {
   1.629 +  if(shape!=null){ shape.removeNode(true); }
   1.630 +}
   1.631 +
   1.632 +
   1.633 +VMLRenderer.prototype.copy = function(shape) 
   1.634 + {
   1.635 +   var vml;
   1.636 +   vml =shape.cloneNode(false);
   1.637 +   //vml.setAttribute('fillcolor', "#aa00aa");
   1.638 +   return vml;
   1.639 + };
   1.640 +
   1.641 +
   1.642 +VMLRenderer.prototype.paste = function(clipboard,left,top)   
   1.643 + {
   1.644 +  this.container.appendChild(clipboard);
   1.645 +  return clipboard;
   1.646 + };
   1.647 +
   1.648 +
   1.649 +
   1.650 +VMLRenderer.prototype.undo = function() 
   1.651 + {
   1.652 +   this.container.removeChild( this.container.lastChild );
   1.653 + };
   1.654 + 
   1.655 +
   1.656 +var xshe=0; 
   1.657 +var yshe=0;  
   1.658 +var isArc=false;
   1.659 +var contArc=0;
   1.660 +     
   1.661 +VMLRenderer.prototype.move = function(shape, left, top,fromX,FromY) {    
   1.662 + var box = this.bounds(shape);
   1.663 + var angle=0;
   1.664 + var dist=0;  
   1.665 + var rotated=false;
   1.666 + 
   1.667 + 
   1.668 +  
   1.669 +
   1.670 +  
   1.671 +         //contmove++;
   1.672 +  if (shape.tagName == 'line') {
   1.673 +    shape.style.marginLeft = left;
   1.674 +    shape.style.marginTop = top;
   1.675 +  } 
   1.676 +   if (shape.tagName == 'polyline') {
   1.677 +    shape.style.marginLeft = left;
   1.678 +    shape.style.marginTop = top;
   1.679 +
   1.680 +   }   
   1.681 +   if (shape.tagName == 'oval') {
   1.682 +    shape.style.left = left;
   1.683 +    shape.style.top = top;
   1.684 +  }      
   1.685 +  if (shape.tagName == 'rect') {
   1.686 +    shape.style.left = left;
   1.687 +    shape.style.top = top;
   1.688 +  } 
   1.689 +  
   1.690 +    if (shape.tagName == 'image') {
   1.691 +    shape.style.left = left;
   1.692 +    shape.style.top = top;
   1.693 +  }      
   1.694 +   if (shape.tagName == 'shape') { 
   1.695 +        
   1.696 +       shape.style.left=left+"px";  
   1.697 +        shape.style.top=top+"px";  
   1.698 +    
   1.699 +   }   
   1.700 +      
   1.701 +
   1.702 +};
   1.703 +
   1.704 +
   1.705 +VMLRenderer.prototype.track = function(shape) {
   1.706 +  // TODO
   1.707 +};
   1.708 +
   1.709 +VMLRenderer.prototype.clic = function(shape) {
   1.710 +         var end='';
   1.711 +	if(data_path_close==true){end=' ';}
   1.712 +
   1.713 +        var thispath='m '+setPoints[0]+' l';  
   1.714 +        var maxcont=setPoints.length;
   1.715 +      
   1.716 +        for(var conta=1;conta< maxcont;conta++){        
   1.717 +          thispath+=setPoints[conta]+' ';
   1.718 +          
   1.719 +	
   1.720 +        }
   1.721 +       	var path=thispath+end+' e';
   1.722 +        shape.style.position="absolute";  
   1.723 +        shape.style.width= 700+"px";
   1.724 +	shape.style.height=500+"px";
   1.725 +        shape.style.left="0px";  
   1.726 +        shape.style.top="0px";    
   1.727 +
   1.728 +       
   1.729 +         	shape.children[0].setAttribute("v",path);
   1.730 +               document.forms[0].control_codebase.value=path;
   1.731 + 
   1.732 +}
   1.733 +
   1.734 +
   1.735 +VMLRenderer.prototype.resize = function(shape, fromX, fromY, toX, toY) {     
   1.736 + //var vml;
   1.737 +  var deltaX = toX - fromX;
   1.738 +  var deltaY = toY - fromY; 
   1.739 +    var shap=1;
   1.740 +    if (shape.tagName == 'line') { shap=0; }   
   1.741 +   if (shape.tagName == 'polyline') { shap=2; } 
   1.742 +    
   1.743 +  if (shape.tagName == 'line') {
   1.744 +    shape.setAttribute('to', toX + 'px,' + toY + 'px');
   1.745 +  }
   1.746 +  if (shap == 1) {
   1.747 +    if (deltaX < 0) {
   1.748 +      shape.style.left = toX + 'px';
   1.749 +      shape.style.width = -deltaX + 'px';
   1.750 +    }
   1.751 +    else {
   1.752 +      shape.style.width = deltaX + 'px';
   1.753 +    }
   1.754 +  
   1.755 +    if (deltaY < 0) {
   1.756 +      shape.style.top = toY + 'px';
   1.757 +      shape.style.height = -deltaY + 'px';
   1.758 +    }
   1.759 +    else {
   1.760 +      shape.style.height = deltaY + 'px';
   1.761 +    }
   1.762 +  }
   1.763 +   if (shap == 2) {   
   1.764 +        xpArray.push(toX);
   1.765 +        ypArray.push(toY);
   1.766 +	
   1.767 +        //xpArray.push(finetoX);
   1.768 +        //ypArray.push(finetoY);    
   1.769 +    
   1.770 +       var thispath=' '+xpArray[1]+','+ypArray[1];  
   1.771 +       var maxcont=xpArray.length;
   1.772 +       //alert(maxcont);
   1.773 +        for(var conta=2;conta< maxcont;conta++){        
   1.774 +          thispath+=' '+xpArray[conta]+','+ypArray[conta]; 
   1.775 +        }
   1.776 +        //alert(shape.points[1]);
   1.777 +    //shape.setAttribute("points",thispath);       
   1.778 +    shape.points.Value = thispath;
   1.779 +      
   1.780 +        /*
   1.781 +        var thispath=''+xpArray[0]+','+ypArray[0]; 
   1.782 +        var thispatho=new Array();   
   1.783 +        thispatho.push(toX); 
   1.784 +          thispatho.push(toY);
   1.785 +       var maxcont=xpArray.length;
   1.786 +       //alert(maxcont);
   1.787 +        for(var conta=2;conta< maxcont;conta++){        
   1.788 +          thispath+=','+xpArray[conta]+','+ypArray[conta]; 
   1.789 +        }
   1.790 +        //alert(shape.points[1]);
   1.791 +    shape.setAttribute("points",thispath);   
   1.792 +          */
   1.793 +   }
   1.794 +  if(shape.tagName == 'shape')
   1.795 +   {    
   1.796 +          
   1.797 +      if (selectmode == 'controlpath')
   1.798 +     {    
   1.799 +        
   1.800 +                 var end='';
   1.801 +	if(data_path_close==true){end=' ';}
   1.802 +
   1.803 +        var thispath='m '+setPoints[0]+' l';  
   1.804 +        var maxcont=setPoints.length;
   1.805 +      
   1.806 +        for(var conta=1;conta< maxcont;conta++){        
   1.807 +          thispath+=setPoints[conta]+' ';
   1.808 +          
   1.809 +	
   1.810 +        }
   1.811 +        var path=thispath+toX+','+toY+end+' e';
   1.812 + 
   1.813 +        shape.style.position="absolute";  
   1.814 +        shape.style.width= 700+"px";
   1.815 +	shape.style.height=500+"px";
   1.816 +        shape.style.left="0px";  
   1.817 +        shape.style.top="0px";    
   1.818 +
   1.819 +         	shape.children[0].setAttribute("v",path);
   1.820 +               document.forms[0].control_codebase.value=path;
   1.821 +
   1.822 +          
   1.823 +     }
   1.824 +      else
   1.825 +     {  
   1.826 +      
   1.827 +      xpArray.push(toX);
   1.828 +      ypArray.push(toY);
   1.829 +	
   1.830 +        //xpArray.push(finetoX);
   1.831 +        //ypArray.push(finetoY);    
   1.832 +        var thispath2='';
   1.833 +       var thispath1=' '+xpArray[1]+','+ypArray[1];  
   1.834 +       var maxcont=xpArray.length;
   1.835 +       //alert(maxcont);
   1.836 +        for(var conta=2;conta< maxcont ;conta++){        
   1.837 +          thispath2+=''+xpArray[conta]+','+ypArray[conta]+',';
   1.838 +          if((conta+2)%3==0){thispath2+='';} 
   1.839 +        } 
   1.840 +        thispath2+=''+xpArray[maxcont]+','+ypArray[maxcont]+'';   
   1.841 +        
   1.842 +        //alert(shape.points[1]);   
   1.843 +        //appendChild(path01)
   1.844 +       //var path01=shape.getFirstChild();  
   1.845 +       var path01 = this.container.ownerDocument.createElement('v:path');  
   1.846 +       path01.setAttribute("v", "m"+thispath1+" l"+ thispath2+" e"); 
   1.847 +        //shape.margin-left="300px";  
   1.848 +        //shape.margin-top="200px";    
   1.849 +  
   1.850 +      //shape.setAttribute('path','m '+thispath1+ ' c'+thispath2+'  e'); 
   1.851 +       if(shape.children[0].tagName=='textpath')
   1.852 +        {      
   1.853 +                var path01 = this.container.ownerDocument.createElement('v:path');  
   1.854 +                path01.setAttribute("v", 'm 100 100 l 600 100 e'); 
   1.855 +
   1.856 +            //if(xpArray.length>1)
   1.857 +             //{       shap.style.position="absolute";  
   1.858 +                    shape.style.width=100+"px";
   1.859 +                    shape.style.height=100+"px";
   1.860 +                    shape.style.left=toX+"px";  
   1.861 +                    shape.style.top=toY+"px";  
   1.862 +                    shape.style.margin=0+"px";  
   1.863 +                    shape.style.padding=0+"px";  
   1.864 +                    shape.appendChild(path01); 
   1.865 +             //}    
   1.866 +        }
   1.867 +         else
   1.868 +        {  
   1.869 +              shape.style.position="absolute";  
   1.870 +          shape.style.width= 700+"px";
   1.871 +	  shape.style.height=500+"px";
   1.872 +          shape.style.left="0px";  
   1.873 +          shape.style.top="0px";    
   1.874 +          //shape.setAttribute('coordsize', '700,500');  
   1.875 +          shape.appendChild(path01);  
   1.876 +          }
   1.877 +        
   1.878 +       //shape.setAttribute('position', 'absolute'); 
   1.879 +       //shape.translate(xpArray[conta+1]+','+ypArray[conta+1]); 
   1.880 +      //shape.setAttribute('coordsize', '700,500');
   1.881 +       // shape.v.Value ='M '+thispath1+ ' C'+thispath2+' x e';      
   1.882 +      //shape.v.Value = 'M '+thispath+ ' c '+thispath2;
   1.883 +      //shape.setAttribute("v", 'M '+thispath+ ' C '+thispath2);  
   1.884 +		//shape.setAttribute('path','M '+thispath+ ' C '+thispath2);
   1.885 +   } 	
   1.886 +  } 
   1.887 +  
   1.888 +};  
   1.889 +
   1.890 +
   1.891 +VMLRenderer.prototype.tocurve = function() {
   1.892 +
   1.893 +
   1.894 +};
   1.895 +
   1.896 +
   1.897 +VMLRenderer.prototype.info = function(shape)
   1.898 +{   
   1.899 +var shInfo = {};
   1.900 +shInfo.id = shape.id;
   1.901 + shInfo.type = shape.tagName;
   1.902 + if (shape.tagName == 'rect') 
   1.903 +   {
   1.904 +    shInfo.left = parseFloat(shape.getAttribute( 'x'));
   1.905 +    shInfo.top = parseFloat(shape.getAttribute( 'y'));
   1.906 +    shInfo.width = parseFloat(shape.getAttribute('width'));
   1.907 +    shInfo.height = parseFloat(shape.getAttribute('height'));   
   1.908 +    //++
   1.909 +    //shInfo.rotate = parseFloat(shape.getAttribute('rotation'));  
   1.910 +   }
   1.911 +  else if (shape.tagName == 'oval') 
   1.912 +   {
   1.913 +    shInfo.width = parseFloat(shape.getAttribute('rx'))*2;
   1.914 +    shInfo.height = parseFloat(shape.getAttribute('ry'))*2;   
   1.915 +    shInfo.left = (shInfo.width * 2)  - parseFloat(shape.getAttribute('rx'));
   1.916 +    shInfo.top = (shInfo.height * 2)  - parseFloat(shape.getAttribute('ry'));
   1.917 + 
   1.918 +   }
   1.919 +  else if (shape.tagName == 'roundrect') 
   1.920 +   {
   1.921 +    shInfo.left = parseFloat(shape.getAttribute('x'));
   1.922 +    shInfo.top = parseFloat(shape.getAttribute('y'));
   1.923 +    shInfo.width = parseFloat(shape.getAttribute('width'));
   1.924 +    shInfo.height = parseFloat(shape.getAttribute('height'));   
   1.925 +   
   1.926 +   }
   1.927 +  else if (shape.tagName == 'line') 
   1.928 +   {
   1.929 +    shInfo.left = parseFloat(shape.getAttribute('x1'));
   1.930 +    shInfo.top = parseFloat(shape.getAttribute('y1'));
   1.931 +
   1.932 +   } 
   1.933 +  else if (shape.tagName == 'polyline') 
   1.934 +   {
   1.935 +    shInfo.points = shape.getAttribute('points');
   1.936 +   }
   1.937 +   else if (shape.tagName == 'image') 
   1.938 +   {
   1.939 +    shInfo.left = parseFloat(shape.getAttribute('x'));
   1.940 +    shInfo.top = parseFloat(shape.getAttribute('y'));
   1.941 +    shInfo.width = parseFloat(shape.getAttribute('width'));
   1.942 +    shInfo.height = parseFloat(shape.getAttribute('height'));   
   1.943 +    shInfo.src = shape.getAttribute('src');  
   1.944 +   } 
   1.945 +  else 
   1.946 +  
   1.947 +   if (shape.tagName == 'shape')
   1.948 +   {  
   1.949 +       if(shape.children[0].tagName=='path') {
   1.950 +              shInfo.d = shape.getAttribute('v'); 
   1.951 +             this.editor.log(shape.getAttribute('v')); 
   1.952 +             
   1.953 +       }
   1.954 +       if(shape.children[0].tagName=='textpath') {
   1.955 +             shInfo['font-family'] = shape.children[0].getAttribute('font-family')
   1.956 +           shInfo['font-size'] = parseInt(shape.children[0].getAttribute('font-size'))
   1.957 +        shInfo.top = parseFloat(shape.children[0].getAttribute('y'))
   1.958 +        shInfo.left = parseFloat(shape.children[0].getAttribute('x'))
   1.959 +        shInfo.text = shape.textContent
   1.960 +
   1.961 +       }
   1.962 +   }
   1.963 +   return shInfo;  
   1.964 +   	
   1.965 +   	
   1.966 +}
   1.967 +VMLRenderer.prototype.transformShape = function(shape,data,transform)
   1.968 +{   
   1.969 + 
   1.970 + if(shape.tagName == 'rect')
   1.971 +  { 
   1.972 +    
   1.973 +    var box = this.bounds(shape);
   1.974 +    var sdata=data.split(';'); 
   1.975 +    
   1.976 +    //alert(data[0]); 
   1.977 +      shape.style.top = parseFloat(sdata[0]) + 'px';  
   1.978 +      shape.style.left = parseFloat(sdata[1]) + 'px';
   1.979 +      shape.style.width = parseFloat(sdata[2]) + 'px';    
   1.980 +      shape.style.height = parseFloat(sdata[3]) + 'px';
   1.981 +     
   1.982 +      
   1.983 +   
   1.984 +   // var centerx=parseFloat(sdata[0])+parseFloat(box.width/2);
   1.985 +   // var centery=parseFloat(sdata[1])+parseFloat(box.height/2);    
   1.986 +    shape.style.rotation=parseFloat(sdata[4]);
   1.987 +    
   1.988 +   //shape.nodparseFloatue=data;
   1.989 +  }
   1.990 +   else 
   1.991 + if(shape.tagName == 'text')
   1.992 +  {    
   1.993 +    if(data.indexOf('<;>',0)==-1 )
   1.994 +     {  
   1.995 +      shape.textContent = data;  
   1.996 +     }
   1.997 +      else
   1.998 +     {  
   1.999 +       var sdata=data.split('<;>'); //?????????
  1.1000 +       shape.textContent = sdata[0]; 
  1.1001 +       shape.setAttribute('font-size',parseFloat(sdata[1])); 
  1.1002 +        shape.setAttribute('font-family',sdata[2]);
  1.1003 +     }
  1.1004 +   //shape.nodparseFloatue=data;
  1.1005 +  }
  1.1006 +   else
  1.1007 + if (shape.tagName == 'polyline') 
  1.1008 +  {
  1.1009 +    shape.setAttribute('points',data);
  1.1010 +  }
  1.1011 +   else 
  1.1012 + if (shape.tagName == 'image') 
  1.1013 +  {   
  1.1014 +    //alert(data);  
  1.1015 +    if(data.indexOf(';',0)==-1 )
  1.1016 +     {  
  1.1017 +      shape.setAttribute('src',data);
  1.1018 +     }
  1.1019 +      else
  1.1020 +     {  
  1.1021 +        var box = this.bounds(shape);
  1.1022 +        var sdata=data.split(';');
  1.1023 +        shape.style.top = parseFloat(sdata[0]) + 'px';  
  1.1024 +        shape.style.left = parseFloat(sdata[1]) + 'px';
  1.1025 +        shape.style.width = parseFloat(sdata[2]) + 'px';    
  1.1026 +        shape.style.height = parseFloat(sdata[3]) + 'px';
  1.1027 +        var centerx=parseFloat(sdata[0])+parseFloat(box.width/2);
  1.1028 +        var centery=parseFloat(sdata[1])+parseFloat(box.height/2);    
  1.1029 +        shape.style.rotation=parseFloat(sdata[4]);
  1.1030 +
  1.1031 +
  1.1032 +     } 
  1.1033 +      
  1.1034 +  }
  1.1035 +   else 
  1.1036 + if (shape.tagName == 'path')
  1.1037 +  {     
  1.1038 +    if(data.indexOf(';',0)==-1 )
  1.1039 +     {  
  1.1040 +    	//shape.setAttribute( 'd', data);  //????????
  1.1041 +    	//shape.setAttribute( 'transform', transform);  
  1.1042 +     }
  1.1043 +      else
  1.1044 +     {  
  1.1045 +        var box = this.bounds(shape);
  1.1046 +        var sdata=data.split(';');
  1.1047 +        var centerx=parseFloat(sdata[0])+parseFloat(box.width/2);
  1.1048 +        var centery=parseFloat(sdata[1])+parseFloat(box.height/2);    
  1.1049 +        //++shape.setAttribute( 'transform','scale('+parseFloat(sdata[2])+','+parseFloat(sdata[3])+')'+' rotate('+parseFloat(sdata[4])+','+centerx+','+centery+')'+' translate('+parseFloat(sdata[0])+','+parseFloat(sdata[1])+')');
  1.1050 +
  1.1051 +
  1.1052 +     } 
  1.1053 +  }  
  1.1054 +   	                   
  1.1055 +   	
  1.1056 +}
  1.1057 +VMLRenderer.prototype.editShape = function(shape,data)
  1.1058 +{   
  1.1059 +if(shape.tagName == 'text'){
  1.1060 +shape.textContent = data
  1.1061 +}else
  1.1062 +   if (shape.tagName == 'polyline') 
  1.1063 +   {
  1.1064 +    shape.setAttribute('points',data);
  1.1065 +   }
  1.1066 +  else 
  1.1067 +  
  1.1068 +  if (shape.tagName == 'path')
  1.1069 +   {
  1.1070 +    	shape.setAttribute('v', data);  
  1.1071 +    	
  1.1072 +   }  
  1.1073 +   	 
  1.1074 +   	
  1.1075 +}
  1.1076 +VMLRenderer.prototype.editCommand = function(shape, cmd, value)
  1.1077 +{
  1.1078 +  if (shape != null) {
  1.1079 +    if (cmd == 'fillcolor') {
  1.1080 +      if (value != '') {
  1.1081 +        shape.filled = 'true';
  1.1082 +        shape.fillcolor = value;
  1.1083 +      }
  1.1084 +      else {
  1.1085 +        shape.filled = 'false';
  1.1086 +        shape.fillcolor = '';
  1.1087 +      }
  1.1088 +    }
  1.1089 +    else if (cmd == 'linecolor') {
  1.1090 +      if (value != '') {
  1.1091 +        shape.stroked = 'true';
  1.1092 +        shape.strokecolor = value;
  1.1093 +      }
  1.1094 +      else {
  1.1095 +        shape.stroked = 'false';
  1.1096 +        shape.strokecolor = '';
  1.1097 +      }
  1.1098 +    }
  1.1099 +    else if (cmd == 'linewidth') {
  1.1100 +      shape.strokeweight = parseInt(value) + 'px';
  1.1101 +    } 
  1.1102 +     else if (cmd == 'fillopacity') {
  1.1103 +           
  1.1104 +             shape.fill.opacity= parseFloat(value);
  1.1105 +            //shape.style.fill.setAttribute("opacity", parseFloat(value)); 
  1.1106 +      
  1.1107 +    }
  1.1108 +  }
  1.1109 +}
  1.1110 +
  1.1111 +
  1.1112 +VMLRenderer.prototype.queryCommand = function(shape, cmd)
  1.1113 +{
  1.1114 +  if (shape != null) {
  1.1115 +    if (cmd == 'fillcolor') {
  1.1116 +      if (shape.filled == 'false')
  1.1117 +        return '';
  1.1118 +      else
  1.1119 +        return shape.fillcolor;
  1.1120 +    }
  1.1121 +    else if (cmd == 'linecolor') {
  1.1122 +      if (shape.stroked == 'false')
  1.1123 +        return '';
  1.1124 +      else
  1.1125 +        return shape.strokecolor;
  1.1126 +    }
  1.1127 +    else if (cmd == 'linewidth') {
  1.1128 +      if (shape.stroked == 'false') {
  1.1129 +        return '';
  1.1130 +      }
  1.1131 +      else {
  1.1132 +        // VML always transforms the pixels to points, so we have to convert them back
  1.1133 +        return (parseFloat(shape.strokeweight) * (screen.logicalXDPI / 72)) + 'px';
  1.1134 +      }
  1.1135 +    }
  1.1136 +  }
  1.1137 +}
  1.1138 +
  1.1139 +VMLRenderer.prototype.getProperties = function(shape)
  1.1140 +{
  1.1141 +  var result = '';
  1.1142 +  
  1.1143 +  if (shape != null) 
  1.1144 +   {
  1.1145 +      result = shape.getAttribute('fillcolor');
  1.1146 +      if (result == 'none')
  1.1147 +       {
  1.1148 +         mefillColor.visible = 'hidden';
  1.1149 +         mefillColor.hex = '#000000'; 
  1.1150 +         filldraw=true;
  1.1151 +         setbe(1,'img_okfill');
  1.1152 +       }
  1.1153 +        else
  1.1154 +       {   
  1.1155 +         //alert(mefillColor.hex+' '+result);
  1.1156 +         mefillColor.visible = 'visible';
  1.1157 +         mefillColor.hex = result; 
  1.1158 +         var rgb=hex2rgb(result)
  1.1159 +         mefillColor.r=rgb[0];
  1.1160 +         mefillColor.g=rgb[1];
  1.1161 +         mefillColor.b=rgb[2];
  1.1162 +         filldraw=false;
  1.1163 +         setbe(1,'img_okfill');
  1.1164 +
  1.1165 +       }
  1.1166 +
  1.1167 +      result = shape.getAttribute('strokecolor');
  1.1168 +      if (result == 'none')
  1.1169 +       {    
  1.1170 +         mestrokeColor.visible = 'hidden'; 
  1.1171 +         mestrokeColor.hex = '#000000';
  1.1172 +         mestrokeColor.width = 0;
  1.1173 +         strokedraw=true;
  1.1174 +         setbe(2,'img_okstroke');
  1.1175 +
  1.1176 +       }
  1.1177 +        else
  1.1178 +       { 
  1.1179 +         mestrokeColor.visible = 'visible'; 
  1.1180 +         mestrokeColor.hex = result; 
  1.1181 +         var rgb=hex2rgb(result)
  1.1182 +         mestrokeColor.r=rgb[0];
  1.1183 +         mestrokeColor.g=rgb[1];
  1.1184 +         mestrokeColor.b=rgb[2];
  1.1185 +         strokedraw=false;
  1.1186 +         setbe(2,'img_okstroke');
  1.1187 +
  1.1188 +       }
  1.1189 +
  1.1190 +      result = shape.getAttribute('strokeweight');
  1.1191 +      mestrokeColor.width = result;
  1.1192 + 
  1.1193 +      result = shape.fill.getAttribute('opacity'); 
  1.1194 +      mefillColor.opacity = result;
  1.1195 +
  1.1196 +      result = shape.stroke.getAttribute('opacity');
  1.1197 +      mestrokeColor.opacity = result;
  1.1198 +      
  1.1199 +      setProperties();
  1.1200 +   }
  1.1201 +}
  1.1202 +
  1.1203 +
  1.1204 +VMLRenderer.prototype.showMultiSelect = function(iniX,iniY) { 
  1.1205 +  var tracker = document.getElementById('trackerMultiSelect');
  1.1206 +  if (tracker) {
  1.1207 +    this.remove(tracker);
  1.1208 +  } 
  1.1209 +  var coord=this.editor.inputxy;
  1.1210 +	toX=parseFloat(coord[0]);
  1.1211 +	toY=parseFloat(coord[1]); 
  1.1212 +	
  1.1213 +   tracker = this.container.ownerDocument.createElement('v:rect');
  1.1214 +  
  1.1215 +  tracker.style.position = 'relative';
  1.1216 +  tracker.style.left = iniX;
  1.1217 +  tracker.style.top = iniY;
  1.1218 +  tracker.style.width = toX ;
  1.1219 +  tracker.style.height = toY;
  1.1220 +  tracker.setAttribute('filled', 'false');
  1.1221 +  tracker.setAttribute('stroked', 'true');
  1.1222 +  tracker.setAttribute('strokecolor', 'blue');
  1.1223 +  tracker.setAttribute('strokeweight', '1px');    
  1.1224 +  
  1.1225 +  this.container.appendChild(tracker);    
  1.1226 +} 
  1.1227 +
  1.1228 +function mouseCoord()
  1.1229 +{                                           
  1.1230 +   var coord=this.editor.inputxy;
  1.1231 +   coord[0]=parseFloat(coord[0]);
  1.1232 +   coord[1]=parseFloat(coord[1]); 
  1.1233 +   return coord
  1.1234 +} 
  1.1235 +
  1.1236 +var memoNode=null; 
  1.1237 +var memoPrevControl=new Array();
  1.1238 +var memoNextControl=new Array();
  1.1239 +VMLRenderer.prototype.nodeMove = function(newx,newy) { 
  1.1240 +    var mypath=$('control_codebase').value; 
  1.1241 +   var  x= $('option_path_x').value;
  1.1242 +   var y= $('option_path_y').value; 
  1.1243 +   var precoord=x+','+y; 
  1.1244 +   
  1.1245 +   $('option_path_x').value=newx; 
  1.1246 +   $('option_path_y').value=newy; 
  1.1247 +    
  1.1248 +      var  cadx= newx;
  1.1249 +      var cady= newy; 
  1.1250 +  
  1.1251 +      var coord=cadx+','+cady;
  1.1252 +          var cad1=new RegExp(precoord,"g");
  1.1253 +      
  1.1254 +      
  1.1255 +      var result=mypath.replace(cad1, coord);
  1.1256 +      
  1.1257 +     
  1.1258 +      $('control_codebase').value=result; 
  1.1259 +      
  1.1260 +      $('someinfo').value=precoord;
  1.1261 +      setShape();
  1.1262 +
  1.1263 +}
  1.1264 +
  1.1265 +function drawNodeControl(vml,numId){
  1.1266 +      var color1='#0066ff';          
  1.1267 +           // if(parseInt(memoNode.id)==a){   
  1.1268 +                   
  1.1269 +                   var pointprev=memoPrevControl[numId].split(',');
  1.1270 +                 var controlNode1 = this.container.ownerDocument.createElement('v:rect');            
  1.1271 +                  controlNode1.setAttribute('x', pointprev[0]-2);
  1.1272 +                  controlNode1.setAttribute('y', pointprev[1]-2);
  1.1273 +          
  1.1274 +                  controlNode1.setAttribute('width', 4);
  1.1275 +                  controlNode1.setAttribute('height', 4);
  1.1276 +                  controlNode1.setAttribute('fillcolor', color1);
  1.1277 +                  controlNode1.setAttribute('strokecolor', '#000000');
  1.1278 +                  controlNode1.setAttribute('strokeweight', '0'); 
  1.1279 +                  controlNode1.setAttribute('id', 'controlNode1'); 
  1.1280 +                  controlNode1.addEventListener("mousedown", function(event) {if(memoNode != null){memoNode.setAttribute('strokeweight', 0 );} memoNode=this; this.setAttribute('fillcolor', '#ffff00' );this.setAttribute('strokeweight', 1 );$('option_path_num').value=this.getAttributeNS(null,'id'); $('option_path_x').value=parseFloat(this.getAttribute('x'))+2; $('option_path_y').value=parseFloat(this.getAttribute('y'))+2;  }, false);
  1.1281 +                  vml.appendChild(controlNode1);  
  1.1282 +                  
  1.1283 +                   var pointnext=memoNextControl[numId].split(',');
  1.1284 +                  
  1.1285 +               
  1.1286 +                  var controlNode2 =this.container.ownerDocument.createElement('v:rect'); 
  1.1287 +                  controlNode2.setAttribute('x', pointnext[0]-2);
  1.1288 +                  controlNode2.setAttribute('y', pointnext[1]-2);
  1.1289 +          
  1.1290 +                  controlNode2.setAttribute('width', 4);
  1.1291 +                  controlNode2.setAttribute('height', 4);
  1.1292 +                  controlNode2.setAttribute('fillcolor', color1);
  1.1293 +                  controlNode2.setAttribute('strokecolor', '#000000');
  1.1294 +                  controlNode2.setAttribute('strokeweight', '0'); 
  1.1295 +                  controlNode2.setAttribute('id', 'controlNode1'); 
  1.1296 +                  controlNode2.addEventListener("mousedown", function(event) {if(memoNode != null){memoNode.setAttribute('strokeweight', 0 );} memoNode=this; this.setAttribute('fillcolor', '#ffff00' );this.setAttribute('strokeweight', 1 );$('option_path_num').value=this.getAttributeNS(null,'id'); $('option_path_x').value=parseFloat(this.getAttribute('x'))+2; $('option_path_y').value=parseFloat(this.getAttribute('y'))+2;  }, false);
  1.1297 +                  vml.appendChild(controlNode2);  
  1.1298 +
  1.1299 +            //}
  1.1300 +
  1.1301 +
  1.1302 +}  
  1.1303 + 
  1.1304 +VMLRenderer.prototype.showNodesCurve = function(path){
  1.1305 +  var points=path.split('c');
  1.1306 +     var chain='';
  1.1307 +     var segment=' ';
  1.1308 +     var numpoints=points.length-1;
  1.1309 +     for(var a=1;a<numpoints;a++)
  1.1310 +      {   
  1.1311 +        segment=points[a].split(' ');
  1.1312 +         chain+=segment[0]+' ';       
  1.1313 +      } 
  1.1314 +      
  1.1315 +         $('someinfo').value=numpoints+ ' nodes ';
  1.1316 +    return chain;    
  1.1317 +        
  1.1318 +};
  1.1319 +
  1.1320 +
  1.1321 +
  1.1322 +VMLRenderer.prototype.showTracker = function(shape) {
  1.1323 +  var box = this.bounds(shape);
  1.1324 +  var trshape = parseFloat(shape.getAttribute('rotation'));  
  1.1325 +  var tracker = document.getElementById('tracker');
  1.1326 +  if (tracker) {
  1.1327 +    this.remove(tracker);
  1.1328 +  }
  1.1329 +  
  1.1330 +  if (shape.tagName == 'shape') 
  1.1331 +   { 
  1.1332 +      shap=2; 
  1.1333 +      if(shape.children[0].tagName == 'path') 
  1.1334 +       {
  1.1335 +      
  1.1336 +            /* $('option_path_trx').value= box.x;  
  1.1337 +             $('option_path_try').value= box.y;
  1.1338 +             $('option_path_sclx').value= box.width;   
  1.1339 +             $('option_path_scly').value= box.height; 
  1.1340 +             $('option_path_rot').value= shape.style.rotation;
  1.1341 +             */  
  1.1342 +             var path=shape.children[0].getAttribute('v');
  1.1343 +              $('control_codebase').value=path;
  1.1344 +       }        
  1.1345 +   }     
  1.1346 +  if (shape.tagName == 'rect') { 
  1.1347 +     
  1.1348 +     $('option_rect_rot').value= shape.getAttribute('rotation');
  1.1349 +     $('option_rect_trx').value= box.x;  
  1.1350 +     $('option_rect_try').value= box.y;
  1.1351 +     $('option_rect_sclx').value= box.width;  
  1.1352 +     $('option_rect_scly').value= box.height;
  1.1353 +
  1.1354 +  }  
  1.1355 +
  1.1356 +  if (shape.tagName == 'image'){
  1.1357 +  /*  $('option_img_trx').value= box.x; 
  1.1358 +    $('option_img_try').value= box.y;
  1.1359 +    $('option_img_sclx').value= box.width;  
  1.1360 +    $('option_img_scly').value= box.height;
  1.1361 +    $('option_img_rot').value= T.b* (Math.PI * 2 / 360);   
  1.1362 +      */
  1.1363 +  }
  1.1364 +  if (shape.tagName == 'text'){
  1.1365 +   /* f$('option_text_trx').value= box.x; 
  1.1366 +    $('option_text_try').value= box.y;
  1.1367 +    $('option_text_sclx').value= box.width;  
  1.1368 +    $('option_text_scly').value= box.height;
  1.1369 +    $('option_text_rot').value= T.b* (Math.PI * 2 / 360);
  1.1370 +   */
  1.1371 +  }
  1.1372 +  if (shape.tagName == 'line'){ 
  1.1373 +    /*
  1.1374 +    $('option_line_trx').value= box.x;  
  1.1375 +    $('option_line_try').value= box.y;
  1.1376 +    */
  1.1377 +  }   
  1.1378 +  if (shape.tagName == 'oval'){  
  1.1379 +    /*$('option_ellipse_trx').value= putx;  
  1.1380 +    $('option_ellipse_try').value= puty;
  1.1381 +    $('option_ellipse_sclx').value= box.width;  
  1.1382 +    $('option_ellipse_scly').value= box.height;
  1.1383 +    $('option_ellipse_rot').value= T.b* (Math.PI * 2 / 360);
  1.1384 +    */
  1.1385 +  }
  1.1386 +  
  1.1387 +  
  1.1388 +  
  1.1389 + /*var matrix = shape.getScreenCTM();
  1.1390 +  var trshape= shape.getAttribute('transform');  
  1.1391 +  var shap=1;
  1.1392 +  if (shape.tagName == 'path') { shap=2; 
  1.1393 +        
  1.1394 +        
  1.1395 +        
  1.1396 +  }
  1.1397 +  */  
  1.1398 +  //if (shape.getAttribute('transform') ) { shap=2; } 
  1.1399 +  //var svgNamespace = 'http://www.w3.org/2000/svg';
  1.1400 +  
  1.1401 +   tracker = this.container.ownerDocument.createElement('v:group');
  1.1402 +   tracker.id = 'tracker'; 
  1.1403 +  //tracker.setAttribute('rotation',trshape);
  1.1404 +  tracker.setAttribute('coordorigin','0, 0');
  1.1405 +  //tracker.setAttribute('wrapcoords',true);
  1.1406 + 
  1.1407 +   
  1.1408 +  tracker.setAttribute('coordsize',box.width+','+ box.height);
  1.1409 +  tracker.style.position = 'absolute';   
  1.1410 +  tracker.style.left = box.x ;
  1.1411 +  tracker.style.top = box.y;
  1.1412 +  tracker.style.width = box.width ;
  1.1413 +  tracker.style.height = box.height ;
  1.1414 +       
  1.1415 +        
  1.1416 +        
  1.1417 +        
  1.1418 +        
  1.1419 +   
  1.1420 +    
  1.1421 +    
  1.1422 +    
  1.1423 +    ////////////////
  1.1424 +
  1.1425 + /*
  1.1426 +       
  1.1427 +       var trshape='translate (0,0) rotate(0) translate(0,0) '; 
  1.1428 +       var trshape_split=trshape.split(') ');    
  1.1429 +       
  1.1430 +      // get_between (trshape, s1, s2) ;
  1.1431 +     if(shape.getAttribute('transform')){ 
  1.1432 +         var trshape=shape.getAttribute('transform') ;   
  1.1433 +         //var spl=trshape.replace(', ',' ');  
  1.1434 +         //var spl1=spl.replace(')',' ');    
  1.1435 +         var trshape_split=trshape.split(') '); 
  1.1436 +         
  1.1437 +
  1.1438 +    }
  1.1439 +  */
  1.1440 +                                         
  1.1441 + var corners = [];
  1.1442 +  var point = createPoint(box.x, box.y, box.width, box.height);
  1.1443 + //point = {x:box.x, y:box.y, width: box.width, height:box.height};
  1.1444 +//point = createPoint(box.x, box.y, box.width, box.height);    
  1.1445 +  //1
  1.1446 +  corners.push( createPoint(box.x + box.width, box.y, box.width, box.height) );
  1.1447 +  point.x = box.x + box.width;
  1.1448 +  point.y = box.y;
  1.1449 +  //2
  1.1450 +  corners.push( createPoint(box.x + box.width, box.y + box.height, box.width, box.height) );
  1.1451 +  point.x = box.x + box.width;
  1.1452 +  point.y = box.y + box.height;
  1.1453 +  //3
  1.1454 +  //corners.push( point.matrixTransform(matrix) );
  1.1455 +  corners.push( createPoint(box.x , box.y + box.height, box.width, box.height) );
  1.1456 +  point.x = box.x;
  1.1457 +  point.y = box.y + box.height;
  1.1458 +  //4
  1.1459 +  corners.push( createPoint(box.x + box.width, box.y, box.width, box.height) );   
  1.1460 +  
  1.1461 +  var max = createPoint(corners[0].x, corners[0].y);
  1.1462 +  var min = createPoint(corners[0].x, corners[0].y);
  1.1463 +
  1.1464 +  // identify the new corner coordinates of the
  1.1465 +  // fully transformed bounding box
  1.1466 +  
  1.1467 +  for (var i = 1; i < corners.length; i++) {
  1.1468 +    var x = corners[i].x;
  1.1469 +    var y = corners[i].y;
  1.1470 +    if (x < min.x) {
  1.1471 +      min.x = x;
  1.1472 +    }
  1.1473 +    else if (x > max.x) {
  1.1474 +      max.x = x;
  1.1475 +    }
  1.1476 +    if (y < min.y) {
  1.1477 +      min.y = y;
  1.1478 +    }
  1.1479 +    else if (y > max.y) {
  1.1480 +      max.y = y;
  1.1481 +    }
  1.1482 +  } 
  1.1483 +      
  1.1484 +      
  1.1485 + var border_square = this.container.ownerDocument.createElement('v:rect');
  1.1486 +  
  1.1487 +  border_square.style.position = 'relative';
  1.1488 +  border_square.style.left = 0 - 10;
  1.1489 +  border_square.style.top = 0 - 10;
  1.1490 +  border_square.style.width = box.width + 20;
  1.1491 +  border_square.style.height = box.height + 20;
  1.1492 +  border_square.setAttribute('filled', 'false');
  1.1493 +  border_square.setAttribute('stroked', 'true');
  1.1494 +  border_square.setAttribute('strokecolor', 'blue');
  1.1495 +  border_square.setAttribute('strokeweight', '1px');  
  1.1496 +  
  1.1497 +  
  1.1498 +  var border_angle = this.container.ownerDocument.createElement('v:polyline');  
  1.1499 +  border_angle.style.position = 'relative';
  1.1500 + 
  1.1501 +    //border_angle.setAttribute('from',(box.width+10) + 'px,' + (box.height/2) + 'px');
  1.1502 +   //border_angle.setAttribute('to', (box.width+10+25) + 'px,' + (box.width+10) + 'px');
  1.1503 +  border_angle.setAttribute('filled', 'false');
  1.1504 +  border_angle.setAttribute('stroked', 'true');
  1.1505 +  border_angle.setAttribute('strokecolor', 'blue');
  1.1506 +  border_angle.setAttribute('strokeweight', '1px'); 
  1.1507 +  border_angle.setAttribute("points", (box.width+10)+","+((box.height/2))+", "
  1.1508 +                                      +(box.width+10+25)+","+((box.height/2)) );
  1.1509 +                  
  1.1510 +      
  1.1511 +    /* var path01 = this.container.ownerDocument.createElement('v:path');  
  1.1512 +     //path01.setAttribute("v", "m "+thispath+" c"+ thispath2+" e ");  
  1.1513 +     path01.setAttribute("v", "m"+(min.x-10)+","+ (min.y-10)+" r"+(box.width+20)+","+(0)+" r"+(0)+","+(box.height+20)+" r"+(-box.width-20)+','+(0)+"x e m"+(box.x+box.width+10)+","+ (box.y+(box.height/2))+" r"+(25)+",0  e ");
  1.1514 +     border.appendChild(path01)
  1.1515 +    */ 
  1.1516 +     //border.setAttribute('stroke-width', '1'); 
  1.1517 +       
  1.1518 +// createRect(min.x, min.y, max.x - min.x, max.y - min.y);
  1.1519 +  
  1.1520 +  
  1.1521 + /* tracker = this.container.ownerDocument.createElement('v:rect');
  1.1522 +  tracker.id = 'tracker';
  1.1523 +  tracker.style.position = 'absolute';
  1.1524 +  tracker.style.left = box.x - 10;
  1.1525 +  tracker.style.top = box.y - 10;
  1.1526 +  tracker.style.width = box.width + 20;
  1.1527 +  tracker.style.height = box.height + 20;
  1.1528 +  tracker.setAttribute('filled', 'false');
  1.1529 +  tracker.setAttribute('stroked', 'true');
  1.1530 +  tracker.setAttribute('strokecolor', 'blue');
  1.1531 +  tracker.setAttribute('strokeweight', '1px');
  1.1532 +  this.container.appendChild(tracker);
  1.1533 + */
  1.1534 +     var circle1 = this.container.ownerDocument.createElement('v:oval'); 
  1.1535 +      circle1.style.position = 'relative'; 
  1.1536 +        circle1.style.left = ( (box.width+40)-5);
  1.1537 +    circle1.style.top = ( (box.height / 2) -5);
  1.1538 +    circle1.style.width = (10);
  1.1539 +    circle1.style.height = (10);
  1.1540 +    circle1.setAttribute('filled', 'true');
  1.1541 +   circle1.setAttribute('stroked', 'true'); 
  1.1542 +   circle1.setAttribute('fillcolor', '#ffffff');
  1.1543 +   circle1.setAttribute('strokecolor', 'green');
  1.1544 +   circle1.setAttribute('strokeweight', '1px');
  1.1545 +
  1.1546 +   
  1.1547 +  var rect1 = this.container.ownerDocument.createElement('v:rect');
  1.1548 +  rect1.style.position = 'relative';
  1.1549 +  rect1.style.left =  - 10-5;
  1.1550 +  rect1.style.top =  - 10-5;
  1.1551 +  rect1.style.width = 10;
  1.1552 +  rect1.style.height = 10;
  1.1553 +  rect1.setAttribute('filled', 'true');
  1.1554 +  rect1.setAttribute('stroked', 'true'); 
  1.1555 +  rect1.setAttribute('fillcolor', '#ffffff');
  1.1556 +  rect1.setAttribute('strokecolor', 'green');
  1.1557 +  rect1.setAttribute('strokeweight', '1px');
  1.1558 +
  1.1559 +    
  1.1560 +  var rect2 = this.container.ownerDocument.createElement('v:rect');
  1.1561 +  rect2.style.position = 'relative';
  1.1562 +  rect2.style.left =   box.width +5;
  1.1563 +  rect2.style.top = -10 -5;
  1.1564 +  rect2.style.width = 10;
  1.1565 +  rect2.style.height = 10;
  1.1566 +  rect2.setAttribute('filled', 'true');
  1.1567 +  rect2.setAttribute('stroked', 'true'); 
  1.1568 +  rect2.setAttribute('fillcolor', '#ffffff');
  1.1569 +  rect2.setAttribute('strokecolor', 'green');
  1.1570 +  rect2.setAttribute('strokeweight', '1px');
  1.1571 +
  1.1572 +                                                        
  1.1573 +  var rect3 = this.container.ownerDocument.createElement('v:rect');
  1.1574 +  rect3.style.position = 'relative';
  1.1575 +  rect3.style.left =   box.width+5;
  1.1576 +  rect3.style.top =  box.height+5;
  1.1577 +  rect3.style.width = 10;
  1.1578 +  rect3.style.height = 10;
  1.1579 +  rect3.setAttribute('filled', 'true');
  1.1580 +  rect3.setAttribute('stroked', 'true'); 
  1.1581 +  rect3.setAttribute('fillcolor', '#ffffff');
  1.1582 +  rect3.setAttribute('strokecolor', 'green');
  1.1583 +  rect3.setAttribute('strokeweight', '1px');
  1.1584 +   
  1.1585 +  var rect4 = this.container.ownerDocument.createElement('v:rect');
  1.1586 +  rect4.style.position = 'relative';
  1.1587 +  rect4.style.left =  -10-5;
  1.1588 +  rect4.style.top = box.height+5;
  1.1589 +  rect4.style.width = 10;
  1.1590 +  rect4.style.height = 10;
  1.1591 +  rect4.setAttribute('filled', 'true');
  1.1592 +  rect4.setAttribute('stroked', 'true'); 
  1.1593 +  rect4.setAttribute('fillcolor', '#ffffff');
  1.1594 +  rect4.setAttribute('strokecolor', 'green');
  1.1595 +  rect4.setAttribute('strokeweight', '1px');
  1.1596 + 
  1.1597 + 
  1.1598 + 
  1.1599 +  var rectmid12 = this.container.ownerDocument.createElement('v:rect');
  1.1600 +  rectmid12.style.position = 'relative';
  1.1601 +  rectmid12.style.left = (box.width/2) -5;
  1.1602 +  rectmid12.style.top =- 10-5;
  1.1603 +  rectmid12.style.width = 10;
  1.1604 +  rectmid12.style.height = 10;
  1.1605 +  rectmid12.setAttribute('filled', 'true');
  1.1606 +  rectmid12.setAttribute('stroked', 'true'); 
  1.1607 +  rectmid12.setAttribute('fillcolor', '#ffffff');
  1.1608 +  rectmid12.setAttribute('strokecolor', 'green');
  1.1609 +  rectmid12.setAttribute('strokeweight', '1px');
  1.1610 +
  1.1611 + var rectmid23 = this.container.ownerDocument.createElement('v:rect');
  1.1612 +  rectmid23.style.position = 'relative';
  1.1613 +  rectmid23.style.left = box.width +5;
  1.1614 +  rectmid23.style.top = (box.height/2)-5;
  1.1615 +  rectmid23.style.width = 10;
  1.1616 +  rectmid23.style.height = 10;
  1.1617 +  rectmid23.setAttribute('filled', 'true');
  1.1618 +  rectmid23.setAttribute('stroked', 'true'); 
  1.1619 +  rectmid23.setAttribute('fillcolor', '#ffffff');
  1.1620 +  rectmid23.setAttribute('strokecolor', 'green');
  1.1621 +  rectmid23.setAttribute('strokeweight', '1px');
  1.1622 +
  1.1623 + var rectmid34 = this.container.ownerDocument.createElement('v:rect');
  1.1624 +  rectmid34.style.position = 'relative';
  1.1625 +  rectmid34.style.left = (box.width/2)-5;
  1.1626 +  rectmid34.style.top = box.height+5;
  1.1627 +  rectmid34.style.width = 10;
  1.1628 +  rectmid34.style.height = 10;
  1.1629 +  rectmid34.setAttribute('filled', 'true');
  1.1630 +  rectmid34.setAttribute('stroked', 'true'); 
  1.1631 +  rectmid34.setAttribute('fillcolor', '#ffffff');
  1.1632 +  rectmid34.setAttribute('strokecolor', 'green');
  1.1633 +  rectmid34.setAttribute('strokeweight', '1px');
  1.1634 +
  1.1635 + 
  1.1636 + var rectmid41 = this.container.ownerDocument.createElement('v:rect');
  1.1637 +  rectmid41.style.position = 'relative';
  1.1638 +  rectmid41.style.left =  -10-5 ;
  1.1639 +  rectmid41.style.top =(box.height/2)-5;
  1.1640 +  rectmid41.style.width = 10;
  1.1641 +  rectmid41.style.height = 10;
  1.1642 +  rectmid41.setAttribute('filled', 'true');
  1.1643 +  rectmid41.setAttribute('stroked', 'true'); 
  1.1644 +  rectmid41.setAttribute('fillcolor', '#ffffff');
  1.1645 +  rectmid41.setAttribute('strokecolor', 'green');
  1.1646 +  rectmid41.setAttribute('strokeweight', '1px');
  1.1647 + 
  1.1648 +       
  1.1649 +  
  1.1650 +
  1.1651 +     var colorin="#ff0000";
  1.1652 +      var colorout="#ffffff" 
  1.1653 +      
  1.1654 +        circle1.attachEvent("onmouseover", function(event) {circle1.style.cursor= 's-resize';  circle1.setAttribute('fillcolor', colorin ); typeTransform='Rotate'; scaleType='nw'; }, false);
  1.1655 +     circle1.attachEvent("onmouseout", function(event) {circle1.style.cursor= 'default';  circle1.setAttribute('fillcolor', colorout ); typeTransform='Rotate'; }, false); //typeTransform='rotate'
  1.1656 + 
  1.1657 +      
  1.1658 +     rect1.attachEvent("onmouseover", function(event) {rect1.style.cursor= 'nw-resize';  rect1.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='nw';  }, false);
  1.1659 +     rect1.attachEvent("onmouseout", function(event) {rect1.style.cursor= 'default';  rect1.setAttribute('fillcolor', colorout ); typeTransform='Scale';  }, false); //typeTransform='rotate'
  1.1660 +    
  1.1661 +     rect2.attachEvent("onmouseover", function(event) {rect2.style.cursor= 'ne-resize';  rect2.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='ne';}, false);  
  1.1662 +     rect2.attachEvent("onmouseout", function(event) {rect2.style.cursor= 'default';  rect2.setAttribute('fillcolor', colorout ); typeTransform='Scale'; }, false);
  1.1663 +      
  1.1664 +     rect3.attachEvent("onmouseover", function(event) {rect3.style.cursor= 'se-resize';  rect3.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='se';}, false);  
  1.1665 +     rect3.attachEvent("onmouseout", function(event) {rect3.style.cursor= 'default';  rect3.setAttribute('fillcolor', colorout ); typeTransform='Scale'; }, false);
  1.1666 +     
  1.1667 +     rect4.attachEvent("onmouseover", function(event) {rect4.style.cursor= 'sw-resize';  rect4.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='sw';}, false);  
  1.1668 +     rect4.attachEvent("onmouseout", function(event) {rect4.style.cursor= 'default';  rect4.setAttribute('fillcolor', colorout ); typeTransform='Scale'; }, false);
  1.1669 +                                                    
  1.1670 +     rectmid12.attachEvent("onmouseover", function(event) {rectmid12.style.cursor= 'n-resize';  rectmid12.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='n';}, false);  
  1.1671 +     rectmid12.attachEvent("onmouseout", function(event) {rectmid12.style.cursor= 'default';  rectmid12.setAttribute('fillcolor', colorout ); typeTransform=''; }, false); 
  1.1672 +
  1.1673 +     rectmid23.attachEvent("onmouseover", function(event) {rectmid23.style.cursor= 'e-resize';  rectmid23.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='e';}, false);  
  1.1674 +     rectmid23.attachEvent("onmouseout", function(event) {rectmid23.style.cursor= 'default';  rectmid23.setAttribute('fillcolor', colorout ); typeTransform=''; }, false); 
  1.1675 +     
  1.1676 +     rectmid34.attachEvent("onmouseover", function(event) {rectmid34.style.cursor= 's-resize';  rectmid34.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='s';}, false);  
  1.1677 +     rectmid34.attachEvent("onmouseout", function(event) {rectmid34.style.cursor= 'default';  rectmid34.setAttribute('fillcolor', colorout ); typeTransform=''; }, false); 
  1.1678 +
  1.1679 +     rectmid41.attachEvent("onmouseover", function(event) {rectmid41.style.cursor= 'w-resize';  rectmid41.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='w'; }, false);  
  1.1680 +     rectmid41.attachEvent("onmouseout", function(event) {rectmid41.style.cursor= 'default';  rectmid41.setAttribute('fillcolor', colorout ); typeTransform=''; }, false); 
  1.1681 +   //tracker.setAttribute('transform',trshape); 
  1.1682 +
  1.1683 + 
  1.1684 + 
  1.1685 +  tracker.appendChild(border_square); 
  1.1686 +  tracker.appendChild(border_angle);  
  1.1687 +   
  1.1688 +  tracker.appendChild(circle1);  
  1.1689 +  
  1.1690 +  tracker.appendChild(rect1);    
  1.1691 +  tracker.appendChild(rect2);   
  1.1692 +  tracker.appendChild(rect3); 
  1.1693 +  tracker.appendChild(rect4);    
  1.1694 +  tracker.appendChild(rectmid12);  
  1.1695 +  tracker.appendChild(rectmid23);
  1.1696 +  tracker.appendChild(rectmid34);
  1.1697 +  tracker.appendChild(rectmid41);  
  1.1698 +  
  1.1699 +  /*
  1.1700 +   
  1.1701 +  
  1.1702 + 
  1.1703 +  */
  1.1704 +
  1.1705 +
  1.1706 +   this.container.appendChild(tracker);
  1.1707 +
  1.1708 +
  1.1709 +
  1.1710 +}                                      
  1.1711 +
  1.1712 +
  1.1713 +
  1.1714 +
  1.1715 +
  1.1716 +
  1.1717 +
  1.1718 +
  1.1719 +
  1.1720 +
  1.1721 +VMLRenderer.prototype.getMarkup = function() { 
  1.1722 +       
  1.1723 +  return this.container.innerHTML;
  1.1724 +}
  1.1725 +
  1.1726 +
  1.1727 +
  1.1728 +/////////////////////////////////
  1.1729 +
  1.1730 +
  1.1731 +
  1.1732 +var rotatexxx=0; 
  1.1733 + 
  1.1734 +var scaleType=''; 
  1.1735 +var xrot=0;
  1.1736 +var yrot=0;  
  1.1737 +
  1.1738 +var point = {x:0, y:0, width: 0, height:0};
  1.1739 +
  1.1740 +function createPoint (x, y, width, height) {
  1.1741 +    //var point = {x:34, y:22, width: 22, height:23};
  1.1742 +    //point.x = x;
  1.1743 +    //point.y = y;   
  1.1744 +    point = {x:x, y:y, width: width, height:height};
  1.1745 +    return point;
  1.1746 +  }
  1.1747 +
  1.1748 +
  1.1749 +/////////////////////////////////
  1.1750 +
  1.1751 +VMLRenderer.prototype.restruct= function(shape)
  1.1752 +{
  1.1753 +};        
  1.1754 +
  1.1755 +
  1.1756 +
  1.1757 +VMLRenderer.prototype.transform = function() {
  1.1758 +
  1.1759 +};
  1.1760 +
  1.1761 +VMLRenderer.prototype.scaleShape = function(shape, previus,toX, toY) {
  1.1762 +// document.forms[0].code.value="escala";      
  1.1763 +
  1.1764 +         //document.forms[0].code.value="escala"; 
  1.1765 +          var box = this.bounds(shape);
  1.1766 +	 var prevbox=this.bounds(previus);
  1.1767 +	var centerx= box.x+(box.width/2);
  1.1768 +	var centery= box.y+(box.height/2); 
  1.1769 +	var coord=this.editor.inputxy;
  1.1770 +	toX=parseFloat(coord[0]);
  1.1771 +	toY=parseFloat(coord[1]); 
  1.1772 +	var d2p_center=dist2p(centerx,centery,toX,toY);       
  1.1773 +
  1.1774 +	var d2p=dist2p(box.x,box.y,toX,toY);
  1.1775 +
  1.1776 +	var shareScale=box.width/d2p;
  1.1777 +
  1.1778 +	var trans_ShareScale='';
  1.1779 +	var tx, ty, tw, yh;
  1.1780 +
  1.1781 +	if(scaleType.length==1){
  1.1782 +		if(scaleType== 'w')
  1.1783 +		 {
  1.1784 +			trans_ShareScale=shareScale+",1";  
  1.1785 +			tx=toX; 
  1.1786 +			ty=prevbox.y; 
  1.1787 +			var dist=prevbox.x-toX;
  1.1788 +			var w=dist+prevbox.width;
  1.1789 +			if(w<1){w=1;}
  1.1790 +			tw=w;
  1.1791 +			th=prevbox.height;
  1.1792 +			//document.forms[0].code.value=box.x+' '+toX+' '+dist+''; 
  1.1793 +		 }        
  1.1794 +		if(scaleType== 'e')
  1.1795 +		 {
  1.1796 +		        trans_ShareScale=shareScale+",1"; 
  1.1797 +			tx=prevbox.x; 
  1.1798 +			ty=prevbox.y; 
  1.1799 +			var dist=toX-(prevbox.x+prevbox.width); //dist2p(toX,b,c,d);
  1.1800 +			var w=dist+prevbox.width;
  1.1801 +			if(w<1){w=1;}
  1.1802 +			tw=w;
  1.1803 +			th=prevbox.height;
  1.1804 + 
  1.1805 +		 }        
  1.1806 +		if(scaleType== 'n')
  1.1807 +		 {
  1.1808 +			trans_ShareScale="1,"+shareScale; 
  1.1809 +			
  1.1810 +			tx=prevbox.x; 
  1.1811 +			ty=toY; 
  1.1812 +			var dist=prevbox.y-toY;
  1.1813 +			var h=dist+prevbox.height;
  1.1814 +			if(h<1){h=1;}
  1.1815 +			tw=prevbox.width;
  1.1816 +			th=h;
  1.1817 +
  1.1818 +		 }
  1.1819 +                if( scaleType== 's')
  1.1820 +                 {
  1.1821 +                        trans_ShareScale="1,"+shareScale;  
  1.1822 +
  1.1823 +			tx=prevbox.x; 
  1.1824 +			ty=prevbox.y; 
  1.1825 +			var dist=toY-(prevbox.y+prevbox.height); //dist2p(toX,b,c,d);
  1.1826 +			var h=dist+prevbox.height;
  1.1827 +			if(h<1){h=1;}
  1.1828 +			tw=prevbox.width;
  1.1829 +			th=h;
  1.1830 +
  1.1831 +	         }
  1.1832 +        }
  1.1833 +	if(scaleType.length==2){
  1.1834 +		if(scaleType== 'nw'){
  1.1835 +			trans_ShareScale=shareScale+","+shareScale; 
  1.1836 +          
  1.1837 +      			//var angle_diagonal=getAngle(prevbox.width,prevbox.height);
  1.1838 +      			  var angle_diagonal=ang2v(prevbox.x,prevbox.y,prevbox.x+prevbox.width,prevbox.y+prevbox.height)
  1.1839 +            
  1.1840 +                        var ax= prevbox.x;
  1.1841 +                        var ay= prevbox.y;
  1.1842 +                        var bx= prevbox.x+prevbox.width; 
  1.1843 +                        var by= prevbox.y+prevbox.height; 
  1.1844 +                        
  1.1845 +                        var cx= toX;
  1.1846 +                        var cy= toY;
  1.1847 +                        var dx= toX+10*Math.cos(angle_diagonal+(Math.PI/2)); 
  1.1848 +                        var dy= toY+10*Math.sin(angle_diagonal+(Math.PI/2)); 
  1.1849 +                      var section_a=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy); 
  1.1850 +                 this.editor.log(angle_diagonal* 180 / Math.PI);       
  1.1851 +
  1.1852 +                var tx= section_a[1];
  1.1853 +                var ty= section_a[2];
  1.1854 +                
  1.1855 +                        var ax= section_a[1];
  1.1856 +                        var ay= section_a[2];
  1.1857 +                        var bx= 0;
  1.1858 +                        var by= section_a[2] ; 
  1.1859 +                        
  1.1860 +                        var cx=prevbox.x+prevbox.width; 
  1.1861 +                        var cy= prevbox.y;
  1.1862 +
  1.1863 +                        var dx= prevbox.x+prevbox.width;  
  1.1864 +                        var dy= 0;
  1.1865 +                        
  1.1866 +                      
  1.1867 +                var section_b=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);
  1.1868 +
  1.1869 +                var distx=dist2p(section_a[1],section_a[2],section_b[1],section_b[2]);         
  1.1870 +                
  1.1871 +                        var ax= section_a[1];
  1.1872 +                        var ay= section_a[2];
  1.1873 +                        var bx= section_a[1] 
  1.1874 +                        var by= 0; 
  1.1875 +                        
  1.1876 +                        var cx= prevbox.x; 
  1.1877 +                        var cy= prevbox.y+prevbox.height; 
  1.1878 +
  1.1879 +                        var dx= 0; 
  1.1880 +                        var dy= prevbox.y+prevbox.height;
  1.1881 +                        
  1.1882 +                      
  1.1883 +                var section_c=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);
  1.1884 +
  1.1885 +                var disty=dist2p(section_a[1],section_a[2],section_c[1],section_c[2]);         
  1.1886 +                
  1.1887 +                  
  1.1888 + 
  1.1889 +
  1.1890 +                    
  1.1891 +                        if(distx<1){distx=1;}    
  1.1892 +			
  1.1893 +         		
  1.1894 +			if(disty<1){disty=1;}
  1.1895 +                        //document.forms[0].code.value=distx+' '+disty;
  1.1896 +			tw=distx;
  1.1897 +			th=disty;
  1.1898 +
  1.1899 +			
  1.1900 +		}                  
  1.1901 +		
  1.1902 +	//////////////////// SE
  1.1903 +		
  1.1904 +           if( scaleType== 'se'){
  1.1905 +			trans_ShareScale=shareScale+","+shareScale;   
  1.1906 +			
  1.1907 +	          
  1.1908 +      			//var angle_diagonal=getAngle(prevbox.width,prevbox.height);
  1.1909 +       			var angle_diagonal=ang2v(prevbox.x,prevbox.y,prevbox.x+prevbox.width,prevbox.y+prevbox.height)
  1.1910 +		
  1.1911 +			
  1.1912 +			
  1.1913 +                        var ax= prevbox.x;
  1.1914 +                        var ay= prevbox.y;
  1.1915 +                        var bx= prevbox.x+prevbox.width; 
  1.1916 +                        var by= prevbox.y+prevbox.height; 
  1.1917 +                        
  1.1918 +                        var cx= toX;
  1.1919 +                        var cy= toY;   
  1.1920 +                        var dx= toX+10*Math.cos(angle_diagonal+(Math.PI/2)); 
  1.1921 +                        var dy= toY+10*Math.sin(angle_diagonal+(Math.PI/2)); 
  1.1922 +      
  1.1923 +                var section_a=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);   
  1.1924 +                
  1.1925 +                                         
  1.1926 +
  1.1927 +                //////////
  1.1928 +                var tx= prevbox.x;
  1.1929 +                var ty= prevbox.y;
  1.1930 +                
  1.1931 +                        var ax= section_a[1];
  1.1932 +                        var ay= section_a[2];
  1.1933 +                        var bx= 0;
  1.1934 +                        var by= section_a[2] ; 
  1.1935 +                        
  1.1936 +                        var cx=prevbox.x; 
  1.1937 +                        var cy= prevbox.y;
  1.1938 +
  1.1939 +                        var dx= prevbox.x;  
  1.1940 +                        var dy= 0;
  1.1941 +                        
  1.1942 +                      
  1.1943 +                var section_b=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);
  1.1944 +               
  1.1945 +               /////////////////
  1.1946 +               
  1.1947 +               
  1.1948 +                var distx=dist2p(section_a[1],section_a[2],section_b[1],section_b[2]);         
  1.1949 +
  1.1950 +             
  1.1951 +                        var ax= section_a[1];
  1.1952 +                        var ay= section_a[2];
  1.1953 +                        var bx= section_a[1] 
  1.1954 +                        var by= 0; 
  1.1955 +                        
  1.1956 +                        var cx= prevbox.x; 
  1.1957 +                        var cy= prevbox.y; 
  1.1958 +
  1.1959 +                        var dx=0;
  1.1960 +                        var dy= prevbox.y;
  1.1961 +                        
  1.1962 +                      
  1.1963 +                var section_c=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);
  1.1964 +               
  1.1965 +               ///////////////
  1.1966 +               
  1.1967 +                var disty=dist2p(section_a[1],section_a[2],section_c[1],section_c[2]);         
  1.1968 +                
  1.1969 +   
  1.1970 +                    
  1.1971 +                        if(distx<1){distx=1;}    
  1.1972 +			
  1.1973 +         		
  1.1974 +			if(disty<1){disty=1;}
  1.1975 +                        
  1.1976 +			tw=distx;
  1.1977 +			th=disty;
  1.1978 +
  1.1979 +			
  1.1980 +		}
  1.1981 +
  1.1982 +		if(scaleType== 'ne'){  
  1.1983 +		        
  1.1984 +			trans_ShareScale=shareScale+","+shareScale;   
  1.1985 +			
  1.1986 +	                var angle_diagonal=ang2v(prevbox.x,prevbox.y+prevbox.height,prevbox.x+prevbox.width,prevbox.y)
  1.1987 +      			//var angle_diagonal=getAngle(prevbox.width,prevbox.height);
  1.1988 + 		
  1.1989 +			
  1.1990 +				
  1.1991 +			
  1.1992 +                        var ax= prevbox.x;
  1.1993 +                        var ay= prevbox.y+prevbox.height;
  1.1994 +                        var bx= prevbox.x+prevbox.width; 
  1.1995 +                        var by= prevbox.y;
  1.1996 +                       
  1.1997 +                        var cx= toX;
  1.1998 +                        var cy= toY;   
  1.1999 +                        var dx= toX+10*Math.cos(angle_diagonal+(Math.PI/2)); 
  1.2000 +                        var dy= toY+10*Math.sin(angle_diagonal+(Math.PI/2)); 
  1.2001 +
  1.2002 +
  1.2003 +                      this.editor.log(angle_diagonal);
  1.2004 +
  1.2005 +      
  1.2006 +                var section_a=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);   
  1.2007 +                
  1.2008 +                                         
  1.2009 +
  1.2010 +                //////////
  1.2011 +                var tx= prevbox.x;
  1.2012 +                var ty= section_a[2];
  1.2013 +                
  1.2014 +                        var ax= section_a[1];
  1.2015 +                        var ay= section_a[2];
  1.2016 +                        var bx= 0;
  1.2017 +                        var by= section_a[2] ; 
  1.2018 +                        
  1.2019 +                        var cx=prevbox.x; 
  1.2020 +                        var cy= prevbox.y;
  1.2021 +
  1.2022 +                        var dx= prevbox.x;  
  1.2023 +                        var dy= 0;
  1.2024 +                        
  1.2025 +                      
  1.2026 +                var section_b=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);
  1.2027 +               
  1.2028 +               /////////////////
  1.2029 +               
  1.2030 +               
  1.2031 +                var distx=dist2p(section_a[1],section_a[2],section_b[1],section_b[2]);         
  1.2032 +
  1.2033 +             
  1.2034 +                        var ax= section_a[1];
  1.2035 +                        var ay= section_a[2];
  1.2036 +                        var bx= section_a[1]; 
  1.2037 +                        var by= 0; 
  1.2038 +                        
  1.2039 +                        var cx= prevbox.x; 
  1.2040 +                        var cy= prevbox.y+prevbox.height; 
  1.2041 +
  1.2042 +                        var dx=0;
  1.2043 +                        var dy= prevbox.y+prevbox.height;
  1.2044 +                        
  1.2045 +                      
  1.2046 +                var section_c=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);
  1.2047 +               
  1.2048 +               ///////////////
  1.2049 +               
  1.2050 +                var disty=dist2p(section_a[1],section_a[2],section_c[1],section_c[2]);         
  1.2051 +                
  1.2052 +
  1.2053 +                    
  1.2054 +                        if(distx<1){distx=1;}    
  1.2055 +			
  1.2056 +         		
  1.2057 +			if(disty<1){disty=1;}
  1.2058 +                        //document.forms[0].code.value=distx+' '+disty;
  1.2059 +			tw=distx;
  1.2060 +			th=disty;
  1.2061 +			
  1.2062 +			
  1.2063 +			
  1.2064 +			
  1.2065 +			
  1.2066 +		}
  1.2067 +		if(scaleType== 'sw'){
  1.2068 +			trans_ShareScale=shareScale+","+shareScale;  
  1.2069 +			
  1.2070 +			
  1.2071 +				
  1.2072 +			
  1.2073 +	                var angle_diagonal=ang2v(prevbox.x,prevbox.y+prevbox.height,prevbox.x+prevbox.width,prevbox.y)
  1.2074 +      			//var angle_diagonal=getAngle(prevbox.width,prevbox.height);
  1.2075 + 		
  1.2076 +			
  1.2077 +				
  1.2078 +			
  1.2079 +                        var ax= prevbox.x;
  1.2080 +                        var ay= prevbox.y+prevbox.height;
  1.2081 +                        var bx= prevbox.x+prevbox.width; 
  1.2082 +                        var by= prevbox.y;
  1.2083 +                       
  1.2084 +                        var cx= toX;
  1.2085 +                        var cy= toY;   
  1.2086 +                        var dx= toX+10*Math.cos(angle_diagonal+(Math.PI/2)); 
  1.2087 +                        var dy= toY+10*Math.sin(angle_diagonal+(Math.PI/2)); 
  1.2088 +
  1.2089 +
  1.2090 +                      this.editor.log(angle_diagonal);
  1.2091 +
  1.2092 +      
  1.2093 +                var section_a=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);   
  1.2094 +                
  1.2095 +
  1.2096 +                //////////
  1.2097 +                var tx= section_a[1];
  1.2098 +                var ty= prevbox.y;
  1.2099 +                
  1.2100 +                        var ax= section_a[1];
  1.2101 +                        var ay= section_a[2];
  1.2102 +                        var bx= 0;
  1.2103 +                        var by= section_a[2] ; 
  1.2104 +                        
  1.2105 +                        var cx=prevbox.x+prevbox.width; 
  1.2106 +                        var cy= prevbox.y+prevbox.height;
  1.2107 +
  1.2108 +                        var dx= prevbox.x+prevbox.width;  
  1.2109 +                        var dy= 0;
  1.2110 +                        
  1.2111 +                      
  1.2112 +                var section_b=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);
  1.2113 +                var distx=dist2p(section_a[1],section_a[2],section_b[1],section_b[2]);         
  1.2114 +
  1.2115 +               /////////////////             
  1.2116 +                        var ax= section_a[1];
  1.2117 +                        var ay= section_a[2];
  1.2118 +                        var bx= section_a[1];
  1.2119 +                        var by= 0; 
  1.2120 +                          
  1.2121 +                        var cx= prevbox.x; 
  1.2122 +                        var cy= prevbox.y; 
  1.2123 +
  1.2124 +                        var dx=0;
  1.2125 +                        var dy= prevbox.y;
  1.2126 +                        
  1.2127 +                      
  1.2128 +                var section_c=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);
  1.2129 +                  var disty=dist2p(section_a[1],section_a[2],section_c[1],section_c[2]);         
  1.2130 +              ///////////////
  1.2131 +                
  1.2132 +   
  1.2133 +                    
  1.2134 +                        if(distx<1){distx=1;}    
  1.2135 +			
  1.2136 +         		
  1.2137 +			if(disty<1){disty=1;}
  1.2138 +                        //document.forms[0].code.value=distx+' '+disty;
  1.2139 +			tw=distx;
  1.2140 +			th=disty;
  1.2141 +			
  1.2142 +		}
  1.2143 +
  1.2144 +	}  
  1.2145 +
  1.2146 +
  1.2147 +
  1.2148 + if(shape.tagName == 'rect')
  1.2149 +  { 
  1.2150 +    //alert(data[0]); 
  1.2151 +    
  1.2152 +    
  1.2153 +      shape.style.left = tx + 'px';
  1.2154 +      shape.style.top = ty + 'px'; 
  1.2155 +      shape.style.height = th + 'px';
  1.2156 +      shape.style.width = tw + 'px';
  1.2157 +    
  1.2158 +  }
  1.2159 +   else 
  1.2160 + if(shape.tagName == 'text')
  1.2161 +  {
  1.2162 +    /*
  1.2163 +    shape.setAttribute('x',tx);
  1.2164 +    shape.setAttribute('y',ty);   
  1.2165 +    shape.setAttribute('width', tw);     
  1.2166 +    shape.setAttribute('height', th); 
  1.2167 +    
  1.2168 +    //previus.setAttribute('transform', "scale("+trans_ShareScale+")");
  1.2169 +     shape.setAttribute('x', tx + 'px');
  1.2170 +    shape.setAttribute('y', ty + 'px');
  1.2171 +
  1.2172 +    shape.setAttribute('textLength', parseInt(Math.round(tw)));    
  1.2173 +    
  1.2174 +     */
  1.2175 +  } 
  1.2176 +   else 
  1.2177 + if(shape.tagName == 'oval')
  1.2178 +  {
  1.2179 +    //shape.getAttribute('transform)
  1.2180 +   
  1.2181 +      shape.style.left = tx + 'px';
  1.2182 +      shape.style.top = ty + 'px'; 
  1.2183 +      shape.style.height = th + 'px';
  1.2184 +      shape.style.width = tw + 'px';
  1.2185 + 
  1.2186 +        
  1.2187 +  }
  1.2188 +   else 
  1.2189 + if(shape.tagName == 'line')
  1.2190 +  { 
  1.2191 +       shape.setAttribute('to',tx + 'px,' + ty + 'px'); 
  1.2192 +           shape.setAttribute('from', tw + 'px,' + th + 'px');
  1.2193 +   
  1.2194 +         
  1.2195 +  }
  1.2196 +   else
  1.2197 + if (shape.tagName == 'polyline') 
  1.2198 +  {
  1.2199 +   
  1.2200 +  }
  1.2201 +   else 
  1.2202 + if (shape.tagName == 'image') 
  1.2203 +  {   
  1.2204 +     
  1.2205 +      shape.style.left = tx + 'px';
  1.2206 +      shape.style.top = ty + 'px'; 
  1.2207 +      shape.style.height = th + 'px';
  1.2208 +      shape.style.width = tw + 'px';
  1.2209 +      
  1.2210 +  }
  1.2211 +   else 
  1.2212 + if (shape.tagName == 'shape')
  1.2213 +  {     
  1.2214 +
  1.2215 +      shape.style.left = tx + 'px';
  1.2216 +      shape.style.top = ty + 'px'; 
  1.2217 +      shape.style.height = th + 'px';
  1.2218 +      shape.style.width = tw + 'px';
  1.2219 +
  1.2220 +       //document.forms[0].code.value='';
  1.2221 +       //shape.setAttribute('transform', "scale("+trans_ShareScale+")");
  1.2222 +
  1.2223 +  }  
  1.2224 +   	                             
  1.2225 +
  1.2226 + 
  1.2227 +         
  1.2228 +         
  1.2229 +};  
  1.2230 +
  1.2231 +
  1.2232 +
  1.2233 +VMLRenderer.prototype.rotateShape = function(shape, previus,toX, toY) {
  1.2234 + 
  1.2235 + 
  1.2236 + 
  1.2237 +         //document.forms[0].code.value=$('xyinput').innerHTML;  
  1.2238 +    //document.getElementById('richdraw').style.cursor='e-resize';
  1.2239 +         var box = this.bounds(shape);
  1.2240 +	 var prevbox=this.bounds(previus);
  1.2241 +	var centerx= box.x+(box.width/2);
  1.2242 +	var centery= box.y+(box.height/2); 
  1.2243 +	var coord=this.editor.inputxy;
  1.2244 +
  1.2245 +       var actual_angle=ang2v(centerx,centery,coord[0], coord[1]);
  1.2246 +       
  1.2247 +       if(xrot<toX) { rotatexxx+=1;}else{rotatexxx-=1;}
  1.2248 +       xrot=toX;
  1.2249 +       yrot=toY;  
  1.2250 +       
  1.2251 +	var xtr=0;
  1.2252 +        var ytr=0;
  1.2253 +                
  1.2254 +        //var box= shape.getBBox();  
  1.2255 +        var tr1x=  box.x;  
  1.2256 +         var tr1y=  box.y;
  1.2257 +
  1.2258 + 
  1.2259 + 
  1.2260 +    toX+=xtr;
  1.2261 +        toY+=xtr;
  1.2262 +
  1.2263 +      //var trax=parseFloat(toX-box.x);   var tray= parseFloat(toY-box.y);      
  1.2264 +      var trax=parseFloat(box.x/2);   var tray= parseFloat(box.y/2); 
  1.2265 +       var angler=Math.atan2(toX,toY);
  1.2266 +         var angle=angler*180/Math.PI;  
  1.2267 +         // var T = shape.getCTM(); 
  1.2268 +          //var rotini=T.a*(180 / Math.PI);
  1.2269 +           //var angle=rotini*180/Math.PI;
  1.2270 +          //var rot_angle=actual_angle*180/Math.PI;  
  1.2271 +          //document.forms[0].code.value=centerx+' '+centery+' '+coord[0]+' '+coord[1]+'____ '+rot_angle+' '+actual_angle*180/Math.PI;
  1.2272 +          
  1.2273 +          
  1.2274 +         // matrix( a, b, c, d, e, f )
  1.2275 +         // a c e
  1.2276 +         // b d f
  1.2277 +         // 0 0 1
  1.2278 +         //a scale factor of 2, a rotation of 30 deg and a translation of (500,50)
  1.2279 +         //T     1.732   -1   500     1   1.732   50     0   0   1
  1.2280 +         //T      1  ad-bc      d  -c -de+cf   -b  a  be-df    0   0   1
  1.2281 +         
  1.2282 +         //shape.setAttribute('transform', "translate("+(-xshe)+","+(-yshe)+")");
  1.2283 + 
  1.2284 +         // shape.setAttribute("transform", "  matrix( a, b, c, d, e, f )");
  1.2285 +          // shape.setAttribute('transform', "translate("+(box.x+(box.width/2))+","+(box.y+(box.height/2))+")  rotate("+rotatexxx+") ");
  1.2286 +           //shape.setAttribute('transform', "translate("+(box.x+(box.width/2))+","+(box.y+(box.height/2))+") rotate("+rotatexxx+") translate("+(-box.x-(box.width/2))+","+(-box.y-(box.height/2))+") ");
  1.2287 +         //shape.setAttribute('transform', "rotate("+rotatexxx+","+(box.x+(box.width/2))+","+(box.y+(box.height/2))+")");
  1.2288 +         //shape.setAttribute('transform', "rotate("+rotatexxx+","+(prevbox.x+(prevbox.width/2))+","+(prevbox.y+(prevbox.height/2))+")");
  1.2289 +         //shape.setAttribute('rotation', rot_angle);
  1.2290 +         shape.setAttribute('rotation', angle);
  1.2291 +         //(prevbox.x+(prevbox.width/2))+","+(prevbox.y+(prevbox.height/2))+")");
  1.2292 +                          
  1.2293 + 
  1.2294 + 
  1.2295 +    }
  1.2296 +
  1.2297 +//////////////////////////////
  1.2298 +/*H  = 0;
  1.2299 +W  = 0;
  1.2300 +LX = new Array();
  1.2301 +S  = new Array();
  1.2302 +i  = 0;
  1.2303 +b  = true;
  1.2304 +
  1.2305 +function SVG2VML(i){
  1.2306 +	l = L[i];
  1.2307 +	if(l.indexOf(" d=")>0){
  1.2308 +		p = l.indexOf("fill:")+6;
  1.2309 +		C = l.substring(p,p+7);
  1.2310 +		p = l.indexOf(" d=")+4;
  1.2311 +		q = l.lastIndexOf("z")-1;
  1.2312 +		l = l.substring(p,q);
  1.2313 +		l = l.replace(/M/g,"m");
  1.2314 +		l = l.replace(/c/g,"v");
  1.2315 +		l = l.replace(/l/g,"r");
  1.2316 +		S = l.split(" ");
  1.2317 +		l="";
  1.2318 +		for(var j in S){
  1.2319 +			c = S[j];
  1.2320 +			p = c.substring(0,1);
  1.2321 +			d = p>"9"?p:"";
  1.2322 +			n = Math.round(c.substring(d!="") * 100);
  1.2323 +			l+= (d+n+" ");
  1.2324 +		}
  1.2325 +		LX[i] = l;
  1.2326 +		code = '<v:shape coordsize="'+(W*100)+','+(H*100)+'" class=vml strokeweight="2" strokecolor="'+C+'" filled="false" fillcolor = "'+C+'"/>';
  1.2327 +		VML.insertAdjacentHTML("beforeEnd",code);
  1.2328 +	} else {
  1.2329 +		L[i] = LX[i] = ""
  1.2330 +		VML.insertAdjacentHTML("beforeEnd","<span></span>");
  1.2331 +	}
  1.2332 +}
  1.2333 +*/
  1.2334 +//http://msdn2.microsoft.com/en-us/library/bb263897(VS.85).aspx
  1.2335 +//http://www.w3.org/TR/NOTE-VML
  1.2336 +//http://trac.openlayers.org/changeset/5285
  1.2337 +//http://vectorconverter.sourceforge.net/index.html
  1.2338 +//http://www.dhteumeuleu.com/colorsyntax/viewJS.php?src=svg2vml1.html
  1.2339 +
  1.2340 +
  1.2341 +VMLRenderer.prototype.getshapes = function(){
  1.2342 +return this.container.childNodes;
  1.2343 +}
  1.2344 +
  1.2345 +
  1.2346 +VMLRenderer.prototype.reflect = function(HorV) {
  1.2347 +};
  1.2348 +
  1.2349 +
  1.2350 +
  1.2351 +