diff onlypaths/js/application_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/application_mini.js	Sun Jan 31 12:33:33 2010 -0500
     1.3 @@ -0,0 +1,1574 @@
     1.4 +
     1.5 +/*
     1.6 + * 
     1.7 + */ 
     1.8 +
     1.9 +Ext.BLANK_IMAGE_URL = 'theme/images/default/s.gif';
    1.10 +
    1.11 +if(typeof console != 'object') {
    1.12 +  console = {};
    1.13 +  console.log = function(){return false;};
    1.14 +}     
    1.15 +
    1.16 +
    1.17 +  function $(e){return Ext.get(e).dom}
    1.18 +  var c, browser, browserpath; 
    1.19 +  var colorpage="#ccccdd"; 
    1.20 +  var colorpage1a="#ee00aa"; //north  
    1.21 +  var colorpage1b="#ee00cc"; 
    1.22 +  var colorpage1c="#ee00ee"; 
    1.23 +  var colorpage2="#77aaaa";  //sud
    1.24 +  var colorpage3="#ddee00";  //est
    1.25 +  var colorpage4="#ccee00";  //west           
    1.26 +  
    1.27 +  var selectmode='';
    1.28 +  var selectedit='';
    1.29 +  
    1.30 +  
    1.31 +  ie = navigator.appVersion.match(/MSIE (\d\.\d)/);
    1.32 +  opera = (navigator.userAgent.toLowerCase().indexOf("opera") != -1);
    1.33 +  
    1.34 +  
    1.35 +  
    1.36 +  window.onresize = doResize; 
    1.37 +  var initialFile='big01.txt';
    1.38 +  var docx=0;
    1.39 +  var docy=0;
    1.40 +  var docw=600;
    1.41 +  var doch=400;
    1.42 +  var canvasWidth=600;//FRONTsize[0];  
    1.43 +  var canvasW=canvasWidth;  
    1.44 +  var canvasHeight=400;//FRONTsize[1];  
    1.45 +  var canvasH=canvasHeight;
    1.46 +  var canvasX=0; 
    1.47 +  var canvasY=0; 
    1.48 +  var zoomx=docx;
    1.49 +  var zoomy=docy;
    1.50 +  var zoomw=docw;
    1.51 +  var zoomh=doch;   
    1.52 +  var marginx=0;
    1.53 +  var marginy=0;      
    1.54 +  var margin=100;   
    1.55 +  var screenSize=myWorkSize();
    1.56 +  var scrW = screenSize[0];//screen.availWidth;
    1.57 +  var scrH = screenSize[1];//screen.availHeight; 
    1.58 +  
    1.59 +  var canvasYpercent=100;
    1.60 +  var canvasXpercent=100;
    1.61 +  
    1.62 + 
    1.63 +//?
    1.64 +  var wndW=scrW;//window.width;
    1.65 +  var wndH=scrH;//window.height;
    1.66 +//  
    1.67 +  var proporWindow= scrW/scrH;
    1.68 +  var proporCanvas=canvasW/canvasH;  
    1.69 +  var proporDoc=docw/doch; 
    1.70 +  var proporZoom= zoomw/zoomh; 
    1.71 +  var proporx=proporCanvas; //IE  
    1.72 +  var propory=1;      //IE  
    1.73 +  var mode='canvas';//'canvas' or 'preview'
    1.74 +
    1.75 +  var zoominit=docx+' '+docy+' '+docw+' '+doch; 
    1.76 +  var zoominit1 =zoominit;  
    1.77 +  var zoominit2 =zoominit;
    1.78 +
    1.79 +  var fieldViewx=Math.round(canvasH*proporCanvas); 
    1.80 +  var fieldViewy=canvasH;  
    1.81 +  var diagonalFrame=dist2p(0,0,fieldViewx,fieldViewy);
    1.82 +  var diagonalAngle=getAngle(fieldViewx,fieldViewy);                                  
    1.83 +  var diagonalinit=diagonalFrame;  
    1.84 +  //alert(diagonalinit);
    1.85 +  
    1.86 +  // double?
    1.87 +  var diagonalMidx=fieldViewx/2; 
    1.88 +  var diagonalMidy=fieldViewy/2;   
    1.89 +  var centerZoomx=diagonalMidx;//Math.round(zoomw/2);
    1.90 +  var centerZoomy=diagonalMidy;//Math.round(zoomh/2);        
    1.91 +  //
    1.92 +  
    1.93 +  
    1.94 +  var proporDiagonal=diagonalFrame/diagonalinit; 
    1.95 +  //////////////////////////
    1.96 +  
    1.97 +  var wProportion={x:35, y:24}
    1.98 +  
    1.99 +  var vertexNORTHmenu={};
   1.100 +  var vertexNORTHglobals={};
   1.101 +  var vertexNORTHoptions={};    
   1.102 +  var vertexSUD={};
   1.103 +  var vertexEST={};
   1.104 +  var vertexWEST={};
   1.105 +  var vertexFRONT={};
   1.106 + 
   1.107 +  var NORTHmenusize=[];
   1.108 +  var NORTHglobalssize=[];
   1.109 +  var NORTHoptionssize=[];  
   1.110 +  var SUDsize=[]; 
   1.111 +  var ESTsize=[]; 
   1.112 +  var WESTsize=[]; 
   1.113 +  var FRONTsize=[]; 
   1.114 +  
   1.115 +  
   1.116 +  vertexFrames();
   1.117 + 
   1.118 +
   1.119 +  var FRONT='';
   1.120 +  FRONT+='  <div id="richdraw"  style="background-image:url();background-color:#ff0000;position:relative; border:0px outset black;left:'+canvasX+'px;top:'+canvasY+'px;width:'+canvasW+'px;height:'+canvasH+'px; "></div>';
   1.121 +  
   1.122 +  var NORTHmenu='';
   1.123 +  NORTHmenu+='&nbsp;&nbsp;<span id="file">File</span>&nbsp;&nbsp;<span id="edit">Edit</span>';   
   1.124 + 
   1.125 +  var NORTHglobals='';
   1.126 +  NORTHglobals+='<span id="options_select" style="visibility:visible;position:relative;top:0px;left:'+canvasX+'px; padding:1px; margin-top:1px; background-color:tranparent;">';
   1.127 +  NORTHglobals+=' <img id="select_deleteone" title="Delete one" onclick="selectedit='+"'"+'deleteone'+"'"+';info_select()" src="img/delete.gif" >';    
   1.128 +  NORTHglobals+=' <img id="select_deleteall" title="Delete all" onclick="selectedit='+"'"+'deleteall'+"'"+';info_select()" src="img/reset.gif" >'    
   1.129 +  NORTHglobals+=' <img id="select_tothetop" title="To the top" onclick="selectedit='+"'"+'tothetop'+"'"+';info_select()" src="img/tothetop.gif" >';    
   1.130 +  NORTHglobals+=' <img id="select_totheback" title="To the back" onclick="selectedit='+"'"+'totheback'+"'"+';info_select()" src="img/totheback.gif" >';    
   1.131 +  NORTHglobals+=' <img id="select_onetop" title="One top" onclick="selectedit='+"'"+'onetop'+"'"+';info_select()" src="img/onetop.gif" >';    
   1.132 +  NORTHglobals+=' <img id="select_oneback" title="One back" onclick="selectedit='+"'"+'oneback'+"'"+';info_select()" src="img/oneback.gif" >';    
   1.133 +  NORTHglobals+=' <img id="select_reflectV" title="Vertical reflect" onclick="selectedit='+"'"+'reflectV'+"'"+';info_select()" src="img/reflect_h.gif" >',    
   1.134 +  NORTHglobals+=' <img id="select_reflectH" title="Horizontal reflect" onclick="selectedit='+"'"+'reflectH'+"'"+';info_select()" src="img/reflect_v.gif" >';    
   1.135 +  NORTHglobals+='</span>';
   1.136 +
   1.137 +  var NORTHoptions='';  
   1.138 +    // <!-- OPTIONS_SELECT_PATH --> 
   1.139 +  NORTHoptions+='<div id="options_select_path" style="font-size:9px;visibility:hidden;position:absolute;top:0px;left:5px;height:14px;width:100%; padding:1px; margin-top:1px; background-color:none;">';
   1.140 +  NORTHoptions+='<input type="text" name="codebase" id="codebase" style="height:15px;width:600px; padding:1px 1px 1px 4px; margin:0px; background-color:#ffffff;" value=""><img id="envshape" style="background-color:orange;" align="top"  title="Submit Shape" onclick="setShape();" border="0px" src="img/setpath1.gif">';
   1.141 +  NORTHoptions+='</div>'; 
   1.142 +  // <!-- OPTIONS_RECT --> 
   1.143 +  NORTHoptions+='<div id="options_rect" style="font-size:9px;visibility:hidden;position:absolute;top:0px;left:5px;height:14px;width:100%; padding:1px; margin-top:1px; background-color:none;">';
   1.144 +  NORTHoptions+='   trX<input id="option_rect_trx" type="text" size="1"  style="background-color:#ffffdd" value="0" onKeyPress="return edit(this,event)">'; 
   1.145 +  NORTHoptions+='   trY<input id="option_rect_try" type="text" size="1"  style="background-color:#ffffdd" value="0"onKeyPress="return edit(this,event)">'; 
   1.146 +  NORTHoptions+='   wx<input id="option_rect_sclx" type="text" size="1" style="background-color:#ddffdd" value="1" onKeyPress="return edit(this,event)">'; 
   1.147 +  NORTHoptions+='   wy<input id="option_rect_scly" type="text" size="1" style="background-color:#ddffdd" value="1" onKeyPress="return edit(this,event)">';   
   1.148 +  NORTHoptions+='   rot<input id="option_rect_rot" type="text" size="1" style="background-color:#ffdddd"  value="0" onKeyPress="return edit(this,event)">'; 
   1.149 +  NORTHoptions+='</div>';
   1.150 +  // <!-- OPTIONS_IMAGE -->
   1.151 +  NORTHoptions+='<div id="options_image" style="font-size:9px;visibility:hidden;position:absolute;top:0px;left:5px;height:14px;width:100%; padding:1px; margin-top:1px; background-color:none;">';
   1.152 +  NORTHoptions+=' trX<input id="option_img_trx" type="text" size="1"  style="background-color:#ffffdd" value="0" onKeyPress="return edit(this,event)">'; 
   1.153 +  NORTHoptions+=' trY<input id="option_img_try" type="text" size="1"  style="background-color:#ffffdd" value="0"onKeyPress="return edit(this,event)">'; 
   1.154 +  NORTHoptions+=' wx<input id="option_img_sclx" type="text" size="1" style="background-color:#ddffdd" value="1" onKeyPress="return edit(this,event)">'; 
   1.155 +  NORTHoptions+=' wy<input id="option_img_scly" type="text" size="1" style="background-color:#ddffdd" value="1" onKeyPress="return edit(this,event)">';   
   1.156 +  NORTHoptions+=' rot<input id="option_img_rot" type="text" size="1" style="background-color:#ffdddd"  value="0" onKeyPress="return edit(this,event)">'; 
   1.157 +  NORTHoptions+=' Source: <input name="option_image_href" type="text" size="62" id="option_image_href"  value="http://tavmjong.free.fr/INKSCAPE/MANUAL/images/QUICKSTART/SOUPCAN/SoupCan_SoupedUp.png" onmouseover="" onKeyPress="return edit(this,event)">';
   1.158 +  NORTHoptions+='</div>';  
   1.159 +  //<!-- OPTIONS_PATH -->
   1.160 +  NORTHoptions+='<div id="options_path" style="font-size:9px;visibility:hidden;position:absolute;top:0px;left:5px;height:14px;width:100%; padding:1px; margin-top:1px; background-color:none;">';
   1.161 +  NORTHoptions+=' trX<input id="option_path_trx" type="text" size="1"  style="background-color:#ffffdd" value="0" onKeyPress="return edit(this,event)">'; 
   1.162 +  NORTHoptions+=' trY<input id="option_path_try" type="text" size="1"  style="background-color:#ffffdd" value="0"onKeyPress="return edit(this,event)">'; 
   1.163 +  NORTHoptions+=' <input id="option_path_sclx" type="hidden" size="1" style="background-color:#ddffdd" value="1" onKeyPress="return edit(this,event)">'; 
   1.164 +  NORTHoptions+=' <input id="option_path_scly" type="hidden" size="1" style="background-color:#ddffdd" value="1" onKeyPress="return edit(this,event)">';   
   1.165 +  NORTHoptions+=' rot<input id="option_path_rot" type="text" size="1" style="background-color:#ffdddd"  value="0" onKeyPress="return edit(this,event)">'; 
   1.166 +  NORTHoptions+=' Open/Close: <input CHECKED name="option_path_close"  id="option_path_close" type="checkbox">';
   1.167 +  NORTHoptions+=' <input type="text" name="control_codebase" id="control_codebase" style="height:15px;width:300px; padding:1px 1px 1px 4px; margin:0px; background-color:#ffffff;" onmouseover="" value="" onKeyPress="return edit(this,event)">';
   1.168 +  NORTHoptions+=' <img style="cursor:pointer" align="top" title="to curve" onclick="c.renderer.tocurve();" src="img/tocurve.gif">';
   1.169 +  NORTHoptions+=' <input id="option_path_num" type="hidden" size="1" style="background-color:#ffdddd"  value="0">';
   1.170 +  NORTHoptions+=' Px<input id="option_path_x" type="text" size="1" style="background-color:#ffdddd"  value="0" onKeyPress="return editPath(this,event)">';
   1.171 +  NORTHoptions+=' Py<input id="option_path_y" type="text" size="1" style="background-color:#ffdddd"  value="0" onKeyPress="return editPath(this,event)">';   
   1.172 +  NORTHoptions+='</div>';
   1.173 +  //<!--OPTIONS ELLIPSE-->    
   1.174 +  NORTHoptions+='<div id="options_ellipse" style="font-size:9px;visibility:hidden;position:absolute;top:0px;left:5px;height:14px;width:100%; padding:1px; margin-top:1px; background-color:none;">';
   1.175 +  NORTHoptions+=' trX<input id="option_ellipse_trx" type="text" size="1"  style="background-color:#ffffdd" value="0" onKeyPress="return edit(this,event)">'; 
   1.176 +  NORTHoptions+=' trY<input id="option_ellipse_try" type="text" size="1"  style="background-color:#ffffdd" value="0"onKeyPress="return edit(this,event)">'; 
   1.177 +  NORTHoptions+=' wx<input id="option_ellipse_sclx" type="text" size="1" style="background-color:#ddffdd" value="1" onKeyPress="return edit(this,event)">'; 
   1.178 +  NORTHoptions+=' wy<input id="option_ellipse_scly" type="text" size="1" style="background-color:#ddffdd" value="1" onKeyPress="return edit(this,event)">';   
   1.179 +  NORTHoptions+=' rot<input id="option_ellipse_rot" type="text" size="1" style="background-color:#ffdddd"  value="0" onKeyPress="return edit(this,event)">'; 
   1.180 +  NORTHoptions+='</div>';
   1.181 +  //<!-- OPTIONS_ZOOM -->
   1.182 +  NORTHoptions+='<div id="options_zoom" style="font-size:9px;visibility:hidden;position:relative;top:0px;left:'+canvasX+'px; padding:0px; margin-top:0px; background-color:tranparent;">';
   1.183 +  NORTHoptions+=' <img id="zoom_more" title="More zoom" onclick="zoommode='+"'"+'more'+"'"+';info_zoom()" src="img/zoom_more.gif" >';    
   1.184 +  NORTHoptions+=' <img id="zoom_minus" title="Minus zoom" onclick="zoommode='+"'"+'minus'+"'"+';info_zoom()" src="img/zoom_minus.gif" >';    
   1.185 +  NORTHoptions+=' <img id="zoom_frame" title="Frame zoom" onclick="zoommode='+"'"+'frame'+"'"+';info_zoom()" src="img/zoom_frame.gif" >';    
   1.186 +  NORTHoptions+=' <img id="zoom_window" title="Window zoom" onclick="zoommode='+"'"+'window'+"'"+';info_zoom()" src="img/zoom_window.gif" >';    
   1.187 +  NORTHoptions+=' <img id="zoom_hand" title="Hand zoom" onclick="zoommode='+"'"+'hand'+"'"+';info_zoom()" src="img/zoom_hand.gif" >';    
   1.188 +  NORTHoptions+='</div>';
   1.189 +  //<!-- OPTIONS TEXT-->
   1.190 +  NORTHoptions+='<div id="options_text" style="font-size:9px;visibility:hidden;position:absolute;top:0px;left:90px;width:100%; padding:1px; margin-top:1px;z-index:200; background-color:transparent;">';
   1.191 +  NORTHoptions+=' <input name="option_text_message"  type="text"   size="22" id="option_text_message"  value="My text" onKeyPress="return edit(this,event)" style="visibility:inherit!important" />'; 
   1.192 +  NORTHoptions+=' Size:<input type="text" size="3" id="option_text_size"  name="option_text_size" value="30" onKeyPress="return edit(this,event)" style="">'; 
   1.193 +  NORTHoptions+=' Family:<select id="select_option_text_family" name="select_option_text_family" onchange="setTextFamily(this);" style="font-size:9px;">';
   1.194 +  NORTHoptions+='     <option style="font-family:Arial;" value="Arial">Arial</option>';
   1.195 +  NORTHoptions+='    <option  style="font-family:Verdana;"  value="Verdana">Verdana</option>';
   1.196 +  NORTHoptions+='    <option  style="font-family:Times;" value="Times">Times</option>'; 
   1.197 +  NORTHoptions+='    <option  style="font-family:Times;" value="Tahoma">Tahoma</option>';
   1.198 +  NORTHoptions+='    <option  style="font-family:Times;" value="Impact">Impact</option>';
   1.199 +  NORTHoptions+='  </select>';
   1.200 +  NORTHoptions+='  <input type="hidden" name="option_text_family" id="option_text_family" value="Arial" >';
   1.201 +  NORTHoptions+='</div>';  
   1.202 +  
   1.203 +  
   1.204 +  var EST='';
   1.205 +   EST+='<img id="select" title="Select shapes" onclick="c.pathsEdit=false; setMode('+"'"+'select'+"'"+', '+"'"+'Selection'+"'"+');" src="img/select3.gif" >';
   1.206 +   EST+='<img id="pathsEdit" title="Edit path" onclick="c.pathsEdit=true; setMode('+"'"+'pathsEdit'+"'"+', '+"'"+'Path Edit'+"'"+');" src="img/editpath.gif" >';
   1.207 +   EST+='<img id="zoom" title="Select zoom" onclick="setMode('+"'"+'zoom'+"'"+', '+"'"+'Zoom'+"'"+');" src="img/zoom.gif" >';
   1.208 +   EST+='<img id="rect" title="Draw a rectangle" onclick="setMode('+"'"+'rect'+"'"+', '+"'"+'Rectangle'+"'"+');" src="img/rectangle.gif" >';
   1.209 +   EST+='<img id="roundrect" title="Draw a rounded rectangle" onclick="setMode('+"'"+'roundrect'+"'"+', '+"'"+'Rounded Rectangle'+"'"+');" src="img/roundrect.gif" >';
   1.210 +   EST+='<img id="ellipse" title="Draw an ellipse" onclick="setMode('+"'"+'ellipse'+"'"+', '+"'"+'Ellipse / Circle'+"'"+');" src="img/circle.gif" >';
   1.211 +   EST+='<img id="line" title="Draw a line" onclick="setMode('+"'"+'line'+"'"+', '+"'"+'Line'+"'"+');" src="img/line.gif" >';  
   1.212 +   EST+='<img id="path" title="Draw a path" onclick="setMode('+"'"+'path'+"'"+', '+"'"+'Path'+"'"+');" src="img/path2.gif">';
   1.213 +   EST+='<img id="controlpath" title="Draw a path" onclick="setMode('+"'"+'controlpath'+"'"+', '+"'"+'controlPath'+"'"+');" src="img/path3.gif">';
   1.214 +   EST+='<img id="text" title="Write a text" onclick="setMode('+"'"+'text'+"'"+', '+"'"+'Text'+"'"+');" src="img/text.gif">';   
   1.215 +   EST+='<img id="shape" title="Open a shape" onclick="setMode('+"'"+'shape'+"'"+', '+"'"+'Shape'+"'"+');" src="img/shape.gif">';
   1.216 +   EST+='<img id="image" title="Put a image" onclick="setMode('+"'"+'image'+"'"+', '+"'"+'Image'+"'"+');" src="img/image.gif" >';    
   1.217 +
   1.218 +   var WEST='';   
   1.219 +   WEST+='<div id="xyinput"  style="width:40px;background-color:none">0,0</div>';
   1.220 +   WEST+='<div style="font-size:9px">Grid:</div>';
   1.221 +   WEST+='<select id="gridwidth" style="font-size:9px">';
   1.222 +       var chain='';
   1.223 +       for(var num=1;num<=30;num++)
   1.224 +       {
   1.225 +         chain+='<option value="'+num+'">'+num+'px</option>';
   1.226 +       }   
   1.227 +   WEST+=chain;    
   1.228 +   WEST+='</select>';
   1.229 +   WEST+='<br>'; 
   1.230 + 
   1.231 +   WEST+=' <div name="me-container">';
   1.232 +   WEST+=' <div id="fill-me">'; 
   1.233 +   WEST+=' <img style=" padding:0px; border:0px solid orange;" id="img_okfill" onclick="setbe(1,'+"'"+'img_okfill'+"'"+')" src="img/theme/images/ok.gif">Fill<div id="fill-square"></div>';
   1.234 +   WEST+=' <div id="slider-fill"></div>'; 
   1.235 +   WEST+=' <div id="fillContainer"></div>';  
   1.236 +   WEST+=' <div id="opacity-slider-fill" title="Fill opacity"></div>';  
   1.237 +   WEST+=' </div>'; 
   1.238 +   WEST+=' <div id="stroke-me">'; 
   1.239 +   WEST+='  <img style=" padding:0px; border:0px solid orange;" id="img_okstroke" onclick="setbe(2,'+"'"+'img_okstroke'+"'"+')" src="img/theme/images/ok.gif">Line<div id="stroke-square"></div>';
   1.240 +   WEST+=' <div id="slider-stroke"></div>';
   1.241 +   WEST+=' <div id="strokeContainer"></div>'; 
   1.242 +   WEST+='  <div id="width-slider-stroke-mask"></div><div id="width-slider-stroke" title="Stroke width"></div>'; 
   1.243 +   WEST+='  <div id="opacity-slider-stroke" title="Stroke opacity"></div>'; 
   1.244 +   WEST+='  </div>'; 
   1.245 +   WEST+='  <div id="divformfill">'; 
   1.246 +   WEST+='  </div>';
   1.247 +   WEST+='  <div id="divformstroke">'; 
   1.248 +   WEST+='  </div>';
   1.249 + 
   1.250 +   WEST+='</div>';
   1.251 +   WEST+=' <div id="panel_shapes" style="overflow:auto;font-size:9px;visibility:hidden;position:absolute;top:200px;left:0px;height:122px;width:200px; padding:1px; margin-top:1px; background-color:none;">';
   1.252 +   WEST+='    <iframe id="linksPaths" style="visibility:hidden;overflow:auto;padding:0px;border-style:outset;border-width:0px;margin:0px;width:200px;height:122px;background-color:wheat;" src="svgpaths.htm"></iframe>';
   1.253 +   WEST+=' </div> ';
   1.254 +
   1.255 +   var SUD="";
   1.256 +   //SUD+='<img id="showcode" title="Show the code" alt="" onclick="showMarkupCode();" src="img/viewcode.gif" style="border-color:#dd7700" >';
   1.257 +   //SUD+='<img id="showmarkup" title="Show the raw markup" alt="" onclick="shm();" src="img/viewcode.gif" >';
   1.258 +   //SUD+='<img id="loadmarkup" title="Load the raw markup" alt="" onclick="lcm();" src="img/loadcode.gif" >';
   1.259 +   //SUD+='<br>&nbsp;';
   1.260 +   SUD+='<br>&nbsp;';
   1.261 +   SUD+='<input type="text"  id="someinfo" value="No Data" name="someinfo" style="width:80%;">';
   1.262 +  // SUD+='<textarea name="code" id="code"  style="width:420px;height:200px;padding:0px"></textarea>';
   1.263 +  // SUD+='<div>';
   1.264 +  // SUD+='</div>';
   1.265 +
   1.266 + var currentEditStatus='off'; 
   1.267 + var currentFileStatus='off';
   1.268 +  var infoFrame, docFrame;
   1.269 +Ext.onReady(function() {  
   1.270 +
   1.271 +
   1.272 +  //var map = new Ext.KeyMap(document, {  
   1.273 +  // key: [Ext.EventObject.LEFT, Ext.EventObject.RIGHT],  
   1.274 +  // ctrl: true,  
   1.275 +  // fn: keypresshandler  
   1.276 +  //});  
   1.277 +  Ext.get("FRONT").dom.innerHTML=(FRONT);
   1.278 +  Ext.get("NORTHmenu").dom.innerHTML=(NORTHmenu); 
   1.279 +  Ext.get("NORTHglobals").dom.innerHTML=(NORTHglobals);  
   1.280 +  Ext.get("NORTHoptions").dom.innerHTML=(NORTHoptions);
   1.281 +  Ext.get("EST").dom.innerHTML=(EST);
   1.282 +  Ext.get("WEST").dom.innerHTML=(WEST);    
   1.283 +  Ext.get("SUD").dom.innerHTML=(SUD); 
   1.284 +  
   1.285 +  resizeFrame();
   1.286 +  var map= new Ext.KeyMap(document, [
   1.287 +    {
   1.288 +        key: [46],//DELETE
   1.289 +        fn: function(){ c.deleteSelection(); }
   1.290 +    }, {
   1.291 +        key: "x",
   1.292 +        ctrl:true,
   1.293 +        fn: function(){ 	
   1.294 +        	c.clipboard=c.renderer.copy(c.selected);
   1.295 +	     	c.deleteSelection();  
   1.296 +	      }    
   1.297 +    }, {
   1.298 +        key: "c",
   1.299 +        ctrl:true,
   1.300 +        fn: function(){ 	
   1.301 +			 c.clipboard=c.renderer.copy(c.selected);
   1.302 +	      }	      
   1.303 +    }, {
   1.304 +        key: "d",
   1.305 +        ctrl:true,
   1.306 +        fn: function(){ 	
   1.307 +			 c.selected=c.renderer.duplicate(c.selected);
   1.308 +			 c.selected.id = 'shape:' + createUUID();
   1.309 +    			Ext.get(c.selected).on( "mousedown", c.onHit,c);  
   1.310 +	      }	      
   1.311 +    }, {
   1.312 +        key: "v",
   1.313 +        ctrl:true,
   1.314 +        fn: function(){ 	
   1.315 +			 c.selected=c.renderer.paste(c.clipboard,c.mouseDownX,c.mouseDownY);
   1.316 +			 c.selected.id = 'shape:' + createUUID();
   1.317 + 			Ext.get(c.selected).on( "mousedown", c.onHit,c);  
   1.318 +	      }	      
   1.319 +    }, {
   1.320 +        key: "z", //UNDO
   1.321 +        ctrl:true,
   1.322 +        shift:false,
   1.323 +        fn: function(){ c.clipboard=c.renderer.undo(); }
   1.324 +    }
   1.325 +]);                                  
   1.326 +
   1.327 +  /*
   1.328 +  Ext.get("richdraw").dom.style.width=(canvasWidth);
   1.329 +  Ext.get("richdraw").dom.style.height=(canvasHeight);
   1.330 +  Ext.get("richdraw").dom.style.left=(canvasX);
   1.331 +  Ext.get("richdraw").dom.style.top=(canvasY);
   1.332 + */ 
   1.333 +  
   1.334 +  
   1.335 +  
   1.336 + menuEdit = new Ext.menu.Menu({
   1.337 +  id: 'menuedit',
   1.338 +  items: [
   1.339 +   {icon: "img/viewcode.gif", text: 'Copy all     ', handler: shm},
   1.340 +   {icon: "img/viewcode.gif", text: 'Paste all    ', handler: lcm},
   1.341 +   {icon: "img/viewcode.gif", text: 'Delete all   ', handler: deleteAllShapes},
   1.342 +   {icon: "img/viewcode.gif", text: 'Duplicate&nbsp;&nbsp;<b>Ctrl+d</b>', handler: duplicateSelected},
   1.343 +   {icon: "img/viewcode.gif", text: 'Cut&nbsp;&nbsp;&nbsp;&nbsp;<b>Ctrl+x</b>', handler: cutSelected},
   1.344 +   {icon: "img/viewcode.gif", text: 'Copy&nbsp;&nbsp;&nbsp;&nbsp;<b>Ctrl+c</b>', handler: copySelected},
   1.345 +   {icon: "img/viewcode.gif", text: 'Paste&nbsp;&nbsp;<b>Ctrl+v</b>', handler: pasteSelected},
   1.346 +   {icon: "img/viewcode.gif", text: 'Delete&nbsp;&nbsp;&nbsp;<b>Supr</b>', handler: deleteShape},
   1.347 +   {icon: "img/viewcode.gif", text: 'Delete last&nbsp;<b>Ctrl+z</b>', handler: deleteLastShapes},
   1.348 +
   1.349 +  ] 
   1.350 + });   
   1.351 + 
   1.352 + menuFile = new Ext.menu.Menu({
   1.353 +  id: 'menufile',  
   1.354 +   
   1.355 +  items: [  
   1.356 +   new Ext.menu.Item({ icon: "img/viewcode.gif", text: 'Open    ', handler: openFile   }),
   1.357 +   new Ext.menu.Item({ icon: "img/viewcode.gif", text: 'View SVG code    ', handler: showMarkupCode   }),
   1.358 +   new Ext.menu.Item({icon: "img/viewcode.gif", text: 'View OPF code    ', handler: showMarkup   }), 
   1.359 +   new Ext.menu.Item({icon: "img/viewcode.gif", text: 'Document properties    ', handler: documentProperties   })
   1.360 +  ] 
   1.361 + });
   1.362 +/*
   1.363 +  items: [ 
   1.364 +   {icon: "img/viewcode.gif", text: 'View SVG code    ', handler: showMarkupCode },
   1.365 +   {icon: "img/viewcode.gif", text: 'View OPF code    ', handler: showMarkup }, 
   1.366 +   {icon: "img/viewcode.gif", text: 'Document properties    ', handler: documentProperties },
   1.367 +
   1.368 +  ] 
   1.369 +*/ 
   1.370 +// define the handler for mouseover/out of either button or menu itself
   1.371 + var editHandler = function(e) 
   1.372 + {
   1.373 +  if(currentEditStatus=='on')
   1.374 +   {
   1.375 +    var edit = menuEdit.getEl();
   1.376 +    var buttonEdit = Ext.get('edit');
   1.377 +    if(!edit.getRegion().contains(e.getPoint()) && !buttonEdit.getRegion().contains(e.getPoint()))
   1.378 +     {
   1.379 +      menuEdit.hide();
   1.380 +      currentEditStatus='off';
   1.381 +     }
   1.382 +   }
   1.383 +    else
   1.384 +   {
   1.385 +    menuEdit.show('edit');
   1.386 +    currentEditStatus='on';
   1.387 +   }
   1.388 + }
   1.389 +
   1.390 + var fileHandler = function(e) 
   1.391 + {
   1.392 +  if(currentFileStatus=='on')
   1.393 +   {
   1.394 +    var file = menuFile.getEl();
   1.395 +    var buttonFile = Ext.get('file');
   1.396 +    if(!file.getRegion().contains(e.getPoint()) && !buttonFile.getRegion().contains(e.getPoint()))
   1.397 +     {
   1.398 +      menuFile.hide();
   1.399 +      currentFileStatus='off';
   1.400 +     }
   1.401 +   }
   1.402 +    else
   1.403 +   {
   1.404 +    menuFile.show('file');
   1.405 +    currentFileStatus='on';
   1.406 +   }
   1.407 + }
   1.408 +
   1.409 + // define the events to observe 
   1.410 + Ext.get('edit').on('mouseover',editHandler);
   1.411 + Ext.get('edit').on('mouseout',editHandler);
   1.412 + menuEdit.getEl().on('mouseout',editHandler); 
   1.413 + 
   1.414 + Ext.get('file').on('mouseover',fileHandler);
   1.415 + Ext.get('file').on('mouseout',fileHandler);
   1.416 + menuFile.getEl().on('mouseout',fileHandler);
   1.417 +
   1.418 +
   1.419 + 
   1.420 +
   1.421 +}); 
   1.422 +
   1.423 +//  end ONREADY 
   1.424 +
   1.425 +function borderDoc(){  
   1.426 + //c.rectCanvas(docx,docy,docw,doch,viewBox)
   1.427 +     if(mode=='canvas')
   1.428 +         {  
   1.429 +         var obj=document.getElementById("rectDoc"); 
   1.430 +         if(obj){c.renderer.remove(obj) }
   1.431 +         c.renderer.rectDoc(zoominit1); 
   1.432 +         //pst.id = "rectCanvas";
   1.433 +               //c.selected=obj;
   1.434 +                // c.renderer.remove(obj) 
   1.435 +         //var clip=c.renderer.copy(obj);
   1.436 +        
   1.437 +         
   1.438 +         
   1.439 +         //var pst=c.container.appendChild( clip );
   1.440 +         //c.renderer.paste(clip,0,0); 
   1.441 +         //pst.id = "rectCanvas";
   1.442 +         
   1.443 +         
   1.444 +         //pasteSelected();
   1.445 +
   1.446 +          //c.renderer.duplicate(document.getElementById("rectCanvas"))
   1.447 +          //c.renderer.remove(document.getElementById("rectCanvas"));
   1.448 +         }
   1.449 +}
   1.450 + function demo() {   
   1.451 +    _dom=document.all?3:(document.getElementById?1:(document.layers?2:0));
   1.452 +
   1.453 +    var renderer;
   1.454 +
   1.455 +    if ((!ie) || (opera)) {
   1.456 +      renderer = new SVGRenderer();
   1.457 +      browser='svg';
   1.458 +      browserpath="linkspath.htm";
   1.459 +    }
   1.460 +    else {
   1.461 +      renderer = new VMLRenderer(); 
   1.462 +      browser='vml';
   1.463 +      browserpath="vmlpaths.htm";
   1.464 +    }
   1.465 +
   1.466 +    c = new RichDrawEditor(document.getElementById('richdraw'), renderer); 
   1.467 +   
   1.468 +    c.onInputXY = function(x,y){$('xyinput').innerHTML = parseInt(x)+','+parseInt(y)}//[x,y].join("<br>")}
   1.469 +    
   1.470 +    c.onselect = onSelect;
   1.471 +    c.onunselect = onUnselect;  
   1.472 +   
   1.473 +     
   1.474 +
   1.475 +    // c.onkeydown = keypresshandler;     
   1.476 +   //c.onkeypress = c.onKeyPress;
   1.477 +    //document.onkeypress = c.onKeyPress;
   1.478 +       
   1.479 +    
   1.480 +    
   1.481 +    c.editCommand('fillcolor', 'red');
   1.482 +    c.editCommand('linecolor', 'black');
   1.483 +    c.editCommand('linewidth', '1px');   
   1.484 +    
   1.485 +  
   1.486 +    //setMode('path', 'Path');
   1.487 +    setMode('select', 'Selection');
   1.488 +
   1.489 +   document.body.style.backgroundColor = colorpage;     
   1.490 + 
   1.491 +
   1.492 +  //alert(vertexSUD.SUD1[0]+' '+vertexSUD.SUD1[1]+ '--'+wndW+' '+wndH);
   1.493 +
   1.494 +  setTimeout(loadDemo,500)    
   1.495 +  //Ext.get("richdraw").on('keydown', function(e){alert('dfsd'); }, false);
   1.496 +   //Ext.get("richdraw").on('keydown', function(e){alert(e.keyCode); });
   1.497 +    //document.onkeydown = keypresshandler;
   1.498 +//richdraw.svgRoot.setAttributeNS(null,'viewBox', '0 0 700 500');
   1.499 +
   1.500 +  //setTimeout(borderDoc,500)  
   1.501 +
   1.502 +  }   //END demo
   1.503 +
   1.504 +
   1.505 +/////////////////
   1.506 +
   1.507 +
   1.508 +//////////////////
   1.509 +var Docs = function(){
   1.510 + return {
   1.511 +   init : function(){
   1.512 +    var loading = Ext.get('loading');
   1.513 +    var mask = Ext.get('loading-mask');
   1.514 +    mask.setOpacity(.7);
   1.515 +    mask.shift({
   1.516 +     xy:loading.getXY(),
   1.517 +     width:loading.getWidth(),
   1.518 +     height:loading.getHeight(),
   1.519 +     remove:true,
   1.520 +     duration:2,
   1.521 +     opacity:.8,
   1.522 +     easing:'bounceOut',
   1.523 +     callback : function(){
   1.524 +      loading.fadeOut({duration:.2,remove:true});
   1.525 +     }
   1.526 +    });
   1.527 +   }
   1.528 +  };
   1.529 +}();
   1.530 +
   1.531 +
   1.532 +Ext.onReady(Docs.init, Docs, true);
   1.533 +
   1.534 +function showinfoFrame(wtitle) {   
   1.535 +      var win = new Ext.Window({   
   1.536 +        closeAction: 'hide',
   1.537 +        renderTo: 'showInfo',
   1.538 +        autoScroll:true,
   1.539 +        modal:true,
   1.540 +	width: '440',
   1.541 +	height:'300', 
   1.542 +	x: '120',
   1.543 +	y: '40',
   1.544 +	title: wtitle, 
   1.545 +	draggable :true,
   1.546 +	html: '', 
   1.547 +	hidden: true,
   1.548 +	contentEl: 'divCode',
   1.549 +	collapsed: true 
   1.550 +	
   1.551 + });  
   1.552 + win.show();
   1.553 +} 
   1.554 +function showdocFrame(wtitle) {   
   1.555 +      var win = new Ext.Window({ 
   1.556 +        closeAction: 'hide', 
   1.557 +        renderTo: 'showInfo',
   1.558 +       	width: '340',
   1.559 +	height:'300', 
   1.560 +	x: '120',
   1.561 +	y: '40',
   1.562 +	title: wtitle, 
   1.563 +	draggable :true,
   1.564 +	html: '', 
   1.565 +	hidden: true,
   1.566 +	contentEl: 'docProperties',
   1.567 +	collapsed: true 
   1.568 +	
   1.569 + });  
   1.570 + win.show();
   1.571 +}    
   1.572 +function showopenFile(wtitle) {   
   1.573 +      var win = new Ext.Window({  
   1.574 +        autoScroll:true,
   1.575 +        closeAction: 'hide', 
   1.576 +        renderTo: 'showInfo',
   1.577 +       	width: '440',
   1.578 +	height:'300', 
   1.579 +	x: '120',
   1.580 +	y: '40',
   1.581 +	title: wtitle, 
   1.582 +	draggable :true,
   1.583 +	html: '', 
   1.584 +	hidden: true,
   1.585 +	contentEl: 'divopenFile',
   1.586 +	collapsed: true 
   1.587 +	
   1.588 + });  
   1.589 + win.show();
   1.590 +}      
   1.591 +
   1.592 +/////////////////////////////
   1.593 +//FUNCTIONS 
   1.594 +/////////////////////////////
   1.595 +
   1.596 +function changeInitialFile() 
   1.597 +{  
   1.598 +   initialFile=document.forms[0].file.value; 
   1.599 +   c.renderer.removeAll()
   1.600 +   loadDemo(); 
   1.601 +  
   1.602 +} 
   1.603 + 
   1.604 + function setMode(mode, status) 
   1.605 +   { 
   1.606 +    
   1.607 +   
   1.608 +    selectmode=mode;
   1.609 +    if(mode=='shape')
   1.610 +     { 
   1.611 +            c.editCommand('mode', 'select');
   1.612 +     }else{              
   1.613 +            if(mode=='pathsEdit' )
   1.614 +             {
   1.615 +                mode='select';
   1.616 +             }
   1.617 +            c.editCommand('mode', mode);
   1.618 +     }
   1.619 +     
   1.620 +     var imgs = $('EST').getElementsByTagName('img');
   1.621 +     
   1.622 +     for (var i=0; i<imgs.length; i++) 
   1.623 +     {
   1.624 +       imgs[i].style.backgroundColor = '';
   1.625 +     }
   1.626 +     if(c.pathsEdit==true){
   1.627 +       $('pathsEdit').style.backgroundColor = 'orange';
   1.628 +     }else{
   1.629 +      $(mode).style.backgroundColor = 'orange';
   1.630 +     } 
   1.631 +     
   1.632 +     
   1.633 +     if (mode == 'select') 
   1.634 +      {
   1.635 +       //$('status').innerHTML = 'Select/Move' ;
   1.636 +       info_select();
   1.637 +      } 
   1.638 +     else
   1.639 +      {
   1.640 +       //$('status').innerHTML = 'Draw ' + status;
   1.641 +      } 
   1.642 +    
   1.643 +    ///////////
   1.644 +    
   1.645 +    hiddenAllMenus();
   1.646 +
   1.647 +    if(mode=='text')
   1.648 +     {
   1.649 +	info_text();
   1.650 +     }
   1.651 +
   1.652 +    if(mode=='shape')
   1.653 +     {
   1.654 +	info_shape();
   1.655 +     }
   1.656 +    if(mode=='ellipse')
   1.657 +     {
   1.658 +	info_ellipse();
   1.659 +     }
   1.660 +
   1.661 +     if(mode=='rect')
   1.662 +     {
   1.663 +	info_rect();
   1.664 +     }  
   1.665 +     
   1.666 +     if(mode=='image')
   1.667 +     {
   1.668 +	info_image();
   1.669 +     }  
   1.670 +
   1.671 +     if(mode=='path')
   1.672 +     {
   1.673 +	info_path();
   1.674 +     }  
   1.675 +     if(mode=='controlpath')
   1.676 +     {
   1.677 +	info_controlpath();
   1.678 +     }  
   1.679 +     if(mode=='zoom')
   1.680 +     {
   1.681 +	info_zoom();
   1.682 +	
   1.683 +     } 
   1.684 +     if(mode=='select')
   1.685 +     {  
   1.686 +        if(c.pathsEdit==true)
   1.687 +         { 
   1.688 +          info_pathsEdit();
   1.689 +         }
   1.690 +          else
   1.691 +         { 
   1.692 +	  info_select();
   1.693 +	 } 
   1.694 +	
   1.695 +     }
   1.696 +     //c.renderer.zoom(0,0);   
   1.697 +     //document.getElementById('richdraw').focus();
   1.698 +     
   1.699 +  } 
   1.700 + 
   1.701 + ///////////////////////// 
   1.702 + 
   1.703 +  function hiddenAllMenus()
   1.704 +   {     
   1.705 +        document.getElementById('richdraw').style.cursor='default'; 
   1.706 +  	$('options_text').style.visibility = 'hidden';
   1.707 +  	$('options_select_path').style.visibility = 'hidden';  
   1.708 +  	$('panel_shapes').style.visibility = 'hidden'; 
   1.709 +  	$('linksPaths').style.visibility = 'hidden';  
   1.710 +        $('options_rect').style.visibility = 'hidden';
   1.711 +        $('options_ellipse').style.visibility = 'hidden';      
   1.712 +        $('options_image').style.visibility = 'hidden';  
   1.713 +        $('options_path').style.visibility = 'hidden';   
   1.714 +        //$('options_controlpath').style.visibility = 'hidden';   
   1.715 +        $('options_zoom').style.visibility = 'hidden';   
   1.716 +        $('options_select').style.visibility = 'hidden';
   1.717 +        
   1.718 +        
   1.719 +        selectedit='';
   1.720 +   }
   1.721 +  
   1.722 +  function info_text()
   1.723 +   {
   1.724 +	$('options_text').style.visibility = 'visible';
   1.725 +   }
   1.726 +  function info_shape()
   1.727 +   {
   1.728 +	$('options_select_path').style.visibility = 'visible';  
   1.729 +	$('linksPaths').style.visibility = 'visible'; 
   1.730 +	$('panel_shapes').style.visibility= 'visible';  
   1.731 +   }
   1.732 +  function info_rect()
   1.733 +   {
   1.734 +	$('options_rect').style.visibility = 'visible';  
   1.735 +   } 
   1.736 +  function info_ellipse()
   1.737 +   {
   1.738 +	$('options_ellipse').style.visibility = 'visible';  
   1.739 +   } 
   1.740 +
   1.741 +  function info_image()
   1.742 +   {
   1.743 +	$('options_image').style.visibility = 'visible';  
   1.744 +   }   
   1.745 +  function info_path()
   1.746 +   {
   1.747 +	$('options_path').style.visibility = 'visible'; 
   1.748 +	
   1.749 +   }
   1.750 +  function info_controlpath()
   1.751 +   {
   1.752 +	$('options_path').style.visibility = 'visible'; 
   1.753 +	
   1.754 +   } 
   1.755 +   function info_zoom()
   1.756 +   {
   1.757 +	$('options_zoom').style.visibility = 'visible';   
   1.758 +	//$('options_zoom').style.backgroundColor = colorpage; 
   1.759 +	if(zoommode=='hand')
   1.760 +	 {
   1.761 +	   document.getElementById('richdraw').style.cursor='move'; 
   1.762 +	   
   1.763 +	 }else{ 
   1.764 +	    if(zoommode=='window')
   1.765 +	     {
   1.766 +	     
   1.767 +	     }else{
   1.768 +	      c.renderer.zoom(0,0);       
   1.769 +	     }
   1.770 +	 }
   1.771 +        var imgs = $('options_zoom').getElementsByTagName('img');
   1.772 +        for (var i=0; i<imgs.length; i++) 
   1.773 +         {
   1.774 +            imgs[i].style.backgroundColor = '';
   1.775 +         }
   1.776 +        $('zoom_'+zoommode).style.backgroundColor = 'orange';
   1.777 +        
   1.778 +       
   1.779 +        
   1.780 +   }   
   1.781 +   
   1.782 +   function info_pathsEdit(){
   1.783 +	$('options_path').style.visibility = 'visible'; 
   1.784 +   }
   1.785 +
   1.786 +   function info_select()
   1.787 +   {
   1.788 +	$('options_select').style.visibility = 'visible';   
   1.789 +	//$('options_select').style.backgroundColor = colorpage; 
   1.790 +
   1.791 +	if(selectedit=='deleteone')
   1.792 +	 {
   1.793 +	     deleteShape();
   1.794 +	 }
   1.795 +	if(selectedit=='deleteall')
   1.796 +	 {
   1.797 +	     deleteAllShapes();
   1.798 +	 }
   1.799 +	if(selectedit=='tothetop')
   1.800 +	 {
   1.801 +	     toFront(-1);
   1.802 +	 }
   1.803 + 	if(selectedit=='totheback')
   1.804 +	 {
   1.805 +	     toFront(0);
   1.806 +	 }
   1.807 +  	if(selectedit=='oneback')
   1.808 +	 {
   1.809 +	     toFront(1);
   1.810 +	 }
   1.811 +   	if(selectedit=='onetop')
   1.812 +	 {
   1.813 +	     toFront(2);
   1.814 +	 }
   1.815 +   	if(selectedit=='reflectV')
   1.816 +	 {
   1.817 +	     c.reflect('V');
   1.818 +	 } 
   1.819 +	if(selectedit=='reflectH')
   1.820 +	 {
   1.821 +	     c.reflect('H');
   1.822 +	 }
   1.823 +
   1.824 +        var imgs = $('options_select').getElementsByTagName('img');
   1.825 +        for (var i=0; i<imgs.length; i++) 
   1.826 +         {
   1.827 +            imgs[i].style.backgroundColor = '';
   1.828 +         } 
   1.829 +        if(selectedit != '')
   1.830 +        {
   1.831 +                $('select_'+selectedit).style.backgroundColor = 'orange';
   1.832 +        } 
   1.833 +        
   1.834 +   }   
   1.835 +  
   1.836 +   
   1.837 +////////////////////////////
   1.838 +
   1.839 +        
   1.840 +  function setShape() 
   1.841 +   {   
   1.842 +       if(selectmode=='select' || selectmode=='control_path' || selectmode=='path'){
   1.843 +          c.submitShape(document.forms[0].control_codebase.value);
   1.844 +        }else{
   1.845 +          setMode('path', 'Path'); 
   1.846 +          c.submitShape(document.forms[0].codebase.value);  
   1.847 +        }
   1.848 +   }
   1.849 +  
   1.850 +  //function onKeyPress(){
   1.851 +    //c.onKeyPress();
   1.852 +  //}
   1.853 +  
   1.854 +  
   1.855 +  function deleteShape() 
   1.856 +   {
   1.857 +    c.deleteSelection();
   1.858 +   } 
   1.859 +   
   1.860 +  function deleteAllShapes() 
   1.861 +   {
   1.862 +    c.deleteAll();
   1.863 +   } 
   1.864 +
   1.865 +  function deleteLastShapes() 
   1.866 +   {
   1.867 +    //c.deleteLast();
   1.868 +    c.clipboard=c.renderer.undo();
   1.869 +   } 
   1.870 +  function toFront(num) 
   1.871 +   {
   1.872 +    c.toFront(num);
   1.873 +   } 
   1.874 +  function cutSelected()
   1.875 +   { 
   1.876 +     
   1.877 +     c.clipboard=c.renderer.copy(c.selected);
   1.878 +     c.deleteSelection();
   1.879 +   }   
   1.880 +  function copySelected()
   1.881 +   {
   1.882 +    c.clipboard=c.renderer.copy(c.selected);
   1.883 +   }
   1.884 +  function pasteSelected()
   1.885 +   {
   1.886 +    c.selected=c.renderer.paste(c.clipboard,c.mouseDownX,c.mouseDownY);
   1.887 +    c.selected.id = 'shape:' + createUUID();
   1.888 +    Ext.get(c.selected).on( "mousedown", c.onHit,c);  
   1.889 +   } 
   1.890 +  function duplicateSelected()
   1.891 +   { 
   1.892 +    c.selected=c.renderer.duplicate(c.selected);
   1.893 +    c.selected.id = 'shape:' + createUUID();
   1.894 +    Ext.get(c.selected).on( "mousedown", c.onHit,c);  
   1.895 +  }                           
   1.896 +///////////////////////////
   1.897 +
   1.898 +                    
   1.899 +  function setFillColor(color)   //colors --
   1.900 +   {
   1.901 +    //-- var color = colors.options[colors.selectedIndex].value;
   1.902 +    //-- colors.style.backgroundColor = color;
   1.903 +    
   1.904 +    c.editCommand('fillcolor', color);
   1.905 +   }
   1.906 +  
   1.907 +  function setLineColor(color)  //colors -- 
   1.908 +   {
   1.909 +    //--var color = colors.options[colors.selectedIndex].value;
   1.910 +    //-- colors.style.backgroundColor = color;
   1.911 +
   1.912 +    c.editCommand('linecolor', color);
   1.913 +   }
   1.914 +  
   1.915 +  function setLineWidth(width) //width --
   1.916 +   {
   1.917 +    //-- var width = widths.options[widths.selectedIndex].value;
   1.918 +    c.editCommand('linewidth', width);
   1.919 +   }
   1.920 +  ////
   1.921 +  //++
   1.922 +  function setFillOpacity(opacity) 
   1.923 +   {
   1.924 +     c.editCommand('fillopacity', opacity);
   1.925 +   } 
   1.926 +   ////
   1.927 +   //++
   1.928 +   function setLineOpacity(opacity) 
   1.929 +    {
   1.930 +     c.editCommand('lineopacity', opacity);
   1.931 +    }
   1.932 +
   1.933 +  function setTextFamily(types) 
   1.934 +   {
   1.935 +    var type = types.options[types.selectedIndex].value;
   1.936 +    document.forms[0].option_text_family.value=type; //bad :-(
   1.937 +    data_text_family = type;
   1.938 +    c.submitShape($('option_text_message').value+'<;>'+$('option_text_size').value+'<;>'+$('option_text_family').value);
   1.939 +   }
   1.940 +
   1.941 +  function setGridWidth(widths) 
   1.942 +   {
   1.943 +    var width = eval(widths.options[widths.selectedIndex].value);
   1.944 +    RichDrawEditor.prototype.setGrid(width, width);
   1.945 +   }
   1.946 +
   1.947 +///////////////////////////////
   1.948 +  
   1.949 +
   1.950 +  function getOptionByValue(select, value)
   1.951 +  {
   1.952 +    /*for (var i=0; i<select.length; i++) 
   1.953 +     {
   1.954 +        if (select.options[i].value == value) 
   1.955 +         {
   1.956 +            return i;
   1.957 +         }
   1.958 +    }
   1.959 +    return -1;
   1.960 +    */
   1.961 +  }      
   1.962 +  
   1.963 +/////////////////////////////
   1.964 +
   1.965 + function showMarkupCode() 
   1.966 +  {
   1.967 +    $('code').value = c.renderer.getMarkup(); 
   1.968 +    //document.forms[0].code.focus();
   1.969 +    //$('code').select; 
   1.970 +    showinfoFrame('SVG code')
   1.971 +    //infoFrame.setTitle('SVG code');  
   1.972 +    //infoFrame.show();
   1.973 +    
   1.974 +  }
   1.975 + function openFile() 
   1.976 +  {
   1.977 +    $('file').value = initialFile; 
   1.978 +    //document.forms[0].code.focus();
   1.979 +    //$('code').select; 
   1.980 +    showopenFile('Open File')
   1.981 +    //infoFrame.setTitle('SVG code');  
   1.982 +    //infoFrame.show();
   1.983 +    
   1.984 +  }
   1.985 + function showMarkup() 
   1.986 +  {
   1.987 +   document.forms[0].code.value=Ext.util.JSON.encode(canvas(c));
   1.988 +    //infoFrame.setTitle('OPF code');
   1.989 +    //infoFrame.show();
   1.990 +     showinfoFrame('OPF code')
   1.991 +
   1.992 +   
   1.993 +  }
   1.994 +
   1.995 +  function shm()
   1.996 +   {
   1.997 +   var json = Ext.util.JSON.encode(canvas(c))
   1.998 +    $('someinfo').value = "JSON File Format Saved : "+( c.renderer.getMarkup().length - json.length )+" characters; JSON Character Total: "+json.length
   1.999 +    $('code').value=json;
  1.1000 +   }
  1.1001 +  
  1.1002 +  function lcm()
  1.1003 +   {
  1.1004 +        load(Ext.util.JSON.decode(document.forms[0].code.value),c)   
  1.1005 +       
  1.1006 +   }
  1.1007 +
  1.1008 +////////////////////////////////////////
  1.1009 +
  1.1010 +  
  1.1011 +  function onSelect() 
  1.1012 +   {
  1.1013 +    /*$('fillcolor').selectedIndex = getOptionByValue($('fillcolor'), c.queryCommand('fillcolor'));
  1.1014 +    $('fillcolor').style.backgroundColor = c.queryCommand('fillcolor');
  1.1015 +    $('linecolor').selectedIndex = getOptionByValue($('linecolor'), c.queryCommand('linecolor'));
  1.1016 +    $('linecolor').style.backgroundColor = c.queryCommand('linecolor');
  1.1017 +    $('linewidth').selectedIndex = getOptionByValue($('linewidth'), c.queryCommand('linewidth'));
  1.1018 +    */ 
  1.1019 +    hiddenAllMenus();
  1.1020 +    info_select();
  1.1021 +      
  1.1022 +    if (c.selected.tagName == 'rect'){
  1.1023 +        //setMode('rect', 'Rectangle')
  1.1024 +         info_rect();
  1.1025 +     } 
  1.1026 +    if (c.selected.tagName == 'image'){
  1.1027 +         info_image();
  1.1028 +     }
  1.1029 +    if (c.selected.tagName == 'text'){
  1.1030 +          info_text();
  1.1031 +     }
  1.1032 +    if (c.selected.tagName == 'line'){ 
  1.1033 +           //info_line();
  1.1034 +     }   
  1.1035 +    if (c.selected.tagName == 'ellipse'){
  1.1036 +           info_ellipse()
  1.1037 +     }
  1.1038 +    if (c.selected.tagName == 'path') { 
  1.1039 +       
  1.1040 +           info_path();
  1.1041 +     }  
  1.1042 +    if (c.selected.tagName == 'shape'){
  1.1043 +         var detail=c.selected.children[0].tagName;
  1.1044 +         $('someinfo').value=detail;
  1.1045 +         if(detail=='path'){ info_path(); }  
  1.1046 +          if(detail=='textpath'){ info_text(); }
  1.1047 +    } 
  1.1048 +    if (c.selected.tagName == 'oval') { 
  1.1049 +       
  1.1050 +           info_ellipse();
  1.1051 +     }  
  1.1052 + 
  1.1053 +      //frames['mondrianstyle'].setcolorhex(c.queryCommand('linecolor'),'stroke');
  1.1054 +      //frames['mondrianstyle'].setcolorhex(c.queryCommand('fillcolor'),'fill');       
  1.1055 +   }
  1.1056 +
  1.1057 +  function onUnselect() 
  1.1058 +   {  
  1.1059 +   
  1.1060 +   /*
  1.1061 +    $('fillcolor').selectedIndex = getOptionByValue($('fillcolor'), c.queryCommand('fillcolor'));
  1.1062 +    $('fillcolor').style.backgroundColor = c.queryCommand('fillcolor');
  1.1063 +    $('linecolor').selectedIndex = getOptionByValue($('linecolor'), c.queryCommand('linecolor'));
  1.1064 +    $('linecolor').style.backgroundColor = c.queryCommand('linecolor');
  1.1065 +    $('linewidth').selectedIndex = getOptionByValue($('linewidth'), c.queryCommand('linewidth'));
  1.1066 +    */ 
  1.1067 +    
  1.1068 +   } 
  1.1069 + 
  1.1070 + function editPath(myfield,e)
  1.1071 +   {  
  1.1072 +
  1.1073 +    var keycode;
  1.1074 +    
  1.1075 +    
  1.1076 +    // ++? if (window.event) keycode = window.event.e;
  1.1077 +     
  1.1078 +      e= (e) ? e : ((window.event) ? event : null);
  1.1079 +     keycode=e.keyCode;
  1.1080 +    var shs= myfield.id.split('_');
  1.1081 +    var sh=shs[1];  
  1.1082 +    
  1.1083 +    var mypath=$('control_codebase').value;    
  1.1084 +    
  1.1085 +    
  1.1086 +     var  x= $('option_path_x').value;
  1.1087 +      var y= $('option_path_y').value; 
  1.1088 +     var precoord=x+','+y; 
  1.1089 +
  1.1090 +    
  1.1091 +    var mypointNum=$('option_path_num').value;
  1.1092 +    var controlNodeNum=2;  
  1.1093 +    
  1.1094 +     if (keycode == 38)//#26
  1.1095 +     {  
  1.1096 +          myfield.value=eval(myfield.value)+1; 
  1.1097 +     }    
  1.1098 +    if (keycode == 40)// #28
  1.1099 +     {       
  1.1100 +        myfield.value=eval(myfield.value)-1;   
  1.1101 +     }    
  1.1102 +    if (keycode == 13  || keycode == 40   || keycode == 38)
  1.1103 +     {
  1.1104 +     var  cadx= $('option_path_x').value;
  1.1105 +     var cady= $('option_path_y').value; 
  1.1106 +     var coord=cadx+','+cady;
  1.1107 +                    
  1.1108 +      //$('code').value=coord;  
  1.1109 +      
  1.1110 +      var cad1=new RegExp(precoord,"g");
  1.1111 +      
  1.1112 +      
  1.1113 +      var result=mypath.replace(cad1, coord);
  1.1114 +      
  1.1115 +      $('control_codebase').value=' ';
  1.1116 +      $('control_codebase').value=result; 
  1.1117 +      
  1.1118 +      $('someinfo').value=precoord;
  1.1119 +      //alert(myfield.id);
  1.1120 +      setShape(); //c.renderer.tocurve();
  1.1121 +
  1.1122 +      return false;
  1.1123 +      
  1.1124 +     } 
  1.1125 +    else
  1.1126 +    return true;
  1.1127 +  }
  1.1128 +
  1.1129 +
  1.1130 +  function editPathXX(myfield,e)
  1.1131 +   {  
  1.1132 +
  1.1133 +    var keycode;
  1.1134 +    
  1.1135 +    
  1.1136 +    // ++? if (window.event) keycode = window.event.e;
  1.1137 +     
  1.1138 +      e= (e) ? e : ((window.event) ? event : null);
  1.1139 +     keycode=e.keyCode;
  1.1140 +    var shs= myfield.id.split('_');
  1.1141 +    var sh=shs[1];  
  1.1142 +    
  1.1143 +    var mypath=$('control_codebase').value;   
  1.1144 +    var mypointNum=$('option_path_num').value;
  1.1145 +    var controlNodeNum=2;  
  1.1146 +    
  1.1147 +     if (keycode == 38)//#26
  1.1148 +     {  
  1.1149 +          myfield.value=eval(myfield.value)+1; 
  1.1150 +     }    
  1.1151 +    if (keycode == 40)// #28
  1.1152 +     {       
  1.1153 +        myfield.value=eval(myfield.value)-1;   
  1.1154 +     }    
  1.1155 +  
  1.1156 +   
  1.1157 +     var points=mypath.split('C');
  1.1158 +     var chain='';
  1.1159 +     var segment=' ';  
  1.1160 +     prevControl=' ';
  1.1161 +     nextControl=' ';
  1.1162 +     nodePoint=' ';
  1.1163 +      var init=points[0].split('M'); 
  1.1164 +      var allcoords=init[1].split(' ');
  1.1165 +      var point=allcoords[0].split(',');
  1.1166 +      
  1.1167 +      if(mypointNum==0){
  1.1168 +      
  1.1169 +             point[1]= $('option_path_x').value;
  1.1170 +             point[2]= $('option_path_y').value;
  1.1171 +             var change=point.join(',')
  1.1172 +        
  1.1173 +        chain+='M' + change+' ';
  1.1174 +         }else{  
  1.1175 +           chain+='M'+points[0]+' '; 
  1.1176 +         }  
  1.1177 +      
  1.1178 +     var numpoints=points.length-1;
  1.1179 +     if(numpoints>1){
  1.1180 +     for(var a=1;a<=numpoints;a++)
  1.1181 +      { 
  1.1182 +        
  1.1183 +         if(a==mypointNum){
  1.1184 +          
  1.1185 +        segment=points[a].split(' ');
  1.1186 +         prevControl=segment[0]+' '; 
  1.1187 +         nextControl=segment[1]+' '; 
  1.1188 +         nodePoint=segment[2]+' '; 
  1.1189 +         
  1.1190 +           
  1.1191 +         /*if(controlNodeNum==0){chain+=prevControl; var point=prevControl.split(',');}  
  1.1192 +         if(controlNodeNum==1){chain+=nextControl; var point=nextControl.split(',');}  
  1.1193 +         if(controlNodeNum==2){chain+=nodePoint; var point=nodePoint.split(',');}  
  1.1194 +         */ 
  1.1195 +         
  1.1196 +        var point=nodePoint.split(',');
  1.1197 +             point[1]= $('option_path_x').value;
  1.1198 +             point[2]= $('option_path_y').value;
  1.1199 +             var change=point.join(',')
  1.1200 +        
  1.1201 +        chain+='C'+prevControl+ nextControl + change+' ';
  1.1202 +         }else{  
  1.1203 +           chain+='C'+points[a]; 
  1.1204 +         }           
  1.1205 +         
  1.1206 +      }
  1.1207 +      
  1.1208 +     }else{                      
  1.1209 +       chain+='C'+points[1]; 
  1.1210 +     
  1.1211 +     }                      
  1.1212 +      //$('someinfo').value= chain;
  1.1213 +       $('control_codebase').value=chain;
  1.1214 +      
  1.1215 +
  1.1216 +       
  1.1217 +    
  1.1218 +    
  1.1219 +    if (keycode == 13  || keycode == 40   || keycode == 38)
  1.1220 +     { 
  1.1221 +      //alert(myfield.id);
  1.1222 +       c.renderer.tocurve();
  1.1223 +
  1.1224 +      return false;
  1.1225 +      
  1.1226 +     } 
  1.1227 +    else
  1.1228 +    return true;
  1.1229 +  }
  1.1230 +
  1.1231 +
  1.1232 +  
  1.1233 +  function edit(myfield,e)
  1.1234 +   { 
  1.1235 +   
  1.1236 +    var keycode;
  1.1237 +    
  1.1238 +    
  1.1239 +    // ++? if (window.event) keycode = window.event.e;
  1.1240 +    //else if (e) keycode = e.which;
  1.1241 +     
  1.1242 +      e= (e) ? e : ((window.event) ? event : null);
  1.1243 +     keycode=e.keyCode;
  1.1244 +   //var keycode = e.which?e.which:e.keycode 
  1.1245 +    
  1.1246 +    //document.layers ? e.which :
  1.1247 +    //document.all ? e.keyCode :
  1.1248 +    //document.getElementById ? e.keyCode : 0;
  1.1249 +    //else return true;               
  1.1250 +    var keyChar = String.fromCharCode(keycode);
  1.1251 +    //var numCheck = /\d/;
  1.1252 +     //if (((keyChar=='.')&&(obj.value.indexOf('.')==-1))¦¦(keycode<32)¦¦numCheck.test(keyChar)¦¦((keycode>=37)&&(keycode<=40)&&(!e.modifiers&&!e.shiftKey))) { 
  1.1253 +    
  1.1254 +    //alert(keycode+' _ '+keyChar); 
  1.1255 +    var shs= myfield.id.split('_');
  1.1256 +    var sh=shs[1];
  1.1257 +  if(myfield.id.indexOf('control_codebase')<=0) 
  1.1258 +  {
  1.1259 +     if (keycode == 38)//#26
  1.1260 +     {  
  1.1261 +       
  1.1262 +       if(eval(myfield.value)>0) 
  1.1263 +        {   
  1.1264 +          myfield.value=eval(myfield.value)+1; 
  1.1265 +          //alert(myfield.value);
  1.1266 +        }  
  1.1267 +       //return false;
  1.1268 +       //alert('keycode')         
  1.1269 +       
  1.1270 +     }    
  1.1271 +    if (keycode == 40)// #28
  1.1272 +     {       
  1.1273 +        myfield.value=eval(myfield.value)-1;   
  1.1274 +        if(myfield.id=='option_path_sclx'  || myfield.id=='option_path_scly')
  1.1275 +         {
  1.1276 +           if( eval(myfield.value)<=0  )
  1.1277 +            {
  1.1278 +              myfield.value=1;
  1.1279 +            }
  1.1280 +         }  
  1.1281 +         
  1.1282 +        if(myfield.id=='option_text_size')
  1.1283 +         {
  1.1284 +           if( eval(myfield.value)<=0  )
  1.1285 +            {
  1.1286 +              myfield.value=1;
  1.1287 +            }
  1.1288 +         }
  1.1289 +     }    
  1.1290 +       
  1.1291 +  }  
  1.1292 +    
  1.1293 +    if (keycode == 13  || keycode == 40   || keycode == 38)
  1.1294 +     { 
  1.1295 +      var check=0;
  1.1296 +      if(myfield.id=='control_codebase') 
  1.1297 +       { 
  1.1298 +         //alert(myfield.id)
  1.1299 +         //c.submitShape($('control_codebase').value+'');
  1.1300 +         check=1;
  1.1301 +         setShape();
  1.1302 +       }  
  1.1303 +
  1.1304 +      if(myfield.id.indexOf('href')>0) 
  1.1305 +       {
  1.1306 +         c.submitShape(myfield.value)
  1.1307 +       }
  1.1308 +         
  1.1309 +      if(myfield.id.indexOf('tr')>0 || myfield.id.indexOf('scl')>0)
  1.1310 +       {
  1.1311 +             if(check==0)
  1.1312 +              {
  1.1313 +                 c.submitShape($('option_'+sh+'_trx').value+';'+$('option_'+sh+'_try').value+';'+$('option_'+sh+'_sclx').value+';'+$('option_'+sh+'_scly').value+';'+$('option_'+sh+'_rot').value)
  1.1314 +               }  
  1.1315 +       } 
  1.1316 +       
  1.1317 +      if(myfield.id.indexOf('rot')>0) 
  1.1318 +       {
  1.1319 +         c.submitShape($('option_'+sh+'_trx').value+';'+$('option_'+sh+'_try').value+';'+$('option_'+sh+'_sclx').value+';'+$('option_'+sh+'_scly').value+';'+$('option_'+sh+'_rot').value)
  1.1320 +       }  
  1.1321 +       
  1.1322 +      if(myfield.id.indexOf('text')>0) 
  1.1323 +       {
  1.1324 +         c.submitShape($('option_text_message').value+'<;>'+$('option_text_size').value+'<;>'+$('option_text_family').value);
  1.1325 +       }  
  1.1326 +      //alert(myfield.id);
  1.1327 +      return false;
  1.1328 +      
  1.1329 +     } 
  1.1330 +    else
  1.1331 +    return true;
  1.1332 +  }
  1.1333 +
  1.1334 +
  1.1335 + 
  1.1336 +
  1.1337 +function env(myfield,delta)
  1.1338 + {
  1.1339 +  
  1.1340 +    //alert(keycode+' _ '+keyChar); 
  1.1341 +    
  1.1342 +     if (delta >0)//#26
  1.1343 +     {     
  1.1344 +       myfield.value=eval(myfield.value)+1; 
  1.1345 +       //return false;
  1.1346 +       //alert('keycode')
  1.1347 +     }    
  1.1348 +      else
  1.1349 +           {     
  1.1350 +       myfield.value=eval(myfield.value)-1;
  1.1351 +       //return false;
  1.1352 +     }
  1.1353 +    
  1.1354 +    
  1.1355 +      if(myfield.id=='option_image_href') 
  1.1356 +       {
  1.1357 +         c.submitShape(myfield.value)
  1.1358 +       }  
  1.1359 +       if(myfield.id=='option_select_trx' || myfield.id=='option_select_try' || myfield.id=='option_select_sclx'  || myfield.id=='option_select_scly') 
  1.1360 +       {
  1.1361 +         c.submitShape($('option_select_trx').value+';'+$('option_select_try').value+';'+$('option_select_sclx').value+';'+$('option_select_scly').value+';'+$('option_select_rot').value)
  1.1362 +       }
  1.1363 +       if(myfield.id=='option_select_rot') 
  1.1364 +       {
  1.1365 +         c.submitShape($('option_select_trx').value+';'+$('option_select_try').value+';'+$('option_select_sclx').value+';'+$('option_select_scly').value+';'+$('option_select_rot').value)
  1.1366 +       }  
  1.1367 + 
  1.1368 +    }  
  1.1369 +
  1.1370 +
  1.1371 +   function clockdata(){
  1.1372 +  //////////////
  1.1373 +  //++
  1.1374 +        
  1.1375 +   data_path_close = $('option_path_close').checked;
  1.1376 +   data_text_family = $('option_text_family').value; 
  1.1377 +   data_text_size = parseFloat($('option_text_size').value);
  1.1378 +   data_text_messaje = $('option_text_message').value;  
  1.1379 +   data_image_href = $('option_image_href').value;
  1.1380 + 
  1.1381 +  ////////////          
  1.1382 +  }
  1.1383 +
  1.1384 + function myWorkSize() {
  1.1385 +  var myWidth = 0, myHeight = 0;
  1.1386 +  if( typeof( window.innerWidth ) == 'number' ) {
  1.1387 +    //Non-IE
  1.1388 +    myWidth = window.innerWidth;
  1.1389 +    myHeight = window.innerHeight;
  1.1390 +  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
  1.1391 +    //IE 6+ in 'standards compliant mode'
  1.1392 +    myWidth = document.documentElement.clientWidth;
  1.1393 +    myHeight = document.documentElement.clientHeight;
  1.1394 +  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
  1.1395 +    //IE 4 compatible
  1.1396 +    myWidth = document.body.clientWidth;
  1.1397 +    myHeight = document.body.clientHeight;
  1.1398 +  }
  1.1399 +  return [ myWidth, myHeight] ;
  1.1400 +} 
  1.1401 + 
  1.1402 +function doResize(){  
  1.1403 +     //deleteAllShapes(); 
  1.1404 + vertexFrames();
  1.1405 + resizeFrame();  
  1.1406 +    //c.renderer.zoomFrame(zoominit); 
  1.1407 + //c.renderer.view(canvasX,canvasY,canvasW,canvasH,zoominit)
  1.1408 + //c.renderer.view(docx,docy,docw,doch,zoominit1)  
  1.1409 +    // delete rectCanvas 
  1.1410 + //   var vB=zoomx+' '+zoomy+' '+zoomw+' '+zoomh;
  1.1411 +    
  1.1412 +     //c.renderer.rectCanvas(docx,docy,docw,doch,vB);
  1.1413 +}
  1.1414 +
  1.1415 +function vertexFrames(){
  1.1416 +
  1.1417 +  var screenSize=myWorkSize();
  1.1418 +   scrW = screenSize[0];//screen.availWidth;
  1.1419 +   scrH = screenSize[1];//screen.availHeight; 
  1.1420 +  
  1.1421 +   wndW=scrW;//window.width;
  1.1422 +   wndH=scrH;//window.height;
  1.1423 +  
  1.1424 +  
  1.1425 +  if (scrW != wndW || scrH != wndH) {
  1.1426 +      //window.resizeTo(scrW, scrH);
  1.1427 +      //window.moveTo(0, 0);
  1.1428 +  }
  1.1429 +  //var wProportion={x:35, y:24}
  1.1430 +  
  1.1431 +   vertexNORTHmenu={ NORTHmenu1:[0,0],NORTHmenu2:[scrW,0],NORTHmenu3:[0,wProportion.y],NORTHmenu4:[scrW,wProportion.y] };
  1.1432 +   vertexNORTHglobals={ NORTHglobals1:[0,wProportion.y],NORTHglobals2:[scrW,wProportion.y],NORTHglobals3:[0,wProportion.y*2],NORTHglobals4:[scrW,wProportion.y*2] };
  1.1433 +   vertexNORTHoptions={ NORTHoptions1:[0,wProportion.y*2],NORTHoptions2:[scrW,wProportion.y*2],NORTHoptions3:[0,wProportion.y*3],NORTHoptions4:[scrW,wProportion.y*3] };    
  1.1434 +   vertexSUD={ SUD1:[0,wndH-wProportion.y*3], SUD2:[scrW,(wndH-wProportion.y*3)], SUD3:[0,wndH], SUD4:[scrW,wndH]};
  1.1435 +   vertexEST={ EST1:[0,wProportion.y*3], EST2:[wProportion.x,wProportion.y*3], EST3:[0,(wndH-wProportion.y*3)], EST4:[wProportion.x,(wndH-wProportion.y*3)] };
  1.1436 +   vertexWEST={ WEST1:[(scrW-wProportion.x*3),wProportion.y*3], WEST2:[scrW,wProportion.y*3], WEST3:[(scrW-wProportion.x*3),(wndH-wProportion.y*3)], WEST4:[scrW,(wndH-wProportion.y*3)] };
  1.1437 +   vertexFRONT={ FRONT1:[vertexEST.EST2[0],vertexEST.EST2[1]], FRONT2:[vertexWEST.WEST1[0],vertexWEST.WEST1[1]], FRONT3:[vertexEST.EST4[0],vertexEST.EST4[1]], FRONT4:[vertexWEST.WEST3[0],vertexWEST.WEST3[1]] };
  1.1438 + 
  1.1439 +   NORTHmenusize=[vertexNORTHmenu.NORTHmenu4[0]-vertexNORTHmenu.NORTHmenu1[0],vertexNORTHmenu.NORTHmenu4[1]-vertexNORTHmenu.NORTHmenu1[1]];
  1.1440 +   NORTHglobalssize=[vertexNORTHglobals.NORTHglobals4[0]-vertexNORTHglobals.NORTHglobals1[0],vertexNORTHglobals.NORTHglobals4[1]-vertexNORTHglobals.NORTHglobals1[1]];
  1.1441 +   NORTHoptionssize=[vertexNORTHoptions.NORTHoptions4[0]-vertexNORTHoptions.NORTHoptions1[0],vertexNORTHoptions.NORTHoptions4[1]-vertexNORTHoptions.NORTHoptions1[1]];  
  1.1442 +   SUDsize=[vertexSUD.SUD4[0]-vertexSUD.SUD1[0],vertexSUD.SUD4[1]-vertexSUD.SUD1[1]]; 
  1.1443 +   ESTsize=[vertexEST.EST4[0]-vertexEST.EST1[0],vertexEST.EST4[1]-vertexEST.EST1[1]]; 
  1.1444 +   WESTsize=[vertexWEST.WEST4[0]-vertexWEST.WEST1[0],vertexWEST.WEST4[1]-vertexWEST.WEST1[1]]; 
  1.1445 +   FRONTsize=[vertexFRONT.FRONT4[0]-vertexFRONT.FRONT1[0],vertexFRONT.FRONT4[1]-vertexFRONT.FRONT1[1]]; 
  1.1446 +   
  1.1447 +
  1.1448 +   
  1.1449 +   //percent of FRONTsize
  1.1450 +   proporDoc= FRONTsize[0]/FRONTsize[1];
  1.1451 +   canvasYpercent=100;
  1.1452 +   canvasXpercent=100;
  1.1453 +   canvasWidth=Math.round(FRONTsize[0]*canvasXpercent/100);//FRONTsize[0];  
  1.1454 +   canvasW=canvasWidth;  
  1.1455 +   canvasHeight=Math.round(canvasYpercent*FRONTsize[1]/100);//FRONTsize[1];  
  1.1456 +   canvasH=canvasHeight;
  1.1457 +   canvasX=Math.round((FRONTsize[0]-canvasW)/2); 
  1.1458 +   canvasY=Math.round((FRONTsize[1]-canvasH)/2);
  1.1459 +
  1.1460 +
  1.1461 +   //vertexFRONTcanvas={ FRONT1:[vertexEST.EST2[0],vertexEST.EST2[1]], FRONT2:[vertexWEST.WEST1[0],vertexWEST.WEST1[1]], FRONT3:[vertexEST.EST4[0],vertexEST.EST4[1]], FRONT4:[vertexWEST.WEST3[0],vertexWEST.WEST3[1]] };
  1.1462 +   //FRONTcanvassize=[vertexFRONT.FRONT4[0]-vertexFRONT.FRONT1[0],vertexFRONT.FRONT4[1]-vertexFRONT.FRONT1[1]]; 
  1.1463 +
  1.1464 +   
  1.1465 +   //centerZoomx=Math.round(canvasWidth/2);
  1.1466 +   //centerZoomy=Math.round(canvasHeight/2);  
  1.1467 +    if(canvasH==0){ canvasH=0.00000001; }
  1.1468 +    proporCanvas= canvasW/canvasH ;    
  1.1469 +   //zoominit='0 0 '+zoomw+' '+zoomh;// 
  1.1470 +   
  1.1471 +   makeWorkSite(canvasH,(-canvasW/2)+(docw/2),(-canvasH/2)+(doch/2));
  1.1472 +   diagonalinit=diagonalFrame;
  1.1473 +   proporDiagonal=diagonalFrame/diagonalinit;  
  1.1474 +   zoominit=(zoomx)+' '+(zoomy)+' '+zoomw+' '+zoomh;  
  1.1475 +   //$('someinfo').value= zoominit;
  1.1476 +   //document.forms[0].someinfo.value= zoominit; 
  1.1477 +   //document.getElementById("someinfo").value = zoominit
  1.1478 +   //Ext.get('richdraw').dom.style.scrollTop = ('40%');
  1.1479 +   //alert(zoominit);
  1.1480 +}
  1.1481 +
  1.1482 +function resizeFrame(){
  1.1483 +  
  1.1484 +  Ext.get('NORTHmenu').dom.style.backgroundColor = (colorpage1a);   
  1.1485 +  Ext.get('NORTHglobals').dom.style.backgroundColor = (colorpage1b);   
  1.1486 +  Ext.get('NORTHoptions').dom.style.backgroundColor = (colorpage1c);   
  1.1487 +
  1.1488 +  Ext.get('SUD').dom.style.backgroundColor = (colorpage2); 
  1.1489 +  Ext.get('EST').dom.style.backgroundColor = (colorpage3); 
  1.1490 +  Ext.get('WEST').dom.style.backgroundColor = (colorpage4);   
  1.1491 +  
  1.1492 +  Ext.get('linksPaths').dom.style.backgroundColor = (colorpage); // bad
  1.1493 +  
  1.1494 +
  1.1495 +  Ext.get('NORTHmenu').dom.style.left =(vertexNORTHmenu.NORTHmenu1[0]+'px'); Ext.get('NORTHmenu').dom.style.top =(vertexNORTHmenu.NORTHmenu1[1]+'px');Ext.get('NORTHmenu').dom.style.width =(NORTHmenusize[0]+'px'); Ext.get('NORTHmenu').dom.style.height = (NORTHmenusize[1]+'px');
  1.1496 +  Ext.get('NORTHglobals').dom.style.left =(vertexNORTHglobals.NORTHglobals1[0]+'px'); Ext.get('NORTHglobals').dom.style.top =(vertexNORTHglobals.NORTHglobals1[1]+'px');Ext.get('NORTHglobals').dom.style.width =(NORTHglobalssize[0]+'px'); Ext.get('NORTHglobals').dom.style.height =(NORTHglobalssize[1]+'px');
  1.1497 +  Ext.get('NORTHoptions').dom.style.left =(vertexNORTHoptions.NORTHoptions1[0]+'px'); Ext.get('NORTHoptions').dom.style.top =(vertexNORTHoptions.NORTHoptions1[1]+'px');Ext.get('NORTHoptions').dom.style.width =(NORTHoptionssize[0]+'px'); Ext.get('NORTHoptions').dom.style.height =(NORTHoptionssize[1]+'px');
  1.1498 +  Ext.get('SUD').dom.style.left =(vertexSUD.SUD1[0]+'px'); Ext.get('SUD').dom.style.top =(vertexSUD.SUD1[1]+'px');Ext.get('SUD').dom.style.width=(SUDsize[0]+'px'); Ext.get('SUD').dom.style.height =(SUDsize[1]+'px');
  1.1499 +  Ext.get('EST').dom.style.left =(vertexEST.EST1[0]+'px'); Ext.get('EST').dom.style.top =(vertexEST.EST1[1]+'px');Ext.get('EST').dom.style.width=(ESTsize[0]+'px'); Ext.get('EST').dom.style.height =((ESTsize[1]+'px'));
  1.1500 +  Ext.get('WEST').dom.style.left =(vertexWEST.WEST1[0]+'px'); Ext.get('WEST').dom.style.top =(vertexWEST.WEST1[1]+'px');Ext.get('WEST').dom.style.width=(WESTsize[0]+'px'); Ext.get('WEST').dom.style.height =((WESTsize[1]+'px'));
  1.1501 +  Ext.get('FRONT').dom.style.left =(vertexFRONT.FRONT1[0]+'px'); Ext.get('FRONT').dom.style.top =(vertexFRONT.FRONT1[1]+'px');Ext.get('FRONT').dom.style.width=(FRONTsize[0]+'px'); Ext.get('FRONT').dom.style.height =(FRONTsize[1]+'px');
  1.1502 +  
  1.1503 +  Ext.get('richdraw').dom.style.left =(canvasX+'px'); Ext.get('richdraw').dom.style.top =(canvasY+'px');Ext.get('richdraw').dom.style.width=(canvasW+'px'); Ext.get('richdraw').dom.style.height =(canvasH+'px');
  1.1504 + 
  1.1505 +}
  1.1506 +
  1.1507 +function documentProperties(){   
  1.1508 +    document.forms[0].xDocument.value=docx;
  1.1509 +    document.forms[0].yDocument.value=docy;
  1.1510 +
  1.1511 +    document.forms[0].widthDocument.value=docw;
  1.1512 +    document.forms[0].heightDocument.value=doch; 
  1.1513 +    showdocFrame('Document properties')
  1.1514 +    //docFrame.setTitle('Document properties');
  1.1515 +    //docFrame.show();
  1.1516 +
  1.1517 +}
  1.1518 +function changeDocumentProperties(){ 
  1.1519 +
  1.1520 +    //percent of FRONTsize
  1.1521 +   proporSpace= FRONTsize[0]/FRONTsize[1];
  1.1522 +   //PERCENT 
  1.1523 +   
  1.1524 +   //canvasYpercent=95;
  1.1525 +   //canvasXpercent=97;
  1.1526 +   /*
  1.1527 +   canvasWidth=Math.round(FRONTsize[0]*canvasXpercent/100);//FRONTsize[0];  
  1.1528 +   canvasW=canvasWidth;  
  1.1529 +   canvasHeight=Math.round(canvasYpercent*FRONTsize[1]/100);//FRONTsize[1];  
  1.1530 +   canvasH=canvasHeight;
  1.1531 +   */ 
  1.1532 +   docx=eval(document.forms[0].xDocument.value);
  1.1533 +   docy=eval(document.forms[0].yDocument.value); 
  1.1534 +
  1.1535 +   docw=eval(document.forms[0].widthDocument.value);
  1.1536 +   doch=eval(document.forms[0].heightDocument.value); 
  1.1537 +   zoominit1= docx+' '+docy+' '+docw+' '+doch;
  1.1538 +   c.renderer.view(docx,docy,docw,doch,zoominit1);
  1.1539 +    borderDoc();
  1.1540 +  
  1.1541 +   //doResize();
  1.1542 +   //canvasX=Math.round((FRONTsize[0]-canvasW)/2); 
  1.1543 +   //canvasY=Math.round((FRONTsize[1]-canvasH)/2);
  1.1544 +
  1.1545 + 
  1.1546 +  //Ext.get('richdraw').dom.style.left =(canvasX+'px'); Ext.get('richdraw').dom.style.top =(canvasY+'px');Ext.get('richdraw').dom.style.width=(canvasW+'px'); Ext.get('richdraw').dom.style.height =(canvasH+'px');
  1.1547 +
  1.1548 +}                 
  1.1549 +function makeWorkSite(width,left,top) {
  1.1550 +    fieldViewx=Math.round(width*proporCanvas)*1; 
  1.1551 +    fieldViewy=width*1;  
  1.1552 +    diagonalFrame=dist2p(0,0,fieldViewx*1,fieldViewy*1);
  1.1553 +    diagonalAngle=getAngle(fieldViewx,fieldViewy);                                  
  1.1554 +    diagonalMidx=fieldViewx/2; 
  1.1555 +    diagonalMidy=fieldViewy/2;   
  1.1556 +    centerZoomx=diagonalMidx;
  1.1557 +    centerZoomy=diagonalMidy;   
  1.1558 +       
  1.1559 +    //alert(diagonalinit+' '+diagonalFrame+'    '+proporDiagonal);
  1.1560 +    //alert(canvasW+''+canvasW+' propor:'+proporCanvas+' Docy:'+docy+' fieldView:'+fieldViewx+' '+fieldViewy);
  1.1561 +    zoomx=(diagonalMidx+(diagonalFrame/2)*Math.cos(diagonalAngle+Math.PI))+left;//-(fieldViewx/8);//-(canvasW/2)docx-fieldViewx;
  1.1562 +    zoomy=(diagonalMidy+(diagonalFrame/2)*Math.sin(diagonalAngle+Math.PI))+top;//-(fieldViewy/8);//-(canvasH/2);//docy-fieldViewy;
  1.1563 +    zoomw=diagonalMidx+(diagonalFrame/2)*Math.cos(diagonalAngle);//fieldViewx*1.25;//docw+fieldViewx*2;
  1.1564 +    zoomh=diagonalMidy+(diagonalFrame/2)*Math.sin(diagonalAngle);//fieldViewy*1.25;//doch+fieldViewy*2;    
  1.1565 +}
  1.1566 +function RichDrawViewer(elem, renderer) {
  1.1567 +this.container = elem;
  1.1568 +this.renderer = renderer;
  1.1569 +this.renderer.init(this.container);
  1.1570 +this.renderer.editor = this;
  1.1571 +}          
  1.1572 +/*
  1.1573 +onResize : function(){
  1.1574 +	        Ext.TabPanel.superclass.onResize.apply(this, arguments);
  1.1575 + 	        this.delegateUpdates();
  1.1576 + 	    },
  1.1577 + 	 */   
  1.1578 \ No newline at end of file