~ubuntu-branches/ubuntu/utopic/electric/utopic-proposed

« back to all changes in this revision

Viewing changes to com/sun/electric/tool/user/dialogs/GetInfoNode.java

  • Committer: Bazaar Package Importer
  • Author(s): Onkar Shinde
  • Date: 2008-07-23 02:09:53 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080723020953-1gmnv7q2wpsdbnop
Tags: 8.07-0ubuntu1
* New Upstream version. Please check changelog for details. (LP: #242720)
* debian/control
  - Add build dependencies *-jdk, cdbs and bsh.
  - Remove build dependency dpatch. We will be using CDBS simple patchsys.
  - Refreshed runtime dependencies to default-jre | java2-runtime and bsh.
  - Added home page field.
  - Standard version 3.8.0.
  - Modify Maintainer value to match the DebianMaintainerField
    specification.
  - Changed email address for original maintainer to indicate who has
    refreshed the packaging.
* debian/rules
  - Revamped to use cdbs.
  - Added get-orig-source target.
* debian/patches
  - 00list, 02_sensible-browser.dpatch, 01_errors-numbers.dpatch,
    03_manpage.dpatch - Deleted, not relevant anymore.
  - 01_fix_build_xml.patch - Patch to fix the build.xml.
* debian/ant.properties
  - File to set various compilation properties.
* debian/electric.1
  - Remove the entry that causes lintian warning.
* debian/electric.desktop
  - Change as suggested by desktop-file-validate.
* debian/electric.docs
  - Updated as per changes in file names.
* debian/electric.svg
  - Name changed from electric_icon.svg.
* debian/install
  - Added appropriate locations for jar file, desktop file and wrapper shell
    script.
* debian/README.source
  - Added to comply with standards version 3.8.0.
* debian/TODO.Debian
  - Name changed form TODO.
* debain/wrapper/electric
  - Wrapper shell script to launch the application.
* debian/manpages
  - Added for installation of manpage.
* debian/watch
  - Updated to match jar files instead of older tar.gz files.
* debian/dirs
  - Removed, not needed anymore.
* debian/{electric.doc-base, electric.examples, substvars}
  - Removed, not relevant anymore.
* debian/*.debhelper
  - Removed auto generated files. Not relevant anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- tab-width: 4 -*-
 
2
 *
 
3
 * Electric(tm) VLSI Design System
 
4
 *
 
5
 * File: GetInfoNode.java
 
6
 *
 
7
 * Copyright (c) 2003 Sun Microsystems and Static Free Software
 
8
 *
 
9
 * Electric(tm) is free software; you can redistribute it and/or modify
 
10
 * it under the terms of the GNU General Public License as published by
 
11
 * the Free Software Foundation; either version 3 of the License, or
 
12
 * (at your option) any later version.
 
13
 *
 
14
 * Electric(tm) is distributed in the hope that it will be useful,
 
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 * GNU General Public License for more details.
 
18
 *
 
19
 * You should have received a copy of the GNU General Public License
 
20
 * along with Electric(tm); see the file COPYING.  If not, write to
 
21
 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 
22
 * Boston, Mass 02111-1307, USA.
 
23
 */
 
24
package com.sun.electric.tool.user.dialogs;
 
25
 
 
26
import com.sun.electric.database.change.DatabaseChangeEvent;
 
27
import com.sun.electric.database.change.DatabaseChangeListener;
 
28
import com.sun.electric.database.geometry.DBMath;
 
29
import com.sun.electric.database.geometry.Orientation;
 
30
import com.sun.electric.database.hierarchy.Cell;
 
31
import com.sun.electric.database.hierarchy.Export;
 
32
import com.sun.electric.database.network.Netlist;
 
33
import com.sun.electric.database.network.Network;
 
34
import com.sun.electric.database.prototype.NodeProto;
 
35
import com.sun.electric.database.prototype.PortCharacteristic;
 
36
import com.sun.electric.database.prototype.PortProto;
 
37
import com.sun.electric.database.text.TextUtils;
 
38
import com.sun.electric.database.topology.ArcInst;
 
39
import com.sun.electric.database.topology.Connection;
 
40
import com.sun.electric.database.topology.NodeInst;
 
41
import com.sun.electric.database.topology.PortInst;
 
42
import com.sun.electric.database.variable.ElectricObject;
 
43
import com.sun.electric.database.variable.TextDescriptor;
 
44
import com.sun.electric.database.variable.Variable;
 
45
import com.sun.electric.technology.ArcProto;
 
46
import com.sun.electric.technology.PrimitiveNode;
 
47
import com.sun.electric.technology.PrimitiveNodeSize;
 
48
import com.sun.electric.technology.Technology;
 
49
import com.sun.electric.technology.technologies.Artwork;
 
50
import com.sun.electric.technology.technologies.Generic;
 
51
import com.sun.electric.technology.technologies.Schematics;
 
52
import com.sun.electric.tool.Client;
 
53
import com.sun.electric.tool.Job;
 
54
import com.sun.electric.tool.JobException;
 
55
import com.sun.electric.tool.user.Highlight2;
 
56
import com.sun.electric.tool.user.HighlightListener;
 
57
import com.sun.electric.tool.user.Highlighter;
 
58
import com.sun.electric.tool.user.User;
 
59
import com.sun.electric.tool.user.UserInterfaceMain;
 
60
import com.sun.electric.tool.user.tecEdit.Manipulate;
 
61
import com.sun.electric.tool.user.ui.EditWindow;
 
62
import com.sun.electric.tool.user.ui.TopLevel;
 
63
import com.sun.electric.tool.user.ui.WindowFrame;
 
64
 
 
65
import java.awt.Frame;
 
66
import java.awt.GridBagConstraints;
 
67
import java.awt.Insets;
 
68
import java.awt.geom.Point2D;
 
69
import java.util.ArrayList;
 
70
import java.util.Iterator;
 
71
import java.util.List;
 
72
import java.util.prefs.Preferences;
 
73
 
 
74
import javax.swing.DefaultListModel;
 
75
import javax.swing.JFrame;
 
76
import javax.swing.JList;
 
77
import javax.swing.ListSelectionModel;
 
78
import javax.swing.UIManager;
 
79
 
 
80
/**
 
81
 * Class to handle the "Node Properties" dialog.
 
82
 */
 
83
public class GetInfoNode extends EModelessDialog implements HighlightListener, DatabaseChangeListener
 
84
{
 
85
        private static GetInfoNode theDialog = null;
 
86
        private NodeInst shownNode = null;
 
87
        private PortProto shownPort = null;
 
88
        private double initialXPos, initialYPos;
 
89
        private String initialXSize, initialYSize;
 
90
        private boolean initialMirrorX, initialMirrorY;
 
91
        private int initialRotation, initialPopupIndex;
 
92
        private boolean initialEasyToSelect, initialInvisibleOutsideCell, initialLocked, initialExpansion;
 
93
        private String initialName, initialTextField;
 
94
        private String initialPopupEntry;
 
95
        private DefaultListModel listModel;
 
96
        private JList list;
 
97
        private List<AttributesTable.AttValPair> allAttributes;
 
98
        private List<ArcInst> portObjects;
 
99
        private boolean bigger;
 
100
        private boolean scalableTrans;
 
101
        private boolean swapXY;
 
102
        private AttributesTable attributesTable;
 
103
        private EditWindow wnd;
 
104
 
 
105
        private static Preferences prefs = Preferences.userNodeForPackage(GetInfoNode.class);
 
106
 
 
107
        /**
 
108
         * Method to show the Node Properties dialog.
 
109
         */
 
110
        public static void showDialog()
 
111
        {
 
112
                if (Client.getOperatingSystem() == Client.OS.UNIX) {
 
113
                        // JKG 07Apr2006:
 
114
                        // On Linux, if a dialog is built, closed using setVisible(false),
 
115
                        // and then requested again using setVisible(true), it does
 
116
                        // not appear on top. I've tried using toFront(), requestFocus(),
 
117
                        // but none of that works.  Instead, I brute force it and
 
118
                        // rebuild the dialog from scratch each time.
 
119
                        if (theDialog != null) theDialog.dispose();
 
120
                        theDialog = null;
 
121
                }
 
122
                if (theDialog == null)
 
123
                {
 
124
                        JFrame jf = null;
 
125
                        if (TopLevel.isMDIMode()) jf = TopLevel.getCurrentJFrame();
 
126
                        theDialog = new GetInfoNode(jf);
 
127
                }
 
128
                theDialog.loadInfo();
 
129
 
 
130
                if (!theDialog.isVisible())
 
131
                {
 
132
                        theDialog.pack();
 
133
                        theDialog.ensureProperSize();
 
134
                        theDialog.setVisible(true);
 
135
                }
 
136
                theDialog.toFront();
 
137
        }
 
138
 
 
139
        /**
 
140
         * Reloads the dialog when Highlights change
 
141
         */
 
142
        public void highlightChanged(Highlighter which)
 
143
        {
 
144
                if (!isVisible()) return;
 
145
                loadInfo();
 
146
        }
 
147
 
 
148
        /**
 
149
         * Called when by a Highlighter when it loses focus. The argument
 
150
         * is the Highlighter that has gained focus (may be null).
 
151
         * @param highlighterGainedFocus the highlighter for the current window (may be null).
 
152
         */
 
153
        public void highlighterLostFocus(Highlighter highlighterGainedFocus) {
 
154
                if (!isVisible()) return;
 
155
                loadInfo();
 
156
        }
 
157
 
 
158
        /**
 
159
         * Respond to database changes
 
160
         * @param e database change event
 
161
         */
 
162
        public void databaseChanged(DatabaseChangeEvent e) {
 
163
                if (!isVisible()) return;
 
164
 
 
165
                // update dialog if we care about the changes
 
166
                if (e.objectChanged(shownNode) || shownPort instanceof Export && e.objectChanged((Export)shownPort))
 
167
                {
 
168
                        loadInfo();
 
169
                }
 
170
        }
 
171
 
 
172
        /** Creates new form Node Properties */
 
173
        private GetInfoNode(Frame parent)
 
174
        {
 
175
                super(parent, false);
 
176
                initComponents();
 
177
                getRootPane().setDefaultButton(ok);
 
178
 
 
179
                UserInterfaceMain.addDatabaseChangeListener(this);
 
180
                Highlighter.addHighlightListener(this);
 
181
 
 
182
                // make type a selectable but not editable field
 
183
                type.setEditable(false);
 
184
                type.setBorder(null);
 
185
                type.setForeground(UIManager.getColor("Label.foreground"));
 
186
                type.setFont(UIManager.getFont("Label.font"));
 
187
 
 
188
                bigger = prefs.getBoolean("GetInfoNode-bigger", false);
 
189
                int buttonSelected = prefs.getInt("GetInfoNode-buttonSelected", 0);
 
190
 
 
191
                // start small
 
192
                if (bigger == false) {
 
193
                        getContentPane().remove(moreStuffTop);
 
194
                        getContentPane().remove(listPane);
 
195
                        getContentPane().remove(moreStuffBottom);
 
196
                        more.setText("More");
 
197
                        pack();
 
198
                } else {
 
199
                        more.setText("Less");
 
200
                }
 
201
 
 
202
                // make the list
 
203
                listModel = new DefaultListModel();
 
204
                list = new JList(listModel);
 
205
                list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
 
206
                listPane.setViewportView(list);
 
207
                allAttributes = new ArrayList<AttributesTable.AttValPair>();
 
208
                portObjects = new ArrayList<ArcInst>();
 
209
 
 
210
                attributesTable = new AttributesTable(null, true, false, false);
 
211
 
 
212
                switch (buttonSelected)
 
213
                {
 
214
                        case 0: ports.setSelected(true);           break;
 
215
                        case 1: attributes.setSelected(true);  break;
 
216
                        case 2: busMembers.setSelected(true);  break;
 
217
                }
 
218
 
 
219
                loadInfo();
 
220
                finishInitialization();
 
221
        }
 
222
 
 
223
        protected void escapePressed() { cancelActionPerformed(null); }
 
224
 
 
225
        protected void loadInfo()
 
226
        {
 
227
                // update current window
 
228
                EditWindow curWnd = EditWindow.getCurrent();
 
229
                if (curWnd != null) wnd = curWnd;
 
230
 
 
231
                // must have a single node selected
 
232
                NodeInst ni = null;
 
233
                PortProto pp = null;
 
234
                int nodeCount = 0;
 
235
                if (wnd != null) {
 
236
                        for(Highlight2 h : wnd.getHighlighter().getHighlights())
 
237
                        {
 
238
                                if (!h.isHighlightEOBJ()) continue;
 
239
                                ElectricObject eobj = h.getElectricObject();
 
240
                                if (eobj instanceof PortInst)
 
241
                                {
 
242
                                        pp = ((PortInst)eobj).getPortProto();
 
243
                                        eobj = ((PortInst)eobj).getNodeInst();
 
244
                                }
 
245
                                if (eobj instanceof NodeInst)
 
246
                                {
 
247
                                        ni = (NodeInst)eobj;
 
248
                                        nodeCount++;
 
249
                                }
 
250
                        }
 
251
                }
 
252
                if (nodeCount > 1) ni = null;
 
253
                if (ni == null)
 
254
                {
 
255
                        if (shownNode != null)
 
256
                        {
 
257
                                // no node selected, disable the dialog
 
258
                                type.setText("");
 
259
                                name.setEditable(false);
 
260
                                name.setText("");
 
261
                                xSize.setEditable(false);
 
262
                                xSize.setText("");
 
263
                                ySize.setEditable(false);
 
264
                                ySize.setText("");
 
265
                                xPos.setEditable(false);
 
266
                                xPos.setText("");
 
267
                                yPos.setEditable(false);
 
268
                                yPos.setText("");
 
269
                                rotation.setEditable(false);
 
270
                                rotation.setText("");
 
271
                                mirrorX.setEnabled(false);
 
272
                                mirrorX.setSelected(false);
 
273
                                mirrorY.setEnabled(false);
 
274
                                mirrorY.setSelected(false);
 
275
                                apply.setEnabled(false);
 
276
 
 
277
                                // in "more" version
 
278
                                expanded.setEnabled(false);
 
279
                                unexpanded.setEnabled(false);
 
280
                                easyToSelect.setEnabled(false);
 
281
                                easyToSelect.setSelected(false);
 
282
                                invisibleOutsideCell.setEnabled(false);
 
283
                                invisibleOutsideCell.setSelected(false);
 
284
                                textFieldLabel.setText("");
 
285
                                textField.setText("");
 
286
                                textField.setEditable(false);
 
287
                                popupLabel.setText("");
 
288
                                popup.removeAllItems();
 
289
                                popup.setEnabled(false);
 
290
                                ports.setEnabled(false);
 
291
                                attributes.setEnabled(false);
 
292
                                attributesTable.setElectricObject(null);
 
293
                                attributesTable.setEnabled(false);
 
294
                                busMembers.setEnabled(false);
 
295
                                listPane.setEnabled(false);
 
296
                                listModel.clear();
 
297
                                locked.setEnabled(false);
 
298
                                locked.setSelected(false);
 
299
                                see.setEnabled(false);
 
300
                                editParameters.setEnabled(false);
 
301
                                colorAndPattern.setEnabled(false);
 
302
 
 
303
                                shownNode = null;
 
304
                                shownPort = null;
 
305
                        }
 
306
                        return;
 
307
                }
 
308
 
 
309
                shownNode = ni;
 
310
                shownPort = pp;
 
311
 
 
312
                EDialog.focusClearOnTextField(name);
 
313
 
 
314
                // in small version
 
315
                NodeProto np = ni.getProto();
 
316
                name.setEditable(true);
 
317
                boolean sizeEditable = true;
 
318
                xPos.setEditable(true);
 
319
                yPos.setEditable(true);
 
320
                rotation.setEditable(true);
 
321
                mirrorX.setEnabled(true);
 
322
                mirrorY.setEnabled(true);
 
323
                apply.setEnabled(true);
 
324
 
 
325
                initialName = ni.getName();
 
326
                initialXPos = ni.getAnchorCenterX();
 
327
                initialYPos = ni.getAnchorCenterY();
 
328
                double initXSize = ni.getLambdaBaseXSize();
 
329
                double initYSize = ni.getLambdaBaseYSize();
 
330
                initialRotation = ni.getAngle();
 
331
                swapXY = false;
 
332
                if (initialRotation == 900 || initialRotation == 2700) swapXY = true;
 
333
 
 
334
                type.setText(np.describe(false));
 
335
                name.setText(initialName);
 
336
                xPos.setText(TextUtils.formatDouble(initialXPos));
 
337
                yPos.setText(TextUtils.formatDouble(initialYPos));
 
338
                boolean realMirrorX = ni.isXMirrored();
 
339
                boolean realMirrorY = ni.isYMirrored();
 
340
                if (swapXY)
 
341
                {
 
342
                        xSize.setText(TextUtils.formatDouble(initYSize));
 
343
                        ySize.setText(TextUtils.formatDouble(initXSize));
 
344
                        initialMirrorX = realMirrorY;
 
345
                        initialMirrorY = realMirrorX;
 
346
                } else
 
347
                {
 
348
                        xSize.setText(TextUtils.formatDouble(initXSize));
 
349
                        ySize.setText(TextUtils.formatDouble(initYSize));
 
350
                        initialMirrorX = realMirrorX;
 
351
                        initialMirrorY = realMirrorY;
 
352
                }
 
353
                initialXSize = xSize.getText();
 
354
                initialYSize = ySize.getText();
 
355
                mirrorX.setSelected(initialMirrorX);
 
356
                mirrorY.setSelected(initialMirrorY);
 
357
                rotation.setText(TextUtils.formatDouble(initialRotation / 10.0));
 
358
 
 
359
                // special case for transistors and resistors
 
360
                PrimitiveNodeSize npSize = ni.getPrimitiveNodeSize(null);
 
361
                if (npSize != null) {
 
362
                        xsizeLabel.setText("Width:");
 
363
                xsizeLabel.setDisplayedMnemonic('w');
 
364
                        ysizeLabel.setText("Length:");
 
365
                ysizeLabel.setDisplayedMnemonic('l');
 
366
                        double width = npSize.getDoubleWidth();
 
367
                        if (width == 0 && npSize.getWidth() != null)
 
368
                                xSize.setText(npSize.getWidth().toString());
 
369
                        else
 
370
                                xSize.setText(TextUtils.formatDouble(width));
 
371
                        double length = npSize.getDoubleLength();
 
372
                        if (length == 0 && npSize.getLength() != null)
 
373
                                ySize.setText(npSize.getLength().toString());
 
374
                        else
 
375
                                ySize.setText(TextUtils.formatDouble(length));
 
376
                        initialXSize = xSize.getText();
 
377
                        initialYSize = ySize.getText();
 
378
//              } else if (ni.getFunction()==PrimitiveNode.Function.PRESIST) {
 
379
//                      // special case for Poly resistors
 
380
//                      xsizeLabel.setText("Length:");
 
381
//                      ysizeLabel.setText("Width:");
 
382
                } else {
 
383
                        xsizeLabel.setText("X size:");
 
384
                xsizeLabel.setDisplayedMnemonic('s');
 
385
                        ysizeLabel.setText("Y size:");
 
386
                ysizeLabel.setDisplayedMnemonic('z');
 
387
                }
 
388
 
 
389
                // in "more" version
 
390
                easyToSelect.setEnabled(true);
 
391
                invisibleOutsideCell.setEnabled(true);
 
392
                ports.setEnabled(true);
 
393
                attributes.setEnabled(true);
 
394
                attributesTable.setEnabled(true);
 
395
                busMembers.setEnabled(true);
 
396
                listPane.setEnabled(true);
 
397
                locked.setEnabled(true);
 
398
                editParameters.setEnabled(false);
 
399
                if (ni.isCellInstance()) editParameters.setEnabled(true);
 
400
                colorAndPattern.setEnabled(ni.getProto().getTechnology() == Artwork.tech());
 
401
 
 
402
                // grab all attributes and parameters
 
403
                allAttributes.clear();
 
404
 
 
405
                for(Iterator<Variable> it = ni.getParametersAndVariables(); it.hasNext(); )
 
406
                {
 
407
                        Variable var = it.next();
 
408
                        String name = var.getKey().getName();
 
409
                        if (!name.startsWith("ATTR_")) continue;
 
410
 
 
411
                        // found an attribute
 
412
                        AttributesTable.AttValPair avp = new AttributesTable.AttValPair();
 
413
                        avp.key = var.getKey();
 
414
                        avp.trueName = var.getTrueName();
 
415
                        avp.value = var.getObject().toString();
 
416
                        avp.code = var.isCode();
 
417
                        allAttributes.add(avp);
 
418
                }
 
419
                boolean hasAttributes = allAttributes.size() != 0 || ni.getParameters().hasNext();
 
420
                attributes.setEnabled(hasAttributes);
 
421
                attributesTable.setEnabled(hasAttributes);
 
422
                attributesTable.setElectricObject(ni);
 
423
                if (attributes.isSelected() && !hasAttributes) ports.setSelected(true);
 
424
 
 
425
                int busWidth = 1;
 
426
                Netlist nl = shownNode.getParent().acquireUserNetlist();
 
427
                if (nl != null)
 
428
                {
 
429
                        if (shownPort != null && shownPort instanceof Export)
 
430
                                busWidth = nl.getBusWidth((Export)shownPort);
 
431
                }
 
432
                if (busWidth <= 1)
 
433
                {
 
434
                        if (busMembers.isSelected()) ports.setSelected(true);
 
435
                        busMembers.setEnabled(false);
 
436
                }
 
437
                showProperList();
 
438
 
 
439
                // special lines default to empty
 
440
                textFieldLabel.setText("");
 
441
                textField.setText("");
 
442
                textField.setEditable(false);
 
443
                popupLabel.setText("");
 
444
                popup.removeAllItems();
 
445
                popup.setEnabled(false);
 
446
 
 
447
                // see if this node has outline information
 
448
                Point2D [] outline = ni.getTrace();
 
449
                if (outline != null)
 
450
                {
 
451
                        sizeEditable = false;
 
452
                }
 
453
 
 
454
                // if there is outline information on a transistor, remember that
 
455
                initialTextField = null;
 
456
                boolean lengthEditable = false;
 
457
                if (ni.isSerpentineTransistor())
 
458
                        lengthEditable = true;
 
459
 
 
460
                // set the expansion button
 
461
                if (np instanceof Cell)
 
462
                {
 
463
                        expanded.setEnabled(true);
 
464
                        unexpanded.setEnabled(true);
 
465
                        initialExpansion = ni.isExpanded();
 
466
                        if (initialExpansion) expanded.setSelected(true); else
 
467
                                unexpanded.setSelected(true);
 
468
                        sizeEditable = false;
 
469
                } else
 
470
                {
 
471
                        expanded.setEnabled(false);
 
472
                        unexpanded.setEnabled(false);
 
473
                }
 
474
 
 
475
                if (sizeEditable) {
 
476
                        xSize.setEditable(true);
 
477
                        ySize.setEditable(true);
 
478
                } else {
 
479
                        xSize.setEditable(false);
 
480
                        ySize.setEditable(lengthEditable);
 
481
                }
 
482
 
 
483
                // load visible-outside-cell state
 
484
                initialInvisibleOutsideCell = ni.isVisInside();
 
485
                invisibleOutsideCell.setSelected(initialInvisibleOutsideCell);
 
486
 
 
487
                // load easy of selection
 
488
                initialEasyToSelect = !ni.isHardSelect();
 
489
                easyToSelect.setSelected(initialEasyToSelect);
 
490
                if (np instanceof Cell && !User.isEasySelectionOfCellInstances())
 
491
                        easyToSelect.setEnabled(false);
 
492
 
 
493
                // load locked state
 
494
                initialLocked = ni.isLocked();
 
495
                locked.setSelected(initialLocked);
 
496
 
 
497
                // load special node information
 
498
                PrimitiveNode.Function fun = ni.getFunction();
 
499
                if (np == Schematics.tech().transistorNode || np == Schematics.tech().transistor4Node)
 
500
                {
 
501
                        if (!ni.isFET())
 
502
                        {
 
503
                                textField.setEditable(true);
 
504
                                textFieldLabel.setText("Area:");
 
505
 
 
506
                                Variable var = ni.getVar(Schematics.ATTR_AREA);
 
507
 
 
508
                                textField.setText(var.getPureValue(-1));
 
509
 
 
510
                                popupLabel.setText("Transistor type:");
 
511
                                popup.addItem(fun.getName());
 
512
                        }
 
513
                }
 
514
 
 
515
                scalableTrans = false;
 
516
                if (!ni.isCellInstance())
 
517
                {
 
518
                        if (np.getTechnology() == Technology.getMocmosTechnology())
 
519
                        {
 
520
                                if (np.getName().equals("P-Transistor-Scalable") ||
 
521
                                        np.getName().equals("N-Transistor-Scalable"))
 
522
                                                scalableTrans = true;
 
523
                        }
 
524
                }
 
525
                if (scalableTrans)
 
526
                {
 
527
                        popupLabel.setText("Contacts:");
 
528
                        popup.addItem("Top & Bottom / normal spacing");
 
529
                        popup.addItem("Top & Bottom / half-unit closer");
 
530
                        popup.addItem("Only Bottom / normal spacing");
 
531
                        popup.addItem("Only Bottom / half-unit closer");
 
532
                        popup.addItem("None");
 
533
                        String pt = ni.getVarValue(Technology.TRANS_CONTACT, String.class);
 
534
                        int numContacts = 2;
 
535
                        boolean insetContacts = false;
 
536
                        if (pt != null)
 
537
                        {
 
538
                                for(int i=0; i<pt.length(); i++)
 
539
                                {
 
540
                                        char chr = pt.charAt(i);
 
541
                                        if (chr == '0' || chr == '1' || chr == '2')
 
542
                                        {
 
543
                                                numContacts = chr - '0';
 
544
                                        } else if (chr == 'i' || chr == 'I') insetContacts = true;
 
545
                                }
 
546
                        }
 
547
                        initialPopupIndex = (2 - numContacts) * 2;
 
548
                        if (insetContacts && numContacts > 0) initialPopupIndex++;
 
549
                        popup.setSelectedIndex(initialPopupIndex);
 
550
                        popup.setEnabled(true);
 
551
 
 
552
                        textFieldLabel.setText("Width:");
 
553
                        Variable var = ni.getVar(Schematics.ATTR_WIDTH);
 
554
                        double width = ni.getLambdaBaseXSize();
 
555
                        if (var != null) width = TextUtils.atof(var.getPureValue(-1));
 
556
                        initialTextField = Double.toString(width);
 
557
                        textField.setEditable(true);
 
558
                        textField.setText(initialTextField);
 
559
                }
 
560
                if (fun.isResistor())
 
561
                {
 
562
                        if (fun == PrimitiveNode.Function.PRESIST)
 
563
                                textFieldLabel.setText("Poly resistance:"); else
 
564
                                        textFieldLabel.setText("Resistance:");
 
565
//                      formatinfstr(infstr, x_(" (%s):"),
 
566
//                              TRANSLATE(us_resistancenames[(us_electricalunits&INTERNALRESUNITS) >> INTERNALRESUNITSSH]));
 
567
                        Variable var = ni.getVar(Schematics.SCHEM_RESISTANCE);
 
568
                        if (var == null) initialTextField = "0"; else
 
569
                                initialTextField = new String(var.getObject().toString());
 
570
                        textField.setEditable(true);
 
571
                        textField.setText(initialTextField);
 
572
                }
 
573
                if (fun.isCapacitor())
 
574
                {
 
575
                        if (fun == PrimitiveNode.Function.ECAPAC)
 
576
                                textFieldLabel.setText("Electrolytic cap:"); else
 
577
                                        textFieldLabel.setText("Capacitance:");
 
578
//                      formatinfstr(infstr, x_(" (%s):"),
 
579
//                              TRANSLATE(us_capacitancenames[(us_electricalunits&INTERNALCAPUNITS) >> INTERNALCAPUNITSSH]));
 
580
                        Variable var = ni.getVar(Schematics.SCHEM_CAPACITANCE);
 
581
                        if (var == null) initialTextField = "0"; else
 
582
                                initialTextField = new String(var.getObject().toString());
 
583
                        textField.setEditable(true);
 
584
                        textField.setText(initialTextField);
 
585
                }
 
586
                if (fun == PrimitiveNode.Function.INDUCT)
 
587
                {
 
588
                        textFieldLabel.setText("Inductance:");
 
589
//                      formatinfstr(infstr, x_(" (%s):"),
 
590
//                              TRANSLATE(us_inductancenames[(us_electricalunits&INTERNALINDUNITS) >> INTERNALINDUNITSSH]));
 
591
                        Variable var = ni.getVar(Schematics.SCHEM_INDUCTANCE);
 
592
                        if (var == null) initialTextField = "0"; else
 
593
                                initialTextField = new String(var.getObject().toString());
 
594
                        textField.setEditable(true);
 
595
                        textField.setText(initialTextField);
 
596
                }
 
597
                if (np == Schematics.tech().bboxNode)
 
598
                {
 
599
                        textFieldLabel.setText("Function:");
 
600
                        Variable var = ni.getVar(Schematics.SCHEM_FUNCTION);
 
601
                        if (var == null) initialTextField = ""; else
 
602
                                initialTextField = new String(var.getObject().toString());
 
603
                        textField.setEditable(true);
 
604
                        textField.setText(initialTextField);
 
605
                }
 
606
                if (fun.isFlipFlop())
 
607
                {
 
608
                        popupLabel.setText("Flip-flop type:");
 
609
                        popup.addItem(fun.getName());
 
610
                }
 
611
                if (np == Schematics.tech().globalNode)
 
612
                {
 
613
                        textFieldLabel.setText("Global name:");
 
614
                        Variable var = ni.getVar(Schematics.SCHEM_GLOBAL_NAME);
 
615
                        if (var == null) initialTextField = ""; else
 
616
                                initialTextField = new String(var.getObject().toString());
 
617
                        textField.setEditable(true);
 
618
                        textField.setText(initialTextField);
 
619
 
 
620
                        popupLabel.setText("Characteristics:");
 
621
                        List<PortCharacteristic> characteristics = PortCharacteristic.getOrderedCharacteristics();
 
622
                        for(PortCharacteristic ch : characteristics)
 
623
                        {
 
624
                                popup.addItem(ch.getName());
 
625
                        }
 
626
                        PortCharacteristic ch = PortCharacteristic.findCharacteristic(ni.getTechSpecific());
 
627
                        initialPopupEntry = ch.getName();
 
628
                        popup.setSelectedItem(initialPopupEntry);
 
629
                        popup.setEnabled(true);
 
630
                }
 
631
 
 
632
                // handle technology editor primitives
 
633
                if (ni.getParent().isInTechnologyLibrary())
 
634
                {
 
635
                        popupLabel.setText("Tech. editor:");
 
636
                        popup.addItem(Manipulate.describeNodeMeaning(ni));
 
637
                }
 
638
 
 
639
                // load the degrees of a circle if appropriate
 
640
                if (np == Artwork.tech().circleNode || np == Artwork.tech().thickCircleNode)
 
641
                {
 
642
                        double [] arcData = ni.getArcDegrees();
 
643
                        double start = DBMath.round(arcData[0] * 180.0 / Math.PI);
 
644
                        double curvature = DBMath.round(arcData[1] * 180.0 / Math.PI);
 
645
                        if (start != 0.0)
 
646
                        {
 
647
                                textFieldLabel.setText("Offset angle / Degrees of circle:");
 
648
                                initialTextField = new String(start + " / " + curvature);
 
649
                        } else
 
650
                        {
 
651
                                textFieldLabel.setText("Degrees of circle:");
 
652
                                if (curvature == 0) initialTextField = "360"; else
 
653
                                        initialTextField = new String(Double.toString(curvature));
 
654
                        }
 
655
                        textField.setEditable(true);
 
656
                        textField.setText(initialTextField);
 
657
                }
 
658
                EDialog.focusOnTextField(name);
 
659
        }
 
660
 
 
661
        private void showProperList()
 
662
        {
 
663
                listModel.clear();
 
664
                portObjects.clear();
 
665
 
 
666
                if (ports.isSelected())
 
667
                {
 
668
                        // show ports
 
669
                        listPane.setViewportView(list);
 
670
                        NodeProto np = shownNode.getProto();
 
671
                        List<String> portMessages = new ArrayList<String>();
 
672
                        int selectedLine = 0;
 
673
                        for(Iterator<PortInst> it = shownNode.getPortInsts(); it.hasNext(); )
 
674
                        {
 
675
                                PortInst pi = it.next();
 
676
                                PortProto pp = pi.getPortProto();
 
677
                                PortCharacteristic ch = pp.getCharacteristic();
 
678
                                String description;
 
679
                                if (ch == PortCharacteristic.UNKNOWN) description = "Port "; else
 
680
                                        description = ch.getName() + " port ";
 
681
                                description += pp.getName();
 
682
 
 
683
                                // mention if it is highlighted
 
684
                                if (pp == shownPort)
 
685
                                {
 
686
                                        selectedLine = portMessages.size();
 
687
                                        description += " (Highlighted)";
 
688
                                }
 
689
 
 
690
                                description += " connects to";
 
691
                                ArcProto [] connList = pp.getBasePort().getConnections();
 
692
                                int count = 0;
 
693
                                for(int i=0; i<connList.length; i++)
 
694
                                {
 
695
                                        ArcProto ap = connList[i];
 
696
                                        if ((np instanceof Cell || np.getTechnology() != Generic.tech()) &&
 
697
                                                ap.getTechnology() == Generic.tech()) continue;
 
698
                                        if (count > 0) description += ",";
 
699
                                        description += " " + ap.getName();
 
700
                                        count++;
 
701
                                }
 
702
                                boolean moreInfo = false;
 
703
                                if (pp == shownPort) moreInfo = true;
 
704
                                for(Iterator<Connection> aIt = shownNode.getConnections(); aIt.hasNext(); )
 
705
                                {
 
706
                                        Connection con = aIt.next();
 
707
                                        if (con.getPortInst() == pi) { moreInfo = true;   break; }
 
708
                                }
 
709
                                for(Iterator<Export> eIt = shownNode.getExports(); eIt.hasNext(); )
 
710
                                {
 
711
                                        Export e = eIt.next();
 
712
                                        if (e.getOriginalPort() == pi) { moreInfo = true;   break; }
 
713
                                }
 
714
                                if (moreInfo) description += ":";
 
715
                                portMessages.add(description);
 
716
                                portObjects.add(null);
 
717
 
 
718
                                // talk about any arcs on this prototype
 
719
                                for(Iterator<Connection> aIt = shownNode.getConnections(); aIt.hasNext(); )
 
720
                                {
 
721
                                        Connection con = aIt.next();
 
722
                                        if (con.getPortInst() != pi) continue;
 
723
                                        ArcInst ai = con.getArc();
 
724
                                        description = "  Connected at (" + con.getLocation().getX() + "," + con.getLocation().getY() +
 
725
                                                ") to " + ai;
 
726
                                        portMessages.add(description);
 
727
                                        portObjects.add(ai);
 
728
                                }
 
729
 
 
730
                                // talk about any exports of this prototype
 
731
                                for(Iterator<Export> eIt = shownNode.getExports(); eIt.hasNext(); )
 
732
                                {
 
733
                                        Export e = eIt.next();
 
734
                                        if (e.getOriginalPort() != pi) continue;
 
735
                                        description = "  Available as " + e.getCharacteristic().getName() + " export '" + e.getName() + "'";
 
736
                                        portMessages.add(description);
 
737
                                        portObjects.add(null);
 
738
                                }
 
739
                        }
 
740
                        see.setEnabled(true);
 
741
                        list.setListData(portMessages.toArray());
 
742
                        list.setSelectedIndex(selectedLine);
 
743
                        list.ensureIndexIsVisible(selectedLine);
 
744
                }
 
745
                if (busMembers.isSelected())
 
746
                {
 
747
                        Netlist nl = shownNode.getParent().acquireUserNetlist();
 
748
                        int busWidth = nl.getBusWidth((Export)shownPort);
 
749
                        List<String> busMessages = new ArrayList<String>();
 
750
                        for(int i=0; i<busWidth; i++)
 
751
                        {
 
752
                                Network net = nl.getNetwork(shownNode, shownPort, i);
 
753
                                String netDescr = "?";
 
754
                                if (net != null) netDescr = net.describe(false);
 
755
                                busMessages.add(i + ": " + netDescr);
 
756
                        }
 
757
                        listPane.setViewportView(list);
 
758
                        list.setListData(busMessages.toArray());
 
759
                }
 
760
                if (attributes.isSelected())
 
761
                {
 
762
                        listPane.setViewportView(attributesTable);
 
763
                }
 
764
        }
 
765
 
 
766
        private static class ChangeNode extends Job
 
767
        {
 
768
                private NodeInst ni;
 
769
                private double initialXPos, initialYPos, currentXPos, currentYPos;
 
770
                private String initialXSize, initialYSize, currentXSize, currentYSize;
 
771
                private boolean currentMirrorX, currentMirrorY;
 
772
                private int currentRotation;
 
773
                private int initialPopupIndex, currentPopupIndex;
 
774
                private boolean initialEasyToSelect, currentEasyToSelect;
 
775
                private boolean initialInvisibleOutsideCell, currentInvisibleOutsideCell;
 
776
                private boolean initialLocked, currentLocked;
 
777
                private boolean initialExpansion, currentExpansion;
 
778
                private String initialName, currentName;
 
779
                private String initialTextField, currentTextField;
 
780
                private String initialPopupEntry, currentPopupEntry;
 
781
                private boolean scalableTrans;
 
782
                private boolean swapXY;
 
783
                private boolean expansionChanged;
 
784
 
 
785
                public ChangeNode(NodeInst ni,
 
786
                        double initialXPos, double currentXPos, double initialYPos, double currentYPos,
 
787
                        String initialXSize, String currentXSize, String initialYSize, String currentYSize,
 
788
                        boolean currentMirrorX, boolean currentMirrorY,
 
789
                        int currentRotation,
 
790
                        int initialPopupIndex, int currentPopupIndex,
 
791
                        boolean initialEasyToSelect, boolean currentEasyToSelect,
 
792
                        boolean initialInvisibleOutsideCell, boolean currentInvisibleOutsideCell,
 
793
                        boolean initialLocked, boolean currentLocked,
 
794
                        boolean initialExpansion, boolean currentExpansion,
 
795
                        String initialName, String currentName,
 
796
                        String initialTextField, String currentTextField,
 
797
                        String initialPopupEntry, String currentPopupEntry,
 
798
                        boolean bigger,
 
799
                        boolean scalableTrans,
 
800
                        boolean swapXY)
 
801
                {
 
802
                        super("Modify Node", User.getUserTool(), Job.Type.CHANGE, null, null, Job.Priority.USER);
 
803
                        this.ni = ni;
 
804
                        this.initialXPos = initialXPos;                                   this.currentXPos = currentXPos;
 
805
                        this.initialYPos = initialYPos;                                   this.currentYPos = currentYPos;
 
806
                        this.initialXSize = initialXSize;                                 this.currentXSize = currentXSize;
 
807
                        this.initialYSize = initialYSize;                                 this.currentYSize = currentYSize;
 
808
                                                                                          this.currentMirrorX = currentMirrorX;
 
809
                                                                                          this.currentMirrorY = currentMirrorY;
 
810
                                                                                          this.currentRotation = currentRotation;
 
811
                        this.initialPopupIndex = initialPopupIndex;                       this.currentPopupIndex = currentPopupIndex;
 
812
                        this.initialEasyToSelect = initialEasyToSelect;                   this.currentEasyToSelect = currentEasyToSelect;
 
813
                        this.initialInvisibleOutsideCell = initialInvisibleOutsideCell;   this.currentInvisibleOutsideCell = currentInvisibleOutsideCell;
 
814
                        this.initialLocked = initialLocked;                               this.currentLocked = currentLocked;
 
815
                        this.initialExpansion = initialExpansion;                         this.currentExpansion = currentExpansion;
 
816
                        this.initialName = initialName;                                   this.currentName = currentName;
 
817
                        this.initialTextField = initialTextField;                         this.currentTextField = currentTextField;
 
818
                        this.initialPopupEntry = initialPopupEntry;                       this.currentPopupEntry = currentPopupEntry;
 
819
                        this.scalableTrans = scalableTrans;
 
820
                        this.swapXY = swapXY;
 
821
                        startJob();
 
822
                }
 
823
 
 
824
                public boolean doIt() throws JobException
 
825
                {
 
826
                        boolean changed = false;
 
827
                        expansionChanged = false;
 
828
                        NodeProto np = ni.getProto();
 
829
 
 
830
                        if (!currentName.equals(initialName))
 
831
                        {
 
832
                                if (currentName.length() == 0) currentName = null;
 
833
                                ni.setName(currentName);
 
834
                                changed = true;
 
835
                        }
 
836
 
 
837
                        if (ni.isCellInstance())
 
838
                        {
 
839
                                if (currentExpansion != initialExpansion)
 
840
                                {
 
841
                                        if (currentExpansion) ni.setExpanded(); else
 
842
                                                ni.clearExpanded();
 
843
                                        changed = true;
 
844
                                        expansionChanged = true;
 
845
                                }
 
846
                        }
 
847
 
 
848
                        if (currentEasyToSelect != initialEasyToSelect)
 
849
                        {
 
850
                                if (currentEasyToSelect) ni.clearHardSelect(); else
 
851
                                        ni.setHardSelect();
 
852
                        }
 
853
 
 
854
                        if (currentInvisibleOutsideCell != initialInvisibleOutsideCell)
 
855
                        {
 
856
                                if (currentInvisibleOutsideCell) ni.setVisInside(); else
 
857
                                        ni.clearVisInside();
 
858
                                changed = true;
 
859
                        }
 
860
 
 
861
                        if (currentLocked != initialLocked)
 
862
                        {
 
863
                                if (currentLocked) ni.setLocked(); else
 
864
                                        ni.clearLocked();
 
865
                        }
 
866
 
 
867
                        // handle special node information
 
868
                        if (scalableTrans)
 
869
                        {
 
870
                                if (currentPopupIndex != initialPopupIndex)
 
871
                                {
 
872
                                        int numContacts = 2 - (currentPopupIndex / 2);
 
873
                                        boolean inset = (currentPopupIndex&1) != 0;
 
874
                                        String contactInfo = String.valueOf(numContacts);
 
875
                                        if (inset) contactInfo += "i";
 
876
                                        ni.newVar(Technology.TRANS_CONTACT, contactInfo);
 
877
                                }
 
878
 
 
879
                                if (!currentTextField.equals(initialTextField))
 
880
                                {
 
881
                                        double width = TextUtils.atof(currentTextField);
 
882
                                        Variable oldVar = ni.getVar(Schematics.ATTR_WIDTH);
 
883
                                        Variable var = ni.updateVar(Schematics.ATTR_WIDTH, new Double(width));
 
884
                                        if (var != null && oldVar == null)
 
885
                                        {
 
886
                                                ni.addVar(var.withDisplay(true).withDispPart(TextDescriptor.DispPos.NAMEVALUE));
 
887
                                        }
 
888
                                }
 
889
                        }
 
890
                        PrimitiveNode.Function fun = ni.getFunction();
 
891
                        if (fun == PrimitiveNode.Function.DIODE || fun == PrimitiveNode.Function.DIODEZ)
 
892
                        {
 
893
                                if (!currentTextField.equals(initialTextField))
 
894
                                {
 
895
                                        Variable var = ni.updateVarText(Schematics.SCHEM_DIODE, currentTextField);
 
896
                                        if (var != null && !var.isDisplay()) ni.addVar(var.withDisplay(true));
 
897
                                        changed = true;
 
898
                                }
 
899
                        }
 
900
                        if (fun.isResistor())
 
901
                        {
 
902
                                if (!currentTextField.equals(initialTextField))
 
903
                                {
 
904
                                        Variable var = ni.updateVarText(Schematics.SCHEM_RESISTANCE, currentTextField);
 
905
                                        if (var != null && !var.isDisplay()) ni.addVar(var.withDisplay(true));
 
906
                                        changed = true;
 
907
                                }
 
908
                        }
 
909
                        if (fun.isCapacitor())
 
910
                        {
 
911
                                if (!currentTextField.equals(initialTextField))
 
912
                                {
 
913
                                        Variable var = ni.updateVarText(Schematics.SCHEM_CAPACITANCE, currentTextField);
 
914
                                        if (var != null && !var.isDisplay()) ni.addVar(var.withDisplay(true));
 
915
                                        changed = true;
 
916
                                }
 
917
                        }
 
918
                        if (fun == PrimitiveNode.Function.INDUCT)
 
919
                        {
 
920
                                if (!currentTextField.equals(initialTextField))
 
921
                                {
 
922
                                        Variable var = ni.updateVarText(Schematics.SCHEM_INDUCTANCE, currentTextField);
 
923
                                        if (var != null && !var.isDisplay()) ni.addVar(var.withDisplay(true));
 
924
                                        changed = true;
 
925
                                }
 
926
                        }
 
927
                        if (np == Schematics.tech().bboxNode)
 
928
                        {
 
929
                                if (!currentTextField.equals(initialTextField))
 
930
                                {
 
931
                                        Variable var = ni.updateVarText(Schematics.SCHEM_FUNCTION, currentTextField);
 
932
                                        if (var != null && !var.isDisplay()) ni.addVar(var.withDisplay(true));
 
933
                                        changed = true;
 
934
                                }
 
935
                        }
 
936
                        if (np == Schematics.tech().globalNode)
 
937
                        {
 
938
                                if (!currentTextField.equals(initialTextField))
 
939
                                {
 
940
                                        Variable var = ni.updateVarText(Schematics.SCHEM_GLOBAL_NAME, currentTextField);
 
941
                                        if (var != null && !var.isDisplay()) ni.addVar(var.withDisplay(true));
 
942
                                        changed = true;
 
943
                                }
 
944
 
 
945
                                if (!currentPopupEntry.equals(initialPopupEntry))
 
946
                                {
 
947
                                        PortCharacteristic ch = PortCharacteristic.findCharacteristic(currentPopupEntry);
 
948
                                        ni.setTechSpecific(ch.getBits());
 
949
                                        changed = true;
 
950
                                }
 
951
                        }
 
952
 
 
953
                        // load the degrees of a circle if appropriate
 
954
                        if (np == Artwork.tech().circleNode || np == Artwork.tech().thickCircleNode)
 
955
                        {
 
956
                                if (!currentTextField.equals(initialTextField))
 
957
                                {
 
958
                                        double start = 0;
 
959
                                        double curvature = TextUtils.atof(currentTextField) * Math.PI / 180.0;
 
960
                                        int slashPos = currentTextField.indexOf('/');
 
961
                                        if (slashPos >= 0)
 
962
                                        {
 
963
                                                start = curvature;
 
964
                                                curvature = TextUtils.atof(currentTextField.substring(slashPos+1)) * Math.PI / 180.0;
 
965
                                        }
 
966
                                        ni.setArcDegrees(start, curvature);
 
967
                                        changed = true;
 
968
                                }
 
969
                        }
 
970
 
 
971
                        double initXSize, initYSize;
 
972
                        double currXSize, currYSize;
 
973
                        Orientation orient;
 
974
 
 
975
                        // Figure out change in X and Y size
 
976
                        // if swapXY, X size was put in Y text box, and vice versa.
 
977
                        if (swapXY)
 
978
                        {
 
979
                                // get true size minus offset (this is the size the user sees)
 
980
                                currXSize = TextUtils.atof(currentYSize, new Double(ni.getLambdaBaseXSize()));
 
981
                                currYSize = TextUtils.atof(currentXSize, new Double(ni.getLambdaBaseYSize()));
 
982
                                initXSize = TextUtils.atof(initialYSize, new Double(currXSize));
 
983
                                initYSize = TextUtils.atof(initialXSize, new Double(currYSize));
 
984
 
 
985
                                // mirror
 
986
                                orient = Orientation.fromJava(currentRotation, currentMirrorY, currentMirrorX);
 
987
                        } else
 
988
                        {
 
989
                                currXSize = TextUtils.atof(currentXSize, new Double(ni.getLambdaBaseXSize()));
 
990
                                currYSize = TextUtils.atof(currentYSize, new Double(ni.getLambdaBaseYSize()));
 
991
                                initXSize = TextUtils.atof(initialXSize, new Double(currXSize));
 
992
                                initYSize = TextUtils.atof(initialYSize, new Double(currYSize));
 
993
 
 
994
                                // mirror
 
995
                                orient = Orientation.fromJava(currentRotation, currentMirrorX, currentMirrorY);
 
996
                        }
 
997
 
 
998
                        // The following code is specific for transistors, and uses the X/Y size fields for
 
999
                        // Width and Length, and therefore may override the values such that the node size does not
 
1000
                        // get set by them.
 
1001
                        PrimitiveNodeSize size = ni.getPrimitiveNodeSize(null);
 
1002
                        if (size != null)
 
1003
                        {
 
1004
                                // see if this is a schematic transistor
 
1005
                                if (np == Schematics.tech().transistorNode || np == Schematics.tech().transistor4Node ||
 
1006
                                        np == Schematics.tech().resistorNode)
 
1007
                                {
 
1008
                                        Object width, length;
 
1009
                                        if (ni.isFET() || ni.getFunction() == PrimitiveNode.Function.PRESIST)
 
1010
                                        {
 
1011
                                                // see if we can convert width and length to a Number
 
1012
                                                double w = TextUtils.atof(currentXSize, null);
 
1013
                                                if (w == 0)
 
1014
                                                {
 
1015
                                                        // set width to whatever text is there
 
1016
                                                        width = Variable.withCode(currentXSize, ni.getCode(Schematics.ATTR_WIDTH));
 
1017
                                                } else
 
1018
                                                {
 
1019
                                                        width = new Double(w);
 
1020
                                                }
 
1021
 
 
1022
                                                double l = TextUtils.atof(currentYSize, null);
 
1023
                                                if (l == 0)
 
1024
                                                {
 
1025
                                                        // set length to whatever text is there
 
1026
                                                        length = Variable.withCode(currentYSize, ni.getCode(Schematics.ATTR_LENGTH));
 
1027
                                                } else
 
1028
                                                {
 
1029
                                                        length = new Double(l);
 
1030
                                                }
 
1031
                                                ni.setPrimitiveNodeSize(width, length);
 
1032
                                        }
 
1033
                                } else // transistors or resistors
 
1034
                                {
 
1035
                                        // this is a layout transistor
 
1036
                                        if (ni.isSerpentineTransistor())
 
1037
                                        {
 
1038
                                                // serpentine transistors can only set length
 
1039
                                                double initialLength = ni.getSerpentineTransistorLength();
 
1040
                                                double length = TextUtils.atof(currentYSize, new Double(initialLength));
 
1041
                                                if (length != initialLength)
 
1042
                                                        ni.setSerpentineTransistorLength(length);
 
1043
                                        } else
 
1044
                                        {
 
1045
                                                // set length and width by node size for layout transistors
 
1046
                                                double initialWidth = size.getDoubleWidth();
 
1047
                                                double initialLength = size.getDoubleLength();
 
1048
                                                double width = TextUtils.atof(currentXSize, new Double(initialWidth));
 
1049
                                                double length = TextUtils.atof(currentYSize, new Double(initialLength));
 
1050
                                                if (!DBMath.doublesEqual(width, initialWidth) ||
 
1051
                                                        !DBMath.doublesEqual(length, initialLength))
 
1052
                                                {
 
1053
                                                        // set transistor or resistor size
 
1054
                                                        ni.setPrimitiveNodeSize(width, length);
 
1055
                                                }
 
1056
                                        }
 
1057
                                }
 
1058
                                // ignore size change, but retain mirroring change (sign)
 
1059
                                currXSize = initXSize = ni.getLambdaBaseXSize();
 
1060
                                currYSize = initYSize = ni.getLambdaBaseYSize();
 
1061
                                if (swapXY)
 
1062
                                        orient = Orientation.fromJava(currentRotation, currentMirrorY, currentMirrorX);
 
1063
                                else
 
1064
                                        orient = Orientation.fromJava(currentRotation, currentMirrorX, currentMirrorY);
 
1065
                        }
 
1066
 
 
1067
                        Orientation dOrient = orient.concatenate(ni.getOrient().inverse());
 
1068
                        if (!DBMath.doublesEqual(currentXPos, initialXPos) ||
 
1069
                                !DBMath.doublesEqual(currentYPos, initialYPos) ||
 
1070
                                !DBMath.doublesEqual(currXSize, initXSize) ||
 
1071
                                !DBMath.doublesEqual(currYSize, initYSize) ||
 
1072
                                dOrient != Orientation.IDENT || changed)
 
1073
                        {
 
1074
                                ni.modifyInstance(DBMath.round(currentXPos - initialXPos), DBMath.round(currentYPos - initialYPos),
 
1075
                                        DBMath.round(currXSize - initXSize),
 
1076
                                        DBMath.round(currYSize - initYSize), dOrient);
 
1077
                        }
 
1078
                        fieldVariableChanged("expansionChanged");
 
1079
 
 
1080
                        return true;
 
1081
                }
 
1082
 
 
1083
                public void terminateOK()
 
1084
                {
 
1085
                        if (expansionChanged)
 
1086
                        {
 
1087
                                EditWindow.expansionChanged(ni.getParent());
 
1088
                                EditWindow.clearSubCellCache();
 
1089
                                EditWindow.repaintAllContents();
 
1090
                        }
 
1091
                }
 
1092
        }
 
1093
 
 
1094
        /** This method is called from within the constructor to
 
1095
         * initialize the form.
 
1096
         * WARNING: Do NOT modify this code. The content of this method is
 
1097
         * always regenerated by the Form Editor.
 
1098
         */
 
1099
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
 
1100
    private void initComponents() {
 
1101
        java.awt.GridBagConstraints gridBagConstraints;
 
1102
 
 
1103
        expansion = new javax.swing.ButtonGroup();
 
1104
        selection = new javax.swing.ButtonGroup();
 
1105
        jLabel1 = new javax.swing.JLabel();
 
1106
        name = new javax.swing.JTextField();
 
1107
        cancel = new javax.swing.JButton();
 
1108
        ok = new javax.swing.JButton();
 
1109
        jLabel3 = new javax.swing.JLabel();
 
1110
        xsizeLabel = new javax.swing.JLabel();
 
1111
        xSize = new javax.swing.JTextField();
 
1112
        ysizeLabel = new javax.swing.JLabel();
 
1113
        ySize = new javax.swing.JTextField();
 
1114
        jLabel6 = new javax.swing.JLabel();
 
1115
        xPos = new javax.swing.JTextField();
 
1116
        jLabel7 = new javax.swing.JLabel();
 
1117
        yPos = new javax.swing.JTextField();
 
1118
        jLabel8 = new javax.swing.JLabel();
 
1119
        rotation = new javax.swing.JTextField();
 
1120
        mirrorX = new javax.swing.JCheckBox();
 
1121
        more = new javax.swing.JButton();
 
1122
        apply = new javax.swing.JButton();
 
1123
        mirrorY = new javax.swing.JCheckBox();
 
1124
        moreStuffTop = new javax.swing.JPanel();
 
1125
        expanded = new javax.swing.JRadioButton();
 
1126
        unexpanded = new javax.swing.JRadioButton();
 
1127
        easyToSelect = new javax.swing.JCheckBox();
 
1128
        invisibleOutsideCell = new javax.swing.JCheckBox();
 
1129
        textFieldLabel = new javax.swing.JLabel();
 
1130
        textField = new javax.swing.JTextField();
 
1131
        popupLabel = new javax.swing.JLabel();
 
1132
        popup = new javax.swing.JComboBox();
 
1133
        ports = new javax.swing.JRadioButton();
 
1134
        attributes = new javax.swing.JRadioButton();
 
1135
        busMembers = new javax.swing.JRadioButton();
 
1136
        moreStuffBottom = new javax.swing.JPanel();
 
1137
        locked = new javax.swing.JCheckBox();
 
1138
        see = new javax.swing.JButton();
 
1139
        colorAndPattern = new javax.swing.JButton();
 
1140
        editParameters = new javax.swing.JButton();
 
1141
        listPane = new javax.swing.JScrollPane();
 
1142
        type = new javax.swing.JTextField();
 
1143
 
 
1144
        getContentPane().setLayout(new java.awt.GridBagLayout());
 
1145
 
 
1146
        setTitle("Node Properties");
 
1147
        setName("");
 
1148
        addWindowListener(new java.awt.event.WindowAdapter() {
 
1149
            public void windowClosing(java.awt.event.WindowEvent evt) {
 
1150
                closeDialog(evt);
 
1151
            }
 
1152
        });
 
1153
 
 
1154
        jLabel1.setLabelFor(type);
 
1155
        jLabel1.setText("Type:");
 
1156
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1157
        gridBagConstraints.gridx = 0;
 
1158
        gridBagConstraints.gridy = 0;
 
1159
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
1160
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1161
        getContentPane().add(jLabel1, gridBagConstraints);
 
1162
 
 
1163
        name.setPreferredSize(new java.awt.Dimension(250, 20));
 
1164
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1165
        gridBagConstraints.gridx = 1;
 
1166
        gridBagConstraints.gridy = 1;
 
1167
        gridBagConstraints.gridwidth = 3;
 
1168
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
 
1169
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1170
        getContentPane().add(name, gridBagConstraints);
 
1171
 
 
1172
        cancel.setText("Cancel");
 
1173
        cancel.addActionListener(new java.awt.event.ActionListener() {
 
1174
            public void actionPerformed(java.awt.event.ActionEvent evt) {
 
1175
                cancelActionPerformed(evt);
 
1176
            }
 
1177
        });
 
1178
 
 
1179
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1180
        gridBagConstraints.gridx = 2;
 
1181
        gridBagConstraints.gridy = 5;
 
1182
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1183
        getContentPane().add(cancel, gridBagConstraints);
 
1184
 
 
1185
        ok.setText("OK");
 
1186
        ok.addActionListener(new java.awt.event.ActionListener() {
 
1187
            public void actionPerformed(java.awt.event.ActionEvent evt) {
 
1188
                okActionPerformed(evt);
 
1189
            }
 
1190
        });
 
1191
 
 
1192
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1193
        gridBagConstraints.gridx = 3;
 
1194
        gridBagConstraints.gridy = 5;
 
1195
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1196
        getContentPane().add(ok, gridBagConstraints);
 
1197
 
 
1198
        jLabel3.setDisplayedMnemonic('n');
 
1199
        jLabel3.setLabelFor(name);
 
1200
        jLabel3.setText("Name:");
 
1201
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1202
        gridBagConstraints.gridx = 0;
 
1203
        gridBagConstraints.gridy = 1;
 
1204
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
1205
        gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
 
1206
        getContentPane().add(jLabel3, gridBagConstraints);
 
1207
 
 
1208
        xsizeLabel.setDisplayedMnemonic('s');
 
1209
        xsizeLabel.setLabelFor(xSize);
 
1210
        xsizeLabel.setText("X size:");
 
1211
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1212
        gridBagConstraints.gridx = 0;
 
1213
        gridBagConstraints.gridy = 2;
 
1214
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
1215
        gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
 
1216
        getContentPane().add(xsizeLabel, gridBagConstraints);
 
1217
 
 
1218
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1219
        gridBagConstraints.gridx = 1;
 
1220
        gridBagConstraints.gridy = 2;
 
1221
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
 
1222
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
1223
        gridBagConstraints.weightx = 0.5;
 
1224
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1225
        getContentPane().add(xSize, gridBagConstraints);
 
1226
 
 
1227
        ysizeLabel.setDisplayedMnemonic('z');
 
1228
        ysizeLabel.setLabelFor(ySize);
 
1229
        ysizeLabel.setText("Y size:");
 
1230
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1231
        gridBagConstraints.gridx = 0;
 
1232
        gridBagConstraints.gridy = 3;
 
1233
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
1234
        gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
 
1235
        getContentPane().add(ysizeLabel, gridBagConstraints);
 
1236
 
 
1237
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1238
        gridBagConstraints.gridx = 1;
 
1239
        gridBagConstraints.gridy = 3;
 
1240
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
 
1241
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
1242
        gridBagConstraints.weightx = 0.5;
 
1243
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1244
        getContentPane().add(ySize, gridBagConstraints);
 
1245
 
 
1246
        jLabel6.setDisplayedMnemonic('x');
 
1247
        jLabel6.setLabelFor(xPos);
 
1248
        jLabel6.setText("X position:");
 
1249
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1250
        gridBagConstraints.gridx = 2;
 
1251
        gridBagConstraints.gridy = 2;
 
1252
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
1253
        gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
 
1254
        getContentPane().add(jLabel6, gridBagConstraints);
 
1255
 
 
1256
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1257
        gridBagConstraints.gridx = 3;
 
1258
        gridBagConstraints.gridy = 2;
 
1259
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
 
1260
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
1261
        gridBagConstraints.weightx = 0.5;
 
1262
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1263
        getContentPane().add(xPos, gridBagConstraints);
 
1264
 
 
1265
        jLabel7.setDisplayedMnemonic('y');
 
1266
        jLabel7.setLabelFor(yPos);
 
1267
        jLabel7.setText("Y position:");
 
1268
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1269
        gridBagConstraints.gridx = 2;
 
1270
        gridBagConstraints.gridy = 3;
 
1271
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
1272
        gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
 
1273
        getContentPane().add(jLabel7, gridBagConstraints);
 
1274
 
 
1275
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1276
        gridBagConstraints.gridx = 3;
 
1277
        gridBagConstraints.gridy = 3;
 
1278
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
 
1279
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
1280
        gridBagConstraints.weightx = 0.5;
 
1281
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1282
        getContentPane().add(yPos, gridBagConstraints);
 
1283
 
 
1284
        jLabel8.setDisplayedMnemonic('r');
 
1285
        jLabel8.setLabelFor(rotation);
 
1286
        jLabel8.setText("Rotation:");
 
1287
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1288
        gridBagConstraints.gridx = 0;
 
1289
        gridBagConstraints.gridy = 4;
 
1290
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
1291
        gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
 
1292
        getContentPane().add(jLabel8, gridBagConstraints);
 
1293
 
 
1294
        rotation.setColumns(6);
 
1295
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1296
        gridBagConstraints.gridx = 1;
 
1297
        gridBagConstraints.gridy = 4;
 
1298
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
 
1299
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
1300
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1301
        getContentPane().add(rotation, gridBagConstraints);
 
1302
 
 
1303
        mirrorX.setText("Mirror L-R");
 
1304
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1305
        gridBagConstraints.gridx = 2;
 
1306
        gridBagConstraints.gridy = 4;
 
1307
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
1308
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1309
        getContentPane().add(mirrorX, gridBagConstraints);
 
1310
 
 
1311
        more.setText("More");
 
1312
        more.addActionListener(new java.awt.event.ActionListener() {
 
1313
            public void actionPerformed(java.awt.event.ActionEvent evt) {
 
1314
                moreActionPerformed(evt);
 
1315
            }
 
1316
        });
 
1317
 
 
1318
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1319
        gridBagConstraints.gridx = 0;
 
1320
        gridBagConstraints.gridy = 5;
 
1321
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1322
        getContentPane().add(more, gridBagConstraints);
 
1323
 
 
1324
        apply.setText("Apply");
 
1325
        apply.addActionListener(new java.awt.event.ActionListener() {
 
1326
            public void actionPerformed(java.awt.event.ActionEvent evt) {
 
1327
                applyActionPerformed(evt);
 
1328
            }
 
1329
        });
 
1330
 
 
1331
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1332
        gridBagConstraints.gridx = 1;
 
1333
        gridBagConstraints.gridy = 5;
 
1334
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1335
        getContentPane().add(apply, gridBagConstraints);
 
1336
 
 
1337
        mirrorY.setText("Mirror U-D");
 
1338
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1339
        gridBagConstraints.gridx = 3;
 
1340
        gridBagConstraints.gridy = 4;
 
1341
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
1342
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1343
        getContentPane().add(mirrorY, gridBagConstraints);
 
1344
 
 
1345
        moreStuffTop.setLayout(new java.awt.GridBagLayout());
 
1346
 
 
1347
        expansion.add(expanded);
 
1348
        expanded.setText("Expanded");
 
1349
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1350
        gridBagConstraints.gridx = 0;
 
1351
        gridBagConstraints.gridy = 0;
 
1352
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1353
        moreStuffTop.add(expanded, gridBagConstraints);
 
1354
 
 
1355
        expansion.add(unexpanded);
 
1356
        unexpanded.setText("Unexpanded");
 
1357
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1358
        gridBagConstraints.gridx = 1;
 
1359
        gridBagConstraints.gridy = 0;
 
1360
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1361
        moreStuffTop.add(unexpanded, gridBagConstraints);
 
1362
 
 
1363
        easyToSelect.setText("Easy to Select");
 
1364
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1365
        gridBagConstraints.gridx = 2;
 
1366
        gridBagConstraints.gridy = 0;
 
1367
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1368
        moreStuffTop.add(easyToSelect, gridBagConstraints);
 
1369
 
 
1370
        invisibleOutsideCell.setText("Invisible Outside Cell");
 
1371
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1372
        gridBagConstraints.gridx = 3;
 
1373
        gridBagConstraints.gridy = 0;
 
1374
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1375
        moreStuffTop.add(invisibleOutsideCell, gridBagConstraints);
 
1376
 
 
1377
        textFieldLabel.setLabelFor(textField);
 
1378
        textFieldLabel.setText(" ");
 
1379
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1380
        gridBagConstraints.gridx = 0;
 
1381
        gridBagConstraints.gridy = 1;
 
1382
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
 
1383
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
1384
        moreStuffTop.add(textFieldLabel, gridBagConstraints);
 
1385
 
 
1386
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1387
        gridBagConstraints.gridx = 1;
 
1388
        gridBagConstraints.gridy = 1;
 
1389
        gridBagConstraints.gridwidth = 3;
 
1390
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
 
1391
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
1392
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1393
        moreStuffTop.add(textField, gridBagConstraints);
 
1394
 
 
1395
        popupLabel.setLabelFor(popup);
 
1396
        popupLabel.setText(" ");
 
1397
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1398
        gridBagConstraints.gridx = 0;
 
1399
        gridBagConstraints.gridy = 2;
 
1400
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
 
1401
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
1402
        moreStuffTop.add(popupLabel, gridBagConstraints);
 
1403
 
 
1404
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1405
        gridBagConstraints.gridx = 1;
 
1406
        gridBagConstraints.gridy = 2;
 
1407
        gridBagConstraints.gridwidth = 3;
 
1408
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
 
1409
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
1410
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1411
        moreStuffTop.add(popup, gridBagConstraints);
 
1412
 
 
1413
        selection.add(ports);
 
1414
        ports.setText("Ports:");
 
1415
        ports.addActionListener(new java.awt.event.ActionListener() {
 
1416
            public void actionPerformed(java.awt.event.ActionEvent evt) {
 
1417
                portsActionPerformed(evt);
 
1418
            }
 
1419
        });
 
1420
 
 
1421
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1422
        gridBagConstraints.gridx = 0;
 
1423
        gridBagConstraints.gridy = 3;
 
1424
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 4);
 
1425
        moreStuffTop.add(ports, gridBagConstraints);
 
1426
 
 
1427
        selection.add(attributes);
 
1428
        attributes.setText("Parameters:");
 
1429
        attributes.addActionListener(new java.awt.event.ActionListener() {
 
1430
            public void actionPerformed(java.awt.event.ActionEvent evt) {
 
1431
                attributesActionPerformed(evt);
 
1432
            }
 
1433
        });
 
1434
 
 
1435
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1436
        gridBagConstraints.gridx = 1;
 
1437
        gridBagConstraints.gridy = 3;
 
1438
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 4);
 
1439
        moreStuffTop.add(attributes, gridBagConstraints);
 
1440
 
 
1441
        selection.add(busMembers);
 
1442
        busMembers.setText("Bus Members on Port:");
 
1443
        busMembers.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
 
1444
        busMembers.addActionListener(new java.awt.event.ActionListener() {
 
1445
            public void actionPerformed(java.awt.event.ActionEvent evt) {
 
1446
                busMembersActionPerformed(evt);
 
1447
            }
 
1448
        });
 
1449
 
 
1450
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1451
        gridBagConstraints.gridx = 2;
 
1452
        gridBagConstraints.gridy = 3;
 
1453
        gridBagConstraints.gridwidth = 2;
 
1454
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
1455
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 4);
 
1456
        moreStuffTop.add(busMembers, gridBagConstraints);
 
1457
 
 
1458
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1459
        gridBagConstraints.gridx = 0;
 
1460
        gridBagConstraints.gridy = 6;
 
1461
        gridBagConstraints.gridwidth = 4;
 
1462
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
 
1463
        gridBagConstraints.weightx = 1.0;
 
1464
        getContentPane().add(moreStuffTop, gridBagConstraints);
 
1465
 
 
1466
        moreStuffBottom.setLayout(new java.awt.GridBagLayout());
 
1467
 
 
1468
        locked.setText("Locked");
 
1469
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1470
        gridBagConstraints.gridx = 0;
 
1471
        gridBagConstraints.gridy = 0;
 
1472
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
1473
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1474
        moreStuffBottom.add(locked, gridBagConstraints);
 
1475
 
 
1476
        see.setText("See");
 
1477
        see.addActionListener(new java.awt.event.ActionListener() {
 
1478
            public void actionPerformed(java.awt.event.ActionEvent evt) {
 
1479
                seeActionPerformed(evt);
 
1480
            }
 
1481
        });
 
1482
 
 
1483
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1484
        gridBagConstraints.gridx = 1;
 
1485
        gridBagConstraints.gridy = 0;
 
1486
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1487
        moreStuffBottom.add(see, gridBagConstraints);
 
1488
 
 
1489
        colorAndPattern.setText("Color and Pattern...");
 
1490
        colorAndPattern.addActionListener(new java.awt.event.ActionListener() {
 
1491
            public void actionPerformed(java.awt.event.ActionEvent evt) {
 
1492
                colorAndPatternActionPerformed(evt);
 
1493
            }
 
1494
        });
 
1495
 
 
1496
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1497
        gridBagConstraints.gridx = 2;
 
1498
        gridBagConstraints.gridy = 0;
 
1499
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1500
        moreStuffBottom.add(colorAndPattern, gridBagConstraints);
 
1501
 
 
1502
        editParameters.setText("Edit Parameters");
 
1503
        editParameters.addActionListener(new java.awt.event.ActionListener() {
 
1504
            public void actionPerformed(java.awt.event.ActionEvent evt) {
 
1505
                editParametersActionPerformed(evt);
 
1506
            }
 
1507
        });
 
1508
 
 
1509
        moreStuffBottom.add(editParameters, new java.awt.GridBagConstraints());
 
1510
 
 
1511
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1512
        gridBagConstraints.gridx = 0;
 
1513
        gridBagConstraints.gridy = 8;
 
1514
        gridBagConstraints.gridwidth = 4;
 
1515
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
 
1516
        gridBagConstraints.weightx = 1.0;
 
1517
        getContentPane().add(moreStuffBottom, gridBagConstraints);
 
1518
 
 
1519
        listPane.setMinimumSize(new java.awt.Dimension(200, 100));
 
1520
        listPane.setPreferredSize(new java.awt.Dimension(200, 100));
 
1521
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1522
        gridBagConstraints.gridx = 0;
 
1523
        gridBagConstraints.gridy = 7;
 
1524
        gridBagConstraints.gridwidth = 4;
 
1525
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
 
1526
        gridBagConstraints.weightx = 1.0;
 
1527
        gridBagConstraints.weighty = 1.0;
 
1528
        gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 4);
 
1529
        getContentPane().add(listPane, gridBagConstraints);
 
1530
 
 
1531
        gridBagConstraints = new java.awt.GridBagConstraints();
 
1532
        gridBagConstraints.gridx = 1;
 
1533
        gridBagConstraints.gridy = 0;
 
1534
        gridBagConstraints.gridwidth = 3;
 
1535
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
 
1536
        gridBagConstraints.weightx = 1.0;
 
1537
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
 
1538
        getContentPane().add(type, gridBagConstraints);
 
1539
 
 
1540
        pack();
 
1541
    }// </editor-fold>//GEN-END:initComponents
 
1542
 
 
1543
    private void busMembersActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_busMembersActionPerformed
 
1544
                showProperList();
 
1545
    }//GEN-LAST:event_busMembersActionPerformed
 
1546
 
 
1547
        private void colorAndPatternActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_colorAndPatternActionPerformed
 
1548
        {//GEN-HEADEREND:event_colorAndPatternActionPerformed
 
1549
                ArtworkLook.showArtworkLookDialog();
 
1550
        }//GEN-LAST:event_colorAndPatternActionPerformed
 
1551
 
 
1552
        private void moreActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_moreActionPerformed
 
1553
        {//GEN-HEADEREND:event_moreActionPerformed
 
1554
                bigger = !bigger;
 
1555
                if (bigger)
 
1556
                {
 
1557
                        GridBagConstraints gridBagConstraints;
 
1558
                        gridBagConstraints = new GridBagConstraints();
 
1559
                        gridBagConstraints.gridx = 0;
 
1560
                        gridBagConstraints.gridy = 6;
 
1561
                        gridBagConstraints.gridwidth = 4;
 
1562
                        gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
 
1563
                        gridBagConstraints.weightx = 1.0;
 
1564
                        getContentPane().add(moreStuffTop, gridBagConstraints);
 
1565
 
 
1566
                        gridBagConstraints = new GridBagConstraints();
 
1567
                        gridBagConstraints.gridx = 0;
 
1568
                        gridBagConstraints.gridy = 7;
 
1569
                        gridBagConstraints.gridwidth = 4;
 
1570
                        gridBagConstraints.fill = GridBagConstraints.BOTH;
 
1571
                        gridBagConstraints.insets = new Insets(0, 4, 4, 4);
 
1572
                        gridBagConstraints.weightx = 1.0;
 
1573
                        gridBagConstraints.weighty = 1.0;
 
1574
                        getContentPane().add(listPane, gridBagConstraints);
 
1575
 
 
1576
                        gridBagConstraints = new GridBagConstraints();
 
1577
                        gridBagConstraints.gridx = 0;
 
1578
                        gridBagConstraints.gridy = 8;
 
1579
                        gridBagConstraints.gridwidth = 4;
 
1580
                        gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
 
1581
                        gridBagConstraints.weightx = 1.0;
 
1582
                        getContentPane().add(moreStuffBottom, gridBagConstraints);
 
1583
 
 
1584
                        more.setText("Less");
 
1585
                } else
 
1586
                {
 
1587
                        getContentPane().remove(moreStuffTop);
 
1588
                        getContentPane().remove(listPane);
 
1589
                        getContentPane().remove(moreStuffBottom);
 
1590
                        more.setText("More");
 
1591
                }
 
1592
                pack();
 
1593
        }//GEN-LAST:event_moreActionPerformed
 
1594
 
 
1595
        private void seeActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_seeActionPerformed
 
1596
        {//GEN-HEADEREND:event_seeActionPerformed
 
1597
                if (!ports.isSelected()) return;
 
1598
                int currentIndex = list.getSelectedIndex();
 
1599
                ArcInst ai = portObjects.get(currentIndex);
 
1600
                if (ai == null) return;
 
1601
                NodeInst ni = shownNode;
 
1602
                if (wnd != null) {
 
1603
                        Highlighter highlighter = wnd.getHighlighter();
 
1604
                        highlighter.clear();
 
1605
                        highlighter.addElectricObject(ni, ni.getParent());
 
1606
                        highlighter.addElectricObject(ai, ai.getParent());
 
1607
                        highlighter.finished();
 
1608
                }
 
1609
        }//GEN-LAST:event_seeActionPerformed
 
1610
 
 
1611
        private void attributesActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_attributesActionPerformed
 
1612
        {//GEN-HEADEREND:event_attributesActionPerformed
 
1613
                showProperList();
 
1614
        }//GEN-LAST:event_attributesActionPerformed
 
1615
 
 
1616
        private void portsActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_portsActionPerformed
 
1617
        {//GEN-HEADEREND:event_portsActionPerformed
 
1618
                showProperList();
 
1619
        }//GEN-LAST:event_portsActionPerformed
 
