Changeset 46

Show
Ignore:
Timestamp:
06/11/08 12:01:26 (6 months ago)
Author:
bi..@lilyapp.org
Message:

fix tickets #18 and #26

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lily/lily/chrome/content/externals/processing.js

    r44 r46  
    8484        this.inlet1["run"]=function() { 
    8585                var obj = LilyUtils.readFileFromPath(currScriptPath); 
    86                 proc = Processing(thisPtr.displayElement,obj.data);    
     86                proc = Processing(thisPtr.displayElement,obj.data,thisPtr);    
    8787        } 
    8888         
     
    137137                thisPtr.controller.patchController.attachPatchObserver(thisPtr.objID,"patchLoaded",loadFunc,"all"); 
    138138                 
    139                 LilyUtils.loadScript("chrome://lily/content/lib/processing.js", this); 
    140                 Processing.lily = thisPtr;               
     139                LilyUtils.loadScript("chrome://lily/content/lib/processing.js", this);   
    141140        } 
    142141 
  • trunk/lily/lily/chrome/content/lib/processing.js

    r45 r46  
    77(function(){ 
    88 
    9 this.Processing = function Processing( aElement, aCode
     9this.Processing = function Processing( aElement, aCode, context
    1010{ 
    1111  var p = buildProcessing( aElement ); 
     12  p.lily = context; 
    1213  p.init( aCode ); 
    1314  return p; 
     
    526527  p.createGraphics = function createGraphics( w, h ) 
    527528  { 
    528     var canvas = Processing.lily.document.createElement("canvas"); //FIX ME ***** 
     529    var canvas = p.lily.document.createElement("canvas"); //FIX ME ***** 
    529530    var ret = buildProcessing( canvas ); 
    530531    ret.size( w, h ); 
     
    551552    if ( typeof img == "string" ) 
    552553    { 
    553           if(Processing.lily.document.getElementById(img)) { 
    554             return Processing.lily.document.getElementById(img); //FIX ME **** 
     554          if(p.lily.document.getElementById(img)) { 
     555            return p.lily.document.getElementById(img); //FIX ME **** 
    555556          } else { 
    556557                p.loadImage(img); 
    557                 return Processing.lily.document.getElementById(img); //FIX ME **** 
     558                return p.lily.document.getElementById(img); //FIX ME **** 
    558559          } 
    559560    } 
     
    572573    } 
    573574 
    574     var canvas = Processing.lily.document.createElement("canvas"); //FIX ME  *** 
     575    var canvas = p.lily.document.createElement("canvas"); //FIX ME  *** 
    575576    canvas.width = img.width; 
    576577    canvas.height = img.height; 
     
    643644        function processData(data){ 
    644645                 
    645                 //remove any dupes 
    646                 if(Processing.lily.document.getElementById(file)) { 
    647                         Processing.lily.document.getElementById(file). 
    648                                 parentNode.removeChild(Processing.lily.document.getElementById(file)); 
     646                //remove any dupes FIXME **** 
     647                if(p.lily.document.getElementById(file)) { 
     648                        p.lily.document.getElementById(file). 
     649                                parentNode.removeChild(p.lily.document.getElementById(file)); 
    649650                } 
    650651                 
    651                 var div = Processing.lily.document.createElement("div"); 
     652                var div = p.lily.document.createElement("div"); 
    652653                div.style.display="none"; 
    653                 Processing.lily.document.body.appendChild(div); 
    654                 img = Processing.lily.document.createElement("img"); 
     654                p.lily.document.body.appendChild(div); 
     655                img = p.lily.document.createElement("img"); 
    655656                img.src = "data:image/jpeg;base64,"+btoa(data); 
    656657                img.id = orgName; 
     
    668669    var h = img.height, w = img.width; 
    669670 
    670     var canvas = Processing.lily.document.createElement("canvas"); //FIX ME **** 
     671    var canvas = p.lily.document.createElement("canvas"); //FIX ME **** 
    671672    canvas.width = w; 
    672673    canvas.height = h; 
     
    13281329    curContext.strokeStyle = strokeStyle; 
    13291330 
    1330         Processing.lily.set_obj_size(aWidth,aHeight); //**** FIX ME **** 
     1331        p.lily.set_obj_size(aWidth,aHeight); //**** FIX ME **** 
    13311332 
    13321333        p.background(); //**** FIX ME **** had to add this for some reason... 
     
    16541655      p.pmouseY = p.mouseY; 
    16551656          //**** FIX ME ***** 
    1656       p.mouseX = (e.clientX+Processing.lily.parent.patchView.oWin.scrollX) - Processing.lily.left; 
    1657       p.mouseY = (e.clientY+Processing.lily.parent.patchView.oWin.scrollY) - Processing.lily.top; 
     1657      p.mouseX = (e.clientX+p.lily.parent.patchView.oWin.scrollX) - p.lily.left; 
     1658      p.mouseY = (e.clientY+p.lily.parent.patchView.oWin.scrollY) - p.lily.top; 
    16581659 
    16591660      if ( p.mouseMoved ) 
     
    16971698    }); 
    16981699 
    1699     attach( Processing.lily.document, "keydown", function(e) //FIX ME **** 
     1700    attach( p.lily.document, "keydown", function(e) //FIX ME **** 
    17001701    { 
    17011702      keyPressed = true; 
     
    17181719    }); 
    17191720 
    1720     attach( Processing.lily.document, "keyup", function(e) //FIX ME ***** 
     1721    attach( p.lily.document, "keyup", function(e) //FIX ME ***** 
    17211722    { 
    17221723      keyPressed = false;