[tiled] r617 - in trunk/src/tiled: core mapeditor mapeditor/actions mapeditor/brush mapeditor/dialogs mapeditor/resources mapeditor/selection mapeditor/widget view
svn@biggeruniverse.com
svn at biggeruniverse.com
Sun Apr 30 10:21:38 PDT 2006
Author: aturk
Date: 2006-04-30 12:21:38 -0500 (Sun, 30 Apr 2006)
New Revision: 617
Modified:
trunk/src/tiled/core/Map.java
trunk/src/tiled/mapeditor/MapEditor.java
trunk/src/tiled/mapeditor/actions/NewMapAction.java
trunk/src/tiled/mapeditor/actions/OpenMapAction.java
trunk/src/tiled/mapeditor/brush/AbstractBrush.java
trunk/src/tiled/mapeditor/brush/CustomBrush.java
trunk/src/tiled/mapeditor/brush/RandomBrush.java
trunk/src/tiled/mapeditor/brush/ShapeBrush.java
trunk/src/tiled/mapeditor/dialogs/AboutDialog.java
trunk/src/tiled/mapeditor/dialogs/TilePaletteDialog.java
trunk/src/tiled/mapeditor/resources/gui.properties
trunk/src/tiled/mapeditor/resources/gui_de.properties
trunk/src/tiled/mapeditor/resources/gui_it.properties
trunk/src/tiled/mapeditor/resources/gui_nl.properties
trunk/src/tiled/mapeditor/selection/SelectionLayer.java
trunk/src/tiled/mapeditor/widget/BrushBrowser.java
trunk/src/tiled/view/IsoMapView.java
trunk/src/tiled/view/MapView.java
trunk/src/tiled/view/OrthoMapView.java
Log:
Lots of changes ahead of beta release
+ NewMapAction and OpenMapAction actually do the work now
+ Changes to the brushes to make visualization more exact
+ RandomBrush actually works again
+ Fixed TilePaletteDialog showing multiple tilesets at once
+ Internationalization is 90% complete
+ Changed how brushes are visualized
+ Fixed right-click, drag brush creation
+ Brush dialog looks much nicer- you can see the brush shapes again
+ Grid/selection drawing is faster with less needless object creation
for Iso and Ortho views
Modified: trunk/src/tiled/core/Map.java
===================================================================
--- trunk/src/tiled/core/Map.java 2006-04-24 19:34:56 UTC (rev 616)
+++ trunk/src/tiled/core/Map.java 2006-04-30 17:21:38 UTC (rev 617)
@@ -18,6 +18,7 @@
import java.util.Vector;
import javax.swing.event.EventListenerList;
+import tiled.mapeditor.Resources;
import tiled.mapeditor.util.MapChangeListener;
import tiled.mapeditor.util.MapChangedEvent;
@@ -128,7 +129,7 @@
*/
public MapLayer addLayer() {
MapLayer layer = new TileLayer(this, bounds.width, bounds.height);
- layer.setName("Layer " + super.getTotalLayers());
+ layer.setName(Resources.getString("general.layer.layer") + " " + super.getTotalLayers());
super.addLayer(layer);
fireMapChanged();
return layer;
Modified: trunk/src/tiled/mapeditor/MapEditor.java
===================================================================
--- trunk/src/tiled/mapeditor/MapEditor.java 2006-04-24 19:34:56 UTC (rev 616)
+++ trunk/src/tiled/mapeditor/MapEditor.java 2006-04-30 17:21:38 UTC (rev 617)
@@ -70,7 +70,7 @@
private Cursor curMarquee;
/** Current release version. */
- public static final String version = "0.6.0";
+ public static final String version = "0.6.0b";
private Map currentMap;
private MapView mapView;
@@ -83,7 +83,7 @@
private int currentPointerState;
private Tile currentTile;
private int currentLayer = -1;
- private boolean bMouseIsDown;
+ private boolean bMouseIsDown, bMouseIsDragging;
private SelectionLayer cursorHighlight;
private Point mousePressLocation, mouseInitialPressLocation;
private Point moveDist;
@@ -171,11 +171,6 @@
mapEventAdapter = new MapEventAdapter();
- // Create a default brush
- ShapeBrush sb = new ShapeBrush();
- sb.makeQuadBrush(new Rectangle(0, 0, 1, 1));
- setBrush(sb);
-
// Create the actions
saveAction = new SaveAction(this);
saveAsAction = new SaveAsAction(this);
@@ -260,18 +255,18 @@
private void createMenuBar() {
JMenuItem save = new TMenuItem(saveAction);
JMenuItem saveAs = new TMenuItem(saveAsAction);
- JMenuItem saveAsImage = createMenuItem("Save as Image...", null,
- "Save current map as an image", "control shift I");
+ JMenuItem saveAsImage = createMenuItem(Resources.getString("menu.file.image"), null,
+ Resources.getString("menu.file.image.tooltip"), "control shift I");
JMenuItem close = new TMenuItem(new CloseMapAction(this, saveAction));
- recentMenu = new JMenu("Open Recent");
+ recentMenu = new JMenu(Resources.getString("menu.file.recent"));
mapEventAdapter.addListener(save);
mapEventAdapter.addListener(saveAs);
mapEventAdapter.addListener(saveAsImage);
mapEventAdapter.addListener(close);
- JMenu fileMenu = new JMenu("File");
+ JMenu fileMenu = new JMenu(Resources.getString("menu.file"));
fileMenu.add(new TMenuItem(new NewMapAction(this, saveAction)));
fileMenu.add(new TMenuItem(new OpenMapAction(this, saveAction)));
fileMenu.add(recentMenu);
@@ -294,7 +289,7 @@
cutMenuItem.setEnabled(false);
pasteMenuItem.setEnabled(false);
- JMenu transformSub = new JMenu("Transform");
+ JMenu transformSub = new JMenu(Resources.getString("menu.edit.transform"));
transformSub.add(new TMenuItem(rot90Action, true));
transformSub.add(new TMenuItem(rot180Action, true));
transformSub.add(new TMenuItem(rot270Action, true));
@@ -303,7 +298,7 @@
transformSub.add(new TMenuItem(flipVerAction, true));
mapEventAdapter.addListener(transformSub);
- JMenu editMenu = new JMenu("Edit");
+ JMenu editMenu = new JMenu(Resources.getString("menu.edit"));
editMenu.add(undoMenuItem);
editMenu.add(redoMenuItem);
editMenu.addSeparator();
@@ -313,9 +308,10 @@
editMenu.addSeparator();
editMenu.add(transformSub);
editMenu.addSeparator();
- editMenu.add(createMenuItem("Preferences...",
- null, "Configure options of the editor", null));
- editMenu.add(createMenuItem("Brush...", null, "Configure the brush",
+ editMenu.add(createMenuItem(Resources.getString("menu.edit.preferences"),
+ null, Resources.getString("menu.edit.preferences.tooltip"), null));
+ editMenu.add(createMenuItem(Resources.getString("menu.edit.brush"), null,
+ Resources.getString("menu.edit.brush.tooltip"),
"control B"));
mapEventAdapter.addListener(undoMenuItem);
@@ -325,19 +321,21 @@
mapEventAdapter.addListener(pasteMenuItem);
- JMenu mapMenu = new JMenu("Map");
- mapMenu.add(createMenuItem("Resize", null, "Modify map dimensions"));
- mapMenu.add(createMenuItem("Search", null,
- "Search for/Replace tiles"));
+ JMenu mapMenu = new JMenu(Resources.getString("menu.map"));
+ mapMenu.add(createMenuItem(Resources.getString("menu.map.resize"), null,
+ Resources.getString("menu.map.resize.tooltip")));
+ mapMenu.add(createMenuItem(Resources.getString("menu.map.search"), null,
+ Resources.getString("menu.map.search.tooltip")));
mapMenu.addSeparator();
- mapMenu.add(createMenuItem("Properties", null, "Map properties"));
+ mapMenu.add(createMenuItem(Resources.getString("menu.map.properties"), null,
+ Resources.getString("menu.map.properties.tooltip")));
mapEventAdapter.addListener(mapMenu);
JMenuItem layerAdd = new TMenuItem(addLayerAction);
mapEventAdapter.addListener(layerAdd);
- JMenu layerMenu = new JMenu("Layer");
+ JMenu layerMenu = new JMenu(Resources.getString("menu.layer"));
layerMenu.add(layerAdd);
layerMenu.add(new TMenuItem(cloneLayerAction));
layerMenu.add(new TMenuItem(deleteLayerAction));
@@ -348,17 +346,17 @@
layerMenu.add(new TMenuItem(mergeLayerDownAction));
layerMenu.add(new TMenuItem(mergeAllLayersAction));
layerMenu.addSeparator();
- layerMenu.add(createMenuItem("Layer Properties", null,
- "Current layer properties"));
+ layerMenu.add(createMenuItem(Resources.getString("menu.layer.properties"), null,
+ Resources.getString("menu.layer.properties.tooltip")));
- JMenu tilesetMenu = new JMenu("Tilesets");
- tilesetMenu.add(createMenuItem("New Tileset...", null,
- "Add a new internal tileset"));
- tilesetMenu.add(createMenuItem("Import Tileset...", null,
- "Import an external tileset"));
+ JMenu tilesetMenu = new JMenu(Resources.getString("menu.tilesets"));
+ tilesetMenu.add(createMenuItem(Resources.getString("menu.tilesets.new"), null,
+ Resources.getString("menu.tilesets.new.tooltip")));
+ tilesetMenu.add(createMenuItem(Resources.getString("menu.tilesets.import"), null,
+ Resources.getString("menu.tilesets.import.tooltip")));
tilesetMenu.addSeparator();
- tilesetMenu.add(createMenuItem("Tileset Manager", null,
- "Open the tileset manager"));
+ tilesetMenu.add(createMenuItem(Resources.getString("menu.tilesets.manager"), null,
+ Resources.getString("menu.tilesets.manager.tooltip")));
/*
@@ -371,7 +369,7 @@
modifySub.add(createMenuItem("Contract Selection", null, ""));
*/
- JMenu selectMenu = new JMenu("Select");
+ JMenu selectMenu = new JMenu(Resources.getString("menu.select"));
selectMenu.add(new TMenuItem(selectAllAction, true));
selectMenu.add(new TMenuItem(cancelSelectionAction, true));
selectMenu.add(new TMenuItem(inverseAction, true));
@@ -379,34 +377,34 @@
//selectMenu.add(modifySub);
- gridMenuItem = new JCheckBoxMenuItem("Show Grid");
+ gridMenuItem = new JCheckBoxMenuItem(Resources.getString("menu.view.grid"));
gridMenuItem.addActionListener(this);
- gridMenuItem.setToolTipText("Toggle grid");
+ gridMenuItem.setToolTipText(Resources.getString("menu.view.grid.tooltip"));
gridMenuItem.setAccelerator(KeyStroke.getKeyStroke("control G"));
- cursorMenuItem = new JCheckBoxMenuItem("Highlight Cursor");
+ cursorMenuItem = new JCheckBoxMenuItem(Resources.getString("menu.view.cursor"));
cursorMenuItem.setSelected(prefs.getBoolean("cursorhighlight", true));
cursorMenuItem.addActionListener(this);
cursorMenuItem.setToolTipText(
- "Toggle highlighting on-map cursor position");
+ Resources.getString("menu.view.cursor.tooltip"));
- boundaryMenuItem = new JCheckBoxMenuItem("Show Boundaries");
+ boundaryMenuItem = new JCheckBoxMenuItem(Resources.getString("menu.view.boundaries"));
boundaryMenuItem.addActionListener(this);
- boundaryMenuItem.setToolTipText("Toggle layer boundaries");
+ boundaryMenuItem.setToolTipText(Resources.getString("menu.view.boundaries.tooltip"));
boundaryMenuItem.setAccelerator(KeyStroke.getKeyStroke("control E"));
- coordinatesMenuItem = new JCheckBoxMenuItem("Show Coordinates");
+ coordinatesMenuItem = new JCheckBoxMenuItem(Resources.getString("menu.view.coordinates"));
coordinatesMenuItem.addActionListener(this);
- coordinatesMenuItem.setToolTipText("Toggle tile coordinates");
+ coordinatesMenuItem.setToolTipText(Resources.getString("menu.view.coordinates.tooltip"));
- JMenu viewMenu = new JMenu("View");
+ JMenu viewMenu = new JMenu(Resources.getString("menu.view"));
viewMenu.add(new TMenuItem(zoomInAction));
viewMenu.add(new TMenuItem(zoomOutAction));
viewMenu.add(new TMenuItem(zoomNormalAction));
viewMenu.addSeparator();
viewMenu.add(gridMenuItem);
viewMenu.add(cursorMenuItem);
- // TODO: Enable when boudary drawing code finished.
+ //TODO: Enable when boudary drawing code finished.
//viewMenu.add(boundaryMenuItem);
viewMenu.add(coordinatesMenuItem);
@@ -415,10 +413,10 @@
mapEventAdapter.addListener(selectMenu);
mapEventAdapter.addListener(viewMenu);
- JMenu helpMenu = new JMenu("Help");
- helpMenu.add(createMenuItem("About Plug-ins", null,
- "Show plugin window"));
- helpMenu.add(createMenuItem("About Tiled", null, "Show about window"));
+ JMenu helpMenu = new JMenu(Resources.getString("menu.help"));
+ helpMenu.add(createMenuItem(Resources.getString("menu.help.plugins"), null,
+ Resources.getString("menu.help.plugins.tooltip")));
+ helpMenu.add(createMenuItem(Resources.getString("menu.help.about"), null, Resources.getString("menu.help.about.tooltip")));
menuBar = new JMenuBar();
menuBar.add(fileMenu);
@@ -757,7 +755,7 @@
if (layer == null) {
return;
} else if (mouseButton == MouseEvent.BUTTON3) {
- if (layer instanceof TileLayer) {
+ if (layer instanceof TileLayer && !bMouseIsDragging) {
Tile newTile = ((TileLayer)layer).getTileAt(tile.x, tile.y);
setCurrentTile(newTile);
} else if (layer instanceof ObjectGroup) {
@@ -853,6 +851,7 @@
Point tile = mapView.screenToTileCoords(e.getX(), e.getY());
mouseButton = e.getButton();
bMouseIsDown = true;
+ bMouseIsDragging = false;
mousePressLocation = mapView.screenToTileCoords(e.getX(), e.getY());
mouseInitialPressLocation = mousePressLocation;
@@ -885,8 +884,6 @@
}
public void mouseReleased(MouseEvent event) {
- mouseButton = MouseEvent.NOBUTTON;
- bMouseIsDown = false;
MapLayer layer = getCurrentLayer();
Point limp = mouseInitialPressLocation;
@@ -905,7 +902,31 @@
} else if (currentPointerState == PS_PAINT) {
currentBrush.endPaint();
}
+
+
+ //STAMP
+ if (bMouseIsDragging && mouseButton == MouseEvent.BUTTON3 &&
+ getCurrentLayer() instanceof TileLayer &&
+ currentPointerState == PS_PAINT)
+ {
+ Point tile = mapView.screenToTileCoords(event.getX(), event.getY());
+ int minx = Math.min(limp.x, tile.x);
+ int miny = Math.min(limp.y, tile.y);
+ Rectangle bounds = new Rectangle(
+ minx, miny,
+ (Math.max(limp.x, tile.x) - minx)+1,
+ (Math.max(limp.y, tile.y) - miny)+1);
+
+ // Right mouse button dragged: create and set custom brush
+ MultilayerPlane mlp =
+ new MultilayerPlane(bounds.width, bounds.height);
+ TileLayer brushLayer = new TileLayer(bounds);
+ brushLayer.copyFrom(getCurrentLayer());
+ mlp.addLayer(brushLayer);
+ setBrush(new CustomBrush(mlp));
+ }
+
if (paintEdit != null) {
if (layer != null) {
try {
@@ -918,6 +939,10 @@
}
paintEdit = null;
}
+
+ mouseButton = MouseEvent.NOBUTTON;
+ bMouseIsDown = false;
+ bMouseIsDragging = false;
}
public void mouseMoved(MouseEvent e) {
@@ -939,36 +964,10 @@
mousePressLocation = mapView.screenToTileCoords(e.getX(), e.getY());
Point tile = mapView.screenToTileCoords(e.getX(), e.getY());
- if (mouseButton == MouseEvent.BUTTON3 &&
- getCurrentLayer() instanceof TileLayer &&
- currentPointerState == PS_PAINT)
- {
- Point limp = mouseInitialPressLocation;
- int minx = Math.min(limp.x, tile.x);
- int miny = Math.min(limp.y, tile.y);
- /*Rectangle oldArea = null;
+ bMouseIsDragging = true;
+
+ doMouse(e);
- if (currentBrush instanceof CustomBrush) {
- oldArea = currentBrush.getBounds();
- }*/
-
- Rectangle bounds = new Rectangle(
- minx, miny,
- (Math.max(limp.x, tile.x) - minx)+1,
- (Math.max(limp.y, tile.y) - miny)+1);
-
- // Right mouse button dragged: create and set custom brush
- MultilayerPlane mlp =
- new MultilayerPlane(bounds.width, bounds.height);
- TileLayer brushLayer = new TileLayer(bounds);
- brushLayer.copyFrom(getCurrentLayer());
- mlp.addLayer(brushLayer);
- setBrush(new CustomBrush(mlp));
- }
- else {
- doMouse(e);
- }
-
if (currentMap.inBounds(tile.x, tile.y)) {
tileCoordsLabel.setText(String.valueOf(tile.x) + ", " + tile.y);
} else {
@@ -982,14 +981,18 @@
if (prefs.getBoolean("cursorhighlight", true)) {
Rectangle redraw = cursorHighlight.getBounds();
Rectangle brushRedraw = currentBrush.getBounds();
-
+
brushRedraw.x = tile.x - brushRedraw.width / 2;
brushRedraw.y = tile.y - brushRedraw.height / 2;
if (!redraw.equals(brushRedraw)) {
mapView.repaintRegion(redraw);
cursorHighlight.setOffset(brushRedraw.x, brushRedraw.y);
+ //cursorHighlight.selectRegion(currentBrush.getShape());
mapView.repaintRegion(brushRedraw);
+ /*if(currentBrush instanceof CustomBrush) {
+ mapView.paintSubMap(currentBrush, null, 0.5f);
+ }*/
}
}
}
@@ -1026,15 +1029,15 @@
}
}
- // Todo: Most if not all of the below should be moved into action objects,
- // Todo: and properly internationalized.
+ // TODO: Most if not all of the below should be moved into action objects,
+ // TODO: and properly internationalized.
private void handleEvent(ActionEvent event) {
String command = event.getActionCommand();
- if (command.equals("Brush...")) {
+ if (command.equals(Resources.getString("menu.edit.brush"))) {
BrushDialog bd = new BrushDialog(this, appFrame, currentBrush);
bd.setVisible(true);
- } else if (command.equals("New Tileset...")) {
+ } else if (command.equals(Resources.getString("menu.tilesets.new"))) {
if (currentMap != null) {
NewTilesetDialog dialog =
new NewTilesetDialog(appFrame, currentMap);
@@ -1043,7 +1046,7 @@
currentMap.addTileset(newSet);
}
}
- } else if (command.equals("Import Tileset...")) {
+ } else if (command.equals(Resources.getString("menu.tilesets.import"))) {
if (currentMap != null) {
JFileChooser ch = new JFileChooser(currentMap.getFilename());
MapReader[] readers = pluginLoader.getReaders();
@@ -1071,51 +1074,51 @@
}
}
}
- } else if (command.equals("Tileset Manager")) {
+ } else if (command.equals(Resources.getString("menu.tilesets.manager"))) {
if (currentMap != null) {
TilesetManager manager = new TilesetManager(appFrame, currentMap);
manager.setVisible(true);
}
- } else if (command.equals("Save as Image...")) {
+ } else if (command.equals(Resources.getString("menu.file.image"))) {
if (currentMap != null) {
saveMapImage(null);
}
- } else if (command.equals("Properties")) {
+ } else if (command.equals(Resources.getString("menu.map.properties"))) {
PropertiesDialog pd = new PropertiesDialog(appFrame,
currentMap.getProperties());
pd.setTitle(Resources.getString("dialog.properties.map.title"));
pd.getProps();
- } else if (command.equals("Layer Properties")) {
+ } else if (command.equals(Resources.getString("menu.layer.properties"))) {
MapLayer layer = getCurrentLayer();
PropertiesDialog lpd =
new PropertiesDialog(appFrame, layer.getProperties());
- lpd.setTitle(layer.getName() + " Properties");
+ lpd.setTitle(layer.getName() + " " + Resources.getString("dialog.properties.title"));
lpd.getProps();
- } else if (command.equals("Show Boundaries") ||
+ } else if (command.equals(Resources.getString("menu.view.boundaries")) ||
command.equals("Hide Boundaries")) {
mapView.toggleMode(MapView.PF_BOUNDARYMODE);
- } else if (command.equals("Show Grid")) {
+ } else if (command.equals(Resources.getString("menu.view.grid"))) {
// Toggle grid
mapView.toggleMode(MapView.PF_GRIDMODE);
- } else if (command.equals("Show Coordinates")) {
+ } else if (command.equals(Resources.getString("menu.view.coordinates"))) {
// Toggle coordinates
mapView.toggleMode(MapView.PF_COORDINATES);
mapView.repaint();
- } else if (command.equals("Highlight Cursor")) {
+ } else if (command.equals(Resources.getString("menu.view.cursor"))) {
prefs.putBoolean("cursorhighlight", cursorMenuItem.isSelected());
cursorHighlight.setVisible(cursorMenuItem.isSelected());
- } else if (command.equals("Resize")) {
+ } else if (command.equals(Resources.getString("menu.map.resize"))) {
ResizeDialog rd = new ResizeDialog(appFrame, this);
rd.setVisible(true);
- } else if (command.equals("Search")) {
+ } else if (command.equals(Resources.getString("menu.map.search"))) {
SearchDialog sd = new SearchDialog(appFrame, currentMap);
sd.setVisible(true);
- } else if (command.equals("About Tiled")) {
+ } else if (command.equals(Resources.getString("menu.help.about"))) {
if (aboutDialog == null) {
aboutDialog = new AboutDialog(appFrame);
}
aboutDialog.setVisible(true);
- } else if (command.equals("About Plug-ins")) {
+ } else if (command.equals(Resources.getString("menu.help.plugins"))) {
PluginDialog pluginDialog =
new PluginDialog(appFrame, pluginLoader);
pluginDialog.setVisible(true);
@@ -1125,7 +1128,7 @@
if (file.length() > 0) {
loadMap(file);
}
- } else if (command.equals("Preferences...")) {
+ } else if (command.equals(Resources.getString("menu.edit.preferences"))) {
ConfigurationDialog d = new ConfigurationDialog(appFrame);
d.configure();
} else {
@@ -1207,8 +1210,8 @@
private class UndoAction extends AbstractAction {
public UndoAction() {
- super("Undo");
- putValue(SHORT_DESCRIPTION, "Undo one action");
+ super(Resources.getString("action.history.undo.name"));
+ putValue(SHORT_DESCRIPTION, Resources.getString("action.history.undo.tooltip"));
putValue(ACCELERATOR_KEY,
KeyStroke.getKeyStroke("control Z"));
}
@@ -1221,8 +1224,8 @@
private class RedoAction extends AbstractAction {
public RedoAction() {
- super("Redo");
- putValue(SHORT_DESCRIPTION, "Redo one action");
+ super(Resources.getString("action.history.redo.name"));
+ putValue(SHORT_DESCRIPTION, Resources.getString("action.history.redo.tooltip"));
putValue(ACCELERATOR_KEY,
KeyStroke.getKeyStroke("control Y"));
}
@@ -1239,35 +1242,35 @@
this.transform = transform;
switch (transform) {
case MapLayer.ROTATE_90:
- putValue(NAME, "Rotate 90 degrees CW");
+ putValue(NAME, Resources.getString("action.layer.transform.rotate90.name"));
putValue(SHORT_DESCRIPTION,
- "Rotate layer 90 degrees clockwise");
+ Resources.getString("action.layer.transform.rotate90.tooltip"));
putValue(SMALL_ICON,
Resources.getIcon("gimp-rotate-90-16.png"));
break;
case MapLayer.ROTATE_180:
- putValue(NAME, "Rotate 180 degrees CW");
+ putValue(NAME, Resources.getString("action.layer.transform.rotate180.name"));
putValue(SHORT_DESCRIPTION,
- "Rotate layer 180 degrees clockwise");
+ Resources.getString("action.layer.transform.rotate180.tooltip"));
putValue(SMALL_ICON,
Resources.getIcon("gimp-rotate-180-16.png"));
break;
case MapLayer.ROTATE_270:
- putValue(NAME, "Rotate 90 degrees CCW");
+ putValue(NAME, Resources.getString("action.layer.transform.rotate270.name"));
putValue(SHORT_DESCRIPTION,
- "Rotate layer 90 degrees counterclockwise");
+ Resources.getString("action.layer.transform.rotate270.tooltip"));
putValue(SMALL_ICON,
Resources.getIcon("gimp-rotate-270-16.png"));
break;
case MapLayer.MIRROR_VERTICAL:
- putValue(NAME, "Flip vertically");
- putValue(SHORT_DESCRIPTION, "Flip layer vertically");
+ putValue(NAME, Resources.getString("action.layer.transform.vertical.name"));
+ putValue(SHORT_DESCRIPTION, Resources.getString("action.layer.transform.vertical.tooltip"));
putValue(SMALL_ICON,
Resources.getIcon("gimp-flip-vertical-16.png"));
break;
case MapLayer.MIRROR_HORIZONTAL:
- putValue(NAME, "Flip horizontally");
- putValue(SHORT_DESCRIPTION, "Flip layer horizontally");
+ putValue(NAME, Resources.getString("action.layer.transform.horizontal.name"));
+ putValue(SHORT_DESCRIPTION, Resources.getString("action.layer.transform.horizontal.tooltip"));
putValue(SMALL_ICON,
Resources.getIcon("gimp-flip-horizontal-16.png"));
break;
@@ -1518,7 +1521,7 @@
if (currentMap != null && clipboardLayer != null) {
Vector layersBefore = currentMap.getLayerVector();
MapLayer ml = createLayerCopy(clipboardLayer);
- ml.setName("Layer " + currentMap.getTotalLayers());
+ ml.setName(Resources.getString("general.layer.layer")+" " + currentMap.getTotalLayers());
currentMap.addLayer(ml);
undoSupport.postEdit(
new MapLayerStateEdit(currentMap, layersBefore,
@@ -1593,6 +1596,20 @@
public void setBrush(AbstractBrush b) {
currentBrush = b;
+
+ Rectangle brushRedraw = currentBrush.getBounds();
+
+ //make sure it's clean
+ cursorHighlight.setOffset(0,0);
+
+ //resize and select the region
+ cursorHighlight.resize(brushRedraw.width, brushRedraw.height,0,0);
+ cursorHighlight.selectRegion(currentBrush.getShape());
+ /*if(currentBrush instanceof CustomBrush) {
+ cursorHighlight.setVisible(false);
+ } else {
+ cursorHighlight.setVisible(true);
+ }*/
}
public void updateTitle() {
@@ -1647,7 +1664,7 @@
return true;
} else {
JOptionPane.showMessageDialog(appFrame,
- "Unsupported map format",
+ Resources.getString("general.file.failed"),
Resources.getString("dialog.openmap.error.title"),
JOptionPane.ERROR_MESSAGE);
}
@@ -1707,46 +1724,6 @@
}
}
- public void openMap() {
- // Start at the location of the most recently loaded map file
- String startLocation = prefs.node("recent").get("file0", "");
-
- JFileChooser ch = new JFileChooser(startLocation);
-
- try {
- MapReader[] readers = pluginLoader.getReaders();
- for(int i = 0; i < readers.length; i++) {
- ch.addChoosableFileFilter(new TiledFileFilter(
- readers[i].getFilter(), readers[i].getName()));
- }
- } catch (Exception e) {
- JOptionPane.showMessageDialog(appFrame,
- "Error while loading plugins: " + e.getMessage(),
- "Error while loading map",
- JOptionPane.ERROR_MESSAGE);
- e.printStackTrace();
- }
-
- ch.addChoosableFileFilter(
- new TiledFileFilter(TiledFileFilter.FILTER_TMX));
-
- int ret = ch.showOpenDialog(appFrame);
- if (ret == JFileChooser.APPROVE_OPTION) {
- loadMap(ch.getSelectedFile().getAbsolutePath());
- }
- }
-
- /**
- * Opens the new map dialog, allowing the user to start editing a new map.
- */
- public void newMap() {
- NewMapDialog nmd = new NewMapDialog(appFrame);
- Map newMap = nmd.create();
- if (newMap != null) {
- setCurrentMap(newMap);
- }
- }
-
private static MapLayer createLayerCopy(MapLayer layer) {
if (layer instanceof TileLayer) {
return new TileLayer((TileLayer)layer);
@@ -1781,6 +1758,11 @@
currentMap = newMap;
boolean mapLoaded = currentMap != null;
+ //Create a default brush (protect against a bug with custom brushes)
+ ShapeBrush sb = new ShapeBrush();
+ sb.makeQuadBrush(new Rectangle(0, 0, 1, 1));
+ setBrush(sb);
+
if (!mapLoaded) {
mapEventAdapter.fireEvent(MapEventAdapter.ME_MAPINACTIVE);
mapView = null;
@@ -1810,7 +1792,7 @@
gridMenuItem.setState(mapView.getMode(MapView.PF_GRIDMODE));
coordinatesMenuItem.setState(
mapView.getMode(MapView.PF_COORDINATES));
-
+
Vector tilesets = currentMap.getTilesets();
if (!tilesets.isEmpty()) {
tilePalettePanel.setTilesets(tilesets);
@@ -1846,7 +1828,7 @@
miniMap.setView(MapView.createViewforMap(currentMap));
}
*/
-
+
if (currentMap != null) {
currentMap.addLayerSpecial(cursorHighlight);
}
Modified: trunk/src/tiled/mapeditor/actions/NewMapAction.java
===================================================================
--- trunk/src/tiled/mapeditor/actions/NewMapAction.java 2006-04-24 19:34:56 UTC (rev 616)
+++ trunk/src/tiled/mapeditor/actions/NewMapAction.java 2006-04-30 17:21:38 UTC (rev 617)
@@ -12,10 +12,13 @@
package tiled.mapeditor.actions;
+import javax.swing.JFrame;
import javax.swing.KeyStroke;
+import tiled.core.Map;
import tiled.mapeditor.MapEditor;
import tiled.mapeditor.Resources;
+import tiled.mapeditor.dialogs.NewMapDialog;
/**
* Creates a new map.
@@ -33,6 +36,10 @@
}
protected void doPerformAction() {
- editor.newMap();
+ NewMapDialog nmd = new NewMapDialog((JFrame)editor.getAppFrame());
+ Map newMap = nmd.create();
+ if (newMap != null) {
+ editor.setCurrentMap(newMap);
+ }
}
}
Modified: trunk/src/tiled/mapeditor/actions/OpenMapAction.java
===================================================================
--- trunk/src/tiled/mapeditor/actions/OpenMapAction.java 2006-04-24 19:34:56 UTC (rev 616)
+++ trunk/src/tiled/mapeditor/actions/OpenMapAction.java 2006-04-30 17:21:38 UTC (rev 617)
@@ -12,10 +12,15 @@
package tiled.mapeditor.actions;
+import javax.swing.JFileChooser;
+import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
+import tiled.io.MapReader;
import tiled.mapeditor.MapEditor;
import tiled.mapeditor.Resources;
+import tiled.mapeditor.util.TiledFileFilter;
+import tiled.util.TiledConfiguration;
/**
* Opens the map open dialog.
@@ -24,6 +29,9 @@
*/
public class OpenMapAction extends AbstractFileAction
{
+
+ 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"),
@@ -33,6 +41,31 @@
}
protected void doPerformAction() {
- editor.openMap();
+ //Start at the location of the most recently loaded map file
+ String startLocation = TiledConfiguration.node("recent").get("file0", "");
+
+ JFileChooser ch = new JFileChooser(startLocation);
+
+ try {
+ MapReader[] readers = editor.getPluginLoader().getReaders();
+ for(int i = 0; i < readers.length; i++) {
+ ch.addChoosableFileFilter(new TiledFileFilter(
+ readers[i].getFilter(), readers[i].getName()));
+ }
+ } catch (Exception e) {
+ JOptionPane.showMessageDialog(editor.getAppFrame(),
+ "Error while loading plugins: " + e.getLocalizedMessage(),
+ OPEN_ERROR_TITLE,
+ JOptionPane.ERROR_MESSAGE);
+ e.printStackTrace();
+ }
+
+ ch.addChoosableFileFilter(
+ new TiledFileFilter(TiledFileFilter.FILTER_TMX));
+
+ int ret = ch.showOpenDialog(editor.getAppFrame());
+ if (ret == JFileChooser.APPROVE_OPTION) {
+ editor.loadMap(ch.getSelectedFile().getAbsolutePath());
+ }
}
}
Modified: trunk/src/tiled/mapeditor/brush/AbstractBrush.java
===================================================================
--- trunk/src/tiled/mapeditor/brush/AbstractBrush.java 2006-04-24 19:34:56 UTC (rev 616)
+++ trunk/src/tiled/mapeditor/brush/AbstractBrush.java 2006-04-30 17:21:38 UTC (rev 617)
@@ -14,6 +14,7 @@
import java.awt.Graphics2D;
import java.awt.Rectangle;
+import java.awt.Shape;
import tiled.core.MultilayerPlane;
import tiled.view.MapView;
@@ -69,4 +70,6 @@
sy = y;
drawPreview(g2d, mv);
}
+
+ public abstract Shape getShape();
}
Modified: trunk/src/tiled/mapeditor/brush/CustomBrush.java
===================================================================
--- trunk/src/tiled/mapeditor/brush/CustomBrush.java 2006-04-24 19:34:56 UTC (rev 616)
+++ trunk/src/tiled/mapeditor/brush/CustomBrush.java 2006-04-30 17:21:38 UTC (rev 617)
@@ -14,6 +14,7 @@
import java.awt.Graphics2D;
import java.awt.Rectangle;
+import java.awt.Shape;
import java.util.ListIterator;
import tiled.core.MultilayerPlane;
@@ -41,6 +42,10 @@
return getTotalLayers();
}
+ public Shape getShape() {
+ return getBounds();
+ }
+
/**
* Determines whether this brush is equal to another brush.
*/
Modified: trunk/src/tiled/mapeditor/brush/RandomBrush.java
===================================================================
--- trunk/src/tiled/mapeditor/brush/RandomBrush.java 2006-04-24 19:34:56 UTC (rev 616)
+++ trunk/src/tiled/mapeditor/brush/RandomBrush.java 2006-04-30 17:21:38 UTC (rev 617)
@@ -54,21 +54,20 @@
* is a random number, to determine if a specific tile should be
* painted or not
*
- * @see ShapeBrush#commitPaint
+ * @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 commitPaint(MultilayerPlane mp, int x, int y,
- int initLayer)
+ public Rectangle doPaint(int x, int y)
{
Rectangle bounds = shape.getBounds();
int centerx = x - bounds.width / 2;
int centery = y - bounds.height / 2;
for (int i = 0; i < numLayers; i++) {
- TileLayer tl = (TileLayer)mp.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++) {
Modified: trunk/src/tiled/mapeditor/brush/ShapeBrush.java
===================================================================
--- trunk/src/tiled/mapeditor/brush/ShapeBrush.java 2006-04-24 19:34:56 UTC (rev 616)
+++ trunk/src/tiled/mapeditor/brush/ShapeBrush.java 2006-04-30 17:21:38 UTC (rev 617)
@@ -88,18 +88,23 @@
return shape.getBounds();
}
+ public Shape getShape() {
+ return shape;
+ }
+
public boolean isRectangular() {
return shape.isRectangular();
}
public void drawPreview(Graphics2D g2d, MapView mv) {
- if (shape.isRectangular()) {
+ g2d.fill(shape);
+ /*if (shape.isRectangular()) {
Rectangle bounds = shape.getBounds();
g2d.fillRect(sx, sy, bounds.width, bounds.height);
} else if (!shape.isPolygonal()) {
Rectangle bounds = shape.getBounds();
g2d.fillOval(sx, sy, bounds.width, bounds.height);
- }
+ }*/
}
public boolean equals(Brush b) {
Modified: trunk/src/tiled/mapeditor/dialogs/AboutDialog.java
===================================================================
--- trunk/src/tiled/mapeditor/dialogs/AboutDialog.java 2006-04-24 19:34:56 UTC (rev 616)
+++ trunk/src/tiled/mapeditor/dialogs/AboutDialog.java 2006-04-30 17:21:38 UTC (rev 617)
@@ -32,7 +32,7 @@
private final JFrame parent;
public AboutDialog(JFrame parent) {
- super(parent, "Tiled v" + MapEditor.version);
+ super(parent, Resources.getString("dialog.main.title") + " v" + MapEditor.version);
this.parent = parent;
Modified: trunk/src/tiled/mapeditor/dialogs/TilePaletteDialog.java
===================================================================
--- trunk/src/tiled/mapeditor/dialogs/TilePaletteDialog.java 2006-04-24 19:34:56 UTC (rev 616)
+++ trunk/src/tiled/mapeditor/dialogs/TilePaletteDialog.java 2006-04-30 17:21:38 UTC (rev 617)
@@ -55,9 +55,10 @@
currentMap = map;
if (currentMap != null) {
tilesets = currentMap.getTilesets();
+ pc.setTilesets(tilesets);
+ sets.setListData(tilesets);
+ sets.setSelectedIndex(0);
}
- pc.setTilesets(tilesets);
- sets.setListData(tilesets);
}
private void init() {
Modified: trunk/src/tiled/mapeditor/resources/gui.properties
===================================================================
--- trunk/src/tiled/mapeditor/resources/gui.properties 2006-04-24 19:34:56 UTC (rev 616)
+++ trunk/src/tiled/mapeditor/resources/gui.properties 2006-04-30 17:21:38 UTC (rev 617)
@@ -2,6 +2,10 @@
action.copy.tooltip=Copy to clipboard
action.cut.name=Cut
action.cut.tooltip=Cut to clipboard
+action.history.undo.name=Undo
+action.history.undo.tooltip=Undo one action
+action.history.redo.name=Redo
+action.history.redo.tooltip=Redo one action
action.layer.add.name=Add Layer
action.layer.add.tooltip=Add a layer
action.layer.delete.name=Delete Layer
@@ -17,6 +21,16 @@
action.layer.movedown.tooltip=Move layer down one in layer stack
action.layer.moveup.name=Move Layer Up
action.layer.moveup.tooltip=Move layer up one in layer stack
+action.layer.transform.rotate90.name=Rotate 90 degrees CW
+action.layer.transform.rotate90.tooltip=Rotate layer 90 degrees clockwise
+action.layer.transform.rotate180.name=Rotate 180 degrees CW
+action.layer.transform.rotate180.tooltip=Rotate layer 180 degrees clockwise
+action.layer.transform.rotate270.name=Rotate 90 degrees CCW
+action.layer.transform.rotate270.tooltip=Rotate layer 90 degrees counterclockwise
+action.layer.transform.vertical.name=Flip vertically
+action.layer.transform.vertical.tooltip=Flip layer vertically
+action.layer.transform.horizontal.name=Flip horizontally
+action.layer.transform.horizontal.tooltip=Flip layer horizontally
action.main.exit.name=Exit
action.main.exit.tooltip=Exit the map editor
action.map.close.name=Close
@@ -118,8 +132,10 @@
general.button.preview=Preview...
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.untitled=Untitled
+general.layer.layer=LayerResources.getString("menu.tilesets")
general.maptype.hexagonal=Hexagonal (experimental)
general.maptype.isometric=Isometric
general.maptype.oblique=Oblique
@@ -129,3 +145,45 @@
general.tile.tile=Tile
general.tile.tiles=Tiles
general.tile.tileset=Tileset
+menu.edit=Edit
+menu.edit.brush=Brush...
+menu.edit.brush.tooltip=Configure the brush
+menu.edit.preferences=Preferences...
+menu.edit.preferences.tooltip=Configure options of the editor
+menu.edit.transform=Transform
+menu.file=File
+menu.file.image=Save as Image...
+menu.file.image.tooltip=Save current map as an image
+menu.file.recent=Open Recent
+menu.help=Help
+menu.help.about=About Tiled
+menu.help.about.tooltip=Show about window
+menu.help.plugins=About Plug-ins
+menu.help.plugins.tooltip=Show plugin window
+menu.layer=Layer
+menu.layer.properties=Layer Properties
+menu.layer.properties.tooltip=Current layer properties
+menu.map=Map
+menu.map.properties=Properties
+menu.map.properties.tooltip=Map properties
+menu.map.resize=Resize
+menu.map.resize.tooltip=Modify map dimensions
+menu.map.search=Search
+menu.map.search.tooltip=Search for/Replace tiles
+menu.select=Select
+menu.tilesets=Tilesets
+menu.tilesets.import=Import Tileset...
+menu.tilesets.import.tooltip=Import an external tileset
+menu.tilesets.manager=Tileset Manager
+menu.tilesets.manager.tooltip=Open the tileset manager
+menu.tilesets.new=New Tileset...
+menu.tilesets.new.tooltip=Add a new internal tileset
+menu.view=View
+menu.view.boundaries=Show Boundaries
+menu.view.boundaries.tooltip=Toggle layer boundaries
+menu.view.coordinates=Show Coordinates
+menu.view.coordinates.tooltip=Toggle tile coordinates
+menu.view.cursor=Highlight Cursor
+menu.view.cursor.tooltip=Toggle highlighting on-map cursor position
+menu.view.grid=Show Grid
+menu.view.grid.tooltip=Toggle grid
\ No newline at end of file
Modified: trunk/src/tiled/mapeditor/resources/gui_de.properties
===================================================================
--- trunk/src/tiled/mapeditor/resources/gui_de.properties 2006-04-24 19:34:56 UTC (rev 616)
+++ trunk/src/tiled/mapeditor/resources/gui_de.properties 2006-04-30 17:21:38 UTC (rev 617)
@@ -57,6 +57,7 @@
general.file.exists.message=Die Datei existiert bereits. Überschreiben?
general.file.notexists.message=Datei existiert nicht.
general.file.untitled=Ohne Titel
+general.layer.layer=Ebene
general.maptype.hexagonal=Hexagonal (experimentell)
general.maptype.isometric=Isometrisch
general.maptype.oblique=Schräg
Modified: trunk/src/tiled/mapeditor/resources/gui_it.properties
===================================================================
--- trunk/src/tiled/mapeditor/resources/gui_it.properties 2006-04-24 19:34:56 UTC (rev 616)
+++ trunk/src/tiled/mapeditor/resources/gui_it.properties 2006-04-30 17:21:38 UTC (rev 617)
@@ -57,6 +57,7 @@
general.file.exists.message=Il file esiste già. Si desidera sovrascriverlo?
general.file.notexists.message=Il file non esiste
general.file.untitled=Senza titolo
+general.layer.layer=Livello
general.maptype.hexagonal=Esagonale (sperimentale)
general.maptype.isometric=Isometrica
general.maptype.oblique=Obliqua
Modified: trunk/src/tiled/mapeditor/resources/gui_nl.properties
===================================================================
--- trunk/src/tiled/mapeditor/resources/gui_nl.properties 2006-04-24 19:34:56 UTC (rev 616)
+++ trunk/src/tiled/mapeditor/resources/gui_nl.properties 2006-04-30 17:21:38 UTC (rev 617)
@@ -119,6 +119,7 @@
general.file.exists.title=Bestand overschrijven?
general.file.notexists.message=Bestand bestaat niet.
general.file.untitled=Naamloos
+general.layer.layer=Laag
general.maptype.hexagonal=Hexagonaal (experimenteel)
general.maptype.isometric=Isometrisch
general.maptype.oblique=Schuin
Modified: trunk/src/tiled/mapeditor/selection/SelectionLayer.java
===================================================================
--- trunk/src/tiled/mapeditor/selection/SelectionLayer.java 2006-04-24 19:34:56 UTC (rev 616)
+++ trunk/src/tiled/mapeditor/selection/SelectionLayer.java 2006-04-30 17:21:38 UTC (rev 617)
@@ -14,6 +14,7 @@
import java.awt.Color;
import java.awt.Rectangle;
+import java.awt.Shape;
import java.awt.geom.Area;
import java.awt.geom.Rectangle2D;
import java.util.prefs.Preferences;
@@ -45,7 +46,7 @@
private void init() {
Preferences prefs = TiledConfiguration.root();
try {
- highlightColor = Color.decode(prefs.get("selectionColor", ""));
+ highlightColor = Color.decode(prefs.get("selectionColor", "#0000FF"));
} catch (NumberFormatException e) {
highlightColor = Color.blue;
}
@@ -96,11 +97,11 @@
}
/**
- * Sets the selected area to the given Rectangle.
+ * Sets the selected area to the given Shape.
*
* @param region
*/
- public void selectRegion(Rectangle region) {
+ public void selectRegion(Shape region) {
clearRegion(selection);
selection = new Area(region);
fillRegion(selection, selTile);
@@ -159,14 +160,7 @@
}
private void clearRegion(Area region) {
- Rectangle bounded = region.getBounds();
- for (int i = bounded.y; i < bounded.y + bounded.height; i++) {
- for (int j = bounded.x; j < bounded.x + bounded.width; j++) {
- if (region.contains(j, i)) {
- setTileAt(j, i, null);
- }
- }
- }
+ fillRegion(region, null);
}
/**
Modified: trunk/src/tiled/mapeditor/widget/BrushBrowser.java
===================================================================
--- trunk/src/tiled/mapeditor/widget/BrushBrowser.java 2006-04-24 19:34:56 UTC (rev 616)
+++ trunk/src/tiled/mapeditor/widget/BrushBrowser.java 2006-04-30 17:21:38 UTC (rev 617)
@@ -100,22 +100,24 @@
// Draw the brushes
Iterator itr = brushes.iterator();
- int x = 0, y = 0;
+ int x = 0;
while (itr.hasNext()) {
Brush b = (Brush)itr.next();
- //Rectangle bb = b.getBounds();
+ Rectangle bb = b.getBounds();
+ float o = maxWidth/2.0f - bb.width/2.0f;
+ g.translate((int)o, (int)o);
b.drawPreview((Graphics2D) g, null);
- // x + (maxWidth / 2 - bb.width / 2),
- // y + (maxWidth / 2 - bb.width / 2));
+ g.translate((int)-o, (int)-o);
if (b == selectedBrush) {
- g.drawRect(x, y, maxWidth, maxWidth);
+ g.drawRect(0, 0, maxWidth, maxWidth);
}
+ g.translate(maxWidth,0);
x += maxWidth;
if (x + maxWidth > getWidth()) {
+ g.translate(-x, maxWidth);
x = 0;
- y += maxWidth;
}
}
}
Modified: trunk/src/tiled/view/IsoMapView.java
===================================================================
--- trunk/src/tiled/view/IsoMapView.java 2006-04-24 19:34:56 UTC (rev 616)
+++ trunk/src/tiled/view/IsoMapView.java 2006-04-30 17:21:38 UTC (rev 617)
@@ -63,7 +63,8 @@
Rectangle clipRect = g2d.getClipBounds();
Dimension tileSize = getTileSize(zoom);
int tileStepY = tileSize.height / 2 == 0 ? 1 : tileSize.height / 2;
-
+ Polygon gridPoly = createGridPolygon(0, -tileSize.height, 0);
+
Point rowItr = screenToTileCoords(clipRect.x, clipRect.y);
rowItr.x--;
Point drawLoc = tileToScreenCoords(rowItr.x, rowItr.y);
@@ -84,9 +85,11 @@
if (tile != null) {
if (layer instanceof SelectionLayer) {
- Polygon gridPoly = createGridPolygon(
- drawLoc.x, drawLoc.y - tileSize.height, 0);
+ //Polygon gridPoly = createGridPolygon(
+ //drawLoc.x, drawLoc.y - tileSize.height, 0);
+ gridPoly.translate(drawLoc.x, drawLoc.y);
g2d.fillPolygon(gridPoly);
+ gridPoly.translate(-drawLoc.x, -drawLoc.y);
//paintEdge(g2d, layer, drawLoc.x, drawLoc.y);
} else {
tile.draw(g2d, drawLoc.x, drawLoc.y, zoom);
Modified: trunk/src/tiled/view/MapView.java
===================================================================
--- trunk/src/tiled/view/MapView.java 2006-04-24 19:34:56 UTC (rev 616)
+++ trunk/src/tiled/view/MapView.java 2006-04-30 17:21:38 UTC (rev 617)
@@ -293,6 +293,11 @@
MapLayer layer;
double currentZoom = zoom;
+ if(g2d == null) {
+ g2d = (Graphics2D)getGraphics().create();
+ g2d.setClip(this.getVisibleRect());
+ }
+
while (li.hasNext()) {
if ((layer = (MapLayer)li.next()) != null) {
float opacity = layer.getOpacity() * mapOpacity;
Modified: trunk/src/tiled/view/OrthoMapView.java
===================================================================
--- trunk/src/tiled/view/OrthoMapView.java 2006-04-24 19:34:56 UTC (rev 616)
+++ trunk/src/tiled/view/OrthoMapView.java 2006-04-30 17:21:38 UTC (rev 617)
@@ -78,7 +78,8 @@
Dimension tsize = getTileSize(zoom);
if (tsize.width <= 0 || tsize.height <= 0) return;
int toffset = (modeFlags & PF_GRIDMODE) != 0 ? 1 : 0;
-
+ Polygon gridPoly = createGridPolygon(0, -tsize.height, 0);
+
// Determine area to draw from clipping rectangle
Rectangle clipRect = g2d.getClipBounds();
int startX = clipRect.x / tsize.width;
@@ -96,9 +97,9 @@
if (tile != null) {
if (layer instanceof SelectionLayer) {
- Polygon gridPoly = createGridPolygon(
- gx, gy - tsize.height, 0);
+ gridPoly.translate(gx, gy);
g2d.fillPolygon(gridPoly);
+ gridPoly.translate(-gx, -gy);
//paintEdge(g, layer, gx, gy);
} else {
tile.draw(g2d, gx, gy, zoom);
More information about the tiled-commit
mailing list