[tiled] r730 - in trunk: . src/tiled/mapeditor src/tiled/mapeditor/dialogs src/tiled/mapeditor/resources
tiled-svn at biggeruniverse.com
tiled-svn at biggeruniverse.com
Fri Nov 9 06:08:52 PST 2007
Author: bjorn
Date: 2007-11-09 08:08:51 -0600 (Fri, 09 Nov 2007)
New Revision: 730
Removed:
trunk/src/tiled/mapeditor/dialogs/TilePaletteDialog.java
Modified:
trunk/TODO
trunk/src/tiled/mapeditor/MapEditor.java
trunk/src/tiled/mapeditor/resources/gui.properties
Log:
Removed TilePaletteDialog, which had been replaced by a docked tabbed tileset panel.
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2007-10-23 18:03:09 UTC (rev 729)
+++ trunk/TODO 2007-11-09 14:08:51 UTC (rev 730)
@@ -13,6 +13,8 @@
* Add support for tile instance properties (see Christian's patch) (WIP)
- Implement an effective way of displaying the presence of these properties
* Add support for arbitrary objects and zones placement (ElvenProgrammer)
+* Add separate buttons for adding and removing objects, and enable/disable them depending on the selected layer
+* Update map view when showing/hiding an object group
0.8.0
* Set up a layer->map->mapview changes event trail to automatically handle
Modified: trunk/src/tiled/mapeditor/MapEditor.java
===================================================================
--- trunk/src/tiled/mapeditor/MapEditor.java 2007-10-23 18:03:09 UTC (rev 729)
+++ trunk/src/tiled/mapeditor/MapEditor.java 2007-11-09 14:08:51 UTC (rev 730)
@@ -126,7 +126,6 @@
private AbstractButton objectMoveButton, objectAddButton;
private TabbedTilesetsPane tabbedTilesetsPane;
- private TilePaletteDialog tilePaletteDialog;
private AboutDialog aboutDialog;
private MapLayerEdit paintEdit;
@@ -152,6 +151,9 @@
private static final String IMPORT_ERROR_MSG = Resources.getString("dialog.newtileset.import.error.message");
+ private static final String PANEL_TILE_PALETTE = Resources.getString("panel.tilepalette.title");
+ private static final String PANEL_LAYERS = Resources.getString("panel.layers.title");
+
private static final String TOOL_PAINT = Resources.getString("tool.paint.name");
private static final String TOOL_ERASE = Resources.getString("tool.erase.name");
private static final String TOOL_FILL = Resources.getString("tool.fill.name");
@@ -229,9 +231,6 @@
appFrame.setJMenuBar(menuBar);
appFrame.setSize(APP_WIDTH, APP_HEIGHT);
- tilePaletteDialog =
- new TilePaletteDialog(this, currentMap);
-
setCurrentMap(null);
updateRecent(null);
@@ -299,15 +298,16 @@
// todo: people may prefer not to have that.
JSplitPane mainSplit = new JSplitPane(
JSplitPane.HORIZONTAL_SPLIT, true, mapScrollPane,
- new FloatablePanel(getAppFrame(), dataPanel, "Layers"));
+ new FloatablePanel(getAppFrame(), dataPanel, PANEL_LAYERS));
mainSplit.setOneTouchExpandable(true);
mainSplit.setResizeWeight(1.0);
mainSplit.setBorder(null);
tabbedTilesetsPane = new TabbedTilesetsPane(this);
+ FloatablePanel tilesetPanel = new FloatablePanel(getAppFrame(),
+ tabbedTilesetsPane, PANEL_TILE_PALETTE);
JSplitPane paletteSplit = new JSplitPane(
- JSplitPane.VERTICAL_SPLIT, true, mainSplit,
- new FloatablePanel(getAppFrame(), tabbedTilesetsPane, "Tile palette"));
+ JSplitPane.VERTICAL_SPLIT, true, mainSplit, tilesetPanel);
paletteSplit.setOneTouchExpandable(true);
paletteSplit.setResizeWeight(1.0);
@@ -1272,14 +1272,6 @@
} else if ("moveobject".equals(command)) {
setCurrentPointerState(PS_MOVEOBJ);
resetBrush();
- } else if ("palette".equals(command)) {
- if (currentMap != null) {
- if (tilePaletteDialog == null) {
- tilePaletteDialog =
- new TilePaletteDialog(this, currentMap);
- }
- tilePaletteDialog.setVisible(true);
- }
} else if ("tileInstanceProperties".equals(command)) {
if (currentMap != null) {
tileInstancePropertiesDialog.setVisible(true);
@@ -1439,15 +1431,9 @@
}
public void tilesetAdded(MapChangedEvent e, TileSet tileset) {
- if (tilePaletteDialog != null) {
- tilePaletteDialog.setMap(currentMap);
- }
}
public void tilesetRemoved(MapChangedEvent e, int index) {
- if (tilePaletteDialog != null) {
- tilePaletteDialog.setMap(currentMap);
- }
mapView.repaint();
}
@@ -1509,14 +1495,6 @@
// Save the extended window state if the window isn't minimized
int extendedState = appFrame.getExtendedState();
prefs.node("dialog/main").putInt("state", extendedState);
-
- // Allow the the tile palette dialog to save its prefs (because it's
- // common to tweak this to a certain width for convenient tileset
- // display)
- // todo: would be nicer to introduce a ShutdownListener interface
- if (tilePaletteDialog != null) {
- tilePaletteDialog.shutdown();
- }
}
private class LayerTransformAction extends AbstractAction {
@@ -2075,9 +2053,6 @@
sb.makeQuadBrush(new Rectangle(0, 0, 1, 1));
setBrush(sb);
- if (tilePaletteDialog != null) {
- tilePaletteDialog.setMap(currentMap);
- }
tabbedTilesetsPane.setMap(currentMap);
if (!mapLoaded) {
Deleted: trunk/src/tiled/mapeditor/dialogs/TilePaletteDialog.java
===================================================================
--- trunk/src/tiled/mapeditor/dialogs/TilePaletteDialog.java 2007-10-23 18:03:09 UTC (rev 729)
+++ trunk/src/tiled/mapeditor/dialogs/TilePaletteDialog.java 2007-11-09 14:08:51 UTC (rev 730)
@@ -1,133 +0,0 @@
-/*
- * Tiled Map Editor, (c) 2004-2006
- *
- * This program is free software; you can redistribute it and/or modify
- * 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>
- */
-
-package tiled.mapeditor.dialogs;
-
-import java.awt.Dimension;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.util.Vector;
-import java.util.prefs.Preferences;
-import javax.swing.*;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-
-import tiled.core.Map;
-import tiled.core.TileSet;
-import tiled.mapeditor.MapEditor;
-import tiled.mapeditor.Resources;
-import tiled.mapeditor.brush.CustomBrush;
-import tiled.mapeditor.util.TileRegionSelectionEvent;
-import tiled.mapeditor.util.TileSelectionEvent;
-import tiled.mapeditor.util.TileSelectionListener;
-import tiled.mapeditor.widget.TilePalettePanel;
-import tiled.util.TiledConfiguration;
-
-/**
- * @version $Id$
- */
-public class TilePaletteDialog extends JDialog implements
- TileSelectionListener, ListSelectionListener
-{
- private final MapEditor editor;
- private TilePalettePanel pc;
- private JList sets;
- private JSplitPane splitPane;
-
- private static final String DIALOG_TITLE =
- Resources.getString("dialog.tilepalette.title");
- private static final Preferences prefs =
- TiledConfiguration.node("dialog/tilepalette");
-
- public TilePaletteDialog(MapEditor editor, Map map) {
- super(editor.getAppFrame(), DIALOG_TITLE, false);
- this.editor = editor;
- init();
- setMap(map);
- setSize(new Dimension(prefs.getInt("width", 300),
- prefs.getInt("height", 200)));
- setLocationRelativeTo(getOwner());
- setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
- }
-
- private void init() {
- sets = new JList();
- sets.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- sets.addListSelectionListener(this);
-
- pc = new TilePalettePanel();
- pc.addTileSelectionListener(this);
-
- JScrollPane setsScrollPane = new JScrollPane(sets);
- JScrollPane paletteScrollPane = new JScrollPane(pc,
- JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
- JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
-
- splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true);
- splitPane.setBorder(null);
- splitPane.setResizeWeight(0.75);
- splitPane.setLeftComponent(paletteScrollPane);
- splitPane.setRightComponent(setsScrollPane);
-
- int dividerLocation = prefs.getInt("divider", -1);
- if (dividerLocation >= 0) {
- splitPane.setDividerLocation(dividerLocation);
- }
-
- JPanel mainPanel = new JPanel(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
- c.fill = GridBagConstraints.BOTH;
- c.weightx = 1; c.weighty = 1;
- mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- mainPanel.add(splitPane, c);
-
- setContentPane(mainPanel);
- }
-
- /**
- * Sets the map of which the tilesets should be displayed.
- * @param map
- */
- public void setMap(Map map) {
- if (map != null) {
- Vector tilesets = map.getTilesets();
-
- // A bit of juggling to maintain the selected index when possible
- int prevIndex = sets.getSelectedIndex();
- sets.setListData(tilesets);
- sets.setSelectedIndex(prevIndex);
- if (sets.getSelectedIndex() == -1) {
- sets.setSelectedIndex(0);
- }
- pc.setTileset((TileSet) sets.getSelectedValue());
- }
- }
-
- public void tileSelected(TileSelectionEvent event) {
- editor.setCurrentTile(event.getTile());
- }
-
- public void tileRegionSelected(TileRegionSelectionEvent e) {
- editor.setBrush(new CustomBrush(e.getTileRegion()));
- }
-
- public void valueChanged(ListSelectionEvent e) {
- pc.setTileset((TileSet) sets.getSelectedValue());
- }
-
- public void shutdown() {
- Dimension size = getSize();
- prefs.putInt("width", size.width);
- prefs.putInt("height", size.height);
- prefs.putInt("divider", splitPane.getDividerLocation());
- }
-}
Modified: trunk/src/tiled/mapeditor/resources/gui.properties
===================================================================
--- trunk/src/tiled/mapeditor/resources/gui.properties 2007-10-23 18:03:09 UTC (rev 729)
+++ trunk/src/tiled/mapeditor/resources/gui.properties 2007-11-09 14:08:51 UTC (rev 730)
@@ -170,7 +170,6 @@
dialog.tile.tab.view=View Tileset
dialog.tile.title=Edit Tileset
dialog.tileimage.title=Choose Tile Image
-dialog.tilepalette.title=Palette
dialog.tilesetmanager.edit.button=Edit...
dialog.tilesetmanager.embed.button=Embed
dialog.tilesetmanager.title=Tileset Manager
@@ -250,6 +249,8 @@
menu.view.cursor.tooltip=Toggle highlighting on-map cursor position
menu.view.grid=Show Grid
menu.view.grid.tooltip=Toggle grid
+panel.layers.title=Layers
+panel.tilepalette.title=Tile palette
tool.erase.name=Erase
tool.eyedropper.name=Eye dropper
tool.fill.name=Fill
More information about the tiled-commit
mailing list