📄 layerstab.java
字号:
Layer oLayer = it.next(); if (oLayer == layer) continue; ColorPatternPanel.Info oLi = layerMap.get(oLayer); if (oLi != null && oLi.transparentLayer == li.transparentLayer) { if (otherLayers == null) otherLayers = oLayer.getName(); else otherLayers += ", " + oLayer.getName(); } } } colorAndPatternPanel.setOtherTransparentLayerNames(otherLayers); } /** * Method called when the "OK" panel is hit. * Updates any changed fields in the Layers tab. */ public void term() { boolean changed = false; for(Iterator<Technology> it = Technology.getTechnologies(); it.hasNext(); ) { Technology tech = it.next(); for(Iterator<Layer> lIt = tech.getLayers(); lIt.hasNext(); ) { Layer layer = lIt.next(); ColorPatternPanel.Info li = layerMap.get(layer); EGraphics graphics = layer.getGraphics(); if (layer.isPseudoLayer()) { ColorPatternPanel.Info altLI = layerMap.get(layer.getNonPseudoLayer()); if (altLI != null) li = altLI; } if (li.updateGraphics(graphics)) changed = true; } // determine the original colors for this technology Color [] fullOrigMap = tech.getColorMap(); Color [] origMap = new Color[tech.getNumTransparentLayers()]; for(int i=0; i<origMap.length; i++) origMap[i] = fullOrigMap[1<<i]; // see if any colors changed boolean mapChanged = false; Color [] map = colorMapMap.get(tech); for(int i=0; i<map.length; i++) if (map[i].getRGB() != origMap[i].getRGB()) mapChanged = true; if (mapChanged) tech.setColorMapFromLayers(map); } // also get any changes to special layers for (User.ColorPrefType type : User.ColorPrefType.values()) { int c = specialMapColor(nameTypeSpecialMap.get(type), User.getColor(type)); if (c >= 0) { User.setColor(type, c); changed = true; } } // 3D Stuff try { Class<?> j3DUtilsClass = Resources.get3DClass("utils.J3DUtils"); Method setMethod = j3DUtilsClass.getDeclaredMethod("set3DColorsInTab", new Class[] {LayersTab.class}); Object color3DChanged = setMethod.invoke(j3DUtilsClass, new Object[]{this}); if (!changed && color3DChanged != null) { changed = ((Boolean)color3DChanged).booleanValue(); } } catch (Exception e) { System.out.println("Cannot call 3D plugin method set3DColorsInTab: " + e.getMessage()); e.printStackTrace(); } // redisplay if changes were made if (changed) { WindowFrame.repaintAllWindows(); } } /** * Method called when the factory reset is requested for just this panel. * @return true if the panel can be reset "in place" without redisplay. */ public boolean resetThis() { for(Layer layer : layerMap.keySet()) { ColorPatternPanel.Info cpi = layerMap.get(layer); resetColorPanelInfo(cpi); } // Special layers for(ColorPatternPanel.Info cpi: transAndSpecialMap.values()) { resetColorPanelInfo(cpi); } for(Iterator<Technology> it = Technology.getTechnologies(); it.hasNext(); ) { Technology tech = it.next(); Color [] map = new Color[tech.getNumTransparentLayers()]; Color [] fullMap = tech.getFactoryColorMap(); for(int i=0; i<map.length; i++) map[i] = fullMap[1<<i]; colorMapMap.put(tech, map); } colorAndPatternPanel.setColorPattern(null); setTechnology(); return true; } /** * Method called when the factory reset is requested. */ public void reset() { for(Iterator<Technology> it = Technology.getTechnologies(); it.hasNext(); ) { Technology tech = it.next(); // reload color map for technology if necessary Color [] transColorsFactory = tech.getFactoryTransparentLayerColors(); Color [] transColors = tech.getTransparentLayerColors(); boolean reload = transColorsFactory.length != transColors.length; if (!reload) { for(int i=0; i<transColors.length; i++) if (transColorsFactory[i].getRGB() != transColors[i].getRGB()) reload = true; } if (reload) tech.setColorMapFromLayers(transColorsFactory); // reload individual layer graphics for(Iterator<Layer> lIt = tech.getLayers(); lIt.hasNext(); ) { Layer layer = lIt.next(); if (layer.isPseudoLayer() && layer.getNonPseudoLayer() != layer) continue; layer.factoryResetGraphics(); } } // Special layers for (User.ColorPrefType type : nameTypeSpecialMap.keySet()) { String name = nameTypeSpecialMap.get(type); ColorPatternPanel.Info cpi = transAndSpecialMap.get(name); int factory = cpi.theColor.getIntFactoryValue(); if (factory != cpi.theColor.getInt()) { cpi.theColor.setInt(factory); User.setColor(type, factory); } } } public int specialMapColor(String title, int curColor) { ColorPatternPanel.Info li = transAndSpecialMap.get(title); if (li == null) return -1; int newColor = (li.red << 16) | (li.green << 8) | li.blue; if (newColor != curColor) return newColor; return -1; } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; layers = new javax.swing.JPanel(); layerName = new javax.swing.JComboBox(); layerTechName = new javax.swing.JLabel(); technology = new javax.swing.JComboBox(); layerTechName1 = new javax.swing.JLabel(); getContentPane().setLayout(new java.awt.GridBagLayout()); setTitle("Edit Options"); setName(""); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); layers.setLayout(new java.awt.GridBagLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 0.5; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); layers.add(layerName, gridBagConstraints); layerTechName.setText("Layer:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); layers.add(layerTechName, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 0.5; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); layers.add(technology, gridBagConstraints); layerTechName1.setText("Technology:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); layers.add(layerTechName1, gridBagConstraints); getContentPane().add(layers, new java.awt.GridBagConstraints()); pack(); }// </editor-fold>//GEN-END:initComponents /** Closes the dialog */ private void closeDialog(java.awt.event.WindowEvent evt)//GEN-FIRST:event_closeDialog { setVisible(false); dispose(); }//GEN-LAST:event_closeDialog // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JComboBox layerName; private javax.swing.JLabel layerTechName; private javax.swing.JLabel layerTechName1; private javax.swing.JPanel layers; private javax.swing.JComboBox technology; // End of variables declaration//GEN-END:variables}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -