[tiled] r734 - in trunk/src/tiled: io/xml mapeditor/dialogs mapeditor/resources
tiled-svn at biggeruniverse.com
tiled-svn at biggeruniverse.com
Sun Mar 30 14:15:58 PDT 2008
Author: aturk
Date: 2008-03-30 15:15:57 -0600 (Sun, 30 Mar 2008)
New Revision: 734
Modified:
trunk/src/tiled/io/xml/XMLMapWriter.java
trunk/src/tiled/mapeditor/dialogs/ConfigurationDialog.java
trunk/src/tiled/mapeditor/resources/gui.properties
Log:
We chose XML as the map format because it is human-readable (or understandable) so increase the chance of it being understood by including useful comments. (WIP)
Modified: trunk/src/tiled/io/xml/XMLMapWriter.java
===================================================================
--- trunk/src/tiled/io/xml/XMLMapWriter.java 2008-03-23 19:44:39 UTC (rev 733)
+++ trunk/src/tiled/io/xml/XMLMapWriter.java 2008-03-30 21:15:57 UTC (rev 734)
@@ -105,6 +105,7 @@
}
private static void writeMap(Map map, XMLWriter w, String wp) throws IOException {
+ Preferences prefs = TiledConfiguration.node("saving");
w.startElement("map");
w.writeAttribute("version", "0.99b");
@@ -136,6 +137,8 @@
firstgid += tileset.getMaxTileId() + 1;
}
+ if (prefs.getBoolean("encodeLayerData", true) && prefs.getBoolean("usefulComments", true))
+ w.writeComment("Layer data is " + (prefs.getBoolean("layerCompression", true) ? "compressed (GZip)" : "") + " binary data, encoded in Base64");
Iterator ml = map.getLayers();
while (ml.hasNext()) {
MapLayer layer = (MapLayer)ml.next();
Modified: trunk/src/tiled/mapeditor/dialogs/ConfigurationDialog.java
===================================================================
--- trunk/src/tiled/mapeditor/dialogs/ConfigurationDialog.java 2008-03-23 19:44:39 UTC (rev 733)
+++ trunk/src/tiled/mapeditor/dialogs/ConfigurationDialog.java 2008-03-30 21:15:57 UTC (rev 734)
@@ -20,7 +20,6 @@
import java.util.prefs.Preferences;
import java.io.File;
import java.io.FileOutputStream;
-import java.io.InputStream;
import java.io.FileInputStream;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
@@ -42,6 +41,7 @@
private JSlider gridOpacitySlider;
private JCheckBox cbBinaryEncode;
private JCheckBox cbCompressLayerData;
+ private JCheckBox cbUsefulComments;
private JCheckBox cbEmbedImages;
private JCheckBox cbReportIOWarnings;
private JCheckBox cbAutoOpenLastFile;
@@ -60,6 +60,7 @@
private static final String OPACITY_LABEL = Resources.getString("dialog.preferences.opacity.label");
private static final String BINARY_ENCODE_CHECKBOX = Resources.getString("dialog.preferences.binary.encode.checkbox");
private static final String COMPRESS_LAYER_DATA_CHECKBOX = Resources.getString("dialog.preferences.compress.layer.data.checkbox");
+ private static final String USEFUL_COMMENTS_CHECKBOX = Resources.getString("dialog.preferences.useful.comments.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");
@@ -100,6 +101,7 @@
cbBinaryEncode = new JCheckBox(BINARY_ENCODE_CHECKBOX);
cbCompressLayerData = new JCheckBox(COMPRESS_LAYER_DATA_CHECKBOX);
+ cbUsefulComments = new JCheckBox(USEFUL_COMMENTS_CHECKBOX);
cbEmbedImages = new JCheckBox(EMBED_IMAGES_CHECKBOX);
cbReportIOWarnings = new JCheckBox(REPORT_IO_WARNINGS_CHECKBOX);
cbAutoOpenLastFile = new JCheckBox(AUTO_OPEN_LAST_FILE_CHECKBOX);
@@ -128,7 +130,7 @@
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 1; c.gridy = 0; c.weightx = 1;
layerOps.add(cbBinaryEncode, c);
- c.gridy = 1; c.insets = new Insets(0, 10, 0, 0);
+ c.gridy = 2; c.insets = new Insets(0, 10, 0, 0);
layerOps.add(cbCompressLayerData, c);
/* GENERAL OPTIONS */
@@ -148,7 +150,7 @@
c.gridy = 2;
c.gridx = 0;
generalOps.add(cbAutoOpenLastFile, c);
-
+
/* TILESET OPTIONS */
JPanel tilesetOps = new VerticalStaticJPanel();
tilesetOps.setLayout(new GridBagLayout());
@@ -216,6 +218,7 @@
JPanel saving = new JPanel();
saving.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
saving.setLayout(new BoxLayout(saving, BoxLayout.Y_AXIS));
+ saving.add(cbUsefulComments);
saving.add(layerOps);
saving.add(tilesetOps);
@@ -264,6 +267,13 @@
}
});
+ cbUsefulComments.addItemListener(new ItemListener() {
+ public void itemStateChanged(ItemEvent itemEvent) {
+ savingPrefs.putBoolean("usefulComments",
+ cbUsefulComments.isSelected());
+ }
+ });
+
cbEmbedImages.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent itemEvent) {
final boolean embed = cbEmbedImages.isSelected();
Modified: trunk/src/tiled/mapeditor/resources/gui.properties
===================================================================
--- trunk/src/tiled/mapeditor/resources/gui.properties 2008-03-23 19:44:39 UTC (rev 733)
+++ trunk/src/tiled/mapeditor/resources/gui.properties 2008-03-30 21:15:57 UTC (rev 734)
@@ -117,6 +117,7 @@
dialog.preferences.antialiasing.checkbox=Antialiasing
dialog.preferences.binary.encode.checkbox=Use binary encoding
dialog.preferences.compress.layer.data.checkbox=Compress layer data (gzip)
+dialog.preferences.useful.comments.checkbox=Include useful comments in TMX files
dialog.preferences.embed.images.checkbox=Embed images (png)
dialog.preferences.embed.in.set.checkbox=Use Tileset (shared) images
dialog.preferences.embed.in.tiles.checkbox=Embed images in tiles
More information about the tiled-commit
mailing list