trackeditor: remember surface, object, camera and light properties tabs

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9329 30fe4595-0a0c-4342-8851-515496e4dcbd
This commit is contained in:
iobyte 2024-02-19 20:37:37 +00:00
parent 64085c8de3
commit a309cbd629
7 changed files with 105 additions and 1 deletions

View File

@ -917,6 +917,10 @@ public class EditorFrame extends JFrame
getProject().setPropertiesEditorX(preferences.getInt("PropertiesEditorX", 0));
getProject().setPropertiesEditorY(preferences.getInt("PropertiesEditorY", 0));
getProject().setPropertiesEditorTab(preferences.getInt("PropertiesEditorTab", 0));
getProject().setPropertiesEditorSurfaceTab(preferences.getInt("PropertiesEditorSurfaceTab", 0));
getProject().setPropertiesEditorObjectTab(preferences.getInt("PropertiesEditorObjectTab", 0));
getProject().setPropertiesEditorCameraTab(preferences.getInt("PropertiesEditorCameraTab", 0));
getProject().setPropertiesEditorLightTab(preferences.getInt("PropertiesEditorLightTab", 0));
getProject().setDefaultSurfacesDialogX(preferences.getInt("DefaultSurfacesDialogX", 0));
getProject().setDefaultSurfacesDialogY(preferences.getInt("DefaultSurfacesDialogY", 0));
getProject().setDefaultObjectsDialogX(preferences.getInt("DefaultObjectsDialogX", 0));
@ -3289,6 +3293,10 @@ public class EditorFrame extends JFrame
preferences.putInt("PropertiesEditorX", getProject().getPropertiesEditorX());
preferences.putInt("PropertiesEditorY", getProject().getPropertiesEditorY());
preferences.putInt("PropertiesEditorTab", getProject().getPropertiesEditorTab());
preferences.putInt("PropertiesEditorSurfaceTab", getProject().getPropertiesEditorSurfaceTab());
preferences.putInt("PropertiesEditorObjectTab", getProject().getPropertiesEditorObjectTab());
preferences.putInt("PropertiesEditorCameraTab", getProject().getPropertiesEditorCameraTab());
preferences.putInt("PropertiesEditorLightTab", getProject().getPropertiesEditorLightTab());
preferences.putInt("DefaultSurfacesDialogX", getProject().getDefaultSurfacesDialogX());
preferences.putInt("DefaultSurfacesDialogY", getProject().getDefaultSurfacesDialogY());
preferences.putInt("DefaultObjectsDialogX", getProject().getDefaultObjectsDialogX());

View File

@ -27,6 +27,7 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import gui.EditorFrame;
import utils.MutableDouble;
@ -144,6 +145,16 @@ public class CameraProperties extends PropertyPanel
Camera camera = cameras.elementAt(i);
tabbedPane.addTab(camera.getName(), null, new CameraPanel(camera), null);
}
SwingUtilities.invokeLater( new Runnable()
{
public void run()
{
int lastTab = getEditorFrame().getProject().getPropertiesEditorCameraTab();
if (lastTab < tabbedPane.getTabCount())
tabbedPane.setSelectedIndex(lastTab);
}
});
}
return tabbedPane;
}
@ -298,5 +309,7 @@ public class CameraProperties extends PropertyPanel
cameras.add(camera);
}
}
getEditorFrame().getProject().setPropertiesEditorCameraTab(this.tabbedPane.getSelectedIndex());
}
} // @jve:decl-index=0:visual-constraint="10,10"

View File

@ -37,6 +37,7 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.colorchooser.AbstractColorChooserPanel;
import javax.swing.event.DocumentEvent;
@ -241,6 +242,16 @@ public class ObjectProperties extends PropertyPanel
TrackObject object = objects.elementAt(i);
tabbedPane.addTab(object.getName(), null, new ObjectPanel(object), null);
}
SwingUtilities.invokeLater( new Runnable()
{
public void run()
{
int lastTab = getEditorFrame().getProject().getPropertiesEditorObjectTab();
if (lastTab < tabbedPane.getTabCount())
tabbedPane.setSelectedIndex(lastTab);
}
});
}
return tabbedPane;
}
@ -798,6 +809,8 @@ public class ObjectProperties extends PropertyPanel
objects.add(object);
}
}
getEditorFrame().getProject().setPropertiesEditorObjectTab(this.tabbedPane.getSelectedIndex());
}
private void setObjectFromPanel(TrackObject object, ObjectPanel panel)

View File

@ -30,6 +30,7 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.filechooser.FileNameExtensionFilter;
@ -229,6 +230,16 @@ public class SurfaceProperties extends PropertyPanel
Surface surface = surfaces.elementAt(i);
tabbedPane.addTab(surface.getName(), null, new SurfacePanel(surface), null);
}
SwingUtilities.invokeLater( new Runnable()
{
public void run()
{
int lastTab = getEditorFrame().getProject().getPropertiesEditorSurfaceTab();
if (lastTab < tabbedPane.getTabCount())
tabbedPane.setSelectedIndex(lastTab);
}
});
}
return tabbedPane;
}
@ -788,6 +799,8 @@ public class SurfaceProperties extends PropertyPanel
surfaces.add(surface);
}
}
getEditorFrame().getProject().setPropertiesEditorSurfaceTab(this.tabbedPane.getSelectedIndex());
}
private void setSurfaceFromPanel(Surface surface, SurfacePanel panel)

View File

@ -29,6 +29,7 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.filechooser.FileNameExtensionFilter;
@ -149,6 +150,16 @@ public class TrackLightProperties extends PropertyPanel
TrackLight light = lights.elementAt(i);
tabbedPane.addTab(light.getName(), null, new TrackLightPanel(light), null);
}
SwingUtilities.invokeLater( new Runnable()
{
public void run()
{
int lastTab = getEditorFrame().getProject().getPropertiesEditorLightTab();
if (lastTab < tabbedPane.getTabCount())
tabbedPane.setSelectedIndex(lastTab);
}
});
}
return tabbedPane;
}
@ -469,5 +480,7 @@ public class TrackLightProperties extends PropertyPanel
lights.add(light);
}
}
getEditorFrame().getProject().setPropertiesEditorLightTab(this.tabbedPane.getSelectedIndex());
}
} // @jve:decl-index=0:visual-constraint="10,10"

View File

@ -49,6 +49,10 @@ public class Project
private int checkDialogY = 0;
private int checkDialogWidth = 0;
private int checkDialogHeight = 0;
private int propertiesEditorSurfaceTab = 0;
private int propertiesEditorObjectTab = 0;
private int propertiesEditorCameraTab = 0;
private int propertiesEditorLightTab = 0;
public Project()
{
@ -281,4 +285,44 @@ public class Project
{
this.checkDialogHeight = checkDialogHeight;
}
public int getPropertiesEditorSurfaceTab()
{
return propertiesEditorSurfaceTab;
}
public void setPropertiesEditorSurfaceTab(int propertiesEditorSurfaceTab)
{
this.propertiesEditorSurfaceTab = propertiesEditorSurfaceTab;
}
public int getPropertiesEditorObjectTab()
{
return propertiesEditorObjectTab;
}
public void setPropertiesEditorObjectTab(int propertiesEditorObjectTab)
{
this.propertiesEditorObjectTab = propertiesEditorObjectTab;
}
public int getPropertiesEditorCameraTab()
{
return propertiesEditorCameraTab;
}
public void setPropertiesEditorCameraTab(int propertiesEditorCameraTab)
{
this.propertiesEditorCameraTab = propertiesEditorCameraTab;
}
public int getPropertiesEditorLightTab()
{
return propertiesEditorLightTab;
}
public void setPropertiesEditorLightTab(int propertiesEditorLightTab)
{
this.propertiesEditorLightTab = propertiesEditorLightTab;
}
}

View File

@ -34,7 +34,7 @@ public class Properties
private static Properties instance = new Properties();
private Vector<ActionListener> propertiesListeners = new Vector<ActionListener>();
public final String title = "sd2-trackeditor";
public final String version = "1.4.48";
public final String version = "1.4.49";
private String path;
private double imageScale = 1;