📄 user.java
字号:
/** * Method to accumulate the area of a window that has changed and needs redisplay. * @param wnd the EditWindow in question. * @param changedArea the area (in database coordinates) that has changed in the window. */// private static void setChangedInWindow(EditWindow wnd, Rectangle2D changedArea)// {//// Rectangle2D lastChanged = changedWindowRects.get(wnd);//// if (lastChanged == null) changedWindowRects.put(wnd, changedArea); else//// {//// Rectangle2D.union(lastChanged, changedArea, lastChanged);//// }// }// /**// * Method to recurse flag all windows showing a cell to redraw.// * @param cell the Cell that changed.// * @param cellChanged true if the cell changed and should be marked so.// */// public static void markCellForRedraw(Cell cell, boolean cellChanged)// {// HashSet<Cell> marked = new HashSet<Cell>();// markCellForRedrawRecursively(cell, marked);// if (cellChanged)// {//// VectorDrawing.cellChanged(cell);// EditWindow.forceRedraw(cell);// // recurse up the hierarchy so that all windows showing the cell get redrawn// for(Iterator<NodeInst> it = cell.getInstancesOf(); it.hasNext(); ) {// NodeInst ni = it.next();// markCellForRedrawRecursively(ni.getParent(), marked);// }// }//// for(Iterator<WindowFrame> wit = WindowFrame.getWindows(); wit.hasNext(); )// {// WindowFrame wf = wit.next();// WindowContent content = wf.getContent();// if (!(content instanceof EditWindow)) continue;// Cell winCell = content.getCell();// if (marked.contains(winCell))// {// EditWindow wnd = (EditWindow)content;// wnd.fullRepaint();// }// }// }//// private static void markCellForRedrawRecursively(Cell cell, HashSet<Cell> marked) {// if (marked.contains(cell)) return;// marked.add(cell);// // recurse up the hierarchy so that all windows showing the cell get redrawn// for(Iterator<NodeInst> it = cell.getInstancesOf(); it.hasNext(); )// {// NodeInst ni = it.next();// if (ni.isExpanded())// markCellForRedrawRecursively(ni.getParent(), marked);// }// } /** * Method called when a technology's parameters change. * All cells that use the technology must be recached. */ public static void technologyChanged() { VectorCache.theCache.clearCache(); EditWindow.clearSubCellCache(); } /** * Method called when visible layers have changed. * Removes all "greeked images" from cached cells. */ public static void layerVisibilityChanged(boolean onlyText) { if (!onlyText) VectorCache.theCache.clearFadeImages(); EditWindow.clearSubCellCache(); EditWindow.repaintAllContents(); } /****************************** MISCELLANEOUS FUNCTIONS ******************************/ /** * Method to return the "current" NodeProto, as maintained by the user interface. * @return the "current" NodeProto, as maintained by the user interface. */ public NodeProto getCurrentNodeProto() { return currentNodeProto; } /** * Method to set the "current" NodeProto, as maintained by the user interface. * @param np the new "current" NodeProto. */ public void setCurrentNodeProto(NodeProto np) { currentNodeProto = np; } /** * Method to return the "current" ArcProto, as maintained by the user interface. * The current ArcProto is highlighted with a bolder red border in the component menu on the left. * @return the "current" ArcProto, as maintained by the user interface. */ public ArcProto getCurrentArcProto() { return currentArcProto; } /** * Method to set the "current" ArcProto, as maintained by the user interface. * The current ArcProto is highlighted with a bolder red border in the component menu on the left. * @param ap the new "current" ArcProto. */ public void setCurrentArcProto(ArcProto ap) { currentArcProto = ap; WindowFrame wf = WindowFrame.getCurrentWindowFrame(false); if (wf != null) wf.getPaletteTab().arcProtoChanged(); } private static AudioClip clickSound = null; private static boolean hasSound = true; public static void playSound() { if (!hasSound) return; if (!isPlayClickSoundsWhenCreatingArcs()) return; if (clickSound == null) { // first time: see if there is a sound card try { hasSound = javax.sound.sampled.AudioSystem.getMixerInfo().length > 0; if (!hasSound) return; } catch (Throwable t) { hasSound = false; return; } // initialize the click sound URL url = Resources.getURLResource(TopLevel.class, "Click.wav"); if (url == null) { hasSound = false; return; } clickSound = Applet.newAudioClip(url); } // play the sound clickSound.play(); } /** * Method to switch libraries and handle technology editing details. */ public static void setCurrentLibrary(Library lib) { lib.setCurrent(); // if switching to a technology library, load its colormap into the Artwork technology Cell techLibFactors = null; for(Iterator<Cell> it = lib.getCells(); it.hasNext(); ) { Cell cell = it.next(); if (cell.isInTechnologyLibrary() && cell.getName().equals("factors")) { techLibFactors = cell; break; } } if (techLibFactors != null) { for(Iterator<NodeInst> it = techLibFactors.getNodes(); it.hasNext(); ) { NodeInst ni = it.next(); Color [] colors = GeneralInfo.getTransparentColors(ni); if (colors == null) continue; if (colors != null) { Color [] map = Technology.getColorMap(colors, colors.length); Artwork.tech().setColorMap(map); Artwork.tech().setNumTransparentLayers(colors.length); break; } } } } /****************************** PROJECT SETTINGS *****************************************/ /** * Method to get default technique in Tech Palette. * The default is "mocmos". * @return the default technology to use in Tech Palette */ public static String getDefaultTechnology() { return tool.cacheDefaultTechnology.getString(); } /** * Returns project Setting to tell default technique in Tech Palette. * @return project Setting to tell default technique in Tech Palette. */ public static Setting getDefaultTechnologySetting() { return tool.cacheDefaultTechnology; } /** * Method to choose the layout Technology to use when schematics are found. * This is important in Spice deck generation (for example) because the Spice primitives may * say "2x3" on them, but a real technology (such as "mocmos") must be found to convert these pure * numbers to real spacings for the deck. * The default is the MOSIS CMOS technology. * @return the Technology to use when schematics are found. */ public static Technology getSchematicTechnology() { String t = tool.cacheSchematicTechnology.getString(); Technology tech = Technology.findTechnology(t); if (tech == null) return Technology.getMocmosTechnology(); return tech; } /** * Returns project Setting to tell the layout Technology to use when schematics are found. * This is important in Spice deck generation (for example) because the Spice primitives may * say "2x3" on them, but a real technology (such as "mocmos") must be found to convert these pure * numbers to real spacings for the deck. * @return project Setting to tell the Technology to use when schematics are found. */ public static Setting getSchematicTechnologySetting() { return tool.cacheSchematicTechnology; } /** * Method to tell whether to include the date and Electric version in output files. * The default is "true". * @return true if the system should include the date and Electric version in output files. */ public static boolean isIncludeDateAndVersionInOutput() { return tool.cacheIncludeDateAndVersionInOutput.getBoolean(); } /** * Returns project Setting to tell whether to include the date and Electric version in output files. * @return project Setting to tell whether to include the date and Electric version in output files. */ public static Setting getIncludeDateAndVersionInOutputSetting() { return tool.cacheIncludeDateAndVersionInOutput; } private Setting cacheDefaultTechnology; private Setting cacheSchematicTechnology; private Setting cacheIncludeDateAndVersionInOutput; private Setting cachePWellProcess; /** * Method to tell whether the process is a PWell process. If true, it will ignore the pwell spacing rule. * The default is "true". * @return true if the process is PWell */ public static Setting getPWellProcessLayoutTechnologySetting() {return tool.cachePWellProcess;} public static boolean isPWellProcessLayoutTechnology() {return getPWellProcessLayoutTechnologySetting().getBoolean();}// public static void setPWellProcessLayoutTechnology(boolean on) {getPWellProcessLayoutTechnologySetting().set(Boolean.valueOf(on));} @Override protected void initProjectSettings() { makeStringSetting("DefaultTechnology", "Technology tab", "Default Technology for editing", "mocmos"); makeStringSetting("SchematicTechnology", "Technology tab", "Schematics use scale values from this technology", "mocmos"); makeBooleanSetting("IncludeDateAndVersionInOutput", "Netlists tab", "Include date and version in output", true); makeBooleanSetting("PWellProcess", "Technology tab", "Define Layout Technology as a PWell process", true); } /****************************** ICON GENERATION PREFERENCES ******************************/ private static Pref cacheIconGenDrawLeads = Pref.makeBooleanPref("IconGenDrawLeads", tool.prefs, true); /** * Method to tell whether generated icons should have leads drawn. * The default is "true". * @return true if generated icons should have leads drawn. */ public static boolean isIconGenDrawLeads() { return cacheIconGenDrawLeads.getBoolean(); } /** * Method to set whether generated icons should have leads drawn. * @param on true if generated icons should have leads drawn. */ public static void setIconGenDrawLeads(boolean on) { cacheIconGenDrawLeads.setBoolean(on); } /** * Method to tell whether generated icons should have leads drawn by default. * @return true if generated icons should have leads drawn by default. */ public static boolean isFactoryIconGenDrawLeads() { return cacheIconGenDrawLeads.getBooleanFactoryValue(); } private static Pref cacheIconsAlwaysDrawn = Pref.makeBooleanPref("IconsAlwaysDrawn", tool.prefs, false); /** * Method to tell whether generated icon exports should be "always drawn". * Exports that are "always drawn" have their text shown on instances, even * when those exports are connected or further exported. * The default is "false". * @return true if generated icon exports should be "always drawn". */ public static boolean isIconsAlwaysDrawn() { return cacheIconsAlwaysDrawn.getBoolean(); } /** * Method to set whether generated icon exports should be "always drawn". * Exports that are "always drawn" have their text shown on instances, even * when those exports are connected or further exported. * @param on true if generated icon exports should be "always drawn". */ public static void setIconsAlwaysDrawn(boolean on) { cacheIconsAlwaysDrawn.setBoolean(on); } /** * Method to tell whether generated icon exports should be "always drawn" by default. * Exports that are "always drawn" have their text shown on instances, even * when those exports are connected or further exported. * @return true if generated icon exports should be "always drawn" by default. */ public static boolean isFactoryIconsAlwaysDrawn() { return cacheIconsAlwaysDrawn.getBooleanFactoryValue(); } private static Pref cacheIconGenDrawBody = Pref.makeBooleanPref("IconGenDrawBody", tool.prefs, true); /** * Method to tell whether generated icons should have a body drawn. * The body is just a rectangle. * The default is "true". * @return true if generated icons should have a body drawn. */ public static boolean isIconGenDrawBody() { return cacheIconGenDrawBody.getBoolean(); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -