|
import java.awt.*;
|
import java.awt.event.*;
|
import javax.swing.*;
|
import javax.swing.event.*;
|
|
import grafeme.ui.*;
|
|
class PointFlowEditor extends ObjEditor implements //ItemListener,
|
ChangeListener, ObjectUI, ActionListener
|
{
|
|
PointFlowEditor(PointFlow inBP, GroupEditor callee)
|
{
|
super(inBP, callee);
|
|
objEditor = callee.GetEditor(); // new ObjEditor(inBP, this, callee);
|
|
particlesystem = (PointFlow) inBP;
|
// parent = p;
|
|
//SetupUI2(callee.objEditor);
|
SetupUI2(objEditor);
|
}
|
|
// TEMP
|
PointFlowEditor(PointFlow inClient, Object3D localCopy, GroupEditor callee)
|
{
|
this(inClient, localCopy, null, callee);
|
}
|
|
PointFlowEditor(PointFlow inBP, ObjectUI p, GroupEditor callee)
|
{
|
super(inBP, callee);
|
|
objEditor = callee.GetEditor(); // new ObjEditor(inBP, this, callee);
|
|
particlesystem = (PointFlow) inBP;
|
parent = p;
|
|
SetupUI2(callee.objEditor);
|
}
|
|
PointFlowEditor(PointFlow inBP, Object3D copy, ObjectUI p, GroupEditor callee) // boolean ends)
|
{
|
//super(inBP, copy, callee);
|
super(inBP, copy, p, callee);
|
objEditor = this;
|
|
//objEditor = new ObjEditor(inBP, copy, this, callee);
|
// ?? super.parent = p;
|
particlesystem = (PointFlow) copy;
|
parent = p;
|
|
//objEditor.SetupUI(false); // ?
|
//objEditor.SetupViews(); // ?
|
SetupUI2(objEditor);
|
}
|
|
void SetupUI2(ObjEditor oe)
|
{
|
/*
|
oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
|
oe.aConstraints.gridx = 0;
|
oe.aConstraints.weighty = 0;
|
oe.aConstraints.gridwidth = ObjEditor.GRIDWIDTH+1;
|
oe.ctrlPanel.add(nameField = new JTextField(biparam.name), oe.aConstraints);
|
nameField.addActionListener(this);
|
oe.aConstraints.gridy += 1;
|
oe.aConstraints.gridwidth = 1;
|
*/
|
super.SetupUI2(oe);
|
|
// oe.aConstraints.gridx = 0;
|
// oe.aConstraints.gridwidth = 1;
|
// oe.aConstraints.fill = GridBagConstraints.VERTICAL;
|
// oe.ctrlPanel.add(frameLabel = new JLabel("Child: "), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
// oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; // 1;
|
// oe.aConstraints.gridx += 1;
|
// oe.aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
|
// oe.ctrlPanel.add(frameField = new NumberSlider(0.0, 100), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
//
|
// frameField.setFloat(particlesystem.initialVelocity);
|
|
resizefactorField = (cNumberSlider)AddSlider(oe.ctrlPanel, "Resize factor", 0, 2, particlesystem.resizefactor, 1).getComponent(1);
|
oe.ctrlPanel.Return();
|
// velocityField = AddSlider(oe.ctrlPanel, "Speed", 0, 10, particlesystem.initialVelocity, 1);
|
// Return();
|
// timestepField = AddSlider(oe.ctrlPanel, "Timestep", 0.001f, 1, particlesystem.controller.timestep, 1);
|
// Return();
|
// delayField = AddSlider(oe.ctrlPanel, "Delay", 0, 10, particlesystem.creationdelay, 1);
|
// Return();
|
// angleminField = AddSlider(oe.ctrlPanel, "Angle min", 0, (float)Math.PI, particlesystem.minimumAngle, 1);
|
// Return();
|
// anglemaxField = AddSlider(oe.ctrlPanel, "Angle max", 0, (float)Math.PI, particlesystem.maximumAngle, 1);
|
// Return();
|
sizeminField = (cNumberSlider)AddSlider(oe.ctrlPanel, "Size min", 0, 0.01, particlesystem.minimumSize, 1).getComponent(1);
|
oe.ctrlPanel.Return();
|
sizemaxField = (cNumberSlider)AddSlider(oe.ctrlPanel, "Size max", 0, 0.01, particlesystem.maximumSize, 1).getComponent(1);
|
oe.ctrlPanel.Return();
|
// lifeminField = AddSlider(oe.ctrlPanel, "Life min", 0, 100, particlesystem.minimumLifeTime, 1);
|
// Return();
|
// lifemaxField = AddSlider(oe.ctrlPanel, "Life max", 0, 100, particlesystem.maximumLifeTime, 1);
|
// Return();
|
// densityField = AddSlider(oe.ctrlPanel, "Density", 0, 1, particlesystem.density, 1);
|
// Return();
|
// gravityField = AddSlider(oe.ctrlPanel, "Gravity", 0, 1, -particlesystem.controller.gvector.y, 1);
|
// Return();
|
// standbyField = AddSlider(oe.ctrlPanel, "Standby", 0, 1, particlesystem.standby, 1);
|
// Return();
|
|
// oe.aConstraints.gridy += 1;
|
// oe.aConstraints.gridx = 0;
|
// oe.aConstraints.gridwidth = 1;
|
// oe.aConstraints.fill = GridBagConstraints.VERTICAL;
|
// oe.ctrlPanel.add(speedLabel = new JLabel("Damp: "), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
// oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; // 1;
|
// oe.aConstraints.gridx += 1;
|
// oe.aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
|
// oe.ctrlPanel.add(speedField = new NumberSlider(0, 500), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
//
|
// speedField.setInteger(particlesystem.speed);
|
|
// oe.aConstraints.gridy += 1;
|
// oe.aConstraints.gridwidth = 1;
|
// oe.aConstraints.fill = 0;
|
// oe.aConstraints.gridx -= 1;
|
// oe.aConstraints.fill = GridBagConstraints.VERTICAL;
|
// oe.aConstraints.gridy += 1;
|
// oe.aConstraints.gridx = 0;
|
// velocityField.addChangeListener(this);
|
// speedField.addChangeListener(this);
|
}
|
|
void Clear()
|
{
|
objEditor.Clear();
|
|
particlesystem = null;
|
}
|
|
// public void itemStateChanged(ItemEvent e)
|
// {
|
// if (//e.getSource() == nameField ||
|
// e.getSource() == endcaps)
|
// {
|
// //System.out.println(e);
|
// frameselect.endcaps = (e.getStateChange() == ItemEvent.SELECTED);
|
// //Refresh();
|
// frameselect.retile();
|
// applySelf();
|
// //super.applySelf();
|
// objEditor.refreshContents();
|
// }
|
// else
|
// {
|
// super.itemStateChanged(e);
|
// }
|
// }
|
// public void actionPerformed(ActionEvent e)
|
// {
|
// if (//e.getSource() == nameField ||
|
// e.getSource() == endcaps)
|
// {
|
// //System.out.println(e);
|
// applySelf();
|
// //super.applySelf();
|
// refreshContents();
|
// //Refresh();
|
// }
|
// else
|
// {
|
// super.actionPerformed(e);
|
// }
|
// }
|
public void stateChanged(ChangeEvent e)
|
{
|
//System.out.println("Biparam :: stateChanged");
|
if (e.getSource() == resizefactorField ||
|
e.getSource() == velocityField ||
|
e.getSource() == delayField ||
|
e.getSource() == timestepField ||
|
e.getSource() == angleminField ||
|
e.getSource() == anglemaxField ||
|
e.getSource() == sizeminField ||
|
e.getSource() == sizemaxField ||
|
e.getSource() == lifeminField ||
|
e.getSource() == lifemaxField ||
|
e.getSource() == densityField ||
|
e.getSource() == standbyField ||
|
e.getSource() == gravityField)
|
{
|
applySelf();
|
//super.applySelf();
|
objEditor.refreshContents();
|
//Refresh();
|
} else
|
{
|
super.stateChanged(e);
|
}
|
}
|
|
// void Refresh()
|
// {
|
//// System.out.println("Biparam :: Refresh");
|
// new Exception().printStackTrace();
|
// particlesystem.initialVelocity = (float) velocityField.getFloat(); // biparam.minUDivs, 99);
|
// particlesystem.controller.timestep = (float) timestepField.getFloat();
|
//
|
// refreshContents();
|
// }
|
|
/*
|
public void doLayout()
|
{
|
super.doLayout();
|
labelAndField(uDivsLabel, uDivsField);
|
labelAndField(vDivsLabel, vDivsField);
|
if (endcaps != null)
|
{
|
int h = endcaps.getPreferredSize().height;
|
int w = endcaps.getPreferredSize().width;
|
endcaps.setBounds(5, widgetPos, w, h);
|
widgetPos += h;
|
}
|
widgetPos += 5;
|
}
|
*/
|
/**/
|
public void applySelf()
|
{
|
//System.out.println("Biparam :: applySelf");
|
//super.applySelf();
|
particlesystem.resizefactor = resizefactorField.getFloat(); // biparam.minUDivs, 99);
|
// particlesystem.initialVelocity = (float) velocityField.getFloat(); // biparam.minUDivs, 99);
|
// particlesystem.controller.timestep = (float) timestepField.getFloat();
|
// particlesystem.creationdelay = (float) delayField.getFloat();
|
particlesystem.minimumSize = sizeminField.getFloat();
|
particlesystem.maximumSize = sizemaxField.getFloat();
|
// particlesystem.minimumAngle = (float) angleminField.getFloat();
|
// particlesystem.maximumAngle = (float) anglemaxField.getFloat();
|
// particlesystem.minimumLifeTime = (float) lifeminField.getFloat();
|
// particlesystem.maximumLifeTime = (float) lifemaxField.getFloat();
|
// particlesystem.density = (float) densityField.getFloat();
|
// particlesystem.controller.gvector.y = (float) -gravityField.getFloat();
|
// particlesystem.standby = (float) standbyField.getFloat();
|
// particlesystem.speed = speedField.getInteger(); // biparam.minUDivs, 99);
|
//biparam.name = nameField.getText();
|
|
// super.applySelf();
|
}
|
/**/
|
|
public void closeUI()
|
{
|
Remove(resizefactorField);
|
// Remove(velocityField);
|
// Remove(timestepField);
|
// Remove(delayField);
|
Remove(sizeminField);
|
Remove(sizemaxField);
|
// Remove(angleminField);
|
// Remove(anglemaxField);
|
// Remove(lifeminField);
|
// Remove(lifemaxField);
|
// Remove(densityField);
|
// Remove(gravityField);
|
// Remove(standbyField);
|
|
// ObjEditor oe = objEditor;
|
|
// frameField.removeChangeListener(this);
|
// oe.ctrlPanel.remove(frameField);
|
// oe.ctrlPanel.remove(frameLabel);
|
// oe.ctrlPanel.remove(speedField);
|
// oe.ctrlPanel.remove(speedLabel);
|
//oe.ctrlPanel.repaint();
|
|
super.closeUI();
|
}
|
|
public ObjEditor GetEditor()
|
{
|
return objEditor;
|
}
|
|
void refreshContents2()
|
{
|
objEditor.refreshContents();
|
}
|
|
PointFlow particlesystem;
|
|
cNumberSlider resizefactorField;
|
cNumberSlider velocityField;
|
cNumberSlider timestepField;
|
cNumberSlider delayField;
|
cNumberSlider sizeminField;
|
cNumberSlider sizemaxField;
|
cNumberSlider angleminField;
|
cNumberSlider anglemaxField;
|
cNumberSlider lifeminField;
|
cNumberSlider lifemaxField;
|
cNumberSlider densityField;
|
cNumberSlider gravityField;
|
cNumberSlider standbyField;
|
|
ObjectUI parent;
|
//ObjEditor objEditor;
|
}
|