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

📄 editwindow.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
			{				dtde.dropComplete(false);				return;			}			EditWindow wnd = (EditWindow)dt.getComponent();			Point2D where = wnd.screenToDatabase(dtde.getLocation().x, dtde.getLocation().y);			EditWindow.gridAlign(where);			wnd.getHighlighter().clear();			NodeInst ni = null;			NodeProto np = null;			int defAngle = 0;			if (obj instanceof CellGroup)			{				np = wnd.whichCellInGroup((CellGroup)obj);			} else if (obj instanceof NodeProto)			{				np = (NodeProto)obj;				if (np instanceof PrimitiveNode)					defAngle = User.getNewNodeRotation();			} else if (obj instanceof NodeInst)			{				ni = (NodeInst)obj;				np = ni.getProto();			} else if (obj instanceof Cell.CellGroup)			{				Cell.CellGroup gp = (Cell.CellGroup)obj;				View view = wnd.getCell().getView();				if (view == View.SCHEMATIC)					view = View.ICON;				for (Iterator<Cell> itG = gp.getCells(); itG.hasNext();)				{					Cell c = itG.next();					if (c.getView() == view)					{						np = c; // found						break;					}				}				if (np == null)					System.out.println("No " + view + " type found in the dragged group '" + gp.getName() + "'");			} else if (obj instanceof String)			{				String str = (String)obj;				if (str.startsWith("LOADCELL "))				{					String cellName = str.substring(9);					np = Cell.findNodeProto(cellName);				}			}			if (np != null) // doesn't make sense to call this job if nothing is selected				new PaletteFrame.PlaceNewNode("Create Node", np, ni, defAngle, where, wnd.getCell(), null, false);		}	}	// ************************************* INFORMATION *************************************	/**	 * Method to return the top-level JPanel for this EditWindow.	 * The actual EditWindow object is below the top level, surrounded by scroll bars.	 * @return the top-level JPanel for this EditWindow.	 */	public JPanel getPanel() { return overall; }	/**	 * Method to return the location of this window on the user's screens.	 * @return the location of this window on the user's screens.	 */	public Point getScreenLocationOfCorner() { return overall.getLocationOnScreen(); }	/**	 * Method to return the current EditWindow.	 * @return the current EditWindow (null if none).	 */	public static EditWindow getCurrent()	{		WindowFrame wf = WindowFrame.getCurrentWindowFrame(false);		if (wf == null) return null;		if (wf.getContent() instanceof EditWindow) return (EditWindow)wf.getContent();		return null;	}	/**	 * Method to return the current EditWindow.	 * @return the current EditWindow.	 * If there is none, an error message is displayed and it returns null.	 */	public static EditWindow needCurrent()	{		WindowFrame wf = WindowFrame.getCurrentWindowFrame(false);		if (wf != null)		{			if (wf.getContent() instanceof EditWindow) return (EditWindow)wf.getContent();		}		System.out.println("There is no current window for this operation");		return null;	}	// ************************************* EDITWINDOW METHODS *************************************	/**	 * Method to return the cell that is shown in this window.	 * @return the cell that is shown in this window.	 */	public Cell getCell() { return cell; }	/**	 * Method to set the page number that is shown in this window.	 * Only applies to multi-page schematics.	 * @param pageNumber the page number that is shown in this window (0-based).	 */	public void setMultiPageNumber(int pageNumber)	{		if (this.pageNumber == pageNumber) return;		this.pageNumber = pageNumber;		setWindowTitle();		fillScreen();	}	/**	 * Method to return the page number that is shown in this window.	 * Only applies to multi-page schematics.	 * @return the page number that is shown in this window (0-based).	 */	public int getMultiPageNumber() { return pageNumber; }	/**	 * Method to tell whether this EditWindow is displaying a cell "in-place".	 * In-place display implies that the user has descended into a lower-level	 * cell while requesting that the upper-level remain displayed.	 * @return true if this EditWindow is displaying a cell "in-place".	 */	public boolean isInPlaceEdit() { return inPlaceDisplay; }	/**	 * Method to return the top-level cell for "in-place" display.	 * In-place display implies that the user has descended into a lower-level	 * cell while requesting that the upper-level remain displayed.	 * The top-level cell is the original cell that is remaining displayed.	 * @return the top-level cell for "in-place" display.	 */	public Cell getInPlaceEditTopCell() { return inPlaceDisplay ? inPlaceDescent.get(0).getParent() : cell; }	/**	 * Method to return a List of NodeInsts to the cell being in-place edited.	 * In-place display implies that the user has descended into a lower-level	 * cell while requesting that the upper-level remain displayed.	 * @return a List of NodeInsts to the cell being in-place edited.	 */	public List<NodeInst> getInPlaceEditNodePath() { return inPlaceDescent; }	/**	 * Method to set the List of NodeInsts to the cell being in-place edited.	 * In-place display implies that the user has descended into a lower-level	 * cell while requesting that the upper-level remain displayed.	 * @param da DisplayAttributes of EditWindow.	 */	private void setInPlaceEditNodePath(WindowFrame.DisplayAttributes da) {		inPlaceDescent = da.inPlaceDescent;		intoCell = da.getIntoCellTransform();		outofCell = da.getOutofCellTransform();		inPlaceDisplay = !inPlaceDescent.isEmpty();	}	/**	 * Method to return the transformation matrix from the displayed top-level cell to the current cell.	 * In-place display implies that the user has descended into a lower-level	 * cell while requesting that the upper-level remain displayed.	 * @return the transformation matrix from the displayed top-level cell to the current cell.	 */	public AffineTransform getInPlaceTransformIn() { return intoCell; }	/**	 * Method to return the transformation matrix from the current cell to the displayed top-level cell.	 * In-place display implies that the user has descended into a lower-level	 * cell while requesting that the upper-level remain displayed.	 * @return the transformation matrix from the current cell to the displayed top-level cell.	 */	public AffineTransform getInPlaceTransformOut() { return outofCell; }	/**	 * Get the highlighter for this WindowContent.	 * @return the highlighter.	 */	public Highlighter getHighlighter() { return highlighter; }	/**	 * Get the mouse over highlighter for this EditWindow.	 * @return the mouse over highlighter.	 */	public Highlighter getMouseOverHighlighter() { return mouseOverHighlighter; }	/**	 * Get the ruler highlighter for this EditWindow (for measurement).	 * @return the ruler highlighter.	 */	public Highlighter getRulerHighlighter() { return rulerHighlighter; }	/**	 * Get the RTree with all text in this Cell.	 * @return the RTree with all text in this Cell.	 */	public RTNode getTextInCell() { return textInCell; }	/**	 * Set the RTree with all text in this Cell.	 * @param tic the RTree with all text in this Cell.	 */	public void setTextInCell(RTNode tic) { textInCell = tic; }	/**	 * Method to return the WindowFrame in which this EditWindow resides.	 * @return the WindowFrame in which this EditWindow resides.	 */	public WindowFrame getWindowFrame() { return wf; }	/**	 * Method to set the cell that is shown in the window to "cell".	 */	public void setCell(Cell cell, VarContext context, WindowFrame.DisplayAttributes displayAttributes)	{		// by default record history and fillscreen		// However, when navigating through history, don't want to record new history objects.		if (context == null) context = VarContext.globalContext;		boolean fillTheScreen = false;		if (displayAttributes == null)		{			displayAttributes = new WindowFrame.DisplayAttributes(getScale(), getOffset().getX(), getOffset().getY(),				new ArrayList<NodeInst>());			fillTheScreen = true;		}		// recalculate the screen size		sz = getSize();		szHalfWidth = sz.width / 2;		szHalfHeight = sz.height / 2;		showCell(cell, context, fillTheScreen, displayAttributes);	}	/**	 * Method to show a cell with ports, display factors, etc.	 */	private void showCell(Cell cell, VarContext context, boolean fillTheScreen,		WindowFrame.DisplayAttributes displayAttributes)	{		// record current history before switching to new cell		wf.saveCurrentCellHistoryState();		// remove highlighters from the window		uninstallHighlighters();		// set new values		this.cell = cell;		textInCell = null;		setInPlaceEditNodePath(displayAttributes);		this.pageNumber = 0;		cellVarContext = context;		if (cell != null) {			Library lib = cell.getLibrary();			Job.getUserInterface().setCurrentCell(lib, cell);		}		setDrawingAlgorithm();		// add new highlighters from the window		installHighlighters();		viewBrowser.clear();		setWindowTitle();		if (wf != null)		{			if (cell != null)			{				if (wf == WindowFrame.getCurrentWindowFrame(false))				{					// if auto-switching technology, do it					WindowFrame.autoTechnologySwitch(cell, wf);				}			}		}		if (fillTheScreen) fillScreen(); else		{			setScale(displayAttributes.scale);			setOffset(new Point2D.Double(displayAttributes.offX, displayAttributes.offY));		}		if (cell != null && User.isCheckCellDates()) cell.checkCellDates();		// clear list of cross-probed levels for this EditWindow		clearCrossProbeLevels();		// update cell information in the status bar		StatusBar.updateStatusBar();	}	/**	 * Method to set the window title.	 */	public void setWindowTitle()	{		if (wf == null) return;		wf.setTitle(wf.composeTitle(cell, "", pageNumber));	}	/**	 * Method to find an EditWindow that is displaying a given cell.	 * @param cell the Cell to find.	 * @return the EditWindow showing that cell, or null if none found.	 */	public static EditWindow findWindow(Cell cell)	{		for(Iterator<WindowFrame> it = WindowFrame.getWindows(); it.hasNext(); )		{			WindowFrame wf = it.next();			WindowContent content = wf.getContent();			if (!(content instanceof EditWindow)) continue;			if (content.getCell() == cell) return (EditWindow)content;		}		return null;	}	/**	 * Method to bring to the front a WindowFrame associated to a given Cell.	 * If no WindowFrame is found, a new WindowFrame will be created and displayed	 * @param c the Cell in the window to raise.	 * @param varC the Context of that window.	 * @return the EditWindow of the cell that was found or created.	 */	public static EditWindow showEditWindowForCell(Cell c, VarContext varC)	{		for(Iterator<WindowFrame> it2 = WindowFrame.getWindows(); it2.hasNext(); )		{			WindowFrame wf = it2.next();			WindowContent content = wf.getContent();			if (c != content.getCell())				continue;			if (!(content instanceof EditWindow))				continue;			EditWindow wnd = (EditWindow)content;			if (varC != null) // it has to be an EditWindow class			{				// VarContexts must match				if (!varC.equals(wnd.getVarContext()))					continue;			}			WindowFrame.showFrame(wf);			return wnd;		}		// If no window is found, then create one		WindowFrame wf = WindowFrame.createEditWindow(c);		EditWindow wnd = (EditWindow)wf.getContent();		wnd.setCell(c, varC, null);		return wnd;	}	public List<MutableTreeNode> loadExplorerTrees()	{		return wf.loadDefaultExplorerTree();	}	/**	 * Method to get rid of this EditWindow.  Called by WindowFrame when	 * that windowFrame gets closed.	 */	public void finished()	{		//wf = null;						// clear reference		//offscreen = null;					// need to clear this ref, because it points to this		// remove myself from listener list		uninstallHighlighters();		UserInterfaceMain.removeDatabaseChangeListener(this);		Highlighter.removeHighlightListener(this);	}	// ************************************* SCROLLING *************************************	/**	 * Method to return the scroll bar resolution.	 * This is the extent of the JScrollBar.	 * @return the scroll bar resolution.	 */	public static int getScrollBarResolution() { return SCROLLBARRESOLUTION; }	/**	 * This class handles changes to the edit window scroll bars.	 */	private static class ScrollAdjustmentListener implements AdjustmentListener	{		/** A weak reference to the WindowFrame */		EditWindow wnd;		ScrollAdjustmentListener(EditWindow wnd)		{			super();			this.wnd = wnd;

⌨️ 快捷键说明

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