📄 getinfonode.java
字号:
description += pp.getName(); // mention if it is highlighted if (pp == shownPort) { selectedLine = portMessages.size(); description += " (Highlighted)"; } description += " connects to"; ArcProto [] connList = pp.getBasePort().getConnections(); int count = 0; for(int i=0; i<connList.length; i++) { ArcProto ap = connList[i]; if ((np instanceof Cell || np.getTechnology() != Generic.tech()) && ap.getTechnology() == Generic.tech()) continue; if (count > 0) description += ","; description += " " + ap.getName(); count++; } boolean moreInfo = false; if (pp == shownPort) moreInfo = true; for(Iterator<Connection> aIt = shownNode.getConnections(); aIt.hasNext(); ) { Connection con = aIt.next(); if (con.getPortInst() == pi) { moreInfo = true; break; } } for(Iterator<Export> eIt = shownNode.getExports(); eIt.hasNext(); ) { Export e = eIt.next(); if (e.getOriginalPort() == pi) { moreInfo = true; break; } } if (moreInfo) description += ":"; portMessages.add(description); portObjects.add(null); // talk about any arcs on this prototype for(Iterator<Connection> aIt = shownNode.getConnections(); aIt.hasNext(); ) { Connection con = aIt.next(); if (con.getPortInst() != pi) continue; ArcInst ai = con.getArc(); description = " Connected at (" + con.getLocation().getX() + "," + con.getLocation().getY() + ") to " + ai; portMessages.add(description); portObjects.add(ai); } // talk about any exports of this prototype for(Iterator<Export> eIt = shownNode.getExports(); eIt.hasNext(); ) { Export e = eIt.next(); if (e.getOriginalPort() != pi) continue; description = " Available as " + e.getCharacteristic().getName() + " export '" + e.getName() + "'"; portMessages.add(description); portObjects.add(null); } } see.setEnabled(true); list.setListData(portMessages.toArray()); list.setSelectedIndex(selectedLine); list.ensureIndexIsVisible(selectedLine); } if (busMembers.isSelected()) { Netlist nl = shownNode.getParent().acquireUserNetlist(); int busWidth = nl.getBusWidth((Export)shownPort); List<String> busMessages = new ArrayList<String>(); for(int i=0; i<busWidth; i++) { if (!showAll && i++ > 100) { int numLeft = busWidth-100; String description = "*** Plus " + numLeft + " more bus members. Use 'Show All' to see them."; busMessages.add(description); showAllButton.setEnabled(true); break; } Network net = nl.getNetwork(shownNode, shownPort, i); String netDescr = "?"; if (net != null) netDescr = net.describe(false); busMessages.add(i + ": " + netDescr); } listPane.setViewportView(list); list.setListData(busMessages.toArray()); } if (attributes.isSelected()) { listPane.setViewportView(attributesTable); } } private static class ChangeNode extends Job { private NodeInst ni; private double initialXPos, initialYPos, currentXPos, currentYPos; private String initialXSize, initialYSize, currentXSize, currentYSize; private boolean currentMirrorX, currentMirrorY; private int currentRotation; private int initialPopupIndex, currentPopupIndex; private boolean initialEasyToSelect, currentEasyToSelect; private boolean initialInvisibleOutsideCell, currentInvisibleOutsideCell; private boolean initialLocked, currentLocked; private boolean initialExpansion, currentExpansion; private String initialName, currentName; private String initialTextField, currentTextField; private String initialPopupEntry, currentPopupEntry; private boolean scalableTrans; private boolean swapXY; private boolean expansionChanged; public ChangeNode(NodeInst ni, double initialXPos, double currentXPos, double initialYPos, double currentYPos, String initialXSize, String currentXSize, String initialYSize, String currentYSize, boolean currentMirrorX, boolean currentMirrorY, int currentRotation, int initialPopupIndex, int currentPopupIndex, boolean initialEasyToSelect, boolean currentEasyToSelect, boolean initialInvisibleOutsideCell, boolean currentInvisibleOutsideCell, boolean initialLocked, boolean currentLocked, boolean initialExpansion, boolean currentExpansion, String initialName, String currentName, String initialTextField, String currentTextField, String initialPopupEntry, String currentPopupEntry, boolean bigger, boolean scalableTrans, boolean swapXY) { super("Modify Node", User.getUserTool(), Job.Type.CHANGE, null, null, Job.Priority.USER); this.ni = ni; this.initialXPos = initialXPos; this.currentXPos = currentXPos; this.initialYPos = initialYPos; this.currentYPos = currentYPos; this.initialXSize = initialXSize; this.currentXSize = currentXSize; this.initialYSize = initialYSize; this.currentYSize = currentYSize; this.currentMirrorX = currentMirrorX; this.currentMirrorY = currentMirrorY; this.currentRotation = currentRotation; this.initialPopupIndex = initialPopupIndex; this.currentPopupIndex = currentPopupIndex; this.initialEasyToSelect = initialEasyToSelect; this.currentEasyToSelect = currentEasyToSelect; this.initialInvisibleOutsideCell = initialInvisibleOutsideCell; this.currentInvisibleOutsideCell = currentInvisibleOutsideCell; this.initialLocked = initialLocked; this.currentLocked = currentLocked; this.initialExpansion = initialExpansion; this.currentExpansion = currentExpansion; this.initialName = initialName; this.currentName = currentName; this.initialTextField = initialTextField; this.currentTextField = currentTextField; this.initialPopupEntry = initialPopupEntry; this.currentPopupEntry = currentPopupEntry; this.scalableTrans = scalableTrans; this.swapXY = swapXY; startJob(); } public boolean doIt() throws JobException { boolean changed = false; expansionChanged = false; NodeProto np = ni.getProto(); if (!currentName.equals(initialName)) { if (currentName.length() == 0) currentName = null; ni.setName(currentName); changed = true; } if (ni.isCellInstance()) { if (currentExpansion != initialExpansion) { if (currentExpansion) ni.setExpanded(); else ni.clearExpanded(); changed = true; expansionChanged = true; } } if (currentEasyToSelect != initialEasyToSelect) { if (currentEasyToSelect) ni.clearHardSelect(); else ni.setHardSelect(); } if (currentInvisibleOutsideCell != initialInvisibleOutsideCell) { if (currentInvisibleOutsideCell) ni.setVisInside(); else ni.clearVisInside(); changed = true; } if (currentLocked != initialLocked) { if (currentLocked) ni.setLocked(); else ni.clearLocked(); } // handle special node information if (scalableTrans) { if (currentPopupIndex != initialPopupIndex) { int numContacts = 2 - (currentPopupIndex / 2); boolean inset = (currentPopupIndex&1) != 0; String contactInfo = String.valueOf(numContacts); if (inset) contactInfo += "i"; ni.newVar(Technology.TRANS_CONTACT, contactInfo); } if (!currentTextField.equals(initialTextField)) { double width = TextUtils.atof(currentTextField); Variable oldVar = ni.getVar(Schematics.ATTR_WIDTH); Variable var = ni.updateVar(Schematics.ATTR_WIDTH, new Double(width)); if (var != null && oldVar == null) { ni.addVar(var.withDisplay(true).withDispPart(TextDescriptor.DispPos.NAMEVALUE)); } } } PrimitiveNode.Function fun = ni.getFunction(); if (fun == PrimitiveNode.Function.DIODE || fun == PrimitiveNode.Function.DIODEZ) { if (!currentTextField.equals(initialTextField)) { Variable var = ni.updateVarText(Schematics.SCHEM_DIODE, currentTextField); if (var != null && !var.isDisplay()) ni.addVar(var.withDisplay(true)); changed = true; } } if (fun.isResistor()) { if (!currentTextField.equals(initialTextField)) { Variable var = ni.updateVarText(Schematics.SCHEM_RESISTANCE, currentTextField); if (var != null && !var.isDisplay()) ni.addVar(var.withDisplay(true)); changed = true; } } if (fun.isCapacitor()) { if (!currentTextField.equals(initialTextField)) { Variable var = ni.updateVarText(Schematics.SCHEM_CAPACITANCE, currentTextField); if (var != null && !var.isDisplay()) ni.addVar(var.withDisplay(true)); changed = true; } } if (fun == PrimitiveNode.Function.INDUCT) { if (!currentTextField.equals(initialTextField)) { Variable var = ni.updateVarText(Schematics.SCHEM_INDUCTANCE, currentTextField); if (var != null && !var.isDisplay()) ni.addVar(var.withDisplay(true)); changed = true; } } if (np == Schematics.tech().bboxNode) { if (!currentTextField.equals(initialTextField)) { Variable var = ni.updateVarText(Schematics.SCHEM_FUNCTION, currentTextField); if (var != null && !var.isDisplay()) ni.addVar(var.withDisplay(true)); changed = true; } } if (np == Schematics.tech().globalNode) { if (!currentTextField.equals(initialTextField)) { Variable var = ni.updateVarText(Schematics.SCHEM_GLOBAL_NAME, currentTextField); if (var != null && !var.isDisplay()) ni.addVar(var.withDisplay(true)); changed = true; } if (!currentPopupEntry.equals(initialPopupEntry)) { PortCharacteristic ch = PortCharacteristic.findCharacteristic(currentPopupEntry); ni.setTechSpecific(ch.getBits()); changed = true; } } // load the degrees of a circle if appropriate if (np == Artwork.tech().circleNode || np == Artwork.tech().thickCircleNode) { if (!currentTextField.equals(initialTextField)) { double start = 0; double curvature = TextUtils.atof(currentTextField) * Math.PI / 180.0; int slashPos = currentTextField.indexOf('/'); if (slashPos >= 0) { start = curvature; curvature = TextUtils.atof(currentTextField.substring(slashPos+1)) * Math.PI / 180.0; } ni.setArcDegrees(start, curvature); changed = true; } } double initXSize, initYSize; double currXSize, currYSize; Orientation orient; // Figure out change in X and Y size // if swapXY, X size was put in Y text box, and vice versa. if (swapXY) { // get true size minus offset (this is the size the user sees) currXSize = TextUtils.atof(currentYSize, new Double(ni.getLambdaBaseXSize())); currYSize = TextUtils.atof(currentXSize, new Double(ni.getLambdaBaseYSize())); initXSize = TextUtils.atof(initialYSize, new Double(currXSize)); initYSize = TextUtils.atof(initialXSize, new Double(currYSize)); // mirror orient = Orientation.fromJava(currentRotation, currentMirrorY, currentMirrorX); } else { currXSize = TextUtils.atof(currentXSize, new Double(ni.getLambdaBaseXSize())); currYSize = TextUtils.atof(currentYSize, new Double(ni.getLambdaBaseYSize())); initXSize = TextUtils.atof(initialXSize, new Double(currXSize)); initYSize = TextUtils.atof(initialYSize, new Double(currYSize)); // mirror orient = Orientation.fromJava(currentRotation, currentMirrorX, currentMirrorY); } // The following code is specific for transistors, and uses the X/Y size fields for // Width and Length, and therefore may override the values such that the node size does not // get set by them. PrimitiveNodeSize size = ni.getPrimitiveDependentNodeSize(null); if (size != null) { // see if this is a schematic transistor if (np == Schematics.tech().transistorNode || np == Schematics.tech().transistor4Node || np == Schematics.tech().resistorNode) { Object width, length; if (ni.getFunction().isFET() || ni.getFunction().isPolyOrWellResistor()) { // see if we can convert width and length to a Number double w = TextUtils.atof(currentXSize, null); if (w == 0) { // set width to whatever text is there width = Variable.withCode(currentXSize, ni.getCode(Schematics.ATTR_WIDTH)); } else { width = new Double(w); } double l = TextUtils.atof(currentYSize, null); if (l == 0) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -