[tiled] r599 - in branches/bjorn/src/tiled: io mapeditor/dialogs mapeditor/util util view
svn@biggeruniverse.com
svn at biggeruniverse.com
Sun Apr 9 04:35:05 PDT 2006
Author: bjorn
Date: 2006-04-09 06:35:02 -0500 (Sun, 09 Apr 2006)
New Revision: 599
Modified:
branches/bjorn/src/tiled/io/MapWriter.java
branches/bjorn/src/tiled/mapeditor/dialogs/ConfigurationDialog.java
branches/bjorn/src/tiled/mapeditor/dialogs/TileImageDialog.java
branches/bjorn/src/tiled/mapeditor/util/MapChangeListener.java
branches/bjorn/src/tiled/util/MersenneTwister.java
branches/bjorn/src/tiled/view/HexMapView.java
branches/bjorn/src/tiled/view/IsoMapView.java
branches/bjorn/src/tiled/view/ObliqueMapView.java
branches/bjorn/src/tiled/view/OrthoMapView.java
branches/bjorn/src/tiled/view/ShiftedMapView.java
Log:
Committing some small changes to be merged to trunk.
Modified: branches/bjorn/src/tiled/io/MapWriter.java
===================================================================
--- branches/bjorn/src/tiled/io/MapWriter.java 2006-04-09 10:19:03 UTC (rev 598)
+++ branches/bjorn/src/tiled/io/MapWriter.java 2006-04-09 11:35:02 UTC (rev 599)
@@ -21,7 +21,9 @@
/**
* Used by Tiled to denote a plugin for writing maps. The map file
* can have any format, as long as the MapWriter implementor accepts
- * instances of tiled.core.Map and tiled.core.TileSet.
+ * instances of {@link tiled.core.Map} and {@link TileSet}.
+ *
+ * $Id$
*/
public interface MapWriter extends PluggableMapIO, FileFilter
{
Modified: branches/bjorn/src/tiled/mapeditor/dialogs/ConfigurationDialog.java
===================================================================
--- branches/bjorn/src/tiled/mapeditor/dialogs/ConfigurationDialog.java 2006-04-09 10:19:03 UTC (rev 598)
+++ branches/bjorn/src/tiled/mapeditor/dialogs/ConfigurationDialog.java 2006-04-09 11:35:02 UTC (rev 599)
@@ -44,6 +44,7 @@
private final Preferences ioPrefs = prefs.node("io");
private static final String DIALOG_TITLE = Resources.getString("dialog.preferences.title");
+ private static final String CLOSE_BUTTON = Resources.getString("general.button.close");
public ConfigurationDialog(JFrame parent) {
super(parent, DIALOG_TITLE, true);
@@ -132,8 +133,8 @@
//c.gridx = 1;
//gridOps.add(gridColor, c);
- JButton bClose = new JButton("Close");
- bClose.addActionListener(new ActionListener() {
+ JButton closeButton = new JButton(CLOSE_BUTTON);
+ closeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
dispose();
}
@@ -143,7 +144,7 @@
JPanel buttons = new VerticalStaticJPanel();
buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
buttons.add(Box.createGlue());
- buttons.add(bClose);
+ buttons.add(closeButton);
JPanel saving = new JPanel();
saving.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
@@ -177,7 +178,7 @@
mainPanel.add(buttons);
getContentPane().add(mainPanel);
- getRootPane().setDefaultButton(bClose);
+ getRootPane().setDefaultButton(closeButton);
pack();
// Associate listeners with the configuration widgets
Modified: branches/bjorn/src/tiled/mapeditor/dialogs/TileImageDialog.java
===================================================================
--- branches/bjorn/src/tiled/mapeditor/dialogs/TileImageDialog.java 2006-04-09 10:19:03 UTC (rev 598)
+++ branches/bjorn/src/tiled/mapeditor/dialogs/TileImageDialog.java 2006-04-09 11:35:02 UTC (rev 599)
@@ -5,7 +5,7 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* Adam Turk <aturk at biggeruniverse.com>
* Bjorn Lindeijer <b.lindeijer at xs4all.nl>
* Rainer Deyke <rainerd at eldwood.com>
@@ -41,15 +41,13 @@
private int[] imageIds;
public TileImageDialog(Dialog parent, TileSet set) {
- this(parent, set, 0, 0);
+ this(parent, set, 0);
}
- public TileImageDialog(Dialog parent, TileSet set, int id,
- int orientation) {
+ public TileImageDialog(Dialog parent, TileSet set, int id) {
super(parent, "Choose Tile Image", true);
tileset = set;
imageId = id;
- imageOrientation = orientation;
init();
queryImages();
@@ -127,7 +125,7 @@
for (int i = 0; i < imageIds.length; ++i) {
if (imageIds[i] == imageId) initialIndex = i;
- Image img = tileset.getImageById(Integer.toString(imageIds[i]));
+ Image img = tileset.getImageById(imageIds[i]);
// assert img != null;
listData.add(img);
}
@@ -165,8 +163,7 @@
private void updateImageLabel() {
if (imageId >= 0) {
- Image img = tileset.getImageById(Integer.toString(imageId));
- img = TileSet.generateImageWithOrientation(img, imageOrientation);
+ Image img = tileset.getImageById(imageId);
imageLabel.setIcon(new ImageIcon(img));
}
}
Modified: branches/bjorn/src/tiled/mapeditor/util/MapChangeListener.java
===================================================================
--- branches/bjorn/src/tiled/mapeditor/util/MapChangeListener.java 2006-04-09 10:19:03 UTC (rev 598)
+++ branches/bjorn/src/tiled/mapeditor/util/MapChangeListener.java 2006-04-09 11:35:02 UTC (rev 599)
@@ -14,8 +14,9 @@
import java.util.EventListener;
-
-
+/**
+ * @version $Id$
+ */
public interface MapChangeListener extends EventListener
{
public void mapChanged(MapChangedEvent e);
Modified: branches/bjorn/src/tiled/util/MersenneTwister.java
===================================================================
--- branches/bjorn/src/tiled/util/MersenneTwister.java 2006-04-09 10:19:03 UTC (rev 598)
+++ branches/bjorn/src/tiled/util/MersenneTwister.java 2006-04-09 11:35:02 UTC (rev 599)
@@ -23,8 +23,8 @@
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- 3. The names of its contributors may not be used to endorse or promote
- products derived from this software without specific prior written
+ 3. The names of its contributors may not be used to endorse or promote
+ products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ -54,7 +54,7 @@
public static final int UPPER_MASK = 0x80000000; /* most significant w-r bits */
public static final int LOWER_MASK = 0x7fffffff; /* least significant r bits */
- private long mt[];
+ private long[] mt;
private int mti=N+1; /* mti==N+1 means mt[N] is not initialized */
public MersenneTwister() {
@@ -86,7 +86,7 @@
/* init_key is the array for initializing keys */
/* key_length is its length */
/* slight change for C++, 2004/2/26 */
- public void initByArray(long init_key[], int key_length)
+ public void initByArray(long[] init_key, int key_length)
{
int i, j, k;
initGenRand(19650218);
@@ -108,14 +108,14 @@
if (i>=N) { mt[0] = mt[N-1]; i=1; }
}
- mt[0] = 0x80000000; /* MSB is 1; assuring non-zero initial array */
+ mt[0] = 0x80000000; /* MSB is 1; assuring non-zero initial array */
}
/* generates a random number on [0,0xffffffff]-interval */
public long genrand()
{
int y;
- long mag01[]={0x0, MATRIX_A};
+ long[] mag01={0x0, MATRIX_A};
/* mag01[x] = x * MATRIX_A for x=0,1 */
if (mti >= N) { /* generate N words at one time */
@@ -148,8 +148,8 @@
return y;
}
-
- synchronized protected int next(int bits) {
- return (int)genrand();
- }
+
+ synchronized protected int next(int bits) {
+ return (int)genrand();
+ }
}
Modified: branches/bjorn/src/tiled/view/HexMapView.java
===================================================================
--- branches/bjorn/src/tiled/view/HexMapView.java 2006-04-09 10:19:03 UTC (rev 598)
+++ branches/bjorn/src/tiled/view/HexMapView.java 2006-04-09 11:35:02 UTC (rev 599)
@@ -90,8 +90,8 @@
int wbhc = (int)getWidthBetweenHexCentres();
return new Dimension(
- myMap.getWidth() * wbhc + border + wbhc,
- myMap.getHeight() * tsize.height + border +
+ map.getWidth() * wbhc + border + wbhc,
+ map.getHeight() * tsize.height + border +
tsize.height / 2);
}
@@ -145,13 +145,13 @@
* Hexes.
*/
private double getWidthBetweenHexCentres() {
- return myMap.getTileWidth() * 3 / 4;
+ return map.getTileWidth() * 3 / 4;
}
private Dimension getTileSize(double zoom) {
return new Dimension(
- (int)(myMap.getTileWidth() * zoom),
- (int)(myMap.getTileHeight() * zoom));
+ (int)(map.getTileWidth() * zoom),
+ (int)(map.getTileHeight() * zoom));
}
protected void paintGrid(Graphics2D g2d, double zoom) {
@@ -194,7 +194,7 @@
int x = (int)(screenX / zoom);
int y = (int)(screenY / zoom);
double hexWidth = getWidthBetweenHexCentres();
- double hexHeight = myMap.getTileHeight();
+ double hexHeight = map.getTileHeight();
double tw = hexWidth * 2 / 3;
double cw = hexWidth / 3;
@@ -255,7 +255,7 @@
}
private double getTileHeight() {
- return myMap.getTileHeight();
+ return map.getTileHeight();
}
public void repaintRegion(Rectangle region) {
Modified: branches/bjorn/src/tiled/view/IsoMapView.java
===================================================================
--- branches/bjorn/src/tiled/view/IsoMapView.java 2006-04-09 10:19:03 UTC (rev 598)
+++ branches/bjorn/src/tiled/view/IsoMapView.java 2006-04-09 11:35:02 UTC (rev 599)
@@ -72,7 +72,7 @@
// Determine area to draw from clipping rectangle
int columns = clipRect.width / tileSize.width + 3;
- int rows = (clipRect.height + (int)(myMap.getTileHeightMax() * zoom)) /
+ int rows = (clipRect.height + (int)(map.getTileHeightMax() * zoom)) /
tileStepY + 4;
// Draw this map layer
@@ -127,10 +127,10 @@
int startX = Math.max(0, screenToTileCoords(clipRect.x, clipRect.y).x);
int startY = Math.max(0, screenToTileCoords(
clipRect.x + clipRect.width, clipRect.y).y);
- int endX = Math.min(myMap.getWidth(), screenToTileCoords(
+ int endX = Math.min(map.getWidth(), screenToTileCoords(
clipRect.x + clipRect.width,
clipRect.y + clipRect.height).x);
- int endY = Math.min(myMap.getHeight(), screenToTileCoords(
+ int endY = Math.min(map.getHeight(), screenToTileCoords(
clipRect.x, clipRect.y + clipRect.height).y);
for (int y = startY; y <= endY; y++) {
@@ -170,7 +170,7 @@
Point columnItr = new Point(rowItr);
for (int x = 0; x < columns; x++) {
- if (myMap.contains(columnItr.x, columnItr.y)) {
+ if (map.contains(columnItr.x, columnItr.y)) {
String coords =
"(" + columnItr.x + "," + columnItr.y + ")";
Rectangle2D textSize =
@@ -204,7 +204,7 @@
public void repaintRegion(Rectangle region) {
Dimension tileSize = getTileSize(zoom);
int maxExtraHeight =
- (int)(myMap.getTileHeightMax() * zoom) - tileSize.height;
+ (int)(map.getTileHeightMax() * zoom) - tileSize.height;
int mapX1 = region.x;
int mapY1 = region.y;
@@ -222,7 +222,7 @@
public Dimension getPreferredSize() {
Dimension tileSize = getTileSize(zoom);
int border = (modeFlags & PF_GRIDMODE) != 0 ? 1 : 0;
- int mapSides = myMap.getHeight() + myMap.getWidth();
+ int mapSides = map.getHeight() + map.getWidth();
return new Dimension(
(mapSides * tileSize.width) / 2 + border,
@@ -237,7 +237,7 @@
double r = getTileRatio();
// Translate origin to top-center
- x -= myMap.getHeight() * (tileSize.width / 2);
+ x -= map.getHeight() * (tileSize.width / 2);
int mx = y + (int)(x / r);
int my = y - (int)(x / r);
@@ -264,12 +264,12 @@
protected Dimension getTileSize(double zoom) {
return new Dimension(
- (int)(myMap.getTileWidth() * zoom),
- (int)(myMap.getTileHeight() * zoom));
+ (int)(map.getTileWidth() * zoom),
+ (int)(map.getTileHeight() * zoom));
}
protected double getTileRatio() {
- return (double)myMap.getTileWidth() / (double)myMap.getTileHeight();
+ return (double)map.getTileWidth() / (double)map.getTileHeight();
}
/**
@@ -277,7 +277,7 @@
*/
public Point tileToScreenCoords(double x, double y) {
Dimension tileSize = getTileSize(zoom);
- int originX = (myMap.getHeight() * tileSize.width) / 2;
+ int originX = (map.getHeight() * tileSize.width) / 2;
return new Point(
(int)((x - y) * tileSize.width / 2) + originX,
(int)((x + y) * tileSize.height / 2));
Modified: branches/bjorn/src/tiled/view/ObliqueMapView.java
===================================================================
--- branches/bjorn/src/tiled/view/ObliqueMapView.java 2006-04-09 10:19:03 UTC (rev 598)
+++ branches/bjorn/src/tiled/view/ObliqueMapView.java 2006-04-09 11:35:02 UTC (rev 599)
@@ -20,7 +20,9 @@
import tiled.core.*;
-
+/**
+ * @version $Id$
+ */
public class ObliqueMapView extends MapView
{
/**
Modified: branches/bjorn/src/tiled/view/OrthoMapView.java
===================================================================
--- branches/bjorn/src/tiled/view/OrthoMapView.java 2006-04-09 10:19:03 UTC (rev 598)
+++ branches/bjorn/src/tiled/view/OrthoMapView.java 2006-04-09 11:35:02 UTC (rev 599)
@@ -69,8 +69,8 @@
int border = (modeFlags & PF_GRIDMODE) != 0 ? 1 : 0;
return new Dimension(
- myMap.getWidth() * tsize.width + border,
- myMap.getHeight() * tsize.height + border);
+ map.getWidth() * tsize.width + border,
+ map.getHeight() * tsize.height + border);
}
protected void paintLayer(Graphics2D g2d, TileLayer layer, double zoom) {
@@ -108,8 +108,8 @@
}
}
- protected void paintLayer(Graphics2D g, ObjectGroup layer, double zoom) {
- Iterator itr = layer.getObjects();
+ protected void paintLayer(Graphics2D g, ObjectGroup og, double zoom) {
+ Iterator itr = og.getObjects();
while (itr.hasNext()) {
MapObject mo = (MapObject) itr.next();
@@ -192,7 +192,7 @@
if (tsize.width <= 0 || tsize.height <= 0) return;
int toffset = (modeFlags & PF_GRIDMODE) != 0 ? 1 : 0;
int maxExtraHeight =
- (int)((myMap.getTileHeightMax() * zoom + toffset) - tsize.height);
+ (int)((map.getTileHeightMax() * zoom + toffset) - tsize.height);
// Calculate the visible corners of the region
int startX = region.x * tsize.width + toffset;
@@ -215,8 +215,8 @@
int grid = (modeFlags & PF_GRIDMODE) != 0 ? 1 : 0;
return new Dimension(
- (int)(myMap.getTileWidth() * zoom) + grid,
- (int)(myMap.getTileHeight() * zoom) + grid);
+ (int)(map.getTileWidth() * zoom) + grid,
+ (int)(map.getTileHeight() * zoom) + grid);
}
protected Polygon createGridPolygon(int tx, int ty, int border) {
@@ -233,6 +233,6 @@
public Point tileToScreenCoords(double x, double y) {
Dimension tsize = getTileSize(zoom);
- return new Point((int)x*tsize.width, (int)y*tsize.height);
+ return new Point((int)x * tsize.width, (int)y * tsize.height);
}
}
Modified: branches/bjorn/src/tiled/view/ShiftedMapView.java
===================================================================
--- branches/bjorn/src/tiled/view/ShiftedMapView.java 2006-04-09 10:19:03 UTC (rev 598)
+++ branches/bjorn/src/tiled/view/ShiftedMapView.java 2006-04-09 11:35:02 UTC (rev 599)
@@ -70,8 +70,8 @@
int repeatY = tsize.height - onceY;
return new Dimension(
- myMap.getWidth() * repeatX + onceX + border,
- myMap.getHeight() * repeatY + onceY + border);
+ map.getWidth() * repeatX + onceX + border,
+ map.getHeight() * repeatY + onceY + border);
}
protected void paintLayer(Graphics2D g2d, TileLayer layer, double zoom) {
@@ -127,8 +127,8 @@
protected Dimension getTileSize(double zoom) {
return new Dimension(
- (int)(myMap.getTileWidth() * zoom),
- (int)(myMap.getTileHeight() * zoom));
+ (int)(map.getTileWidth() * zoom),
+ (int)(map.getTileHeight() * zoom));
}
protected Polygon createGridPolygon(int tx, int ty, int border) {
More information about the tiled-commit
mailing list