Normand Briere
2019-08-17 5892f05411c3d4dce2d8a59e0966dc2e1843a971
Fix L&F nimbus too slow.
7 files modified
1 files added
146 ■■■■ changed files
Checker.java 5 ●●●● patch | view | raw | blame | history
Composite.java 1 ●●●● patch | view | raw | blame | history
Grafreed.java 51 ●●●●● patch | view | raw | blame | history
GroupEditor.java 4 ●●●● patch | view | raw | blame | history
ObjEditor.java 81 ●●●●● patch | view | raw | blame | history
cButton.java 2 ●●● patch | view | raw | blame | history
cToggleButton.java 2 ●●● patch | view | raw | blame | history
icons/white-sphere-icon.png patch | view | raw | blame | history
Checker.java
....@@ -11,10 +11,13 @@
1111
1212 material = new cMaterial();
1313
14
- material.ambient = 100;
14
+ material.ambient = 1;
1515 material.specular = 0.001f;
1616 material.diffuse = 0.01f;
1717 material.cameralight = 0.001f;
18
+ material.opacity = 0.5f;
19
+
20
+ flipV = true;
1821 }
1922
2023 Object3D deepCopy()
Composite.java
....@@ -401,7 +401,6 @@
401401 {
402402 child = (Object3D) e.nextElement();
403403 }
404
-
405404 }
406405
407406 void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root)
Grafreed.java
....@@ -5,6 +5,7 @@
55
66 import java.io.*;
77
8
+import java.util.ArrayList;
89 import javax.swing.UIManager;
910 import javax.swing.plaf.metal.MetalLookAndFeel;
1011 import javax.swing.plaf.ColorUIResource;
....@@ -15,7 +16,7 @@
1516 //import com.jamonapi.*;
1617 public class Grafreed extends Applet implements ActionListener
1718 {
18
- static boolean NIMBUSLAF = true;
19
+ static boolean NIMBUSLAF = false; // true;
1920
2021 static int RENDERME = 0;
2122
....@@ -898,6 +899,13 @@
898899 //UIManager.setLookAndFeel("com.apple.laf.AquaLookAndFeel");
899900 //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
900901 //UIManager.put("nimbusBase", new Color(0,0,0));
902
+
903
+ javax.swing.UIDefaults ui = UIManager.getDefaults();
904
+ for (java.util.Enumeration e = ui.keys(); e.hasMoreElements();)
905
+ {
906
+ Object key = e.nextElement();
907
+ System.out.println(key + " --> " + ui.get(key));
908
+ }
901909 }
902910 catch (Exception e)
903911 {
....@@ -907,12 +915,49 @@
907915 {
908916 try
909917 {
910
- MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
911
- MetalLookAndFeel.setCurrentTheme(new Theme(Constants.yellowTheme));
918
+ //Object o = UIManager.getInstalledLookAndFeels();
919
+
920
+ MetalLookAndFeel.setCurrentTheme(new javax.swing.plaf.metal.DefaultMetalTheme());
921
+ //MetalLookAndFeel.setCurrentTheme(new Theme(Constants.yellowTheme));
922
+ //UIManager.put("ScrollBar.background", new javax.swing.plaf.ColorUIResource(100,0,0));
912923 UIManager.setLookAndFeel(new MetalLookAndFeel());
913924 //UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
914925 //UIManager.setLookAndFeel("com.apple.laf.AquaLookAndFeel");
926
+ //UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
915927 //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
928
+
929
+ javax.swing.UIDefaults ui = UIManager.getDefaults();
930
+ ArrayList gradient = new java.util.ArrayList(5);
931
+ gradient.add(1.0);
932
+ gradient.add(0.0);
933
+ gradient.add(new javax.swing.plaf.ColorUIResource(255,255,255));
934
+ gradient.add(new javax.swing.plaf.ColorUIResource(192,192,192));
935
+ gradient.add(new javax.swing.plaf.ColorUIResource(0,0,0));
936
+
937
+ ui.put("Button.gradient", gradient);
938
+ ui.put("TabbedPane.tabInsets", new javax.swing.plaf.InsetsUIResource(0,8,0,0));
939
+ ui.put("Slider.foreground", new javax.swing.plaf.ColorUIResource(0,0,0));
940
+ ui.put("Slider.horizontalThumbIcon", ObjEditor.GetIcon("icons/white-sphere-icon.png"));
941
+
942
+ //javax.swing.plaf.metal.MetalIconFactory.getHorizontalSliderThumbIcon().
943
+ Object o = ui.get("Slider.horizontalThumbIcon");
944
+
945
+ gradient = new java.util.ArrayList(5);
946
+ gradient.add(1.0);
947
+ gradient.add(0.0);
948
+ gradient.add(new javax.swing.plaf.ColorUIResource(192,192,192));
949
+ gradient.add(new javax.swing.plaf.ColorUIResource(255,255,255));
950
+ gradient.add(new javax.swing.plaf.ColorUIResource(0,0,0));
951
+
952
+ ui.put("ToggleButton.gradient", gradient);
953
+ //ui.put("Button[MouseOver].backgroundPainter", new com.sun.java.swing.plaf.nimbus.ButtonPainter());
954
+ //ui.put("Button.highlight", new javax.swing.plaf.ColorUIResource(155,155,155));
955
+
956
+ for (java.util.Enumeration e = ui.keys(); e.hasMoreElements();)
957
+ {
958
+ Object key = e.nextElement();
959
+ //System.out.println(key + " --> " + ui.get(key));
960
+ }
916961 } catch (Exception e)
917962 {
918963 }
GroupEditor.java
....@@ -1040,7 +1040,7 @@
10401040 */
10411041 cGridBag copyOptionsPanel = new cGridBag();
10421042
1043
- copyOptionsPanel.preferredHeight = 2;
1043
+ copyOptionsPanel.preferredHeight = 3;
10441044
10451045 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10461046
....@@ -1323,7 +1323,7 @@
13231323 oe.treePanel.Return();
13241324 cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
13251325 versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1326
- sliderPane.preferredHeight = 1;
1326
+ sliderPane.preferredHeight = 2;
13271327
13281328 // mainPanel.setDividerLocation(0.1); //1.0);
13291329 mainPanel.setResizeWeight(0.4);
ObjEditor.java
....@@ -106,7 +106,7 @@
106106
107107 static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>();
108108
109
- ImageIcon GetIcon(String name)
109
+ static ImageIcon GetIcon(String name)
110110 {
111111 javax.swing.ImageIcon iconCache = icons.get(name);
112112 if (iconCache != null)
....@@ -116,7 +116,7 @@
116116
117117 try
118118 {
119
- BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
119
+ BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name));
120120
121121 // if (image.getWidth() > 48 && image.getHeight() > 48)
122122 // {
....@@ -1715,7 +1715,7 @@
17151715 scrollpane.addMouseWheelListener(this); // Default not fast enough
17161716
17171717 /*JTabbedPane*/ scenePanel = new cGridBag();
1718
- scenePanel.preferredWidth = 5;
1718
+ scenePanel.preferredWidth = 6;
17191719
17201720 JTabbedPane tabbedPane = new JTabbedPane();
17211721 tabbedPane.add(scrollpane);
....@@ -4738,6 +4738,12 @@
47384738 // else
47394739 // applySelf(true);
47404740 // }
4741
+
4742
+ boolean Equal(double a, double b)
4743
+ {
4744
+ return Math.abs(a - b) < 0.001;
4745
+ }
4746
+
47414747 void applySelf0(boolean name)
47424748 {
47434749 if (name)
....@@ -4787,29 +4793,52 @@
47874793 {
47884794 cMaterial mat = copy.material;
47894795
4790
- colorField.SetToolTipValue((mat.color));
4791
- saturationField.SetToolTipValue((mat.modulation));
4792
- metalnessField.SetToolTipValue((mat.metalness));
4793
- diffuseField.SetToolTipValue((mat.diffuse));
4794
- specularField.SetToolTipValue((mat.specular));
4795
- shininessField.SetToolTipValue((mat.shininess));
4796
- shiftField.SetToolTipValue((mat.shift));
4797
- ambientField.SetToolTipValue((mat.ambient));
4798
- lightareaField.SetToolTipValue((mat.lightarea));
4799
- diffusenessField.SetToolTipValue((mat.factor));
4800
- velvetField.SetToolTipValue((mat.velvet));
4801
- sheenField.SetToolTipValue((mat.sheen));
4802
- subsurfaceField.SetToolTipValue((mat.subsurface));
4803
- backlitField.SetToolTipValue((mat.bump));
4804
- anisoField.SetToolTipValue((mat.aniso));
4805
- anisoVField.SetToolTipValue((mat.anisoV));
4806
- cameraField.SetToolTipValue((mat.cameralight));
4807
- selfshadowField.SetToolTipValue((mat.diffuseness));
4808
- shadowField.SetToolTipValue((mat.shadow));
4809
- textureField.SetToolTipValue((mat.texture));
4810
- opacityField.SetToolTipValue((mat.opacity));
4811
- fakedepthField.SetToolTipValue((mat.fakedepth));
4812
- shadowbiasField.SetToolTipValue((mat.shadowbias));
4796
+ if (!Equal(colorField.getFloat(), mat.color))
4797
+ colorField.SetToolTipValue((mat.color));
4798
+ if (!Equal(saturationField.getFloat(), mat.modulation))
4799
+ saturationField.SetToolTipValue((mat.modulation));
4800
+ if (!Equal(metalnessField.getFloat(), mat.metalness))
4801
+ metalnessField.SetToolTipValue((mat.metalness));
4802
+ if (!Equal(diffuseField.getFloat(), mat.diffuse))
4803
+ diffuseField.SetToolTipValue((mat.diffuse));
4804
+ if (!Equal(specularField.getFloat(), mat.specular))
4805
+ specularField.SetToolTipValue((mat.specular));
4806
+ if (!Equal(shininessField.getFloat(), mat.shininess))
4807
+ shininessField.SetToolTipValue((mat.shininess));
4808
+ if (!Equal(shiftField.getFloat(), mat.shift))
4809
+ shiftField.SetToolTipValue((mat.shift));
4810
+ if (!Equal(ambientField.getFloat(), mat.ambient))
4811
+ ambientField.SetToolTipValue((mat.ambient));
4812
+ if (!Equal(lightareaField.getFloat(), mat.lightarea))
4813
+ lightareaField.SetToolTipValue((mat.lightarea));
4814
+ if (!Equal(diffusenessField.getFloat(), mat.factor))
4815
+ diffusenessField.SetToolTipValue((mat.factor));
4816
+ if (!Equal(velvetField.getFloat(), mat.velvet))
4817
+ velvetField.SetToolTipValue((mat.velvet));
4818
+ if (!Equal(sheenField.getFloat(), mat.sheen))
4819
+ sheenField.SetToolTipValue((mat.sheen));
4820
+ if (!Equal(subsurfaceField.getFloat(), mat.subsurface))
4821
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4822
+ if (!Equal(backlitField.getFloat(), mat.bump))
4823
+ backlitField.SetToolTipValue((mat.bump));
4824
+ if (!Equal(anisoField.getFloat(), mat.aniso))
4825
+ anisoField.SetToolTipValue((mat.aniso));
4826
+ if (!Equal(anisoVField.getFloat(), mat.anisoV))
4827
+ anisoVField.SetToolTipValue((mat.anisoV));
4828
+ if (!Equal(cameraField.getFloat(), mat.cameralight))
4829
+ cameraField.SetToolTipValue((mat.cameralight));
4830
+ if (!Equal(selfshadowField.getFloat(), mat.diffuseness))
4831
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4832
+ if (!Equal(shadowField.getFloat(), mat.shadow))
4833
+ shadowField.SetToolTipValue((mat.shadow));
4834
+ if (!Equal(textureField.getFloat(), mat.texture))
4835
+ textureField.SetToolTipValue((mat.texture));
4836
+ if (!Equal(opacityField.getFloat(), mat.opacity))
4837
+ opacityField.SetToolTipValue((mat.opacity));
4838
+ if (!Equal(fakedepthField.getFloat(), mat.fakedepth))
4839
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4840
+ if (!Equal(shadowbiasField.getFloat(), mat.shadowbias))
4841
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
48134842 }
48144843
48154844 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
cButton.java
....@@ -26,7 +26,7 @@
2626 {
2727 super(icon);
2828
29
- setMargin(new java.awt.Insets(-1, -1, -1, -1));
29
+ setMargin(new java.awt.Insets(1, 10, 1, 10)); // ??
3030
3131 //result = new JButton( icon );
3232 //result.setBorderPainted( false );
cToggleButton.java
....@@ -37,7 +37,7 @@
3737 //if (getWidth() > image.getWidth(null) + 8)
3838 {
3939 g.drawImage(image, this.getWidth()/2 - 12, this.getHeight()/2 - 12, this);
40
- g.drawRect(0, 0, this.getWidth()-1, this.getHeight()-1);
40
+ g.drawRect(2, 2, this.getWidth()-5, this.getHeight()-5);
4141 }
4242 }
4343 }
icons/white-sphere-icon.png
Binary files differ