⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 windowmenu.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: WindowMenu.java * * Copyright (c) 2003 Sun Microsystems and Static Free Software * * Electric(tm) is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * Electric(tm) is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Electric(tm); see the file COPYING.  If not, write to * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, Mass 02111-1307, USA. */package com.sun.electric.tool.user.menus;import com.sun.electric.database.hierarchy.EDatabase;import static com.sun.electric.tool.user.menus.EMenuItem.SEPARATOR;import com.sun.electric.database.text.Pref;import com.sun.electric.database.text.TextUtils;import com.sun.electric.tool.Job;import com.sun.electric.tool.JobException;import com.sun.electric.tool.io.FileType;import com.sun.electric.tool.user.MessagesStream;import com.sun.electric.tool.user.Resources;import com.sun.electric.tool.user.User;import com.sun.electric.tool.user.dialogs.OpenFile;import com.sun.electric.tool.user.dialogs.SetFocus;import com.sun.electric.tool.user.ui.ClickZoomWireListener;import com.sun.electric.tool.user.ui.EditWindow;import com.sun.electric.tool.user.ui.EditWindowFocusBrowser;import com.sun.electric.tool.user.ui.MessagesWindow;import com.sun.electric.tool.user.ui.TopLevel;import com.sun.electric.tool.user.ui.WindowContent;import com.sun.electric.tool.user.ui.WindowFrame;import com.sun.electric.tool.user.ui.ZoomAndPanListener;import com.sun.electric.tool.user.waveform.WaveformWindow;import java.awt.Color;import java.awt.Dimension;import java.awt.GraphicsConfiguration;import java.awt.GraphicsDevice;import java.awt.GraphicsEnvironment;import java.awt.Point;import java.awt.Rectangle;import java.awt.Toolkit;import java.awt.event.InputEvent;import java.awt.event.KeyEvent;import java.awt.geom.Point2D;import java.awt.geom.Rectangle2D;import java.net.URL;import java.util.ArrayList;import java.util.Collections;import java.util.EventListener;import java.util.Iterator;import java.util.List;import javax.swing.KeyStroke;/** * Class to handle the commands in the "Window" pulldown menu. */public class WindowMenu {    public static KeyStroke getCloseWindowAccelerator() { return EMenuItem.shortcut(KeyEvent.VK_W); }    private static EMenu thisWindowMenu = null;    private static EMenuItem hiddenWindowCycleMenuItem = null;    static EMenu makeMenu() {        /****************************** THE WINDOW MENU ******************************/        // bindings for numpad keys.  Need extra one because over VNC, they get sent as shift+KP_*        int ctrlshift = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() | InputEvent.SHIFT_MASK;        KeyStroke [] numpad4 = new KeyStroke [] { EMenuItem.shortcut('4'), EMenuItem.shortcut(KeyEvent.VK_NUMPAD4),                KeyStroke.getKeyStroke(KeyEvent.VK_KP_LEFT, ctrlshift)};        KeyStroke [] numpad6 = new KeyStroke [] { EMenuItem.shortcut('6'), EMenuItem.shortcut(KeyEvent.VK_NUMPAD6),                KeyStroke.getKeyStroke(KeyEvent.VK_KP_RIGHT, ctrlshift)};        KeyStroke [] numpad8 = new KeyStroke [] { EMenuItem.shortcut('8'), EMenuItem.shortcut(KeyEvent.VK_NUMPAD8),                KeyStroke.getKeyStroke(KeyEvent.VK_KP_UP, ctrlshift)};        KeyStroke [] numpad2 = new KeyStroke [] { EMenuItem.shortcut('2'), EMenuItem.shortcut(KeyEvent.VK_NUMPAD2),                KeyStroke.getKeyStroke(KeyEvent.VK_KP_DOWN, ctrlshift)};        KeyStroke [] numpad9 = new KeyStroke [] { EMenuItem.shortcut('9'), EMenuItem.shortcut(KeyEvent.VK_NUMPAD9),                KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, ctrlshift)};        KeyStroke [] numpad7 = new KeyStroke [] { EMenuItem.shortcut('7'), EMenuItem.shortcut(KeyEvent.VK_NUMPAD7),                KeyStroke.getKeyStroke(KeyEvent.VK_HOME, ctrlshift)};        KeyStroke [] numpad0 = new KeyStroke [] { EMenuItem.shortcut('0'), EMenuItem.shortcut(KeyEvent.VK_NUMPAD0),                KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, ctrlshift)};        KeyStroke [] numpad5 = new KeyStroke [] { EMenuItem.shortcut('5'), EMenuItem.shortcut(KeyEvent.VK_NUMPAD5),                KeyStroke.getKeyStroke(KeyEvent.VK_BEGIN, ctrlshift)};        // mnemonic keys available: A         K     Q  T    Y        EMenu menu = new EMenu("_Window",            new EMenuItem("_Fill Window", numpad9) { public void run() {                fullDisplay(); }},            new EMenuItem("Redisplay _Window") { public void run() {                ZoomAndPanListener.redrawDisplay(); }},            new EMenuItem("Zoom _Out", numpad0) { public void run() {                zoomOutDisplay(); }},            new EMenuItem("Zoom _In", numpad7) { public void run() {                zoomInDisplay(); }},		// mnemonic keys available: ABCDEF  IJKLMNOPQRSTUV XY            new EMenu("Special _Zoom",                new EMenuItem("Focus on _Highlighted", 'F') { public void run() {                    focusOnHighlighted(); }},                new EMenuItem("_Zoom Box") { public void run() {                    zoomBoxCommand(); }},                new EMenuItem("Make _Grid Just Visible") { public void run() {                    makeGridJustVisibleCommand(); }},                new EMenuItem("Match Other _Window") { public void run() {                    matchOtherWindowCommand(0); }}),            SEPARATOR,            new EMenuItem("Pan _Left", numpad4) { public void run() {                ZoomAndPanListener.panXOrY(0, WindowFrame.getCurrentWindowFrame(), 1); }},            new EMenuItem("Pan _Right", numpad6) { public void run() {                ZoomAndPanListener.panXOrY(0, WindowFrame.getCurrentWindowFrame(), -1); }},            new EMenuItem("Pan _Up",  numpad8) { public void run() {                ZoomAndPanListener.panXOrY(1, WindowFrame.getCurrentWindowFrame(), -1); }},            new EMenuItem("Pan _Down", numpad2) { public void run() {                ZoomAndPanListener.panXOrY(1, WindowFrame.getCurrentWindowFrame(), 1); }},		// mnemonic keys available:  B DEFGHIJKLMNOPQR TUVW  Z            new EMenu("Special _Pan",                new EMenuItem("Center _Selection") { public void run() {                    ZoomAndPanListener.centerSelection(); }},                new EMenuItem("Center _Cursor", numpad5) { public void run() {                    ZoomAndPanListener.centerCursor(WindowFrame.getCurrentWindowFrame()); }},                new EMenuItem("Match Other Window in _X") { public void run() {                    matchOtherWindowCommand(1); }},                new EMenuItem("Match Other Window in _Y") { public void run() {                    matchOtherWindowCommand(2); }},                new EMenuItem("Match Other Window in X, Y, _and Scale") { public void run() {                    matchOtherWindowCommand(3); }}),        //    new EMenuItem("Saved Views...") { public void run() {        //        SavedViews.showSavedViewsDialog(); }},            new EMenuItem("Go To Pre_vious Focus") { public void run() {                goToPreviousSavedFocus(); }},            new EMenuItem("Go To Ne_xt Focus") { public void run() {                goToNextSavedFocus(); }},            new EMenuItem("_Set Focus...") { public void run() {			    SetFocus.showSetFocusDialog(); }},            SEPARATOR,            new EMenuItem("Toggle _Grid", 'G') { public void run() {                toggleGridCommand(); }},            SEPARATOR,		// mnemonic keys available: AB DEFG IJKLMNOPQRSTU WXYZ            new EMenu("Ad_just Position",                new EMenuItem("Tile _Horizontally") { public void run() {                    tileHorizontallyCommand(); }},                new EMenuItem("Tile _Vertically", KeyStroke.getKeyStroke(KeyEvent.VK_F9, 0)) { public void run() {                    tileVerticallyCommand(); }},                new EMenuItem("_Cascade") { public void run() {                    cascadeWindowsCommand(); }}),            new EMenuItem("Clos_e Window", getCloseWindowAccelerator()) { public void run() {                closeWindowCommand(); }},//            new EMenuItem("Select Next Window") { public void run() {//                nextWindowCommand(); }},            !TopLevel.isMDIMode() ? SEPARATOR : null,            !TopLevel.isMDIMode() && getAllGraphicsDevices().length >= 2 ? new EMenuItem("Move to Ot_her Display") { public void run() {                moveToOtherDisplayCommand(); }} : null,			!TopLevel.isMDIMode() ? new EMenuItem("Remember Locatio_n of Display") { public void run() {				    rememberDisplayLocation(); }} : null,		    SEPARATOR,        // mnemonic keys available: A  DEFGHIJKLMNOPQ STUV XYZ            new EMenu("_Color Schemes",                new EMenuItem("_Restore Default Colors") { public void run() {                    defaultBackgroundCommand(); }},                new EMenuItem("_Black Background Colors") { public void run() {                    blackBackgroundCommand(); }},                new EMenuItem("_White Background Colors") { public void run() {                    whiteBackgroundCommand(); }},                new EMenuItem("_Cadence Colors, Layers and Keystrokes") { public void run() {                    importCadencePreferences(); }}                    ),		// mnemonic keys available: AB   FGHIJKLMNOPQ  TUVW  Z            new EMenu("W_aveform Window",		        new EMenuItem("_Save Waveform Window Configuration to Disk...") { public void run() {                    WaveformWindow.saveConfiguration(); }},		        new EMenuItem("_Restore Waveform Window Configuration from Disk...") { public void run() {                    WaveformWindow.restoreConfiguration(); }},                SEPARATOR,                new EMenuItem("Refresh Simulation _Data") { public void run() {                    WaveformWindow.refreshSimulationData(); }},                SEPARATOR,                new EMenuItem("_Clear All Signals in Waveform Window") { public void run() {                    WaveformWindow.clearSimulationData(); }},                SEPARATOR,                new EMenuItem("_Export Simulation Data...") { public void run() {                    WaveformWindow.exportSimulationData(); }},                SEPARATOR,                new EMenuItem("Fill Only in _X") { public void run() {                    WaveformWindow.fillInX(); }},                new EMenuItem("Fill Only in _Y") { public void run() {                    WaveformWindow.fillInY(); }}                ),		// mnemonic keys available: AB DE GHIJKLMNOPQR  UVWXYZ            new EMenu("_Messages Window",                new EMenuItem("_Tile with Edit Window") { public void run() {                	TopLevel.getMessagesWindow().tileWithEdit(); }},                new EMenuItem("_Save Messages...") { public void run() {                    MessagesStream.getMessagesStream().save(); }},                new EMenuItem("_Clear") { public void run() {                    TopLevel.getMessagesWindow().clear(); }},                new EMenuItem("Set F_ont...") { public void run() {                    TopLevel.getMessagesWindow().selectFont(); }}),            MenuCommands.makeExtraMenu("j3d.ui.J3DMenu"),		// mnemonic keys available: ABCDEFGHIJK MNOPQ STUVWXYZ            new EMenu("Side _Bar",		        new EMenuItem("On _Left") { public void run() {                    WindowFrame.setSideBarLocation(true); }},		        new EMenuItem("On _Right") { public void run() {                    WindowFrame.setSideBarLocation(false); }}),            SEPARATOR        );        thisWindowMenu = menu;        return menu;    }    static EMenuItem getHiddenWindowCycleMenuItem() {        if (hiddenWindowCycleMenuItem == null) {            hiddenWindowCycleMenuItem = new EMenuItem("Window Cycle", KeyStroke.getKeyStroke('Q', 0)) {                public void run() {                WindowFrame.getWindows().next().requestFocus(); }};        }        return hiddenWindowCycleMenuItem;    }    private static DynamicEMenuItem messageDynamicMenu = null;    public static void setDynamicMenus()    {        List<DynamicEMenuItem> list = new ArrayList<DynamicEMenuItem>();        KeyStroke accelerator = getHiddenWindowCycleMenuItem().getAccelerator();        for (Iterator<WindowFrame> it = WindowFrame.getWindows(); it.hasNext();) {            WindowFrame wf = it.next();            list.add(new DynamicEMenuItem(wf, accelerator));            accelerator = null;        }        if (messageDynamicMenu == null)            messageDynamicMenu = new DynamicEMenuItem(accelerator);        list.add(messageDynamicMenu);        // Sort list of dynamic menus before adding into the menus        Collections.sort(list, new TextUtils.ObjectsByToString());        thisWindowMenu.setDynamicItems(list);    }    private static class DynamicEMenuItem extends EMenuItem    {        WindowFrame window;        public DynamicEMenuItem(WindowFrame w, KeyStroke accelerator)        {            super(w.getTitle(), accelerator);            window = w;        }        public DynamicEMenuItem(KeyStroke accelerator)        {            super("Electric Messages", accelerator);            window = null;        }        public String getDescription() { return "Window Cycle"; }        protected void updateButtons() {}        public void run()

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -