- Timestamp:
- 03/10/10 18:47:48 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Xul_Core/content/scenariCore/widgets/matrix/slotContents.xbl.xml
r15048 r15093 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <!-- 3 * LICENCE[[4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1/CeCILL 2.O5 *6 * The contents of this file are subject to the Mozilla Public License Version7 * 1.1 (the "License"); you may not use this file except in compliance with8 * the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/9 *10 * Software distributed under the License is distributed on an "AS IS" basis,11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License12 * for the specific language governing rights and limitations under the13 * License.14 *15 * The Original Code is kelis.fr code.16 *17 * The Initial Developer of the Original Code is18 * sylvain.spinelli@kelis.fr19 *20 * Portions created by the Initial Developer are Copyright (C) 2009-201021 * the Initial Developer. All Rights Reserved.22 *23 * Contributor(s):24 * samuel.monsarrat@kelis.fr25 *26 *27 * Alternatively, the contents of this file may be used under the terms of28 * either of the GNU General Public License Version 2 or later (the "GPL"),29 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),30 * or the CeCILL Licence Version 2.0 (http://www.cecill.info/licences.en.html),31 * in which case the provisions of the GPL, the LGPL or the CeCILL are applicable32 * instead of those above. If you wish to allow use of your version of this file33 * only under the terms of either the GPL or the LGPL, and not to allow others34 * to use your version of this file under the terms of the MPL, indicate your35 * decision by deleting the provisions above and replace them with the notice36 * and other provisions required by the GPL or the LGPL. If you do not delete37 * the provisions above, a recipient may use your version of this file under38 * the terms of any one of the MPL, the GPL, the LGPL or the CeCILL.39 * ]]LICENCE40 -->3 * LICENCE[[ 4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1/CeCILL 2.O 5 * 6 * The contents of this file are subject to the Mozilla Public License Version 7 * 1.1 (the "License"); you may not use this file except in compliance with 8 * the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ 9 * 10 * Software distributed under the License is distributed on an "AS IS" basis, 11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 12 * for the specific language governing rights and limitations under the 13 * License. 14 * 15 * The Original Code is kelis.fr code. 16 * 17 * The Initial Developer of the Original Code is 18 * sylvain.spinelli@kelis.fr 19 * 20 * Portions created by the Initial Developer are Copyright (C) 2009-2010 21 * the Initial Developer. All Rights Reserved. 22 * 23 * Contributor(s): 24 * samuel.monsarrat@kelis.fr 25 * 26 * 27 * Alternatively, the contents of this file may be used under the terms of 28 * either of the GNU General Public License Version 2 or later (the "GPL"), 29 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 30 * or the CeCILL Licence Version 2.0 (http://www.cecill.info/licences.en.html), 31 * in which case the provisions of the GPL, the LGPL or the CeCILL are applicable 32 * instead of those above. If you wish to allow use of your version of this file 33 * only under the terms of either the GPL or the LGPL, and not to allow others 34 * to use your version of this file under the terms of the MPL, indicate your 35 * decision by deleting the provisions above and replace them with the notice 36 * and other provisions required by the GPL or the LGPL. If you do not delete 37 * the provisions above, a recipient may use your version of this file under 38 * the terms of any one of the MPL, the GPL, the LGPL or the CeCILL. 39 * ]]LICENCE 40 --> 41 41 42 42 <bindings xmlns="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:xbl="http://www.mozilla.org/xbl"> 43 43 44 44 <!-- 45 Slot des views principales (mainviews) éditables.46 Les views filles de ce slot peuvent définir les attributs supplémentairees suivants47 - dirty : view dirty nécessitant d'être enregistrée avant d'être fermée.48 - locked : Même si il n'est pas dirty, évite de remplacer le contenu.49 -->45 Slot des views principales (mainviews) éditables. 46 Les views filles de ce slot peuvent définir les attributs supplémentairees suivants 47 - dirty : view dirty nécessitant d'être enregistrée avant d'être fermée. 48 - locked : Même si il n'est pas dirty, évite de remplacer le contenu. 49 --> 50 50 <binding id="slotContents" extends="chrome://scenariCore/content/widgets/matrix/matrix.xbl.xml#slot-base"> 51 51 <content orient="vertical" flex="1" slotTabLocalName="slotTabContent" autoCollapse="false"> … … 56 56 </xul:arrowscrollbox> 57 57 <!-- TODO Historique 58 <xul:toolbarbutton label="<" oncommand=""/>59 <xul:toolbarbutton label=">" oncommand=""/>60 -->58 <xul:toolbarbutton label="<" oncommand=""/> 59 <xul:toolbarbutton label=">" oncommand=""/> 60 --> 61 61 <xul:toolbarbutton anonid="maxBtn" oncommand="document.getBindingParent(this).toggleMaximizeBlock();"/> 62 62 </xul:hbox> … … 75 75 <parameter name="pView"/> 76 76 <body><![CDATA[ 77 try { 78 pTab.setAttribute("label", pView.getAttribute("label")||""); 79 pTab.setAttribute("image", pView.getAttribute("iconUrl")||""); 80 pTab.setAttribute("tooltiptext", pView.getAttribute("longDesc")||""); 81 pTab.setAttribute("accesskey", pView.getAttribute("accesskey")||""); 82 pTab.setAttribute("notClosable", ! (pView.getAttribute("closable")=="true")); 83 pTab.fSlot = this; 84 if(pView.getAttribute("dirty")=="true") { 85 pTab.setAttribute("dirty", "true"); 86 } else { 87 pTab.removeAttribute("dirty"); 77 try { 78 pTab.setAttribute("label", pView.getAttribute("label")||""); 79 pTab.setAttribute("image", pView.getAttribute("iconUrl")||""); 80 pTab.setAttribute("tooltiptext", pView.getAttribute("longDesc")||""); 81 pTab.setAttribute("accesskey", pView.getAttribute("accesskey")||""); 82 pTab.setAttribute("notClosable", ! (pView.getAttribute("closable")=="true")); 83 pTab.fSlot = this; 84 if(pView.getAttribute("dirty")=="true") { 85 pTab.setAttribute("dirty", "true"); 86 } else { 87 pTab.removeAttribute("dirty"); 88 } 89 if(pView.getAttribute("locked")=="true") { 90 pTab.setAttribute("locked", "true"); 91 if(pTab.fOptionMnuPinTab) pTab.fOptionMnuPinTab.setAttribute("checked", true); 92 } else { 93 pTab.removeAttribute("locked"); 94 if(pTab.fOptionMnuPinTab) pTab.fOptionMnuPinTab.setAttribute("checked", false); 95 } 96 } catch(e) { 97 log.debug("slot.fillTab::"+e); 88 98 } 89 if(pView.getAttribute("locked")=="true") {90 pTab.setAttribute("locked", "true");91 if(pTab.fOptionMnuPinTab) pTab.fOptionMnuPinTab.setAttribute("checked", true);92 } else {93 pTab.removeAttribute("locked");94 if(pTab.fOptionMnuPinTab) pTab.fOptionMnuPinTab.setAttribute("checked", false);95 }96 } catch(e) {97 log.debug("slot.fillTab::"+e);98 }99 99 ]]></body> 100 100 </method> … … 110 110 <method name="closeAllTabs"> 111 111 <body><![CDATA[ 112 try { 113 var vTab = this.fTabsContainer.firstElementChild; 114 while(vTab && vTab.fView.getAttribute("locked")) vTab = vTab.nextElementSibling; 115 while(vTab) { 116 if( ! vTab.closeTab()) return; 117 vTab = this.fTabsContainer.firstElementChild; 112 try { 113 var vTab = this.fTabsContainer.firstElementChild; 118 114 while(vTab && vTab.fView.getAttribute("locked")) vTab = vTab.nextElementSibling; 115 while(vTab) { 116 if( ! vTab.closeTab()) return; 117 vTab = this.fTabsContainer.firstElementChild; 118 while(vTab && vTab.fView.getAttribute("locked")) vTab = vTab.nextElementSibling; 119 } 120 }catch(e){ 121 log.debug("slot.closeAllTabs::"+e); 119 122 } 120 }catch(e){121 log.debug("slot.closeAllTabs::"+e);122 }123 123 ]]></body> 124 124 </method> … … 127 127 <parameter name="pCurrentTab"/> 128 128 <body><![CDATA[ 129 try { 130 log.info("closing all exept: "+pCurrentTab.label); 131 var vTab = pCurrentTab.nextElementSibling; 132 while(vTab && vTab.fView.getAttribute("locked")) vTab = vTab.nextElementSibling; 133 while(vTab) { 134 if( ! vTab.closeTab()) return; 135 vTab = pCurrentTab.nextElementSibling; 129 try { 130 log.info("closing all exept: "+pCurrentTab.label); 131 var vTab = pCurrentTab.nextElementSibling; 136 132 while(vTab && vTab.fView.getAttribute("locked")) vTab = vTab.nextElementSibling; 133 while(vTab) { 134 if( ! vTab.closeTab()) return; 135 vTab = pCurrentTab.nextElementSibling; 136 while(vTab && vTab.fView.getAttribute("locked")) vTab = vTab.nextElementSibling; 137 } 138 vTab = pCurrentTab.previousElementSibling; 139 while(vTab && vTab.fView.getAttribute("locked")) vTab = vTab.previousElementSibling; 140 while(vTab) { 141 var vPrvTab = vTab.previousElementSibling; 142 while(vPrvTab && vPrvTab.fView.getAttribute("locked")) vPrvTab = vPrvTab.previousElementSibling; 143 if( ! vTab.closeTab()) return; 144 vTab = vPrvTab; 145 } 146 }catch(e){ 147 log.debug("slot.closeOtherTabs::"+e); 137 148 } 138 vTab = pCurrentTab.previousElementSibling;139 while(vTab && vTab.fView.getAttribute("locked")) vTab = vTab.previousElementSibling;140 while(vTab) {141 var vPrvTab = vTab.previousElementSibling;142 while(vPrvTab && vPrvTab.fView.getAttribute("locked")) vPrvTab = vPrvTab.previousElementSibling;143 if( ! vTab.closeTab()) return;144 vTab = vPrvTab;145 }146 }catch(e){147 log.debug("slot.closeOtherTabs::"+e);148 }149 149 ]]></body> 150 150 </method> … … 155 155 <!-- Interne : onglets destinés pour le slotContents --> 156 156 <binding id="slotTabContent" extends="chrome://scenariCore/content/widgets/matrix/matrix.xbl.xml#slotTab"> 157 <content align="top" >158 <children>159 <xul:stack>160 <xul:hbox anonid="tabLabel" class="tabLabel" align="center">161 <xul:image class="tabLabelIco" xbl:inherits="src=image"/>162 <xul:label class="small-margin tabLabelTxt" xbl:inherits="value=label" minwidth="20" crop="end"/>163 <xul:image class="tabLabelFlags"/>164 </xul:hbox>165 <xul:hbox anonid="tabTools" class="tabTools" pack="end" align="top">166 <xul:hbox anonid="tabToolBar">167 <xul:toolbarbutton anonid="optionBtn" class="optionBtn" onmousedown="document.getBindingParent(this).showOptionMnu(this)" tooltiptext="Options..."/>168 <xul:toolbarbutton anonid="closeBtn" class="closeBtn" oncommand="document.getBindingParent(this).closeTab();" tooltiptext="Fermer cet onglet"/>169 </xul:hbox>170 </xul:hbox>171 <xul:popup anonid="optionMnu">172 <xul:menuitem anonid="optionMnu.pinTab" label="Figer cet onglet" type="checkbox" oncommand="document.getBindingParent(this).pinTab();" tooltiptext=""/>173 <xul:menuseparator/>174 <xul:menuitem anonid="optionMnu.closeTab" label="Fermer cet onglet" oncommand="document.getBindingParent(this).closeTab();" tooltiptext=""/>175 <xul:menuitem anonid="optionMnu.closeOtherTabs" label="Fermer les autres onglets" oncommand="document.getBindingParent(this).fSlot.closeOtherTabs(document.getBindingParent(this));" tooltiptext=""/>176 <xul:menuitem anonid="optionMnu.closeAllTabs" label="Fermer tous les onglets" oncommand="document.getBindingParent(this).fSlot.closeAllTabs();" tooltiptext=""/>177 </xul:popup>178 </xul:stack>179 </children>157 <content align="top" contextmenu="_child"> 158 <xul:menupopup anonid="optionMnu"> 159 <xul:menuitem anonid="optionMnu.pinTab" label="Figer cet onglet" type="checkbox" oncommand="document.getBindingParent(this).pinTab();" tooltiptext=""/> 160 <xul:menuseparator/> 161 <xul:menuitem anonid="optionMnu.closeTab" label="Fermer cet onglet" oncommand="document.getBindingParent(this).closeTab();" tooltiptext=""/> 162 <xul:menuitem anonid="optionMnu.closeOtherTabs" label="Fermer les autres onglets" oncommand="document.getBindingParent(this).fSlot.closeOtherTabs(document.getBindingParent(this));" tooltiptext=""/> 163 <xul:menuitem anonid="optionMnu.closeAllTabs" label="Fermer tous les onglets" oncommand="document.getBindingParent(this).fSlot.closeAllTabs();" tooltiptext=""/> 164 </xul:menupopup> 165 <xul:stack> 166 <xul:hbox anonid="tabLabel" class="tabLabel" align="center"> 167 <children> 168 <xul:image class="tabLabelIco" xbl:inherits="src=image"/> 169 <xul:label class="small-margin tabLabelTxt" xbl:inherits="value=label" minwidth="20" crop="end"/> 170 </children> 171 <xul:image class="tabLabelFlags"/> 172 </xul:hbox> 173 <xul:hbox anonid="tabTools" class="tabTools" pack="end" align="top"> 174 <xul:hbox anonid="tabToolBar"> 175 <xul:toolbarbutton anonid="optionBtn" class="optionBtn" onmousedown="document.getBindingParent(this).showOptionMnu(this)" tooltiptext="Options..."/> 176 <xul:toolbarbutton anonid="closeBtn" class="closeBtn" oncommand="document.getBindingParent(this).closeTab();" tooltiptext="Fermer cet onglet"/> 177 </xul:hbox> 178 </xul:hbox> 179 </xul:stack> 180 180 </content> 181 181 <implementation> 182 <field name="fOptionMnu">document.getAnonymousElementByAttribute(this, "anonid", "optionMnu")</field>183 182 <field name="fOptionMnuPinTab">document.getAnonymousElementByAttribute(this, "anonid", "optionMnu.pinTab")</field> 184 183 <field name="fOptionMnuCloseOtherTabs">document.getAnonymousElementByAttribute(this, "anonid", "optionMnu.closeOtherTabs")</field> 185 184 <field name="fOptionMnuCloseAllTabs">document.getAnonymousElementByAttribute(this, "anonid", "optionMnu.closeAllTabs")</field> 186 <method name=" showOptionMnu">187 <parameter name="p Node"/>188 <body><![CDATA[ 189 try{190 var vHasTabs = this.fSlot.fTabsContainer.childElementCount > 1;191 this.fOptionMnuCloseOtherTabs.hidden = !vHasTabs;192 this.fOptionMnuCloseAllTabs.hidden = !vHasTabs;193 this.fOptionMnu.openPopup(pNode, 'after_start', 0, 1, true, false);194 }catch(e){log.debug("slotTabContent.showOptionMnu: "+e);}185 <method name="onPopupShowing"> 186 <parameter name="pEvent"/> 187 <body><![CDATA[ 188 try{ 189 var vHasTabs = this.fSlot.fTabsContainer.childElementCount > 1; 190 this.fOptionMnuCloseOtherTabs.hidden = !vHasTabs; 191 this.fOptionMnuCloseAllTabs.hidden = !vHasTabs; 192 this.fOptionMnu.openPopup(pNode, 'after_start', 0, 1, true, false); 193 }catch(e){log.debug("slotTabContent.onPopupShowing : "+e);} 195 194 ]]></body> 196 195 </method> 197 196 <method name="pinTab"> 198 197 <body><![CDATA[ 199 try{200 var vPinned = this.fView.getAttribute("locked") || false;201 vPinned = !vPinned;202 this.fOptionMnuPinTab.setAttribute("checked", vPinned);203 this.fView.setAttribute("locked", vPinned);204 if (vPinned) {205 this.setAttribute("locked", "true");206 this.fView.setAttribute("locked", "true");207 } else {208 this.removeAttribute("locked");209 this.fView.removeAttribute("locked");210 }211 }catch(e){log.debug("slotTabContent.pinTab : "+e);}198 try{ 199 var vPinned = this.fView.getAttribute("locked") || false; 200 vPinned = !vPinned; 201 this.fOptionMnuPinTab.setAttribute("checked", vPinned); 202 this.fView.setAttribute("locked", vPinned); 203 if (vPinned) { 204 this.setAttribute("locked", "true"); 205 this.fView.setAttribute("locked", "true"); 206 } else { 207 this.removeAttribute("locked"); 208 this.fView.removeAttribute("locked"); 209 } 210 }catch(e){log.debug("slotTabContent.pinTab : "+e);} 212 211 ]]></body> 213 212 </method> 214 213 </implementation> 215 <handlers>216 <handler event="mousedown" button="2" phase="capturing"><![CDATA[217 if (event.originalTarget.getAttribute("anonid") == "tabTools") {218 event.stopPropagation();219 this.showOptionMnu(document.getAnonymousElementByAttribute(this, "anonid", "tabLabel"));220 }221 ]]></handler>222 </handlers>223 214 </binding> 224 215 </bindings>
Note: See TracChangeset
for help on using the changeset viewer.