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

📄 windowmenu.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
		WindowFrame curWF = WindowFrame.getCurrentWindowFrame();		curWF.finished();	}//	private static void nextWindowCommand()//	{//		Object cur = null;//		List<Object> frames = new ArrayList<Object>();//		for(Iterator<WindowFrame> it = WindowFrame.getWindows(); it.hasNext(); )//		{//			WindowFrame wf = it.next();//			if (wf.isFocusOwner()) cur = wf;//			frames.add(wf);//		}//		MessagesWindow mw = TopLevel.getMessagesWindow();//		if (mw.isFocusOwner()) cur = mw;//		frames.add(mw);////		// find current frame in the list//		int found = -1;//		for(int i=0; i<frames.size(); i++)//		{//			if (cur == frames.get(i))//			{//				found = i;//				break;//			}//		}//		if (found >= 0)//		{//			found++;//			if (found >= frames.size()) found = 0;//			Object newCur = frames.get(found);//			if (newCur instanceof WindowFrame)//				((WindowFrame)newCur).requestFocus(); else//					((MessagesWindow)newCur).requestFocus();//		}//	}	private static Rectangle [] getArrangementWindowAreas()    {		// get list of possible window areas		Rectangle [] areas = TopLevel.getWindowAreas();        // remove the messages window        MessagesWindow mw = TopLevel.getMessagesWindow();        Rectangle mb = mw.getMessagesLocation();        removeOccludingRectangle(areas, mb);        return areas;    }    private static void removeOccludingRectangle(Rectangle [] areas, Rectangle occluding)    {		int cX = occluding.x + occluding.width/2;		int cY = occluding.y + occluding.height/2;        for (Rectangle area : areas)    	{			int lX = (int)area.getMinX();			int hX = (int)area.getMaxX();			int lY = (int)area.getMinY();			int hY = (int)area.getMaxY();			if (cX > lX && cX < hX && cY > lY && cY < hY)			{		        if (occluding.width > occluding.height)		        {		            // horizontally occluding window		            if (occluding.getMaxY() - lY < hY - occluding.getMinY())		            {		                // occluding window on top		                lY = (int)occluding.getMaxY();		            } else		            {		                // occluding window on bottom		                hY = (int)occluding.getMinY();		            }		        } else		        {		            if (occluding.getMaxX() - lX < hX - occluding.getMinX())		            {		                // occluding window on left		                lX = (int)occluding.getMaxX();		            } else		            {		                // occluding window on right		                hX = (int)occluding.getMinX();		            }		        }				area.x = lX;   area.width = hX - lX;				area.y = lY;   area.height = hY - lY;			}    	}    }    /**     * This method implements the command to set default background colors. This function resets colors     * set by blackBackgroundCommand or whiteBackgroundCommand.     */    public static void defaultBackgroundCommand()    {        User.resetFactoryColor(User.ColorPrefType.BACKGROUND);        User.resetFactoryColor(User.ColorPrefType.GRID);        User.resetFactoryColor(User.ColorPrefType.HIGHLIGHT);        User.resetFactoryColor(User.ColorPrefType.PORT_HIGHLIGHT);        User.resetFactoryColor(User.ColorPrefType.TEXT);        User.resetFactoryColor(User.ColorPrefType.INSTANCE);        User.resetFactoryColor(User.ColorPrefType.ARTWORK);		User.resetFactoryColor(User.ColorPrefType.WAVE_BACKGROUND);		User.resetFactoryColor(User.ColorPrefType.WAVE_FOREGROUND);		User.resetFactoryColor(User.ColorPrefType.WAVE_STIMULI);        // change the colors in the "Generic" technology        EDatabase.clientDatabase().getGeneric().setBackgroudColor(Color.BLACK);        // redraw        WindowFrame.repaintAllWindows();    }    /**     * This method implements the command to set colors so that there is a black background.     */    public static void blackBackgroundCommand()    {        User.setColor(User.ColorPrefType.BACKGROUND, Color.BLACK.getRGB());        User.setColor(User.ColorPrefType.GRID, Color.WHITE.getRGB());        User.setColor(User.ColorPrefType.HIGHLIGHT, Color.RED.getRGB());        User.setColor(User.ColorPrefType.PORT_HIGHLIGHT, Color.YELLOW.getRGB());        User.setColor(User.ColorPrefType.TEXT, Color.WHITE.getRGB());        User.setColor(User.ColorPrefType.INSTANCE, Color.WHITE.getRGB());        User.setColor(User.ColorPrefType.ARTWORK, Color.WHITE.getRGB());		User.setColor(User.ColorPrefType.WAVE_BACKGROUND, Color.BLACK.getRGB());		User.setColor(User.ColorPrefType.WAVE_FOREGROUND, Color.WHITE.getRGB());		User.setColor(User.ColorPrefType.WAVE_STIMULI, Color.RED.getRGB());		// change the colors in the "Generic" technology        EDatabase.clientDatabase().getGeneric().setBackgroudColor(Color.WHITE);        // redraw        WindowFrame.repaintAllWindows();    }    /**     * This method implements the command to set colors so that there is a white background.     */    public static void whiteBackgroundCommand()    {        User.setColor(User.ColorPrefType.BACKGROUND, Color.WHITE.getRGB());        User.setColor(User.ColorPrefType.GRID, Color.BLACK.getRGB());        User.setColor(User.ColorPrefType.HIGHLIGHT, Color.RED.getRGB());        User.setColor(User.ColorPrefType.PORT_HIGHLIGHT, Color.DARK_GRAY.getRGB());        User.setColor(User.ColorPrefType.TEXT, Color.BLACK.getRGB());        User.setColor(User.ColorPrefType.INSTANCE, Color.BLACK.getRGB());        User.setColor(User.ColorPrefType.ARTWORK, Color.BLACK.getRGB());		User.setColor(User.ColorPrefType.WAVE_BACKGROUND, Color.WHITE.getRGB());		User.setColor(User.ColorPrefType.WAVE_FOREGROUND, Color.BLACK.getRGB());		User.setColor(User.ColorPrefType.WAVE_STIMULI, Color.RED.getRGB());		// change the colors in the "Generic" technology        EDatabase.clientDatabase().getGeneric().setBackgroudColor(Color.BLACK);        // redraw        WindowFrame.repaintAllWindows();    }    private static GraphicsDevice [] getAllGraphicsDevices() {        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();        GraphicsDevice[] gs = ge.getScreenDevices();        return gs;    }    public static void moveToOtherDisplayCommand()    {        // this only works in SDI mode        if (TopLevel.isMDIMode()) return;        // find current screen        WindowFrame curWF = WindowFrame.getCurrentWindowFrame();        WindowContent content = curWF.getContent();        GraphicsConfiguration curConfig = content.getPanel().getGraphicsConfiguration();        GraphicsDevice curDevice = curConfig.getDevice();        // get all screens        GraphicsDevice[] gs = getAllGraphicsDevices();//        for (int j=0; j<gs.length; j++) {//            //System.out.println("Found GraphicsDevice: "+gs[j]+", type: "+gs[j].getType());//        }        // find screen after current screen        int i;        for (i=0; i<gs.length; i++) {            if (gs[i] == curDevice) break;        }        if (i == (gs.length - 1)) i = 0; else i++;      // go to next device        curWF.moveEditWindow(gs[i].getDefaultConfiguration());    }	public static void rememberDisplayLocation()    {        // this only works in SDI mode        if (TopLevel.isMDIMode()) return;        // remember main window information        WindowFrame curWF = WindowFrame.getCurrentWindowFrame();		TopLevel tl = curWF.getFrame();		Point pt = tl.getLocation();		User.setDefaultWindowPos(pt);		Dimension sz = tl.getSize();		User.setDefaultWindowSize(sz);		// remember messages information        MessagesWindow mw = TopLevel.getMessagesWindow();		Rectangle rect = mw.getMessagesLocation();		User.setDefaultMessagesPos(new Point(rect.x, rect.y));		User.setDefaultMessagesSize(new Dimension(rect.width, rect.height));    }    /**     * Go to the previous saved view for the current Edit Window     */    public static void goToPreviousSavedFocus() {        EditWindow wnd = EditWindow.needCurrent();        if (wnd == null) return;        EditWindowFocusBrowser browser = wnd.getSavedFocusBrowser();        browser.goBack();    }    /**     * Go to the previous saved view for the current Edit Window     */    public static void goToNextSavedFocus() {        EditWindow wnd = EditWindow.needCurrent();        if (wnd == null) return;        EditWindowFocusBrowser browser = wnd.getSavedFocusBrowser();        browser.goForward();    }    /**     * Inner job class to import Cadence colors     */    private static class ImportCadenceColorJob extends Job    {        private int response;        private String backFileName;        ImportCadenceColorJob(int r, String file)        {            super("Importing Cadence Colors", User.getUserTool(), Job.Type.EXAMINE, null, null, Job.Priority.USER);            response = r;            backFileName = file;            this.startJob();        }        public boolean doIt() throws JobException        {            if (response == 0) // Save previous preferences            {                if (backFileName != null)                    Pref.exportPrefs(backFileName);                else                   System.out.println("Previous Preferences not backup");            }            if (response != 2) // cancel            {                String cadenceFileName = "CadencePrefs.xml";                URL fileURL = Resources.getURLResource(TopLevel.class, cadenceFileName);                if (fileURL != null)                    Pref.importPrefs(fileURL, EDatabase.serverDatabase().getTechPool());                else                    System.out.println("Cannot import '" + cadenceFileName + "'");            }            return true;        }    }    /**     * Method to import color pattern used in Cadence     */    private static void importCadencePreferences()    {        String backFileName = null;        String [] options = { "Yes", "No", "Cancel Import"};        int response = Job.getUserInterface().askForChoice("Do you want to backup your preferences " +             "before importing Cadence values?", "Import Cadence Preferences", options, options[1]);        if (response == 0) // Save previous preferences        {            String fileName = OpenFile.chooseOutputFile(FileType.XML, "Backup Preferences", "electricPrefsBack.xml");            if (fileName != null)                backFileName = fileName; // only if it didn't cancel the dialog        }        new ImportCadenceColorJob(response, backFileName);    }}

⌨️ 快捷键说明

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