Bug 407899 - "SeaMonkey would like separate default modes/iconsizes for each toolbar" (Each toolbar can have defaults different from that of the toolbox) [p=philip.chee@gmail.com (Philip Chee) r=gavin a1.9=beltzner]

This commit is contained in:
reed@reedloden.com 2008-02-06 13:52:29 -08:00
parent 476a925984
commit 0f81decbc5

View File

@ -580,28 +580,6 @@ function restoreDefaultSet()
// going to recreate the wrappers and lose this
var savedAttributes = saveItemAttributes(["itemdisabled", "itemcommand"]);
// Restore the defaultset for fixed toolbars.
var toolbar = gToolbox.firstChild;
while (toolbar) {
if (isCustomizableToolbar(toolbar)) {
if (!toolbar.hasAttribute("customindex")) {
var defaultSet = toolbar.getAttribute("defaultset");
if (defaultSet)
toolbar.currentSet = defaultSet;
}
}
toolbar = toolbar.nextSibling;
}
// Restore the default icon size and mode.
var defaultMode = gToolbox.getAttribute("defaultmode");
var defaultIconsSmall = gToolbox.getAttribute("defaulticonsize") == "small";
updateIconSize(defaultIconsSmall);
document.getElementById("smallicons").checked = defaultIconsSmall;
updateToolbarMode(defaultMode);
document.getElementById("modelist").value = defaultMode;
// Remove all of the customized toolbars.
var child = gToolbox.lastChild;
while (child) {
@ -614,6 +592,26 @@ function restoreDefaultSet()
}
}
// Restore the defaultset for fixed toolbars.
var toolbar = gToolbox.firstChild;
while (toolbar) {
if (isCustomizableToolbar(toolbar)) {
var defaultSet = toolbar.getAttribute("defaultset");
if (defaultSet)
toolbar.currentSet = defaultSet;
}
toolbar = toolbar.nextSibling;
}
// Restore the default icon size and mode.
var defaultMode = gToolbox.getAttribute("defaultmode");
var defaultIconsSmall = gToolbox.getAttribute("defaulticonsize") == "small";
updateIconSize(defaultIconsSmall, true);
document.getElementById("smallicons").checked = defaultIconsSmall;
updateToolbarMode(defaultMode, true);
document.getElementById("modelist").value = defaultMode;
// Now rebuild the palette.
buildPalette();
@ -663,7 +661,7 @@ function restoreItemAttributes(aAttributeList, aSavedAttrList)
}
}
function updateIconSize(aUseSmallIcons)
function updateIconSize(aUseSmallIcons, localDefault)
{
gToolboxIconSize = aUseSmallIcons ? "small" : "large";
@ -673,13 +671,16 @@ function updateIconSize(aUseSmallIcons)
for (var i = 0; i < gToolbox.childNodes.length; ++i) {
var toolbar = getToolbarAt(i);
if (isCustomizableToolbar(toolbar)) {
setAttribute(toolbar, "iconsize", gToolboxIconSize);
var toolbarIconSize = (localDefault && toolbar.hasAttribute("defaulticonsize")) ?
toolbar.getAttribute("defaulticonsize") :
gToolboxIconSize;
setAttribute(toolbar, "iconsize", toolbarIconSize);
gToolboxDocument.persist(toolbar.id, "iconsize");
}
}
}
function updateToolbarMode(aModeValue)
function updateToolbarMode(aModeValue, localDefault)
{
setAttribute(gToolbox, "mode", aModeValue);
gToolboxDocument.persist(gToolbox.id, "mode");
@ -687,7 +688,10 @@ function updateToolbarMode(aModeValue)
for (var i = 0; i < gToolbox.childNodes.length; ++i) {
var toolbar = getToolbarAt(i);
if (isCustomizableToolbar(toolbar)) {
setAttribute(toolbar, "mode", aModeValue);
var toolbarMode = (localDefault && toolbar.hasAttribute("defaultmode")) ?
toolbar.getAttribute("defaultmode") :
aModeValue;
setAttribute(toolbar, "mode", toolbarMode);
gToolboxDocument.persist(toolbar.id, "mode");
}
}