|
1 // -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
2 |
|
3 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 // update menu items that rely on focus or on the current selection |
|
8 function goUpdateGlobalEditMenuItems() |
|
9 { |
|
10 // Don't bother updating the edit commands if they aren't visible in any way |
|
11 // (i.e. the Edit menu isn't open, nor is the context menu open, nor have the |
|
12 // cut, copy, and paste buttons been added to the toolbars) for performance. |
|
13 // This only works in applications/on platforms that set the gEditUIVisible |
|
14 // flag, so we check to see if that flag is defined before using it. |
|
15 if (typeof gEditUIVisible != "undefined" && !gEditUIVisible) |
|
16 return; |
|
17 |
|
18 goUpdateCommand("cmd_undo"); |
|
19 goUpdateCommand("cmd_redo"); |
|
20 goUpdateCommand("cmd_cut"); |
|
21 goUpdateCommand("cmd_copy"); |
|
22 goUpdateCommand("cmd_paste"); |
|
23 goUpdateCommand("cmd_selectAll"); |
|
24 goUpdateCommand("cmd_delete"); |
|
25 goUpdateCommand("cmd_switchTextDirection"); |
|
26 } |
|
27 |
|
28 // update menu items that relate to undo/redo |
|
29 function goUpdateUndoEditMenuItems() |
|
30 { |
|
31 goUpdateCommand("cmd_undo"); |
|
32 goUpdateCommand("cmd_redo"); |
|
33 } |
|
34 |
|
35 // update menu items that depend on clipboard contents |
|
36 function goUpdatePasteMenuItems() |
|
37 { |
|
38 goUpdateCommand("cmd_paste"); |
|
39 } |