⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 statusbar.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
			if (thisFrame.getContent() instanceof TextWindow)			{				TextWindow tw = (TextWindow)thisFrame.getContent();				int len = tw.getLineCount();				sizeMsg = "LINES: " + len;			} else			{				Rectangle2D bounds = cell.getBounds();				sizeMsg = "CELL: " + TextUtils.formatDouble(bounds.getWidth(),1) + "x" +                        TextUtils.formatDouble(bounds.getHeight(), 1);			}		}		fieldSize.setText(sizeMsg);		Technology tech = Technology.getCurrent();		if (tech != null)		{			String message = "TECH: " + tech.getTechName();            String foundry = tech.getPrefFoundry();            boolean validFoundry = !foundry.equals("");			if (tech.isScaleRelevant())            {                message += " (scale=" + tech.getScale() + "nm";                if (!validFoundry) message += ")";                else // relevant foundry                    message += ",foundry=" + foundry + ")";            }             fieldTech.setText(message);		}        // Determing if size and tech labels should appear        FontMetrics fm = this.getGraphics().getFontMetrics(fieldSelected.getFont());        int a = SwingUtilities.computeStringWidth(fm, fieldSelected.getText());        Rectangle rectSel = fieldSelected.getBounds();        Rectangle rectSize = fieldSize.getBounds();        boolean visibleSize = (rectSel.getMinX() + a) < rectSize.getMinX();        fieldSize.setVisible(visibleSize);        Rectangle rectTech = fieldTech.getBounds();        boolean visibleTech = (rectSel.getMinX() + a) < (rectTech.getMinX());        fieldTech.setVisible(visibleTech);		if (coords == null) fieldCoords.setText(""); else			fieldCoords.setText(coords);        // if too many chars to display in space provided, truncate.        if (hierCoords != null) {            int width = fieldHierCoords.getFontMetrics(fieldHierCoords.getFont()).stringWidth(hierCoords);            int widgetW = fieldHierCoords.getWidth();            if (width > widgetW)            {                int chars = hierCoords.length() * widgetW / width;                hierCoords = hierCoords.substring(hierCoords.length() - chars, hierCoords.length());            }            fieldHierCoords.setText(hierCoords);        } else		    fieldHierCoords.setText(" ");	}    private void updateSelectedText() {        String selectedMsg = "NOTHING SELECTED";        if (selectionOverride != null)        {            selectedMsg = selectionOverride;        } else        {            // count the number of nodes and arcs selected            int nodeCount = 0, arcCount = 0, textCount = 0;            Highlight2 lastHighlight = null;            Highlighter highlighter = getHighlighter();            if (highlighter == null) {                fieldSelected.setText(selectedMsg);                return;            }			NodeInst theNode = null;            for(Highlight2 h : highlighter.getHighlights())            {                if (h.isHighlightEOBJ())                {                    ElectricObject eObj = h.getElectricObject();                    if (eObj instanceof PortInst)                    {                        lastHighlight = h;						theNode = ((PortInst)eObj).getNodeInst();                        nodeCount++;                    } else if (eObj instanceof NodeInst)                    {                        lastHighlight = h;						theNode = (NodeInst)eObj;                        nodeCount++;                    } else if (eObj instanceof ArcInst)                    {                        lastHighlight = h;                        arcCount++;                    }                } else if (h.isHighlightText())                {                    lastHighlight = h;                    textCount++;                }            }            if (nodeCount + arcCount + textCount == 1)            {                selectedMsg = "SELECTED "+getSelectedText(lastHighlight);				if (theNode != null)				{					PrimitiveNodeSize npSize = theNode.getPrimitiveDependentNodeSize(null);					if (npSize != null)					{						selectedMsg += " (size=";                        selectedMsg += npSize.getWidthInString();						selectedMsg += "x";                        selectedMsg += npSize.getLengthInString();						selectedMsg += ")";					} else					{						double xSize = theNode.getLambdaBaseXSize();						double ySize = theNode.getLambdaBaseYSize();						selectedMsg += " (size=" + TextUtils.formatDouble(xSize) +							"x" + TextUtils.formatDouble(ySize) + ")";					}				}            } else            {                if (nodeCount + arcCount + textCount > 0)                {                    StringBuffer buf = new StringBuffer();                    buf.append("SELECTED:");                    if (nodeCount > 0) buf.append(" " + nodeCount + " NODES");                    if (arcCount > 0)                    {                        if (nodeCount > 0) buf.append(",");                        buf.append(" " + arcCount + " ARCS");                    }                    if (textCount > 0)                    {                        if (nodeCount + arcCount > 0) buf.append(",");                        buf.append(" " + textCount + " TEXT");                    }                    // add on info for last highlight                    buf.append(". LAST: "+getSelectedText(lastHighlight));                    selectedMsg = buf.toString();                }            }        }        fieldSelected.setText(selectedMsg);    }    private String addLayerInfo(PortProto pp)    {    	// if the port is on a generic primitive which can connect to everything, say so    	PrimitivePort pRp = pp.getBasePort();    	if (pRp.getParent().getTechnology().isUniversalConnectivityPort(pRp))    		return " [ALL]";        String descr = "";        ArcProto [] cons = pp.getBasePort().getConnections();        boolean first = true;        for(int i=0; i<cons.length; i++)        {            ArcProto ap = cons[i];            if (ap.getTechnology() == Generic.tech()) continue;            if (first) descr += " ["; else descr += ",";            first = false;            descr += cons[i].getName();        }        if (!first) descr += "]";        return descr;    }    /**     * Get a String describing the Highlight, to display in the     * "Selected" part of the status bar.     */    private String getSelectedText(Highlight2 h) {        PortInst thePort;        NodeInst theNode;        ArcInst theArc;        if (h.isHighlightEOBJ())        {            ElectricObject eObj = h.getElectricObject();            if (eObj instanceof PortInst)            {                thePort = (PortInst)eObj;                theNode = thePort.getNodeInst();                String desc = (theNode.isCellInstance())?addLayerInfo(thePort.getPortProto()):"";                return "NODE: " + theNode.describe(true) +                    " PORT: \'" + thePort.getPortProto().getName() + "\'" + desc;            } else if (eObj instanceof NodeInst)            {                theNode = (NodeInst)eObj;                return("NODE: " + theNode.describe(true));            } else if (eObj instanceof ArcInst)            {                theArc = (ArcInst)eObj;				Netlist netlist = theArc.getParent().acquireUserNetlist();				if (netlist == null)                    return("netlist exception! try again");	            if (!theArc.isLinked())	                return("netlist exception! try again. ArcIndex = -1");				Network net = netlist.getNetwork(theArc, 0);				String netMsg = (net != null) ? "NETWORK: "+net.describe(true)+ ", " : "";				return netMsg + "ARC: " + theArc.describe(true);            }        } else if (h.isHighlightText())        {        	String descr = "TEXT: " + h.describe();			if (h.getVarKey() == Export.EXPORT_NAME && h.getElectricObject() instanceof Export)			{				Export e = (Export)h.getElectricObject();                descr += addLayerInfo(e.getOriginalPort().getPortProto());			}        	return descr;        }        return null;    }    /**     * Call when done with this Object. Cleans up references to this object.     */    public void finished() {        if (!TopLevel.isMDIMode() && frame.getContent().getHighlighter() != null)            Highlighter.removeHighlightListener(this);        UserInterfaceMain.removeDatabaseChangeListener(this);    }    public void databaseChanged(DatabaseChangeEvent e) {        redoStatusBar();    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -