[tiled] r712 - in trunk: . src/tiled/core src/tiled/io src/tiled/io/xml src/tiled/mapeditor src/tiled/mapeditor/resources
svn at biggeruniverse.com
svn at biggeruniverse.com
Fri Dec 22 20:34:43 PST 2006
Author: aturk
Date: 2006-12-22 22:34:42 -0600 (Fri, 22 Dec 2006)
New Revision: 712
Modified:
trunk/README
trunk/src/tiled/core/TileSet.java
trunk/src/tiled/io/MapHelper.java
trunk/src/tiled/io/xml/XMLMapTransformer.java
trunk/src/tiled/mapeditor/MapEditor.java
trunk/src/tiled/mapeditor/resources/gui.properties
Log:
+ Added extra file checks to Tileset#importTileBitmap(String, TileCutter)
(thanks Hendrik)
+ Added new messages for translation **Translators, we need an update**
(I rearranged some too, so don't be caught off-guard)
Modified: trunk/README
===================================================================
--- trunk/README 2006-12-17 10:26:03 UTC (rev 711)
+++ trunk/README 2006-12-23 04:34:42 UTC (rev 712)
@@ -54,6 +54,7 @@
- Rickard Isaksson for an improved image loader
- Kevin Kelley for the base64 encoder/decoder we use
- GNOME and GIMP for their magnificent icons
-- Nephilim for suggesting layer opacity
+- Nephilim for suggesting layer opacity (our first suggestion)
- Rainer Deyke for useful suggestions and many code contributions
- Jerome Blouin for some meticulous testing
+- Hendrik Brummermann for some clean up
Modified: trunk/src/tiled/core/TileSet.java
===================================================================
--- trunk/src/tiled/core/TileSet.java 2006-12-17 10:26:03 UTC (rev 711)
+++ trunk/src/tiled/core/TileSet.java 2006-12-23 04:34:42 UTC (rev 712)
@@ -20,6 +20,7 @@
import java.util.*;
import javax.imageio.ImageIO;
+import tiled.mapeditor.Resources;
import tiled.mapeditor.util.TransparentImageFilter;
import tiled.mapeditor.util.cutter.BasicTileCutter;
import tiled.mapeditor.util.cutter.TileCutter;
@@ -77,9 +78,19 @@
{
setTilesetImageFilename(imgFilename);
- Image image = ImageIO.read(new File(imgFilename));
+ //some checks on the file before we try to read it
+ File imageFile = new File(imgFilename);
+ if (!imageFile.exists()) {
+ throw new IOException(Resources.getString("general.file.notexists.message") + " (" + tilebmpFile + ")");
+ }
+
+ if (!imageFile.canRead()) {
+ throw new IOException(Resources.getString("general.file.cant.read") + " (" + tilebmpFile + ")");
+ }
+
+ Image image = ImageIO.read(imageFile);
if (image == null) {
- throw new IOException("Failed to load " + tilebmpFile);
+ throw new IOException("Failed to load (" + tilebmpFile + ")");
}
Toolkit tk = Toolkit.getDefaultToolkit();
Modified: trunk/src/tiled/io/MapHelper.java
===================================================================
--- trunk/src/tiled/io/MapHelper.java 2006-12-17 10:26:03 UTC (rev 711)
+++ trunk/src/tiled/io/MapHelper.java 2006-12-23 04:34:42 UTC (rev 712)
@@ -23,6 +23,7 @@
import tiled.core.TileSet;
import tiled.io.xml.XMLMapTransformer;
import tiled.io.xml.XMLMapWriter;
+import tiled.mapeditor.Resources;
import tiled.mapeditor.dialogs.PluginLogDialog;
import tiled.mapeditor.plugin.PluginClassLoader;
import tiled.util.TiledConfiguration;
@@ -35,6 +36,9 @@
public class MapHelper {
private static PluginClassLoader pluginLoader;
+ public static final String ERROR_LOAD_MAP = Resources.getString("general.file.noload.map");
+ public static final String ERROR_LOAD_TILESET = Resources.getString("general.file.noload.tileset");
+
/**
* Called to tell the MapHelper which {@link PluginClassLoader} to use when
* finding a suitable plugin for a filename.
@@ -165,7 +169,7 @@
JOptionPane.showMessageDialog(null,
e.getMessage() + (e.getCause() != null ? "\nCause: " +
e.getCause().getMessage() : ""),
- "Error while loading map",
+ ERROR_LOAD_MAP,
JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
} catch (Exception e) {
@@ -173,7 +177,7 @@
"Error while loading " + file + ": " +
e.getMessage() + (e.getCause() != null ? "\nCause: " +
e.getCause().getMessage() : ""),
- "Error while loading map",
+ ERROR_LOAD_MAP,
JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
}
@@ -215,7 +219,7 @@
JOptionPane.showMessageDialog(null,
e.getMessage() + (e.getCause() != null ? "\nCause: " +
e.getCause().getMessage() : ""),
- "Error while loading tileset",
+ ERROR_LOAD_TILESET,
JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
} catch (Exception e) {
@@ -223,7 +227,7 @@
"Error while loading " + file + ": " +
e.getMessage() + (e.getCause() != null ? "\nCause: " +
e.getCause().getMessage() : ""),
- "Error while loading tileset",
+ ERROR_LOAD_TILESET,
JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
}
Modified: trunk/src/tiled/io/xml/XMLMapTransformer.java
===================================================================
--- trunk/src/tiled/io/xml/XMLMapTransformer.java 2006-12-17 10:26:03 UTC (rev 711)
+++ trunk/src/tiled/io/xml/XMLMapTransformer.java 2006-12-23 04:34:42 UTC (rev 712)
@@ -281,7 +281,7 @@
xmlPath = xmlPathSave;
} catch (SAXException e) {
- logger.error("Failed while loading "+filename+": "+e.getMessage());
+ logger.error("Failed while loading "+filename+": "+e.getLocalizedMessage());
//e.printStackTrace();
}
Modified: trunk/src/tiled/mapeditor/MapEditor.java
===================================================================
--- trunk/src/tiled/mapeditor/MapEditor.java 2006-12-17 10:26:03 UTC (rev 711)
+++ trunk/src/tiled/mapeditor/MapEditor.java 2006-12-23 04:34:42 UTC (rev 712)
@@ -1847,7 +1847,6 @@
}
public void setBrush(String tool, AbstractBrush brush) {
- System.out.println("setting "+tool+" to "+brush);
brushes.put(tool, brush);
}
Modified: trunk/src/tiled/mapeditor/resources/gui.properties
===================================================================
--- trunk/src/tiled/mapeditor/resources/gui.properties 2006-12-17 10:26:03 UTC (rev 711)
+++ trunk/src/tiled/mapeditor/resources/gui.properties 2006-12-23 04:34:42 UTC (rev 712)
@@ -49,6 +49,10 @@
action.select.invert.tooltip=Inverse of the current selection
action.select.none.name=None
action.select.none.tooltip=Cancel selection
+action.tile.create.done.message=Tile created with id {0}
+action.tile.create.done.title=Created Tile
+action.tile.delete.confirm.message=Delete tile?
+action.tile.delete.confirm.title=Are you sure?
action.tileset.remove.error.layer-locked.message=A layer containing tiles used by this tileset is locked,\n it needs to be unlocked before the tileset can be completely removed.
action.tileset.remove.error.title=Error while removing tileset
action.tileset.remove.in-use.message=This tileset is currently in use. Are you sure you wish to remove it?
@@ -153,6 +157,7 @@
dialog.tile.button.deletetile=Delete Tile
dialog.tile.button.duptile=Duplicate Tile
dialog.tile.button.newtile=Add Tile
+dialog.tile.image.load.error=Error loading image
dialog.tile.imgload.error.message=Error while loading image:
dialog.tile.imgload.error.title=Error while loading image
dialog.tile.tab.view=View Tileset
@@ -170,10 +175,13 @@
general.button.ok=OK
general.button.preview=Preview...
general.button.remove=Remove
+general.file.cant.read=Cannot read file
general.file.exists.message=The file already exists. Do you wish to overwrite it?
general.file.exists.title=Overwrite file?
general.file.failed=Failed to load map
-general.file.notexists.message=File does not exist.
+general.file.noload.map=Error while loading map
+general.file.noload.tileset=Error while loading tileset
+general.file.notexists.message=File does not exist
general.file.untitled=Untitled
general.filetype.byextension=By Extension
general.filetype.tiled=Tiled files
@@ -240,8 +248,3 @@
tool.moveobject.name=Move object
tool.paint.name=Paint
tool.select.name=Select
-dialog.tile.image.load.error=Error loading image
-action.tile.delete.confirm.message=Delete tile?
-action.tile.delete.confirm.title=Are you sure?
-action.tile.create.done.message=Tile created with id {0}
-action.tile.create.done.title=Created Tile
More information about the tiled-commit
mailing list