📄 editmenu.java
字号:
if (fileName != null) // didn't press cancel button { xmlTech.writeXml(fileName); } }}, new EMenuItem("Write XML of Technology from Old Electric Build...") { public void run() { writeXmlTechnologyFromElectricBuildCommand(); }}, SEPARATOR,// new EMenuItem("Rename Current Technology...") { public void run() {// CircuitChanges.renameCurrentTechnology(); }},// SEPARATOR, // mnemonic keys available: B DEFG IJKLM O Q TUV XYZ new EMenu("_FPGA", new EMenuItem("Read _Architecture And Primitives...") { public void run() { FPGA.tech().readArchitectureFile(true); }}, new EMenuItem("Read P_rimitives...") { public void run() { FPGA.tech().readArchitectureFile(false); }}, SEPARATOR, new EMenuItem("Edit _Pips...") { public void run() { FPGA.tech().programPips(); }}, SEPARATOR, new EMenuItem("Show _No Wires") { public void run() { FPGA.tech().setWireDisplay(0); }}, new EMenuItem("Show A_ctive Wires") { public void run() { FPGA.tech().setWireDisplay(1); }}, new EMenuItem("Show All _Wires") { public void run() { FPGA.tech().setWireDisplay(2); }}, SEPARATOR, new EMenuItem("_Show Text") { public void run() { FPGA.tech().setTextDisplay(true); }}, new EMenuItem("_Hide Text") { public void run() { FPGA.tech().setTextDisplay(false); }})), // mnemonic keys available: AB EFGH JK MNO QRS UV XYZ new EMenu("Technolo_gy Editing", new EMenuItem("Convert Technology to _Library for Editing...") { public void run() { TechToLib.makeLibFromTech(); }}, new EMenuItem("Convert Library to _Technology...") { public void run() { LibToTech.makeTechFromLib(); }}, SEPARATOR, new EMenuItem("_Identify Primitive Layers") { public void run() { Manipulate.identifyLayers(false); }}, new EMenuItem("Identify _Ports") { public void run() { Manipulate.identifyLayers(true); }}, SEPARATOR, new EMenuItem("Edit Library _Dependencies...") { public void run() { Manipulate.editLibraryDependencies(); }}, new EMenuItem("Edit _Component Menu...") { public void run() { Manipulate.editComponentMenu(); }}, SEPARATOR, new EMenuItem("Technology Creation _Wizard...") { public void run() { TechEditWizard.techEditWizardCommand(); }}), // mnemonic keys available: B F K M Q Z new EMenu("_Selection", new EMenuItem("Sele_ct All", 'A') { public void run() { selectAllCommand(); }}, new EMenuItem("Select All _Easy") { public void run() { selectEasyCommand(); }}, new EMenuItem("Select All _Hard") { public void run() { selectHardCommand(); }}, new EMenuItem("Select Nothin_g") { public void run() { selectNothingCommand(); }}, SEPARATOR, new EMenuItem("Select All Like _This") { public void run() { selectAllLikeThisCommand(); }}, new EMenuItem("Select _Next Like This" /*, '\t', KeyEvent.VK_TAB */) { public void run() { selectNextLikeThisCommand(true); }}, new EMenuItem("Select _Previous Like This") { public void run() { selectNextLikeThisCommand(false); }}, SEPARATOR, new EMenuItem("_Select Object...") { public void run() { SelectObject.selectObjectDialog(null, false); }}, new EMenuItem("Deselect All _Arcs") { public void run() { deselectAllArcsCommand(); }}, SEPARATOR, new EMenuItem("Make Selected Eas_y") { public void run() { selectMakeEasyCommand(); }}, new EMenuItem("Make Selected Har_d") { public void run() { selectMakeHardCommand(); }}, SEPARATOR, new EMenuItem("P_ush Selection") { public void run() { EditWindow wnd = EditWindow.getCurrent(); if (wnd == null) return; wnd.getHighlighter().pushHighlight(); }}, new EMenuItem("P_op Selection") { public void run() { EditWindow wnd = EditWindow.getCurrent(); if (wnd ==null) return; wnd.getHighlighter().popHighlight(); }}, SEPARATOR, new EMenuItem("Enclosed Ob_jects") { public void run() { selectEnclosedObjectsCommand(); }}, SEPARATOR, new EMenuItem("Show Ne_xt Error", KeyStroke.getKeyStroke('>')) { public void run() { showNextErrorCommand(); }}, new EMenuItem("Show Pre_vious Error", KeyStroke.getKeyStroke('<')) { public void run() { showPrevErrorCommand(); }}, new EMenuItem("Show Current Co_llection of Errors") { public void run() { ErrorLoggerTree.showCurrentErrors(); }}, SEPARATOR, new EMenuItem("Add to Waveform _in New Panel", KeyStroke.getKeyStroke('A', 0)) { public void run() { addToWaveformNewCommand(); }}, new EMenuItem("Add to _Waveform in Current Panel", KeyStroke.getKeyStroke('O', 0)) { public void run() { addToWaveformCurrentCommand(); }}, new EMenuItem("_Remove from Waveform", KeyStroke.getKeyStroke('R', 0)) { public void run() { removeFromWaveformCommand(); }})); } /** * This method implements the command to show the Key Bindings Options dialog. */ public static void keyBindingsCommand() { // edit key bindings for current menu TopLevel top = TopLevel.getCurrentJFrame(); EditKeyBindings dialog = new EditKeyBindings(top.getEMenuBar(), top, true); dialog.setVisible(true); } /** * This method shows the GetInfo dialog for the highlighted nodes, arcs, and/or text. */ public static void getInfoCommand(boolean doubleClick) { EditWindow wnd = EditWindow.getCurrent(); if (wnd == null) return; if (wnd.getHighlighter().getNumHighlights() == 0) { System.out.println("Must select an object first"); } else { int [] counts = new int[5]; NodeInst theNode = Highlight2.getInfoCommand(wnd.getHighlighter().getHighlights(), counts); // information about the selected items int arcCount = counts[0]; int nodeCount = counts[1]; int exportCount = counts[2]; int textCount = counts[3]; int graphicsCount = counts[4]; // special dialogs for double-clicking on known nodes if (doubleClick) { // if double-clicked on a technology editing object, modify it if (arcCount == 0 && exportCount == 0 && graphicsCount == 0 && (nodeCount == 1 ^ textCount == 1) && theNode != null) { int opt = Manipulate.getOptionOnNode(theNode); if (opt >= 0) { Manipulate.modifyObject(wnd, theNode, opt); return; } } if (arcCount == 0 && exportCount == 0 && graphicsCount == 0 && nodeCount == 1 && textCount == 0 && theNode != null) { int ret = SpecialProperties.doubleClickOnNode(wnd, theNode); if (ret > 0) return; if (ret < 0) doubleClick = false; } } if (arcCount <= 1 && nodeCount <= 1 && exportCount <= 1 && textCount <= 1 && graphicsCount == 0) { if (arcCount == 1) GetInfoArc.showDialog(); if (nodeCount == 1) { // if in outline-edit mode, show that dialog if (WindowFrame.getListener() == OutlineListener.theOne) { GetInfoOutline.showOutlinePropertiesDialog(); } else { GetInfoNode.showDialog(); } } if (exportCount == 1) { if (doubleClick) { GetInfoText.editTextInPlace(); } else { GetInfoExport.showDialog(); } } if (textCount == 1) { if (doubleClick) { GetInfoText.editTextInPlace(); } else { GetInfoText.showDialog(); } } } else { GetInfoMulti.showDialog(); } } }// /**// * Method to move selected object(s). If either scaleMove or scaleMove2// * is true, the move is multiplied by the grid Bold frequency. If both are// * true the move gets multiplied twice.// * @param dX amount to move in X in lambda// * @param dY amount to move in Y in lambda// * @param scaleMove scales move up if true// * @param scaleMove2 scales move up if true (stacks with scaleMove)// */// private static void moveSelected(double dX, double dY, boolean scaleMove, boolean scaleMove2)// {// // scale distance according to arrow motion// EditWindow wnd = EditWindow.getCurrent();// if (wnd == null) return;// Highlighter highlighter = wnd.getHighlighter();// double arrowDistance = User.getAlignmentToGrid();// dX *= arrowDistance;// dY *= arrowDistance;// int scaleX = User.getDefGridXBoldFrequency();// int scaleY = User.getDefGridYBoldFrequency();// if (scaleMove) { dX *= scaleX; dY *= scaleY; }// if (scaleMove2) { dX *= scaleX; dY *= scaleY; }// highlighter.setHighlightOffset(0, 0);// if (wnd.isInPlaceEdit())// {// Point2D delta = new Point2D.Double(dX, dY);// AffineTransform trans = wnd.getInPlaceTransformIn();// double m00 = trans.getScaleX();// double m01 = trans.getShearX();// double m10 = trans.getShearY();// double m11 = trans.getScaleY();// AffineTransform justRot = new AffineTransform(m00, m10, m01, m11, 0, 0);// justRot.transform(delta, delta);// dX = delta.getX();// dY = delta.getY();// }// CircuitChanges.manyMove(dX, dY);// wnd.fullRepaint();// } /** * Method to handle the "See All Parameters on Node" command. */ public static void seeAllParametersCommand() { new ParameterVisibility(0, MenuCommands.getSelectedObjects(true, false)); } /** * Method to handle the "Hide All Parameters on Node" command. */ public static void hideAllParametersCommand() { new ParameterVisibility(1, MenuCommands.getSelectedObjects(true, false)); } /** * Method to handle the "Default Parameter Visibility" command. */ public static void defaultParamVisibilityCommand() { new ParameterVisibility(2, MenuCommands.getSelectedObjects(true, false)); } /** * Class to do change parameter visibility in a new thread. */ private static class ParameterVisibility extends Job { private int how; private List<Geometric> selected; protected ParameterVisibility(int how, List<Geometric> selected) { super("Change Parameter Visibility", User.getUserTool(), Job.Type.CHANGE, null, null, Job.Priority.USER); this.how = how; this.selected = selected; startJob(); } public boolean doIt() throws JobException { // change visibility of parameters on the current node(s) int changeCount = 0; List<Geometric> list = selected; for(Geometric geom : list) { NodeInst ni = (NodeInst)geom; if (!ni.isCellInstance()) continue; boolean changed = false; for(Iterator<Variable> vIt = ni.getParameters(); vIt.hasNext(); ) { Variable var = vIt.next(); Variable nVar = ((Cell)ni.getProto()).getParameter(var.getKey()); switch (how) { case 0: // make all parameters visible if (var.isDisplay()) continue; ni.addParameter(var.withDisplay(true)); changed = true; break; case 1: // make all parameters invisible if (!var.isDisplay()) continue; ni.addParameter(var.withTextDescriptor(var.getTextDescriptor().withDisplay(TextDescriptor.Display.HIDDEN))); changed = true; break; case 2: // make all parameters have default visiblity if (nVar.getTextDescriptor().isInterior()) { // prototype wants parameter to be invisible if (!var.isDisplay()) continue; ni.addParameter(var.withDisplay(false)); changed = true; } else { // prototype wants parameter to be visible if (var.isDisplay()) continue; ni.addParameter(var.withDisplay(true)); changed = true; } break; } } if (changed) { changeCount++; } } if (changeCount == 0) System.out.println("No Parameter visibility changed"); else System.out.println("Changed visibility on " + changeCount + " nodes"); return true; } } public static void updateParameters(boolean allLibraries) { // get currently selected node(s) List<Geometric> highlighted = MenuCommands.getSelectedObjects(true, false); new UpdateParameters(highlighted, allLibraries); } private static class UpdateParameters extends Job { private List<Geometric> highlighted; private boolean allLibraries; /** * Update Parameters. * @param highlighted currently highlighted objects * @param allLibraries if true, update all nodeinsts in all libraries, otherwise update highlighted */ UpdateParameters(List<Geometric> highlighted, boolean allLibraries) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -