📄 layertab.java
字号:
opacityChanged(); } private void opacityChanged() { for(Iterator<WindowFrame> it = WindowFrame.getWindows(); it.hasNext(); ) { WindowFrame wf = it.next(); WindowContent content = wf.getContent(); if (!(content instanceof EditWindow)) continue; EditWindow wnd = (EditWindow)content; wnd.opacityChanged(); LayerTab layerTab = wf.getLayersTab(); if (layerTab == this) wnd.repaint(); } } /** * Method to clear all highlighting. */ private void clearAllHighlight() { for(int i=0; i<layerListModel.size(); i++) { changeHighlighted(i, 0); } } private void toggleHighlight() { int [] indices = layerList.getSelectedIndices(); for(int i=0; i<indices.length; i++) { int line = indices[i]; changeHighlighted(line, 1); } } /** * Method to select all layers. */ private void selectAll() { int len = layerListModel.size(); int [] indices = new int[len]; for(int i=0; i<len; i++) indices[i] = i; layerList.setSelectedIndices(indices); } /** * Method to make the selected layers visible or invisible. * @param on true to make selected layers visible. */ private void setVisibility(boolean on) { int [] indices = layerList.getSelectedIndices(); for(int i=0; i<indices.length; i++) { int line = indices[i]; setVisibility(line, on, false); } // update the display update(); } private boolean isLineChecked(int i) { String s = (String)layerListModel.get(i); if (s.charAt(0) == ' ') return false; return true; } private Layer getSelectedLayer(int i) { String name = (String)layerListModel.get(i); if (name != null) name = name.substring(2); String techName = (String)technology.getSelectedItem(); Technology tech = Technology.findTechnology(techName); int spacePos = name.indexOf(' '); if (spacePos >= 0) name = name.substring(0, spacePos); Layer layer = tech.findLayer(name); if (layer == null) { layer = Generic.tech().findLayer(name); if (layer == null) System.out.println("Can't find "+name); } return layer; } /** * Method to change a line of the layer list. * @param i the line number to change. * @param on true to make that layer visible. */ private void setVisibility(int i, boolean on, boolean doUpdate) { // find the layer on the given line Layer layer = getSelectedLayer(i); if (layer == null) return; // remember the state of this layer visibility.put(layer, Boolean.valueOf(on)); // update the list layerListModel.set(i, lineName(layer)); // update the display if (doUpdate) update(); } /** * Set the metal layer at the given level visible, * and turn off all other layers. Layer 0 turns on all layers. * @param level metal level */ public void setVisibilityLevel(int level) { int len = layerListModel.size(); Layer metalLayer = null; if (level == 0) { for (int i=0; i<len; i++) { Layer layer = getSelectedLayer(i); visibility.put(layer, Boolean.TRUE); layerListModel.set(i, lineName(layer)); } } else { for (int i=0; i<len; i++) { Layer layer = getSelectedLayer(i); Layer.Function func = layer.getFunction(); if (func.isContact() || func.isDiff() || func.isGatePoly() || func.isImplant() || func.isMetal() || func.isPoly() || func.isWell() || func.isDummy() || func.isDummyExclusion()) { Boolean b = Boolean.valueOf(false); if (level == 2 && layer.getFunction() == Layer.Function.GATE) b = Boolean.valueOf(true); if (level == 2 && (layer.getFunction() == Layer.Function.DIFF || layer.getFunction() == Layer.Function.DIFFN || layer.getFunction() == Layer.Function.DIFFP)) b = Boolean.valueOf(true); if (level == 1 && layer.getFunction().getLevel() <= 1) b = Boolean.valueOf(true); if (layer.getFunction().getLevel() == level) { b = Boolean.valueOf(true); if (layer.getFunction().isMetal()) metalLayer = layer; } if (layer.getFunction().getLevel() == (level-1) || level == 0) b = Boolean.valueOf(true); if (layer.getFunction().isContact() && layer.getFunction().getLevel() == (level-1)) b = Boolean.valueOf(false); visibility.put(layer, b); layerListModel.set(i, lineName(layer)); } } } // turn on all layers with the same height as the main metal layer if (metalLayer != null) {// for (int i=0; i<len; i++) {// Layer layer = getSelectedLayer(i);// if (layer.getFunction().getHeight() == metalLayer.getFunction().getHeight()) {// visibility.put(layer, true);// layerListModel.set(i, lineName(layer));// }// } } update(); } /** * Method to change a line of the layer list. * @param i the line number to change. * @param how 1: toggle highlighting; 0: clear highlighting. */ private void changeHighlighted(int i, int how) { // find the layer on the given line String name = (String)layerListModel.get(i); if (name != null) name = name.substring(2); String techName = (String)technology.getSelectedItem(); Technology tech = Technology.findTechnology(techName); int spacePos = name.indexOf(' '); if (spacePos >= 0) name = name.substring(0, spacePos); Layer layer = tech.findLayer(name); if (layer == null) { System.out.println("Can't find "+name); return; } // remember the state of this layer boolean newState = false; if (how == 1) newState = !highlighted.get(layer).booleanValue(); highlighted.put(layer, Boolean.valueOf(newState)); // update the list layerListModel.set(i, lineName(layer)); // update the display update(); } private void update() { // see if anything was highlighted boolean changed = false; boolean anyHighlighted = false; for(Iterator<Technology> it = Technology.getTechnologies(); it.hasNext(); ) { Technology tech = it.next(); for(Iterator<Layer> lIt = tech.getLayers(); lIt.hasNext(); ) { Layer layer = lIt.next(); Boolean layerHighlighted = highlighted.get(layer.getNonPseudoLayer()); if (layerHighlighted != null && layerHighlighted.booleanValue()) anyHighlighted = true; } } // update visibility and highlighting for(Iterator<Technology> it = Technology.getTechnologies(); it.hasNext(); ) { Technology tech = it.next(); for(Iterator<Layer> lIt = tech.getLayers(); lIt.hasNext(); ) { Layer layer = lIt.next(); Boolean layerVis = visibility.get(layer.getNonPseudoLayer()); if (layerVis != null) { if (layer.isVisible() != layerVis.booleanValue()) { changed = true; layer.setVisible(layerVis.booleanValue()); // graphics notifies to all 3D observers if available layer.getGraphics().notifyVisibility(layerVis); } } Boolean layerHighlighted = highlighted.get(layer.getNonPseudoLayer()); if (layerHighlighted != null) { boolean newState = false; if (anyHighlighted && !layerHighlighted.booleanValue()) newState = true; if (newState != layer.isDimmed()) { layer.setDimmed(newState); changed = true; } } } } // recompute visibility of primitive nodes and arcs for(Iterator<Technology> it = Technology.getTechnologies(); it.hasNext(); ) { Technology tech = it.next(); for(Iterator<PrimitiveNode> nIt = tech.getNodes(); nIt.hasNext(); ) { PrimitiveNode np = nIt.next(); Technology.NodeLayer [] layers = np.getLayers(); boolean invisible = true; for(int i=0; i<layers.length; i++) { Technology.NodeLayer lay = layers[i]; if (lay.getLayer().isVisible()) { invisible = false; break; } } np.setNodeInvisible(invisible); } for(Iterator<ArcProto> aIt = tech.getArcs(); aIt.hasNext(); ) { ArcProto ap = aIt.next(); boolean invisible = true; for(Iterator<Layer> lIt = ap.getLayerIterator(); lIt.hasNext(); ) { Layer layer = lIt.next(); if (layer.isVisible()) { invisible = false; break; } } ap.setArcInvisible(invisible); } } boolean textVisChanged = false; boolean currentTextOnNode = nodeText.isSelected(); if (currentTextOnNode != User.isTextVisibilityOnNode()) { textVisChanged = true; User.setTextVisibilityOnNode(currentTextOnNode); } boolean currentTextOnArc = arcText.isSelected(); if (currentTextOnArc != User.isTextVisibilityOnArc()) { textVisChanged = true; User.setTextVisibilityOnArc(currentTextOnArc); } boolean currentTextOnPort = portText.isSelected(); if (currentTextOnPort != User.isTextVisibilityOnPort()) { textVisChanged = true; User.setTextVisibilityOnPort(currentTextOnPort); } boolean currentTextOnExport = exportText.isSelected(); if (currentTextOnExport != User.isTextVisibilityOnExport()) { textVisChanged = true; User.setTextVisibilityOnExport(currentTextOnExport); } boolean currentTextOnAnnotation = annotationText.isSelected(); if (currentTextOnAnnotation != User.isTextVisibilityOnAnnotation()) { textVisChanged = true; User.setTextVisibilityOnAnnotation(currentTextOnAnnotation); } boolean currentTextOnInstance = instanceNames.isSelected(); if (currentTextOnInstance != User.isTextVisibilityOnInstance()) { textVisChanged = true; User.setTextVisibilityOnInstance(currentTextOnInstance); } boolean currentTextOnCell = cellText.isSelected(); if (currentTextOnCell != User.isTextVisibilityOnCell()) { textVisChanged = true; User.setTextVisibilityOnCell(currentTextOnCell); } // make sure all other visibility panels are in sync for(Iterator<WindowFrame> it = WindowFrame.getWindows(); it.hasNext(); ) { WindowFrame wf = it.next(); LayerTab lt = wf.getLayersTab(); if (lt != this) lt.updateLayersTab(); } if (changed || textVisChanged) User.layerVisibilityChanged(!changed); } /************************** DRAG AND DROP **************************/ public void dragGestureRecognized(DragGestureEvent dge) { StringSelection transferable = new StringSelection("" + layerList.getSelectedIndex()); dragSource.startDrag(dge, DragSource.DefaultCopyDrop, transferable, this); } public void dragEnter(DragSourceDragEvent dsde) {} public void dragExit(DragSourceEvent dse) {} public void dragOver(DragSourceDragEvent dsde) {} public void dragDropEnd(DragSourceDropEvent dsde) {} public void dropActionChanged(DragSourceDragEvent dsde) {}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -