trackeditor: add view default surfaces

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

Former-commit-id: 845666cffe1ac0a2dad644ad5c08064236996671
Former-commit-id: 50a1fde720a9595344aab122ea3a3b064584d2aa
This commit is contained in:
iobyte 2022-08-03 21:52:22 +00:00
parent f3329f116f
commit 95d9b1addf
3 changed files with 73 additions and 7 deletions

View file

@ -155,6 +155,7 @@ public class EditorFrame extends JFrame
private JMenuItem deleteMenuItem = null;
private JMenuItem showArrowsMenuItem = null;
private JMenuItem showBackgroundMenuItem = null;
private JMenuItem defaultSurfacesItem = null;
private JToggleButton moveButton = null;
private JToggleButton showArrowsButton = null;
private JToggleButton showBackgroundButton = null;
@ -681,6 +682,8 @@ public class EditorFrame extends JFrame
viewMenu.add(getShowBackgroundMenuItem());
viewMenu.add(menuItemShoStartPoint);
viewMenu.add(menuItemAddBackground);
viewMenu.addSeparator();
viewMenu.add(getDefaultSurfacesMenuItem());
_splash.incProgress(20);
try
{
@ -993,6 +996,28 @@ public class EditorFrame extends JFrame
return showBackgroundMenuItem;
}
private JMenuItem getDefaultSurfacesMenuItem()
{
if (defaultSurfacesItem == null)
{
defaultSurfacesItem = new JMenuItem("Default Surfaces");
defaultSurfacesItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
defaultSurfacesDialog();
}
});
}
return defaultSurfacesItem;
}
private void defaultSurfacesDialog()
{
DefaultSurfacesDialog surfacesDialog = new DefaultSurfacesDialog(this);
surfacesDialog.setVisible(true);
}
/**
* This method initializes editMenu
*

View file

@ -315,7 +315,7 @@ public class PropertiesDialog extends JDialog
*/
private SurfaceProperties getSurfaceProperties() {
if (surfaceProperties == null) {
surfaceProperties = new SurfaceProperties(editorFrame);
surfaceProperties = new SurfaceProperties(editorFrame, false);
}
return surfaceProperties;
}

View file

@ -45,6 +45,7 @@ import utils.circuit.Surface;
*/
public class SurfaceProperties extends PropertyPanel
{
private Boolean defaultSurfaces = false;
private JButton addSurfaceButton = null;
private JButton deleteSurfaceButton = null;
private JTabbedPane tabbedPane = null;
@ -52,9 +53,10 @@ public class SurfaceProperties extends PropertyPanel
/**
*
*/
public SurfaceProperties(EditorFrame editorFrame)
public SurfaceProperties(EditorFrame editorFrame, Boolean defaultSurfaces)
{
super(editorFrame);
this.defaultSurfaces = defaultSurfaces;
initialize();
}
@ -68,8 +70,11 @@ public class SurfaceProperties extends PropertyPanel
this.setLayout(null);
this.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED));
this.add(getTabbedPane(), null);
this.add(getAddSurfaceButton(), null);
this.add(getDeleteSurfaceButton(), null);
if (!defaultSurfaces)
{
this.add(getAddSurfaceButton(), null);
this.add(getDeleteSurfaceButton(), null);
}
}
/**
@ -140,7 +145,15 @@ public class SurfaceProperties extends PropertyPanel
tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
tabbedPane.setBounds(10, 10, 510, 630);
Vector<Surface> surfaces = getEditorFrame().getTrackData().getSurfaces();
Vector<Surface> surfaces;
if (defaultSurfaces)
{
surfaces = getEditorFrame().getDefaultSurfaces();
}
else
{
surfaces = getEditorFrame().getTrackData().getSurfaces();
}
for (int i = 0; i < surfaces.size(); i++)
{
@ -271,8 +284,36 @@ public class SurfaceProperties extends PropertyPanel
addTextField(this, 20, damageTextField, surface.getDammage(), 190, 100);
addTextField(this, 21, reboundTextField, getString(surface.getRebound()), 190, 100);
add(getTextureNameButton(), null);
add(getRacelineNameButton(), null);
if (defaultSurfaces)
{
nameTextField.setEnabled(false);
colorR1TextField.setEnabled(false);
colorG1TextField.setEnabled(false);
colorB1TextField.setEnabled(false);
colorR2TextField.setEnabled(false);
colorG2TextField.setEnabled(false);
colorB2TextField.setEnabled(false);
textureNameTextField.setEnabled(false);
textureTypeComboBox.setEnabled(false);
textureSizeTextField.setEnabled(false);
textureLinkWithPreviousComboBox.setEnabled(false);
textureStartOnBoundaryComboBox.setEnabled(false);
textureMipMapTextField.setEnabled(false);
frictionTextField.setEnabled(false);
rollingResistanceTextField.setEnabled(false);
bumpNameTextField.setEnabled(false);
bumpSizeTextField.setEnabled(false);
roughnessTextField.setEnabled(false);
roughnessWavelengthTextField.setEnabled(false);
racelineNameTextField.setEnabled(false);
damageTextField.setEnabled(false);
reboundTextField.setEnabled(false);
}
else
{
add(getTextureNameButton(), null);
add(getRacelineNameButton(), null);
}
}
private String getString(double value)