1620
 
 
1621
        private void applyActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_applyActionPerformed
 
1622
        {//GEN-HEADEREND:event_applyActionPerformed
 
1623
                if (shownNode == null) return;
 
1624
 
 
1625
                double currentXPos = TextUtils.atof(xPos.getText(), new Double(initialXPos));
 
1626
                double currentYPos = TextUtils.atof(yPos.getText(), new Double(initialYPos));
 
1627
                int currentRotation = (int)(TextUtils.atof(rotation.getText(), new Double(initialRotation)) * 10);
 
1628
 
 
1629
                new ChangeNode(shownNode,
 
1630
                        initialXPos, currentXPos, initialYPos, currentYPos,
 
1631
                        initialXSize, xSize.getText(), initialYSize, ySize.getText(),
 
1632
                        mirrorX.isSelected(), mirrorY.isSelected(),
 
1633
                        currentRotation,
 
1634
                        initialPopupIndex, popup.getSelectedIndex(),
 
1635
                        initialEasyToSelect, easyToSelect.isSelected(),
 
1636
                        initialInvisibleOutsideCell, invisibleOutsideCell.isSelected(),
 
1637
                        initialLocked, locked.isSelected(),
 
1638
                        initialExpansion, expanded.isSelected(),
 
1639
                        initialName, name.getText().trim(),
 
1640
                        initialTextField, textField.getText(),
 
1641
                        initialPopupEntry, (String)popup.getSelectedItem(),
 
1642
                        bigger,
 
1643
                        scalableTrans,
 
1644
                        swapXY);
 
1645
                attributesTable.applyChanges();
 
1646
 
 
1647
                initialName = name.getText().trim();
 
1648
                initialExpansion = expanded.isSelected();
 
1649
                initialEasyToSelect = easyToSelect.isSelected();
 
1650
                initialInvisibleOutsideCell = invisibleOutsideCell.isSelected();
 
1651
                initialLocked = locked.isSelected();
 
1652
                initialTextField = textField.getText();
 
1653
                initialPopupEntry = (String)popup.getSelectedItem();
 
1654
                initialXPos = currentXPos;
 
1655
                initialYPos = currentYPos;
 
1656
                initialXSize = xSize.getText();
 
1657
                initialYSize = ySize.getText();
 
1658
                initialMirrorX = mirrorX.isSelected();
 
1659
                initialMirrorY = mirrorY.isSelected();
 
1660
                initialRotation = currentRotation;
 
1661
        }//GEN-LAST:event_applyActionPerformed
 
