Mercurial > laserkard
diff onlypaths/js/application.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.js Sun Jan 31 12:33:33 2010 -0500 1.3 @@ -0,0 +1,1670 @@ 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='onerobot.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 viewMode='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+=' <span id="file">File</span> <span id="edit">Edit</span> <span id="view">View</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:transparent;">'; 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:transparent;">'; 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:transparent;">'; 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:transparent;">'; 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:transparent;">'; 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:transparent;">'; 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:transparent;">'; 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:transparent">0,0</div>'; 1.220 + WEST+='<div id="zoomOverInput" style="width:40px;background-color:transparent">0,0</div>'; 1.221 + 1.222 + WEST+='<div style="font-size:9px">Grid:</div>'; 1.223 + WEST+='<select id="gridwidth" style="font-size:9px">'; 1.224 + var chain=''; 1.225 + for(var num=1;num<=30;num++) 1.226 + { 1.227 + chain+='<option value="'+num+'">'+num+'px</option>'; 1.228 + } 1.229 + WEST+=chain; 1.230 + WEST+='</select>'; 1.231 + WEST+='<br>'; 1.232 + 1.233 + WEST+=' <div name="me-container">'; 1.234 + WEST+=' <div id="fill-me">'; 1.235 + 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.236 + WEST+=' <div id="slider-fill"></div>'; 1.237 + WEST+=' <div id="fillContainer"></div>'; 1.238 + WEST+=' <div id="opacity-slider-fill" title="Fill opacity"></div>'; 1.239 + WEST+=' </div>'; 1.240 + WEST+=' <div id="stroke-me">'; 1.241 + 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.242 + WEST+=' <div id="slider-stroke"></div>'; 1.243 + WEST+=' <div id="strokeContainer"></div>'; 1.244 + WEST+=' <div id="width-slider-stroke-mask"></div><div id="width-slider-stroke" title="Stroke width"></div>'; 1.245 + WEST+=' <div id="opacity-slider-stroke" title="Stroke opacity"></div>'; 1.246 + WEST+=' </div>'; 1.247 + WEST+=' <div id="divformfill">'; 1.248 + WEST+=' </div>'; 1.249 + WEST+=' <div id="divformstroke">'; 1.250 + WEST+=' </div>'; 1.251 + 1.252 + WEST+='</div>'; 1.253 + WEST+=' <div id="panel_shapes" style="overflow:auto;font-size:9px;visibility:hidden;position:absolute;top:270px;left:0px;height:100px;width:200px; padding:1px; margin-top:1px; background-color:transparent;">'; 1.254 + 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.255 + WEST+=' </div> '; 1.256 + 1.257 + var SUD=""; 1.258 + //SUD+='<img id="showcode" title="Show the code" alt="" onclick="showMarkupCode();" src="img/viewcode.gif" style="border-color:#dd7700" >'; 1.259 + //SUD+='<img id="showmarkup" title="Show the raw markup" alt="" onclick="shm();" src="img/viewcode.gif" >'; 1.260 + //SUD+='<img id="loadmarkup" title="Load the raw markup" alt="" onclick="lcm();" src="img/loadcode.gif" >'; 1.261 + //SUD+='<br> '; 1.262 + SUD+='<br> '; 1.263 + SUD+='<input type="text" id="someinfo" value="No Data" name="someinfo" style="width:80%;">'; 1.264 + // SUD+='<textarea name="code" id="code" style="width:420px;height:200px;padding:0px"></textarea>'; 1.265 + // SUD+='<div>'; 1.266 + // SUD+='</div>'; 1.267 + 1.268 + var currentEditStatus='off'; 1.269 + var currentFileStatus='off'; 1.270 + var currentViewStatus='off'; 1.271 + var infoFrame, docFrame; 1.272 +Ext.onReady(function() { 1.273 + 1.274 + 1.275 + //var map = new Ext.KeyMap(document, { 1.276 + // key: [Ext.EventObject.LEFT, Ext.EventObject.RIGHT], 1.277 + // ctrl: true, 1.278 + // fn: keypresshandler 1.279 + //}); 1.280 + //Ext.get("FRONT").dom.innerHTML=(FRONT); 1.281 + Ext.get("NORTHmenu").dom.innerHTML=(NORTHmenu); 1.282 + Ext.get("NORTHglobals").dom.innerHTML=(NORTHglobals); 1.283 + Ext.get("NORTHoptions").dom.innerHTML=(NORTHoptions); 1.284 + Ext.get("EST").dom.innerHTML=(EST); 1.285 + Ext.get("WEST").dom.innerHTML=(WEST); 1.286 + Ext.get("SUD").dom.innerHTML=(SUD); 1.287 + 1.288 + resizeFrame(); 1.289 + var map= new Ext.KeyMap(document, [ 1.290 + { 1.291 + key: [46],//DELETE 1.292 + fn: function(){ c.deleteSelection(); } 1.293 + }, { 1.294 + key: "x", 1.295 + ctrl:true, 1.296 + fn: function(){ 1.297 + c.clipboard=c.renderer.copy(c.selected); 1.298 + c.deleteSelection(); 1.299 + } 1.300 + }, { 1.301 + key: "c", 1.302 + ctrl:true, 1.303 + fn: function(){ 1.304 + c.clipboard=c.renderer.copy(c.selected); 1.305 + } 1.306 + }, { 1.307 + key: "d", 1.308 + ctrl:true, 1.309 + fn: function(){ 1.310 + c.selected=c.renderer.duplicate(c.selected); 1.311 + c.selected.id = 'shape:' + createUUID(); 1.312 + Ext.get(c.selected).on( "mousedown", c.onHit,c); 1.313 + } 1.314 + }, { 1.315 + key: "v", 1.316 + ctrl:true, 1.317 + fn: function(){ 1.318 + c.selected=c.renderer.paste(c.clipboard,c.mouseDownX,c.mouseDownY); 1.319 + c.selected.id = 'shape:' + createUUID(); 1.320 + Ext.get(c.selected).on( "mousedown", c.onHit,c); 1.321 + } 1.322 + }, { 1.323 + key: "z", //UNDO 1.324 + ctrl:true, 1.325 + shift:false, 1.326 + fn: function(){ c.clipboard=c.renderer.undo(); } 1.327 + } 1.328 +]); 1.329 + 1.330 + /* 1.331 + Ext.get("richdraw").dom.style.width=(canvasWidth); 1.332 + Ext.get("richdraw").dom.style.height=(canvasHeight); 1.333 + Ext.get("richdraw").dom.style.left=(canvasX); 1.334 + Ext.get("richdraw").dom.style.top=(canvasY); 1.335 + */ 1.336 + 1.337 + 1.338 + 1.339 + menuEdit = new Ext.menu.Menu({ 1.340 + id: 'menuedit', 1.341 + items: [ 1.342 + {icon: "img/viewcode.gif", text: 'Copy all ', handler: shm}, 1.343 + {icon: "img/viewcode.gif", text: 'Paste all ', handler: lcm}, 1.344 + {icon: "img/viewcode.gif", text: 'Delete all ', handler: deleteAllShapes}, 1.345 + {icon: "img/viewcode.gif", text: 'Duplicate <b>Ctrl+d</b>', handler: duplicateSelected}, 1.346 + {icon: "img/viewcode.gif", text: 'Cut <b>Ctrl+x</b>', handler: cutSelected}, 1.347 + {icon: "img/viewcode.gif", text: 'Copy <b>Ctrl+c</b>', handler: copySelected}, 1.348 + {icon: "img/viewcode.gif", text: 'Paste <b>Ctrl+v</b>', handler: pasteSelected}, 1.349 + {icon: "img/viewcode.gif", text: 'Delete <b>Supr</b>', handler: deleteShape}, 1.350 + {icon: "img/viewcode.gif", text: 'Delete last <b>Ctrl+z</b>', handler: deleteLastShapes}, 1.351 + 1.352 + ] 1.353 + }); 1.354 + 1.355 + menuFile = new Ext.menu.Menu({ 1.356 + id: 'menufile', 1.357 + 1.358 + items: [ 1.359 + new Ext.menu.Item({ icon: "img/viewcode.gif", text: 'New ', handler: newFile }), 1.360 + new Ext.menu.Item({ icon: "img/viewcode.gif", text: 'Open ', handler: openFile }), 1.361 + new Ext.menu.Item({ icon: "img/viewcode.gif", text: 'View SVG code ', handler: showMarkupCode }), 1.362 + new Ext.menu.Item({icon: "img/viewcode.gif", text: 'View OPF code ', handler: showMarkup }), 1.363 + new Ext.menu.Item({icon: "img/viewcode.gif", text: 'Document properties ', handler: documentProperties }) 1.364 + ] 1.365 + }); 1.366 + menuView = new Ext.menu.Menu({ 1.367 + id: 'menuview', 1.368 + 1.369 + items: [ 1.370 + {icon: "img/viewcode.gif", text: 'Preview ', handler: preView}, 1.371 + {icon: "img/viewcode.gif", text: 'Canvas ', handler: canvasView} 1.372 + ] 1.373 + }); 1.374 +/* 1.375 + items: [ 1.376 + {icon: "img/viewcode.gif", text: 'View SVG code ', handler: showMarkupCode }, 1.377 + {icon: "img/viewcode.gif", text: 'View OPF code ', handler: showMarkup }, 1.378 + {icon: "img/viewcode.gif", text: 'Document properties ', handler: documentProperties }, 1.379 + 1.380 + ] 1.381 +*/ 1.382 +// define the handler for mouseover/out of either button or menu itself 1.383 + var editHandler = function(e) 1.384 + { 1.385 + if(currentEditStatus=='on') 1.386 + { 1.387 + var edit = menuEdit.getEl(); 1.388 + var buttonEdit = Ext.get('edit'); 1.389 + if(!edit.getRegion().contains(e.getPoint()) && !buttonEdit.getRegion().contains(e.getPoint())) 1.390 + { 1.391 + menuEdit.hide(); 1.392 + currentEditStatus='off'; 1.393 + } 1.394 + } 1.395 + else 1.396 + { 1.397 + menuEdit.show('edit'); 1.398 + currentEditStatus='on'; 1.399 + } 1.400 + } 1.401 + 1.402 + var fileHandler = function(e) 1.403 + { 1.404 + if(currentFileStatus=='on') 1.405 + { 1.406 + var file = menuFile.getEl(); 1.407 + var buttonFile = Ext.get('file'); 1.408 + if(!file.getRegion().contains(e.getPoint()) && !buttonFile.getRegion().contains(e.getPoint())) 1.409 + { 1.410 + menuFile.hide(); 1.411 + currentFileStatus='off'; 1.412 + } 1.413 + } 1.414 + else 1.415 + { 1.416 + menuFile.show('file'); 1.417 + currentFileStatus='on'; 1.418 + } 1.419 + } 1.420 + 1.421 + 1.422 + var viewHandler = function(e) 1.423 + { 1.424 + if(currentViewStatus=='on') 1.425 + { 1.426 + var view = menuView.getEl(); 1.427 + var buttonView = Ext.get('view'); 1.428 + if(!view.getRegion().contains(e.getPoint()) && !buttonView.getRegion().contains(e.getPoint())) 1.429 + { 1.430 + menuView.hide(); 1.431 + currentViewStatus='off'; 1.432 + } 1.433 + } 1.434 + else 1.435 + { 1.436 + menuView.show('view'); 1.437 + currentViewStatus='on'; 1.438 + } 1.439 + } 1.440 + 1.441 + // define the events to observe 1.442 + Ext.get('edit').on('mouseover',editHandler); 1.443 + Ext.get('edit').on('mouseout',editHandler); 1.444 + menuEdit.getEl().on('mouseout',editHandler); 1.445 + 1.446 + Ext.get('file').on('mouseover',fileHandler); 1.447 + Ext.get('file').on('mouseout',fileHandler); 1.448 + menuFile.getEl().on('mouseout',fileHandler); 1.449 + 1.450 + Ext.get('view').on('mouseover',viewHandler); 1.451 + Ext.get('view').on('mouseout',viewHandler); 1.452 + menuView.getEl().on('mouseout',viewHandler); 1.453 + 1.454 + 1.455 + 1.456 +}); 1.457 + 1.458 +// end ONREADY 1.459 + 1.460 +function borderDoc(){ 1.461 + //c.rectCanvas(docx,docy,docw,doch,viewBox) 1.462 + if(viewMode=='canvas') 1.463 + { 1.464 + var obj=document.getElementById("rectDoc"); 1.465 + if(obj){c.renderer.remove(obj) } 1.466 + c.renderer.rectDoc(zoominit); 1.467 + //c.renderer.rectDoc(zoominit1); 1.468 + //pst.id = "rectCanvas"; 1.469 + //c.selected=obj; 1.470 + // c.renderer.remove(obj) 1.471 + //var clip=c.renderer.copy(obj); 1.472 + 1.473 + 1.474 + 1.475 + //var pst=c.container.appendChild( clip ); 1.476 + //c.renderer.paste(clip,0,0); 1.477 + //pst.id = "rectCanvas"; 1.478 + 1.479 + 1.480 + //pasteSelected(); 1.481 + 1.482 + //c.renderer.duplicate(document.getElementById("rectCanvas")) 1.483 + //c.renderer.remove(document.getElementById("rectCanvas")); 1.484 + } 1.485 + if(viewMode=='preview') 1.486 + { 1.487 + var obj=document.getElementById("rectDoc"); 1.488 + if(obj){c.renderer.remove(obj) } 1.489 + } 1.490 +} 1.491 + function demo() { 1.492 + _dom=document.all?3:(document.getElementById?1:(document.layers?2:0)); 1.493 + ie = navigator.appVersion.match(/MSIE (\d\.\d)/); 1.494 + opera = (navigator.userAgent.toLowerCase().indexOf("opera") != -1); 1.495 + 1.496 + var renderer; 1.497 + 1.498 + if ((!ie) || (opera)) { 1.499 + renderer = new SVGRenderer(); 1.500 + browser='svg'; 1.501 + browserpath="linkspath.htm"; 1.502 + } 1.503 + else { 1.504 + renderer = new VMLRenderer(); 1.505 + browser='vml'; 1.506 + browserpath="vmlpaths.htm"; 1.507 + } 1.508 + 1.509 + c = new RichDrawEditor(document.getElementById('richdraw'), renderer); 1.510 + 1.511 + c.onInputXY = function(x,y){$('xyinput').innerHTML = parseInt(x)+','+parseInt(y)}//[x,y].join("<br>")} 1.512 + c.onViewInputXY = function(x,y){$('zoomOverInput').innerHTML = parseInt(x)+','+parseInt(y)}//[x,y].join("<br>")} 1.513 + 1.514 + c.onselect = onSelect; 1.515 + c.onunselect = onUnselect; 1.516 + 1.517 + 1.518 + 1.519 + // c.onkeydown = keypresshandler; 1.520 + //c.onkeypress = c.onKeyPress; 1.521 + //document.onkeypress = c.onKeyPress; 1.522 + 1.523 + 1.524 + 1.525 + c.editCommand('fillcolor', 'red'); 1.526 + c.editCommand('linecolor', 'black'); 1.527 + c.editCommand('linewidth', '1px'); 1.528 + 1.529 + 1.530 + //setMode('path', 'Path'); 1.531 + setMode('select', 'Selection'); 1.532 + 1.533 + document.body.style.backgroundColor = colorpage; 1.534 + 1.535 + 1.536 + //alert(vertexSUD.SUD1[0]+' '+vertexSUD.SUD1[1]+ '--'+wndW+' '+wndH); 1.537 + 1.538 + setTimeout(loadDemo,500) 1.539 + //Ext.get("richdraw").on('keydown', function(e){alert('dfsd'); }, false); 1.540 + //Ext.get("richdraw").on('keydown', function(e){alert(e.keyCode); }); 1.541 + //document.onkeydown = keypresshandler; 1.542 +//richdraw.svgRoot.setAttributeNS(null,'viewBox', '0 0 700 500'); 1.543 + 1.544 + //setTimeout(borderDoc,500) 1.545 + 1.546 + } //END demo 1.547 + 1.548 + 1.549 +///////////////// 1.550 + 1.551 + 1.552 +////////////////// 1.553 +var Docs = function(){ 1.554 + return { 1.555 + init : function(){ 1.556 + var loading = Ext.get('loading'); 1.557 + var mask = Ext.get('loading-mask'); 1.558 + mask.setOpacity(.7); 1.559 + mask.shift({ 1.560 + xy:loading.getXY(), 1.561 + width:loading.getWidth(), 1.562 + height:loading.getHeight(), 1.563 + remove:true, 1.564 + duration:2, 1.565 + opacity:.8, 1.566 + easing:'bounceOut', 1.567 + callback : function(){ 1.568 + loading.fadeOut({duration:.2,remove:true}); 1.569 + } 1.570 + }); 1.571 + } 1.572 + }; 1.573 +}(); 1.574 + 1.575 + 1.576 +Ext.onReady(Docs.init, Docs, true); 1.577 + 1.578 +//var win; 1.579 + 1.580 +function showinfoFrame(wtitle) { 1.581 + var win = new Ext.Window({ 1.582 + closeAction: 'hide', 1.583 + renderTo: 'showInfo', 1.584 + autoScroll:true, 1.585 + modal:true, 1.586 + width: '440', 1.587 + height:'300', 1.588 + x: '120', 1.589 + y: '40', 1.590 + title: wtitle, 1.591 + draggable :true, 1.592 + html: '', 1.593 + hidden: true, 1.594 + contentEl: 'divCode', 1.595 + collapsed: true 1.596 + 1.597 + }); 1.598 + win.show(); 1.599 +} 1.600 +function showdocFrame(wtitle) { 1.601 + var win = new Ext.Window({ 1.602 + closeAction: 'hide', 1.603 + renderTo: 'showInfo', 1.604 + width: '340', 1.605 + height:'300', 1.606 + x: '120', 1.607 + y: '40', 1.608 + title: wtitle, 1.609 + draggable :true, 1.610 + html: '', 1.611 + hidden: true, 1.612 + contentEl: 'docProperties', 1.613 + collapsed: true 1.614 + 1.615 + }); 1.616 + win.show(); 1.617 +} 1.618 +function showopenFile(wtitle) { 1.619 + var win = new Ext.Window({ 1.620 + autoScroll:true, 1.621 + closeAction: 'hide', 1.622 + renderTo: 'showInfo', 1.623 + width: '440', 1.624 + height:'300', 1.625 + x: '120', 1.626 + y: '40', 1.627 + title: wtitle, 1.628 + draggable :true, 1.629 + html: '', 1.630 + hidden: true, 1.631 + contentEl: 'divopenFile', 1.632 + collapsed: true 1.633 + 1.634 + }); 1.635 + win.show(); 1.636 +} 1.637 + 1.638 +function preView() { 1.639 + viewMode='preview'; 1.640 + // 1.641 + //document.forms[0].code.value=Ext.util.JSON.encode(canvas(c)); 1.642 + //myOPF=document.forms[0].code.value; 1.643 + c.renderer.view(docx,docy,docw,doch,zoominit); 1.644 + borderDoc(); 1.645 + 1.646 + //var all=canvas(c) ; 1.647 + // deleteAllShapes() 1.648 + //load(all,c); 1.649 + 1.650 +} 1.651 + 1.652 +function canvasView() { 1.653 + viewMode='canvas'; 1.654 + //deleteAllShapes() 1.655 + //document.forms[0].code.value=Ext.util.JSON.encode(canvas(c)); 1.656 + //myOPF=document.forms[0].code.value; 1.657 + //load(myOPF,c); 1.658 + c.renderer.view(docx,docy,docw,doch,zoominit); 1.659 + borderDoc(); 1.660 + //var all=canvas(c) ; 1.661 + //deleteAllShapes() 1.662 + //load(all,c); 1.663 + 1.664 +} 1.665 + 1.666 + 1.667 +///////////////////////////// 1.668 +//FUNCTIONS 1.669 +///////////////////////////// 1.670 + 1.671 +function changeInitialFile() 1.672 +{ 1.673 + initialFile=document.forms[0].file.value; 1.674 + c.renderer.removeAll() 1.675 + loadDemo(); 1.676 + if(viewMode=='canvas') 1.677 + { 1.678 + c.renderer.rectDoc(zoominit) 1.679 + } 1.680 + //win.hide(); 1.681 + //document.getElementById("showInfo").style.display='none'; 1.682 +} 1.683 + 1.684 + function setMode(mode, status) 1.685 + { 1.686 + 1.687 + 1.688 + selectmode=mode; 1.689 + if(mode=='shape') 1.690 + { 1.691 + c.editCommand('mode', 'select'); 1.692 + }else{ 1.693 + if(mode=='pathsEdit' ) 1.694 + { 1.695 + mode='select'; 1.696 + } 1.697 + c.editCommand('mode', mode); 1.698 + } 1.699 + 1.700 + var imgs = $('EST').getElementsByTagName('img'); 1.701 + 1.702 + for (var i=0; i<imgs.length; i++) 1.703 + { 1.704 + imgs[i].style.backgroundColor = ''; 1.705 + } 1.706 + if(c.pathsEdit==true){ 1.707 + $('pathsEdit').style.backgroundColor = 'orange'; 1.708 + }else{ 1.709 + $(mode).style.backgroundColor = 'orange'; 1.710 + } 1.711 + 1.712 + 1.713 + if (mode == 'select') 1.714 + { 1.715 + //$('status').innerHTML = 'Select/Move' ; 1.716 + info_select(); 1.717 + } 1.718 + else 1.719 + { 1.720 + //$('status').innerHTML = 'Draw ' + status; 1.721 + } 1.722 + 1.723 + /////////// 1.724 + 1.725 + hiddenAllMenus(); 1.726 + 1.727 + if(mode=='text') 1.728 + { 1.729 + info_text(); 1.730 + } 1.731 + 1.732 + if(mode=='shape') 1.733 + { 1.734 + info_shape(); 1.735 + } 1.736 + if(mode=='ellipse') 1.737 + { 1.738 + info_ellipse(); 1.739 + } 1.740 + 1.741 + if(mode=='rect') 1.742 + { 1.743 + info_rect(); 1.744 + } 1.745 + 1.746 + if(mode=='image') 1.747 + { 1.748 + info_image(); 1.749 + } 1.750 + 1.751 + if(mode=='path') 1.752 + { 1.753 + info_path(); 1.754 + } 1.755 + if(mode=='controlpath') 1.756 + { 1.757 + info_controlpath(); 1.758 + } 1.759 + if(mode=='zoom') 1.760 + { 1.761 + info_zoom(); 1.762 + 1.763 + } 1.764 + if(mode=='select') 1.765 + { 1.766 + if(c.pathsEdit==true) 1.767 + { 1.768 + info_pathsEdit(); 1.769 + } 1.770 + else 1.771 + { 1.772 + info_select(); 1.773 + } 1.774 + 1.775 + } 1.776 + //c.renderer.zoom(0,0); 1.777 + //document.getElementById('richdraw').focus(); 1.778 + 1.779 + } 1.780 + 1.781 + ///////////////////////// 1.782 + 1.783 + function hiddenAllMenus() 1.784 + { 1.785 + 1.786 + document.getElementById('richdraw').style.cursor='default'; 1.787 + $('options_text').style.visibility = 'hidden'; 1.788 + $('options_select_path').style.visibility = 'hidden'; 1.789 + $('panel_shapes').style.visibility = 'hidden'; 1.790 + $('linksPaths').style.visibility = 'hidden'; 1.791 + $('options_rect').style.visibility = 'hidden'; 1.792 + $('options_ellipse').style.visibility = 'hidden'; 1.793 + $('options_image').style.visibility = 'hidden'; 1.794 + $('options_path').style.visibility = 'hidden'; 1.795 + //$('options_controlpath').style.visibility = 'hidden'; 1.796 + $('options_zoom').style.visibility = 'hidden'; 1.797 + $('options_select').style.visibility = 'hidden'; 1.798 + 1.799 + 1.800 + selectedit=''; 1.801 + } 1.802 + 1.803 + function info_text() 1.804 + { 1.805 + $('options_text').style.visibility = 'visible'; 1.806 + } 1.807 + function info_shape() 1.808 + { 1.809 + $('options_select_path').style.visibility = 'visible'; 1.810 + $('linksPaths').style.visibility = 'visible'; 1.811 + $('panel_shapes').style.visibility= 'visible'; 1.812 + } 1.813 + function info_rect() 1.814 + { 1.815 + $('options_rect').style.visibility = 'visible'; 1.816 + } 1.817 + function info_ellipse() 1.818 + { 1.819 + $('options_ellipse').style.visibility = 'visible'; 1.820 + } 1.821 + 1.822 + function info_image() 1.823 + { 1.824 + $('options_image').style.visibility = 'visible'; 1.825 + } 1.826 + function info_path() 1.827 + { 1.828 + $('options_path').style.visibility = 'visible'; 1.829 + 1.830 + } 1.831 + function info_controlpath() 1.832 + { 1.833 + $('options_path').style.visibility = 'visible'; 1.834 + 1.835 + } 1.836 + function info_zoom() 1.837 + { 1.838 + $('options_zoom').style.visibility = 'visible'; 1.839 + //$('options_zoom').style.backgroundColor = colorpage; 1.840 + if(zoommode=='hand') 1.841 + { 1.842 + document.getElementById('richdraw').style.cursor='move'; 1.843 + 1.844 + }else{ 1.845 + if(zoommode=='window') 1.846 + { 1.847 + 1.848 + }else{ 1.849 + c.renderer.zoom(0,0); 1.850 + } 1.851 + } 1.852 + var imgs = $('options_zoom').getElementsByTagName('img'); 1.853 + for (var i=0; i<imgs.length; i++) 1.854 + { 1.855 + imgs[i].style.backgroundColor = ''; 1.856 + } 1.857 + $('zoom_'+zoommode).style.backgroundColor = 'orange'; 1.858 + 1.859 + 1.860 + 1.861 + } 1.862 + 1.863 + function info_pathsEdit(){ 1.864 + $('options_path').style.visibility = 'visible'; 1.865 + } 1.866 + 1.867 + function info_select() 1.868 + { 1.869 + $('options_select').style.visibility = 'visible'; 1.870 + //$('options_select').style.backgroundColor = colorpage; 1.871 + 1.872 + if(selectedit=='deleteone') 1.873 + { 1.874 + deleteShape(); 1.875 + } 1.876 + if(selectedit=='deleteall') 1.877 + { 1.878 + deleteAllShapes(); 1.879 + } 1.880 + if(selectedit=='tothetop') 1.881 + { 1.882 + toFront(-1); 1.883 + } 1.884 + if(selectedit=='totheback') 1.885 + { 1.886 + toFront(0); 1.887 + } 1.888 + if(selectedit=='oneback') 1.889 + { 1.890 + toFront(1); 1.891 + } 1.892 + if(selectedit=='onetop') 1.893 + { 1.894 + toFront(2); 1.895 + } 1.896 + if(selectedit=='reflectV') 1.897 + { 1.898 + c.reflect('V'); 1.899 + } 1.900 + if(selectedit=='reflectH') 1.901 + { 1.902 + c.reflect('H'); 1.903 + } 1.904 + 1.905 + var imgs = $('options_select').getElementsByTagName('img'); 1.906 + for (var i=0; i<imgs.length; i++) 1.907 + { 1.908 + imgs[i].style.backgroundColor = ''; 1.909 + } 1.910 + if(selectedit != '') 1.911 + { 1.912 + $('select_'+selectedit).style.backgroundColor = 'orange'; 1.913 + } 1.914 + 1.915 + } 1.916 + 1.917 + 1.918 +//////////////////////////// 1.919 + 1.920 + 1.921 + function setShape() 1.922 + { 1.923 + if(selectmode=='select' || selectmode=='control_path' || selectmode=='path'){ 1.924 + c.submitShape(document.forms[0].control_codebase.value); 1.925 + }else{ 1.926 + setMode('path', 'Path'); 1.927 + c.submitShape(document.forms[0].codebase.value); 1.928 + } 1.929 + } 1.930 + 1.931 + //function onKeyPress(){ 1.932 + //c.onKeyPress(); 1.933 + //} 1.934 + 1.935 + 1.936 + function deleteShape() 1.937 + { 1.938 + c.deleteSelection(); 1.939 + } 1.940 + 1.941 + function deleteAllShapes() 1.942 + { 1.943 + c.deleteAll(); 1.944 + } 1.945 + 1.946 + function deleteLastShapes() 1.947 + { 1.948 + //c.deleteLast(); 1.949 + c.clipboard=c.renderer.undo(); 1.950 + } 1.951 + function toFront(num) 1.952 + { 1.953 + c.toFront(num); 1.954 + } 1.955 + function cutSelected() 1.956 + { 1.957 + 1.958 + c.clipboard=c.renderer.copy(c.selected); 1.959 + c.deleteSelection(); 1.960 + } 1.961 + function copySelected() 1.962 + { 1.963 + c.clipboard=c.renderer.copy(c.selected); 1.964 + } 1.965 + function pasteSelected() 1.966 + { 1.967 + c.selected=c.renderer.paste(c.clipboard,c.mouseDownX,c.mouseDownY); 1.968 + c.selected.id = 'shape:' + createUUID(); 1.969 + Ext.get(c.selected).on( "mousedown", c.onHit,c); 1.970 + } 1.971 + function duplicateSelected() 1.972 + { 1.973 + c.selected=c.renderer.duplicate(c.selected); 1.974 + c.selected.id = 'shape:' + createUUID(); 1.975 + Ext.get(c.selected).on( "mousedown", c.onHit,c); 1.976 + } 1.977 +/////////////////////////// 1.978 + 1.979 + 1.980 + function setFillColor(color) //colors -- 1.981 + { 1.982 + //-- var color = colors.options[colors.selectedIndex].value; 1.983 + //-- colors.style.backgroundColor = color; 1.984 + 1.985 + c.editCommand('fillcolor', color); 1.986 + } 1.987 + 1.988 + function setLineColor(color) //colors -- 1.989 + { 1.990 + //--var color = colors.options[colors.selectedIndex].value; 1.991 + //-- colors.style.backgroundColor = color; 1.992 + 1.993 + c.editCommand('linecolor', color); 1.994 + } 1.995 + 1.996 + function setLineWidth(width) //width -- 1.997 + { 1.998 + //-- var width = widths.options[widths.selectedIndex].value; 1.999 + c.editCommand('linewidth', width); 1.1000 + } 1.1001 + //// 1.1002 + //++ 1.1003 + function setFillOpacity(opacity) 1.1004 + { 1.1005 + c.editCommand('fillopacity', opacity); 1.1006 + } 1.1007 + //// 1.1008 + //++ 1.1009 + function setLineOpacity(opacity) 1.1010 + { 1.1011 + c.editCommand('lineopacity', opacity); 1.1012 + } 1.1013 + 1.1014 + function setTextFamily(types) 1.1015 + { 1.1016 + var type = types.options[types.selectedIndex].value; 1.1017 + document.forms[0].option_text_family.value=type; //bad :-( 1.1018 + data_text_family = type; 1.1019 + c.submitShape($('option_text_message').value+'<;>'+$('option_text_size').value+'<;>'+$('option_text_family').value); 1.1020 + } 1.1021 + 1.1022 + function setGridWidth(widths) 1.1023 + { 1.1024 + var width = eval(widths.options[widths.selectedIndex].value); 1.1025 + RichDrawEditor.prototype.setGrid(width, width); 1.1026 + } 1.1027 + 1.1028 +/////////////////////////////// 1.1029 + 1.1030 + 1.1031 + function getOptionByValue(select, value) 1.1032 + { 1.1033 + /*for (var i=0; i<select.length; i++) 1.1034 + { 1.1035 + if (select.options[i].value == value) 1.1036 + { 1.1037 + return i; 1.1038 + } 1.1039 + } 1.1040 + return -1; 1.1041 + */ 1.1042 + } 1.1043 + 1.1044 +///////////////////////////// 1.1045 + 1.1046 + function showMarkupCode() 1.1047 + { 1.1048 + $('code').value = c.renderer.getMarkup(); 1.1049 + //document.forms[0].code.focus(); 1.1050 + //$('code').select; 1.1051 + showinfoFrame('SVG code') 1.1052 + //infoFrame.setTitle('SVG code'); 1.1053 + //infoFrame.show(); 1.1054 + 1.1055 + } 1.1056 + function newFile() 1.1057 + { 1.1058 + initialFile='new.txt'; 1.1059 + document.forms[0].file.value = initialFile; 1.1060 + changeInitialFile() 1.1061 + 1.1062 + } 1.1063 + function openFile() 1.1064 + { 1.1065 + $('file').value = initialFile; 1.1066 + //document.forms[0].code.focus(); 1.1067 + //$('code').select; 1.1068 + showopenFile('Open File') 1.1069 + //infoFrame.setTitle('SVG code'); 1.1070 + //infoFrame.show(); 1.1071 + 1.1072 + } 1.1073 + function showMarkup() 1.1074 + { 1.1075 + document.forms[0].code.value=Ext.util.JSON.encode(canvas(c)); 1.1076 + //infoFrame.setTitle('OPF code'); 1.1077 + //infoFrame.show(); 1.1078 + showinfoFrame('OPF code') 1.1079 + 1.1080 + 1.1081 + } 1.1082 + 1.1083 + function shm() 1.1084 + { 1.1085 + var json = Ext.util.JSON.encode(canvas(c)) 1.1086 + $('someinfo').value = "JSON File Format Saved : "+( c.renderer.getMarkup().length - json.length )+" characters; JSON Character Total: "+json.length 1.1087 + $('code').value=json; 1.1088 + } 1.1089 + 1.1090 + function lcm() 1.1091 + { 1.1092 + load(Ext.util.JSON.decode(document.forms[0].code.value),c) 1.1093 + c.renderer.rectDoc(zoominit) 1.1094 + 1.1095 + 1.1096 + } 1.1097 + 1.1098 +//////////////////////////////////////// 1.1099 + 1.1100 + 1.1101 + function onSelect() 1.1102 + { 1.1103 + /*$('fillcolor').selectedIndex = getOptionByValue($('fillcolor'), c.queryCommand('fillcolor')); 1.1104 + $('fillcolor').style.backgroundColor = c.queryCommand('fillcolor'); 1.1105 + $('linecolor').selectedIndex = getOptionByValue($('linecolor'), c.queryCommand('linecolor')); 1.1106 + $('linecolor').style.backgroundColor = c.queryCommand('linecolor'); 1.1107 + $('linewidth').selectedIndex = getOptionByValue($('linewidth'), c.queryCommand('linewidth')); 1.1108 + */ 1.1109 + hiddenAllMenus(); 1.1110 + info_select(); 1.1111 + 1.1112 + if (c.selected.tagName == 'rect'){ 1.1113 + //setMode('rect', 'Rectangle') 1.1114 + info_rect(); 1.1115 + } 1.1116 + if (c.selected.tagName == 'image'){ 1.1117 + info_image(); 1.1118 + } 1.1119 + if (c.selected.tagName == 'text'){ 1.1120 + info_text(); 1.1121 + } 1.1122 + if (c.selected.tagName == 'line'){ 1.1123 + //info_line(); 1.1124 + } 1.1125 + if (c.selected.tagName == 'ellipse'){ 1.1126 + info_ellipse() 1.1127 + } 1.1128 + if (c.selected.tagName == 'path') { 1.1129 + 1.1130 + info_path(); 1.1131 + } 1.1132 + if (c.selected.tagName == 'shape'){ 1.1133 + var detail=c.selected.children[0].tagName; 1.1134 + $('someinfo').value=detail; 1.1135 + if(detail=='path'){ info_path(); } 1.1136 + if(detail=='textpath'){ info_text(); } 1.1137 + } 1.1138 + if (c.selected.tagName == 'oval') { 1.1139 + 1.1140 + info_ellipse(); 1.1141 + } 1.1142 + 1.1143 + //frames['mondrianstyle'].setcolorhex(c.queryCommand('linecolor'),'stroke'); 1.1144 + //frames['mondrianstyle'].setcolorhex(c.queryCommand('fillcolor'),'fill'); 1.1145 + } 1.1146 + 1.1147 + function onUnselect() 1.1148 + { 1.1149 + 1.1150 + /* 1.1151 + $('fillcolor').selectedIndex = getOptionByValue($('fillcolor'), c.queryCommand('fillcolor')); 1.1152 + $('fillcolor').style.backgroundColor = c.queryCommand('fillcolor'); 1.1153 + $('linecolor').selectedIndex = getOptionByValue($('linecolor'), c.queryCommand('linecolor')); 1.1154 + $('linecolor').style.backgroundColor = c.queryCommand('linecolor'); 1.1155 + $('linewidth').selectedIndex = getOptionByValue($('linewidth'), c.queryCommand('linewidth')); 1.1156 + */ 1.1157 + 1.1158 + } 1.1159 + 1.1160 + function editPath(myfield,e) 1.1161 + { 1.1162 + 1.1163 + var keycode; 1.1164 + 1.1165 + 1.1166 + // ++? if (window.event) keycode = window.event.e; 1.1167 + 1.1168 + e= (e) ? e : ((window.event) ? event : null); 1.1169 + keycode=e.keyCode; 1.1170 + var shs= myfield.id.split('_'); 1.1171 + var sh=shs[1]; 1.1172 + 1.1173 + var mypath=$('control_codebase').value; 1.1174 + 1.1175 + 1.1176 + var x= $('option_path_x').value; 1.1177 + var y= $('option_path_y').value; 1.1178 + var precoord=x+','+y; 1.1179 + 1.1180 + 1.1181 + var mypointNum=$('option_path_num').value; 1.1182 + var controlNodeNum=2; 1.1183 + 1.1184 + if (keycode == 38)//#26 1.1185 + { 1.1186 + myfield.value=eval(myfield.value)+1; 1.1187 + } 1.1188 + if (keycode == 40)// #28 1.1189 + { 1.1190 + myfield.value=eval(myfield.value)-1; 1.1191 + } 1.1192 + if (keycode == 13 || keycode == 40 || keycode == 38) 1.1193 + { 1.1194 + var cadx= $('option_path_x').value; 1.1195 + var cady= $('option_path_y').value; 1.1196 + var coord=cadx+','+cady; 1.1197 + 1.1198 + //$('code').value=coord; 1.1199 + 1.1200 + var cad1=new RegExp(precoord,"g"); 1.1201 + 1.1202 + 1.1203 + var result=mypath.replace(cad1, coord); 1.1204 + 1.1205 + $('control_codebase').value=' '; 1.1206 + $('control_codebase').value=result; 1.1207 + 1.1208 + $('someinfo').value=precoord; 1.1209 + //alert(myfield.id); 1.1210 + setShape(); //c.renderer.tocurve(); 1.1211 + 1.1212 + return false; 1.1213 + 1.1214 + } 1.1215 + else 1.1216 + return true; 1.1217 + } 1.1218 + 1.1219 + 1.1220 + function editPathXX(myfield,e) 1.1221 + { 1.1222 + 1.1223 + var keycode; 1.1224 + 1.1225 + 1.1226 + // ++? if (window.event) keycode = window.event.e; 1.1227 + 1.1228 + e= (e) ? e : ((window.event) ? event : null); 1.1229 + keycode=e.keyCode; 1.1230 + var shs= myfield.id.split('_'); 1.1231 + var sh=shs[1]; 1.1232 + 1.1233 + var mypath=$('control_codebase').value; 1.1234 + var mypointNum=$('option_path_num').value; 1.1235 + var controlNodeNum=2; 1.1236 + 1.1237 + if (keycode == 38)//#26 1.1238 + { 1.1239 + myfield.value=eval(myfield.value)+1; 1.1240 + } 1.1241 + if (keycode == 40)// #28 1.1242 + { 1.1243 + myfield.value=eval(myfield.value)-1; 1.1244 + } 1.1245 + 1.1246 + 1.1247 + var points=mypath.split('C'); 1.1248 + var chain=''; 1.1249 + var segment=' '; 1.1250 + prevControl=' '; 1.1251 + nextControl=' '; 1.1252 + nodePoint=' '; 1.1253 + var init=points[0].split('M'); 1.1254 + var allcoords=init[1].split(' '); 1.1255 + var point=allcoords[0].split(','); 1.1256 + 1.1257 + if(mypointNum==0){ 1.1258 + 1.1259 + point[1]= $('option_path_x').value; 1.1260 + point[2]= $('option_path_y').value; 1.1261 + var change=point.join(',') 1.1262 + 1.1263 + chain+='M' + change+' '; 1.1264 + }else{ 1.1265 + chain+='M'+points[0]+' '; 1.1266 + } 1.1267 + 1.1268 + var numpoints=points.length-1; 1.1269 + if(numpoints>1){ 1.1270 + for(var a=1;a<=numpoints;a++) 1.1271 + { 1.1272 + 1.1273 + if(a==mypointNum){ 1.1274 + 1.1275 + segment=points[a].split(' '); 1.1276 + prevControl=segment[0]+' '; 1.1277 + nextControl=segment[1]+' '; 1.1278 + nodePoint=segment[2]+' '; 1.1279 + 1.1280 + 1.1281 + /*if(controlNodeNum==0){chain+=prevControl; var point=prevControl.split(',');} 1.1282 + if(controlNodeNum==1){chain+=nextControl; var point=nextControl.split(',');} 1.1283 + if(controlNodeNum==2){chain+=nodePoint; var point=nodePoint.split(',');} 1.1284 + */ 1.1285 + 1.1286 + var point=nodePoint.split(','); 1.1287 + point[1]= $('option_path_x').value; 1.1288 + point[2]= $('option_path_y').value; 1.1289 + var change=point.join(',') 1.1290 + 1.1291 + chain+='C'+prevControl+ nextControl + change+' '; 1.1292 + }else{ 1.1293 + chain+='C'+points[a]; 1.1294 + } 1.1295 + 1.1296 + } 1.1297 + 1.1298 + }else{ 1.1299 + chain+='C'+points[1]; 1.1300 + 1.1301 + } 1.1302 + //$('someinfo').value= chain; 1.1303 + $('control_codebase').value=chain; 1.1304 + 1.1305 + 1.1306 + 1.1307 + 1.1308 + 1.1309 + if (keycode == 13 || keycode == 40 || keycode == 38) 1.1310 + { 1.1311 + //alert(myfield.id); 1.1312 + c.renderer.tocurve(); 1.1313 + 1.1314 + return false; 1.1315 + 1.1316 + } 1.1317 + else 1.1318 + return true; 1.1319 + } 1.1320 + 1.1321 + 1.1322 + 1.1323 + function edit(myfield,e) 1.1324 + { 1.1325 + 1.1326 + var keycode; 1.1327 + 1.1328 + 1.1329 + // ++? if (window.event) keycode = window.event.e; 1.1330 + //else if (e) keycode = e.which; 1.1331 + 1.1332 + e= (e) ? e : ((window.event) ? event : null); 1.1333 + keycode=e.keyCode; 1.1334 + //var keycode = e.which?e.which:e.keycode 1.1335 + 1.1336 + //document.layers ? e.which : 1.1337 + //document.all ? e.keyCode : 1.1338 + //document.getElementById ? e.keyCode : 0; 1.1339 + //else return true; 1.1340 + var keyChar = String.fromCharCode(keycode); 1.1341 + //var numCheck = /\d/; 1.1342 + //if (((keyChar=='.')&&(obj.value.indexOf('.')==-1))¦¦(keycode<32)¦¦numCheck.test(keyChar)¦¦((keycode>=37)&&(keycode<=40)&&(!e.modifiers&&!e.shiftKey))) { 1.1343 + 1.1344 + //alert(keycode+' _ '+keyChar); 1.1345 + var shs= myfield.id.split('_'); 1.1346 + var sh=shs[1]; 1.1347 + if(myfield.id.indexOf('control_codebase')<=0) 1.1348 + { 1.1349 + if (keycode == 38)//#26 1.1350 + { 1.1351 + 1.1352 + if(eval(myfield.value)>0) 1.1353 + { 1.1354 + myfield.value=eval(myfield.value)+1; 1.1355 + //alert(myfield.value); 1.1356 + } 1.1357 + //return false; 1.1358 + //alert('keycode') 1.1359 + 1.1360 + } 1.1361 + if (keycode == 40)// #28 1.1362 + { 1.1363 + myfield.value=eval(myfield.value)-1; 1.1364 + if(myfield.id=='option_path_sclx' || myfield.id=='option_path_scly') 1.1365 + { 1.1366 + if( eval(myfield.value)<=0 ) 1.1367 + { 1.1368 + myfield.value=1; 1.1369 + } 1.1370 + } 1.1371 + 1.1372 + if(myfield.id=='option_text_size') 1.1373 + { 1.1374 + if( eval(myfield.value)<=0 ) 1.1375 + { 1.1376 + myfield.value=1; 1.1377 + } 1.1378 + } 1.1379 + } 1.1380 + 1.1381 + } 1.1382 + 1.1383 + if (keycode == 13 || keycode == 40 || keycode == 38) 1.1384 + { 1.1385 + var check=0; 1.1386 + if(myfield.id=='control_codebase') 1.1387 + { 1.1388 + //alert(myfield.id) 1.1389 + //c.submitShape($('control_codebase').value+''); 1.1390 + check=1; 1.1391 + setShape(); 1.1392 + } 1.1393 + 1.1394 + if(myfield.id.indexOf('href')>0) 1.1395 + { 1.1396 + c.submitShape(myfield.value) 1.1397 + } 1.1398 + 1.1399 + if(myfield.id.indexOf('tr')>0 || myfield.id.indexOf('scl')>0) 1.1400 + { 1.1401 + if(check==0) 1.1402 + { 1.1403 + c.submitShape($('option_'+sh+'_trx').value+';'+$('option_'+sh+'_try').value+';'+$('option_'+sh+'_sclx').value+';'+$('option_'+sh+'_scly').value+';'+$('option_'+sh+'_rot').value) 1.1404 + } 1.1405 + } 1.1406 + 1.1407 + if(myfield.id.indexOf('rot')>0) 1.1408 + { 1.1409 + c.submitShape($('option_'+sh+'_trx').value+';'+$('option_'+sh+'_try').value+';'+$('option_'+sh+'_sclx').value+';'+$('option_'+sh+'_scly').value+';'+$('option_'+sh+'_rot').value) 1.1410 + } 1.1411 + 1.1412 + if(myfield.id.indexOf('text')>0) 1.1413 + { 1.1414 + c.submitShape($('option_text_message').value+'<;>'+$('option_text_size').value+'<;>'+$('option_text_family').value); 1.1415 + } 1.1416 + //alert(myfield.id); 1.1417 + return false; 1.1418 + 1.1419 + } 1.1420 + else 1.1421 + return true; 1.1422 + } 1.1423 + 1.1424 + 1.1425 + 1.1426 + 1.1427 +function env(myfield,delta) 1.1428 + { 1.1429 + 1.1430 + //alert(keycode+' _ '+keyChar); 1.1431 + 1.1432 + if (delta >0)//#26 1.1433 + { 1.1434 + myfield.value=eval(myfield.value)+1; 1.1435 + //return false; 1.1436 + //alert('keycode') 1.1437 + } 1.1438 + else 1.1439 + { 1.1440 + myfield.value=eval(myfield.value)-1; 1.1441 + //return false; 1.1442 + } 1.1443 + 1.1444 + 1.1445 + if(myfield.id=='option_image_href') 1.1446 + { 1.1447 + c.submitShape(myfield.value) 1.1448 + } 1.1449 + if(myfield.id=='option_select_trx' || myfield.id=='option_select_try' || myfield.id=='option_select_sclx' || myfield.id=='option_select_scly') 1.1450 + { 1.1451 + c.submitShape($('option_select_trx').value+';'+$('option_select_try').value+';'+$('option_select_sclx').value+';'+$('option_select_scly').value+';'+$('option_select_rot').value) 1.1452 + } 1.1453 + if(myfield.id=='option_select_rot') 1.1454 + { 1.1455 + c.submitShape($('option_select_trx').value+';'+$('option_select_try').value+';'+$('option_select_sclx').value+';'+$('option_select_scly').value+';'+$('option_select_rot').value) 1.1456 + } 1.1457 + 1.1458 + } 1.1459 + 1.1460 + 1.1461 + function clockdata(){ 1.1462 + ////////////// 1.1463 + //++ 1.1464 + 1.1465 + data_path_close = $('option_path_close').checked; 1.1466 + data_text_family = $('option_text_family').value; 1.1467 + data_text_size = parseFloat($('option_text_size').value); 1.1468 + data_text_messaje = $('option_text_message').value; 1.1469 + data_image_href = $('option_image_href').value; 1.1470 + 1.1471 + //////////// 1.1472 + } 1.1473 + 1.1474 + function myWorkSize() { 1.1475 + var myWidth = 0, myHeight = 0; 1.1476 + if( typeof( window.innerWidth ) == 'number' ) { 1.1477 + //Non-IE 1.1478 + myWidth = window.innerWidth; 1.1479 + myHeight = window.innerHeight; 1.1480 + } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { 1.1481 + //IE 6+ in 'standards compliant mode' 1.1482 + myWidth = document.documentElement.clientWidth; 1.1483 + myHeight = document.documentElement.clientHeight; 1.1484 + } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { 1.1485 + //IE 4 compatible 1.1486 + myWidth = document.body.clientWidth; 1.1487 + myHeight = document.body.clientHeight; 1.1488 + } 1.1489 + return [ myWidth, myHeight] ; 1.1490 +} 1.1491 + 1.1492 +function doResize(){ 1.1493 + //deleteAllShapes(); 1.1494 + vertexFrames(); 1.1495 + resizeFrame(); 1.1496 + //c.renderer.zoomFrame(zoominit); 1.1497 + //c.renderer.view(canvasX,canvasY,canvasW,canvasH,zoominit) 1.1498 + //c.renderer.view(docx,docy,docw,doch,zoominit1) 1.1499 + // delete rectCanvas 1.1500 + // var vB=zoomx+' '+zoomy+' '+zoomw+' '+zoomh; 1.1501 + 1.1502 + //c.renderer.rectCanvas(docx,docy,docw,doch,vB); 1.1503 +} 1.1504 + 1.1505 +function vertexFrames(){ 1.1506 + 1.1507 + var screenSize=myWorkSize(); 1.1508 + scrW = screenSize[0];//screen.availWidth; 1.1509 + scrH = screenSize[1];//screen.availHeight; 1.1510 + 1.1511 + wndW=scrW;//window.width; 1.1512 + wndH=scrH;//window.height; 1.1513 + 1.1514 + 1.1515 + if (scrW != wndW || scrH != wndH) { 1.1516 + //window.resizeTo(scrW, scrH); 1.1517 + //window.moveTo(0, 0); 1.1518 + } 1.1519 + //var wProportion={x:35, y:24} 1.1520 + 1.1521 + vertexNORTHmenu={ NORTHmenu1:[0,0],NORTHmenu2:[scrW,0],NORTHmenu3:[0,wProportion.y],NORTHmenu4:[scrW,wProportion.y] }; 1.1522 + vertexNORTHglobals={ NORTHglobals1:[0,wProportion.y],NORTHglobals2:[scrW,wProportion.y],NORTHglobals3:[0,wProportion.y*2],NORTHglobals4:[scrW,wProportion.y*2] }; 1.1523 + vertexNORTHoptions={ NORTHoptions1:[0,wProportion.y*2],NORTHoptions2:[scrW,wProportion.y*2],NORTHoptions3:[0,wProportion.y*3],NORTHoptions4:[scrW,wProportion.y*3] }; 1.1524 + vertexSUD={ SUD1:[0,wndH-wProportion.y*3], SUD2:[scrW,(wndH-wProportion.y*3)], SUD3:[0,wndH], SUD4:[scrW,wndH]}; 1.1525 + 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.1526 + 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.1527 + 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.1528 + 1.1529 + NORTHmenusize=[vertexNORTHmenu.NORTHmenu4[0]-vertexNORTHmenu.NORTHmenu1[0],vertexNORTHmenu.NORTHmenu4[1]-vertexNORTHmenu.NORTHmenu1[1]]; 1.1530 + NORTHglobalssize=[vertexNORTHglobals.NORTHglobals4[0]-vertexNORTHglobals.NORTHglobals1[0],vertexNORTHglobals.NORTHglobals4[1]-vertexNORTHglobals.NORTHglobals1[1]]; 1.1531 + NORTHoptionssize=[vertexNORTHoptions.NORTHoptions4[0]-vertexNORTHoptions.NORTHoptions1[0],vertexNORTHoptions.NORTHoptions4[1]-vertexNORTHoptions.NORTHoptions1[1]]; 1.1532 + SUDsize=[vertexSUD.SUD4[0]-vertexSUD.SUD1[0],vertexSUD.SUD4[1]-vertexSUD.SUD1[1]]; 1.1533 + ESTsize=[vertexEST.EST4[0]-vertexEST.EST1[0],vertexEST.EST4[1]-vertexEST.EST1[1]]; 1.1534 + WESTsize=[vertexWEST.WEST4[0]-vertexWEST.WEST1[0],vertexWEST.WEST4[1]-vertexWEST.WEST1[1]]; 1.1535 + FRONTsize=[vertexFRONT.FRONT4[0]-vertexFRONT.FRONT1[0],vertexFRONT.FRONT4[1]-vertexFRONT.FRONT1[1]]; 1.1536 + 1.1537 + 1.1538 + 1.1539 + //percent of FRONTsize 1.1540 + proporDoc= FRONTsize[0]/FRONTsize[1]; 1.1541 + canvasYpercent=100; 1.1542 + canvasXpercent=100; 1.1543 + canvasWidth=Math.round(FRONTsize[0]*canvasXpercent/100);//FRONTsize[0]; 1.1544 + canvasW=canvasWidth; 1.1545 + canvasHeight=Math.round(canvasYpercent*FRONTsize[1]/100);//FRONTsize[1]; 1.1546 + canvasH=canvasHeight; 1.1547 + canvasX=Math.round((FRONTsize[0]-canvasW)/2); 1.1548 + canvasY=Math.round((FRONTsize[1]-canvasH)/2); 1.1549 + 1.1550 + 1.1551 + //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.1552 + //FRONTcanvassize=[vertexFRONT.FRONT4[0]-vertexFRONT.FRONT1[0],vertexFRONT.FRONT4[1]-vertexFRONT.FRONT1[1]]; 1.1553 + 1.1554 + 1.1555 + //centerZoomx=Math.round(canvasWidth/2); 1.1556 + //centerZoomy=Math.round(canvasHeight/2); 1.1557 + if(canvasH==0){ canvasH=0.00000001; } 1.1558 + proporCanvas= canvasW/canvasH ; 1.1559 + //zoominit='0 0 '+zoomw+' '+zoomh;// 1.1560 + 1.1561 + makeWorkSite(canvasH,(-canvasW/2)+(docw/2),(-canvasH/2)+(doch/2)); 1.1562 + diagonalinit=diagonalFrame; 1.1563 + proporDiagonal=diagonalFrame/diagonalinit; 1.1564 + zoominit=(zoomx)+' '+(zoomy)+' '+zoomw+' '+zoomh; 1.1565 + //$('someinfo').value= zoominit; 1.1566 + //document.forms[0].someinfo.value= zoominit; 1.1567 + //document.getElementById("someinfo").value = zoominit 1.1568 + //Ext.get('richdraw').dom.style.scrollTop = ('40%'); 1.1569 + //alert(zoominit); 1.1570 +} 1.1571 + 1.1572 +function resizeFrame(){ 1.1573 + 1.1574 + Ext.get('NORTHmenu').dom.style.backgroundColor = (colorpage1a); 1.1575 + Ext.get('NORTHglobals').dom.style.backgroundColor = (colorpage1b); 1.1576 + Ext.get('NORTHoptions').dom.style.backgroundColor = (colorpage1c); 1.1577 + 1.1578 + Ext.get('SUD').dom.style.backgroundColor = (colorpage2); 1.1579 + Ext.get('EST').dom.style.backgroundColor = (colorpage3); 1.1580 + Ext.get('WEST').dom.style.backgroundColor = (colorpage4); 1.1581 + 1.1582 + Ext.get('linksPaths').dom.style.backgroundColor = (colorpage); // bad 1.1583 + 1.1584 + 1.1585 + 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.1586 + 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.1587 + 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.1588 + 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.1589 + 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.1590 + 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.1591 + 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.1592 + 1.1593 + 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.1594 + 1.1595 +} 1.1596 + 1.1597 +function documentProperties(){ 1.1598 + var tokens = zoominit.split(' '); 1.1599 + 1.1600 + document.forms[0].xDocument.value=tokens[0]; 1.1601 + document.forms[0].yDocument.value=tokens[1]; 1.1602 + 1.1603 + document.forms[0].widthDocument.value=tokens[2]; 1.1604 + document.forms[0].heightDocument.value=tokens[3]; 1.1605 + showdocFrame('Document properties') 1.1606 + //docFrame.setTitle('Document properties'); 1.1607 + //docFrame.show(); 1.1608 + 1.1609 +} 1.1610 +function changeDocumentProperties(){ 1.1611 + 1.1612 + //percent of FRONTsize 1.1613 + proporSpace= FRONTsize[0]/FRONTsize[1]; 1.1614 + //PERCENT 1.1615 + 1.1616 + //canvasYpercent=95; 1.1617 + //canvasXpercent=97; 1.1618 + /* 1.1619 + canvasWidth=Math.round(FRONTsize[0]*canvasXpercent/100);//FRONTsize[0]; 1.1620 + canvasW=canvasWidth; 1.1621 + canvasHeight=Math.round(canvasYpercent*FRONTsize[1]/100);//FRONTsize[1]; 1.1622 + canvasH=canvasHeight; 1.1623 + */ 1.1624 + 1.1625 + docx=eval(document.forms[0].xDocument.value); 1.1626 + docy=eval(document.forms[0].yDocument.value); 1.1627 + 1.1628 + docw=eval(document.forms[0].widthDocument.value); 1.1629 + doch=eval(document.forms[0].heightDocument.value); 1.1630 + zoominit= docx+' '+docy+' '+docw+' '+doch; 1.1631 + c.renderer.view(docx,docy,docw,doch,zoominit); 1.1632 + borderDoc(); 1.1633 + 1.1634 + //doResize(); 1.1635 + //canvasX=Math.round((FRONTsize[0]-canvasW)/2); 1.1636 + //canvasY=Math.round((FRONTsize[1]-canvasH)/2); 1.1637 + 1.1638 + 1.1639 + //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.1640 + 1.1641 +} 1.1642 +function makeWorkSite(width,left,top) { 1.1643 + fieldViewx=Math.round(width*proporCanvas)*1; 1.1644 + fieldViewy=width*1; 1.1645 + diagonalFrame=dist2p(0,0,fieldViewx*1,fieldViewy*1); 1.1646 + diagonalAngle=getAngle(fieldViewx,fieldViewy); 1.1647 + diagonalMidx=fieldViewx/2; 1.1648 + diagonalMidy=fieldViewy/2; 1.1649 + centerZoomx=diagonalMidx; 1.1650 + centerZoomy=diagonalMidy; 1.1651 + 1.1652 + //alert(diagonalinit+' '+diagonalFrame+' '+proporDiagonal); 1.1653 + //alert(canvasW+''+canvasW+' propor:'+proporCanvas+' Docy:'+docy+' fieldView:'+fieldViewx+' '+fieldViewy); 1.1654 + zoomx=(diagonalMidx+(diagonalFrame/2)*Math.cos(diagonalAngle+Math.PI))+left;//-(fieldViewx/8);//-(canvasW/2)docx-fieldViewx; 1.1655 + zoomy=(diagonalMidy+(diagonalFrame/2)*Math.sin(diagonalAngle+Math.PI))+top;//-(fieldViewy/8);//-(canvasH/2);//docy-fieldViewy; 1.1656 + zoomw=diagonalMidx+(diagonalFrame/2)*Math.cos(diagonalAngle);//fieldViewx*1.25;//docw+fieldViewx*2; 1.1657 + zoomh=diagonalMidy+(diagonalFrame/2)*Math.sin(diagonalAngle);//fieldViewy*1.25;//doch+fieldViewy*2; 1.1658 +} 1.1659 + 1.1660 + 1.1661 +function RichDrawViewer(elem, renderer) 1.1662 +{ 1.1663 + this.container = elem; 1.1664 + this.renderer = renderer; 1.1665 + this.renderer.init(this.container); 1.1666 + this.renderer.editor = this; 1.1667 +} 1.1668 +/* 1.1669 +onResize : function(){ 1.1670 + Ext.TabPanel.superclass.onResize.apply(this, arguments); 1.1671 + this.delegateUpdates(); 1.1672 + }, 1.1673 + */ 1.1674 \ No newline at end of file