[tiled] r702 - in trunk: . src/tiled/mapeditor src/tiled/mapeditor/dialogs src/tiled/mapeditor/resources
svn at biggeruniverse.com
svn at biggeruniverse.com
Thu Oct 26 15:02:17 PDT 2006
Author: bjorn
Date: 2006-10-26 17:02:16 -0500 (Thu, 26 Oct 2006)
New Revision: 702
Modified:
trunk/CHANGES
trunk/src/tiled/mapeditor/MapEditor.java
trunk/src/tiled/mapeditor/dialogs/ConfigurationDialog.java
trunk/src/tiled/mapeditor/resources/gui.properties
Log:
Added option to automatically open the last map on startup (by Pedro Miller)
Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES 2006-10-14 20:23:44 UTC (rev 701)
+++ trunk/CHANGES 2006-10-26 22:02:16 UTC (rev 702)
@@ -3,6 +3,7 @@
* Added support for tile instance properties (by Christian Henz)
* Added ability to create stamp brushes from the tile palette
* Added import/export of configuration
+* Added option to automatically open the last map on startup (by Pedro Miller)
* Embedded the tile palette
* Report out of memory error when saving map as image
* Properties table now displays the properties in alphabetical order
Modified: trunk/src/tiled/mapeditor/MapEditor.java
===================================================================
--- trunk/src/tiled/mapeditor/MapEditor.java 2006-10-14 20:23:44 UTC (rev 701)
+++ trunk/src/tiled/mapeditor/MapEditor.java 2006-10-26 22:02:16 UTC (rev 702)
@@ -86,7 +86,7 @@
private final UndoableEditSupport undoSupport;
private final MapEventAdapter mapEventAdapter;
private final PluginClassLoader pluginLoader;
- private final Preferences prefs = TiledConfiguration.root();
+ private static final Preferences prefs = TiledConfiguration.root();
private int currentPointerState;
private Tile currentTile;
@@ -256,7 +256,8 @@
// Make sure the map view is redrawn when grid preferences change.
- // todo: move this functionality out of here somehow, but not back into MapView
+ // todo: move this functionality out of here somehow, but not back into
+ // MapView
final Preferences display = prefs.node("display");
display.addPreferenceChangeListener(new PreferenceChangeListener() {
public void preferenceChange(PreferenceChangeEvent event) {
@@ -2111,5 +2112,15 @@
e.printStackTrace();
}
}
+ else if (prefs.node("io").getBoolean("autoOpenLast", false)) {
+ // Load last map if it still exists
+ java.util.List recent = TiledConfiguration.getRecentFiles();
+ if (recent.size() > 0) {
+ String filename = (String) recent.get(0);
+ if (new File(filename).exists()) {
+ editor.loadMap(filename);
+ }
+ }
+ }
}
}
Modified: trunk/src/tiled/mapeditor/dialogs/ConfigurationDialog.java
===================================================================
--- trunk/src/tiled/mapeditor/dialogs/ConfigurationDialog.java 2006-10-14 20:23:44 UTC (rev 701)
+++ trunk/src/tiled/mapeditor/dialogs/ConfigurationDialog.java 2006-10-26 22:02:16 UTC (rev 702)
@@ -40,9 +40,13 @@
{
private IntegerSpinner undoDepth;
private JSlider gridOpacitySlider;
- private JCheckBox cbBinaryEncode, cbCompressLayerData, cbEmbedImages;
+ private JCheckBox cbBinaryEncode;
+ private JCheckBox cbCompressLayerData;
+ private JCheckBox cbEmbedImages;
private JCheckBox cbReportIOWarnings;
- private JRadioButton rbEmbedInTiles, rbEmbedInSet;
+ private JCheckBox cbAutoOpenLastFile;
+ private JRadioButton rbEmbedInTiles;
+ private JRadioButton rbEmbedInSet;
private JCheckBox cbGridAA;
//private JColorChooser gridColor;
@@ -58,6 +62,7 @@
private static final String COMPRESS_LAYER_DATA_CHECKBOX = Resources.getString("dialog.preferences.compress.layer.data.checkbox");
private static final String EMBED_IMAGES_CHECKBOX = Resources.getString("dialog.preferences.embed.images.checkbox");
private static final String REPORT_IO_WARNINGS_CHECKBOX = Resources.getString("dialog.preferences.report.io.warnings.checkbox");
+ private static final String AUTO_OPEN_LAST_FILE_CHECKBOX = Resources.getString("dialog.preferences.report.io.autoopenlast.checkbox");
private static final String EMBED_IN_TILES_CHECKBOX = Resources.getString("dialog.preferences.embed.in.tiles.checkbox");
private static final String EMBED_IN_SET_CHECKBOX = Resources.getString("dialog.preferences.embed.in.set.checkbox");
private static final String ANTIALIASING_CHECKBOX = Resources.getString("dialog.preferences.antialiasing.checkbox");
@@ -97,6 +102,7 @@
cbCompressLayerData = new JCheckBox(COMPRESS_LAYER_DATA_CHECKBOX);
cbEmbedImages = new JCheckBox(EMBED_IMAGES_CHECKBOX);
cbReportIOWarnings = new JCheckBox(REPORT_IO_WARNINGS_CHECKBOX);
+ cbAutoOpenLastFile = new JCheckBox(AUTO_OPEN_LAST_FILE_CHECKBOX);
rbEmbedInTiles = new JRadioButton(EMBED_IN_TILES_CHECKBOX);
rbEmbedInSet = new JRadioButton(EMBED_IN_SET_CHECKBOX);
ButtonGroup bg = new ButtonGroup();
@@ -139,6 +145,9 @@
c.gridy = 1;
c.gridx = 0;
generalOps.add(cbReportIOWarnings, c);
+ c.gridy = 2;
+ c.gridx = 0;
+ generalOps.add(cbAutoOpenLastFile, c);
/* TILESET OPTIONS */
JPanel tilesetOps = new VerticalStaticJPanel();
@@ -271,6 +280,13 @@
}
});
+ cbAutoOpenLastFile.addItemListener(new ItemListener() {
+ public void itemStateChanged(ItemEvent itemEvent) {
+ ioPrefs.putBoolean("autoOpenLast",
+ cbAutoOpenLastFile.isSelected());
+ }
+ });
+
cbGridAA.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent itemEvent) {
displayPrefs.putBoolean("gridAntialias", cbGridAA.isSelected());
@@ -336,6 +352,7 @@
cbCompressLayerData.setSelected(savingPrefs.getBoolean("layerCompression", true));
cbGridAA.setSelected(displayPrefs.getBoolean("gridAntialias", true));
cbReportIOWarnings.setSelected(ioPrefs.getBoolean("reportWarnings", false));
+ cbAutoOpenLastFile.setSelected(ioPrefs.getBoolean("autoOpenLast", false));
cbCompressLayerData.setEnabled(cbBinaryEncode.isSelected());
rbEmbedInTiles.setEnabled(embedImages);
Modified: trunk/src/tiled/mapeditor/resources/gui.properties
===================================================================
--- trunk/src/tiled/mapeditor/resources/gui.properties 2006-10-14 20:23:44 UTC (rev 701)
+++ trunk/src/tiled/mapeditor/resources/gui.properties 2006-10-26 22:02:16 UTC (rev 702)
@@ -112,6 +112,7 @@
dialog.preferences.layer.options.title=Layer Options
dialog.preferences.opacity.label=Opacity:
dialog.preferences.report.io.warnings.checkbox=Report I/O messages
+dialog.preferences.report.io.autoopenlast.checkbox=Automatically open last file on startup
dialog.preferences.saving.tab=Saving
dialog.preferences.tileset.options.title=Tileset Options
dialog.preferences.title=Preferences
More information about the tiled-commit
mailing list