home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2011 November
/
CHIP_2011_11.iso
/
Programy
/
Narzedzia
/
AIMP2
/
aimp_2.61.583.exe
/
$TEMP
/
YandexPackSetup.msi
/
fil7AAC6FA3217C2DECD77C16F49E1E57B9
< prev
next >
Wrap
Extensible Markup Language
|
2010-07-12
|
20KB
|
592 lines
<?xml version="1.0"?>
<bindings xmlns="http://www.mozilla.org/xbl"
xmlns:xbl="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
<binding id="prefWindow-dlgbuttons-hack">
<content style="max-height:1px; overflow: hidden; visibility: hidden">
<grid xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<columns flex="1">
<column style="width:15em"/>
<column/>
<column flex="1"/>
<column/>
</columns>
<rows flex="1">
<row flex="1">
<vbox><richlistbox/></vbox>
<vbox class="buttons-container"><button class="minimal arrow-right"/></vbox>
<vbox><richlistbox/></vbox>
<vbox class="buttons-container"><button class="minimal arrow-up"/></vbox>
</row>
<row anonid="sizes-hack"><button/><hbox/><button/><hbox/></row>
</rows>
</grid>
</content>
<implementation>
<constructor>
<![CDATA[
window.setTimeout(function(me) me.constructorEx(), 0, this);
]]>
</constructor>
<method name="constructorEx">
<body><![CDATA[
const dialog = document.documentElement;
if (dialog.hasAttribute("prefWindow-dlgbuttons-hack"))
return;
dialog.setAttribute("prefWindow-dlgbuttons-hack", "true");
function setAttributes(aElement, aAttributes) {
for (let [name, val] in Iterator(aAttributes))
aElement.setAttribute(name, val);
}
let hackChildNodes = document.getAnonymousElementByAttribute(this, "anonid", "sizes-hack").childNodes;
let [w1, w2, w3, w4] = Array.slice(hackChildNodes).map(function(aNode) aNode.boxObject.width);
let extra2Button = dialog.getButton("extra2");
let container = extra2Button.parentNode;
let clone = document.createElement("button");
setAttributes(clone, {
"command": "cmd_deleteWidgets",
"observes": "canDeleteWidgetsBroadcaster",
"class": "dialog-button",
"dlgtype": "customdelete",
"width": w1
});
if (dialog.hasAttribute("buttonlabelcustomdelete")) {
let label = document.createElement("label");
setAttributes(label, {
"flex": "1",
"crop": "end",
"class": "plain",
"value": dialog.getAttribute("buttonlabelcustomdelete"),
"style": "text-align: center;"
});
clone.appendChild(label);
}
container.insertBefore(clone, extra2Button);
let hbox = document.createElement("hbox");
hbox.setAttribute("width", w2);
container.insertBefore(hbox, extra2Button);
hbox = document.createElement("hbox");
hbox.setAttribute("width", w4);
container.appendChild(hbox);
// for macos fx35-
const appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULAppInfo)
.QueryInterface(Components.interfaces.nsIXULRuntime);
if (/darwin/i.test(appInfo.OS) && !Components.interfaces.nsIDOMGeoPositionAddress) {
let btnMargin = hackChildNodes[0].boxObject.screenX;
btnMargin -= clone.boxObject.screenX;
btnMargin += parseInt(window.getComputedStyle(clone, null).getPropertyValue("margin-left"), 10);
clone.setAttribute("style", "margin-left:" + btnMargin + "px");
}
]]></body>
</method>
</implementation>
</binding>
<binding id="button-minimal"
extends="chrome://global/content/bindings/button.xml#button"
inheritstyle="false">
<resources>
<stylesheet src="button.css"/>
</resources>
<content pack="center" align="center">
<xul:image/>
</content>
</binding>
<binding id="richlistbox"
extends="chrome://global/content/bindings/richlistbox.xml#richlistbox">
<implementation>
<field name="mDNDDataType">"application/x-xb-node"</field>
<method name="clear">
<body><![CDATA[
this.clearSelection();
while (this.firstChild)
this.removeChild(this.firstChild);
]]></body>
</method>
<method name="insertItem">
<parameter name="aIsUnique"/>
<parameter name="aIsRemovable"/>
<parameter name="aId"/>
<parameter name="aLabel"/>
<parameter name="aIconURL"/>
<parameter name="aBeforeId"/>
<body><![CDATA[
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
let richlistitem = this.ownerDocument.createElementNS(XULNS, "richlistitem");
richlistitem.setAttribute("id", aId);
richlistitem.setAttribute("isUnique", aIsUnique);
richlistitem.setAttribute("isRemovable", aIsRemovable);
richlistitem.setAttribute("label", aLabel);
richlistitem.setAttribute("image", aIconURL);
let beforeElement = aBeforeId ? document.getElementById(aBeforeId) : null;
if (beforeElement && beforeElement.parentNode == this)
this.insertBefore(richlistitem, beforeElement);
else
this.appendChild(richlistitem);
return richlistitem;
]]></body>
</method>
<property name="selectedItemsSorted" reodonly="true">
<getter><![CDATA[
let selectedItems = Array.slice(this.selectedItems);
let len = selectedItems.length;
if (!len)
return null;
let me = this;
selectedItems = selectedItems.sort(function(a,b) {
let indxA = me.getIndexOfItem(a);
let indxB = me.getIndexOfItem(b);
return (indxA > indxB) ? 1 : (indxA < indxB) ? -1 : 0;
});
return selectedItems;
]]></getter>
</property>
<method name="_dragWithCustomImage">
<parameter name="aEvent"/>
<parameter name="aRect"/>
<body><![CDATA[
let doc = this.ownerDocument;
let canvas = doc.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
canvas.width = aRect.right - aRect.left;
canvas.height = aRect.bottom - aRect.top;
let ctx = canvas.getContext("2d");
ctx.drawWindow(doc.defaultView,
aRect.left,
aRect.top,
aRect.right,
aRect.bottom,
"rgb(255,255,255)");
let dt = aEvent.dataTransfer;
dt.effectAllowed = "move";
dt.setDragImage(canvas, 5, 5);
]]></body>
</method>
<method name="_getListitemFromEvent">
<parameter name="aEvent"/>
<body><![CDATA[
return aEvent.dataTransfer.mozGetDataAt(this.mDNDDataType, 0);
]]></body>
</method>
</implementation>
<handlers>
<handler event="dragstart"><![CDATA[
if (!(event.target && event.target.localName == "richlistitem"))
return;
// <menu/> DnD
let originalTarget = event.originalTarget;
if (originalTarget && (originalTarget.localName == "menuitem" || originalTarget.localName == "thumb"))
return;
if ("expandItem" in this)
this.expandItem(null);
let selectedItems = this.selectedItemsSorted;
let len = selectedItems.length;
if (!len)
return;
for (let i = 0; i < len; i++)
event.dataTransfer.mozSetDataAt(this.mDNDDataType, selectedItems[i], i);
if (len == 1 && "collapsedSettings" in selectedItems[0])
selectedItems[0].collapsedSettings = true;
let listRect = this.getBoundingClientRect();
let firstRect = selectedItems[0].getBoundingClientRect();
let lastRect = selectedItems[len-1].getBoundingClientRect();
let rect = {
left: firstRect.left,
right: firstRect.right,
top: firstRect.top > listRect.top ? firstRect.top : listRect.top,
bottom: lastRect.bottom < listRect.bottom ? lastRect.bottom : listRect.bottom
};
this._dragWithCustomImage(event, rect);
]]></handler>
</handlers>
</binding>
<binding id="richlistbox-registered" extends="#richlistbox">
<handlers>
<handler event="dragover"><![CDATA[
let listitem = this._getListitemFromEvent(event);
if (listitem && listitem.parentNode !== this)
event.preventDefault();
]]></handler>
<handler event="drop"><![CDATA[
if (this._getListitemFromEvent(event))
Preferences.doCommand("cmd_removeWidgets");
]]></handler>
<handler event="focus" phase="capturing"><![CDATA[
if (event.target == this)
Preferences.checkControls();
]]></handler>
<handler event="blur" phase="capturing"><![CDATA[
if (event.target == this)
Preferences.checkControls();
]]></handler>
</handlers>
</binding>
<binding id="richlistbox-active" extends="#richlistbox">
<implementation>
<field name="mDragOverAttrName">"xb-dragover-node"</field>
<field name="mLastDragOverId">null</field>
<method name="moveSelectedItems">
<parameter name="aDirection"/>
<parameter name="aBeforeElementId"/>
<body><![CDATA[
let selectedItems = this.selectedItemsSorted;
if (!selectedItems)
return;
let len = selectedItems.length;
if (len == this.itemCount)
return;
let beforeElement;
if (aBeforeElementId)
beforeElement = document.getElementById(aBeforeElementId);
if (aDirection == "down")
beforeElement = beforeElement ? beforeElement.nextSibling : null;
while (beforeElement && selectedItems.indexOf(beforeElement) != -1)
beforeElement = beforeElement.nextSibling;
this.clearSelection();
if (len == 1 && !selectedItems[0].collapsedSettings)
selectedItems[0].collapsedSettings = true;
let docFrag = this.ownerDocument.createDocumentFragment();
for (let i = 0; i < len; i++)
docFrag.appendChild(this.removeChild(selectedItems[i]));
beforeElement ? this.insertBefore(docFrag, beforeElement)
: this.appendChild(docFrag);
this.selectItemRange(selectedItems[0], selectedItems[len - 1]);
]]></body>
</method>
<method name="expandItem">
<parameter name="aItem"/>
<parameter name="aSwitchState"/>
<body><![CDATA[
let state = this.getAttribute("last-selected").split(" ");
if (state) {
state.forEach(function(aId) {
let item = aId ? document.getElementById(aId) : null;
if (item && item != aItem)
item.collapsedSettings = true;
});
}
this._timedExpandItem(aItem, aSwitchState);
]]></body>
</method>
<field name="_timedExpandItemTimer">null</field>
<method name="stopExpandItem">
<body><![CDATA[
if (this._timedExpandItemTimer) {
window.clearTimeout(this._timedExpandItemTimer);
this._timedExpandItemTimer = null;
}
]]></body>
</method>
<method name="_timedExpandItem">
<parameter name="aItem"/>
<parameter name="aSwitchState"/>
<body><![CDATA[
this.stopExpandItem();
this._timedExpandItemTimer = window.setTimeout(function(item, switchState) {
if (item && "collapsedSettings" in item)
item.collapsedSettings = (typeof switchState == "undefined") ? false : !item.collapsedSettings;
}, 250, aItem, aSwitchState);
]]></body>
</method>
</implementation>
<handlers>
<handler event="click" button="0">
<![CDATA[
let target = event.target;
if (target.localName == "richlistitem" &&
this.selectedItems.length == 1 &&
target.isClickedOnCaption(event))
this.expandItem(target, true);
]]>
</handler>
<handler event="DOMMenuItemActive">
this.expandItem(this.selectedItems.length == 1 ? this.selectedItem : null);
</handler>
<handler event="dragover"><![CDATA[
let listitem = this._getListitemFromEvent(event);
if (!listitem)
return;
let target = event.target;
if (target && target == this.lastChild) {
let { top: top, bottom: bottom } = target.getBoundingClientRect();
let halfPoint = top + parseInt((bottom - top) / 2, 10);
if (halfPoint < event.clientY) {
target.setAttribute(this.mDragOverAttrName, "after");
this.mLastDragOverId = null;
} else {
target.setAttribute(this.mDragOverAttrName, "before");
this.mLastDragOverId = target.id;
}
}
event.preventDefault();
]]></handler>
<handler event="dragenter"><![CDATA[
let listitem = this._getListitemFromEvent(event);
if (!listitem)
return;
let target = event.target;
if (target.localName != "richlistitem")
return;
target.setAttribute(this.mDragOverAttrName, "before");
this.mLastDragOverId = target.id;
window.setTimeout(function(me, target) {
if (!(me && target && target.parentNode == me && "ensureElementIsVisible" in me))
return;
let listRect = me.getBoundingClientRect();
let prevSibling = target.previousSibling;
if (prevSibling) {
let { top: top } = prevSibling.getBoundingClientRect();
if (top < listRect.top) {
me.ensureElementIsVisible(prevSibling);
return;
}
}
let nextSibling = target.nextSibling;
if (nextSibling) {
let { bottom: bottom } = nextSibling.getBoundingClientRect();
if (bottom > listRect.bottom) {
me.ensureElementIsVisible(nextSibling);
return;
}
}
me.ensureElementIsVisible(target);
}, 150, this, target);
event.preventDefault();
]]></handler>
<handler event="dragleave"><![CDATA[
let listitem = this._getListitemFromEvent(event);
if (listitem) {
let target = event.target;
if (target.localName == "richlistitem") {
target.removeAttribute(this.mDragOverAttrName);
} else if (target == this) {
this.mLastDragOverId = null;
}
}
]]></handler>
<handler event="drop"><![CDATA[
let listitem = this._getListitemFromEvent(event);
if (listitem) {
let nodeBefore = this.mLastDragOverId ? document.getElementById(this.mLastDragOverId) : null;
let cmd = listitem.parentNode == this ? "cmd_moveWidgets" : "cmd_addWidgets";
Preferences.doCommand(cmd, nodeBefore);
}
this.mLastDragOverId = null;
]]></handler>
</handlers>
</binding>
<binding id="richlistitem-base"
extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
<implementation>
<property name="isUnique" readonly="true"
onget="return this.getAttribute('isUnique') == 'true';"/>
<property name="isRemovable" readonly="true"
onget="return this.getAttribute('isRemovable') == 'true';"/>
</implementation>
</binding>
<binding id="registered-richlistitem" extends="#richlistitem-base">
<content>
<xul:hbox flex="1" xbl:inherits="tooltiptext=label" anonid="caption">
<xul:hbox align="center" pack="center">
<xul:image class="xb-widget-icon" xbl:inherits="src=image"/>
</xul:hbox>
<xul:label xbl:inherits="value=label" flex="1" crop="end"/>
</xul:hbox>
</content>
<handlers>
<handler event="dblclick" button="0"><![CDATA[
if (event.target == this)
Preferences.doCommand("cmd_addWidgets");
]]></handler>
</handlers>
</binding>
<binding id="active-richlistitem" extends="#richlistitem-base">
<content collapsedSettings="true">
<xul:vbox flex="1">
<xul:hbox flex="1" anonid="caption">
<xul:hbox align="center" pack="center">
<xul:image class="xb-widget-icon" xbl:inherits="src=image"/>
</xul:hbox>
<xul:label xbl:inherits="value=label" flex="1" crop="end"/>
</xul:hbox>
<xul:vbox anonid="settingsContainer" xbl:inherits="collapsed=collapsedSettings">
<children/>
</xul:vbox>
</xul:vbox>
</content>
<implementation>
<field name="mListitemCaption">
document.getAnonymousElementByAttribute(this, "anonid", "caption")
</field>
<field name="settingsContainer">
document.getAnonymousElementByAttribute(this, "anonid", "settingsContainer")
</field>
<property name="collapsedSettings">
<getter><![CDATA[
return this.getAttribute("collapsedSettings") == "true";
]]></getter>
<setter><![CDATA[
let collapsedBefore = this.collapsedSettings;
this.setAttribute("collapsedSettings", !!val);
if (collapsedBefore == this.collapsedSettings)
return;
if (collapsedBefore) {
ActiveWidgetsController.initItemSettings(this);
this.parentNode.ensureElementIsVisible(this);
} else {
let focusedElement = document.commandDispatcher.focusedElement;
if (focusedElement &&
focusedElement.ownerDocument == document &&
focusedElement.localName == "input") {
focusedElement.blur();
}
let settingsContainer = this.settingsContainer;
while (settingsContainer.firstChild) {
settingsContainer.firstChild.blur();
settingsContainer.removeChild(settingsContainer.firstChild);
}
}
]]></setter>
</property>
<method name="isClickedOnCaption">
<parameter name="aEvent"/>
<body><![CDATA[
if (aEvent.target == this) {
try {
return (aEvent.originalTarget == this.mListitemCaption) ||
!!(this.mListitemCaption.compareDocumentPosition(aEvent.originalTarget)
& Node.DOCUMENT_POSITION_CONTAINED_BY);
} catch(e) {}
}
return false;
]]></body>
</method>
</implementation>
<handlers>
<handler event="dblclick" button="0"><![CDATA[
if (this.isClickedOnCaption(event))
Preferences.doCommand("cmd_removeWidgets");
]]></handler>
</handlers>
</binding>
</bindings>