Normand Briere
2019-09-10 a7e7618fb914f8b919a17daf6c020b860c5d11c9
Lazy icons.
5 files modified
60 ■■■■ changed files
Grafreed.java 7 ●●●● patch | view | raw | blame | history
ObjEditor.java 9 ●●●●● patch | view | raw | blame | history
Sphere.java 8 ●●●● patch | view | raw | blame | history
Torus.java 4 ●●●● patch | view | raw | blame | history
cButton.java 32 ●●●● patch | view | raw | blame | history
Grafreed.java
....@@ -688,10 +688,14 @@
688688
689689 public static void main(String argv[])
690690 {
691
- String osArch = System.getProperty("os.arch");
691
+ String osArch = System.getProperty("os.arch");
692692 if (Globals.DEBUG)
693693 System.out.println("os.arch = " + osArch);
694694
695
+ String osName = System.getProperty("os.name");
696
+
697
+ isWindows = !osName.equals("Mac OS X");
698
+
695699 if (argv.length == 0)
696700 {
697701 String javaPath = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
....@@ -717,7 +721,6 @@
717721 // -Djava.library.path=/Users/nbriere/Projects/shared/lib
718722 if (jarfile.charAt(2) == ':')
719723 {
720
- isWindows = true;
721724 command = "\"" + javaPath + "\" -Xmx1024m -Djava.library.path=" + jarpath;
722725 // On Windows systems, the path is /C:/
723726 jarfile = jarfile.substring(1, jarfile.length());
ObjEditor.java
....@@ -98,10 +98,11 @@
9898
9999 cButton GetButton(String name, boolean border)
100100 {
101
- ImageIcon icon = GetIcon(name);
101
+ //ImageIcon icon = GetIcon(name);
102102 boolean fit = !name.startsWith("icons");
103
- if (icon != null || name.contains("/"))
104
- return new cButton(icon, border, fit);
103
+ if (//icon != null ||
104
+ name.contains("/"))
105
+ return new cButton(name, border, fit);
105106 else
106107 return new cButton(name, border);
107108 }
....@@ -1787,7 +1788,7 @@
17871788 objectTabbedPane.setToolTipTextAt(objectTabCount++, "Material");
17881789
17891790 figurePanel = new cGridBag();
1790
- figurePanel.add(new cButton("FIGURES amd POSES coming soon!"));
1791
+ figurePanel.add(new cButton("FIGURES and POSES coming soon!"));
17911792 objectTabbedPane.add(figurePanel);
17921793 objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/figure.png"));
17931794 objectTabbedPane.setToolTipTextAt(objectTabCount++, "Figures and poses");
Sphere.java
....@@ -13,8 +13,8 @@
1313 this(false);
1414
1515 radius = 0.05f;
16
- uDivs = 7;
17
- vDivs = 6;
16
+ uDivs = 11; // 7;
17
+ vDivs = 4; // 6;
1818
1919 center = new cVector();
2020 center.set(x, y, z);
....@@ -44,8 +44,8 @@
4444 inPnt = new cVector();
4545 name = "Sphere";
4646 //uDivs = vDivs = 16;
47
- uDivs = 8; // 19;
48
- vDivs = 8; // 18;
47
+ uDivs = 12; // 8; // 19;
48
+ vDivs = 6; // 8; // 18;
4949 minUDivs = 3;
5050 minVDivs = 2;
5151 //center = new cVector();
Torus.java
....@@ -8,8 +8,8 @@
88 {
99 inPnt = new cVector();
1010 name = "Torus";
11
- uDivs = 35; // 64;
12
- vDivs = 19; // 24;
11
+ uDivs = 61; // 35; // 64;
12
+ vDivs = 21; // 19; // 24;
1313 minUDivs = 3;
1414 minVDivs = 3;
1515 retile();
cButton.java
....@@ -1,5 +1,8 @@
11 public class cButton extends javax.swing.JButton
22 {
3
+ String iconname;
4
+ boolean fit;
5
+
36 cButton(String name)
47 {
58 super(name);
....@@ -22,16 +25,20 @@
2225 }
2326 }
2427
25
- cButton(javax.swing.ImageIcon icon, boolean border, boolean fit)
28
+ cButton(//javax.swing.ImageIcon icon,
29
+ String iconname,
30
+ boolean border, boolean fit)
2631 {
27
- super(icon);
32
+ //super(icon);
33
+ this.iconname = iconname;
34
+ this.fit = fit;
2835
2936 assert(border);
3037
3138 //setMargin(new java.awt.Insets(1, 10, 1, 10)); // ??
3239
33
- if (icon != null && fit)
34
- this.image = icon.getImage();
40
+// if (icon != null && fit)
41
+// this.image = icon.getImage();
3542
3643 //result = new JButton( icon );
3744 //result.setBorderPainted( false );
....@@ -53,6 +60,23 @@
5360 //@Override
5461 protected void paintComponent(java.awt.Graphics g)
5562 {
63
+ if (iconname != null)
64
+ {
65
+ javax.swing.ImageIcon icon = ObjEditor.GetIcon(iconname);
66
+
67
+ if (icon == null)
68
+ setName(iconname);
69
+ else
70
+ {
71
+ if (fit)
72
+ this.image = icon.getImage();
73
+ else
74
+ setIcon(icon);
75
+ }
76
+
77
+ iconname = null;
78
+ }
79
+
5680 if (image != null)
5781 {
5882 //if (getWidth() > image.getWidth(null) + 8)