📄 user.java
字号:
// */// public void killObject(ElectricObject obj)// {// if (obj instanceof Cell)// {// Cell cell = (Cell)obj;// if (cell.isInTechnologyLibrary())// {// Manipulate.deletedCell(cell);// }// return;// }//// // remember what has changed in the cell// // 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 renaming of an ElectricObject.// * @param obj the ElectricObject that was renamed.// * @param oldName the former name of that ElectricObject.// */// public void renameObject(ElectricObject obj, Object oldName)// {// if (obj instanceof Cell)// {// Cell cell = (Cell)obj;// if (cell.isInTechnologyLibrary())// {// Manipulate.renamedCell((String)oldName, 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 request that an object be redrawn.// * @param obj the ElectricObject to be redrawn.// */// public void redrawObject(ElectricObject obj)// {// Cell cell = null;// Rectangle2D bounds = null;// if (obj instanceof Geometric)// {// Geometric geom = (Geometric)obj;// cell = geom.getParent();// }// if (obj instanceof PortInst)// {// PortInst pi = (PortInst)obj;// cell = pi.getNodeInst().getParent();// }// if (cell != null)// {// markCellForRedraw(cell, true);// 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)// {// setChangedInWindow(wnd, bounds);// }// }// }// }// }//// /**// * Method to announce that a Library is about to be saved to disk.// * @param lib the Library that will be written.// */// public void writeLibrary(Library lib)// {// }//// public void startBatch(Tool t, boolean undoRedo)// {// this.undoRedo = undoRedo;//// // project management tool runs quietly// Undo.ChangeBatch batch = Undo.getCurrentBatch();// if (batch != null && batch.getTool() == Project.getProjectTool()) this.undoRedo = true;// }//// /**// * Daemon Method called when a batch of changes ends.// */// public void endBatch()// {// if (Job.BATCHMODE) return;//// // redraw all windows with Cells that changed// for(Iterator<Cell> it = Undo.getChangedCells(); it.hasNext(); )// {// Cell cell = it.next();// markCellForRedraw(cell, true);// }//// // update "last designer" field// if (!undoRedo)// {// String userName = System.getProperty("user.name");// List<Cell> updateLastDesigner = new ArrayList<Cell>();//// for(Iterator<Cell> it = Undo.getChangedCells(); it.hasNext(); )// {// Cell cell = it.next();// if (!cell.isLinked()) continue;//// // see if the "last designer" should be changed on the cell// Variable var = cell.getVar(FRAME_LAST_CHANGED_BY);// if (var != null)// {// String lastDesigner = (String)var.getObject();// if (lastDesigner.equals(userName)) continue;// }//// // HACK: if cell is checked-in, don't try to modify it// int status = Project.getCellStatus(cell);// if (status == Project.CHECKEDIN || status == Project.CHECKEDOUTTOOTHERS) continue;//// // must update the "last designer" on this cell// updateLastDesigner.add(cell);// }//// if (updateLastDesigner.size() > 0)// {// // change the "last designer" on these cells// new SetLastDesigner(userName, updateLastDesigner);// }// }// }//// private static class SetLastDesigner extends Job// {// private String userName;// private List<Cell> updateLastDesigner;//// protected SetLastDesigner(String userName, List<Cell> updateLastDesigner)// {// super("Set Last Designer", User.getUserTool(), Job.Type.CHANGE, null, null, Job.Priority.USER);// this.userName = userName;// this.updateLastDesigner = updateLastDesigner;// startJob();// }//// public boolean doIt() throws JobException// {// for(Cell cell : updateLastDesigner)// {// cell.newVar(FRAME_LAST_CHANGED_BY, userName);// }// return true;// }// } /** * Handles database changes of a Job. * @param oldSnapshot database snapshot before Job. * @param newSnapshot database snapshot after Job and constraint propagation. * @param undoRedo true if Job was Undo/Redo job. */ public void endBatch(Snapshot oldSnapshot, Snapshot newSnapshot, boolean undoRedo) { for(Iterator<WindowFrame> wit = WindowFrame.getWindows(); wit.hasNext(); ) { WindowFrame wf = wit.next(); WindowContent content = wf.getContent(); if (!(content instanceof EditWindow)) continue; Cell winCell = content.getCell(); if (winCell == null) continue; EditWindow wnd = (EditWindow)content; if (!winCell.isLinked()) wnd.setCell(null, null, null); } EditWindow.invokeRenderJob();// // Mark cells for redraw// HashSet<Cell> marked = new HashSet<Cell>();// for (CellId cellId: newSnapshot.getChangedCells(oldSnapshot)) {// CellBackup newBackup = newSnapshot.getCell(cellId);// CellBackup oldBackup = oldSnapshot.getCell(cellId);// ERectangle newBounds = newSnapshot.getCellBounds(cellId);// ERectangle oldBounds = oldSnapshot.getCellBounds(cellId);// if (newBackup != oldBackup || newBounds != oldBounds) {// if (newBackup == null) continue; // What to do with deleted cells ??// Cell cell = Cell.inCurrentThread(cellId);// if (cell == null) continue; // This might be a desynchronization between GUI thread and delete???// markCellForRedrawRecursively(cell, marked);//// VectorDrawing.cellChanged(cell);// EditWindow.forceRedraw(cell);// }// }// for(Iterator<WindowFrame> wit = WindowFrame.getWindows(); wit.hasNext(); )// {// WindowFrame wf = wit.next();// WindowContent content = wf.getContent();// if (!(content instanceof EditWindow)) continue;// Cell winCell = content.getCell();// if (winCell == null) continue;// EditWindow wnd = (EditWindow)content;// if (!winCell.isLinked()) {// wnd.setCell(null, null, null);// } else if (marked.contains(winCell)) {// wnd.fullRepaint();// }// } } /** * Reloading oe renaming libraries has the side affect that any EditWindows * containing cells that were reloaded now point to old, unlinked * cells instead of the new ones. This method checks for this state * and fixes it. * @param idMapper mapping of Library/Cell/Export ids, null if the library was renamed. */ public static void fixStaleCellReferences(IdMapper idMapper) { if (idMapper == null) return; for (Iterator<WindowFrame> it = WindowFrame.getWindows(); it.hasNext(); ) { WindowFrame frame = it.next(); WindowContent wnd = frame.getContent(); Cell cell = wnd.getCell(); if (cell == null) continue; if (!cell.isLinked()) { CellId cellId = idMapper.get(cell.getId()); Cell newCell = EDatabase.clientDatabase().getCell(cellId); if (newCell == null) continue; wnd.setCell(newCell, VarContext.globalContext, null); } } } /************************** TRACKING CHANGES TO CELLS **************************/ private static Map<EditWindow,Rectangle2D> changedWindowRects = new HashMap<EditWindow,Rectangle2D>(); /** * Method to tell which area of a window has been changed. * @param wnd the EditWindow in question. * @return the area (in database coordinates) that have been modified and demand redisplay. */ public static Rectangle2D getChangedInWindow(EditWindow wnd) { Rectangle2D changedArea = changedWindowRects.get(wnd); return changedArea; } /** * Method to reset the area of a window that has been changed. * Call this after redisplaying that area so that nothing is queued for redraw. * @param wnd the EditWindow in question. */ public static void clearChangedInWindow(EditWindow wnd) { changedWindowRects.remove(wnd); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -