Remove the silly zoom menu, replace it with two simple menuitems (better wording pending).

This commit is contained in:
blakeross%telocity.com 2002-08-08 01:36:02 +00:00
Родитель 7b9e0d2ac0
Коммит a6c2367d72
3 изменённых файлов: 22 добавлений и 108 удалений

Просмотреть файл

@ -88,79 +88,6 @@ var gOldCloseHandler = null; // close handler before we went into print preview
var gInPrintPreviewMode = false;
var gWebProgress = null;
// Pref listener constants
const gButtonPrefListener =
{
domain: "browser.toolbars.showbutton",
observe: function(subject, topic, prefName)
{
// verify that we're changing a button pref
if (topic != "nsPref:changed")
return;
var buttonName = prefName.substr(this.domain.length+1);
var buttonId = buttonName + "-button";
var button = document.getElementById(buttonId);
// We need to explicitly set "hidden" to "false"
// in order for persistence to work correctly
var show = pref.getBoolPref(prefName);
if (show)
button.setAttribute("hidden","false");
else
button.setAttribute("hidden", "true");
// If all buttons before the separator are hidden, also hide the separator
if (allLeftButtonsAreHidden())
document.getElementById("home-bm-separator").setAttribute("hidden", "true");
else
document.getElementById("home-bm-separator").removeAttribute("hidden");
}
};
const gTabStripPrefListener =
{
domain: "browser.tabs.autoHide",
observe: function(subject, topic, prefName)
{
// verify that we're changing the tab browser strip auto hide pref
if (topic != "nsPref:changed")
return;
var stripVisibility = !pref.getBoolPref(prefName);
if (gBrowser.mTabContainer.childNodes.length == 1) {
gBrowser.setStripVisibilityTo(stripVisibility);
pref.setBoolPref("browser.tabs.forceHide", false);
}
}
};
/**
* Pref listener handler functions.
* Both functions assume that observer.domain is set to
* the pref domain we want to start/stop listening to.
*/
function addPrefListener(observer)
{
try {
var pbi = pref.QueryInterface(Components.interfaces.nsIPrefBranchInternal);
pbi.addObserver(observer.domain, observer, false);
} catch(ex) {
dump("Failed to observe prefs: " + ex + "\n");
}
}
function removePrefListener(observer)
{
try {
var pbi = pref.QueryInterface(Components.interfaces.nsIPrefBranchInternal);
pbi.removeObserver(observer.domain, observer);
} catch(ex) {
dump("Failed to remove pref observer: " + ex + "\n");
}
}
/**
* We can avoid adding multiple load event listeners and save some time by adding
* one listener that calls all real handlers.
@ -277,21 +204,6 @@ function UpdateBackForwardButtons()
}
}
// Function allLeftButtonsAreHidden
// Returns true if all the buttons left of the separator in the personal
// toolbar are hidden, false otherwise.
// Used by nsButtonPrefListener to hide the separator if needed
function allLeftButtonsAreHidden()
{
var buttonNode = document.getElementById("PersonalToolbar").firstChild;
while(buttonNode.tagName != "toolbarseparator") {
if(!buttonNode.hasAttribute("hidden") || buttonNode.getAttribute("hidden") == "false")
return false;
buttonNode = buttonNode.nextSibling;
}
return true;
}
function RegisterTabOpenObserver()
{
const observer = {
@ -316,7 +228,6 @@ function Startup()
gBrandBundle = document.getElementById("bundle_brand");
gNavigatorRegionBundle = document.getElementById("bundle_navigator_region");
gBrandRegionBundle = document.getElementById("bundle_brand_region");
registerZoomManager();
gBrowser = document.getElementById("content");
gURLBar = document.getElementById("urlbar");
@ -360,9 +271,6 @@ function Startup()
// initialize observers and listeners
window.XULBrowserWindow = new nsBrowserStatusHandler();
addPrefListener(gButtonPrefListener);
addPrefListener(gTabStripPrefListener);
window.browserContentListener =
new nsBrowserContentListener(window, getBrowser());
@ -372,7 +280,7 @@ function Startup()
// Add a capturing event listener to the content area
// (rjc note: not the entire window, otherwise we'll get sidebar pane loads too!)
// so we'll be notified when onloads complete.
var contentArea = document.getElementById("appcontent");
var contentArea = document.getElementById("browser");
contentArea.addEventListener("load", loadEventHandlers, true);
contentArea.addEventListener("focus", contentAreaFrameFocus, true);
@ -556,10 +464,6 @@ function Shutdown()
BrowserFlushBookmarksAndHistory();
// unregister us as a pref listener
removePrefListener(gButtonPrefListener);
removePrefListener(gTabStripPrefListener);
window.browserContentListener.close();
// Close the app core.
if (appCore)
@ -3570,4 +3474,3 @@ function BrowserCustomizeToolbar()
{
window.openDialog("chrome://browser/content/customizeToolbar.xul", "Customize Toolbar", "modal,chrome,resizable=yes");
}

Просмотреть файл

@ -26,7 +26,6 @@ Contributor(s):
<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
<?xul-overlay href="chrome://communicator/content/bookmarks/bookmarksOverlay.xul"?>
<?xul-overlay href="chrome://global/content/viewZoomOverlay.xul"?>
<?xul-overlay href="chrome://navigator/content/platformNavigationBindings.xul"?>
<?xul-overlay href="chrome://communicator/content/platformCommunicatorOverlay.xul"?>
@ -71,7 +70,8 @@ Contributor(s):
<script type="application/x-javascript" src="chrome://browser/content/utilityOverlay.js"/>
<script type="application/x-javascript" src="chrome://global/content/charset.js"/>
<script type="application/x-javascript" src="chrome://communicator/content/bookmarks/bookmarksOverlay.js"/>
<script type="application/x-javascript" src="chrome://communicator/content/securityUI.js" />
<script type="application/x-javascript" src="chrome://communicator/content/securityUI.js"/>
<script type="application/x-javascript" src="chrome://global/content/viewZoomOverlay.js"/>
<script type="application/x-javascript" src="chrome://browser/content/browser.js"/>
<script type="application/x-javascript" src="chrome://global/content/nsContextMenu.js"/>
@ -83,7 +83,6 @@ Contributor(s):
<stringbundle id="bundle_navigator_region" src="chrome://navigator-region/locale/region.properties"/>
<stringbundle id="bundle_brand_region" src="chrome://global-region/locale/region.properties"/>
<stringbundle id="findBundle" src="chrome://global/locale/finddialog.properties"/>
<stringbundle id="bundle_viewZoom"/>
</stringbundleset>
<commandset id="globalEditMenuItems"
@ -159,7 +158,8 @@ Contributor(s):
<command id="Browser:Home" oncommand="BrowserHome();"/>
<command id="Browser:Back" oncommand="BrowserBack();" observes="canGoBack"/>
<command id="Browser:Forward" oncommand="BrowserForward();" observes="canGoForward"/>
<commandset id="viewZoomCommands"/>
<command id="cmd_textZoomReduce" oncommand="ZoomManager.prototype.getInstance().reduce();"/>
<command id="cmd_textZoomEnlarge" oncommand="ZoomManager.prototype.getInstance().enlarge();"/>
<broadcaster id="canGoBack" disabled="true"/>
<broadcaster id="canGoForward" disabled="true"/>
@ -214,7 +214,8 @@ Contributor(s):
<key id="key_stop" keycode="VK_ESCAPE" oncommand="BrowserStop();"/>
<key id="key_gotoHistory" key="&history.commandKey;" oncommand="toHistory();" modifiers="accel"/>
<keyset id="viewZoomKeys"/>
<key id="key_textZoomReduce" key="&textZoomReduceCmd.commandkey;" command="cmd_textZoomReduce" modifiers="accel"/>
<key id="key_textZoomEnlarge" key="&textZoomEnlargeCmd.commandkey;" command="cmd_textZoomEnlarge" modifiers="accel"/>
<keyset id="navigationKeys"/>
</keyset>
@ -481,10 +482,11 @@ Contributor(s):
<menuitem label="&stopCmd.label;" accesskey="&stopCmd.accesskey;" id="menuitem-stop" disabled="true" oncommand="BrowserStop();" key="key_stop"/>
<menuitem accesskey="&reloadCmd.accesskey;" key="key_reload" label="&reloadCmd.label;" oncommand="BrowserReload();"/>
<menuseparator/>
<!-- overlayed from viewZoomOverlay.xul -->
<menu id="menu_textZoom" observes="isImage"/>
<menuitem key="key_textZoomEnlarge" label="&textZoomEnlargeCmd.label;" accesskey="&textZoomEnlargeCmd.accesskey;"
command="cmd_textZoomEnlarge" observes="isImage"/>
<menuitem key="key_textZoomReduce" label="&textZoomReduceCmd.label;" accesskey="&textZoomReduceCmd.accesskey;"
command="cmd_textZoomReduce" observes="isImage"/>
<menuseparator/>
<menu observes="isImage"
label="&charsetMenu.label;" accesskey="&charsetMenu.accesskey;"
datasources="rdf:charset-menu" ref="NC:BrowserCharsetMenuRoot"

Просмотреть файл

@ -240,3 +240,12 @@
<!ENTITY thisFrameMenu.label "This Frame">
<!ENTITY thisFrameMenu.accesskey "h">
<!ENTITY search.accesskey "W">
<!ENTITY textZoomEnlargeCmd.label "Increase Text Size">
<!ENTITY textZoomEnlargeCmd.accesskey "I">
<!ENTITY textZoomEnlargeCmd.commandkey "+">
<!ENTITY textZoomEnlargeCmd.commandkey2 "="> <!-- + is above this key on many keyboards -->
<!ENTITY textZoomReduceCmd.label "Reduce Text Size">
<!ENTITY textZoomReduceCmd.accesskey "R">
<!ENTITY textZoomReduceCmd.commandkey "-">