Bug 368918 - browser.xul should use editMenuOverlay rather than duplicating its code. r=gavin.

This commit is contained in:
mozilla.mano@sent.com
2007-02-14 21:28:26 +00:00
parent b5df70fda8
commit a5b0593a6f
6 changed files with 43 additions and 89 deletions

View File

@@ -50,23 +50,6 @@
<stringbundle id="bundle_preferences" src="chrome://browser/locale/preferences/preferences.properties"/>
</stringbundleset>
<commandset id="globalEditCommandSet"
commandupdater="true"
events="focus,select"
oncommandupdate="goUpdateGlobalEditMenuItems()"/>
<commandset id="selectEditCommandSet"
commandupdater="true"
events="select"
oncommandupdate="goUpdateSelectEditMenuItems()"/>
<commandset id="undoEditCommandSet"
commandupdater="true"
events="undo"
oncommandupdate="goUpdateUndoEditMenuItems()"/>
<commandset id="pasteCommandSet"
commandupdater="true"
events="clipboard"
oncommandupdate="goUpdatePasteMenuItems()"/>
<commandset id="mainCommandSet">
<command id="cmd_newNavigator" oncommand="OpenBrowserWindow()"/>
<command id="cmd_bm_open" oncommand="goDoCommand('cmd_bm_open');"/>
@@ -103,31 +86,7 @@
<command id="cmd_CustomizeToolbars" oncommand="BrowserCustomizeToolbar()"/>
<command id="cmd_undo"
oncommand="goDoCommand('cmd_undo')"
disabled="true"/>
<command id="cmd_redo"
oncommand="goDoCommand('cmd_redo')"
disabled="true"/>
<command id="cmd_cut"
oncommand="goDoCommand('cmd_cut')"
disabled="true"/>
<command id="cmd_copy"
oncommand="goDoCommand('cmd_copy')"
disabled="true"/>
<command id="cmd_paste"
oncommand="goDoCommand('cmd_paste')"
disabled="true"/>
<command id="cmd_delete"
oncommand="goDoCommand('cmd_delete')"
valueDefault="&deleteCmd.label;"
disabled="true"/>
<command id="cmd_selectAll"
oncommand="goDoCommand('cmd_selectAll')"
disabled="true"/>
<command id="cmd_switchTextDirection"
oncommand="goDoCommand('cmd_switchTextDirection');"
disabled="true"/>
<commandset id="editMenuCommands"/>
<command id="View:PageSource" oncommand="BrowserViewSourceOfDocument(content.document);" observes="isImage"/>
<command id="View:PageInfo" oncommand="BrowserPageInfo();"/>

View File

@@ -45,6 +45,7 @@
#endif
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
<?xul-overlay href="chrome://browser/content/baseMenuOverlay.xul"?>
#ifdef MOZ_PLACES
<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>

View File

@@ -270,42 +270,6 @@ function closeMenus(node)
}
}
// update menu items that rely on focus
function goUpdateGlobalEditMenuItems()
{
goUpdateCommand('cmd_undo');
goUpdateCommand('cmd_redo');
goUpdateCommand('cmd_cut');
goUpdateCommand('cmd_copy');
goUpdateCommand('cmd_paste');
goUpdateCommand('cmd_selectAll');
goUpdateCommand('cmd_delete');
if (gBidiUI)
goUpdateCommand('cmd_switchTextDirection');
}
// update menu items that rely on the current selection
function goUpdateSelectEditMenuItems()
{
goUpdateCommand('cmd_cut');
goUpdateCommand('cmd_copy');
goUpdateCommand('cmd_delete');
goUpdateCommand('cmd_selectAll');
}
// update menu items that relate to undo/redo
function goUpdateUndoEditMenuItems()
{
goUpdateCommand('cmd_undo');
goUpdateCommand('cmd_redo');
}
// update menu items that depend on clipboard contents
function goUpdatePasteMenuItems()
{
goUpdateCommand('cmd_paste');
}
// Gather all descendent text under given document node.
function gatherTextUnder ( root )
{

View File

@@ -1,5 +1,42 @@
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Alec Flett <alecf@netscape.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
// update menu items that rely on focus
// update menu items that rely on focus or on the current selection
function goUpdateGlobalEditMenuItems()
{
goUpdateCommand("cmd_undo");
@@ -9,15 +46,7 @@ function goUpdateGlobalEditMenuItems()
goUpdateCommand("cmd_paste");
goUpdateCommand("cmd_selectAll");
goUpdateCommand("cmd_delete");
}
// update menu items that rely on the current selection
function goUpdateSelectEditMenuItems()
{
goUpdateCommand("cmd_cut");
goUpdateCommand("cmd_copy");
goUpdateCommand("cmd_delete");
goUpdateCommand("cmd_selectAll");
goUpdateCommand("cmd_switchTextDirection");
}
// update menu items that relate to undo/redo

View File

@@ -22,6 +22,7 @@
<command id="cmd_paste" oncommand="goDoCommand('cmd_paste')"/>
<command id="cmd_delete" oncommand="goDoCommand('cmd_delete')"/>
<command id="cmd_selectAll" oncommand="goDoCommand('cmd_selectAll')"/>
<command id="cmd_switchTextDirection" oncommand="goDoCommand('cmd_switchTextDirection');"/>
</commandset>
<!-- These key nodes are here only for show. The real bindings come from

View File

@@ -23,7 +23,7 @@ toolkit.jar:
content/global/customizeToolbar.css (customizeToolbar.css)
* content/global/customizeToolbar.js (customizeToolbar.js)
* content/global/customizeToolbar.xul (customizeToolbar.xul)
+ content/global/editMenuOverlay.js (editMenuOverlay.js)
*+ content/global/editMenuOverlay.js (editMenuOverlay.js)
*+ content/global/editMenuOverlay.xul (editMenuOverlay.xul)
*+ content/global/finddialog.js (finddialog.js)
*+ content/global/finddialog.xul (finddialog.xul)