📄 icontab.java
字号:
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: IconTab.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.hierarchy.Cell;import com.sun.electric.database.text.TextUtils;import com.sun.electric.tool.user.User;import com.sun.electric.tool.user.ViewChanges;import com.sun.electric.tool.user.dialogs.EDialog;import com.sun.electric.tool.user.ui.WindowFrame;import java.awt.Frame;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JComboBox;import javax.swing.JPanel;/** * Class to handle the "Icon" tab of the Preferences dialog. */public class IconTab extends PreferencePanel{ /** Creates new form IconTab */ public IconTab(Frame parent, boolean modal) { super(parent, modal); initComponents(); // make all text fields select-all when entered EDialog.makeTextFieldSelectAllOnTab(iconLeadLength); EDialog.makeTextFieldSelectAllOnTab(iconLeadSpacing); EDialog.makeTextFieldSelectAllOnTab(iconTextSize); } /** return the panel to use for this preferences tab. */ public JPanel getPanel() { return icon; } /** return the name of this preferences tab. */ public String getName() { return "Icon"; } /** * Method called at the start of the dialog. * Caches current values and displays them in the Icon tab. */ public void init() { // listen for the "Make Icon" button iconMakeIcon.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { makeIconNow(); } }); // show the current cell Cell curCell = WindowFrame.getCurrentCell(); if (curCell == null) { iconCurrentCell.setText(""); iconMakeIcon.setEnabled(false); } else { iconCurrentCell.setText(curCell.describe(true)); iconMakeIcon.setEnabled(true); } iconPlaceByChar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { placementChanged(); } }); iconPlaceByLoc.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { placementChanged(); } }); useExactSchemLoc.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { placementChanged(); } }); // set how exports are placed (by characteristic or by location in original cell) int how = User.getIconGenExportPlacement(); if (how == 0) iconPlaceByChar.setSelected(true); else { if (how == 1) { iconPlaceByLoc.setSelected(true); useExactSchemLoc.setSelected(User.getIconGenExportPlacementExact()); } } placementChanged(); // initialize the side for each type of export initSide(iconInputPos); iconInputPos.setSelectedIndex(User.getIconGenInputSide()); initSide(iconOutputPos); iconOutputPos.setSelectedIndex(User.getIconGenOutputSide()); initSide(iconBidirPos); iconBidirPos.setSelectedIndex(User.getIconGenBidirSide()); initSide(iconPowerPos); iconPowerPos.setSelectedIndex(User.getIconGenPowerSide()); initSide(iconGroundPos); iconGroundPos.setSelectedIndex(User.getIconGenGroundSide()); initSide(iconClockPos); iconClockPos.setSelectedIndex(User.getIconGenClockSide()); // initialize the text rotation for each type of export initRot(iconInputRot); iconInputRot.setSelectedIndex(User.getIconGenInputRot()); initRot(iconOutputRot); iconOutputRot.setSelectedIndex(User.getIconGenOutputRot()); initRot(iconBidirRot); iconBidirRot.setSelectedIndex(User.getIconGenBidirRot()); initRot(iconPowerRot); iconPowerRot.setSelectedIndex(User.getIconGenPowerRot()); initRot(iconGroundRot); iconGroundRot.setSelectedIndex(User.getIconGenGroundRot()); initRot(iconClockRot); iconClockRot.setSelectedIndex(User.getIconGenClockRot()); initRot(iconTopRot); iconTopRot.setSelectedIndex(User.getIconGenTopRot()); initRot(iconBottomRot); iconBottomRot.setSelectedIndex(User.getIconGenBottomRot()); initRot(iconLeftRot); iconLeftRot.setSelectedIndex(User.getIconGenLeftRot()); initRot(iconRightRot); iconRightRot.setSelectedIndex(User.getIconGenRightRot()); iconExportPos.addItem("Body"); iconExportPos.addItem("Lead End"); iconExportPos.addItem("Lead Middle"); iconExportPos.setSelectedIndex(User.getIconGenExportLocation()); iconExportStyle.addItem("Centered"); iconExportStyle.addItem("Inward"); iconExportStyle.addItem("Outward"); iconExportStyle.setSelectedIndex(User.getIconGenExportStyle()); iconExportTechnology.addItem("Universal"); iconExportTechnology.addItem("Schematic"); iconExportTechnology.setSelectedIndex(User.getIconGenExportTech()); iconInstancePos.addItem("Upper-right"); iconInstancePos.addItem("Upper-left"); iconInstancePos.addItem("Lower-right"); iconInstancePos.addItem("Lower-left"); iconInstancePos.addItem("No Instance"); iconInstancePos.setSelectedIndex(User.getIconGenInstanceLocation()); iconDrawLeads.setSelected(User.isIconGenDrawLeads()); iconDrawBody.setSelected(User.isIconGenDrawBody()); iconTextSize.setText(TextUtils.formatDouble(User.getIconGenBodyTextSize())); iconReverseOrder.setSelected(User.isIconGenReverseExportOrder()); iconsAlwaysDrawn.setSelected(User.isIconsAlwaysDrawn()); iconLeadLength.setText(TextUtils.formatDouble(User.getIconGenLeadLength())); iconLeadSpacing.setText(TextUtils.formatDouble(User.getIconGenLeadSpacing())); } private void placementChanged() { boolean charEnabled = iconPlaceByChar.isSelected(); iconCharLabel1.setEnabled(charEnabled); iconCharLabel2.setEnabled(charEnabled); iconCharLabel3.setEnabled(charEnabled); iconCharLabel4.setEnabled(charEnabled); iconCharLabel5.setEnabled(charEnabled); iconCharLabel6.setEnabled(charEnabled); iconCharLabel7.setEnabled(charEnabled); iconCharLabel8.setEnabled(charEnabled); iconCharLabel9.setEnabled(charEnabled); iconCharLabel10.setEnabled(charEnabled); iconCharLabel11.setEnabled(charEnabled); iconCharLabel12.setEnabled(charEnabled); iconInputPos.setEnabled(charEnabled); iconInputRot.setEnabled(charEnabled); iconOutputPos.setEnabled(charEnabled); iconOutputRot.setEnabled(charEnabled); iconBidirPos.setEnabled(charEnabled); iconBidirRot.setEnabled(charEnabled); iconPowerPos.setEnabled(charEnabled); iconPowerRot.setEnabled(charEnabled); iconGroundPos.setEnabled(charEnabled); iconGroundRot.setEnabled(charEnabled); iconClockPos.setEnabled(charEnabled); iconClockRot.setEnabled(charEnabled); iconReverseOrder.setEnabled(charEnabled); boolean exactPlacementEnabled = useExactSchemLoc.isSelected(); iconLocLabel1.setEnabled(!charEnabled && !exactPlacementEnabled); iconLocLabel2.setEnabled(!charEnabled && !exactPlacementEnabled); iconLocLabel3.setEnabled(!charEnabled && !exactPlacementEnabled); iconLocLabel4.setEnabled(!charEnabled && !exactPlacementEnabled); iconLeftRot.setEnabled(!charEnabled && !exactPlacementEnabled); iconRightRot.setEnabled(!charEnabled && !exactPlacementEnabled); iconTopRot.setEnabled(!charEnabled && !exactPlacementEnabled); iconBottomRot.setEnabled(!charEnabled && !exactPlacementEnabled); useExactSchemLoc.setEnabled(!charEnabled); } private void initSide(JComboBox box) { box.addItem("Left Side"); box.addItem("Right Side"); box.addItem("Top Side"); box.addItem("Bottom Side"); } private void initRot(JComboBox box) { box.addItem("0"); box.addItem("90"); box.addItem("180"); box.addItem("270"); } private void makeIconNow() { term(); ViewChanges.makeIconViewCommand(); } /** * Method called when the "OK" panel is hit. * Updates any changed fields in the Icon tab. */ public void term() { int currInt = 0; if (iconPlaceByLoc.isSelected()) currInt = 1; if (currInt != User.getIconGenExportPlacement()) User.setIconGenExportPlacement(currInt); // Set the checkbox for using the exact placement User.setIconGenExportPlacementExact(useExactSchemLoc.isSelected()); // save which side each export type goes on currInt = iconInputPos.getSelectedIndex(); if (currInt != User.getIconGenInputSide()) User.setIconGenInputSide(currInt); currInt = iconOutputPos.getSelectedIndex(); if (currInt != User.getIconGenOutputSide()) User.setIconGenOutputSide(currInt); currInt = iconBidirPos.getSelectedIndex(); if (currInt != User.getIconGenBidirSide()) User.setIconGenBidirSide(currInt); currInt = iconPowerPos.getSelectedIndex(); if (currInt != User.getIconGenPowerSide()) User.setIconGenPowerSide(currInt); currInt = iconGroundPos.getSelectedIndex(); if (currInt != User.getIconGenGroundSide()) User.setIconGenGroundSide(currInt); currInt = iconClockPos.getSelectedIndex(); if (currInt != User.getIconGenClockSide()) User.setIconGenClockSide(currInt); // save which angle each export goes on currInt = iconInputRot.getSelectedIndex(); if (currInt != User.getIconGenInputRot()) User.setIconGenInputRot(currInt); currInt = iconOutputRot.getSelectedIndex();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -