📄 designrulestab.java
字号:
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: DesignRulesTab.java * * Copyright (c) 2004 Sun Microsystems and Static Free Software * * Electric(tm) is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * Electric(tm) is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Electric(tm); see the file COPYING. If not, write to * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, Mass 02111-1307, USA. */package com.sun.electric.tool.user.dialogs.options;import com.sun.electric.database.text.TextUtils;import com.sun.electric.technology.DRCRules;import com.sun.electric.technology.Foundry;import com.sun.electric.technology.Technology;import com.sun.electric.technology.XMLRules;import com.sun.electric.tool.drc.DRC;import com.sun.electric.tool.user.dialogs.DesignRulesPanel;import com.sun.electric.tool.user.ui.EditWindow;import com.sun.electric.tool.user.ui.TopLevel;import java.awt.Frame;import java.awt.GridBagConstraints;import java.awt.Insets;import java.util.Iterator;import javax.swing.JOptionPane;import javax.swing.JPanel;/** * Class to handle the "Design Rules" tab of the Preferences dialog. */public class DesignRulesTab extends PreferencePanel{ DesignRulesPanel rulesPanel; private DRCRules drRules; private boolean designRulesFactoryReset = false; /** Creates new form DesignRulesTab */ public DesignRulesTab(Frame parent, boolean modal) { super(parent, modal); initComponents(); // Adding the node and layer panels rulesPanel = new DesignRulesPanel(); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = 4; gridBagConstraints.gridheight = 1; gridBagConstraints.insets = new Insets(0, 0, 0, 0); gridBagConstraints.fill = GridBagConstraints.BOTH; designRules.add(rulesPanel, gridBagConstraints); } /** return the panel to use for this preferences tab. */ public JPanel getPanel() { return designRules; } /** return the name of this preferences tab. */ public String getName() { return "Design Rules"; } /** * Method called at the start of the dialog. * Caches current values and displays them in the Design Rules tab. */ public void init() { // get the design rules for the current technology DRCRules rules = DRC.getRules(curTech); if (rules == null) { drTechName.setText("Technology " + curTech.getTechName() + " HAS NO DESIGN RULES"); return; } drRules = rules; Foundry.Type foundry = curTech.getSelectedFoundry().getType(); rulesPanel.init(curTech, foundry, drRules); // load the dialog String text = "Design Rules for Technology '" + curTech.getTechName() + "'"; if (foundry != Foundry.Type.NONE) text += " with foundry " + foundry.getName(); drTechName.setText(text); // Resolution drResolutionValue.setText(TextUtils.formatDouble(curTech.getResolution())); } /** * Method called when the "OK" panel is hit. * Updates any changed fields in the Design Rules tab. */ public void term() { double currentResolution = TextUtils.atof(drResolutionValue.getText()); if (currentResolution != curTech.getResolution()) curTech.setResolution(currentResolution); // Getting last changes if (designRulesFactoryReset) { DRC.resetDRCDates(true); drRules = curTech.getFactoryDesignRules(); } DRC.setRules(curTech, drRules); // Repaint primitives EditWindow wnd = EditWindow.needCurrent(); if (wnd != null) wnd.fullRepaint(); } /** * Method called when the factory reset is requested. */ public void reset() { for(Iterator<Technology> it = Technology.getTechnologies(); it.hasNext(); ) { Technology tech = it.next(); if (tech.getFactoryResolution() != tech.getResolution()) tech.setResolution(tech.getFactoryResolution()); XMLRules rules = tech.getFactoryDesignRules(); DRC.setRules(tech, rules); tech.setCachedRules(rules); } } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; designRules = new javax.swing.JPanel(); drResolutionLabel = new javax.swing.JLabel(); drResolutionValue = new javax.swing.JTextField(); jLabel6 = new javax.swing.JLabel(); drTechName = new javax.swing.JLabel(); getContentPane().setLayout(new java.awt.GridBagLayout()); setTitle("Tool Options"); setName(""); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); designRules.setLayout(new java.awt.GridBagLayout()); designRules.setBorder(javax.swing.BorderFactory.createTitledBorder("")); drResolutionLabel.setText("Min. resolution:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); designRules.add(drResolutionLabel, gridBagConstraints); drResolutionValue.setColumns(6); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); designRules.add(drResolutionValue, gridBagConstraints); jLabel6.setText("(use 0 to ignore resolution check)"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); designRules.add(jLabel6, gridBagConstraints); drTechName.setText("jLabel1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 3; designRules.add(drTechName, gridBagConstraints); getContentPane().add(designRules, new java.awt.GridBagConstraints()); pack(); }// </editor-fold>//GEN-END:initComponents /** Closes the dialog */ private void closeDialog(java.awt.event.WindowEvent evt)//GEN-FIRST:event_closeDialog { setVisible(false); dispose(); }//GEN-LAST:event_closeDialog // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel designRules; private javax.swing.JLabel drResolutionLabel; private javax.swing.JTextField drResolutionValue; private javax.swing.JLabel drTechName; private javax.swing.JLabel jLabel6; // End of variables declaration//GEN-END:variables /****************************** Reset default arc widths ******************************/}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -