diff onlypaths/js/me.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/me.js	Sun Jan 31 12:33:33 2010 -0500
     1.3 @@ -0,0 +1,819 @@
     1.4 +/*
     1.5 + * Ext JS Library 2.1
     1.6 + * Copyright(c) 2006-2008, Ext JS, LLC.
     1.7 + * licensing@extjs.com
     1.8 + * 
     1.9 + * http://extjs.com/license
    1.10 + */ 
    1.11 +Ext.BLANK_IMAGE_URL = 'theme/images/default/s.gif';
    1.12 +var mefillColor = {r:255,g:0,b:0,hex:'#ff0000',visible:'visible',color:'#ff0000',opacity:'1',gradient:'no'};
    1.13 +var mestrokeColor = {r:0,g:0,b:255,hex:'#000000',visible:'visible',color:'#ff0000',width:'1',opacity:'1',gradient:'no'};
    1.14 + 
    1.15 +var fillhex="#ff0000";  
    1.16 +var squarecont=0;
    1.17 +var squarerows=6;
    1.18 +var squarecols=6;  
    1.19 +var squarelist=new Array(squarerows);  
    1.20 +var filldraw=true;
    1.21 +var strokedraw=true;
    1.22 +var mode_render_fill=2;
    1.23 +var mode_render_stroke=2;
    1.24 +
    1.25 +var prevselect_fill='no-fill-gradient';
    1.26 +var prevselect_stroke='no-stroke-gradient'; 
    1.27 +
    1.28 +for (i = 0; i < squarerows; i++)
    1.29 + {
    1.30 +     squarelist[i]=new Array(squarecols);
    1.31 + }
    1.32 +
    1.33 +function rgb2hex(r,g,b){                
    1.34 + var rh= toHex(r);
    1.35 + var gh= toHex(g);
    1.36 + var bh= toHex(b);  
    1.37 + return '#'+rh + '' + gh + '' + bh;
    1.38 +// document.getElementById('inputfillhex').value=fillhex;
    1.39 + //parent.c.editCommand('mefillcolor', color);
    1.40 +}
    1.41 + 
    1.42 +function hex2rgb(hex)
    1.43 +   {
    1.44 +     var regexp = new RegExp('^#?([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$');
    1.45 +     var match = hex.toLowerCase().match(regexp);
    1.46 +  
    1.47 +      if (match)
    1.48 +      {
    1.49 +          var rgb = new Array(parseInt(match[1], 16), parseInt(match[2], 16), parseInt(match[3], 16));
    1.50 +          return(rgb);
    1.51 +      }
    1.52 +      else
    1.53 +      {
    1.54 +          var rgb = new Array(0,0,0);
    1.55 +          return(rgb);
    1.56 +      }
    1.57 +  }
    1.58 +  
    1.59 +function toHex(color){
    1.60 +	color=parseInt(color).toString(16);
    1.61 +	return color.length<2?"0"+color:color;
    1.62 +} 
    1.63 +
    1.64 +function squareDump(r,g,b,container) {  
    1.65 + squareArray(r,g,b);
    1.66 + for (i = 0; i < squarerows; i++)
    1.67 +   {
    1.68 +  for (j = 0; j < squarecols; j++) 
    1.69 +   { 
    1.70 +        document.getElementById(container+i+'_'+j).style.backgroundColor = squarelist[i][j];
    1.71 +   } 
    1.72 +   squarecont++;            
    1.73 + }              
    1.74 + squarecont=0;
    1.75 +} 
    1.76 +
    1.77 +
    1.78 +
    1.79 +function squareArray(r,g,b) {     
    1.80 + 
    1.81 +  var l00_05=ccnp(r,g,b,0,0,0,(squarerows+0));
    1.82 + var color00_05=l00_05.split("_"); 
    1.83 + 
    1.84 + var l05_55=ccnp(255,255,255,255-r,255-g,255-b,(squarerows+0));
    1.85 + var color05_55=l05_55.split("_"); 
    1.86 +
    1.87 + var cols0, cols5, rowy;
    1.88 + var cad='';
    1.89 + for(var i=0;i<squarerows;i++){
    1.90 +        cols0=color00_05[i].split(",");
    1.91 +        cols5=color05_55[i].split(",");
    1.92 +        //for(var j=0;j<squarecols;j++){
    1.93 +        rowy=ccnprmtrc(parseInt(cols0[0]),parseInt(cols0[1]),parseInt(cols0[2]),parseInt(cols5[0]),parseInt(cols5[1]),parseInt(cols5[2]),squarecols+0);
    1.94 +        squarelist[i]=rowy.split("_");
    1.95 +        cad+=squarelist[i].join("  ");
    1.96 +        //}        
    1.97 + }
    1.98 +
    1.99 +//alert(l00_60);  
   1.100 +//document.getElementById('texta').value=cad;
   1.101 +}
   1.102 +function ccnp(a,b,c,d,e,f,nPartes){
   1.103 +	var q=0
   1.104 +	 var crdnds='';
   1.105 +	 var h = 1 / (nPartes);
   1.106 +	 var k = (1 - q)* a +  q * d;
   1.107 +	 var l = (1 - q)* b +  q * e;
   1.108 +	 var m = (1 - q)* c + q * f;
   1.109 +	// crdnds += k +" "+ l +" "+ m +", "+ R;
   1.110 +      for (var i=0; i<=(nPartes) ;i++)
   1.111 +       { 
   1.112 +	 k = (1 - q)* a +  q * d;
   1.113 +	 l = (1 - q)* b +  q * e;
   1.114 +	 m = (1 - q)* c +  q * f;
   1.115 +	q = q + h;
   1.116 +	if(i==(nPartes)){
   1.117 +	   crdnds+=''+ parseInt(Math.round(k)) +","+ parseInt(Math.round(l)) +","+ parseInt(Math.round(m)) +"" ;
   1.118 +	 }else{
   1.119 +  	   crdnds+=''+ parseInt(Math.round(k)) +","+ parseInt(Math.round(l)) +","+ parseInt(Math.round(m)) +"_";
   1.120 +
   1.121 +	 }   
   1.122 +       }  
   1.123 +	return  crdnds;
   1.124 +}
   1.125 +function ccnprmtrc(a,b,c,d,e,f,nPartes){
   1.126 +	var q=0
   1.127 +	 var crdnds='';
   1.128 +	 var h = 1 / (nPartes);
   1.129 +	 var k = (1 - q)* a +  q * d;
   1.130 +	 var l = (1 - q)* b +  q * e;
   1.131 +	 var m = (1 - q)* c + q * f;
   1.132 +	// crdnds += k +" "+ l +" "+ m +", "+ R;
   1.133 +      for (var i=0; i<=(nPartes) ;i++)
   1.134 +       { 
   1.135 +	 k = (1 - q)* a +  q * d;
   1.136 +	 l = (1 - q)* b +  q * e;
   1.137 +	 m = (1 - q)* c +  q * f;
   1.138 +	q = q + h;
   1.139 +	if(i==(nPartes)){
   1.140 +	   crdnds+='rgb('+ parseInt(Math.round(k)) +","+ parseInt(Math.round(l)) +","+ parseInt(Math.round(m)) +")" ;
   1.141 +	 }else{
   1.142 +  	   crdnds+='rgb('+ parseInt(Math.round(k)) +","+ parseInt(Math.round(l)) +","+ parseInt(Math.round(m)) +")_";
   1.143 +
   1.144 +	 }   
   1.145 +       }  
   1.146 +	return  crdnds;
   1.147 +} 
   1.148 +
   1.149 +
   1.150 +/**
   1.151 + * Converts an HSL color value to RGB. Conversion formula adapted from
   1.152 + * http://en.wikipedia.org/wiki/HSL_color_space. Assumes h, s, and l are
   1.153 + * contained in the set [0, 1] and returns r, g, and b in the set [0, 255].
   1.154 + *
   1.155 + * @param   {Number}    h       The hue
   1.156 + * @param   {Number}    s       The saturation
   1.157 + * @param   {Number}    l       The lightness
   1.158 + * @return  {Array}             The RGB representation
   1.159 + */
   1.160 +var hslToRgb = function(h, s, l){
   1.161 +    var r, g, b;
   1.162 +
   1.163 +    if(s == 0){
   1.164 +        r = g = b = l; // achromatic
   1.165 +    }else{
   1.166 +        function hue2rgb(p, q, t){
   1.167 +            if(t < 0) t += 1;
   1.168 +            if(t > 1) t -= 1;
   1.169 +            if(t < 1/6) return p + (q - p) * 6 * t;
   1.170 +            if(t < 1/2) return q;
   1.171 +            if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
   1.172 +            return p;
   1.173 +        };
   1.174 +
   1.175 +        var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
   1.176 +        var p = 2 * l - q;
   1.177 +        r = hue2rgb(p, q, h + 1/3);
   1.178 +        g = hue2rgb(p, q, h);
   1.179 +        b = hue2rgb(p, q, h - 1/3);
   1.180 +    }
   1.181 +
   1.182 +    return [parseInt(r * 255), parseInt(g * 255), parseInt(b * 255)];
   1.183 +};  
   1.184 +/**
   1.185 + * Converts an RGB color value to HSL. Conversion formula adapted from
   1.186 + * http://en.wikipedia.org/wiki/HSL_color_space. Assumes r, g, and b are
   1.187 + * contained in the set [0, 255] and returns h, s, and l in the set [0, 1].
   1.188 + *
   1.189 + * @param   {Number}    r       The red color value
   1.190 + * @param   {Number}    g       The green color value
   1.191 + * @param   {Number}    b       The blue color value
   1.192 + * @return  {Array}             The HSL representation
   1.193 + */
   1.194 +var rgbToHsl = function(r, g, b){
   1.195 +    r /= 255, g /= 255, b /= 255;
   1.196 +    var max = Math.max(r, g, b), min = Math.min(r, g, b);
   1.197 +    var h, s, l = (max + min) / 2;
   1.198 +
   1.199 +    if(max == min){
   1.200 +        h = s = 0; // achromatic
   1.201 +    }else{
   1.202 +        var d = max - min;
   1.203 +        s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
   1.204 +        switch(max){
   1.205 +            case r: h = (g - b) / d + (g < b ? 6 : 0); break;
   1.206 +            case g: h = (b - r) / d + 2; break;
   1.207 +            case b: h = (r - g) / d + 4; break;
   1.208 +        }
   1.209 +        h /= 6;
   1.210 +    }
   1.211 +
   1.212 +    return [h, s, l];
   1.213 +};
   1.214 +function selectSquare(x,y,container){   
   1.215 +   movecolors=0;
   1.216 +  //$("#square"+x+"_"+y).css("border", "1px solid #000");
   1.217 +   //  $("#square"+x+"_"+y).mouseover(function(){
   1.218 +      
   1.219 +   // }).mouseout(function(){
   1.220 +     //  $("#square"+x+"_"+y).css("border", "0px solid #000");
   1.221 +   // });  
   1.222 +   var cadcolor=document.getElementById('square_'+container+(x)+'_'+y).style.backgroundColor
   1.223 +   //document.getElementById('texta').value=cadcolor; 
   1.224 +   var treecolors=GetString(cadcolor, '(', ')');
   1.225 +   
   1.226 +   //OPCTION? 
   1.227 +   var rgb=treecolors.split(', '); 
   1.228 +   //squareDump(rgb[0],rgb[1],rgb[2],'square_'+container);
   1.229 +   if(container=='stroke')
   1.230 +    {
   1.231 +        Ext.get('width-slider-stroke-mask').applyStyles({'background-color':'rgb('+rgb[0]+','+rgb[1]+','+rgb[2]+')'});
   1.232 +        //--document.forms.formstrokedata.mestrokecolor.value=rgb[0]+','+rgb[1]+','+rgb[2];
   1.233 +        mestrokeColor.r=rgb[0]; 
   1.234 +        mestrokeColor.g=rgb[1]; 
   1.235 +        mestrokeColor.b=rgb[2];
   1.236 +        mestrokeColor.hex=rgb2hex(rgb[0],rgb[1],rgb[2]);
   1.237 +        c.editCommand('linecolor',mestrokeColor.hex);
   1.238 +    }
   1.239 +     else
   1.240 +    {
   1.241 +         //--document.forms.formfilldata.mefillcolor.value=rgb[0]+','+rgb[1]+','+rgb[2];
   1.242 +         mefillColor.r=rgb[0]; mefillColor.g=rgb[1];mefillColor.b=rgb[2];
   1.243 +         mefillColor.hex=rgb2hex(rgb[0],rgb[1],rgb[2]);
   1.244 +         c.editCommand('fillcolor',mefillColor.hex);
   1.245 +
   1.246 +    }
   1.247 +   Ext.get('opacity-slider-'+container).applyStyles({'background-color':'rgb('+rgb[0]+','+rgb[1]+','+rgb[2]+')'});
   1.248 +   Ext.get(container+'-square').applyStyles({'background-color':'rgb('+rgb[0]+','+rgb[1]+','+rgb[2]+')'});
   1.249 +   
   1.250 +    //document.getElementById('texta').value=rgb[0]+' '+rgb[1]+' '+rgb[2]; 
   1.251 + /*   if(actualEdit ==1){
   1.252 +      fillMemory();    
   1.253 +    }else{
   1.254 +     strokeMemory();   
   1.255 +    }
   1.256 +        $('.slider1').SliderSetValues([[Math.round(rgb[0]*45/255),0]]);  
   1.257 +        $('.slider2').SliderSetValues([[Math.round(rgb[1]*45/255),0]]);
   1.258 +        $('.slider3').SliderSetValues([[Math.round(rgb[2]*45/255),0]]);  //-(mefillColor.b*45/255)
   1.259 + */
   1.260 +     
   1.261 +
   1.262 +} 
   1.263 +function setbe(num,id)
   1.264 + { 
   1.265 +  if(num == 1)
   1.266 +   { 
   1.267 +     if(filldraw==true)
   1.268 +      {
   1.269 +       
   1.270 +        Ext.get(id).dom.src ='img/theme/images/no.gif';  
   1.271 +        filldraw=false;  
   1.272 +        //--document.forms.formfilldata.fillvisible.value='hidden';
   1.273 +         mefillColor.visible='hidden';
   1.274 +         c.editCommand('fillcolor','none');
   1.275 +       // $('#tape').show("slow"); 
   1.276 +        
   1.277 +      }
   1.278 +       else 
   1.279 +      {
   1.280 +        Ext.get(id).dom.src ='img/theme/images/ok.gif';   
   1.281 +        filldraw=true; 
   1.282 +        //--document.forms.formfilldata.fillvisible.value='visible';
   1.283 +        mefillColor.visible='visible';
   1.284 +         c.editCommand('fillcolor',mefillColor.hex);
   1.285 +       // $('#tape').hide("slow"); 
   1.286 +      }
   1.287 +   }
   1.288 +
   1.289 +  if( num== 2)  // stroke
   1.290 +   {
   1.291 +     if(strokedraw==true)
   1.292 +      {
   1.293 +        Ext.get(id).dom.src ='img/theme/images/no.gif';     
   1.294 +        strokedraw=false; 
   1.295 +        //--document.forms.formstrokedata.strokevisible.value='hidden';
   1.296 +        mestrokeColor.visible='hidden'; 
   1.297 +        c.editCommand('linecolor','none');
   1.298 +        //$('#tape').show("slow"); 
   1.299 +      }
   1.300 +       else 
   1.301 +      {
   1.302 +        Ext.get(id).dom.src ='img/theme/images/ok.gif';   
   1.303 +        strokedraw=true; 
   1.304 +        //--document.forms.formstrokedata.strokevisible.value='visible'; 
   1.305 +        mestrokeColor.visible='visible';          
   1.306 +        c.editCommand('linecolor',mestrokeColor.hex);
   1.307 +        //$('#tape').hide("slow"); 
   1.308 +      }
   1.309 +   }
   1.310 + }                
   1.311 + 
   1.312 +///////////
   1.313 +
   1.314 +function onColorChange(){
   1.315 +c.lineColor =mestrokeColor.hex;
   1.316 +c.fillColor = mefillColor.hex;
   1.317 +c.lineWidth =mestrokeColor.width;
   1.318 +c.lineOpac = mestrokeColor.opacity;
   1.319 +c.fillOpac = mefillColor.opacity;
   1.320 +if(mefillColor.visible=='hidden')
   1.321 +{
   1.322 +c.fillColor = 'none';
   1.323 +}
   1.324 +if(mestrokeColor.visible=='hidden')
   1.325 +{
   1.326 +c.lineColor = 'none';
   1.327 +}
   1.328 +return;
   1.329 +}
   1.330 + 
   1.331 +///////////
   1.332 +
   1.333 +function setProperties(){   
   1.334 +   
   1.335 +   Ext.get('opacity-slider-fill').applyStyles({'background-color':'rgb('+mefillColor.r+','+mefillColor.g+','+mefillColor.b+')'});
   1.336 +   Ext.get('fill-square').applyStyles({'background-color':'rgb('+mefillColor.r+','+mefillColor.g+','+mefillColor.b+')'});
   1.337 +   squareDump(mefillColor.r,mefillColor.g,mefillColor.b,'square_fill'); 
   1.338 +   
   1.339 +   Ext.get('opacity-slider-stroke').applyStyles({'background-color':'rgb('+mestrokeColor.r+','+mestrokeColor.g+','+mestrokeColor.b+')'});
   1.340 +   Ext.get('width-slider-stroke-mask').applyStyles({'background-color':'rgb('+mestrokeColor.r+','+mestrokeColor.g+','+mestrokeColor.b+')'});
   1.341 +   Ext.get('stroke-square').applyStyles({'background-color':'rgb('+mestrokeColor.r+','+mestrokeColor.g+','+mestrokeColor.b+')'});
   1.342 +   squareDump(mestrokeColor.r,mestrokeColor.g,mestrokeColor.b,'square_stroke');  
   1.343 +
   1.344 +}                      
   1.345 +//////////
   1.346 +
   1.347 +
   1.348 +function GetString(source, start, end){
   1.349 +var st = source.indexOf(start) + start.length;
   1.350 +var en = source.indexOf(end, start);
   1.351 + return source.substring(st, en);//trimAll(source.substring(st, en));
   1.352 +}
   1.353 +
   1.354 +
   1.355 +
   1.356 +
   1.357 +var basicColors=new Array(" ",
   1.358 +"ff0000","ff8800","ffcc00",
   1.359 +"ffff00","ccff00","88ff00","00ff00","00ff88","00ffcc","00ffff",
   1.360 + "00ccff","0088ff","0000ff","8800ff","cc00ff","ff00ff","ff00cc","ff0088"
   1.361 +); 
   1.362 +
   1.363 +var str=''
   1.364 +for(var a=1;a<basicColors.length;a++){
   1.365 + str+='<span id="s'+a+'" style="background-color:'+basicColors[a]+'; width:2px;font-size:0.95em">.</span>';
   1.366 +} 
   1.367 +var str1=''
   1.368 +for(var a=basicColors.length;a>0;a--){
   1.369 + str1+='<span id="s'+a+'" style="background-color:'+basicColors[a]+'; width:2px;font-size:8px">&nbsp;</span>';
   1.370 +} 
   1.371 +
   1.372 +
   1.373 +  var str2='';
   1.374 +  var contx=0;
   1.375 +  var conty=0;
   1.376 +  var unitx=8;  
   1.377 +  var unity=8;
   1.378 +  var widthsq='width: '+unitx+'px;';
   1.379 +  for (i = 0; i < squarerows; i++) 
   1.380 +   { 
   1.381 +    contx=0;
   1.382 +    for (j = 0; j < squarecols; j++) 
   1.383 +     { 
   1.384 +        str2+='<div class="colorFillSquare" id="square_fill'+i+'_'+j+'" style="'+widthsq+' left:'+contx+'px; top:'+conty+'px;" onmouseover="this.style.borderWidth=\'1px\'; this.style.zIndex=100" onmouseout="this.style.borderWidth=\'0px\';this.style.zIndex=0" onclick="selectSquare('+i+','+j+',\'fill\')"></div>';
   1.385 +        contx+=unitx;
   1.386 +     } 
   1.387 +     conty+=unity;
   1.388 +   } 
   1.389 +
   1.390 + 
   1.391 +  var str3='';
   1.392 +  var contx=0;
   1.393 +  var conty=0;
   1.394 +  var unitx=8;  
   1.395 +  var unity=8;
   1.396 +  var widthsq='width: '+unitx+'px;';
   1.397 +  for (i = 0; i < squarerows; i++) 
   1.398 +   { 
   1.399 +    contx=0;
   1.400 +    for (j = 0; j < squarecols; j++) 
   1.401 +     { 
   1.402 +        str3+='<div class="colorStrokeSquare" id="square_stroke'+i+'_'+j+'" style="'+widthsq+' left:'+contx+'px; top:'+conty+'px;" onmouseover="this.style.borderWidth=\'1px\'; this.style.zIndex=100" onmouseout="this.style.borderWidth=\'0px\';this.style.zIndex=0" onclick="selectSquare('+i+','+j+',\'stroke\')"></div>';
   1.403 +        contx+=unitx;
   1.404 +     } 
   1.405 +     conty+=unity;
   1.406 +   } 
   1.407 +
   1.408 +///////////////////// 
   1.409 +
   1.410 +   var str4='';
   1.411 +       str4+='<span id="linear-fill-gradient" class="toolboxItem" title="Linear gradient" onmouseout="select(this,0,0)" onmouseover="select(this,1,0)" onclick="select(this,2,0)"><img  src="theme/images/gradient_linear.gif"></span>&nbsp;&nbsp;';
   1.412 +       str4+='<span id="radial-fill-gradient" class="toolboxItem" title="Radial gradient" onmouseout="select(this,0,1)" onmouseover="select(this,1,1)" onclick="select(this,2,1)"><img src="theme/images/gradient_radial.gif"></span>&nbsp;&nbsp;';
   1.413 +       str4+='<span id="no-fill-gradient" class="toolboxItem" title="No gradient" onmouseout="select(this,0,2)" onmouseover="select(this,1,2)" onclick="select(this,2,2)"><img src="theme/images/gradient_no.gif"></span>';
   1.414 +
   1.415 +/////////////////////
   1.416 +
   1.417 +   var str5='';
   1.418 +       str5+='<span id="linear-stroke-gradient" class="toolboxItem" title="Linear gradient" onmouseout="select(this,0,0)" onmouseover="select(this,1,0)" onclick="select(this,2,0)"><img  src="theme/images/gradient_linear.gif"></span>&nbsp;&nbsp;';
   1.419 +       str5+='<span id="radial-stroke-gradient" class="toolboxItem" title="Radial gradient" onmouseout="select(this,0,1)" onmouseover="select(this,1,1)" onclick="select(this,2,1)"><img src="theme/images/gradient_radial.gif"></span>&nbsp;&nbsp;';
   1.420 +       str5+='<span id="no-stroke-gradient" class="toolboxItem" title="No gradient" onmouseout="select(this,0,2)" onmouseover="select(this,1,2)" onclick="select(this,2,2)"><img src="theme/images/gradient_no.gif"></span>';
   1.421 +
   1.422 +/////////////////////
   1.423 +
   1.424 + var str6='';   //<form name="formfilldata">
   1.425 + str6+='<input type="text" class="field" name="fillvisible" title="Fill visible" value="visible"  size="2">';
   1.426 + str6+='<input type="text" class="field" name="fillcolor" title="Fill color"value="255,0,0" size="2">';  
   1.427 + str6+='<input type="text" class="field" name="fillopacity" title="Fill opacity" value="100" size="2">';
   1.428 + str6+='<input type="text" class="field" name="fillgradient" title="Fill gradient" value="no" size="2">';
   1.429 +  str6+='';
   1.430 +
   1.431 + var str7=''; // <form name="formstrokedata">
   1.432 + str7+='<input type="text" class="field" title="Stroke visible" name="strokevisible" value="visible"  size="2">';
   1.433 + str7+='<input type="text" class="field" title="Stroke color" name="strokecolor" value="0,0,0" size="2">';  
   1.434 +  str7+='<input type="text" class="field" title="Stroke width" name="strokewidth" value="1" size="2">';
   1.435 + str7+='<input type="text" class="field" title="Stroke opacity" name="strokeopacity" value="100" size="2">';
   1.436 +   str7+='<input type="text" class="field" title="Stroke gradienr" name="strokegradient" value="no" size="2">';
   1.437 +
   1.438 +  str7+='';
   1.439 +
   1.440 +
   1.441 +//ONREADY
   1.442 +
   1.443 +Ext.onReady(function() {
   1.444 +
   1.445 +      
   1.446 +   //  Ext.get("mefillColor").dom.innerHTML=(str);
   1.447 +   //   Ext.get("mestrokeColor").dom.innerHTML=(str1); 
   1.448 +  
   1.449 +
   1.450 +
   1.451 +    
   1.452 +   Ext.get("fillContainer").dom.innerHTML=(str2);      
   1.453 +   Ext.get("strokeContainer").dom.innerHTML=(str3); 
   1.454 +   //Ext.get("toolbox_fill").dom.innerHTML=(str4);
   1.455 +   //Ext.get("toolbox_stroke").dom.innerHTML=(str5); 
   1.456 +  // Ext.get("divformfill").dom.innerHTML=(str6); 
   1.457 +   //Ext.get("divformstroke").dom.innerHTML=(str7); 
   1.458 +
   1.459 +   
   1.460 +   Ext.get('fill-square').applyStyles({'background-color':'rgb(255,0,0)'});
   1.461 +   Ext.get('stroke-square').applyStyles({'background-color':'rgb(0,0,0)'});
   1.462 +  //Ext.get('no-stroke-gradient').applyStyles({'background-position':'0 0'});  
   1.463 +  //Ext.get('no-fill-gradient').applyStyles({'background-position':'0 0'});
   1.464 +  
   1.465 +         var color=hslToRgb(0, 1, 0.5); 
   1.466 +         squareDump(color[0],color[1],color[2],'square_fill');  
   1.467 + 
   1.468 +        var color=hslToRgb(0, 0, 0); 
   1.469 +        squareDump(color[0],color[1],color[2],'square_stroke');  
   1.470 +         
   1.471 +     //console.log('The windows has been loaded','fill-square' );      
   1.472 +     new Ext.Slider({
   1.473 +        renderTo: 'slider-fill',
   1.474 +        width: 62, 
   1.475 +        height: 5,
   1.476 +        minValue: -1,
   1.477 +        maxValue: 360, 
   1.478 +        value: 10,
   1.479 +        plugins: new Ext.ux.SliderFillColor()
   1.480 +    });
   1.481 +       new Ext.Slider({
   1.482 +        renderTo: 'opacity-slider-fill',
   1.483 +        width: 55,
   1.484 +        minValue: 0,
   1.485 +        maxValue: 100,
   1.486 +        value: 100,
   1.487 +        plugins: new Ext.ux.SliderOpacityFill()
   1.488 +    });     
   1.489 +        
   1.490 +        new Ext.Slider({
   1.491 +        renderTo: 'slider-stroke',
   1.492 +        width: 62,
   1.493 +        minValue: -1,
   1.494 +        maxValue: 360,
   1.495 +        value: -1,
   1.496 +        plugins: new Ext.ux.SliderStrokeColor()
   1.497 +    });   
   1.498 +   
   1.499 +      new Ext.Slider({
   1.500 +        renderTo: 'opacity-slider-stroke',
   1.501 +        width: 57,
   1.502 +        minValue: 0,
   1.503 +        maxValue: 100,
   1.504 +        value: 100, 
   1.505 +        plugins: new Ext.ux.SliderOpacityStroke()
   1.506 +    });  
   1.507 +      new Ext.Slider({
   1.508 +        renderTo: 'width-slider-stroke',
   1.509 +        width: 57,
   1.510 +        minValue: 0,
   1.511 +        maxValue: 50, 
   1.512 +        value: 1,
   1.513 +        plugins: new Ext.ux.SliderWidth()
   1.514 +    }); 
   1.515 +
   1.516 +   
   1.517 +}); 
   1.518 +
   1.519 +//  end ONREADY
   1.520 +
   1.521 +
   1.522 +
   1.523 +
   1.524 +
   1.525 +Ext.ux.SliderFillColor = Ext.extend(Ext.Tip, {
   1.526 +    minWidth: 10,
   1.527 +    offsets : [0, -10],
   1.528 +    init : function(slider){
   1.529 +        slider.on('dragstart', this.onSlide, this);
   1.530 +        slider.on('drag', this.onSlide, this);
   1.531 +        slider.on('dragend', this.hide, this);
   1.532 +        slider.on('destroy', this.destroy, this);
   1.533 +    },
   1.534 +
   1.535 +    onSlide : function(slider){
   1.536 +        //this.show();
   1.537 +        //this.doAutoWidth();
   1.538 +        //this.el.alignTo(slider.thumb, 'b-t?', this.offsets); 
   1.539 +         if(this.getText(slider)<0 || this.getText(slider)>359)
   1.540 +          {  
   1.541 +            var color=new Array();  
   1.542 +            color[0]='0';
   1.543 +            color[1]='0';
   1.544 +            color[2]='0'; 
   1.545 +
   1.546 +            if(this.getText(slider)>359)
   1.547 +             { 
   1.548 + 
   1.549 +              color[0]='245';
   1.550 +              color[1]='245';
   1.551 +              color[2]='245'; 
   1.552 +             }  
   1.553 +            Ext.get('fill-square').applyStyles({'background-color':'rgb('+color[0]+','+color[1]+','+color[2]+')'});
   1.554 +            Ext.get('opacity-slider-fill').applyStyles({'background-color':'rgb('+color[0]+','+color[1]+','+color[2]+')'});
   1.555 +      
   1.556 +          }
   1.557 +           else
   1.558 +          {  
   1.559 +              var color=hslToRgb((this.getText(slider)/359), 1, 0.5); 
   1.560 +             Ext.get('fill-square').applyStyles({'background-color':'rgb('+color[0]+','+color[1]+','+color[2]+')'});
   1.561 +             Ext.get('opacity-slider-fill').applyStyles({'background-color':'rgb('+color[0]+','+color[1]+','+color[2]+')'});
   1.562 +             //var color=hslToRgb((this.getText(slider)/359), 1, 0.5);       
   1.563 +          }
   1.564 +       
   1.565 +         squareDump(color[0],color[1],color[2],'square_fill'); 
   1.566 +         //Ext.get("fillcolor").dom.innerHTML=(color[0]+','+color[1]+','+color[2]);
   1.567 +         //--document.forms.formfilldata.fillcolor.value=color[0]+','+color[1]+','+color[2];
   1.568 +         mefillColor.r=color[0]; mefillColor.g=color[1]; mefillColor.b=color[2];
   1.569 +         mefillColor.hex=rgb2hex(color[0],color[1],color[2]);
   1.570 +         c.editCommand('fillcolor',mefillColor.hex);
   1.571 +
   1.572 +         //Ext.get("squareFill0_0").applyStyles({'background-color':'rgb('+color[0]+','+color[1]+','+color[2]+')'}); 
   1.573 +       // Ext.get("squareFill0_5").applyStyles({'background-color':'rgb(255,255,255)'});
   1.574 +        //Ext.get("squareFill5_5").applyStyles({'background-color':'rgb('+Math.abs(color[0]-255)+','+Math.abs(color[1]-255)+','+Math.abs(color[2]-255)+')'});
   1.575 +          //      Ext.get("squareFill5_0").applyStyles({'background-color':'rgb(0,0,0)'});
   1.576 +        //Ext.get("text").dom.innerHTML=color[0];
   1.577 +        
   1.578 +    },
   1.579 +
   1.580 +    getText : function(slider){ 
   1.581 +       return slider.getValue();
   1.582 +    }
   1.583 +});
   1.584 +
   1.585 +
   1.586 +
   1.587 + 
   1.588 +Ext.ux.SliderStrokeColor = Ext.extend(Ext.Tip, {
   1.589 +    minWidth: 10,
   1.590 +    offsets : [0, -10],
   1.591 +    init : function(slider){
   1.592 +        slider.on('dragstart', this.onSlide, this);
   1.593 +        slider.on('drag', this.onSlide, this);
   1.594 +        slider.on('dragend', this.hide, this);
   1.595 +        slider.on('destroy', this.destroy, this);
   1.596 +    },
   1.597 +
   1.598 +    onSlide : function(slider){
   1.599 +        //this.show();
   1.600 +        //this.doAutoWidth();
   1.601 +        //this.el.alignTo(slider.thumb, 'b-t?', this.offsets);
   1.602 +        if(this.getText(slider)<0 || this.getText(slider)>359)
   1.603 +          {  
   1.604 +            var color=new Array();  
   1.605 +            color[0]='0';
   1.606 +            color[1]='0';
   1.607 +            color[2]='0'; 
   1.608 +
   1.609 +            if(this.getText(slider)>359)
   1.610 +             { 
   1.611 + 
   1.612 +              color[0]='245';
   1.613 +              color[1]='245';
   1.614 +              color[2]='245'; 
   1.615 +             }  
   1.616 +            Ext.get('stroke-square').applyStyles({'background-color':'rgb('+color[0]+','+color[1]+','+color[2]+')'});
   1.617 +            Ext.get('opacity-slider-stroke').applyStyles({'background-color':'rgb('+color[0]+','+color[1]+','+color[2]+')'});
   1.618 +             Ext.get('width-slider-stroke-mask').applyStyles({'background-color':'rgb('+color[0]+','+color[1]+','+color[2]+')'});
   1.619 +
   1.620 +          }
   1.621 +           else
   1.622 +          { 
   1.623 +              var color=hslToRgb((this.getText(slider)/359), 1, 0.5); 
   1.624 +             Ext.get('stroke-square').applyStyles({'background-color':'rgb('+color[0]+','+color[1]+','+color[2]+')'});
   1.625 +             Ext.get('opacity-slider-stroke').applyStyles({'background-color':'rgb('+color[0]+','+color[1]+','+color[2]+')'});
   1.626 +             Ext.get('width-slider-stroke-mask').applyStyles({'background-color':'rgb('+color[0]+','+color[1]+','+color[2]+')'});
   1.627 +
   1.628 +             /*Ext.get('stroke-square').applyStyles({'background-color':'hsl('+this.getText(slider)+',100%,50%)'});
   1.629 +             Ext.get('opacity-slider-stroke').applyStyles({'background-color':'hsl('+this.getText(slider)+',100%,50%)'});
   1.630 +             var color=hslToRgb((this.getText(slider)/359), 1, 0.5);
   1.631 +             Ext.get('width-slider-stroke-mask').applyStyles({'background-color':'hsl('+this.getText(slider)+',100%,50%)'});
   1.632 +            */
   1.633 +          }
   1.634 +   
   1.635 +        
   1.636 +         
   1.637 +        //Ext.get('stroke-square').applyStyles({'background-color':'hsl('+this.getText(slider)+',100%,50%)'});
   1.638 +        //Ext.get('opacity-slider-stroke').applyStyles({'background-color':'hsl('+this.getText(slider)+',100%,50%)'});
   1.639 +
   1.640 +        //var color=hslToRgb((this.getText(slider)/359), 1, 0.5); 
   1.641 +        squareDump(color[0],color[1],color[2],'square_stroke'); 
   1.642 +        //--document.forms.formstrokedata.strokecolor.value=color[0]+','+color[1]+','+color[2];
   1.643 +        mestrokeColor.r=color[0]; mestrokeColor.g=color[1]; mestrokeColor.b=color[2];
   1.644 +        mestrokeColor.hex=rgb2hex(color[0],color[1],color[2]);
   1.645 +        c.editCommand('linecolor',mestrokeColor.hex);
   1.646 +        // this.body.update(''+this.getText(slider));
   1.647 +
   1.648 +    },
   1.649 +
   1.650 +    getText : function(slider){ 
   1.651 +       return slider.getValue();
   1.652 +    }
   1.653 +  }); 
   1.654 +
   1.655 +
   1.656 +
   1.657 +  Ext.ux.SliderOpacityFill = Ext.extend(Ext.Tip, {
   1.658 +    minWidth: 10,
   1.659 +    offsets : [0, -10],
   1.660 +    init : function(slider){
   1.661 +        slider.on('dragstart', this.onSlide, this);
   1.662 +        slider.on('drag', this.onSlide, this);
   1.663 +        slider.on('dragend', this.hide, this);
   1.664 +        slider.on('destroy', this.destroy, this);
   1.665 +    },
   1.666 +
   1.667 +    onSlide : function(slider){
   1.668 +        this.show();
   1.669 +        this.body.update(''+this.getText(slider)+'%');
   1.670 +        this.doAutoWidth();
   1.671 +        this.el.alignTo(slider.thumb, 'b-t?', this.offsets); 
   1.672 +        changeOpacity(this.getText(slider)/100, 'opacity-slider-fill');
   1.673 +        //--document.forms.formfilldata.fillopacity.value=this.getText(slider);
   1.674 +        mefillColor.opacity=this.getText(slider)/100;
   1.675 +        c.editCommand('fillopacity',mefillColor.opacity);
   1.676 +    },
   1.677 +
   1.678 +    getText : function(slider){
   1.679 +        return slider.getValue();
   1.680 +    }
   1.681 +  });                                      
   1.682 +  Ext.ux.SliderOpacityStroke = Ext.extend(Ext.Tip, {
   1.683 +    minWidth: 10,
   1.684 +    offsets : [0, -10],
   1.685 +    init : function(slider){
   1.686 +        slider.on('dragstart', this.onSlide, this);
   1.687 +        slider.on('drag', this.onSlide, this);
   1.688 +        slider.on('dragend', this.hide, this);
   1.689 +        slider.on('destroy', this.destroy, this);
   1.690 +    },
   1.691 +
   1.692 +    onSlide : function(slider){
   1.693 +        this.show();
   1.694 +        this.body.update(''+this.getText(slider)+'%');
   1.695 +        this.doAutoWidth();
   1.696 +        this.el.alignTo(slider.thumb, 'b-t?', this.offsets); 
   1.697 +        changeOpacity(this.getText(slider)/100, 'opacity-slider-stroke');
   1.698 +        //--document.forms.formstrokedata.strokeopacity.value=this.getText(slider);
   1.699 +        mestrokeColor.opacity=this.getText(slider)/100; 
   1.700 +        c.editCommand('lineopacity',mestrokeColor.opacity);
   1.701 +    },
   1.702 +
   1.703 +    getText : function(slider){
   1.704 +        return slider.getValue();
   1.705 +    }
   1.706 +  }); 
   1.707 +
   1.708 +  Ext.ux.SliderWidth = Ext.extend(Ext.Tip, {
   1.709 +    minWidth: 10,
   1.710 +    offsets : [0, -10],
   1.711 +    init : function(slider){
   1.712 +        slider.on('dragstart', this.onSlide, this);
   1.713 +        slider.on('drag', this.onSlide, this);
   1.714 +        slider.on('dragend', this.hide, this);
   1.715 +        slider.on('destroy', this.destroy, this);
   1.716 +    },
   1.717 +
   1.718 +    onSlide : function(slider){
   1.719 +        this.show();
   1.720 +        this.body.update(''+this.getText(slider)+'px');
   1.721 +        this.doAutoWidth();
   1.722 +        this.el.alignTo(slider.thumb, 'b-t?', this.offsets); 
   1.723 +        Ext.get('width-slider-stroke-mask').applyStyles({'width':this.getText(slider)+'px'});
   1.724 +        //--document.forms.formstrokedata.strokewidth.value=this.getText(slider);
   1.725 +        mestrokeColor.width=this.getText(slider);  
   1.726 +        c.editCommand('linewidth',mestrokeColor.width);
   1.727 +    },
   1.728 +
   1.729 +    getText : function(slider){
   1.730 +        return slider.getValue();
   1.731 +    }
   1.732 +  }); 
   1.733 +
   1.734 +
   1.735 +
   1.736 +
   1.737 +                                     
   1.738 +//===================================
   1.739 +//===================================
   1.740 +
   1.741 +function select(select,action,type){  
   1.742 + var id=select.id;
   1.743 + if(type==0){var text='lineal';}   
   1.744 + if(type==1){var text='radial';}  
   1.745 + if(type==2){var text='no';}  
   1.746 + // && mode_render_fill!=type
   1.747 + if(action==0 && mode_render_fill!=type)
   1.748 +  {
   1.749 +   Ext.get(id).applyStyles({'background-position':'0 12px'});  
   1.750 +    
   1.751 +
   1.752 +  }
   1.753 + if(action==1 && mode_render_fill!=type)
   1.754 +  {
   1.755 +   Ext.get(id).applyStyles({'background-position':'0 0'}); 
   1.756 +   
   1.757 +  } 
   1.758 + if(action==2)
   1.759 +  { 
   1.760 +   mode_render_fill=type; 
   1.761 +   if(id.indexOf('fill')!=-1)
   1.762 +    {
   1.763 +      Ext.get(prevselect_fill).applyStyles({'background-position':'0 12px'});
   1.764 +      prevselect_fill=id; 
   1.765 +      //--document.forms.formfilldata.fillgradient.value=text;
   1.766 +    }else{ 
   1.767 +    
   1.768 +      Ext.get(prevselect_stroke).applyStyles({'background-position':'0 12px'}); 
   1.769 +      prevselect_stroke=id;
   1.770 +      //--document.forms.formstrokedata.strokegradient.value=text;
   1.771 +    }  
   1.772 +   Ext.get(id).applyStyles({'background-position':'0 0'});
   1.773 +   
   1.774 + 
   1.775 +  }  
   1.776 +} 
   1.777 +
   1.778 +function changeOpacity(opacity, id)
   1.779 + {  
   1.780 +       var object = document.getElementById(id).style;  
   1.781 +       object.opacity = (opacity );
   1.782 +       object.MozOpacity = (opacity);  
   1.783 +       object.KhtmlOpacity = (opacity);  
   1.784 +       object.filter = "alpha(opacity=" + parseFloat(opacity*100) + ")";  
   1.785 + } 
   1.786 +
   1.787 + //print() function will just create a window similar to the default alert function within the page.
   1.788 +//Arguments
   1.789 +// txt  - The message that appears in the box.
   1.790 +// title - The title of the box(OPTIONAL) 
   1.791 +
   1.792 +/*
   1.793 +if(typeof console != 'object') {
   1.794 +console = {};
   1.795 +console.log = function(){return false;};
   1.796 +}                
   1.797 +
   1.798 +
   1.799 +/////////////////
   1.800 +var Docs = function(){
   1.801 +return {
   1.802 +init : function(){
   1.803 +var loading = Ext.get('loading');
   1.804 +var mask = Ext.get('loading-mask');
   1.805 +mask.setOpacity(.1);
   1.806 +mask.shift({
   1.807 +xy:loading.getXY(),
   1.808 +width:loading.getWidth(),
   1.809 +height:loading.getHeight(),
   1.810 +remove:true,
   1.811 +duration:1,
   1.812 +opacity:.8,
   1.813 +easing:'bounceOut',
   1.814 +callback : function(){
   1.815 +loading.fadeOut({duration:.1,remove:true});
   1.816 +}
   1.817 +});
   1.818 +}
   1.819 +};
   1.820 +}();
   1.821 +Ext.onReady(Docs.init, Docs, true);
   1.822 + */  
   1.823 \ No newline at end of file