📄 logicalefforttab.java
字号:
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: LogicalEffortTab.java * * Copyright (c) 2006 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.projsettings;import com.sun.electric.database.text.Setting;import com.sun.electric.database.text.TextUtils;import com.sun.electric.technology.Technology;import com.sun.electric.tool.logicaleffort.LETool;import com.sun.electric.tool.user.dialogs.EDialog;import com.sun.electric.tool.user.dialogs.ProjectSettingsFrame;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.util.Iterator;import javax.swing.JPanel;import javax.swing.event.DocumentEvent;import javax.swing.event.DocumentListener;/** * Class to handle the "Logical Effort" tab of the Project Settings dialog. */public class LogicalEffortTab extends ProjSettingsPanel{ /** Creates new form LogicalEffortTab */ public LogicalEffortTab(ProjectSettingsFrame parent, boolean modal) { super(parent, modal); initComponents(); // make all text fields select-all when entered EDialog.makeTextFieldSelectAllOnTab(leGlobalFanOut); EDialog.makeTextFieldSelectAllOnTab(leConvergence); EDialog.makeTextFieldSelectAllOnTab(leMaxIterations); EDialog.makeTextFieldSelectAllOnTab(leKeeperSizeRatio); EDialog.makeTextFieldSelectAllOnTab(leGateCapacitance); EDialog.makeTextFieldSelectAllOnTab(leDefaultWireCapRatio); EDialog.makeTextFieldSelectAllOnTab(leDiffToGateCapRatio); } /** return the panel to use for this preferences tab. */ public JPanel getPanel() { return logicalEffort; } /** return the name of this preferences tab. */ public String getName() { return "Logical Effort"; } private boolean changingLE; private Setting useLocalSettingsSetting = LETool.getUseLocalSettingsSetting(); private Setting globalFanoutSetting = LETool.getGlobalFanoutSetting(); private Setting convergenceEpsilonSetting = LETool.getConvergenceEpsilonSetting(); private Setting maxIterationsSetting = LETool.getMaxIterationsSetting(); private Setting keeperRatioSetting = LETool.getKeeperRatioSetting(); /** * Method called at the start of the dialog. * Caches current values and displays them in the Logical Effort tab. */ public void init() { // tech-independent settings leUseLocalSettings.setSelected(getBoolean(useLocalSettingsSetting)); leGlobalFanOut.setText(getFormattedDouble(globalFanoutSetting)); leConvergence.setText(getFormattedDouble(convergenceEpsilonSetting)); leMaxIterations.setText(String.valueOf(getInt(maxIterationsSetting))); leKeeperSizeRatio.setText(getFormattedDouble(keeperRatioSetting)); // tech-dependent settings for(Iterator<Technology> it = Technology.getTechnologies(); it.hasNext(); ) { Technology tech = it.next(); if (!tech.isLayout()) continue; leTechnology.addItem(tech.getTechName()); } leTechnology.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { showArcsInTechnology(); } }); leTechnology.setSelectedItem(Technology.getCurrent().getTechName()); changingLE = false; leGateCapacitance.getDocument().addDocumentListener(new LEDocumentListener(this)); leDefaultWireCapRatio.getDocument().addDocumentListener(new LEDocumentListener(this)); leDiffToGateCapRatio.getDocument().addDocumentListener(new LEDocumentListener(this)); } /** * Method called when the user types a new layer name into the edit field. */ private void leInfoChanged() { if (changingLE) return; String techName = (String)leTechnology.getSelectedItem(); Technology tech = Technology.findTechnology(techName); if (tech == null) return; setDouble(tech.getGateCapacitanceSetting(), TextUtils.atof(leGateCapacitance.getText())); setDouble(tech.getWireRatioSetting(), TextUtils.atof(leDefaultWireCapRatio.getText())); setDouble(tech.getDiffAlphaSetting(), TextUtils.atof(leDiffToGateCapRatio.getText())); } /** * Class to handle special changes to changes to a Logical Effort setting. */ private static class LEDocumentListener implements DocumentListener { private LogicalEffortTab dialog; LEDocumentListener(LogicalEffortTab dialog) { this.dialog = dialog; } public void changedUpdate(DocumentEvent e) { dialog.leInfoChanged(); } public void insertUpdate(DocumentEvent e) { dialog.leInfoChanged(); } public void removeUpdate(DocumentEvent e) { dialog.leInfoChanged(); } } private void showArcsInTechnology() { String techName = (String)leTechnology.getSelectedItem(); Technology tech = Technology.findTechnology(techName); if (tech == null) return; changingLE = true; leGateCapacitance.setText(getFormattedDouble(tech.getGateCapacitanceSetting())); leDefaultWireCapRatio.setText(getFormattedDouble(tech.getWireRatioSetting())); leDiffToGateCapRatio.setText(getFormattedDouble(tech.getDiffAlphaSetting())); changingLE = false; } /** * Method called when the "OK" panel is hit. * Updates any changed fields in the Logical Effort tab. */ public void term() { setBoolean(useLocalSettingsSetting, leUseLocalSettings.isSelected()); setDouble(globalFanoutSetting, TextUtils.atof(leGlobalFanOut.getText())); setDouble(convergenceEpsilonSetting, TextUtils.atof(leConvergence.getText())); setInt(maxIterationsSetting, Integer.parseInt(leMaxIterations.getText())); setDouble(keeperRatioSetting, TextUtils.atof(leKeeperSizeRatio.getText())); } /** 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; logicalEffort = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); jLabel25 = new javax.swing.JLabel(); leUseLocalSettings = new javax.swing.JCheckBox(); leGlobalFanOut = new javax.swing.JTextField(); leConvergence = new javax.swing.JTextField(); leMaxIterations = new javax.swing.JTextField(); leKeeperSizeRatio = new javax.swing.JTextField(); jPanel1 = new javax.swing.JPanel(); jLabel23 = new javax.swing.JLabel(); leDiffToGateCapRatio = new javax.swing.JTextField(); jLabel22 = new javax.swing.JLabel(); leDefaultWireCapRatio = new javax.swing.JTextField(); jLabel20 = new javax.swing.JLabel(); leGateCapacitance = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); leTechnology = new javax.swing.JComboBox(); getContentPane().setLayout(new java.awt.GridBagLayout()); setTitle("Tool Options");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -