1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/content/editMenuOverlay.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,39 @@ 1.4 +// -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +// update menu items that rely on focus or on the current selection 1.11 +function goUpdateGlobalEditMenuItems() 1.12 +{ 1.13 + // Don't bother updating the edit commands if they aren't visible in any way 1.14 + // (i.e. the Edit menu isn't open, nor is the context menu open, nor have the 1.15 + // cut, copy, and paste buttons been added to the toolbars) for performance. 1.16 + // This only works in applications/on platforms that set the gEditUIVisible 1.17 + // flag, so we check to see if that flag is defined before using it. 1.18 + if (typeof gEditUIVisible != "undefined" && !gEditUIVisible) 1.19 + return; 1.20 + 1.21 + goUpdateCommand("cmd_undo"); 1.22 + goUpdateCommand("cmd_redo"); 1.23 + goUpdateCommand("cmd_cut"); 1.24 + goUpdateCommand("cmd_copy"); 1.25 + goUpdateCommand("cmd_paste"); 1.26 + goUpdateCommand("cmd_selectAll"); 1.27 + goUpdateCommand("cmd_delete"); 1.28 + goUpdateCommand("cmd_switchTextDirection"); 1.29 +} 1.30 + 1.31 +// update menu items that relate to undo/redo 1.32 +function goUpdateUndoEditMenuItems() 1.33 +{ 1.34 + goUpdateCommand("cmd_undo"); 1.35 + goUpdateCommand("cmd_redo"); 1.36 +} 1.37 + 1.38 +// update menu items that depend on clipboard contents 1.39 +function goUpdatePasteMenuItems() 1.40 +{ 1.41 + goUpdateCommand("cmd_paste"); 1.42 +}