📄 editmenu.java
字号:
Variable var = vIt.next(); if (likeThis.contains(var.getKey().getName())) highlighter.addText(ni, curCell, var.getKey()); } } for(Iterator<ArcInst> it = curCell.getArcs(); it.hasNext(); ) { ArcInst ai = it.next(); if (likeThis.contains(ai.getProto())) highlighter.addElectricObject(ai, curCell); if (likeThis.contains(ArcInst.ARC_NAME.getName())) highlighter.addText(ai, curCell, ArcInst.ARC_NAME); for(Iterator<Variable> vIt = ai.getVariables(); vIt.hasNext(); ) { Variable var = vIt.next(); if (likeThis.contains(var.getKey().getName())) highlighter.addText(ai, curCell, var.getKey()); } } for(Iterator<Export> it = curCell.getExports(); it.hasNext(); ) { Export e = it.next(); PortCharacteristic pc = e.getCharacteristic(); if (!likeThis.contains(pc.getName())) continue; highlighter.addText(e, curCell, Export.EXPORT_NAME); } for(Iterator<Variable> vIt = curCell.getParametersAndVariables(); vIt.hasNext(); ) { Variable var = vIt.next(); if (likeThis.contains(var.getKey().getName())) highlighter.addText(curCell, curCell, var.getKey()); } highlighter.finished(); System.out.println("Selected "+highlighter.getNumHighlights()+ " objects"); } /** * Method to select the next object that is of the same type as the current object. */ public static void selectNextLikeThisCommand(boolean next) { Cell curCell = WindowFrame.needCurCell(); if (curCell == null) return; EditWindow wnd = EditWindow.getCurrent(); if (wnd == null) return; Highlighter highlighter = wnd.getHighlighter(); Highlight2 high = highlighter.getOneHighlight(); if (high == null) return; ElectricObject eObj = high.getElectricObject(); if (high.isHighlightEOBJ()) { if (eObj instanceof PortInst) { eObj = ((PortInst)eObj).getNodeInst(); } if (eObj instanceof NodeInst) { NodeInst thisNi = (NodeInst)eObj; NodeInst [] allNodes = new NodeInst[curCell.getNumNodes()]; int tot = 0; int which = 0; for(Iterator<NodeInst> it = curCell.getNodes(); it.hasNext(); ) { NodeInst ni = it.next(); if (ni.getProto() != thisNi.getProto()) continue; if (ni == thisNi) which = tot; allNodes[tot++] = ni; } if (next) { which++; if (which >= tot) which = 0; } else { which--; if (which < 0) which = tot - 1; } highlighter.clear(); highlighter.addElectricObject(allNodes[which], curCell); highlighter.finished(); return; } if (eObj instanceof ArcInst) { ArcInst thisAi = (ArcInst)eObj; ArcInst [] allArcs = new ArcInst[curCell.getNumArcs()]; int tot = 0; int which = 0; for(Iterator<ArcInst> it = curCell.getArcs(); it.hasNext(); ) { ArcInst ai = it.next(); if (ai.getProto() != thisAi.getProto()) continue; if (ai == thisAi) which = tot; allArcs[tot++] = ai; } if (next) { which++; if (which >= tot) which = 0; } else { which--; if (which < 0) which = tot - 1; } highlighter.clear(); highlighter.addElectricObject(allArcs[which], curCell); highlighter.finished(); return; } } if (high.isHighlightText()) { if (eObj instanceof Export) { PortCharacteristic pc = ((Export)eObj).getCharacteristic(); List<Export> allExports = new ArrayList<Export>(); int which = 0; for(Iterator<Export> it = curCell.getExports(); it.hasNext(); ) { Export e = it.next(); if (e.getCharacteristic() != pc) continue; if (e == eObj) which = allExports.size(); allExports.add(e); } if (next) { which++; if (which >= allExports.size()) which = 0; } else { which--; if (which < 0) which = allExports.size() - 1; } highlighter.clear(); highlighter.addText(allExports.get(which), curCell, Export.EXPORT_NAME); highlighter.finished(); } else { // advance to next with this name List<Key> allVarKeys = new ArrayList<Key>(); List<ElectricObject> allVarObjs = new ArrayList<ElectricObject>(); int which = 0; for(Iterator<ArcInst> it = curCell.getArcs(); it.hasNext(); ) { ArcInst ai = it.next(); for(Iterator<Variable> vIt = ai.getVariables(); vIt.hasNext(); ) { Variable var = vIt.next(); if (var.getKey() != high.getVarKey()) continue; if (ai == high.getElectricObject() && var.getKey() == high.getVarKey()) which = allVarKeys.size(); allVarKeys.add(var.getKey()); allVarObjs.add(ai); } } for(Iterator<NodeInst> it = curCell.getNodes(); it.hasNext(); ) { NodeInst ni = it.next(); for(Iterator<Variable> vIt = ni.getParametersAndVariables(); vIt.hasNext(); ) { Variable var = vIt.next(); if (var.getKey() != high.getVarKey()) continue; if (ni == high.getElectricObject() && var.getKey() == high.getVarKey()) which = allVarKeys.size(); allVarKeys.add(var.getKey()); allVarObjs.add(ni); } } for(Iterator<Variable> vIt = curCell.getVariables(); vIt.hasNext(); ) { Variable var = vIt.next(); if (var.getKey() != high.getVarKey()) continue; if (curCell == high.getElectricObject() && var.getKey() == high.getVarKey()) which = allVarKeys.size(); allVarKeys.add(var.getKey()); allVarObjs.add(curCell); } if (next) { which++; if (which >= allVarKeys.size()) which = 0; } else { which--; if (which < 0) which = allVarKeys.size() - 1; } highlighter.clear(); highlighter.addText(allVarObjs.get(which), curCell, allVarKeys.get(which)); highlighter.finished(); } return; } System.out.println("Cannot advance the current selection"); } /** * This method implements the command to highlight nothing in the current Cell. */ public static void selectNothingCommand() { EditWindow wnd = EditWindow.getCurrent(); if (wnd == null) return; wnd.getHighlighter().clear(); wnd.getHighlighter().finished(); } /** * This method implements the command to deselect all selected arcs. */ public static void deselectAllArcsCommand() { EditWindow wnd = EditWindow.getCurrent(); if (wnd == null) return; Highlighter highlighter = wnd.getHighlighter(); List<Highlight2> newHighList = new ArrayList<Highlight2>(); for(Highlight2 h : highlighter.getHighlights()) { if (h.isHighlightEOBJ() || h.isHighlightText()) { if (h.getElectricObject() instanceof ArcInst) continue; } newHighList.add(h); } highlighter.clear(); highlighter.setHighlightList(newHighList); highlighter.finished(); } /** * This method implements the command to make all selected objects be easy-to-select. */ public static void selectMakeEasyCommand() { EditWindow wnd = EditWindow.getCurrent(); if (wnd == null) return; List<Geometric> highlighted = wnd.getHighlighter().getHighlightedEObjs(true, true); new SetEasyHardSelect(true, highlighted); } /** * This method implements the command to make all selected objects be hard-to-select. */ public static void selectMakeHardCommand() { EditWindow wnd = EditWindow.getCurrent(); if (wnd == null) return; List<Geometric> highlighted = wnd.getHighlighter().getHighlightedEObjs(true, true); new SetEasyHardSelect(false, highlighted); } /** * Class to set selected objects "easy to select" or "hard to select". */ private static class SetEasyHardSelect extends Job { private boolean easy; private List<Geometric> highlighted; private SetEasyHardSelect(boolean easy, List<Geometric> highlighted) { super("Make Selected Objects Easy/Hard To Select", User.getUserTool(), Job.Type.CHANGE, null, null, Job.Priority.USER); this.easy = easy; this.highlighted = highlighted; startJob(); } public boolean doIt() throws JobException { for(Geometric geom : highlighted) { if (geom instanceof NodeInst) { NodeInst ni = (NodeInst)geom; if (easy) { ni.clearHardSelect(); } else { ni.setHardSelect(); } } else { ArcInst ai = (ArcInst)geom; if (easy) { ai.setHardSelect(false); } else { ai.setHardSelect(true); } } } return true; } } /** * This method implements the command to replace the rectangular highlight * with the selection of objects in that rectangle. */ public static void selectEnclosedObjectsCommand() { EditWindow wnd = EditWindow.needCurrent(); if (wnd == null) return; Highlighter highlighter = wnd.getHighlighter(); Rectangle2D selection = highlighter.getHighlightedArea(wnd); highlighter.clear(); if (selection != null ) highlighter.selectArea(wnd, selection.getMinX(), selection.getMaxX(), selection.getMinY(), selection.getMaxY(), false, ToolBar.isSelectSpecial()); highlighter.finished(); } /** * This method implements the command to show the next logged error. * The error log lists the results of the latest command (DRC, NCC, etc.) */ private static void showNextErrorCommand() { String msg = ErrorLoggerTree.reportNextMessage(); System.out.println(msg); } /** * This method implements the command to show the last logged error. * The error log lists the results of the latest command (DRC, NCC, etc.) */ private static void showPrevErrorCommand() { String msg = ErrorLoggerTree.reportPrevMessage(); System.out.println(msg); } /** * This method implements the command to add the currently selected network * to the waveform window, in a new panel. */ public static void addToWaveformNewCommand() { WindowFrame wf = WindowFrame.getCurrentWindowFrame(); if (!(wf.getContent() instanceof EditWindow)) return; EditWindow wnd = (EditWindow)wf.getContent(); WaveformWindow.Locator wwLoc = new WaveformWindow.Locator(wnd); WaveformWindow ww = wwLoc.getWaveformWindow(); if (ww == null) { System.out.println("Cannot add selected signals to the waveform window: no waveform window is associated with this cell"); return; } ww.showSignals(wnd.getHighlighter(), wwLoc.getContext(), true); } /** * This method implements the command to add the currently selected network * to the waveform window, overlaid on top of the current panel. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -