зеркало из https://github.com/mozilla/gecko-dev.git
Enable menubar customization.
This commit is contained in:
Родитель
3ce39b25c8
Коммит
0d6df8fc86
|
@ -1329,12 +1329,14 @@ function updateToolbarStates(toolbarMenuElt)
|
|||
for (i = 0; i < toolbarMenuElt.childNodes.length; ++i)
|
||||
document.getElementById(toolbarMenuElt.childNodes[i].getAttribute("observes")).removeAttribute("checked");
|
||||
var toolbars = document.getElementsByTagName("toolbar");
|
||||
for (i = 0; i < toolbars.length; ++i) {
|
||||
|
||||
// Start i at 1, since we skip the menubar.
|
||||
for (i = 1; i < toolbars.length; ++i) {
|
||||
if (toolbars[i].getAttribute("class").indexOf("chromeclass") != -1)
|
||||
toolbars[i].setAttribute("hidden", "true");
|
||||
}
|
||||
var statusbars = document.getElementsByTagName("statusbar");
|
||||
for (i = 0; i < statusbars.length; ++i) {
|
||||
for (i = 1; i < statusbars.length; ++i) {
|
||||
if (statusbars[i].getAttribute("class").indexOf("chromeclass") != -1)
|
||||
statusbars[i].setAttribute("hidden", "true");
|
||||
}
|
||||
|
@ -2615,7 +2617,7 @@ function openAboutDialog()
|
|||
|
||||
function BrowserCustomizeToolbar()
|
||||
{
|
||||
// Disable tlhe menubar and toolbar context menu items
|
||||
// Disable the toolbar context menu items
|
||||
var menubar = document.getElementById("main-menubar");
|
||||
for (var i = 0; i < menubar.childNodes.length; ++i)
|
||||
menubar.childNodes[i].setAttribute("disabled", true);
|
||||
|
@ -3044,7 +3046,8 @@ function onViewToolbarsPopupShowing(aEvent)
|
|||
for (i = 0; i < toolbox.childNodes.length; ++i) {
|
||||
var toolbar = toolbox.childNodes[i];
|
||||
var toolbarName = toolbar.getAttribute("toolbarname");
|
||||
if (toolbarName) {
|
||||
var type = toolbar.getAttribute("type");
|
||||
if (toolbarName && type != "menubar") {
|
||||
var menuItem = document.createElement("menuitem");
|
||||
menuItem.setAttribute("toolbarindex", i);
|
||||
menuItem.setAttribute("type", "checkbox");
|
||||
|
|
|
@ -131,6 +131,11 @@ function notifyParentComplete()
|
|||
gToolbox.customizeDone(gToolboxChanged);
|
||||
}
|
||||
|
||||
function getToolbarAt(i)
|
||||
{
|
||||
return gToolbox.childNodes[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* Persist the current set of buttons in all customizable toolbars to
|
||||
* localstore.
|
||||
|
@ -143,7 +148,7 @@ function persistCurrentSets()
|
|||
var customCount = 0;
|
||||
for (var i = 0; i < gToolbox.childNodes.length; ++i) {
|
||||
// Look for customizable toolbars that need to be persisted.
|
||||
var toolbar = gToolbox.childNodes[i];
|
||||
var toolbar = getToolbarAt(i);
|
||||
if (isCustomizableToolbar(toolbar)) {
|
||||
// Calculate currentset and store it in the attribute.
|
||||
var currentSet = toolbar.currentSet;
|
||||
|
@ -183,7 +188,7 @@ function persistCurrentSets()
|
|||
function wrapToolbarItems()
|
||||
{
|
||||
for (var i = 0; i < gToolbox.childNodes.length; ++i) {
|
||||
var toolbar = gToolbox.childNodes[i];
|
||||
var toolbar = getToolbarAt(i);
|
||||
if (isCustomizableToolbar(toolbar)) {
|
||||
for (var k = 0; k < toolbar.childNodes.length; ++k) {
|
||||
var item = toolbar.childNodes[k];
|
||||
|
@ -291,7 +296,7 @@ function getCurrentItemIds()
|
|||
{
|
||||
var currentItems = {};
|
||||
for (var i = 0; i < gToolbox.childNodes.length; ++i) {
|
||||
var toolbar = gToolbox.childNodes[i];
|
||||
var toolbar = getToolbarAt(i);
|
||||
if (isCustomizableToolbar(toolbar)) {
|
||||
var child = toolbar.firstChild;
|
||||
while (child) {
|
||||
|
@ -585,7 +590,7 @@ function updateIconSize(aUseSmallIcons)
|
|||
gToolboxDocument.persist(gToolbox.id, "iconsize");
|
||||
|
||||
for (var i = 0; i < gToolbox.childNodes.length; ++i) {
|
||||
var toolbar = gToolbox.childNodes[i];
|
||||
var toolbar = getToolbarAt(i);
|
||||
if (isCustomizableToolbar(toolbar)) {
|
||||
setAttribute(toolbar, "iconsize", val);
|
||||
gToolboxDocument.persist(toolbar.id, "iconsize");
|
||||
|
@ -601,7 +606,7 @@ function updateToolbarMode(aModeValue)
|
|||
gToolboxDocument.persist(gToolbox.id, "mode");
|
||||
|
||||
for (var i = 0; i < gToolbox.childNodes.length; ++i) {
|
||||
var toolbar = gToolbox.childNodes[i];
|
||||
var toolbar = getToolbarAt(i);
|
||||
if (isCustomizableToolbar(toolbar)) {
|
||||
setAttribute(toolbar, "mode", aModeValue);
|
||||
gToolboxDocument.persist(toolbar.id, "mode");
|
||||
|
@ -632,7 +637,7 @@ function setAttribute(aElt, aAttr, aVal)
|
|||
|
||||
function isCustomizableToolbar(aElt)
|
||||
{
|
||||
return aElt.localName == "toolbar" &&
|
||||
return (aElt.localName == "toolbar" &&
|
||||
aElt.getAttribute("customizable") == "true";
|
||||
}
|
||||
|
||||
|
|
|
@ -80,11 +80,12 @@
|
|||
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
this.lastPermanentChild = this.firstChild;
|
||||
this.lastPermanentChild = this.lastChild;
|
||||
|
||||
// Searching for the toolbox palette in the toolbar binding because
|
||||
// toolbars are constructed first.
|
||||
var toolbox = this.parentNode;
|
||||
|
||||
if (!toolbox.palette) {
|
||||
// Look to see if there is a toolbarpalette.
|
||||
var node = toolbox.firstChild;
|
||||
|
@ -145,14 +146,9 @@
|
|||
|
||||
<setter>
|
||||
<![CDATA[
|
||||
// Remove all items before the last permanent child.
|
||||
if (this.lastPermanentChild) {
|
||||
while (this.lastPermanentChild.previousSibling)
|
||||
this.removeChild(this.lastPermanentChild.previousSibling);
|
||||
} else {
|
||||
while (this.lastChild)
|
||||
this.removeChild(this.lastChild);
|
||||
}
|
||||
// Remove all items after the last permanent child.
|
||||
while (this.lastChild && this.lastChild != this.lastPermanentChild)
|
||||
this.removeChild(this.lastChild);
|
||||
|
||||
if (val == "__empty")
|
||||
return;
|
||||
|
@ -216,8 +212,8 @@
|
|||
}
|
||||
|
||||
// Insert the palette item into the toolbar.
|
||||
if (aBeforeElt || this.lastPermanentChild)
|
||||
this.insertBefore(insertItem, aBeforeElt ? aBeforeElt : this.lastPermanentChild);
|
||||
if (aBeforeElt)
|
||||
this.insertBefore(insertItem, aBeforeElt);
|
||||
else
|
||||
this.appendChild(insertItem);
|
||||
|
||||
|
@ -229,10 +225,6 @@
|
|||
</binding>
|
||||
|
||||
<binding id="menubar" extends="xul:menubar">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/toolbar.css"/>
|
||||
</resources>
|
||||
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
|
|
|
@ -108,7 +108,7 @@ menubar > menu[_moz-menuactive="true"] {
|
|||
border-left: 1px solid ThreeDHighlight;
|
||||
}
|
||||
|
||||
menubar > menu[_moz-menuactive="true"][open="true"] {
|
||||
menubar > menu[_moz-menuactive="true"][open="true"] {
|
||||
border-top: 1px solid ThreeDShadow;
|
||||
border-right: 1px solid ThreeDHighlight;
|
||||
border-bottom: 1px solid ThreeDHighlight;
|
||||
|
|
Загрузка…
Ссылка в новой задаче