Changeset 64

Show
Ignore:
Timestamp:
07/21/08 15:04:16 (1 month ago)
Author:
bi..@lilyapp.org
Message:

Fix bug #29. Also fix a bad checkin from last night.

Files:

Legend:

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

    r63 r64  
    7979                } else { 
    8080                        LilyDebugWindow.error("Couldn't load the patch or external "+stripped+". An object with that name is already exists."); 
    81                 }       
     81                } 
    8282        }, 
    8383 
     
    142142                                        this.objArray[i].displayName=LilyUtils.getObjectMetaData(objName).htmlName; 
    143143                                        this.objArray[i].menuName=LilyUtils.getObjectMetaData(objName).textName; 
    144                                         this.objArray[i].catName=LilyUtils.getObjectMetaData(objName).objectCategory; 
     144                                        this.objArray[i].catName=(LilyUtils.getObjectMetaData(objName).objectCategory?LilyUtils.getObjectMetaData(objName).objectCategory:LilyUtils.extractPatchCat(this.objArray[i].sourceCode)) 
    145145                                        this.objArray[i].objSummary=(LilyUtils.getObjectMetaData(objName).objectSummary?LilyUtils.getObjectMetaData(objName).objectSummary:LilyUtils.extractPatchDesc(this.objArray[i].sourceCode)); 
    146146                                        this.objArray[i].objArguments=LilyUtils.getObjectMetaData(objName).objectArguments;                                                              
     
    338338                var tmp=[]; 
    339339                for(var i=0;i<this.objArray.length;i++) {                        
    340                         if((this.objArray[i].name.indexOf(".json")==-1)&&(this.objArray[i].catName!=undefined)) 
     340                        if((this.objArray[i].catName)) 
    341341                                tmp.push(this.objArray[i]); 
    342342                } 
  • trunk/lily/lily/chrome/content/lily.js

    r59 r64  
    11921192                var initVals = {  
    11931193                        title:  p.title||"Untitled", 
    1194                         color:  p.color||"#FFFFFF",                    
     1194                        category:  p.category||"",                     
    11951195                        height: p.heightInSubPatch||"0",  
    11961196                        width:  p.widthInSubPatch||"0", 
     
    11981198                }; 
    11991199                 
    1200                 win.openDialog("chrome://lily/content/patch-properties.xul", "cWin","width=450,height=405,left=50,top=550,close=no,scrollbars=no,dialog=yes,resizable=no,toolbar=no,menubar=no,location=no,status=no,chrome=yes,alwaysRaised=yes",function(val){ 
     1200                win.openDialog("chrome://lily/content/patch-properties.xul", "cWin","width=450,height=450,left=50,top=250,close=no,scrollbars=no,dialog=yes,resizable=no,toolbar=no,menubar=no,location=no,status=no,chrome=yes,alwaysRaised=yes",function(val){ 
    12011201                        for(var x in val) { 
    12021202                                switch(x) { 
    12031203                                        case "title": 
    12041204                                                p.patchView.setPatchTitle(val[x]); 
    1205                                         case "color": 
    1206                                                 p.patchView.setPatchColor(val[x]); 
     1205                                        case "category": 
     1206                                                p.category=LilyUtils.escape(val[x]); 
    12071207                                        case "height": 
    12081208                                                p.heightInSubPatch=val[x]; 
  • trunk/lily/lily/chrome/content/model.js

    r60 r64  
    104104                j+="'color':"+quote+this.patch.color+quote+comma; 
    105105                j+="'mode':"+quote+this.patch.patchController.editable+quote+comma;      
    106                 j+="'description':"+quote+this.patch.description+quote+comma;    
     106                j+="'description':"+quote+this.patch.description+quote+comma; 
     107                j+="'category':"+quote+this.patch.category+quote+comma;                  
    107108                j+="'heightInSubPatch':"+quote+this.patch.heightInSubPatch+quote+comma;  
    108109                j+="'widthInSubPatch':"+quote+this.patch.widthInSubPatch+quote+comma;                                                            
  • trunk/lily/lily/chrome/content/patch-properties.html

    r58 r64  
    11<html> 
     2        <head> 
     3                <script> 
     4                        function toggleInputs(checked) { 
     5                                document.getElementById("height").disabled=!checked; 
     6                                document.getElementById("width").disabled=!checked;                              
     7                        } 
     8                </script> 
     9        </head> 
    210 
    311        <body> 
     
    715                                <td align="right" style="background:lightgrey" width="145">Title:</td> 
    816                                <td><input onchange="parentWin.saveDialog();" size="30" style="font-size:14px;font-family:verdana,DejaVu Sans,sans-serif;" id="title" type="text"></td> 
    9                         </tr> 
     17                        </tr>                   
    1018                        <tr> 
    11                                 <td align="right" style="background:lightgrey">Color:</td> 
    12                                 <td><input onchange="parentWin.saveDialog();" size="30" style="font-size: 14px; font-family:verdana,DejaVu Sans,sans-serif;" id="color" type="text"></td> 
     19                                <td align="right" style="background:lightgrey">Open in SubPatch:</td> 
     20                                <td><input onclick="toggleInputs(this.checked);" type="checkbox" id="open_in_subpatch"></td> 
    1321                        </tr> 
    1422                        <tr> 
    1523                                <td align="right" style="background:lightgrey">Height in Subpatch:</td> 
    16                                 <td><input onchange="parentWin.saveDialog();" size="30" style="font-size: 14px; font-family:verdana,DejaVu Sans,sans-serif;" id="height" type="text"></td> 
     24                                <td><input disabled="disabled" onchange="parentWin.saveDialog();" size="30" style="font-size: 14px; font-family:verdana,DejaVu Sans,sans-serif;" id="height" type="text"></td> 
    1725                        </tr> 
    1826                        <tr> 
    1927                                <td align="right" style="background:lightgrey">Width in Subpatch:</td> 
    20                                 <td><input onchange="parentWin.saveDialog();" size="30" style="font-size: 14px; font-family:verdana,DejaVu Sans,sans-serif;" id="width" type="text"></td> 
     28                                <td><input disabled="disabled" onchange="parentWin.saveDialog();" size="30" style="font-size: 14px; font-family:verdana,DejaVu Sans,sans-serif;" id="width" type="text"></td> 
    2129                        </tr> 
     30                        <tr> 
     31                                <td align="right" style="background:lightgrey">Category:</td> 
     32                                <td><input onchange="parentWin.saveDialog();" size="30" style="font-size: 14px; font-family:verdana,DejaVu Sans,sans-serif;" id="category" type="text"></td> 
     33                        </tr>                    
    2234                        <tr> 
    2335                                <td align="right" style="background:lightgrey">Description:</td> 
    2436                                <td><textarea onchange="parentWin.saveDialog();" style="font-size: 14px; font-family:verdana,DejaVu Sans,sans-serif;" cols="29" rows="4" id="desc"></textarea></td> 
    25                         </tr> 
     37                        </tr>                   
    2638                        <tr> 
    2739                                <td colspan="2" align="center" style="background:lightgrey"> 
  • trunk/lily/lily/chrome/content/patch-properties.xul

    r58 r64  
    4747                         
    4848                        for(var x in tmp) { 
    49                                 if(doc.getElementById(x)) { 
     49                                if(doc.getElementById(x) &amp;&amp; !doc.getElementById(x).disabled) { 
    5050                                        tmp[x] = doc.getElementById(x).value; 
    5151                                } 
  • trunk/lily/lily/chrome/content/patch.js

    r61 r64  
    3636        this.widthInSubPatch=0;  //width when loaded in a subpatch 
    3737        this.description="";    //patch description. 
     38        this.category="";       //patch category.        
    3839        this.color="#FFFFFF" //background color 
    39         this.desc="";           //patch description 
    4040        this.fontSize=LilyUtils.getDefaultFont()[1]; //font size in px 
    4141        this.fontFamily=LilyUtils.getDefaultFont()[0]; //font face 
     
    738738                 
    739739                        if(typeof patch.title!="undefined" && !subPatchID && !opID && this.patchWindowType=="popup") 
    740                                 this.patchView.setPatchTitle(patchName); //update the patch title - patch.title                                
     740                                this.patchView.setPatchTitle(patch.title||patchName); //update the patch title - patch.title                           
    741741                 
    742742                        if(typeof patch.color!="undefined" && !subPatchID && !opID) 
     
    745745                        if(typeof patch.description!="undefined" && !subPatchID && !opID) 
    746746                                this.description=patch.description; //update color 
     747                                 
     748                        if(typeof patch.category!="undefined" && !subPatchID && !opID) 
     749                                this.category=patch.category; //update color                             
    747750                                 
    748751                        if(typeof patch.heightInSubPatch!="undefined" && !subPatchID && !opID) 
  • trunk/lily/lily/chrome/content/utils.js

    r63 r64  
    14321432        */       
    14331433        extractPatchDesc: function(data) { 
    1434                 var desc=data.match(/'description':'([\S|\s]+)','heightInSubPatch'/);          
     1434                var desc=data.match(/'description':'([\S|\s]+)','category'/);          
    14351435                 
    14361436                if(desc && desc.length>1) 
    14371437                        return desc[1]; 
     1438                else 
     1439                        return ""; 
     1440        }, 
     1441         
     1442        /* 
     1443                Method: extractPatchCat 
     1444                        get the patch size without having to eval the patch JSON. 
     1445                         
     1446                Arguments:  
     1447                        data - JSON patch string. 
     1448                         
     1449                Returns:  
     1450                        Patch description.                                                                       
     1451        */       
     1452         
     1453        //'description':'','category':'','heightInSubPatch': 
     1454         
     1455        extractPatchCat: function(data) { 
     1456                var cat=data.match(/'category':'([\S|\s]+)','heightInSubPatch'/);                
     1457                 
     1458                if(cat && cat.length>1) 
     1459                        return cat[1]; 
    14381460                else 
    14391461                        return "";