From e8fc2c11480a11cb8565fb98f9f12009478965f9 Mon Sep 17 00:00:00 2001 From: iobyte Date: Wed, 3 Aug 2022 22:30:55 +0000 Subject: [PATCH] trackeditor: remember default surfaces dialog last position git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@8363 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 41e7524b1164fbb9ae95ac2197d25037d4d6c5e8 Former-commit-id: 40ad3b2157eb70f2444b5f2b0ec825103ff619a4 --- src/tools/trackeditor/gui/EditorFrame.java | 25 ++++++++++++++++-- src/tools/trackeditor/utils/Project.java | 30 +++++++++++++++++++--- 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/src/tools/trackeditor/gui/EditorFrame.java b/src/tools/trackeditor/gui/EditorFrame.java index e7cd495f8..557cdfe13 100644 --- a/src/tools/trackeditor/gui/EditorFrame.java +++ b/src/tools/trackeditor/gui/EditorFrame.java @@ -198,6 +198,8 @@ public class EditorFrame extends JFrame private final static String SD_DATA_DIRECTORY = "DataDirectory"; private final static String SD_BIN_DIRECTORY = "BinDirectory"; private final static String SD_LIB_DIRECTORY = "LibDirectory"; + + private DefaultSurfacesDialog defaultSurfacesDialog = null; public class NewProjectInfo { @@ -697,6 +699,8 @@ public class EditorFrame extends JFrame getProject().setSegmentEditorY(preferences.getInt("SegmentEditorY", 0)); getProject().setPropertiesEditorX(preferences.getInt("PropertiesEditorX", 0)); getProject().setPropertiesEditorY(preferences.getInt("PropertiesEditorY", 0)); + getProject().setDefaultSurfacesDialogX(preferences.getInt("DefaultSurfacesDialogX", 0)); + getProject().setDefaultSurfacesDialogY(preferences.getInt("DefaultSurfacesDialogY", 0)); } /** @@ -1014,8 +1018,11 @@ public class EditorFrame extends JFrame private void defaultSurfacesDialog() { - DefaultSurfacesDialog surfacesDialog = new DefaultSurfacesDialog(this); - surfacesDialog.setVisible(true); + if (defaultSurfacesDialog == null) + { + defaultSurfacesDialog = new DefaultSurfacesDialog(this); + defaultSurfacesDialog.setVisible(true); + } } /** @@ -2218,6 +2225,13 @@ public class EditorFrame extends JFrame public void exit() { + if (defaultSurfacesDialog != null) + { + getProject().setDefaultSurfacesDialogX(defaultSurfacesDialog.getX()); + getProject().setDefaultSurfacesDialogY(defaultSurfacesDialog.getY()); + defaultSurfacesDialog.setVisible(false); + } + getProject().setFrameX(this.getX()); getProject().setFrameY(this.getY()); @@ -2229,6 +2243,8 @@ public class EditorFrame extends JFrame preferences.putInt("SegmentEditorY", getProject().getSegmentEditorY()); preferences.putInt("PropertiesEditorX", getProject().getPropertiesEditorX()); preferences.putInt("PropertiesEditorY", getProject().getPropertiesEditorY()); + preferences.putInt("DefaultSurfacesDialogX", getProject().getDefaultSurfacesDialogX()); + preferences.putInt("DefaultSurfacesDialogY", getProject().getDefaultSurfacesDialogY()); System.exit(0); } @@ -2305,4 +2321,9 @@ public class EditorFrame extends JFrame } return calculateDeltaButton; } + + public void clearDefaultSurfacesDialog() + { + defaultSurfacesDialog = null; + } } diff --git a/src/tools/trackeditor/utils/Project.java b/src/tools/trackeditor/utils/Project.java index 2b329e5da..e4f365f67 100644 --- a/src/tools/trackeditor/utils/Project.java +++ b/src/tools/trackeditor/utils/Project.java @@ -30,10 +30,12 @@ public class Project { private int frameX = 0; private int frameY = 0; - private int segmentEditorX =0; - private int segmentEditorY =0; - private int propertiesEditorX =0; - private int propertiesEditorY =0; + private int segmentEditorX = 0; + private int segmentEditorY = 0; + private int propertiesEditorX = 0; + private int propertiesEditorY = 0; + private int defaultSurfacesDialogX = 0; + private int defaultSurfacesDialogY = 0; public Project() { @@ -116,4 +118,24 @@ public class Project { this.propertiesEditorY = propertiesEditorY; } + + public int getDefaultSurfacesDialogX() + { + return defaultSurfacesDialogX; + } + + public void setDefaultSurfacesDialogX(int defaultSurfacesDialogX) + { + this.defaultSurfacesDialogX = defaultSurfacesDialogX; + } + + public int getDefaultSurfacesDialogY() + { + return defaultSurfacesDialogY; + } + + public void setDefaultSurfacesDialogY(int defaultSurfacesDialogY) + { + this.defaultSurfacesDialogY = defaultSurfacesDialogY; + } }