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
/
fil8A763788427A9770297D9860F5C8DEE4
< prev
next >
Wrap
Extensible Markup Language
|
2010-07-12
|
13KB
|
346 lines
<?xml version="1.0"?>
<!DOCTYPE bindings PUBLIC "-//MOZILLA//DTD XBL V1.0//EN" "http://www.mozilla.org/xbl">
<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="widget-base">
<implementation>
<field name="appName" readonly="true">this.getAttribute("xb-app")</field>
<field name="core" readonly="true">Components.classes["@yandex.ru/custombarcore;" + this.appName].getService().wrappedJSObject</field>
<field name="application" readonly="true">this.core.application</field>
<field name="isXBWidget" readonly="true">true</field>
<field name="_instanceID">""</field>
<field name="_isFromDefaultSet">false</field>
<property name="_isABlank" readonly="true" onget="return (this._instanceID == '0')"/>
<property name="prototypeID" readonly="true" onget="return this.getAttribute('xb-proto-id');"/>
<property name="instanceID" readonly="true" onget="return this._instanceID;"/>
<property name="prototype" readonly="true" onget="return this.application.widgetLibrary.getWidgetProto(this.prototypeID);"/>
<property name="isUnique" readonly="true" onget="return this.prototype.isUnique;"/>
<constructor><![CDATA[
var info = this.application.overlayProvider.parseWidgetItemId(this.id, true);
this._instanceID = info.instanceID;
this._isFromDefaultSet = !!info.isFromDefaultSet;
this.settings = info.settings;
]]></constructor>
<method name="_widgetRemoved">
<parameter name="controller"/>
<parameter name="eraseSettingsIfNeeded"/>
<body><![CDATA[
var engine = controller.windowEngine;
if (!engine.hasWidget(this._instanceID))
return;
engine.destroyWidget(this._instanceID, eraseSettingsIfNeeded);
this.application.overlayProvider.widgetItemRemoved(this._instanceID);
]]></body>
</method>
</implementation>
</binding>
<binding id="widget" extends="#widget-base">
<implementation implements="nsIDOMEventListener">
<field name="_overlayController">window[this.appName + "OverlayController"]</field>
<field name="_logger" readonly="true">this._overlayController._logger;</field>
<field name="_engine">this._overlayController.windowEngine</field>
<property name="constructed"
onget="return this.getAttribute('constructed') === 'true'"
onset="return this.setAttribute('constructed', !!val)" />
<property name="killed"
onget="return this.getAttribute('killed') === 'true'"
onset="return this.setAttribute('killed', !!val)" />
<constructor><![CDATA[
try {
this.constructorEx();
}
catch(e) {
this._logger.error("Couldn't construct widget item. " + this.core.Lib.misc.formatError(e));
this._logger.debug(e.stack);
}
]]></constructor>
<destructor><![CDATA[
this.destructorEx();
]]></destructor>
<method name="constructorEx">
<body><![CDATA[
if (this.constructed || this.killed)
return;
this._logger.debug("Widget item constructorEx, id: " + [this.id, this.constructed, this.killed]);
var destInstID = this._instanceID;
if (this._isABlank) {
let spawnedWidgets = this.prototype.spawnedWidgets;
if (this.isUnique && spawnedWidgets.length > 0)
destInstID = spawnedWidgets[0].id;
else
destInstID = this.application.getNewWidgetInstanceID();
}
var destID = this.application.overlayProvider.compileWidgetItemId(this.prototypeID, destInstID);
this.paletteMagic(destID);
if (this._isABlank || this._isFromDefaultSet) {
this._instanceID = destInstID;
this.id = destID;
this._logger.debug("Widget item changed id to " + this.id);
}
this._engine.createWidget(this.prototypeID, this._instanceID, this.settings, this);
this.constructed = true;
]]></body>
</method>
<method name="destructorEx">
<body><![CDATA[
this._widgetRemoved(this._overlayController);
]]></body>
</method>
<method name="switchOn">
<parameter name="on"/>
<body><![CDATA[
if (on)
this.constructorEx();
else
this.destructorEx();
]]></body>
</method>
<method name="kill">
<body><![CDATA[
if (!Components.interfaces.nsIWorker) { // FF-3.0
try {
this._deletePhantom();
}
catch (e) {
this._logger.error("Error while deleting phantom palette item. " + e);
}
}
this._widgetRemoved(this._overlayController, true);
this.killed = true;
]]></body>
</method>
<method name="paletteMagic">
<parameter name="destID"/>
<body><![CDATA[
try {
var palette = document.getElementById("navigator-toolbox").palette;
var paletteItemID = this.id;
var copies = palette.getElementsByAttribute("id", paletteItemID);
var isFx35plus = !!Components.interfaces.nsIWorker;
if (!copies.length && ((!this.isUnique && this._isABlank) || this._isFromDefaultSet)) {
this._logger.debug("Cloning to palette " + paletteItemID);
let paletteItem = this.application.overlayProvider.makePaletteItem(document, this.prototype, this._instanceID);
for (let name in {"id": 0, "xb-app": 0, "xb-proto-id": 0, "xb-widget": 0, "label": 0, "image": 0})
paletteItem.setAttribute(name, this.getAttribute(name));
palette.appendChild(paletteItem);
} else {
this._logger.debug("Removing copies of " + paletteItemID);
let maxCopiesNumber = isFx35plus ? 0 : 1;
while (copies.length > maxCopiesNumber) {
let copy = copies.item(0);
copy.parentNode.removeChild(copy);
}
}
if (!isFx35plus && !palette.getElementsByAttribute("id", destID).length) {
let paletteItem = this.application.overlayProvider.makePaletteItem(document, this.prototype, this._instanceID);
paletteItem.setAttribute("id", destID);
paletteItem.setAttribute("phantom", "true");
palette.appendChild(paletteItem);
}
}
catch (e) {
this._logger.error("Palette magic failed. " + this.core.Lib.misc.formatError(e));
}
]]></body>
</method>
<method name="_deletePhantom">
<body><![CDATA[
var palette = document.getElementById("navigator-toolbox").palette;
var paletteItemID = this.id;
var copies = palette.getElementsByAttribute("id", paletteItemID);
while (copies.length > 0) {
let copy = copies.item(0);
copy.parentNode.removeChild(copy);
}
]]></body>
</method>
</implementation>
</binding>
<binding id="widget-customize" extends="#widget-base">
<content>
<xul:vbox>
<xul:hbox pack="center">
<xul:image xbl:inherits="src=image"/>
</xul:hbox>
<xul:label xbl:inherits="value=label" crop="end"/>
<xul:box hidden="true">
<children/>
</xul:box>
</xul:vbox>
</content>
<implementation>
<field name="_logger" readonly="true">this.application._logger</field>
<field name="_boundWindow" readonly="true">gToolboxDocument.defaultView</field>
<field name="_controller" readonly="true">this._boundWindow[this.appName + "OverlayController"]</field>
<field name="isPhantom" readonly="true">(this.getAttribute("phantom") == "true")</field>
<constructor><![CDATA[
var isFx35plus = !!Components.interfaces.nsIWorker;
var wasTakenFromToolbar = !(this._isFromDefaultSet || this._instanceID == 0);
if (this._instanceID != 0)
this._logger.debug("widget-customize " + this.id);
if (this.isPhantom)
this._logger.debug("Phantom " + this.id);
if (wasTakenFromToolbar) {
this._widgetRemoved(this._controller, true);
if (!this.isPhantom) {
this._instanceID = "0";
var oldId = this.id,
newId = this.application.overlayProvider.compileWidgetItemId(this.prototypeID, this._instanceID);
this.id = newId;
if (this.parentNode.id.indexOf("wrapper-") == 0)
this.parentNode.id = "wrapper-" + newId;
setTimeout(this.modifyPalette, 1, oldId, this.isUnique? newId: null);
}
}
var paletteCopy = (gToolbox.palette.getElementsByAttribute("id", this.id).length > 0) && isFx35plus;
var hasSpawns = (this.prototype.spawnedWidgets.length > 0);
if (this.isPhantom)
this._logger.debug([this._isFromDefaultSet, wasTakenFromToolbar, paletteCopy, hasSpawns]);
if (this._isFromDefaultSet
|| (this.isUnique && hasSpawns) && !this.isPhantom
|| (wasTakenFromToolbar && paletteCopy)) {
var item = this.parentNode,
row = item.parentNode;
row.removeChild(item);
if (row.makeFine)
row.makeFine();
}
]]></constructor>
<destructor>
<![CDATA[
try {
if (this.isPhantom)
this.modifyPalette(this.id, null);
}
catch (e) {}
]]>
</destructor>
<method name="modifyPalette">
<parameter name="oldId"/>
<parameter name="newId"/>
<body><![CDATA[
var elements = gToolbox.palette.childNodes;
for (var i = elements.length; i--;) {
let element = elements[i];
if (element.id == oldId) {
if (newId)
element.id = newId;
else
element.parentNode.removeChild(element);
break;
}
}
]]></body>
</method>
</implementation>
</binding>
<binding id="palette-row" display="xul:hbox">
<implementation>
<method name="removeChild">
<parameter name="node"/>
<body><![CDATA[
var caller = this.removeChild.caller || arguments.callee.caller;
if (
(("toolbarDNDObserver" in window) && caller && caller === window.toolbarDNDObserver.onDrop) ||
(("onToolbarDrop" in window) && caller === window.onToolbarDrop)
) {
var button = node.firstChild;
if (button && button.isXBWidget && !button.isUnique) {
this.makeFine();
return this;
}
}
return this.parentNode.removeChild.call(this, node);
]]></body>
</method>
<method name="makeFine">
<body><![CDATA[
function doIt(grid) {
if (!grid || grid.id != "palette-box")
return;
var max = kRowMax || 4;
var row = grid.firstChild;
while (row) {
var cells = row.childNodes;
while (cells.length > max) {
var lastCell = row.lastChild;
if (lastCell && lastCell.localName == "spacer") {
row.removeChild(lastCell);
continue;
}
var nextRow = row.nextSibling;
if (!nextRow) {
var ns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
nextRow = document.createElementNS(ns, "hbox");
nextRow.appendChild(document.createElementNS(ns, "spacer"));
grid.appendChild(nextRow);
}
nextRow.insertBefore(lastCell, nextRow.firstChild);
}
row = row.nextSibling;
}
var lastRow = grid.lastChild,
lastCell = lastRow.lastChild;
if (lastCell && lastCell.localName == "spacer") {
if (lastCell == lastRow.firstChild)
lastRow.parentNode.removeChild(lastRow);
else
lastCell.setAttribute("flex", max - lastCell.parentNode.childNodes.length + 1);
}
}
setTimeout(doIt, 0, this.parentNode);
]]></body>
</method>
</implementation>
</binding>
</bindings>