Changeset 42

Show
Ignore:
Timestamp:
06/06/08 17:19:10 (6 months ago)
Author:
bi..@lilyapp.org
Message:

more bug fixes following on checkins 40 & 41 to support ticket 22.

Files:

Legend:

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

    r40 r42  
    244244                        //now the question is how does a _patch_ include an external resource? 
    245245                } 
    246                          
    247                 //******* removing this due to changes in FF3 ********                   
    248                 //faster to use nsiFile methods or xmlhttp               
    249                 //var xhr=new LilyUtils._xhr(handleResponse,'text',this,"GET",false); //,"GET",false 
    250                 //xhr.loadXMLDoc("file://"+path); 
    251                  
    252                 //function handleResponse(_thisObjectSourceCode) { //_thisObjectSourceCode is available in the object context and contains the source code for the object. 
    253                 //      source=_thisObjectSourceCode; 
    254                 //      eval.apply(Lily,[_thisObjectSourceCode]); //eval in the context of the window  
    255                 //} 
    256                  
     246                                 
    257247                source = LilyUtils.readFileFromPath(path,false).data;            
    258                 if(!LilyUtils.isPatchString()) LilyUtils.loadScript("file://"+path,Lily); //only load externs, not patches 
     248                if(!/\.json/.test(path)) LilyUtils.loadScript("file://"+path,Lily); //only load externs, not patches 
    259249                 
    260250                return source; //return the source       
  • trunk/lily/lily/chrome/content/externals/patcher.js

    r41 r42  
    5050         
    5151        if(!isPatchString && /##\w+##/.test(param)) { 
     52                //pull out the patch name and use that as the display 
    5253                this.displayName = param.match(/##(\w+)##/)[1]; 
    53                 this.displayArgs = (this.patchArgs)?this.patchArgs.replace(/##\w+##/,""):false; 
     54                //if there any additional args, strip out the classname and assign them to display args. otherwise displayargs = false. 
     55                this.displayArgs = (!/^##\w+##/.test(this.patchArgs))?this.patchArgs.replace(/##\w+##/,""):false; 
    5456        } 
    5557         
     
    8587                 
    8688                if(thisPtr.fPath) { 
    87                          
     89                                        
    8890                        var filepath = LilyUtils.getFilePath(thisPtr.fPath); 
    8991 
     
    110112                //eval the patch string to get the inlet/outlet count 
    111113                try { 
    112                         eval(data); 
     114                        var tmpObj = {} 
     115                        LilyUtils.loadScript("file://"+thisPatch.file.path,tmpObj); 
    113116                } catch(e) { 
    114117                        LilyDebugWindow.error(e.name + ": " + e.message); 
     
    116119                } 
    117120                 
    118                 if(typeof patch != "undefined") { 
    119  
     121                if(typeof tmpObj.patch != "undefined") { 
     122                         
    120123                        //push all the inlets into an array 
    121                         for(var x in patch.objArray) { 
    122                                 if(patch.objArray[x].name=="inlet") { 
    123                                         tmpIn.push(patch.objArray[x]);                                 
     124                        for(var x in tmpObj.patch.objArray) { 
     125                                if(tmpObj.patch.objArray[x].name=="inlet") { 
     126                                        tmpIn.push(tmpObj.patch.objArray[x]);                          
    124127                                } 
    125128                        } 
    126129 
    127130                        //push all the outlets into an array 
    128                         for(var y in patch.objArray) { 
    129                                 if(patch.objArray[y].name=="outlet") { 
    130                                         tmpOut.push(patch.objArray[y]);                                
     131                        for(var y in tmpObj.patch.objArray) { 
     132                                if(tmpObj.patch.objArray[y].name=="outlet") { 
     133                                        tmpOut.push(tmpObj.patch.objArray[y]);                                 
    131134                                } 
    132135                        } 
     
    251254        function frameLoad() { 
    252255                iframe.removeEventListener("load",frameLoad,true); //remove this so we don't loop 
    253                 if(thisPatch.json&&thisPatch.file) { 
     256                if(thisPatch.json&&thisPatch.file) {                    
    254257                        openPatch(thisPatch.json,thisPatch.file);//open the patch if we've got the data- this loads the patch in the iframe 
    255                 } else { 
     258                } else {                
    256259                        openPatchWindow(); //no data so open the edit window- this opens the patch window we'll create the patch in. 
    257260                } 
     
    272275                        openPatchWin.obj.patchView.setPatchTitle("[subpatch]"); //mark it as a subpatch 
    273276                        openPatchWin.obj.patchView.xulWin.moveBy(20,20); //move it a bit so its clear whats going on 
    274                 },100); 
     277                },500); 
    275278                 
    276279                setTimeout(function(){ 
  • trunk/lily/lily/chrome/content/object.js

    r41 r42  
    16881688                 
    16891689                if(this.objInput) { 
    1690                         this.objInput.value=Lily["$"+this.name+"MetaData"].textName + ((obj.args)?" ":"") + obj.args; 
     1690                        var args = (typeof obj.displayArgs == "string") ? obj.displayArgs : obj.args; 
     1691                        this.objInput.value=this.display + ((args)?" ":"") + args; 
    16911692                        this.objInput.focus(); 
    16921693                        this.objInput.select(); 
     
    17231724                return val;      
    17241725        } 
    1725          
    1726         //FIXME **** remove this **** 
    1727         //can't find any calls to this 
    1728         /* 
    1729         //update the inlets 
    1730         this.redrawInlets=function() { 
    1731                 this.controller.removeInletListeners(); 
    1732                 var el = this.document.getElementById(this.parent.createElID("inletContainer")); 
    1733                 el.innerHTML=""; 
    1734                 el.innerHTML = this.buildInletHTML(); 
    1735                 this.controller.addInletListeners(); 
    1736                 setTimeout(function(){changeInletOutletVisibility((thisPtr.patch.patchController.getEditable()=="edit")?"visible":"hidden");},100);              
    1737         }        
    1738          
    1739         //update the outlets 
    1740         this.redrawOutlets=function() { 
    1741                 this.controller.removeOutletListeners(); 
    1742                 var el = this.document.getElementById(this.parent.createElID("outletContainer")); 
    1743                 el.innerHTML="";                 
    1744                 el.innerHTML = this.buildOutletHTML();           
    1745                 this.controller.addOutletListeners(); 
    1746                 setTimeout(function(){changeInletOutletVisibility((thisPtr.patch.patchController.getEditable()=="edit")?"visible":"hidden");},100);      
    1747         } 
    1748         */ 
    1749          
     1726                 
    17501727        this.draw=function() { 
    17511728         
     
    17551732                        this.inputWrapper=this.getElByID(this.parent.createElID("inputWrapper")); 
    17561733                         
    1757                         if(typeof this.parent.displayArgs == "boolean" && this.parent.displayArgs) //display args ok... 
     1734                        if(typeof this.parent.displayArgs == "boolean" && this.parent.displayArgs) {//display args ok... 
    17581735                                this.inputWrapper.innerHTML=LilyUtils.string2HTML(this.cmdStr); //escape any args 
    1759                         else if(typeof this.parent.displayArgs == "boolean" && !this.parent.displayArgs) 
     1736                        } else if(typeof this.parent.displayArgs == "boolean" && !this.parent.displayArgs) { 
    17601737                                this.inputWrapper.innerHTML=this.display; //just the name since we're not displaying args 
    1761                         else if(typeof this.parent.displayArgs == "string" && this.parent.displayArgs) 
     1738                        } else if(typeof this.parent.displayArgs == "string" && this.parent.displayArgs) { 
    17621739                                this.inputWrapper.innerHTML=this.display+" "+this.parent.displayArgs; //display this specific args 
     1740                        }        
    17631741                         
    17641742                } 
  • trunk/lily/lily/chrome/content/patch.js

    r41 r42  
    432432                var id=oldObj.objID; 
    433433                oldObj.controller.replacing=true;                
    434                 var args=newArgs;        
    435                 var saveConnections=(oldObj.displayName==newObjName)?true:false; 
    436                 var newID=(oldObj.displayName==newObjName)?id:null; 
     434                var args=newArgs; 
     435                         
     436                var saveConnections=(oldObj.controller.objView.display==newObjName)?true:false; 
     437                var newID=(oldObj.controller.objView.display==newObjName)?id:null; 
    437438                 
    438439                //if we're just modifying the args, grab the old connections 
     
    494495                //then recreate the connnections for the new object here 
    495496                if(saveConnections) 
    496                         this.restoreConnections(savedConnections);                      
     497                        this.restoreConnections(savedConnections); 
    497498                         
    498499                return o; 
     
    502503        //restore previously saved connections 
    503504        this.restoreConnections=function(connections) { 
    504                 log(connections) 
    505505                for(var i=0;i<connections.length;i++) { 
    506506                        this.createConnection(connections[i].inlet,connections[i].outlet,connections[i].segmentArray,null)