Changeset 77

Show
Ignore:
Timestamp:
07/26/08 08:43:23 (4 months ago)
Author:
bi..@lilyapp.org
Message:

fix bug #19

Files:

Legend:

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

    r62 r77  
    6262        this.loadsSubPatchByName = false; //true when a subpatch is invoked by name 
    6363        this.hasBeenResized=false; //true when an extern has resized by hand. 
     64        this.isPaste=false; //true if we're creating this as a paste 
    6465         
    6566        this.ui=null; //to filled in when view instantiates 
     
    868869                //      log("deselect- no e "+thisPtr.id) 
    869870                                 
    870                 if(!thisPtr.isSelected || thisPtr.objDrag.dragging
     871                if(!thisPtr.isSelected || thisPtr.objDrag.dragging || (e && e.type=="paste")
    871872                        return;  
    872873                         
     
    10101011        //handler for edit state switch 
    10111012        this.toggleEditState=function() { 
    1012                 thisPtr.deselect(); 
    1013                 thisPtr.objView.toggleEditView(); 
     1013                if(!thisPtr.objView.parent.isPaste)thisPtr.deselect(); 
     1014                thisPtr.objView.toggleEditView();  
    10141015        } 
    10151016         
     
    17531754                 
    17541755                if(!this.parent.subPatcherID) //no listeners for subpatch objects 
    1755                         this.controller.addDefaultListeners(); //setTimeout(function(){thisPtr.controller.addDefaultListeners();},100); 
     1756                        this.controller.addDefaultListeners(); 
    17561757                 
    17571758                this.contentWrapper=this.getElByID(this.parent.createElID("contentWrapper")); 
     
    17611762                this.parent.displayElement=this.contentContainer; 
    17621763                this.parent.resizeElement=this.contentWrapper;   
    1763                 this.parent.animationElement=this.objViewNode;           
    1764                  
    1765                 if(!this.controller.noBorders) 
    1766                         setTimeout(function(){if(thisPtr.name!="tmp"){thisPtr.controller.toggleEditState();}},100); 
    1767                 else if(thisPtr.name!="tmp" && this.controller.noBorders) 
     1764                this.parent.animationElement=this.objViewNode;   
     1765                                 
     1766                //FIXME? hack to get the borders to draw correctly 
     1767                if(!this.controller.noBorders) { 
     1768                        setTimeout(function(){ 
     1769                                if(thisPtr.name!="tmp"){ 
     1770                                        thisPtr.controller.toggleEditState(); 
     1771                                        thisPtr.parent.isPaste=false;                                    
     1772                                } 
     1773                        },100); 
     1774                } else if(thisPtr.name!="tmp" && this.controller.noBorders) { 
    17681775                        thisPtr.controller.toggleEditState(); 
     1776                        thisPtr.parent.isPaste=false; 
     1777                }        
    17691778                 
    17701779                setTimeout(function(){thisPtr.updateObjSize();},100); 
  • trunk/lily/lily/chrome/content/patch.js

    r76 r77  
    643643                        LilyDebugWindow.error("error- patch not found."); 
    644644        } 
     645         
     646        /* 
     647                Method: openHidden 
     648                        open an existing patch as hidden. 
     649         
     650                Arguments:  
     651                        path    - path to patch (required) 
     652                         
     653                Returns:  
     654                        returns the newly created patch object.          
     655        */ 
     656        //open an existing patch window. 
     657        this.openHidden=function(path) { 
     658                 
     659                var fPath=LilyUtils.getFilePath(path); 
     660                var file=(fPath)?LilyUtils.getFileHandle(fPath):null; 
     661                 
     662                if(file) 
     663                        return Lily.openPatchFromFile(file,true,true); 
     664                else 
     665                        LilyDebugWindow.error("error- patch not found."); 
     666        }        
     667         
     668        /* 
     669                Method: openReadOnly 
     670                        open an existing patch as readonly. 
     671         
     672                Arguments:  
     673                        path    - path to patch (required) 
     674                         
     675                Returns:  
     676                        returns the newly created patch object.          
     677        */ 
     678        //open an existing patch window. 
     679        this.openReadOnly=function(path) { 
     680                 
     681                var fPath=LilyUtils.getFilePath(path); 
     682                var file=(fPath)?LilyUtils.getFileHandle(fPath):null; 
     683                 
     684                if(file) 
     685                        return Lily.openPatchFromFile(file,true,false); 
     686                else 
     687                        LilyDebugWindow.error("error- patch not found."); 
     688        }        
    645689 
    646690        /* 
     
    795839                                        //create the object 
    796840                                        var o=this.createObject(oArray[x].name,subPatchID,oArray[x].top,oArray[x].left,this.updateObjID(oArray[x].objID,opID),oArray[x].args,oArray[x].hasBeenResized); 
     841 
     842                                        if(opID) { 
     843                                                o.isPaste=true; //set the flag so this doesn't get deselected. 
     844                                        } 
    797845 
    798846                                        //set some object properties 
     
    843891                                                parent_patch.patchModel.addSubPatch(x,false,null); //add this subpatch to the list 
    844892                                        } 
     893                                         
     894                                        if(opID) { 
     895                                                o.controller.select({type:"paste"}); //if we're pasting, select the object after we create it. 
     896                                        } 
    845897                                } 
    846898                        } 
     
    849901                                if(oArray[a].type=="connection") { 
    850902                                        var c=this.createConnection(this.updateObjID(oArray[a].inlet,opID),this.updateObjID(oArray[a].outlet,opID),oArray[a].segmentArray,subPatchID); 
    851                                         if(c && typeof oArray[a].hiddenInPerf!="undefined") 
     903 
     904                                        if(c && typeof oArray[a].hiddenInPerf!="undefined"){ 
    852905                                                c.controller.setHiddenInPerf(oArray[a].hiddenInPerf); 
     906                                        } 
     907                                         
     908                                        if(opID) { 
     909                                                c.controller.select({type:"paste"}); 
     910                                        }                                                
     911                                         
    853912                                } 
    854913                        } 
     
    14101469        this.deselectAll=function(e) { 
    14111470                 
    1412                 if((e && (LilyUtils.selectionModifyingKeyDown(e)||e.type=="selectAll"||e.type=="marqueeSelection"))) 
     1471                if( 
     1472                        ( 
     1473                        e &&  
     1474                                ( 
     1475                                LilyUtils.selectionModifyingKeyDown(e)|| 
     1476                                e.type=="selectAll"|| 
     1477                                e.type=="marqueeSelection"|| 
     1478                                e.type=="paste" 
     1479                                ) 
     1480                        ) 
     1481                ) 
    14131482                        return; 
    14141483