trackeditor: add object border distance

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@8537 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 07b7e80ddd2231a62685913e298fdbaff46a8116
Former-commit-id: ad86ef179e275307e4a798dcff1cf85f5496faa8
This commit is contained in:
iobyte 2022-09-22 12:34:19 +00:00
parent 78930dadd1
commit 6dc12a8857
5 changed files with 43 additions and 20 deletions

View file

@ -22,7 +22,7 @@ public class DefaultObjectsDialog extends JDialog
private void initialize()
{
this.setContentPane(getObjectProperties());
this.setSize(550, 435);
this.setSize(550, 462);
Point p = new Point();
p.x = editorFrame.getProject().getDefaultObjectsDialogX();
p.y = editorFrame.getProject().getDefaultObjectsDialogY();

View file

@ -94,7 +94,7 @@ public class ObjectProperties extends PropertyPanel
if (addObjectButton == null)
{
addObjectButton = new JButton();
addObjectButton.setBounds(10, 360, 120, 25);
addObjectButton.setBounds(10, 387, 120, 25);
addObjectButton.setText("Add Object");
addObjectButton.addActionListener(new java.awt.event.ActionListener()
{
@ -123,7 +123,7 @@ public class ObjectProperties extends PropertyPanel
if (deleteObjectButton == null)
{
deleteObjectButton = new JButton();
deleteObjectButton.setBounds(140, 360, 120, 25);
deleteObjectButton.setBounds(140, 387, 120, 25);
deleteObjectButton.setText("Delete Object");
deleteObjectButton.addActionListener(new java.awt.event.ActionListener()
{
@ -149,7 +149,7 @@ public class ObjectProperties extends PropertyPanel
if (copyObjectButton == null)
{
copyObjectButton = new JButton();
copyObjectButton.setBounds(270, 360, 120, 25);
copyObjectButton.setBounds(270, 387, 120, 25);
copyObjectButton.setText("Copy Object");
copyObjectButton.addActionListener(new java.awt.event.ActionListener()
{
@ -173,7 +173,7 @@ public class ObjectProperties extends PropertyPanel
if (pasteObjectButton == null)
{
pasteObjectButton = new JButton();
pasteObjectButton.setBounds(400, 360, 120, 25);
pasteObjectButton.setBounds(400, 387, 120, 25);
pasteObjectButton.setText("Paste Object");
pasteObjectButton.addActionListener(new java.awt.event.ActionListener()
{
@ -200,7 +200,7 @@ public class ObjectProperties extends PropertyPanel
{
tabbedPane = new JTabbedPane();
tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
tabbedPane.setBounds(10, 10, 510, 340);
tabbedPane.setBounds(10, 10, 510, 367);
Vector<TrackObject> objects = null;
if (defaultObjects)
@ -232,6 +232,8 @@ public class ObjectProperties extends PropertyPanel
private JLabel orientationTypeLabel = new JLabel();
private JComboBox<String> orientationTypeComboBox = null;
private JLabel orientationLabel = new JLabel();
private JTextField borderDistanceTextField = new JTextField();
private JLabel borderDistanceLabel = new JLabel();
private JTextField orientationTextField = new JTextField();
private JLabel deltaHeightLabel = new JLabel();
private JTextField deltaHeightTextField = new JTextField();
@ -283,13 +285,14 @@ public class ObjectProperties extends PropertyPanel
addLabel(this, 1, objectLabel, "Object", 160);
addLabel(this, 2, colorLabel, "Color", 160);
addLabel(this, 3, orientationTypeLabel, "Orientation Type", 160);
addLabel(this, 4, orientationLabel, "Orientation", 160);
addLabel(this, 5, deltaHeightLabel, "Delta Height", 160);
addLabel(this, 6, deltaVertLabel, "Delta Vert", 160);
addLabel(this, 7, scaleTypeLabel, "Scale Type", 160);
addLabel(this, 8, scaleLabel, "Scale", 160);
addLabel(this, 9, scaleMinLabel, "Scale Min", 160);
addLabel(this, 10, scaleMaxLabel, "Scale Max", 160);
addLabel(this, 4, borderDistanceLabel, "Border Distance", 160);
addLabel(this, 5, orientationLabel, "Orientation", 160);
addLabel(this, 6, deltaHeightLabel, "Delta Height", 160);
addLabel(this, 7, deltaVertLabel, "Delta Vert", 160);
addLabel(this, 8, scaleTypeLabel, "Scale Type", 160);
addLabel(this, 9, scaleLabel, "Scale", 160);
addLabel(this, 10, scaleMinLabel, "Scale Min", 160);
addLabel(this, 11, scaleMaxLabel, "Scale Max", 160);
addTextField(this, 0, nameTextField, object.getName(), 120, 125);
addTextField(this, 1, objectTextField, object.getObject(), 120, 290);
@ -298,16 +301,17 @@ public class ObjectProperties extends PropertyPanel
add(getOrientationTypeComboBox(), null);
getOrientationTypeComboBox().setSelectedItem(toNoneString(object.getOrientationType()));
addTextField(this, 4, orientationTextField, object.getOrientation(), 120, 125);
addTextField(this, 5, deltaHeightTextField, object.getDeltaHeight(), 120, 125);
addTextField(this, 6, deltaVertTextField, object.getDeltaVert(), 120, 125);
addTextField(this, 4, borderDistanceTextField, object.getBorderDistance(), 120, 125);
addTextField(this, 5, orientationTextField, object.getOrientation(), 120, 125);
addTextField(this, 6, deltaHeightTextField, object.getDeltaHeight(), 120, 125);
addTextField(this, 7, deltaVertTextField, object.getDeltaVert(), 120, 125);
add(getScaleTypeComboBox(), null);
getScaleTypeComboBox().setSelectedItem(toNoneString(object.getScaleType()));
addTextField(this, 8, scaleTextField, object.getScale(), 120, 125);
addTextField(this, 9, scaleMinTextField, object.getScaleMin(), 120, 125);
addTextField(this, 10, scaleMaxTextField, object.getScaleMax(), 120, 125);
addTextField(this, 9, scaleTextField, object.getScale(), 120, 125);
addTextField(this, 10, scaleMinTextField, object.getScaleMin(), 120, 125);
addTextField(this, 11, scaleMaxTextField, object.getScaleMax(), 120, 125);
if (defaultObjects)
{
@ -346,7 +350,7 @@ public class ObjectProperties extends PropertyPanel
{
String[] items = {"none", "random", "fixed"};
scaleTypeComboBox = new JComboBox<String>(items);
scaleTypeComboBox.setBounds(120, 201, 125, 23);
scaleTypeComboBox.setBounds(120, 228, 125, 23);
scaleTypeComboBox.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent e)
@ -508,6 +512,12 @@ public class ObjectProperties extends PropertyPanel
getEditorFrame().documentIsModified = true;
}
if (isDifferent(panel.borderDistanceTextField.getText(), object.getBorderDistance(), doubleResult))
{
object.setBorderDistance(doubleResult.getValue());
getEditorFrame().documentIsModified = true;
}
if (isDifferent(panel.orientationTextField.getText(), object.getOrientation(), doubleResult))
{
object.setOrientation(doubleResult.getValue());
@ -577,6 +587,7 @@ public class ObjectProperties extends PropertyPanel
object.setObject(panel.objectTextField.getText());
object.setColor(getInteger(panel.colorTextField.getText()));
object.setOrientationType(getString(panel.orientationTypeComboBox.getSelectedItem().toString()));
object.setBorderDistance(getDouble(panel.borderDistanceTextField.getText()));
object.setOrientation(getDouble(panel.orientationTextField.getText()));
object.setDeltaHeight(getDouble(panel.deltaHeightTextField.getText()));
object.setDeltaVert(getDouble(panel.deltaVertTextField.getText()));

View file

@ -452,6 +452,7 @@ public class XmlReader
obj.setObject(getAttrStrValue(object, "object"));
obj.setColor(getAttrIntValue(object, "color"));
obj.setOrientationType(getAttrStrValue(object, "orientation type"));
obj.setBorderDistance(getAttrNumValue(object, "border distance", "m"));
obj.setOrientation(getAttrNumValue(object, "orientation", "deg"));
obj.setDeltaHeight(getAttrNumValue(object, "delta height"));
obj.setDeltaVert(getAttrNumValue(object, "delta vert"));

View file

@ -656,6 +656,7 @@ public class XmlWriter
addContent(el, "object", object.getObject());
addHexContent(el, "color", null, object.getColor());
addContent(el, "orientation type", object.getOrientationType());
addContent(el, "border distance", "m", object.getBorderDistance());
addContent(el, "orientation", "deg", object.getOrientation());
addContent(el, "delta height",null, object.getDeltaHeight());
addContent(el, "delta vert", null, object.getDeltaVert());

View file

@ -5,6 +5,7 @@ public final class TrackObject {
private String object = null;
private int color = Integer.MAX_VALUE;
private String orientationType = null;
private double borderDistance = Double.NaN;
private double orientation = Double.NaN;
private double deltaHeight = Double.NaN;
private double deltaVert = Double.NaN;
@ -45,6 +46,14 @@ public final class TrackObject {
this.orientationType = orientationType;
}
public double getBorderDistance() {
return borderDistance;
}
public void setBorderDistance(double borderDistance) {
this.borderDistance = borderDistance;
}
public double getOrientation() {
return orientation;
}
@ -108,6 +117,7 @@ public final class TrackObject {
System.out.println(indent + " object : " + object);
System.out.println(indent + " color : 0x" + Integer.toHexString(color).toUpperCase());
System.out.println(indent + " orientationType : " + orientationType);
System.out.println(indent + " borderDistance : " + borderDistance);
System.out.println(indent + " orientation : " + orientation);
System.out.println(indent + " deltaHeight : " + deltaHeight);
System.out.println(indent + " deltaVert : " + deltaVert);