Ignore:
Timestamp:
06/13/07 17:44:00 (5 years ago)
Author:
dar
Message:

Réorganisation du code (constructor, field, property, method)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/xAudioHier/Xul_Audio/chrome/content/audio-toolkit/area.xml

    r9275 r9276  
    11<?xml version="1.0"?> 
    2  
    3   
    4  
    52<bindings xmlns="http://www.mozilla.org/xbl" xmlns:xbl="http://www.mozilla.org/xbl" 
    63        xmlns:html="http://www.w3.org/1999/xhtml" 
     
    1411                        <svg:rect x="0" y="0" width="1000" height="20" fill="#fff" stroke-width="0" /> 
    1512                        <svg:rect x="0" y="20" width="1000" height="80" fill="#f6e69d" opacity="0.8" stroke-width="0" /> 
     13 
    1614                        <svg:g anonid="area_rules"> 
    1715                                <svg:line x1="0" x2="1000" y1="20" y2="20" stroke="#aaa" fill="black" stroke-width="1" /> 
    1816                        </svg:g> 
     17 
    1918                        <svg:g anonid="sections"> 
    2019                                <children /> 
    2120                        </svg:g> 
     21 
    2222                        <svg:svg anonid="cursor" x="0" y="0" width="2%" height="100" viewBox="0 0 10 10" 
    2323                                preserveAspectRatio="none"> 
    2424                                <svg:line x1="0" x2="0" y1="0" y2="10" fill="red" stroke-width="2" /> 
    2525                        </svg:svg> 
    26  
    2726                </content> 
    2827 
     
    3130                                this._cursor = document.getAnonymousElementByAttribute(this, "anonid", "cursor"); 
    3231                        ]]></constructor> 
     32 
     33                        <property name="rootSection"> 
     34                                <getter><![CDATA[ 
     35                                        var firstSection = this.firstChild; 
     36                                        while(firstSection && firstSection.localName != "section") { 
     37                                                firstSection = firstSection.nextSibling; 
     38                                        } 
     39                                        return firstSection; 
     40                                ]]></getter> 
     41                        </property> 
     42 
     43                        <property name="inner" readonly="true"> 
     44                                <getter><![CDATA[ 
     45                                        return document.getAnonymousNodes(this)[0]; 
     46                                ]]></getter> 
     47                        </property> 
     48 
     49                        <property name="cursor"> 
     50                                <getter><![CDATA[ 
     51                                        return this._cursor.x.baseVal.value; 
     52                                ]]></getter> 
     53                                <setter><![CDATA[ 
     54                                        if (val < 0) val = 0; 
     55                                        if (val > 1000 ) val = 1000; 
     56                                        this._cursor.x.baseVal.value = val; 
     57                                ]]></setter> 
     58                        </property> 
     59 
    3360                        <method name="init"> 
    3461                                <parameter name="audioElt" /> 
     
    86113                                ]]></body> 
    87114                        </method> 
     115 
    88116                        <method name="updateRatio"> 
    89117                                <body><![CDATA[ 
     
    103131                                ]]></body> 
    104132                        </method> 
     133 
    105134                        <method name="drawGraph"> 
    106135                                <body><![CDATA[ 
    107                                                 var graph = document.getAnonymousElementByAttribute(this, "anonid", "audiograph"); 
    108                                                 if (this._audioElt.srcAudio) { 
    109                                                         graph.drawGraph(this._audioElt.srcAudio, "daim://zoomedGraph", 1, 10000, 80); 
    110                                                 } else { 
    111                                                         graph.hideGraph(); 
    112                                                 } 
     136                                        var graph = document.getAnonymousElementByAttribute(this, "anonid", "audiograph"); 
     137                                        if (this._audioElt.srcAudio) { 
     138                                                graph.drawGraph(this._audioElt.srcAudio, "daim://zoomedGraph", 1, 10000, 80); 
     139                                        } else { 
     140                                                graph.hideGraph(); 
     141                                        } 
    113142                                ]]></body> 
    114143                        </method> 
    115                         <property name="rootSection"> 
    116                                 <getter> 
    117                                         <![CDATA[ 
    118                                         var firstSection = this.firstChild; 
    119                                         while(firstSection && firstSection.localName != "section") { 
    120                                                 firstSection = firstSection.nextSibling; 
    121                                         } 
    122                                         return firstSection; 
    123                                 ]]></getter> 
    124                         </property> 
     144 
    125145                        <method name="newSectionWalker"> 
    126146                                <body><![CDATA[ 
    127                                                 function sectionFilter(node) { 
    128                                                         if (node.localName == "section") 
    129                                                                 return NodeFilter.FILTER_ACCEPT 
    130                                                         else 
    131                                                                 return NodeFilter.FILTER_SKIP 
    132                                                 } 
     147                                        function sectionFilter(node) { 
     148                                                if (node.localName == "section") 
     149                                                        return NodeFilter.FILTER_ACCEPT 
     150                                                else 
     151                                                        return NodeFilter.FILTER_SKIP 
     152                                        } 
    133153 
    134                                                 return document.createTreeWalker(this.rootSection, NodeFilter.SHOW_ELEMENT, sectionFilter, false); 
     154                                        return document.createTreeWalker(this.rootSection, NodeFilter.SHOW_ELEMENT, sectionFilter, false); 
    135155                                ]]></body> 
    136156                        </method> 
    137                         <property name="inner" readonly="true"> 
    138                                 <getter><![CDATA[ 
    139                                         return document.getAnonymousNodes(this)[0]; 
    140                                 ]]></getter> 
    141                         </property> 
     157                </implementation> 
    142158 
    143  
    144                         <property name="cursor"> 
    145                                 <getter><![CDATA[ 
    146                                         return this._cursor.x.baseVal.value; 
    147                                 ]]></getter> 
    148                                 <setter><![CDATA[ 
    149                                         if (val < 0) val = 0; 
    150                                         if (val > 1000 ) val = 1000; 
    151                                         this._cursor.x.baseVal.value = val; 
    152                                 ]]></setter> 
    153                         </property> 
    154                 </implementation> 
    155                  
    156159                <handlers> 
    157160                        <handler event="DOMMouseScroll"><![CDATA[ 
     
    167170                        ]]></handler> 
    168171                </handlers> 
    169  
    170172        </binding> 
    171173</bindings> 
Note: See TracChangeset for help on using the changeset viewer.