Normand Briere
2019-11-17 cb37a129d1adb403019c96e798e86e2da9667f15
RandomEditor.java
....@@ -9,14 +9,15 @@
99 class RandomEditor extends ObjEditor implements //ItemListener,
1010 ChangeListener, ObjectUI, ActionListener
1111 {
12
- cGridBag childPanel;
12
+ cGridBag itemPanel;
13
+ private cGridBag dampPanel;
1314 RandomEditor(RandomNode inBP, GroupEditor callee)
1415 {
1516 super(inBP,callee);
1617
1718 objEditor = callee.GetEditor(); // new ObjEditor(inBP, this, callee);
1819
19
- switchnode = (RandomNode) inBP;
20
+ randomnode = (RandomNode) inBP;
2021 // parent = p;
2122
2223 //SetupUI2(callee.objEditor);
....@@ -35,7 +36,7 @@
3536
3637 objEditor = callee.GetEditor(); // new ObjEditor(inBP, this, callee);
3738
38
- switchnode = (RandomNode) inBP;
39
+ randomnode = (RandomNode) inBP;
3940 parent = p;
4041
4142 SetupUI2(callee.objEditor);
....@@ -49,7 +50,7 @@
4950
5051 //objEditor = new ObjEditor(inBP, copy, this, callee);
5152 // ?? super.parent = p;
52
- switchnode = (RandomNode) copy;
53
+ randomnode = (RandomNode) copy;
5354 parent = p;
5455
5556 //objEditor.SetupUI(false); // ?
....@@ -57,27 +58,39 @@
5758 SetupUI2(objEditor);
5859 }
5960
61
+ String GetSupportText()
62
+ {
63
+ return "Show all";
64
+ }
65
+
6066 void SetupUI2(ObjEditor oe)
6167 {
6268 super.SetupUI2(oe);
63
- childPanel = AddSlider(oe.ctrlPanel, "Item: ", 0, switchnode.Size()-1, switchnode.rnd);
69
+ itemPanel = AddSlider(oe.ctrlPanel, "Item: ", 0, randomnode.Size()-1, randomnode.rndIndex);
6470
65
- childField = (cNumberSlider)childPanel.getComponent(1);
71
+ itemField = (cNumberSlider)itemPanel.getComponent(1);
72
+ itemPanel.getComponent(0).setEnabled(!randomnode.random);
6673 oe.ctrlPanel.Return();
74
+
75
+ oe.ctrlPanel.Return();
76
+ dampPanel = AddSlider(oe.ctrlPanel, "Damp: ", 0, 300, randomnode.damp);
77
+
78
+ dampField = (cNumberSlider)dampPanel.getComponent(1);
79
+ oe.ctrlPanel.Return();
6780 }
6881
6982 void Clear()
7083 {
7184 objEditor.Clear();
7285
73
- switchnode = null;
86
+ randomnode = null;
7487 }
7588
7689
7790 public void stateChanged(ChangeEvent e)
7891 {
7992 //System.out.println("Biparam :: stateChanged");
80
- if (e.getSource() == childField)
93
+ if (e.getSource() == itemField || e.getSource() == dampField)
8194 {
8295 //System.out.println("#U = " + biparam.uDivs);
8396 //System.out.println("#V = " + biparam.vDivs);
....@@ -85,7 +98,9 @@
8598 //System.out.println(e);
8699 applySelf();
87100 //super.applySelf();
88
- objEditor.refreshContents();
101
+
102
+ Globals.lighttouched = true;
103
+ objEditor.refreshContents();
89104 //Refresh();
90105 }
91106 else
....@@ -94,7 +109,7 @@
94109
95110 void Refresh()
96111 {
97
- switchnode.rnd = childField.getInteger();
112
+ randomnode.rndIndex = itemField.getInteger();
98113
99114 refreshContents();
100115 }
....@@ -102,7 +117,8 @@
102117 /**/
103118 public void applySelf()
104119 {
105
- switchnode.rnd = childField.getInteger();
120
+ randomnode.rndIndex = itemField.getInteger();
121
+ randomnode.damp = dampField.getInteger(); // biparam.minUDivs, 99);
106122 }
107123 /**/
108124
....@@ -111,7 +127,8 @@
111127 ObjEditor oe = objEditor;
112128
113129 //Remove(childField);
114
- oe.ctrlPanel.remove(this.childPanel);
130
+ oe.ctrlPanel.remove(this.itemPanel);
131
+ oe.ctrlPanel.remove(this.dampPanel);
115132
116133 super.closeUI();
117134 }
....@@ -121,13 +138,18 @@
121138 return objEditor;
122139 }
123140
124
- void refreshContents2()
141
+ void refreshContents()
125142 {
126
- objEditor.refreshContents();
143
+ itemField.setMinimum(0);
144
+ itemField.setMaximum(randomnode.Size() - 1);
145
+ itemField.setInteger(randomnode.rndIndex);
146
+
147
+ // objEditor.refreshContents();
127148 }
128149
129
- RandomNode switchnode;
130
- cNumberSlider childField;
150
+ RandomNode randomnode;
151
+ cNumberSlider itemField;
152
+ cNumberSlider dampField;
131153
132154 ObjectUI parent;
133155