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

📄 editmenu.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
    public static void addToWaveformCurrentCommand()    {        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 overlay selected signals to the waveform window: no waveform window is associated with this cell");            return;        }        ww.showSignals(wnd.getHighlighter(), wwLoc.getContext(), false);    }    /**     * This method implements the command to remove the currently selected network     * from the waveform window.     */    public static void removeFromWaveformCommand()    {        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 remove selected signals from the waveform window: no waveform window is associated with this cell");            return;        }        Set<Network> nets = wnd.getHighlighter().getHighlightedNetworks();        ww.removeSignals(nets, wwLoc.getContext());    }    /**     * This method implements the command to insert a jog in an arc     */    public static void insertJogInArcCommand()    {        EditWindow wnd = EditWindow.needCurrent();        if (wnd == null) return;        ArcInst ai = (ArcInst)wnd.getHighlighter().getOneElectricObject(ArcInst.class);        if (ai == null) return;        System.out.println("Select the position in the arc to place the jog");        EventListener currentListener = WindowFrame.getListener();        WindowFrame.setListener(new InsertJogInArcListener(wnd, ai, currentListener));    }    /**     * Class to handle the interactive selection of a jog point in an arc.     */    private static class InsertJogInArcListener        implements MouseMotionListener, MouseListener, MouseWheelListener, KeyListener    {        private EditWindow wnd;        private ArcInst ai;        private EventListener currentListener;        /**         * Create a new insert-jog-point listener         * @param wnd Controlling window         * @param ai the arc that is having a jog inserted.         * @param currentListener listener to restore when done         */        public InsertJogInArcListener(EditWindow wnd, ArcInst ai, EventListener currentListener)        {            this.wnd = wnd;            this.ai = ai;            this.currentListener = currentListener;        }        public void mousePressed(MouseEvent evt) {}        public void mouseClicked(MouseEvent evt) {}        public void mouseEntered(MouseEvent evt) {}        public void mouseExited(MouseEvent evt) {}        public void mouseDragged(MouseEvent evt)        {            mouseMoved(evt);        }        public void mouseReleased(MouseEvent evt)        {            Point2D insert2D = getInsertPoint(evt);            EPoint insert = new EPoint(insert2D.getX(), insert2D.getY());            new InsertJogPoint(ai, insert, wnd.getHighlighter());            WindowFrame.setListener(currentListener);        }        public void mouseMoved(MouseEvent evt)        {            Point2D insert = getInsertPoint(evt);            double x = insert.getX();            double y = insert.getY();            double width = ai.getLambdaBaseWidth() / 2;            Highlighter highlighter = wnd.getHighlighter();            highlighter.clear();            highlighter.addLine(new Point2D.Double(x-width, y-width), new Point2D.Double(x-width, y+width), ai.getParent());            highlighter.addLine(new Point2D.Double(x-width, y+width), new Point2D.Double(x+width, y+width), ai.getParent());            highlighter.addLine(new Point2D.Double(x+width, y+width), new Point2D.Double(x+width, y-width), ai.getParent());            highlighter.addLine(new Point2D.Double(x+width, y-width), new Point2D.Double(x-width, y-width), ai.getParent());            highlighter.finished();            wnd.repaint();        }        private Point2D getInsertPoint(MouseEvent evt)        {            Point2D mouseDB = wnd.screenToDatabase(evt.getX(), evt.getY());            EditWindow.gridAlign(mouseDB);            Point2D insert = DBMath.closestPointToSegment(ai.getHeadLocation(), ai.getTailLocation(), mouseDB);            return insert;        }        public void mouseWheelMoved(MouseWheelEvent e) {}        public void keyPressed(KeyEvent e) {}        public void keyReleased(KeyEvent e) {}        public void keyTyped(KeyEvent e) {}        private static class InsertJogPoint extends Job        {            private ArcInst ai;            private EPoint insert;            private transient Highlighter highlighter;            private NodeInst jogPoint;            protected InsertJogPoint(ArcInst ai, EPoint insert, Highlighter highlighter)            {                super("Insert Jog in Arc", User.getUserTool(), Job.Type.CHANGE, null, null, Job.Priority.USER);                this.ai = ai;                this.insert = insert;                this.highlighter = highlighter;                startJob();            }            public boolean doIt() throws JobException            {                if (CircuitChangeJobs.cantEdit(ai.getParent(), null, true, false, true) != 0) return false;                // create the break pins                ArcProto ap = ai.getProto();                NodeProto np = ap.findPinProto();                if (np == null) return false;                NodeInst ni = NodeInst.makeInstance(np, insert, np.getDefWidth(), np.getDefHeight(), ai.getParent());                if (ni == null)                {                    System.out.println("Cannot create pin " + np.describe(true));                    return false;                }                NodeInst ni2 = NodeInst.makeInstance(np, insert, np.getDefWidth(), np.getDefHeight(), ai.getParent());                if (ni2 == null)                {                    System.out.println("Cannot create pin " + np.describe(true));                    return false;                }                // get location of connection to these pins                PortInst pi = ni.getOnlyPortInst();                PortInst pi2 = ni2.getOnlyPortInst();                // now save the arc information and delete it                PortInst headPort = ai.getHeadPortInst();                PortInst tailPort = ai.getTailPortInst();                Point2D headPt = ai.getHeadLocation();                Point2D tailPt = ai.getTailLocation();                double width = ai.getLambdaBaseWidth();                String arcName = ai.getName();                int angle = (ai.getAngle() + 900) % 3600;                // create the new arcs                ArcInst newAi1 = ArcInst.makeInstanceBase(ap, width, headPort, pi, headPt, insert, null);                ArcInst newAi2 = ArcInst.makeInstanceBase(ap, width, pi, pi2, insert, insert, null);                ArcInst newAi3 = ArcInst.makeInstanceBase(ap, width, pi2, tailPort, insert, tailPt, null);                newAi1.setHeadNegated(ai.isHeadNegated());                newAi1.setHeadExtended(ai.isHeadExtended());                newAi1.setHeadArrowed(ai.isHeadArrowed());                newAi3.setTailNegated(ai.isTailNegated());                newAi3.setTailExtended(ai.isTailExtended());                newAi3.setTailArrowed(ai.isTailArrowed());                ai.kill();                if (arcName != null)                {                    if (headPt.distance(insert) > tailPt.distance(insert))                    {                        newAi1.setName(arcName);                        newAi1.copyTextDescriptorFrom(ai, ArcInst.ARC_NAME);                    } else                    {                        newAi3.setName(arcName);                        newAi3.copyTextDescriptorFrom(ai, ArcInst.ARC_NAME);                    }                }                newAi2.setAngle(angle);                // remember the node to be highlighted                jogPoint = ni;                fieldVariableChanged("jogPoint");                return true;            }            public void terminateOK()            {                // highlight one of the jog nodes                highlighter.clear();                highlighter.addElectricObject(jogPoint.getOnlyPortInst(), jogPoint.getParent());                highlighter.finished();            }        }    }    /**     * This method implements the command to show the undo history.     */    public static void showUndoListCommand()    {    	Undo.showHistoryList();    }	public static void describeTechnologyCommand()    {        int pageWidth = TopLevel.getMessagesWindow().getMessagesCharWidth();        Technology tech = Technology.getCurrent();        System.out.println("Technology " + tech.getTechName());        System.out.println("    Full name: " + tech.getTechDesc());        if (tech.isScaleRelevant())        {            System.out.println("    Scale: 1 grid unit is " + tech.getScale() + " nanometers (" +                (tech.getScale()/1000) + " microns)");        }        int arcCount = 0;        for(Iterator<ArcProto> it = tech.getArcs(); it.hasNext(); )        {            ArcProto ap = it.next();            if (!ap.isNotUsed()) arcCount++;        }        StringBuffer sb = new StringBuffer();        sb.append("    Has " + arcCount + " arcs (wires):");        int newLineIndent = sb.length();        for(Iterator<ArcProto> it = tech.getArcs(); it.hasNext(); )        {            ArcProto ap = it.next();            if (ap.isNotUsed()) continue;            String addThis = " " + ap.getName();            if (sb.length() + addThis.length() > pageWidth)            {                System.out.println(sb.toString());                sb = new StringBuffer();                for(int i=0; i<newLineIndent; i++) sb.append(' ');            }            sb.append(addThis);        }        System.out.println(sb.toString());        int pinCount = 0, totalCount = 0, pureCount = 0, contactCount = 0;        for(Iterator<PrimitiveNode> it = tech.getNodes(); it.hasNext(); )        {            PrimitiveNode np = it.next();            if (np.isNotUsed()) continue;            PrimitiveNode.Function fun = np.getFunction();            totalCount++;            if (fun == PrimitiveNode.Function.PIN) pinCount++; else            if (fun == PrimitiveNode.Function.CONTACT || fun == PrimitiveNode.Function.CONNECT) contactCount++; else            if (fun == PrimitiveNode.Function.NODE) pureCount++;        }        if (pinCount > 0)        {            sb = new StringBuffer();            sb.append("    Has " + pinCount + " pin nodes:");            newLineIndent = sb.length();            for(Iterator<PrimitiveNode> it = tech.getNodes(); it.hasNext(); )            {                PrimitiveNode np = it.next();                if (np.isNotUsed()) continue;                PrimitiveNode.Function fun = np.getFunction();                if (fun != PrimitiveNode.Function.PIN) continue;                String addThis = " " + np.getName();                if (sb.length() + addThis.length() > pageWidth)                {                    System.out.println(sb.toString());                    sb = new StringBuffer();                    for(int i=0; i<newLineIndent; i++) sb.append(' ');                }                sb.append(addThis);            }            System.out.println(sb.toString());        }        if (contactCount > 0)        {            sb = new StringBuffer();            sb.append("    Has " + contactCount + " contact nodes:");            newLineIndent = sb.length();            for(Iterator<PrimitiveNode> it = tech.getNodes(); it.hasNext(); )            {                PrimitiveNode np = it.next();                if (np.isNotUsed()) continue;                PrimitiveNode.Function fun = np.getFunction();                if (fun != PrimitiveNode.Function.CONTACT && fun != PrimitiveNode.Function.CONNECT)                    continue;                String addThis = " " + np.getName();                if (sb.length() + addThis.length() > pageWidth)                {                    System.out.println(sb.toString());                    sb = new StringBuffer();                    for(int i=0; i<newLineIndent; i++) sb.append(' ');                }                sb.append(addThis);            }            System.out.println(sb.toString());        }        if (pinCount+contactCount+pureCount < totalCount)        {            sb = new StringBuffer();            sb.append("    Has " + (totalCount-pinCount-contactCount-pureCount) + " regular nodes:");            newLineIndent = sb.length();            for(Iterator<PrimitiveNode> it = tech.getNodes(); it.hasNext(); )            {                PrimitiveNode np = it.next();                if (np.isNotUsed()) continue;                PrimitiveNode.Function fun = np.getFunction();                if (fun == PrimitiveNode.Function.PIN || fun == PrimitiveNode.Function.CONTACT ||                    fun == PrimitiveNode.Function.CONNECT || fun == PrimitiveNode.Function.NODE)                    continue;                String addThis = " " + np.getName();                if (sb.length() + addThis.length() > pageWidth)                {                    System.out.println(sb.toString());                    sb = new StringBuffer();                    for(int i=0; i<newLineIndent; i++) sb.append(' ');                }                sb.append(addThis);            }            System.out.println(sb.toString());        }        if (pureCount > 0)        {            sb = new StringBuffer();            sb.append("    Has " + pureCount + " pure-layer nodes:");            newLineIndent = sb.length();            for(Iterator<PrimitiveNode> it = tech.getNodes(); it.hasNext(); )            {                PrimitiveNode np = it.next();                if (np.isNotUsed()) continue;                PrimitiveNode.Function fun = np.getFunction();                if (fun != PrimitiveNode.Function.NODE) continue;                String addThis = " " + np.getName();                if (sb.l

⌨️ 快捷键说明

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