📄 getinfomulti.java
字号:
{ NodeInst ni = (NodeInst)eobj; if (ni.getProto() == Generic.tech().invisiblePinNode) { isAnnotation = true; xPositionLow = Math.min(xPositionLow, ni.getAnchorCenterX()); xPositionHigh = Math.max(xPositionHigh, ni.getAnchorCenterX()); yPositionLow = Math.min(yPositionLow, ni.getAnchorCenterY()); yPositionHigh = Math.max(yPositionHigh, ni.getAnchorCenterY()); } } if (isAnnotation) annotationTextList.add(new DisplayedText(eobj, varKey)); else textList.add(new DisplayedText(eobj, varKey)); } } } } // with exactly 2 objects, show the distance between them if (nodeList.size() + arcList.size() == 2) { displayList.add("---------------------------"); Point2D firstPt = firstGeom.getTrueCenter(); if (firstGeom instanceof NodeInst) firstPt = ((NodeInst)firstGeom).getAnchorCenter(); Point2D secondPt = secondGeom.getTrueCenter(); if (secondGeom instanceof NodeInst) secondPt = ((NodeInst)secondGeom).getAnchorCenter(); displayList.add("Distance between centers: X=" + Math.abs(firstPt.getX() - secondPt.getX()) + " Y=" + Math.abs(firstPt.getY() - secondPt.getY())); } // reload the list (much more efficient than clearing and reloading if it is already displayed) list.setListData(displayList.toArray()); // figure out what can be edited here int index = 0; if (nodeList.size() != 0) index += 1; if (arcList.size() != 0) index += 2; if (exportList.size() != 0) index += 4; if (textList.size() != 0) index += 8; if (annotationTextList.size() != 0) index += 16; changePanel.removeAll(); currentChangeTypes = changeCombos[index]; if (currentChangeTypes == null) return; currentChangeValues = new JComponent[currentChangeTypes.length]; if (currentChangeTypes != null) { for(int c=0; c<currentChangeTypes.length; c++) { ChangeType change = currentChangeTypes[c]; JPanel onePanel = new JPanel(); onePanel.setLayout(new GridBagLayout()); String msg = null; switch (change) { case CHANGEXSIZE: if (xSizeLow == xSizeHigh) msg = "(All are " + TextUtils.formatDouble(xSizeLow) + ")"; else msg = "(" + TextUtils.formatDouble(xSizeLow) + " to " + TextUtils.formatDouble(xSizeHigh) + ")"; addChangePossibility("X size:", currentChangeValues[c] = new JTextField(""), msg, onePanel); break; case CHANGEYSIZE: if (ySizeLow == ySizeHigh) msg = "(All are " + TextUtils.formatDouble(ySizeLow) + ")"; else msg = "(" + TextUtils.formatDouble(ySizeLow) + " to " + TextUtils.formatDouble(ySizeHigh) + ")"; addChangePossibility("Y size:", currentChangeValues[c] = new JTextField(""), msg, onePanel); break; case CHANGEXPOS: if (xPositionLow == xPositionHigh) msg = "(All are " + TextUtils.formatDouble(xPositionLow) + ")"; else msg = "(" + TextUtils.formatDouble(xPositionLow) + " to " + TextUtils.formatDouble(xPositionHigh) + ")"; addChangePossibility("X position:", currentChangeValues[c] = new JTextField(""), msg, onePanel); break; case CHANGEYPOS: if (yPositionLow == yPositionHigh) msg = "(All are " + TextUtils.formatDouble(yPositionLow) + ")"; else msg = "(" + TextUtils.formatDouble(yPositionLow) + " to " + TextUtils.formatDouble(yPositionHigh) + ")"; addChangePossibility("Y position:", currentChangeValues[c] = new JTextField(""), msg, onePanel); break; case CHANGEROTATION:; if (rotLow == rotHigh) msg = "(All are " + TextUtils.formatDouble(rotHigh/10.0) + ")"; else msg = "(" + TextUtils.formatDouble(rotLow/10.0) + " to " + TextUtils.formatDouble(rotHigh/10.0) + ")"; addChangePossibility("Rotation:", currentChangeValues[c] = new JTextField(""), msg, onePanel); break; case CHANGEMIRRORLR: JComboBox lr = new JComboBox(); lr.addItem("Leave alone"); lr.addItem("Set"); lr.addItem("Clear"); addChangePossibility("Mirror L-R:", currentChangeValues[c] = lr, null, onePanel); break; case CHANGEMIRRORUD: JComboBox ud = new JComboBox(); ud.addItem("Leave alone"); ud.addItem("Set"); ud.addItem("Clear"); addChangePossibility("Mirror U-D:", currentChangeValues[c] = ud, null, onePanel); break; case CHANGEEXPANDED: JComboBox exp = new JComboBox(); exp.addItem("Leave alone"); exp.addItem("Expand"); exp.addItem("Unexpand"); addChangePossibility("Expansion:", currentChangeValues[c] = exp, null, onePanel); break; case CHANGEEASYSELECT: JComboBox es = new JComboBox(); es.addItem("Leave alone"); es.addItem("Make Easy"); es.addItem("Make Hard"); addChangePossibility("Ease of Selection:", currentChangeValues[c] = es, null, onePanel); break; case CHANGEINVOUTSIDECELL: JComboBox io = new JComboBox(); io.addItem("Leave alone"); io.addItem("Make Invisible"); io.addItem("Make Visible"); addChangePossibility("Invisible Outside Cell:", currentChangeValues[c] = io, null, onePanel); break; case CHANGELOCKED: JComboBox lo = new JComboBox(); lo.addItem("Leave alone"); lo.addItem("Lock"); lo.addItem("Unlock"); addChangePossibility("Locked:", currentChangeValues[c] = lo, null, onePanel); break; case CHANGEWIDTH: if (widthLow == widthHigh) msg = "(All are " + TextUtils.formatDouble(widthLow) + ")"; else msg = "(" + TextUtils.formatDouble(widthLow) + " to " + TextUtils.formatDouble(widthHigh) + ")"; addChangePossibility("Width:", currentChangeValues[c] = new JTextField(""), msg, onePanel); break; case CHANGERIGID: JComboBox ri = new JComboBox(); ri.addItem("Leave alone"); ri.addItem("Make Rigid"); ri.addItem("Make Unrigid"); addChangePossibility("Rigid:", currentChangeValues[c] = ri, null, onePanel); break; case CHANGEFIXANGLE: JComboBox fa = new JComboBox(); fa.addItem("Leave alone"); fa.addItem("Make Fixed Angle"); fa.addItem("Make Not Fixed Angle"); addChangePossibility("Fixed Angle:", currentChangeValues[c] = fa, null, onePanel); break; case CHANGESLIDABLE: JComboBox sl = new JComboBox(); sl.addItem("Leave alone"); sl.addItem("Make Slidable"); sl.addItem("Make Not Slidable"); addChangePossibility("Slidable:", currentChangeValues[c] = sl, null, onePanel); break; case CHANGEEXTENSION: JComboBox ex = new JComboBox(); ex.addItem("Leave alone"); ex.addItem("Make Both Ends Extend"); ex.addItem("Make Neither End Extend"); ex.addItem("Make Head Extend"); ex.addItem("Make Tail Extend"); addChangePossibility("Extension:", currentChangeValues[c] = ex, null, onePanel); break; case CHANGEDIRECTION: JComboBox di = new JComboBox(); di.addItem("Leave alone"); di.addItem("No directional arrow"); di.addItem("Arrow on Head and Body"); di.addItem("Arrow on Tail and Body"); di.addItem("Arrow on Body Only"); di.addItem("Arrow on Head, Tail, and Body"); addChangePossibility("Directionality:", currentChangeValues[c] = di, null, onePanel); break; case CHANGENEGATION: JComboBox ne = new JComboBox(); ne.addItem("Leave alone"); ne.addItem("No Negation"); ne.addItem("Negate Head"); ne.addItem("Negate Tail"); ne.addItem("Negate Head and Tail"); addChangePossibility("Negation:", currentChangeValues[c] = ne, null, onePanel); break; case CHANGECHARACTERISTICS: JComboBox ch = new JComboBox(); ch.addItem("Leave alone"); List<PortCharacteristic> chList = PortCharacteristic.getOrderedCharacteristics(); for(PortCharacteristic chara : chList) { ch.addItem(chara.getName()); } addChangePossibility("Characteristics:", currentChangeValues[c] = ch, null, onePanel); break; case CHANGEBODYONLY: JComboBox bo = new JComboBox(); bo.addItem("Leave alone"); bo.addItem("Make Body Only"); bo.addItem("Make Not Body Only"); addChangePossibility("Body Only:", currentChangeValues[c] = bo, null, onePanel); break; case CHANGEALWAYSDRAWN: JComboBox ad = new JComboBox(); ad.addItem("Leave alone"); ad.addItem("Make Always Drawn"); ad.addItem("Make Not Always Drawn"); addChangePossibility("Always Drawn:", currentChangeValues[c] = ad, null, onePanel); break; case CHANGEPOINTSIZE: addChangePossibility("Point Size:", currentChangeValues[c] = new JTextField(""), null, onePanel); break; case CHANGEUNITSIZE: addChangePossibility("Unit Size:", currentChangeValues[c] = new JTextField(""), null, onePanel); break; case CHANGEXOFF: addChangePossibility("X Offset:", currentChangeValues[c] = new JTextField(""), null, onePanel); break; case CHANGEYOFF: addChangePossibility("Y Offset:", currentChangeValues[c] = new JTextField(""), null, onePanel); break; case CHANGETEXTROT: JComboBox tr = new JComboBox(); tr.addItem("Leave alone"); tr.addItem("No Rotation"); tr.addItem("Rotate 90 Degrees"); tr.addItem("Rotate 180 Degrees"); tr.addItem("Rotate 270 Degrees"); addChangePossibility("Text Rotation:", currentChangeValues[c] = tr, null, onePanel); break; case CHANGEANCHOR: JComboBox an = new JComboBox(); an.addItem("Leave alone"); for(Iterator<TextDescriptor.Position> it = TextDescriptor.Position.getPositions(); it.hasNext(); ) { TextDescriptor.Position pos = it.next(); an.addItem(pos); } addChangePossibility("Text Anchor:", currentChangeValues[c] = an, null, onePanel); break; case CHANGEFONT: JComboBox fo = new JComboBox(); fo.addItem("Leave alone"); Font[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); fo.addItem("DEFAULT FONT"); for(int i=0; i<fonts.length; i++) fo.addItem(fonts[i].getFontName()); addChangePossibility("Text Font:", currentChangeValues[c] = fo, null, onePanel); break; case CHANGECOLOR: JComboBox co = new JComboBox(); co.addItem("Leave alone"); int [] colorIndices = EGraphics.getColorIndices(); co.addItem("DEFAULT COLOR"); for(int i=0; i<colorIndices.length; i++) co.addItem(EGraphics.getColorIndexName(colorIndices[i])); addChangePossibility("Text Color:", currentChangeValues[c] = co, null, onePanel); break; case CHANGEBOLD: JComboBox bd = new JComboBox(); bd.addItem("Leave alone"); bd.addItem("Make Bold"); bd.addItem("Make Not Bold"); addChangePossibility("Bold:", currentChangeValues[c] = bd, null, onePanel); break; case CHANGEITALIC: JComboBox it = new JComboBox(); it.addItem("Leave alone"); it.addItem("Make Italic"); it.addItem("Make Not Italic"); addChangePossibility("Italic:", currentChangeValues[c] = it, null, onePanel); break; case CHANGEUNDERLINE: JComboBox ul = new JComboBox(); ul.addItem("Leave alone"); ul.addItem("Make Underlined"); ul.addItem("Make Not Underlined"); addChangePossibility("Underlined:", currentChangeValues[c] = ul, null, onePanel); break; case CHANGECODE: JComboBox cd = new JComboBox(); cd.addItem("Leave alone"); for (Iterator<CodeExpression.Code> cIt = CodeExpression.Code.getCodes(); cIt.hasNext(); ) cd.addItem(cIt.next()); addChangePossibility("Code:", currentChangeValues[c] = cd, null, onePanel); break; case CHANGEUNITS: JComboBox un = new JComboBox(); un.addItem("Leave alone"); for (Iterator<TextDescriptor.Unit> uIt = TextDescriptor.Unit.getUnits(); uIt.hasNext(); ) un.addItem(uIt.next()); addChangePossibility("Units:", currentChangeValues[c] = un, null, onePanel); break; case CHANGESHOW: JComboBox sh = new JComboBox(); sh.addItem("Leave alone"); for (Iterator<TextDescriptor.DispPos> sIt = TextDescriptor.DispPos.getShowStyles(); sIt.hasNext(); ) sh.addItem(sIt.next()); addChangePossibility("Show:", currentChangeValues[c] = sh, null, onePanel); break; } changePanel.add(onePanel); } // add a "Color and Pattern..." button if there are artwork components boolean hasArtwork = false; for(NodeInst ni : nodeList) { if (ni.isCellInstance()) continue; if (ni.getProto().getTechnology() == Artwork.tech()) hasArtwork = true; } for(ArcInst ai : arcList) { if (ai.getProto().getTechnology() == Artwork.tech()) hasArtwork = true; } if (hasArtwork) { JPanel butPanel = new JPanel(); butPanel.setLayout(new GridBagLayout()); JButton sh = new JButton("Color and Pattern..."); sh.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { ArtworkLook.showArtworkLookDialog(); } }); addChangePossibility(null, sh, null, butPanel); changePanel.add(butPanel); } } } private void addChangePossibility(String label, JComponent comp, String msg, JPanel onePanel) { int bottom = 4; if (msg != null) bottom = 0; GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.weightx = 1; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(4, 4, bottom, 4); if (label == null) { gbc.gridx = 0; gbc.gridwidth = 2; } else { GridBagConstraints lgbc = new GridBagConstraints(); lgbc.gridx = 0; lgbc.gridy = 0; lgbc.insets = new Insets(4, 4, bottom, 4); onePanel.add(new JLabel(label), lgbc); } onePanel.add(comp, gbc); if (msg != null) { gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.gridwidth = 2; gbc.insets = new Insets(0, 4, 4, 4); onePanel.add(new JLabel(msg), gbc); } } private static class SortMultipleHighlights implements Comparator<Highlight2> { public int compare(Highlight2 h1, Highlight2 h2) { // if the types are different, order by types if (h1.getClass() != h2.getClass()) { return h1.getClass().hashCode() - h2.getClass().hashCode(); } // if not a geometric, no order is available if (!h1.isHighlightEOBJ()) return 0; // sort on mix of NodeInst / ArcInst / PortInst ElectricObject e1 = h1.getElectricObject(); int type1 = 0; if (e1 instanceof NodeInst) type1 = 1; else if (e1 instanceof ArcInst) type1 = 2; ElectricObject e2 = h2.getElectricObject(); int type2 = 0; if (e2 instanceof NodeInst) type2 = 1; else if (e2 instanceof ArcInst) type2 = 2; if (type1 != type2) return type1 - type2; // sort on the object name String s1 = null, s2 = null; if (e1 instanceof Geometric) s1 = ((Geometric)e1).describe(false); else s1 = e1.toString(); if (e2 instanceof Geometric) s2 = ((Geometric)e2).describe(false); else s2 = e2.toString(); return TextUtils.canonicString(s1).compareTo(TextUtils.canonicString(s2)); } } private Object findComboBoxValue(ChangeType type) { if (currentChangeTypes != null) { for(int c=0; c<currentChangeTypes.length; c++) { ChangeType change = currentChangeTypes[c]; if (change == type) { JComboBox cb = (JComboBox)currentChangeValues[c]; if (cb.getSelectedIndex() == 0) return null; return cb.getSelectedItem(); } } } return null; } private int findComboBoxIndex(ChangeType type) { if (currentChangeTypes != null) { for(int c=0; c<currentChangeTypes.length; c++) { ChangeType change = currentChangeTypes[c]; if (change == type) return ((JComboBox)currentChangeValues[c]).getSelectedIndex(); } } return -1; } private String findComponentStringValue(ChangeType type)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -