diff onlypaths/js/format.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/format.js	Sun Jan 31 12:33:33 2010 -0500
     1.3 @@ -0,0 +1,135 @@
     1.4 +/*
     1.5 +JSON Richdraw Abstraction Layer
     1.6 +
     1.7 +---------------------
     1.8 +Also,
     1.9 +
    1.10 +JSON Rich Draw Format
    1.11 +
    1.12 +---------------------
    1.13 +
    1.14 +*/
    1.15 +
    1.16 +
    1.17 +
    1.18 +function canvas(richdraw,format){ 
    1.19 +  
    1.20 +  var rawshapes = richdraw.getshapes()
    1.21 +  var newshapes = [];  
    1.22 +    //var view=Ext.util.JSON.encode(myOPF[0])
    1.23 +    //newshapes.push(Ext.util.JSON.decode(view));
    1.24 +    newshapes.push(myOPF[0]);
    1.25 +  for(var i = 0; i < rawshapes.length; i++){
    1.26 +    newshapes.push(richdraw.renderer.info(rawshapes[i]));
    1.27 +  }
    1.28 +    return newshapes;
    1.29 +}
    1.30 +
    1.31 +
    1.32 +var fullscreen=false;
    1.33 +function load(code,draw)
    1.34 +{
    1.35 +
    1.36 + var noattachlistener=false;
    1.37 + var renderdoc=false;  
    1.38 + var renderinfo=false
    1.39 + for(var i = 0; i < code.length; i++)
    1.40 +  {
    1.41 +   var rendering=true;  
    1.42 +
    1.43 +   if(code[i].type == "info")
    1.44 +    {
    1.45 +     rendering=false; 
    1.46 +     renderinfo=true;
    1.47 +     if(code[i].loop!=null)
    1.48 +      {
    1.49 +       timerNext=code[i].loop;
    1.50 +      }else{
    1.51 +       timerNext=0;
    1.52 +      }            
    1.53 +    } 
    1.54 +    
    1.55 +   if(code[i].type == "doc")
    1.56 +    { 
    1.57 +     rendering=false; 
    1.58 +     renderdoc=true;
    1.59 +     if(fullscreen==false)
    1.60 +      {
    1.61 +       draw.renderer.view(
    1.62 +       code[i].left,
    1.63 +       code[i].top,
    1.64 +       code[i].width,
    1.65 +       code[i].height,
    1.66 +       code[i].viewBox,
    1.67 +       (code[i].bgcolor!=null)?code[i].bgcolor:"" 
    1.68 +       ); 
    1.69 +      }
    1.70 +       else
    1.71 +      {
    1.72 +       draw.renderer.view(
    1.73 +        0,
    1.74 +        0,
    1.75 +        screenW,
    1.76 +        screenH,
    1.77 +        code[i].viewBox,
    1.78 +        ''
    1.79 +        ); 
    1.80 +      }  
    1.81 +    }
    1.82 +   
    1.83 +   if( rendering==true)
    1.84 +    {
    1.85 +     var co  = draw.renderer.create(code[i].type, 
    1.86 +     (code[i].fillColor!=null)?code[i].fillColor:"", 
    1.87 +     (code[i].lineColor)?code[i].lineColor:"", 
    1.88 +     (code[i].fillOpac)?code[i].fillOpac:"", 
    1.89 +     (code[i].lineOpac)?code[i].lineOpac:"", 
    1.90 +     (code[i].lineWidth)?code[i].lineWidth:"", 
    1.91 +     (code[i].left)?code[i].left:"", 
    1.92 +     (code[i].top)?code[i].top:"", 
    1.93 +     (code[i].width)?code[i].width:"", 
    1.94 +     (code[i].height)?code[i].height:"",  
    1.95 +     (code[i].text)?code[i].text:'', 
    1.96 +     (code[i].textSize)?code[i].textSize:"",    
    1.97 +     (code[i].textFamily)?code[i].textFamily:'Arial', 
    1.98 +     (code[i].href)?code[i].href:'', 
    1.99 +     (code[i].points)?code[i].points:'', 
   1.100 +     (code[i].transform)?code[i].transform:'',
   1.101 +     (code[i].parent)?code[i].parent:''); 
   1.102 +    
   1.103 +     co.id = ""+code[i].id;  
   1.104 +     if (!noattachlistener) 
   1.105 +      {  
   1.106 +        Ext.get(co).on("mousedown", draw.onHit, draw);
   1.107 +
   1.108 +        /*
   1.109 +        co.addEventListener("click", function(event) { myfunction(this.id,draw,event); }, false);
   1.110 +        co.addEventListener("mouseover", function(event) {myOverFunction(this.id,draw,event); }, false);
   1.111 +        co.addEventListener("mouseout", function(event) {myOutFunction(this.id,draw,event); }, false);
   1.112 +        co.addEventListener("mouseup", function(event) {myUpFunction(this.id,draw,event); }, false);
   1.113 +        co.addEventListener("mousedown", function(event) {myDownFunction(this.id,draw,event); }, false);
   1.114 +        co.addEventListener("mousemove", function(event) {myMoveFunction(this.id,draw,event); }, false);
   1.115 +        co.addEventListener("dblclick", function(event) {myDblclickFunction(this.id,draw,event); }, false);
   1.116 +        */
   1.117 +      }
   1.118 +    }
   1.119 +  }
   1.120 + if(renderdoc == false)
   1.121 +  { 
   1.122 +   if(fullscreen==false)
   1.123 +    {
   1.124 +     draw.renderer.view(0,0,canvasWidth,canvasHeight,'0 0 700 400','');   
   1.125 +    }
   1.126 +     else
   1.127 +    {
   1.128 +     draw.renderer.view(0,0,screenW,screenH,'0 0 700 400','');
   1.129 +    }
   1.130 +  }  
   1.131 + if(renderinfo == false)
   1.132 +  { 
   1.133 +  }  
   1.134 +}
   1.135 +
   1.136 +
   1.137 +
   1.138 +