1662
 
 
1663
        private void okActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_okActionPerformed
 
1664
        {//GEN-HEADEREND:event_okActionPerformed
 
1665
                applyActionPerformed(evt);
 
1666
                closeDialog(null);
 
1667
        }//GEN-LAST:event_okActionPerformed
 
1668
 
 
1669
        private void cancelActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_cancelActionPerformed
 
1670
        {//GEN-HEADEREND:event_cancelActionPerformed
 
1671
                closeDialog(null);
 
1672
        }//GEN-LAST:event_cancelActionPerformed
 
1673
 
 
1674
        private void closeDialog(java.awt.event.WindowEvent evt)//GEN-FIRST:event_closeDialog
 
1675
        {
 
1676
                prefs.putBoolean("GetInfoNode-bigger", bigger);
 
1677
                if (ports.isSelected()) prefs.putInt("GetInfoNode-buttonSelected", 0);
 
1678
                if (attributes.isSelected()) prefs.putInt("GetInfoNode-buttonSelected", 1);
 
1679
                if (busMembers.isSelected()) prefs.putInt("GetInfoNode-buttonSelected", 2);
 
1680
                super.closeDialog();
 
1681
        }//GEN-LAST:event_closeDialog
 
1682
 
 
1683
    private void editParametersActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editParametersActionPerformed
 
1684
                if (shownNode == null) return;
 
1685
                if (!shownNode.isCellInstance()) return;
 
1686
                Cell.CellGroup group = ((Cell)shownNode.getProto()).getCellGroup();
 
1687
                Cell paramOwner = group.getParameterOwner();
 
1688
                if (paramOwner != null) {
 
1689
                        WindowFrame.createEditWindow(paramOwner);
 
1690
                        Attributes.showDialog();
 
1691
                }
 
1692
    }//GEN-LAST:event_editParametersActionPerformed
 
1693
 
 
1694
    // Variables declaration - do not modify//GEN-BEGIN:variables
 
1695
    private javax.swing.JButton apply;
 
1696
    private javax.swing.JRadioButton attributes;
 
1697
    private javax.swing.JRadioButton busMembers;
 
1698
    private javax.swing.JButton cancel;
 
1699
    private javax.swing.JButton colorAndPattern;
 
1700
    private javax.swing.JCheckBox easyToSelect;
 
1701
    private javax.swing.JButton editParameters;
 
1702
    private javax.swing.JRadioButton expanded;
 
1703
    private javax.swing.ButtonGroup expansion;
 
1704
    private javax.swing.JCheckBox invisibleOutsideCell;
 
1705
    private javax.swing.JLabel jLabel1;
 
1706
    private javax.swing.JLabel jLabel3;
 
1707
    private javax.swing.JLabel jLabel6;
 
1708
    private javax.swing.JLabel jLabel7;
 
1709
    private javax.swing.JLabel jLabel8;
 
1710
    private javax.swing.JScrollPane listPane;
 
1711
    private javax.swing.JCheckBox locked;
 
1712
    private javax.swing.JCheckBox mirrorX;
 
1713
    private javax.swing.JCheckBox mirrorY;
 
1714
    private javax.swing.JButton more;
 
1715
    private javax.swing.JPanel moreStuffBottom;
 
1716
    private javax.swing.JPanel moreStuffTop;
 
1717
    private javax.swing.JTextField name;
 
1718
    private javax.swing.JButton ok;
 
1719
    private javax.swing.JComboBox popup;
 
1720
    private javax.swing.JLabel popupLabel;
 
1721
    private javax.swing.JRadioButton ports;
 
1722
    private javax.swing.JTextField rotation;
 
1723
    private javax.swing.JButton see;
 
1724
    private javax.swing.ButtonGroup selection;
 
1725
    private javax.swing.JTextField textField;
 
1726
    private javax.swing.JLabel textFieldLabel;
 
1727
    private javax.swing.JTextField type;
 
1728
    private javax.swing.JRadioButton unexpanded;
 
1729
    private javax.swing.JTextField xPos;
 
1730
    private javax.swing.JTextField xSize;
 
1731
    private javax.swing.JLabel xsizeLabel;
 
1732
    private javax.swing.JTextField yPos;
 
1733
    private javax.swing.JTextField ySize;
 
1734
    private javax.swing.JLabel ysizeLabel;
 
1735
    // End of variables declaration//GEN-END:variables
 
1736
}