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/subplayer.xml

    r9275 r9276  
    11<?xml version="1.0"?> 
    2   
    3  
    42<bindings xmlns="http://www.mozilla.org/xbl" xmlns:xbl="http://www.mozilla.org/xbl" 
    53        xmlns:html="http://www.w3.org/1999/xhtml" 
     
    119                <content> 
    1210                        <svg:g xbl:inherits="transform"> 
    13  
    1411                                <svg:g class="buttonplayer" anonid="button"> 
    1512                                        <svg:rect anonid="" x="0" y="0" width="40" height="40" /> 
     
    1714                                        <svg:rect anonid="stop" x="8" y="8" width="24" height="24" /> 
    1815                                </svg:g> 
     16 
    1917                                <svg:rect anonid="ext" x="70" y="0" width="1000" height="40" stroke-width="0" /> 
    2018                                <svg:text anonid="text1" x="84" y="30" font-size="28" fill="#000" stroke-width="0" /> 
     
    2321                                <svg:audiograph x="70" y="0" height="40" width="925" anonid="audiograph" /> 
    2422                                <svg:rect anonid="ground" x="70" y="0" width="925" height="40" fill-opacity="0" /> 
     23 
    2524                                <svg:g class="subzone" style="visibility: hidden;"> 
    26  
    2725                                        <svg:symbol id="zoneAnchorLeft" viewBox="15 0 40 40" preserveAspectRatio="none" 
    2826                                                overflow="visible"> 
     
    4240                                                height="36" stroke-width="2" /> 
    4341                                </svg:g> 
     42 
    4443                                <svg:svg anonid="cursor" x="0" y="0" width="10" height="40" viewBox="0 0 10 10" 
    4544                                        preserveAspectRatio="none"> 
     
    4847                        </svg:g> 
    4948                </content> 
     49 
    5050                <implementation> 
    51                         <method name="init"> 
    52                                 <parameter name="audioElt" /> 
    53                                 <body><![CDATA[ 
    54                                         this._audioElt = audioElt; 
    55                                          
    56                                         while (this._modificationListeners.length) 
    57                                                 this._modificationListeners.pop(); 
    58                                 ]]></body> 
    59                         </method> 
    60                         <method name="drawGraph"> 
    61                                 <body><![CDATA[ 
    62                                                 var graph = document.getAnonymousElementByAttribute(this, "anonid", "audiograph"); 
    63                                                 if (this._audioElt.srcAudio) { 
    64                                                         graph.drawGraph(this._audioElt.srcAudio, "daim://fullGraph", 0, 950, 40); 
    65                                                 } else { 
    66                                                         graph.hideGraph(); 
    67                                                 } 
    68                                 ]]></body> 
    69                         </method> 
    7051                        <constructor><![CDATA[ 
    7152                                //FIXME: init() 
     
    132113                                                        var initValue = handle.x.baseVal.value; 
    133114                                                        var newValue = initValue + delta / self._ratio; 
    134                                                         self._resizeZone(self._selectedHandle  == LEFT ? "left" : "right", newValue, true); 
     115                                                        self._resizeZone(self._selectedHandle == LEFT ? "left" : "right", newValue, true); 
    135116                                                } 
    136117                                                var groundClientLeft = self._audioElt._xulroot.boxObject.x + (self._ground.x.baseVal.value * self._ratio); 
     
    147128 
    148129                                function _mousedownMiddle(event) { 
    149             if (event.button == 0) { 
    150                                                 self._state = DRAG; 
    151                                                 self._selectedHandle = MIDDLE; 
    152                                                 self.oriX = event.clientX; 
    153             } 
     130                                        if (event.button == 0) { 
     131                                                self._state = DRAG; 
     132                                                self._selectedHandle = MIDDLE; 
     133                                                self.oriX = event.clientX; 
     134                                        } 
    154135                                } 
    155136 
     
    199180                                this._ratio = coordTrans2.x - coordTrans1.x; 
    200181 
    201                         ]]></constructor> 
     182                                ]]></constructor> 
     183 
     184 
     185                        <property name="cursor"> 
     186                                <getter><![CDATA[ 
     187                                        return 1000 * (this._cursor.x.baseVal.value - this._ground.x.baseVal.value) / this._ground.width.baseVal.value; 
     188                                ]]></getter> 
     189 
     190                                <setter><![CDATA[ 
     191                                        if (val < 0) val = 0; 
     192                                        if (val > 1000 ) val = 1000; 
     193                                        this._cursor.x.baseVal.value = (val / 1000) * this._ground.width.baseVal.value + this._ground.x.baseVal.value;  
     194                                ]]></setter> 
     195                        </property> 
     196 
     197                        <property name="t1"> 
     198                                <getter><![CDATA[ 
     199                                        return 1000 * (this._zone.c1.x.baseVal.value - this._ground.x.baseVal.value) / this._ground.width.baseVal.value; 
     200                                ]]></getter> 
     201                        </property> 
     202 
     203                        <property name="t2"> 
     204                                <getter><![CDATA[ 
     205                                        return 1000 * (this._zone.c2.x.baseVal.value - this._ground.x.baseVal.value) / this._ground.width.baseVal.value; 
     206                                ]]></getter> 
     207                        </property> 
     208 
     209                        <method name="setT2"> 
     210                                <parameter name="val" /> 
     211                                <parameter name="notify" /> 
     212                                <body><![CDATA[ 
     213                                        if (val < 0) val = 0; 
     214                                        if (val > 1000 ) val = 1000; 
     215                                        this.showZone(true); 
     216                                        this._resizeZone("right", this._ground.x.baseVal.value + this._ground.width.baseVal.value * (val / 1000), notify); 
     217                                ]]></body> 
     218                        </method> 
     219 
     220                        <property name="inner" readonly="true"> 
     221                                <getter><![CDATA[ 
     222                                        return document.getAnonymousNodes(this)[0]; 
     223                                ]]></getter> 
     224                        </property> 
     225 
     226                        <method name="init"> 
     227                                <parameter name="audioElt" /> 
     228                                <body><![CDATA[ 
     229                                        this._audioElt = audioElt; 
     230                                         
     231                                        while (this._modificationListeners.length) 
     232                                                this._modificationListeners.pop(); 
     233                                ]]></body> 
     234                        </method> 
     235 
     236                        <method name="drawGraph"> 
     237                                <body><![CDATA[ 
     238                                                var graph = document.getAnonymousElementByAttribute(this, "anonid", "audiograph"); 
     239                                                if (this._audioElt.srcAudio) { 
     240                                                        graph.drawGraph(this._audioElt.srcAudio, "daim://fullGraph", 0, 950, 40); 
     241                                                } else { 
     242                                                        graph.hideGraph(); 
     243                                                } 
     244                                ]]></body> 
     245                        </method> 
    202246 
    203247                        <method name="_notifyPlayListeners"> 
     
    269313                                        if (notify && modif) this._notifyResizeListeners( 
    270314                                                1000 * (this._zone.c1.x.baseVal.value - this._ground.x.baseVal.value) / this._ground.width.baseVal.value, 
    271                                                 1000 * (this._zone.c2.x.baseVal.value - this._ground.x.baseVal.value)  / this._ground.width.baseVal.value, 
     315                                                1000 * (this._zone.c2.x.baseVal.value - this._ground.x.baseVal.value) / this._ground.width.baseVal.value, 
    272316                                                handle); 
    273317                                        return modif; 
     
    293337                                        if (notify && modif) this._notifyResizeListeners( 
    294338                                                1000 * (this._zone.c1.x.baseVal.value - this._ground.x.baseVal.value) / this._ground.width.baseVal.value, 
    295                                                 1000 * (this._zone.c2.x.baseVal.value - this._ground.x.baseVal.value)  / this._ground.width.baseVal.value, 
     339                                                1000 * (this._zone.c2.x.baseVal.value - this._ground.x.baseVal.value) / this._ground.width.baseVal.value, 
    296340                                                'middle'); 
    297341                                        return modif; 
    298342                                ]]></body> 
    299343                        </method> 
    300  
    301344 
    302345                        <method name="addResizeListener"> 
     
    325368                                ]]></body> 
    326369                        </method> 
     370 
    327371                        <method name="showZone"> 
    328372                                <parameter name="show" /> 
     
    336380                        </method> 
    337381 
    338                         <property name="cursor"> 
    339                                 <getter><![CDATA[ 
    340                                         return 1000 * (this._cursor.x.baseVal.value - this._ground.x.baseVal.value) / this._ground.width.baseVal.value; 
    341                                 ]]></getter> 
    342                                 <setter><![CDATA[ 
    343                                         if (val < 0) val = 0; 
    344                                         if (val > 1000 ) val = 1000; 
    345                                         this._cursor.x.baseVal.value = (val / 1000) * this._ground.width.baseVal.value  + this._ground.x.baseVal.value;  
    346                                 ]]></setter> 
    347                         </property> 
    348  
    349                         <property name="t1"> 
    350                                 <getter><![CDATA[ 
    351                                         return 1000 * (this._zone.c1.x.baseVal.value - this._ground.x.baseVal.value) / this._ground.width.baseVal.value; 
    352                                 ]]></getter> 
    353                         </property> 
    354  
    355382                        <method name="setT1"> 
    356383                                <parameter name="val" /> 
     
    364391                        </method> 
    365392 
    366                         <property name="t2"> 
    367                                 <getter><![CDATA[ 
    368                                         return 1000 * (this._zone.c2.x.baseVal.value - this._ground.x.baseVal.value)  / this._ground.width.baseVal.value; 
    369                                 ]]></getter> 
    370                         </property> 
    371                         <method name="setT2"> 
    372                                 <parameter name="val" /> 
    373                                 <parameter name="notify" /> 
    374                                 <body><![CDATA[ 
    375                                         if (val < 0) val = 0; 
    376                                         if (val > 1000 ) val = 1000; 
    377                                         this.showZone(true); 
    378                                         this._resizeZone("right", this._ground.x.baseVal.value + this._ground.width.baseVal.value * (val / 1000), notify); 
    379                                 ]]></body> 
    380                         </method> 
    381  
    382                         <property name="inner" readonly="true"> 
    383                                 <getter><![CDATA[ 
    384                                         return document.getAnonymousNodes(this)[0]; 
    385                                 ]]></getter> 
    386                         </property> 
    387393                        <method name="startplay"> 
    388394                                <body><![CDATA[ 
     
    390396                                ]]></body> 
    391397                        </method> 
     398 
    392399                        <method name="stopplay"> 
    393400                                <body><![CDATA[ 
     
    395402                                ]]></body> 
    396403                        </method> 
    397  
    398404                </implementation> 
     405 
    399406                <handlers> 
    400407                        <handler event="DOMMouseScroll"><![CDATA[ 
Note: See TracChangeset for help on using the changeset viewer.