Changeset 42
- Timestamp:
- 06/06/08 17:19:10 (6 months ago)
- Files:
-
- trunk/lily/lily/chrome/content/externals.js (modified) (1 diff)
- trunk/lily/lily/chrome/content/externals/patcher.js (modified) (6 diffs)
- trunk/lily/lily/chrome/content/object.js (modified) (3 diffs)
- trunk/lily/lily/chrome/content/patch.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lily/lily/chrome/content/externals.js
r40 r42 244 244 //now the question is how does a _patch_ include an external resource? 245 245 } 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 257 247 source = LilyUtils.readFileFromPath(path,false).data; 258 if(! LilyUtils.isPatchString()) LilyUtils.loadScript("file://"+path,Lily); //only load externs, not patches248 if(!/\.json/.test(path)) LilyUtils.loadScript("file://"+path,Lily); //only load externs, not patches 259 249 260 250 return source; //return the source trunk/lily/lily/chrome/content/externals/patcher.js
r41 r42 50 50 51 51 if(!isPatchString && /##\w+##/.test(param)) { 52 //pull out the patch name and use that as the display 52 53 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; 54 56 } 55 57 … … 85 87 86 88 if(thisPtr.fPath) { 87 89 88 90 var filepath = LilyUtils.getFilePath(thisPtr.fPath); 89 91 … … 110 112 //eval the patch string to get the inlet/outlet count 111 113 try { 112 eval(data); 114 var tmpObj = {} 115 LilyUtils.loadScript("file://"+thisPatch.file.path,tmpObj); 113 116 } catch(e) { 114 117 LilyDebugWindow.error(e.name + ": " + e.message); … … 116 119 } 117 120 118 if(typeof patch != "undefined") {119 121 if(typeof tmpObj.patch != "undefined") { 122 120 123 //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]); 124 127 } 125 128 } 126 129 127 130 //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]); 131 134 } 132 135 } … … 251 254 function frameLoad() { 252 255 iframe.removeEventListener("load",frameLoad,true); //remove this so we don't loop 253 if(thisPatch.json&&thisPatch.file) { 256 if(thisPatch.json&&thisPatch.file) { 254 257 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 { 256 259 openPatchWindow(); //no data so open the edit window- this opens the patch window we'll create the patch in. 257 260 } … … 272 275 openPatchWin.obj.patchView.setPatchTitle("[subpatch]"); //mark it as a subpatch 273 276 openPatchWin.obj.patchView.xulWin.moveBy(20,20); //move it a bit so its clear whats going on 274 }, 100);277 },500); 275 278 276 279 setTimeout(function(){ trunk/lily/lily/chrome/content/object.js
r41 r42 1688 1688 1689 1689 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; 1691 1692 this.objInput.focus(); 1692 1693 this.objInput.select(); … … 1723 1724 return val; 1724 1725 } 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 1750 1727 this.draw=function() { 1751 1728 … … 1755 1732 this.inputWrapper=this.getElByID(this.parent.createElID("inputWrapper")); 1756 1733 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... 1758 1735 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) { 1760 1737 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) { 1762 1739 this.inputWrapper.innerHTML=this.display+" "+this.parent.displayArgs; //display this specific args 1740 } 1763 1741 1764 1742 } trunk/lily/lily/chrome/content/patch.js
r41 r42 432 432 var id=oldObj.objID; 433 433 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; 437 438 438 439 //if we're just modifying the args, grab the old connections … … 494 495 //then recreate the connnections for the new object here 495 496 if(saveConnections) 496 this.restoreConnections(savedConnections); 497 this.restoreConnections(savedConnections); 497 498 498 499 return o; … … 502 503 //restore previously saved connections 503 504 this.restoreConnections=function(connections) { 504 log(connections)505 505 for(var i=0;i<connections.length;i++) { 506 506 this.createConnection(connections[i].inlet,connections[i].outlet,connections[i].segmentArray,null)
