Normand Briere
2019-09-28 57f4646563d6757f65ddc00ca38975c352d76de7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
// Decompiled by Jad v1.5.7b. Copyright 1997-99 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   ConeEditor.java
 
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
 
import grafeme.ui.*;
 
class ConeEditor extends BiparamEditor implements ChangeListener, ObjectUI
{
   
   /*
    ConeEditor(Cone inCone, Object3D copy, GroupEditor callee)
    {
        super(inCone, copy, null, callee); // true);
       //parent = this;
        cone = (Cone) copy;
       
       SetupWindow();
       SetupUI2(this);
   }
   */
   ConeEditor(Cone inCone, GroupEditor callee)
   {
            super(inCone, callee);
       //objEditor = new BiparamEditor(inCone, this, callee);
       objEditor = callee.GetEditor();
       
       this.cone = inCone;
       
       SetupUI2(GetEditor());
   }
   
   ConeEditor(Cone t, Object3D copy, GroupEditor callee)
   {
            super(t, copy, callee); // false);
       //objEditor = new BiparamEditor(t, copy, this, callee);
       objEditor = this;
                
        cone = (Cone) copy;
       
       SetupUI2(GetEditor());
   }
   
   
   void SetupUI2(ObjEditor oe)
   {
            super.SetupUI2(oe);
            
       /*
        ctrlPanel.add(baseLabel = new JLabel("Base"), aConstraints);
       aConstraints.fill = GridBagConstraints.HORIZONTAL;
       aConstraints.gridx += 1;
       aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
        ctrlPanel.add(baseField = new NumberField(), aConstraints);
        baseField.setVector(cone.base);
       baseField.addActionListener(this);
       */
            topPanel = new cGridBag();
        topPanel.add(baseRadLabel = new JLabel("Top")); //, oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
        topPanel.add(baseRadField = new cNumberSlider(this, 0.001,10,1)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
        baseRadField.setFloat(cone.baseRadius);
                
        oe.ctrlPanel.add(topPanel);
        oe.ctrlPanel.Return();
        /*
       aConstraints.fill = 0;
       aConstraints.gridx -= 1;
       aConstraints.gridy += 1;
       aConstraints.gridwidth = 1;
        ctrlPanel.add(apexLabel = new JLabel("Apex"), aConstraints);
       aConstraints.fill = GridBagConstraints.HORIZONTAL;
       aConstraints.gridx += 1;
       aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
        ctrlPanel.add(apexField = new NumberField(), aConstraints);
        apexField.setVector(cone.apex);
       apexField.addActionListener(this);
       */
            basePanel = new cGridBag();
        basePanel.add(apexRadLabel = new JLabel("Base")); //, oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
        basePanel.add(apexRadField = new cNumberSlider(this, 0.001,10,1)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
        apexRadField.setFloat(cone.apexRadius);
 
        oe.ctrlPanel.add(basePanel);
        oe.ctrlPanel.Return();
    }
   
   public void closeUI()
   {
       ObjEditor oe = GetEditor();
       
       apexRadField.removeChangeListener(this);
       baseRadField.removeChangeListener(this);
//        oe.ctrlPanel.remove(apexRadField);
//        oe.ctrlPanel.remove(baseRadField);
//        oe.ctrlPanel.remove(apexRadLabel);
//        oe.ctrlPanel.remove(baseRadLabel);
       oe.ctrlPanel.remove(topPanel);
       oe.ctrlPanel.remove(basePanel);
       //oe.ctrlPanel.repaint();
       
       super.closeUI();
   }
   
   public ObjEditor GetEditor2()
   {
       return objEditor.GetEditor();
   }
 
   void refreshContents2()
   {
       objEditor.refreshContents();
   }
   
   void Clear()
   {
       super.Clear();
       
       cone = null;
   }
   
    public void actionPerformed(ActionEvent e)
    {
       if (//e.getSource() == apexField ||
           //e.getSource() == baseField ||
       e.getSource() == apexRadField ||
       e.getSource() == baseRadField)
       {
           applySelf();
           refreshContents();
       }
       else
       //assert false;
       super.actionPerformed(e);
    }
    
    public void stateChanged(ChangeEvent e)
    {
       if (//e.getSource() == apexField ||
           //e.getSource() == baseField ||
       e.getSource() == apexRadField ||
       e.getSource() == baseRadField)
       {
           applySelf();
           objEditor.refreshContents();
       }
       else
       //    assert false;
                super.stateChanged(e);
    }
    
    /*
    public void doLayout()
    {
        super.doLayout();
        labelAndField(baseLabel, baseField);
        labelAndField(baseRadLabel, baseRadField);
        labelAndField(apexLabel, apexField);
        labelAndField(apexRadLabel, apexRadField);
        widgetPos += 5;
    }
    */
    
    public void applySelf()
    {
        super.applySelf();
        //baseField.getVector(cone.base);
        cone.baseRadius = apexRadField.getFloat();
        //apexField.getVector(cone.apex);
        cone.apexRadius = baseRadField.getFloat();
        //cone.orient();
       cone.recalculate();
    }
   
    Cone cone;
    JLabel baseLabel;
    JLabel apexLabel;
    JLabel baseRadLabel;
    JLabel apexRadLabel;
    //NumberField baseField;
    //NumberField apexField;
    cNumberSlider baseRadField;
    cNumberSlider apexRadField;
 
    cGridBag topPanel;
    cGridBag basePanel;
   //BiparamEditor objEditor;
}