[tiled] r698 - in trunk: . plugins/json/src/org/json src/tiled/mapeditor/actions src/tiled/mapeditor/brush src/tiled/mapeditor/util
svn at biggeruniverse.com
svn at biggeruniverse.com
Mon Oct 2 11:37:33 PDT 2006
Author: bjorn
Date: 2006-10-02 13:37:32 -0500 (Mon, 02 Oct 2006)
New Revision: 698
Modified:
trunk/CHANGES
trunk/plugins/json/src/org/json/XMLTokener.java
trunk/src/tiled/mapeditor/actions/OpenMapAction.java
trunk/src/tiled/mapeditor/brush/RandomBrush.java
trunk/src/tiled/mapeditor/brush/ShapeBrush.java
trunk/src/tiled/mapeditor/util/PropertiesTableModel.java
Log:
Worked around an issue with the open file dialog on GNU classpath.
Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES 2006-10-02 10:30:28 UTC (rev 697)
+++ trunk/CHANGES 2006-10-02 18:37:32 UTC (rev 698)
@@ -6,6 +6,7 @@
* Report out of memory error when saving map as image
* Properties table now displays the properties in alphabetical order
* Fixed properties dialog to also save values that were still being edited
+* Worked around an issue with the open file dialog on GNU classpath
0.6.1 - July 15th, 2006
Modified: trunk/plugins/json/src/org/json/XMLTokener.java
===================================================================
--- trunk/plugins/json/src/org/json/XMLTokener.java 2006-10-02 10:30:28 UTC (rev 697)
+++ trunk/plugins/json/src/org/json/XMLTokener.java 2006-10-02 18:37:32 UTC (rev 698)
@@ -11,13 +11,12 @@
* @author JSON.org
* @version 0.1
*/
-public class XMLTokener extends JSONTokener {
-
-
+public class XMLTokener extends JSONTokener
+{
/** The table of entity values. It initially contains Character values for
* amp, apos, gt, lt, quot.
*/
- public static final HashMap entity;
+ private static final HashMap entity;
static {
entity = new HashMap(8);
Modified: trunk/src/tiled/mapeditor/actions/OpenMapAction.java
===================================================================
--- trunk/src/tiled/mapeditor/actions/OpenMapAction.java 2006-10-02 10:30:28 UTC (rev 697)
+++ trunk/src/tiled/mapeditor/actions/OpenMapAction.java 2006-10-02 18:37:32 UTC (rev 698)
@@ -29,9 +29,8 @@
*/
public class OpenMapAction extends AbstractFileAction
{
-
- private static final String OPEN_ERROR_TITLE = Resources.getString("dialog.saveas.error.title");
-
+ private static final String OPEN_ERROR_TITLE = Resources.getString("dialog.saveas.error.title");
+
public OpenMapAction(MapEditor editor, SaveAction saveAction) {
super(editor, saveAction,
Resources.getString("action.map.open.name"),
@@ -42,7 +41,8 @@
protected void doPerformAction() {
//Start at the location of the most recently loaded map file
- String startLocation = TiledConfiguration.node("recent").get("file0", "");
+ String startLocation = TiledConfiguration.node("recent").get("file0",
+ null);
JFileChooser ch = new JFileChooser(startLocation);
Modified: trunk/src/tiled/mapeditor/brush/RandomBrush.java
===================================================================
--- trunk/src/tiled/mapeditor/brush/RandomBrush.java 2006-10-02 10:30:28 UTC (rev 697)
+++ trunk/src/tiled/mapeditor/brush/RandomBrush.java 2006-10-02 18:37:32 UTC (rev 698)
@@ -56,22 +56,23 @@
*
* @see ShapeBrush#doPaint
* @return a Rectangle of the bounds of the area that was modified
- * @param mp The multilayer plane that will be modified
* @param x The x-coordinate where the click occurred.
* @param y The y-coordinate where the click occurred.
*/
public Rectangle doPaint(int x, int y)
{
- Rectangle bounds = shape.getBounds();
- int centerx = x - bounds.width / 2;
- int centery = y - bounds.height / 2;
+ Rectangle shapeBounds = shape.getBounds();
+ int centerx = x - shapeBounds.width / 2;
+ int centery = y - shapeBounds.height / 2;
for (int i = 0; i < numLayers; i++) {
- TileLayer tl = (TileLayer)affectedMp.getLayer(initLayer - i);
+ TileLayer tl = (TileLayer) affectedMp.getLayer(initLayer - i);
if (tl != null) {
- for (int cy = 0; cy <= bounds.height; cy++) {
- for (int cx = 0; cx < bounds.width; cx++) {
- if (shape.contains(cx, cy) && mt.genrand() % 101 <= 100 * ratio) {
+ for (int cy = 0; cy <= shapeBounds.height; cy++) {
+ for (int cx = 0; cx < shapeBounds.width; cx++) {
+ if (shape.contains(cx, cy) &&
+ mt.genrand() % 101 <= 100 * ratio)
+ {
tl.setTileAt(
cx + centerx, cy + centery, paintTile);
}
@@ -80,6 +81,7 @@
}
}
- return new Rectangle(centerx, centery, bounds.width, bounds.height);
+ return new Rectangle(
+ centerx, centery, shapeBounds.width, shapeBounds.height);
}
}
Modified: trunk/src/tiled/mapeditor/brush/ShapeBrush.java
===================================================================
--- trunk/src/tiled/mapeditor/brush/ShapeBrush.java 2006-10-02 10:30:28 UTC (rev 697)
+++ trunk/src/tiled/mapeditor/brush/ShapeBrush.java 2006-10-02 18:37:32 UTC (rev 698)
@@ -66,11 +66,11 @@
public void makePolygonBrush(Polygon p) {
}
- public void setSize(int s) {
+ public void setSize(int size) {
if (shape.isRectangular()) {
- makeQuadBrush(new Rectangle(0, 0, s, s));
+ makeQuadBrush(new Rectangle(0, 0, size, size));
} else if (!shape.isPolygonal()) {
- makeCircleBrush(s/2);
+ makeCircleBrush(size/2);
} else {
// TODO: scale the polygon brush
}
@@ -91,7 +91,7 @@
public Shape getShape() {
return shape;
}
-
+
public boolean isRectangular() {
return shape.isRectangular();
}
@@ -107,11 +107,9 @@
}*/
}
- public boolean equals(Brush b) {
- if (b instanceof ShapeBrush) {
- return ((ShapeBrush)b).shape.equals(shape);
- }
- return false;
+ public boolean equals(Brush brush) {
+ return brush instanceof ShapeBrush &&
+ ((ShapeBrush) brush).shape.equals(shape);
}
public void startPaint(MultilayerPlane mp, int x, int y, int button, int layer) {
@@ -127,19 +125,19 @@
*/
public Rectangle doPaint(int x, int y) throws Exception
{
- Rectangle bounds = shape.getBounds();
- int centerx = x - (bounds.width / 2);
- int centery = y - (bounds.height / 2);
+ Rectangle shapeBounds = shape.getBounds();
+ int centerx = x - shapeBounds.width / 2;
+ int centery = y - shapeBounds.height / 2;
super.doPaint(x, y);
// FIXME: This loop does not take all edges into account
- for(int l = 0; l < numLayers; l++) {
- TileLayer tl = (TileLayer)affectedMp.getLayer(initLayer + l);
+ for (int layer = 0; layer < numLayers; layer++) {
+ TileLayer tl = (TileLayer) affectedMp.getLayer(initLayer + layer);
if (tl != null) {
- for (int i = 0; i <= bounds.height + 1; i++) {
- for (int j = 0; j <= bounds.width + 1; j++) {
+ for (int i = 0; i <= shapeBounds.height + 1; i++) {
+ for (int j = 0; j <= shapeBounds.width + 1; j++) {
if (shape.contains(j, i)) {
tl.setTileAt(j + centerx, i + centery, paintTile);
}
@@ -149,6 +147,7 @@
}
// Return affected area
- return new Rectangle(centerx, centery, bounds.width, bounds.height);
+ return new Rectangle(
+ centerx, centery, shapeBounds.width, shapeBounds.height);
}
}
Modified: trunk/src/tiled/mapeditor/util/PropertiesTableModel.java
===================================================================
--- trunk/src/tiled/mapeditor/util/PropertiesTableModel.java 2006-10-02 10:30:28 UTC (rev 697)
+++ trunk/src/tiled/mapeditor/util/PropertiesTableModel.java 2006-10-02 18:37:32 UTC (rev 698)
@@ -70,12 +70,12 @@
public void setValueAt(Object value, int row, int col) {
if (row >= properties.size() && col == 0) {
if (((String) value).length() > 0) {
- properties.put((String) value, "");
+ properties.put(value, "");
fireTableDataChanged();
}
} else {
if (col == 1) {
- properties.put((String) getValueAt(row, 0), (String) value);
+ properties.put(getValueAt(row, 0), value);
fireTableCellUpdated(row, col);
} else if (col == 0) {
String val = (String) getValueAt(row, 1);
@@ -83,7 +83,7 @@
properties.remove(getValueAt(row, col));
}
if (((String) value).length() > 0) {
- properties.put((String) value, val);
+ properties.put(value, val);
}
fireTableDataChanged();
}
More information about the tiled-commit
mailing list