From df2ace3a215a0ef85d5f36b535164f5110c06946 Mon Sep 17 00:00:00 2001 From: "hewitt%netscape.com" Date: Fri, 27 Sep 2002 04:06:56 +0000 Subject: [PATCH] 171101 - new toolbar customization features git-svn-id: svn://10.0.0.236/trunk@130568 18797224-902f-48f8-a5cc-f745e15eee43 --- ...wser.exe.manifest => phoenix.exe.manifest} | 0 mozilla/browser/base/content/browser.js | 61 +- mozilla/browser/base/content/browser.xul | 228 ++--- .../browser/base/content/customizeToolbar.js | 566 ----------- mozilla/browser/base/jar.mn | 6 +- mozilla/browser/base/locale/browser.dtd | 2 +- mozilla/browser/base/skin/bookmark-large.png | Bin 0 -> 3321 bytes mozilla/browser/base/skin/browser.css | 25 +- .../content/customizeToolbar.css | 20 +- mozilla/toolkit/content/customizeToolbar.js | 910 ++++++++++++++++++ .../content/customizeToolbar.xul | 40 +- mozilla/toolkit/content/widgets/toolbar.xml | 245 +++-- mozilla/toolkit/content/xul.css | 2 +- mozilla/toolkit/jar.mn | 5 + .../locale/customizeToolbar.dtd | 5 +- .../locale/customizeToolbar.properties | 3 + mozilla/toolkit/skin/win/autocomplete.css | 6 + .../skin/win}/customizeToolbar.css | 3 +- mozilla/toolkit/skin/win/global.css | 4 + mozilla/toolkit/skin/win/globalBindings.xml | 8 + mozilla/toolkit/skin/win/jar.mn | 4 + mozilla/toolkit/skin/win/textbox.css | 8 +- mozilla/toolkit/skin/win/toolbar.css | 30 + .../toolkit/skin/win/toolbar/spacer-lft.gif | Bin 0 -> 89 bytes .../toolkit/skin/win/toolbar/spacer-mid.gif | Bin 0 -> 52 bytes .../toolkit/skin/win/toolbar/spacer-rit.gif | Bin 0 -> 88 bytes 26 files changed, 1380 insertions(+), 801 deletions(-) rename mozilla/browser/app/{mozbrowser.exe.manifest => phoenix.exe.manifest} (100%) delete mode 100644 mozilla/browser/base/content/customizeToolbar.js create mode 100644 mozilla/browser/base/skin/bookmark-large.png rename mozilla/{browser/base => toolkit}/content/customizeToolbar.css (79%) create mode 100644 mozilla/toolkit/content/customizeToolbar.js rename mozilla/{browser/base => toolkit}/content/customizeToolbar.xul (64%) rename mozilla/{browser/base => toolkit}/locale/customizeToolbar.dtd (66%) create mode 100644 mozilla/toolkit/locale/customizeToolbar.properties rename mozilla/{browser/base/skin => toolkit/skin/win}/customizeToolbar.css (95%) create mode 100644 mozilla/toolkit/skin/win/toolbar/spacer-lft.gif create mode 100644 mozilla/toolkit/skin/win/toolbar/spacer-mid.gif create mode 100644 mozilla/toolkit/skin/win/toolbar/spacer-rit.gif diff --git a/mozilla/browser/app/mozbrowser.exe.manifest b/mozilla/browser/app/phoenix.exe.manifest similarity index 100% rename from mozilla/browser/app/mozbrowser.exe.manifest rename to mozilla/browser/app/phoenix.exe.manifest diff --git a/mozilla/browser/base/content/browser.js b/mozilla/browser/base/content/browser.js index 823207dbf8a..132927f023b 100644 --- a/mozilla/browser/base/content/browser.js +++ b/mozilla/browser/base/content/browser.js @@ -2592,7 +2592,24 @@ function BrowserToolbarChanged() function BrowserCustomizeToolbar() { - window.openDialog("chrome://browser/content/customizeToolbar.xul", "Customize Toolbar", "modal,chrome,resizable=yes"); + var cmd = document.getElementById("cmd_CustomizeToolbars"); + cmd.setAttribute("disabled", "true"); + + var iframe = document.createElement("iframe"); + iframe.flex = 1; + iframe.setAttribute("src", "chrome://global/content/customizeToolbar.xul"); + gBrowser.parentNode.insertBefore(iframe, gBrowser); + gBrowser.collapsed = true; +} + +function onToolbarCustomizeComplete() +{ + var cmd = document.getElementById("cmd_CustomizeToolbars"); + cmd.removeAttribute("disabled"); + + var iframe = gBrowser.previousSibling; + iframe.parentNode.removeChild(iframe); + gBrowser.collapsed = false; } var FullScreen = @@ -3000,6 +3017,48 @@ nsBrowserStatusHandler.prototype = } } +function onViewToolbarsPopupShowing(aEvent) +{ + var popup = aEvent.target; + + // Empty the menu + for (var i = popup.childNodes.length-1; i >= 0; --i) { + var deadItem = popup.childNodes[i]; + if (deadItem.hasAttribute("toolbarindex")) + popup.removeChild(deadItem); + } + + var firstMenuItem = popup.firstChild; + + var toolbox = document.getElementById("navigator-toolbox"); + for (var i = 0; i < toolbox.childNodes.length; ++i) { + var toolbar = toolbox.childNodes[i]; + var toolbarName = toolbar.getAttribute("toolbarname"); + if (toolbarName) { + var menuItem = document.createElement("menuitem"); + menuItem.setAttribute("toolbarindex", i); + menuItem.setAttribute("type", "checkbox"); + menuItem.setAttribute("label", toolbarName); + menuItem.setAttribute("accesskey", toolbar.getAttribute("accesskey")); + menuItem.setAttribute("checked", toolbar.getAttribute("collapsed") != "true"); + popup.insertBefore(menuItem, firstMenuItem); + + menuItem.addEventListener("command", onViewToolbarCommand, false); + } + toolbar = toolbar.nextSibling; + } +} + +function onViewToolbarCommand(aEvent) +{ + var toolbox = document.getElementById("navigator-toolbox"); + var index = aEvent.originalTarget.getAttribute("toolbarindex"); + var toolbar = toolbox.childNodes[index]; + + toolbar.collapsed = aEvent.originalTarget.getAttribute("checked") != "true"; + document.persist(toolbar.id, "collapsed"); +} + function displayPageInfo() { window.openDialog("chrome://navigator/content/pageInfo.xul", "_blank", diff --git a/mozilla/browser/base/content/browser.xul b/mozilla/browser/base/content/browser.xul index 8c5a917e5b8..793e4a684d0 100644 --- a/mozilla/browser/base/content/browser.xul +++ b/mozilla/browser/base/content/browser.xul @@ -118,7 +118,8 @@ Contributor(s): - + + @@ -228,7 +229,7 @@ Contributor(s): - @@ -396,7 +397,7 @@ Contributor(s): oncommand="gContextMenu.showMetadata();"/> - + - + - - + command="cmd_CustomizeToolbars"/> @@ -683,104 +683,115 @@ Contributor(s): - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +