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

📄 user.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: User.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;import com.sun.electric.database.IdMapper;import com.sun.electric.database.Snapshot;import com.sun.electric.database.geometry.Dimension2D;import com.sun.electric.database.hierarchy.Cell;import com.sun.electric.database.hierarchy.EDatabase;import com.sun.electric.database.hierarchy.Library;import com.sun.electric.database.id.CellId;import com.sun.electric.database.prototype.NodeProto;import com.sun.electric.database.text.Pref;import com.sun.electric.database.text.Setting;import com.sun.electric.database.text.TextUtils;import com.sun.electric.database.topology.NodeInst;import com.sun.electric.database.variable.VarContext;import com.sun.electric.database.variable.Variable;import com.sun.electric.technology.ArcProto;import com.sun.electric.technology.Technology;import com.sun.electric.technology.technologies.Artwork;import com.sun.electric.tool.Job;import com.sun.electric.tool.Listener;import com.sun.electric.tool.user.redisplay.VectorCache;import com.sun.electric.tool.user.tecEdit.GeneralInfo;import com.sun.electric.tool.user.ui.EditWindow;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 java.applet.Applet;import java.applet.AudioClip;import java.awt.Color;import java.awt.Dimension;import java.awt.Point;import java.awt.geom.Rectangle2D;import java.lang.reflect.Method;import java.net.URL;import java.util.ArrayList;import java.util.HashMap;import java.util.Iterator;import java.util.List;import java.util.Map;import java.util.StringTokenizer;/** * This is the User Interface tool. */public class User extends Listener{	// ---------------------- private and protected methods -----------------	/** the User Interface tool. */		private static User tool = new User();	/** key of Variable holding cell frame information. */				public static final Variable.Key FRAME_SIZE = Variable.newKey("FACET_schematic_page_size");	/** key of Variable holding cell company name. */					public static final Variable.Key FRAME_COMPANY_NAME = Variable.newKey("USER_drawing_company_name");	/** key of Variable holding cell designer name. */					public static final Variable.Key FRAME_DESIGNER_NAME = Variable.newKey("USER_drawing_designer_name");	/** key of Variable holding user who last changed the cell. */		public static final Variable.Key FRAME_LAST_CHANGED_BY = Variable.newKey("USER_drawing_last_changed_by");	/** key of Variable holding cell project name. */					public static final Variable.Key FRAME_PROJECT_NAME = Variable.newKey("USER_drawing_project_name");	private ArcProto currentArcProto = null;	private NodeProto currentNodeProto = null;//	private boolean undoRedo;	/**	 * The constructor sets up the User tool.	 */	private User()	{		super("user");	}	/**	 * Method to initialize the User Interface tool.	 */	public void init()	{		// the user interface tool is always on		setOn();		setIncremental();		if (Job.getRunMode() != Job.Mode.CLIENT)			Clipboard.clear(); // To initialize Clibpoard Cell	}	/**	 * Method to retrieve the singleton associated with the User tool.	 * @return the User tool.	 */	public static User getUserTool() { return tool; }//	/**//	 * Method to handle a change to a NodeInst.//	 * @param ni the NodeInst that was changed.//	 * @param oldD the old contents of the NodeInst.//	 *///	public void modifyNodeInst(NodeInst ni, ImmutableNodeInst oldD)//	{//		Clipboard.nodeMoved(ni, oldD.anchor.getX(), oldD.anchor.getY());////		// remember what has changed in the cell//		Cell cell = ni.getParent();//		Rectangle2D.Double oldBounds = new Rectangle2D.Double();//		oldD.computeBounds(ni, oldBounds);//		Rectangle2D.Double newBounds = new Rectangle2D.Double();//		ni.getD().computeBounds(ni, newBounds);	// TO DO Why can't we use "ni.getBounds()" ?//		for(Iterator<WindowFrame> it = WindowFrame.getWindows(); it.hasNext(); )//		{//			WindowFrame wf = it.next();//			if (wf.getContent() instanceof EditWindow)//			{//				EditWindow wnd = (EditWindow)wf.getContent();//				if (wnd.getCell() == cell)//				{//					// TO DO figure out way to find text bounds on the OLD object//					setChangedInWindow(wnd, oldBounds);////					// figure out full bounds including text//					Rectangle2D newTextBounds = ni.getTextBounds(wnd);//					if (newTextBounds == null) setChangedInWindow(wnd, newBounds); else//					{//						Rectangle2D.union(newTextBounds, newBounds, newTextBounds);//						setChangedInWindow(wnd, newTextBounds);//					}//				}//			}//		}//	}////	/**//	 * Method to handle a change to an ArcInst.//	 * @param ai the ArcInst that changed.//	 * @param oD the old contents of the ArcInst.//	 *///	public void modifyArcInst(ArcInst ai, ImmutableArcInst oD)//	{//		// remember what has changed in the cell//		Cell cell = ai.getParent();//		Poly oldPoly = ArcInst.makePolyForArc(ai, oD.length, oD.width, oD.headLocation, oD.tailLocation, Poly.Type.FILLED);//		Rectangle2D oldBounds = oldPoly.getBounds2D();//		Rectangle2D newBounds = ai.getBounds();//		for(Iterator<WindowFrame> it = WindowFrame.getWindows(); it.hasNext(); )//		{//			WindowFrame wf = it.next();//			if (wf.getContent() instanceof EditWindow)//			{//				EditWindow wnd = (EditWindow)wf.getContent();//				if (wnd.getCell() == cell)//				{//					// TO DO figure out way to find text bounds on the OLD object//					setChangedInWindow(wnd, oldBounds);////					// figure out full bounds including text//					Rectangle2D newTextBounds = ai.getTextBounds(wnd);//					if (newTextBounds == null) setChangedInWindow(wnd, newBounds); else//					{//						Rectangle2D.union(newTextBounds, newBounds, newTextBounds);//						setChangedInWindow(wnd, newTextBounds);//					}//				}//			}//		}//	}////	/**//	 * Method to handle a change to an Export.//	 * @param pp the Export that moved.//	 * @param oD the old contents of the Export.//	 *///	public void modifyExport(Export pp, ImmutableExport oD)//	{//		PortInst oldPi = ((Cell)pp.getParent()).getPortInst(oD.originalNodeId, oD.originalPortId);//		// remember what has changed in the cell//		Cell cell = (Cell)pp.getParent();//		NodeInst oldNi = oldPi.getNodeInst();//		NodeInst newNi = pp.getOriginalPort().getNodeInst();//		Rectangle2D oldBounds = oldPi.getBounds();//		Rectangle2D newBounds = newNi.getBounds();//		for(Iterator<WindowFrame> it = WindowFrame.getWindows(); it.hasNext(); )//		{//			WindowFrame wf = it.next();//			if (wf.getContent() instanceof EditWindow)//			{//				EditWindow wnd = (EditWindow)wf.getContent();//				if (wnd.getCell() == cell)//				{//					// figure out full bounds including text//					Rectangle2D oldTextBounds = oldNi.getTextBounds(wnd);//					if (oldTextBounds == null) setChangedInWindow(wnd, oldBounds); else//					{//						Rectangle2D.union(oldTextBounds, oldBounds, oldTextBounds);//						setChangedInWindow(wnd, oldTextBounds);//					}////					// figure out full bounds including text//					Rectangle2D newTextBounds = newNi.getTextBounds(wnd);//					if (newTextBounds == null) setChangedInWindow(wnd, newBounds); else//					{//						Rectangle2D.union(newTextBounds, newBounds, newTextBounds);//						setChangedInWindow(wnd, newTextBounds);//					}//				}//			}//		}//	}////	/**//	 * Method to handle a change to a Cell.//	 * @param cell the Cell that was changed.//	 * @param oD the old contents of the Cell.//	 *///	public void modifyCell(Cell cell, ImmutableCell oD) {//		redrawObject(cell);//		CellName oldCellName = oD.cellName;//		if (cell.getCellName() == oldCellName) return;//		if (cell.isInTechnologyLibrary()) {//			Manipulate.renamedCell(oldCellName.getName(), cell.getName());//		}//		for(Iterator<WindowFrame> it = WindowFrame.getWindows(); it.hasNext(); ) {//			WindowFrame wf = it.next();//			WindowContent content = wf.getContent();//			if (content.getCell() != cell) continue;//			content.setWindowTitle();//		}//	}////	/**//	 * Method to handle a change to a Library.//	 * @param lib the Library that was changed.//	 * @param oldD the old contents of the Library.//	 *///	public void modifyLibrary(Library lib, ImmutableLibrary oldD) {}////	/**//	 * Method to handle the creation of a new ElectricObject.//	 * @param obj the ElectricObject that was just created.//	 *///	public void newObject(ElectricObject obj)//	{//		// remember what has changed in the cell//		Cell cell = null;//		Rectangle2D bounds = null;//		if (obj instanceof NodeInst)//		{//			NodeInst ni = (NodeInst)obj;//			cell = ni.getParent();//			bounds = ni.getBounds();//		} else if (obj instanceof ArcInst)//		{//			ArcInst ai = (ArcInst)obj;//			cell = ai.getParent();//			bounds = ai.getBounds();//		} else if (obj instanceof Export)//		{//			Export pp = (Export)obj;//			cell = (Cell)pp.getParent();//			bounds = pp.getOriginalPort().getNodeInst().getBounds();//		}//		if (cell == null) return;//		for(Iterator<WindowFrame> it = WindowFrame.getWindows(); it.hasNext(); )//		{//			WindowFrame wf = it.next();//			if (wf.getContent() instanceof EditWindow)//			{//				EditWindow wnd = (EditWindow)wf.getContent();//				if (wnd.getCell() == cell)//				{//					// figure out full bounds including text//					Rectangle2D textBounds = obj.getTextBounds(wnd);//					if (textBounds == null) setChangedInWindow(wnd, bounds); else//					{//						Rectangle2D.union(textBounds, bounds, textBounds);//						setChangedInWindow(wnd, bounds);//					}//				}//			}//		}//	}////	/**//	 * Method to handle the deletion of an ElectricObject.//	 * @param obj the ElectricObject that was just deleted.

⌨️ 快捷键说明

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