[tiled] r565 - tags/0.5.2 tags/0.5.2/dist tags/0.5.2/dist/plugins tags/0.5.2/releases trunk/tiled/mapeditor trunk/tiled/mapeditor/brush trunk/tiled/mapeditor/dialogs
svn@biggeruniverse.com
svn at biggeruniverse.com
Fri Jan 27 00:46:19 PST 2006
Author: aturk
Date: 2006-01-27 02:46:18 -0600 (Fri, 27 Jan 2006)
New Revision: 565
Added:
tags/0.5.2/dist/
tags/0.5.2/dist/plugins/
tags/0.5.2/dist/plugins/mappy.jar
tags/0.5.2/dist/plugins/tmw.jar
tags/0.5.2/dist/tiled-core.jar
tags/0.5.2/dist/tiled.conf
tags/0.5.2/dist/tiled.jar
tags/0.5.2/mappy.jar
tags/0.5.2/releases/
tags/0.5.2/releases/tiled-0.5.1-bin.zip
tags/0.5.2/tiled.conf
trunk/tiled/mapeditor/actions/
trunk/tiled/mapeditor/dialogs/
trunk/tiled/mapeditor/dialogs/AboutDialog.java
trunk/tiled/mapeditor/dialogs/BrushDialog.java
trunk/tiled/mapeditor/dialogs/ConfigurationDialog.java
trunk/tiled/mapeditor/dialogs/ImageColorDialog.java
trunk/tiled/mapeditor/dialogs/NewMapDialog.java
trunk/tiled/mapeditor/dialogs/NewTileDialog.java
trunk/tiled/mapeditor/dialogs/NewTilesetDialog.java
trunk/tiled/mapeditor/dialogs/ObjectDialog.java
trunk/tiled/mapeditor/dialogs/PluginDialog.java
trunk/tiled/mapeditor/dialogs/PropertiesDialog.java
trunk/tiled/mapeditor/dialogs/ResizeDialog.java
trunk/tiled/mapeditor/dialogs/SearchDialog.java
trunk/tiled/mapeditor/dialogs/TileDialog.java
trunk/tiled/mapeditor/dialogs/TileImageDialog.java
trunk/tiled/mapeditor/dialogs/TilePaletteDialog.java
trunk/tiled/mapeditor/dialogs/TilesetManager.java
Removed:
trunk/tiled/mapeditor/AboutDialog.java
trunk/tiled/mapeditor/BrushDialog.java
trunk/tiled/mapeditor/ConfigurationDialog.java
trunk/tiled/mapeditor/ImageColorDialog.java
trunk/tiled/mapeditor/NewMapDialog.java
trunk/tiled/mapeditor/NewTileDialog.java
trunk/tiled/mapeditor/NewTilesetDialog.java
trunk/tiled/mapeditor/ObjectDialog.java
trunk/tiled/mapeditor/PluginDialog.java
trunk/tiled/mapeditor/PropertiesDialog.java
trunk/tiled/mapeditor/ResizeDialog.java
trunk/tiled/mapeditor/SearchDialog.java
trunk/tiled/mapeditor/TileDialog.java
trunk/tiled/mapeditor/TileImageDialog.java
trunk/tiled/mapeditor/TilePaletteDialog.java
trunk/tiled/mapeditor/TilesetManager.java
Modified:
trunk/tiled/mapeditor/MapEditor.java
trunk/tiled/mapeditor/brush/CustomBrush.java
Log:
Fairly large initial rearrangement of dialogs, and some base work for actions.
Added: tags/0.5.2/dist/plugins/mappy.jar
===================================================================
(Binary files differ)
Property changes on: tags/0.5.2/dist/plugins/mappy.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: tags/0.5.2/dist/plugins/tmw.jar
===================================================================
(Binary files differ)
Property changes on: tags/0.5.2/dist/plugins/tmw.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: tags/0.5.2/dist/tiled-core.jar
===================================================================
(Binary files differ)
Property changes on: tags/0.5.2/dist/tiled-core.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: tags/0.5.2/dist/tiled.conf
===================================================================
--- tags/0.5.2/dist/tiled.conf 2006-01-26 06:42:52 UTC (rev 564)
+++ tags/0.5.2/dist/tiled.conf 2006-01-27 08:46:18 UTC (rev 565)
@@ -0,0 +1,17 @@
+tmx.save.tileSetImages = 0
+tmx.save.layerCompression = 1
+tiled.grid.opacity = 255
+tmx.undo.depth = 30
+tmx.save.embedtileSetImages = 0
+tiled.grid.color = 0x000000
+tmx.save.tileImagePrefix = tile
+tiled.plugins.dir = ./plugins
+tmx.save.encodeLayerData = 1
+tiled.grid.antialias = 1
+tmx.save.embedImages = 1
+tmx.recent.1 = /root/chess.tmx
+tiled.background.color = 0x404040
+tiled.cursorhighlight = 1
+tiled.report.io = 0
+tiled.selection.color = 0x0000FF
+tiled.undo.depth = 30
Added: tags/0.5.2/dist/tiled.jar
===================================================================
(Binary files differ)
Property changes on: tags/0.5.2/dist/tiled.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: tags/0.5.2/mappy.jar
===================================================================
(Binary files differ)
Property changes on: tags/0.5.2/mappy.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: tags/0.5.2/releases/tiled-0.5.1-bin.zip
===================================================================
(Binary files differ)
Property changes on: tags/0.5.2/releases/tiled-0.5.1-bin.zip
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: tags/0.5.2/tiled.conf
===================================================================
--- tags/0.5.2/tiled.conf 2006-01-26 06:42:52 UTC (rev 564)
+++ tags/0.5.2/tiled.conf 2006-01-27 08:46:18 UTC (rev 565)
@@ -0,0 +1,27 @@
+tiled.recent.1 = /home/develop/tmw/data/maps/new_3-1.tmx.gz
+tiled.selection.color = 0x0000FF
+tmx.save.tileSetImages = 0
+tmx.save.layerCompression = 1
+tiled.undo.depth = 30
+tiled.grid.opacity = 255
+tmx.save.embedtileSetImages = 0
+tmx.load.report = 1
+tiled.grid.color = 0x000000
+tmx.save.tileImagePrefix = tile
+tiled.plugins.dir = .
+tmx.save.encodeLayerData = 1
+tiled.background.color = 0x404040
+tiled.grid.antialias = 1
+tiled.cursorhighlight = 1
+tmx.save.embedImages = 1
+tiled.recent.2 = /home/develop/tmw/data/maps/new_1-1.tmx.gz
+tiled.recent.3 = /home/develop/tiled/trunk/examples/snowy_trees.tmx
+tiled.report.io = 1
+tiled.recent.4 = /home/develop/tiled/trunk/examples/desert.tmx
+Embed images (png) = 1
+tiled.animation.safe = 0
+tiled.animation.animate = 0
+tiled.newmapdialog.tileheight = 16
+tiled.newmapdialog.mapheight = 64
+tiled.newmapdialog.tilewidth = 16
+tiled.newmapdialog.mapwidth = 64
Deleted: trunk/tiled/mapeditor/AboutDialog.java
===================================================================
--- trunk/tiled/mapeditor/AboutDialog.java 2006-01-26 06:42:52 UTC (rev 564)
+++ trunk/tiled/mapeditor/AboutDialog.java 2006-01-27 08:46:18 UTC (rev 565)
@@ -1,58 +0,0 @@
-/*
- * Tiled Map Editor, (c) 2004
- *
- * 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;
-
-import java.io.IOException;
-import javax.imageio.ImageIO;
-import javax.swing.*;
-
-import tiled.mapeditor.MapEditor;
-
-
-/**
- * The about dialog.
- */
-public class AboutDialog extends JFrame
-{
- JFrame parent;
-
- public AboutDialog(JFrame parent) {
- super("Tiled v" + MapEditor.version);
-
- this.parent = parent;
- ImageIcon icon;
-
- try {
- icon = new ImageIcon(ImageIO.read(
- getClass().getResourceAsStream("resources/logo.png")));
-
- JPanel content = new JPanel();
- JLabel label = new JLabel(icon);
- content.add(label);
-
- setContentPane(content);
- setResizable(false);
- setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
- pack();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- public void setVisible(boolean visible) {
- if (visible) {
- setLocationRelativeTo(parent);
- }
- super.setVisible(visible);
- }
-}
Deleted: trunk/tiled/mapeditor/BrushDialog.java
===================================================================
--- trunk/tiled/mapeditor/BrushDialog.java 2006-01-26 06:42:52 UTC (rev 564)
+++ trunk/tiled/mapeditor/BrushDialog.java 2006-01-27 08:46:18 UTC (rev 565)
@@ -1,346 +0,0 @@
-/*
- * Tiled Map Editor, (c) 2004
- *
- * 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;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import javax.swing.*;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-
-import tiled.core.Tile;
-import tiled.io.MapHelper;
-import tiled.io.MapReader;
-import tiled.mapeditor.brush.*;
-import tiled.mapeditor.plugin.PluginClassLoader;
-import tiled.mapeditor.util.LayerTableModel;
-import tiled.mapeditor.util.TiledFileFilter;
-import tiled.mapeditor.widget.BrushBrowser;
-import tiled.mapeditor.widget.IntegerSpinner;
-import tiled.mapeditor.widget.MiniMapViewer;
-import tiled.mapeditor.widget.VerticalStaticJPanel;
-import tiled.util.TiledConfiguration;
-
-
-public class BrushDialog extends JDialog implements ActionListener,
- ItemListener, ChangeListener, PropertyChangeListener,
- ListSelectionListener
-{
- private AbstractBrush myBrush;
- private MapEditor editor;
-
- private JCheckBox cbRandomBrush;
- private IntegerSpinner affectLayers, brushSize;
- private JSlider sRandomAmount;
- private JButton bOk, bApply, bCancel;
- private BrushBrowser brushes;
- private MiniMapViewer mmv;
- private JTable layerTable;
-
- public BrushDialog(MapEditor editor, JFrame parent,
- AbstractBrush currentBrush)
- {
- super(parent, "Brush Options", false);
- myBrush = currentBrush;
- this.editor = editor;
-
- init();
- update();
- pack();
-
- setLocationRelativeTo(parent);
- }
-
- private JPanel createShapePanel() {
- // Brush presets
- brushes = new BrushBrowser();
- JScrollPane brushScrollPane = new JScrollPane(brushes);
- brushScrollPane.setPreferredSize(new Dimension(100, 100));
- brushes.addPropertyChangeListener(this);
- brushes.setSelectedBrush(myBrush);
-
- JPanel presets = new JPanel();
- presets.setBorder(BorderFactory.createCompoundBorder(
- BorderFactory.createTitledBorder("Presets"),
- BorderFactory.createEmptyBorder(0, 5, 5, 5)));
- presets.setLayout(new GridLayout(1, 1));
- presets.add(brushScrollPane);
-
- // Brush size
- brushSize = new IntegerSpinner(1, 1);
- if (myBrush != null) {
- brushSize.setValue(myBrush.getBounds().width);
- }
- brushSize.addChangeListener(this);
- brushSize.setToolTipText("Sets the size of the brush in tiles");
-
- // Number of affected layers
- affectLayers = new IntegerSpinner(myBrush.getAffectedLayers(), 1);
- affectLayers.addChangeListener(this);
-
- // Randomize tile placement
- cbRandomBrush = new JCheckBox("Random");
- cbRandomBrush.setToolTipText(
- "Make brush paint randomly within the shape area");
- cbRandomBrush.addItemListener(this);
- sRandomAmount = new JSlider();
- sRandomAmount.setPreferredSize(new Dimension(
- 50, sRandomAmount.getPreferredSize().height));
- sRandomAmount.setToolTipText(
- "The amount of area to fill with randomness");
- sRandomAmount.addChangeListener(this);
-
- // Brush options section
- JPanel opts = new VerticalStaticJPanel();
- opts.setLayout(new GridBagLayout());
- opts.setBorder(BorderFactory.createCompoundBorder(
- BorderFactory.createTitledBorder("Options"),
- BorderFactory.createEmptyBorder(0, 5, 5, 5)));
- GridBagConstraints c = new GridBagConstraints();
- c.fill = GridBagConstraints.NONE;
- c.anchor = GridBagConstraints.NORTHWEST;
- c.weightx = 0;
- c.insets = new Insets(0, 0, 5, 0);
- opts.add(new JLabel("Brush size: "), c);
- c.gridy = 1;
- opts.add(new JLabel("Affected layers: "), c);
- c.gridy = 2;
- opts.add(cbRandomBrush, c);
- c.gridy = 0; c.gridx = 1; c.weightx = 0.3;
- c.fill = GridBagConstraints.HORIZONTAL;
- opts.add(brushSize, c);
- c.gridy = 1;
- opts.add(affectLayers, c);
- c.gridy = 2;
- opts.add(sRandomAmount, c);
-
- JPanel shapePanel = new JPanel();
- shapePanel.setLayout(new BoxLayout(shapePanel, BoxLayout.Y_AXIS));
- shapePanel.add(presets);
- shapePanel.add(opts);
-
- return shapePanel;
- }
-
- private JPanel createCustomPanel() {
- JPanel customPanel = new JPanel();
-
- mmv = new MiniMapViewer();
- if (myBrush instanceof CustomBrush) {
- //mmv.setView(((CustomBrush)myBrush));
- }
-
- JScrollPane miniSp = new JScrollPane();
- miniSp.getViewport().setView(mmv);
- miniSp.setPreferredSize(new Dimension(100,100));
- JButton bCreate = new JButton("Create...");
- bCreate.addActionListener(this);
- //TODO: create functionality is not available yet
- bCreate.setEnabled(false);
- JButton bLoad = new JButton("Load...");
- bLoad.addActionListener(this);
- layerTable = new JTable(new LayerTableModel(myBrush));
- layerTable.getColumnModel().getColumn(0).setPreferredWidth(32);
- layerTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- layerTable.getSelectionModel().addListSelectionListener(this);
-
- customPanel.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
- c.anchor = GridBagConstraints.NORTH;
- c.fill = GridBagConstraints.NONE;
- c.weightx = 2; c.weighty = 2;
- customPanel.add(miniSp, c);
- c.weightx = 1; c.weighty = 1;
- c.gridx=2;
- customPanel.add(bCreate, c);
- c.gridy=1;
- customPanel.add(bLoad, c);
- c.gridx=0; c.gridy=2;
- customPanel.add(layerTable, c);
-
- return customPanel;
- }
-
- private void init() {
- createCustomPanel();
-
- bOk = new JButton("OK");
- bApply = new JButton("Apply");
- bCancel = new JButton("Cancel");
- bOk.addActionListener(this);
- bApply.addActionListener(this);
- bCancel.addActionListener(this);
- bApply.setEnabled(false);
-
- /* BUTTONS PANEL */
- JPanel buttons = new VerticalStaticJPanel();
- buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
- buttons.add(Box.createGlue());
- buttons.add(bOk);
- buttons.add(Box.createRigidArea(new Dimension(5, 0)));
- buttons.add(bApply);
- buttons.add(Box.createRigidArea(new Dimension(5, 0)));
- buttons.add(bCancel);
-
- JPanel mainPanel = new JPanel();
- mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
- mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- mainPanel.add(createShapePanel());
- mainPanel.add(Box.createRigidArea(new Dimension(0, 5)));
- mainPanel.add(buttons);
-
- getContentPane().add(mainPanel);
- getRootPane().setDefaultButton(bOk);
- }
-
- private void createFromOptions() {
- Tile t = null;
-
- if (myBrush instanceof ShapeBrush) {
- t = ((ShapeBrush)myBrush).getTile();
- }
-
- ShapeBrush sel = (ShapeBrush)brushes.getSelectedBrush();
- sel.setSize(((Integer)brushSize.getValue()).intValue());
-
- if (cbRandomBrush.isSelected()) {
- RandomBrush randomBrush = new RandomBrush(sel);
- randomBrush.setRatio(
- sRandomAmount.getValue() /
- (double)sRandomAmount.getMaximum());
- myBrush = randomBrush;
- } else {
- myBrush = new ShapeBrush(sel);
- }
-
- ((ShapeBrush)myBrush).setTile(t);
- myBrush.setAffectedLayers(
- ((Integer)affectLayers.getValue()).intValue());
-
- update();
- }
-
- private void update() {
- if (myBrush instanceof CustomBrush) { // Custom brush
- brushSize.setEnabled(false);
- affectLayers.setEnabled(false);
- cbRandomBrush.setEnabled(false);
- } else if (myBrush instanceof RandomBrush) { // Random brush
- cbRandomBrush.setSelected(true);
- sRandomAmount.setValue(
- (int)(((RandomBrush)myBrush).getRatio() * 100));
- }
-
- sRandomAmount.setEnabled(cbRandomBrush.isSelected());
- }
-
- public void actionPerformed(ActionEvent e) {
- Object source = e.getSource();
-
- if (source == bOk) {
- createFromOptions();
- editor.setBrush(myBrush);
- dispose();
- }
- else if (source == bApply) {
- createFromOptions();
- editor.setBrush(myBrush);
- bApply.setEnabled(false);
- }
- else if (source == bCancel) {
- dispose();
- }
- else if (e.getActionCommand().equals("Load...")) {
- try {
- openMap();
- //mmv.setView(((CustomBrush)myBrush));
- } catch (Exception e1) {
- e1.printStackTrace();
- JOptionPane.showMessageDialog(this,
- e1.toString(), "Load Brush",
- JOptionPane.WARNING_MESSAGE);
- }
- repaint();
- }
- }
-
- public void stateChanged(ChangeEvent e) {
- bApply.setEnabled(true);
- }
-
- public void itemStateChanged(ItemEvent event) {
- Object source = event.getItemSelectable();
-
- if (source == cbRandomBrush) {
- sRandomAmount.setEnabled(cbRandomBrush.isSelected());
- }
-
- bApply.setEnabled(true);
- }
-
- public void propertyChange(PropertyChangeEvent evt) {
- if (evt.getPropertyName().equals("selectedbrush")) {
- Brush b = brushes.getSelectedBrush();
- if (b != null) {
- brushSize.setValue(b.getBounds().width);
- }
- }
-
- bApply.setEnabled(true);
- }
-
- public void valueChanged(ListSelectionEvent e) {
- // TODO Auto-generated method stub
- }
-
- private void openMap() throws Exception {
- String startLocation = "";
- TiledConfiguration configuration = TiledConfiguration.getInstance();
-
- // Start at the location of the most recently loaded map file
- if (configuration.hasOption("tiled.recent.1")) {
- startLocation = configuration.getValue("tiled.recent.1");
- }
-
- JFileChooser ch = new JFileChooser(startLocation);
-
- try {
- MapReader readers[] =
- (MapReader[])PluginClassLoader.getInstance().getReaders();
- for(int i = 0; i < readers.length; i++) {
- ch.addChoosableFileFilter(new TiledFileFilter(
- readers[i].getFilter(), readers[i].getName()));
- }
- } catch (Throwable e) {
- JOptionPane.showMessageDialog(this,
- "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(this);
- if (ret == JFileChooser.APPROVE_OPTION) {
- myBrush = new CustomBrush(
- MapHelper.loadMap(ch.getSelectedFile().getAbsolutePath()));
- }
- }
-}
Deleted: trunk/tiled/mapeditor/ConfigurationDialog.java
===================================================================
--- trunk/tiled/mapeditor/ConfigurationDialog.java 2006-01-26 06:42:52 UTC (rev 564)
+++ trunk/tiled/mapeditor/ConfigurationDialog.java 2006-01-27 08:46:18 UTC (rev 565)
@@ -1,305 +0,0 @@
-/*
- * Tiled Map Editor, (c) 2004
- *
- * 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;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-import javax.swing.event.ChangeListener;
-import javax.swing.event.ChangeEvent;
-
-import tiled.util.TiledConfiguration;
-import tiled.mapeditor.widget.*;
-
-
-public class ConfigurationDialog extends JDialog implements ActionListener,
- ChangeListener, ItemListener
-{
- private JButton bOk, bApply, bCancel;
- private JPanel layerOps, generalOps, tilesetOps, gridOps;
- private IntegerSpinner undoDepth, gridOpacity;
- private JCheckBox cbBinaryEncode, cbCompressLayerData, cbEmbedImages;
- private JCheckBox cbReportIOWarnings;
- private JRadioButton rbEmbedInTiles, rbEmbedInSet;
- private JCheckBox cbGridAA;
- private JColorChooser gridColor;
- private TiledConfiguration configuration;
-
- public ConfigurationDialog(JFrame parent) {
- super(parent, "Preferences", true);
- configuration = TiledConfiguration.getInstance();
- init();
- setLocationRelativeTo(parent);
- }
-
- private void init() {
- // Create primitives
-
- cbBinaryEncode = new JCheckBox("Use binary encoding");
- cbCompressLayerData = new JCheckBox("Compress layer data (gzip)");
- cbEmbedImages = new JCheckBox("Embed images (png)");
- cbReportIOWarnings = new JCheckBox("Report I/O messages");
- rbEmbedInTiles = new JRadioButton("Embed images in tiles");
- rbEmbedInSet = new JRadioButton("Use Tileset (shared) images");
- ButtonGroup bg = new ButtonGroup();
- bg.add(rbEmbedInTiles);
- bg.add(rbEmbedInSet);
- undoDepth = new IntegerSpinner();
- cbGridAA = new JCheckBox("Antialiasing");
- gridOpacity = new IntegerSpinner(0, 0, 255);
- //gridColor = new JColorChooser();
- cbBinaryEncode.addItemListener(this);
- cbCompressLayerData.addItemListener(this);
- cbEmbedImages.addItemListener(this);
- cbReportIOWarnings.addItemListener(this);
- cbGridAA.addItemListener(this);
- undoDepth.addChangeListener(this);
- gridOpacity.addChangeListener(this);
- //gridColor.addChangeListener(this);
-
- cbBinaryEncode.setActionCommand("tmx.save.encodeLayerData");
- cbCompressLayerData.setActionCommand("tmx.save.layerCompression");
- //cbEmbedImages.setActionCommand("tmx.save.embedImages");
- cbReportIOWarnings.setActionCommand("tiled.report.io");
-
- rbEmbedInTiles.setActionCommand("tmx.save.embedImages");
- rbEmbedInTiles.setEnabled(false);
- rbEmbedInSet.setActionCommand("tmx.save.tileSetImages");
- rbEmbedInSet.setEnabled(false);
- undoDepth.setName("tiled.undo.depth");
- cbGridAA.setActionCommand("tiled.grid.antialias");
- gridOpacity.setName("tiled.grid.opacity");
- //gridColor.setName("tiled.grid.color");
-
- bOk = new JButton("OK");
- bApply = new JButton("Apply");
- bCancel = new JButton("Cancel");
- bOk.addActionListener(this);
- bApply.addActionListener(this);
- bCancel.addActionListener(this);
- bApply.setEnabled(false);
-
- /* LAYER OPTIONS */
- layerOps = new VerticalStaticJPanel();
- layerOps.setLayout(new GridBagLayout());
- layerOps.setBorder(BorderFactory.createCompoundBorder(
- BorderFactory.createTitledBorder("Layer Options"),
- BorderFactory.createEmptyBorder(0, 5, 5, 5)));
- GridBagConstraints c = new GridBagConstraints();
- c.anchor = GridBagConstraints.EAST;
- c.fill = GridBagConstraints.NONE;
- c.gridy = 1;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.gridx = 1; c.gridy = 0; c.weightx = 1;
- layerOps.add(cbBinaryEncode, c);
- c.gridy = 1; c.insets = new Insets(0, 10, 0, 0);
- layerOps.add(cbCompressLayerData, c);
-
- /* GENERAL OPTIONS */
- generalOps = new VerticalStaticJPanel();
- generalOps.setLayout(new GridBagLayout());
- generalOps.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- c = new GridBagConstraints();
- c.anchor = GridBagConstraints.NORTH;
- c.fill = GridBagConstraints.NONE;
- generalOps.add(new JLabel("Undo Depth: "), c);
- c.fill = GridBagConstraints.HORIZONTAL;
- c.gridx = 1; c.weightx = 1;
- generalOps.add(undoDepth, c);
- c.gridy = 1;
- c.gridx = 0;
- generalOps.add(cbReportIOWarnings, c);
-
- /* TILESET OPTIONS */
- tilesetOps = new VerticalStaticJPanel();
- tilesetOps.setLayout(new GridBagLayout());
- tilesetOps.setBorder(BorderFactory.createCompoundBorder(
- BorderFactory.createTitledBorder("Tileset Options"),
- BorderFactory.createEmptyBorder(0, 5, 5, 5)));
- c = new GridBagConstraints();
- c.fill = GridBagConstraints.HORIZONTAL;
- c.gridx = 1; c.gridy = 0; c.weightx = 1;
- tilesetOps.add(cbEmbedImages, c);
- c.gridy = 1; c.insets = new Insets(0, 10, 0, 0);
- tilesetOps.add(rbEmbedInTiles, c);
- c.gridy = 2; c.insets = new Insets(0, 10, 0, 0);
- tilesetOps.add(rbEmbedInSet, c);
-
- /* GRID OPTIONS */
- gridOps = new VerticalStaticJPanel();
- gridOps.setLayout(new GridBagLayout());
- gridOps.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- c = new GridBagConstraints();
- gridOps.add(new JLabel("Opacity: "), c);
- c.weightx = 1; c.gridx = 1;
- c.fill = GridBagConstraints.HORIZONTAL;
- gridOps.add(gridOpacity, c);
- c.gridwidth = 2; c.gridy = 1; c.gridx = 0;
- gridOps.add(cbGridAA, c);
- //c.gridy = 2; c.weightx = 0;
- //gridOps.add(new JLabel("Color: "), c);
- //c.gridx = 1;
- //gridOps.add(gridColor, c);
-
- /* BUTTONS PANEL */
- JPanel buttons = new VerticalStaticJPanel();
- buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
- buttons.add(Box.createGlue());
- buttons.add(bOk);
- buttons.add(Box.createRigidArea(new Dimension(5, 0)));
- buttons.add(bApply);
- buttons.add(Box.createRigidArea(new Dimension(5, 0)));
- buttons.add(bCancel);
-
-
- JPanel saving = new JPanel();
- saving.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
- saving.setLayout(new BoxLayout(saving, BoxLayout.Y_AXIS));
- saving.add(layerOps);
- saving.add(tilesetOps);
-
- JPanel general = new JPanel();
- general.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
- general.setLayout(new BoxLayout(general, BoxLayout.Y_AXIS));
- general.add(generalOps);
-
- JPanel grid = new JPanel();
- grid.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
- grid.setLayout(new BoxLayout(grid, BoxLayout.Y_AXIS));
- grid.add(gridOps);
-
-
- // Put together the tabs
-
- JTabbedPane perfs = new JTabbedPane();
- perfs.addTab("General", general);
- perfs.addTab("Saving", saving);
- perfs.addTab("Grid", grid);
-
- JPanel mainPanel = new JPanel();
- mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS));
- mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- mainPanel.add(perfs);
- mainPanel.add(Box.createRigidArea(new Dimension(0, 5)));
- mainPanel.add(buttons);
-
- getContentPane().add(mainPanel);
- getRootPane().setDefaultButton(bOk);
- pack();
- }
-
- public void configure() {
- updateFromConf();
- setVisible(true);
- }
-
- private void updateFromConf() {
- undoDepth.setValue(configuration.getIntValue(undoDepth.getName(), 30));
- gridOpacity.setValue(
- configuration.getIntValue(gridOpacity.getName(), 255));
-
- if (configuration.keyHasValue("tmx.save.embedImages", "1")) {
- cbEmbedImages.setSelected(true);
- rbEmbedInTiles.setSelected(true);
- }
-
- // Handle checkboxes
- updateFromConf(layerOps);
- updateFromConf(generalOps);
- updateFromConf(tilesetOps);
- updateFromConf(gridOps);
-
- cbCompressLayerData.setEnabled(cbBinaryEncode.isSelected());
-
- bApply.setEnabled(false);
- }
-
- private void updateFromConf(Container container) {
- for (int i = 0; i < container.getComponentCount(); i++) {
- Component c = container.getComponent(i);
- try {
- AbstractButton b = (AbstractButton)c;
- if (b.getClass().equals(JCheckBox.class)) {
- if (configuration.keyHasValue(b.getActionCommand(), "1")) {
- b.setSelected(true);
- }
- }
- } catch (ClassCastException e) {
- }
- }
- }
-
- private void processOptions() {
- configuration.addConfigPair(
- undoDepth.getName(), "" + undoDepth.intValue());
- configuration.addConfigPair(
- gridOpacity.getName(), "" + gridOpacity.intValue());
-
- // Handle checkboxes
- processOptions(layerOps);
- processOptions(generalOps);
- processOptions(tilesetOps);
- processOptions(gridOps);
-
- bApply.setEnabled(false);
- }
-
- private void processOptions(Container container) {
- for (int i = 0; i < container.getComponentCount(); i++) {
- Component c = container.getComponent(i);
- try {
- AbstractButton b = (AbstractButton)c;
- if (b.getClass().equals(JCheckBox.class)) {
- configuration.addConfigPair(
- b.getActionCommand(), b.isSelected() ? "1" : "0");
- }
- } catch (ClassCastException e) {
- }
- }
- }
-
- public void actionPerformed(ActionEvent event) {
- Object source = event.getSource();
-
- if (source == bOk) {
- processOptions();
- dispose();
- } else if (source == bCancel) {
- dispose();
- } else if (source == bApply) {
- processOptions();
- }
- }
-
- public void stateChanged(ChangeEvent event) {
- bApply.setEnabled(true);
- }
-
- public void itemStateChanged(ItemEvent event) {
- Object source = event.getItemSelectable();
-
- if (source == cbBinaryEncode) {
- cbCompressLayerData.setEnabled(cbBinaryEncode.isSelected());
- } else if (source == cbEmbedImages) {
- rbEmbedInTiles.setSelected(
- cbEmbedImages.isSelected() && rbEmbedInTiles.isSelected());
- rbEmbedInTiles.setEnabled(cbEmbedImages.isSelected());
- rbEmbedInSet.setSelected(
- cbEmbedImages.isSelected() && rbEmbedInSet.isSelected());
- rbEmbedInSet.setEnabled(cbEmbedImages.isSelected());
- }
-
- bApply.setEnabled(true);
- }
-}
Deleted: trunk/tiled/mapeditor/ImageColorDialog.java
===================================================================
--- trunk/tiled/mapeditor/ImageColorDialog.java 2006-01-26 06:42:52 UTC (rev 564)
+++ trunk/tiled/mapeditor/ImageColorDialog.java 2006-01-27 08:46:18 UTC (rev 565)
@@ -1,145 +0,0 @@
-/*
- * Tiled Map Editor, (c) 2004
- *
- * 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;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.image.PixelGrabber;
-
-import javax.swing.*;
-
-import tiled.mapeditor.widget.ImageViewPanel;
-import tiled.mapeditor.widget.VerticalStaticJPanel;
-
-
-public class ImageColorDialog
- extends JDialog
- implements ActionListener, MouseListener, MouseMotionListener {
-
- private Image image;
- private JButton bCancel;
- private Color color;
- private JPanel colorPanel;
- private int pixels[];
-
- public ImageColorDialog() {
- super();
- }
-
- public ImageColorDialog(Image i) {
- this();
- image = i;
- PixelGrabber pg = new PixelGrabber(i,0,0,-1,-1,true);
-
- try {
- pg.grabPixels();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
-
- pixels = (int[])pg.getPixels();
-
- init();
- pack();
- setLocationRelativeTo(getOwner());
- setModal(true);
- }
-
- private void init() {
- ImageViewPanel imagePanel = new ImageViewPanel(image);
- imagePanel.addMouseListener(this);
- imagePanel.addMouseMotionListener(this);
-
- setTitle("Color Chooser");
-
- color = new Color(255, 103, 139); //Evil pink
- colorPanel = new JPanel();
- colorPanel.setPreferredSize(new Dimension(25, 25));
- colorPanel.setBackground(color);
-
- bCancel = new JButton("Cancel");
- bCancel.addActionListener(this);
-
- JScrollPane imageScrollPane = new JScrollPane(imagePanel);
- imageScrollPane.setAutoscrolls(true);
-
- VerticalStaticJPanel mainPanel = new VerticalStaticJPanel();
- mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
-
- mainPanel.add(imageScrollPane);
-
- JPanel buttonPanel = new JPanel(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
- c.gridx = 0; c.gridy = 0; c.weightx = 1;
- c.fill = GridBagConstraints.HORIZONTAL;
- buttonPanel.add(colorPanel);
- c.gridx = 1;
- buttonPanel.add(Box.createRigidArea(new Dimension(25, 5)));
- c.gridx = 2;
- buttonPanel.add(bCancel);
-
- mainPanel.add(buttonPanel);
-
- setContentPane(mainPanel);
- }
-
- public Color showDialog() {
- setVisible(true);
- return color;
- }
-
- public void actionPerformed(ActionEvent e) {
- if(e.getSource() == bCancel) {
- color = null;
- dispose();
- }
- }
-
- public void mouseClicked(MouseEvent e) {
- grabColor(e.getX(), e.getY());
- dispose();
- }
-
- public void mousePressed(MouseEvent e) {
- }
-
- public void mouseReleased(MouseEvent e) {
- }
-
- public void mouseEntered(MouseEvent e) {
- }
-
- public void mouseExited(MouseEvent e) {
- }
-
- public void mouseDragged(MouseEvent e) {
- grabColor(e.getX(), e.getY());
- }
-
- public void mouseMoved(MouseEvent e) {
- grabColor(e.getX(), e.getY());
- }
-
- private void grabColor(int x, int y) {
- int w = image.getWidth(null);
- int h = image.getHeight(null);
- if(pixels != null && (x < w && y < h)) {
- int r = (pixels[y * w + x] >> 16) & 0xff;
- int g = (pixels[y * w + x] >> 8) & 0xff;
- int b = (pixels[y * w + x] ) & 0xff;
-
- color = new Color(r,g,b);
- colorPanel.setBackground(color);
- }
- }
-}
Modified: trunk/tiled/mapeditor/MapEditor.java
===================================================================
--- trunk/tiled/mapeditor/MapEditor.java 2006-01-26 06:42:52 UTC (rev 564)
+++ trunk/tiled/mapeditor/MapEditor.java 2006-01-27 08:46:18 UTC (rev 565)
@@ -29,6 +29,17 @@
import tiled.core.*;
import tiled.view.*;
import tiled.mapeditor.brush.*;
+import tiled.mapeditor.dialogs.AboutDialog;
+import tiled.mapeditor.dialogs.BrushDialog;
+import tiled.mapeditor.dialogs.ConfigurationDialog;
+import tiled.mapeditor.dialogs.NewMapDialog;
+import tiled.mapeditor.dialogs.NewTilesetDialog;
+import tiled.mapeditor.dialogs.PluginDialog;
+import tiled.mapeditor.dialogs.PropertiesDialog;
+import tiled.mapeditor.dialogs.ResizeDialog;
+import tiled.mapeditor.dialogs.SearchDialog;
+import tiled.mapeditor.dialogs.TilePaletteDialog;
+import tiled.mapeditor.dialogs.TilesetManager;
import tiled.mapeditor.plugin.PluginClassLoader;
import tiled.mapeditor.selection.SelectionLayer;
import tiled.mapeditor.util.*;
@@ -67,7 +78,7 @@
private Cursor curMarquee = null;
/** Current release version */
- public static final String version = "0.5.2";
+ public static final String version = "0.6.0";
private Map currentMap;
private MapView mapView;
Deleted: trunk/tiled/mapeditor/NewMapDialog.java
===================================================================
--- trunk/tiled/mapeditor/NewMapDialog.java 2006-01-26 06:42:52 UTC (rev 564)
+++ trunk/tiled/mapeditor/NewMapDialog.java 2006-01-27 08:46:18 UTC (rev 565)
@@ -1,200 +0,0 @@
-/*
- * Tiled Map Editor, (c) 2004
- *
- * 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;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import java.io.*;
-
-import tiled.core.*;
-import tiled.mapeditor.widget.*;
-import tiled.util.*;
-
-public class NewMapDialog extends JDialog implements ActionListener
-{
- private Map newMap;
- private IntegerSpinner mapWidth, mapHeight;
- private IntegerSpinner tileWidth, tileHeight;
- private JComboBox mapTypeChooser;
-
- public NewMapDialog(JFrame parent) {
- super(parent, "New Map", true);
- init();
- pack();
- setResizable(false);
- setLocationRelativeTo(parent);
- }
-
- private void init() {
-
- // Load dialog defaults
-
- TiledConfiguration conf = TiledConfiguration.getInstance();
-
- int defaultMapWidth = conf.getIntValue("tiled.newmapdialog.mapwidth", 64);
- int defaultMapHeight = conf.getIntValue("tiled.newmapdialog.mapheight", 64);
- int defaultTileWidth = conf.getIntValue("tiled.newmapdialog.tilewidth", 35);
- int defaultTileHeight = conf.getIntValue("tiled.newmapdialog.tileheight", 35);
-
- // Create the primitives
-
- mapWidth = new IntegerSpinner(defaultMapWidth, 1);
- mapHeight = new IntegerSpinner(defaultMapHeight, 1);
- tileWidth = new IntegerSpinner(defaultTileWidth, 1);
- tileHeight = new IntegerSpinner(defaultTileHeight, 1);
-
- // Map size fields
-
- JPanel mapSize = new VerticalStaticJPanel();
- mapSize.setLayout(new GridBagLayout());
- mapSize.setBorder(BorderFactory.createCompoundBorder(
- BorderFactory.createTitledBorder("Map size"),
- BorderFactory.createEmptyBorder(0, 5, 5, 5)));
- GridBagConstraints c = new GridBagConstraints();
- c.anchor = GridBagConstraints.EAST;
- c.fill = GridBagConstraints.NONE;
- c.insets = new Insets(5, 0, 0, 0);
- mapSize.add(new JLabel("Width: "), c);
- c.gridy = 1;
- mapSize.add(new JLabel("Height: "), c);
- c.fill = GridBagConstraints.HORIZONTAL;
- c.gridx = 1; c.gridy = 0; c.weightx = 1;
- mapSize.add(mapWidth, c);
- c.gridy = 1;
- mapSize.add(mapHeight, c);
-
- // Tile size fields
-
- JPanel tileSize = new VerticalStaticJPanel();
- tileSize.setLayout(new GridBagLayout());
- tileSize.setBorder(BorderFactory.createCompoundBorder(
- BorderFactory.createTitledBorder("Tile size"),
- BorderFactory.createEmptyBorder(0, 5, 5, 5)));
- c.gridx = 0; c.gridy = 0; c.weightx = 0;
- c.fill = GridBagConstraints.NONE;
- tileSize.add(new JLabel("Width: "), c);
- c.gridy = 1;
- tileSize.add(new JLabel("Height: "), c);
- c.fill = GridBagConstraints.HORIZONTAL;
- c.gridx = 1; c.gridy = 0; c.weightx = 1;
- tileSize.add(tileWidth, c);
- c.gridy = 1;
- tileSize.add(tileHeight, c);
-
- // OK and Cancel buttons
-
- JButton okButton = new JButton("OK");
- JButton cancelButton = new JButton("Cancel");
- okButton.addActionListener(this);
- cancelButton.addActionListener(this);
-
- JPanel buttons = new VerticalStaticJPanel();
- buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
- buttons.add(Box.createGlue());
- buttons.add(okButton);
- buttons.add(Box.createRigidArea(new Dimension(5, 0)));
- buttons.add(cancelButton);
-
- // Map type and name inputs
-
- mapTypeChooser = new JComboBox();
- mapTypeChooser.addItem("Orthogonal");
- mapTypeChooser.addItem("Isometric");
- mapTypeChooser.addItem("Shifted (iso and hex)");
- // TODO: Enable when view is implemented
- //mapTypeChooser.addItem("Oblique");
- mapTypeChooser.addItem("Hexagonal (experimental)");
-
- JPanel miscPropPanel = new VerticalStaticJPanel();
- miscPropPanel.setLayout(new GridBagLayout());
- miscPropPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
- c.gridx = 0; c.gridy = 0; c.weightx = 0;
- c.fill = GridBagConstraints.NONE;
- miscPropPanel.add(new JLabel("Map type: "), c);
- c.fill = GridBagConstraints.HORIZONTAL;
- c.gridx = 1; c.gridy = 0; c.weightx = 1;
- miscPropPanel.add(mapTypeChooser, c);
-
- // Putting two size panels next to eachother
-
- JPanel sizePanels = new JPanel();
- sizePanels.setLayout(new BoxLayout(sizePanels, BoxLayout.X_AXIS));
- sizePanels.add(mapSize);
- sizePanels.add(Box.createRigidArea(new Dimension(5, 0)));
- sizePanels.add(tileSize);
-
- // Main panel
-
- JPanel mainPanel = new JPanel();
- mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS));
- mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- mainPanel.add(miscPropPanel);
- mainPanel.add(sizePanels);
- mainPanel.add(Box.createRigidArea(new Dimension(0, 5)));
- mainPanel.add(Box.createGlue());
- mainPanel.add(buttons);
-
- getContentPane().add(mainPanel);
- getRootPane().setDefaultButton(okButton);
- }
-
- public Map create() {
- setVisible(true);
- return newMap;
- }
-
- public void actionPerformed(ActionEvent e) {
- if (e.getActionCommand().equals("OK")) {
- int w = mapWidth.intValue();
- int h = mapHeight.intValue();
- int twidth = tileWidth.intValue();
- int theight = tileHeight.intValue();
- int orientation = Map.MDO_ORTHO;
- String mapTypeString = (String)mapTypeChooser.getSelectedItem();
-
- if (mapTypeString.equals("Isometric")) {
- orientation = Map.MDO_ISO;
- } else if (mapTypeString.equals("Oblique")) {
- orientation = Map.MDO_OBLIQUE;
- } else if (mapTypeString.equals("Hexagonal (experimental)")) {
- orientation = Map.MDO_HEX;
- } else if (mapTypeString.equals("Shifted (iso and hex)")) {
- orientation = Map.MDO_SHIFTED;
- }
-
- newMap = new Map(w, h);
- newMap.addLayer();
- newMap.setTileWidth(twidth);
- newMap.setTileHeight(theight);
- newMap.setOrientation(orientation);
-
- // save dialog options
-
- TiledConfiguration conf = TiledConfiguration.getInstance();
-
- conf.addConfigPair("tiled.newmapdialog.mapwidth", Integer.toString(mapWidth.intValue()));
- conf.addConfigPair("tiled.newmapdialog.mapheight", Integer.toString(mapHeight.intValue()));
- conf.addConfigPair("tiled.newmapdialog.tilewidth", Integer.toString(tileWidth.intValue()));
- conf.addConfigPair("tiled.newmapdialog.tileheight", Integer.toString(tileHeight.intValue()));
-
- try { conf.write("tiled.conf"); }
- catch (IOException ex) {}
- catch (Exception ex) {}
-
- dispose();
- } else {
- dispose();
- }
- }
-}
Deleted: trunk/tiled/mapeditor/NewTileDialog.java
===================================================================
--- trunk/tiled/mapeditor/NewTileDialog.java 2006-01-26 06:42:52 UTC (rev 564)
+++ trunk/tiled/mapeditor/NewTileDialog.java 2006-01-27 08:46:18 UTC (rev 565)
@@ -1,100 +0,0 @@
-/*
- * Tiled Map Editor, (c) 2005
- *
- * 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;
-
-import java.awt.Dialog;
-import java.awt.event.*;
-import java.awt.image.BufferedImage;
-import java.io.File;
-
-import javax.imageio.ImageIO;
-
-import javax.swing.*;
-
-import tiled.core.*;
-
-public class NewTileDialog extends JDialog implements ActionListener {
-
- private TileSet tileset;
- private Tile currentTile=null;
- private String location;
-
- private JButton bAddTiles, bCancel;
-
- public NewTileDialog(Dialog parent, TileSet set) {
- super(parent, "New Tile", true);
- tileset = set;
- location = "";
-
- init();
- pack();
- setLocationRelativeTo(getOwner());
- }
-
- private void init() {
-
- }
-
- public Tile createTile() {
- setVisible(true);
- return currentTile;
- }
-
- private void pickImage() {
- if (tileset.usesSharedImages()) {
- TileImageDialog d = new TileImageDialog(this, tileset);
- d.setVisible(true);
- if (d.getImageId() >= 0) {
- currentTile = new Tile(tileset);
- currentTile.setImage(d.getImageId());
- currentTile.setImageOrientation(d.getImageOrientation());
- }
- return;
- }
-
- File files[];
- JFileChooser ch = new JFileChooser(location);
- ch.setMultiSelectionEnabled(true);
- BufferedImage image = null;
-
- int ret = ch.showOpenDialog(this);
- if(ret == JFileChooser.APPROVE_OPTION) {
- files = ch.getSelectedFiles();
-
- for (int i = 0; i < files.length; i++) {
- try {
- image = ImageIO.read(files[i]);
- // TODO: Support for a transparent color
- } catch (Exception e) {
- JOptionPane.showMessageDialog(this, e.getMessage(),
- "Error!", JOptionPane.ERROR_MESSAGE);
- return;
- }
-
- Tile newTile = new Tile(tileset);
- newTile.setImage(image);
- tileset.addNewTile(newTile);
- }
-
- if (files.length > 0) {
- location = files[0].getAbsolutePath();
- }
-
- }
- }
-
- public void actionPerformed(ActionEvent e) {
- // TODO Auto-generated method stub
-
- }
-}
Deleted: trunk/tiled/mapeditor/NewTilesetDialog.java
===================================================================
--- trunk/tiled/mapeditor/NewTilesetDialog.java 2006-01-26 06:42:52 UTC (rev 564)
+++ trunk/tiled/mapeditor/NewTilesetDialog.java 2006-01-27 08:46:18 UTC (rev 565)
@@ -1,341 +0,0 @@
-/*
- * Tiled Map Editor, (c) 2004
- *
- * 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;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.image.BufferedImage;
-import java.awt.image.FilteredImageSource;
-import java.io.File;
-import java.io.IOException;
-
-import javax.imageio.ImageIO;
-import javax.swing.*;
-import javax.swing.event.*;
-
-import tiled.core.*;
-import tiled.mapeditor.util.TransparentImageFilter;
-import tiled.mapeditor.util.cutter.BasicTileCutter;
-import tiled.mapeditor.util.cutter.BorderTileCutter;
-import tiled.mapeditor.util.cutter.TileCutter;
-import tiled.mapeditor.widget.*;
-
-
-/**
- * A dialog for creating a new tileset.
- */
-public class NewTilesetDialog extends JDialog implements ActionListener,
- ChangeListener
-{
- private Map map;
- private TileSet newTileset;
- private JTextField tileWidth, tileHeight;
- private IntegerSpinner tileSpacing;
- private JTextField tilesetName;
- private JTextField tilebmpFile;
- private JLabel nameLabel, tileWidthLabel, tileHeightLabel, spacingLabel;
- private JLabel tilebmpFileLabel, cutterLabel;
- private JCheckBox tilebmpCheck, tileAutoCheck, transCheck;
- private JComboBox cutterBox;
- //private JRadioButton importRadio;
- //private JRadioButton referenceRadio;
- private JButton okButton, cancelButton, browseButton, propsButton;
- private ColorButton colorButton;
- private String path;
-
- public NewTilesetDialog(JFrame parent, Map map) {
- super(parent, "New Tileset", true);
- this.map = map;
- path = map.getFilename();
- init();
- pack();
- setLocationRelativeTo(parent);
- }
-
- private void init() {
- // Create the primitives
-
- nameLabel = new JLabel("Tileset name: ");
- tileWidthLabel = new JLabel("Tile width: ");
- tileHeightLabel = new JLabel("Tile height: ");
- spacingLabel = new JLabel("Tile spacing: ");
- tilebmpFileLabel = new JLabel("Tile image: ");
- cutterLabel = new JLabel("Tile Cutter: ");
-
- tilesetName = new JTextField("Untitled");
- tileWidth = new JTextField("" + map.getTileWidth(), 3);
- tileHeight = new JTextField("" + map.getTileHeight(), 3);
- tileSpacing = new IntegerSpinner(0, 0);
- tilebmpFile = new JTextField(10);
- tilebmpFile.setEnabled(false);
-
- tileWidthLabel.setEnabled(false);
- tileHeightLabel.setEnabled(false);
- tileWidth.setEnabled(false);
- tileHeight.setEnabled(false);
-
- cutterBox = new JComboBox(new String[] {"Basic", "Border"});
- cutterBox.setEditable(false);
- cutterBox.setEnabled(false);
- cutterLabel.setEnabled(false);
-
- tilebmpCheck = new JCheckBox("Reference tileset image", false);
- tilebmpCheck.addChangeListener(this);
-
- tileAutoCheck = new JCheckBox("Automatically create tiles from images",
- true);
- tileAutoCheck.setEnabled(false);
-
- transCheck = new JCheckBox("Use transparent color");
- transCheck.addChangeListener(this);
-
- okButton = new JButton("OK");
- cancelButton = new JButton("Cancel");
- browseButton = new JButton("Browse...");
- propsButton = new JButton("Set Default Properties...");
- colorButton = new ColorButton(new Color(255, 0, 255));
- okButton.addActionListener(this);
- cancelButton.addActionListener(this);
- browseButton.addActionListener(this);
- propsButton.addActionListener(this);
- colorButton.addActionListener(this);
-
- // Combine browse button and tile bitmap path text field
-
- JPanel tilebmpPathPanel = new JPanel(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
- c.gridx = 0; c.gridy = 0; c.weightx = 1;
- c.fill = GridBagConstraints.HORIZONTAL;
- tilebmpPathPanel.add(tilebmpFile, c);
- c.gridx = 1; c.weightx = 0;
- c.fill = GridBagConstraints.NONE;
- c.insets = new Insets(0, 5, 0, 0);
- tilebmpPathPanel.add(browseButton, c);
-
- // Combine transparent color label and button
-
- JPanel tileColorPanel = new JPanel(new GridBagLayout());
- c = new GridBagConstraints();
- c.gridx = 0; c.gridy = 0; c.weightx = 1;
- c.fill = GridBagConstraints.HORIZONTAL;
- tileColorPanel.add(transCheck, c);
- c.gridx = 1;
- tileColorPanel.add(colorButton);
-
- // Create the tile bitmap import setting panel
-
- JPanel tilebmpPanel = new VerticalStaticJPanel();
- tilebmpPanel.setLayout(new GridBagLayout());
- tilebmpPanel.setBorder(BorderFactory.createCompoundBorder(
- BorderFactory.createTitledBorder("From tileset image"),
- BorderFactory.createEmptyBorder(0, 5, 5, 5)));
- c.gridx = 0; c.gridy = 0; c.weightx = 0;
- c.insets = new Insets(5, 0, 0, 0);
- c.anchor = GridBagConstraints.EAST;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.gridwidth = 2;
- tilebmpPanel.add(tilebmpCheck, c);
- c.gridy = 1;
- tilebmpPanel.add(tileAutoCheck, c);
- c.gridy = 2; c.gridwidth = 1;
- c.fill = GridBagConstraints.NONE;
- tilebmpPanel.add(tilebmpFileLabel, c);
- c.gridy = 3;
- tilebmpPanel.add(spacingLabel, c);
- c.gridy = 4;
- tilebmpPanel.add(cutterLabel,c );
- c.gridx = 1; c.gridy = 2; c.weightx = 1;
- c.fill = GridBagConstraints.HORIZONTAL;
- tilebmpPanel.add(tilebmpPathPanel, c);
- c.gridy = 3;
- tilebmpPanel.add(tileSpacing, c);
- c.gridy = 4;
- tilebmpPanel.add(cutterBox,c);
- c.gridx = 0; c.gridy = 5; c.gridwidth = 2;
- tilebmpPanel.add(tileColorPanel, c);
- c.gridx = 1; c.gridwidth = 1;
-
- // OK and Cancel buttons
-
- JPanel buttons = new VerticalStaticJPanel();
- buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
- buttons.add(Box.createGlue());
- buttons.add(okButton);
- buttons.add(Box.createRigidArea(new Dimension(5, 0)));
- buttons.add(cancelButton);
-
-
- // Top part of form
-
- JPanel miscPropPanel = new VerticalStaticJPanel();
- miscPropPanel.setLayout(new GridBagLayout());
- miscPropPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
- c.gridx = 0; c.gridy = 0; c.weightx = 0;
- c.fill = GridBagConstraints.NONE;
- c.insets = new Insets(5, 0, 0, 0);
- miscPropPanel.add(nameLabel, c);
- c.gridy = 1;
- miscPropPanel.add(tileWidthLabel, c);
- c.gridy = 2;
- miscPropPanel.add(tileHeightLabel, c);
- c.fill = GridBagConstraints.HORIZONTAL;
- c.gridx = 1; c.gridy = 0; c.weightx = 1;
- miscPropPanel.add(tilesetName, c);
- c.gridy = 1;
- miscPropPanel.add(tileWidth, c);
- c.gridy = 2;
- miscPropPanel.add(tileHeight, c);
- c.gridy = 3;
- miscPropPanel.add(propsButton, c);
-
- // Main panel
-
- JPanel mainPanel = new JPanel();
- mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS));
- mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- mainPanel.add(miscPropPanel);
- mainPanel.add(tilebmpPanel);
- mainPanel.add(Box.createRigidArea(new Dimension(0, 5)));
- mainPanel.add(Box.createGlue());
- mainPanel.add(buttons);
-
- getContentPane().add(mainPanel);
- getRootPane().setDefaultButton(okButton);
-
- setUseTileBitmap(tilebmpCheck.isSelected());
- }
-
- public TileSet create() {
- setVisible(true);
- return newTileset;
- }
-
- public TileCutter getCutter(int w, int h, int s) {
- if(((String)cutterBox.getSelectedItem()).equalsIgnoreCase("basic")) {
- return new BasicTileCutter(w, h, s, 0);
- } else if(((String)cutterBox.getSelectedItem()).equalsIgnoreCase("border")) {
- return new BorderTileCutter();
- }
-
- return null;
- }
-
- public void actionPerformed(ActionEvent event) {
- Object source = event.getSource();
-
- if (source == okButton) {
- newTileset = new TileSet();
- newTileset.setName(tilesetName.getText());
-
- if (tilebmpCheck.isSelected()) {
- String file = tilebmpFile.getText();
- int spacing = tileSpacing.intValue();
- try {
- if (!transCheck.isSelected()) {
- newTileset.importTileBitmap(file,
- getCutter(map.getTileWidth(),
- map.getTileHeight(),
- spacing),
- tileAutoCheck.isSelected());
- } else {
- try {
- Toolkit tk = Toolkit.getDefaultToolkit();
- Image orig = ImageIO.read(new File(file));
- Image trans = tk.createImage(
- new FilteredImageSource(orig.getSource(),
- new TransparentImageFilter(
- colorButton.getColor().getRGB())));
- BufferedImage img = new BufferedImage(
- trans.getWidth(null),
- trans.getHeight(null),
- BufferedImage.TYPE_INT_ARGB);
-
- img.getGraphics().drawImage(trans, 0, 0, null);
-
- newTileset.importTileBitmap(img,
- getCutter(map.getTileWidth(),
- map.getTileHeight(),
- spacing),
- tileAutoCheck.isSelected());
-
- newTileset.setTransparentColor(
- colorButton.getColor());
-
- newTileset.setTilesetImageFilename(file);
- } catch (Exception e) {
- }
- }
- } catch (Exception e) {
- JOptionPane.showMessageDialog(this,
- e.getMessage(), "Error while importing tileset",
- JOptionPane.ERROR_MESSAGE);
- newTileset = null;
- }
- }
-
- dispose();
- } else if (source == browseButton) {
- JFileChooser ch = new JFileChooser(path);
-
- int ret = ch.showOpenDialog(this);
- if (ret == JFileChooser.APPROVE_OPTION) {
- path = ch.getSelectedFile().getAbsolutePath();
- tilebmpFile.setText(path);
- }
- } else if (source == colorButton) {
- ImageColorDialog icd;
- try {
- icd = new ImageColorDialog(
- ImageIO.read(new File(tilebmpFile.getText())));
- Color c = icd.showDialog();
- if (c != null) {
- colorButton.setColor(c);
- }
- } catch (IOException e) {
- JOptionPane.showMessageDialog(getOwner(),
- "Error while loading image: " + e.getMessage(),
- "Error while choosing color",
- JOptionPane.ERROR_MESSAGE);
- }
- } else if (source == propsButton) {
-
- } else {
- dispose();
- }
- }
-
- public void stateChanged(ChangeEvent event) {
- Object source = event.getSource();
-
- if (source == tilebmpCheck) {
- setUseTileBitmap(tilebmpCheck.isSelected());
- }
- else if (source == transCheck) {
- colorButton.setEnabled(tilebmpCheck.isSelected() &&
- transCheck.isSelected());
- }
- }
-
- private void setUseTileBitmap(boolean value) {
- tilebmpFile.setEnabled(value);
- tilebmpFileLabel.setEnabled(value);
- browseButton.setEnabled(value);
- tileSpacing.setEnabled(value);
- spacingLabel.setEnabled(value);
- tileAutoCheck.setEnabled(value);
- transCheck.setEnabled(value);
- colorButton.setEnabled(value && transCheck.isSelected());
- cutterBox.setEnabled(value && tileAutoCheck.isSelected());
- cutterLabel.setEnabled(value && tileAutoCheck.isSelected());
- }
-}
Deleted: trunk/tiled/mapeditor/ObjectDialog.java
===================================================================
--- trunk/tiled/mapeditor/ObjectDialog.java 2006-01-26 06:42:52 UTC (rev 564)
+++ trunk/tiled/mapeditor/ObjectDialog.java 2006-01-27 08:46:18 UTC (rev 565)
@@ -1,26 +0,0 @@
-/*
- * Tiled Map Editor, (c) 2004
- *
- * 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;
-
-import javax.swing.JDialog;
-
-
-public class ObjectDialog extends JDialog
-{
- ObjectDialog() {
- super();
- }
-
- public void init() {
- }
-}
Deleted: trunk/tiled/mapeditor/PluginDialog.java
===================================================================
--- trunk/tiled/mapeditor/PluginDialog.java 2006-01-26 06:42:52 UTC (rev 564)
+++ trunk/tiled/mapeditor/PluginDialog.java 2006-01-27 08:46:18 UTC (rev 565)
@@ -1,152 +0,0 @@
-/*
- * Tiled Map Editor, (c) 2004
- *
- * 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;
-
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.*;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.ListSelectionEvent;
-
-import tiled.io.MapReader;
-import tiled.io.MapWriter;
-import tiled.mapeditor.plugin.PluginClassLoader;
-import tiled.mapeditor.widget.VerticalStaticJPanel;
-
-
-public class PluginDialog extends JDialog implements ActionListener,
- ListSelectionListener
-{
- private PluginClassLoader pluginLoader;
- private JList pluginList = null;
- private JButton closeButton, infoButton, removeButton;
-
- public PluginDialog(JFrame parent, PluginClassLoader pluginLoader) {
- super(parent, "Available Plugins", true);
- this.pluginLoader = pluginLoader;
-
- init();
- pack();
- setLocationRelativeTo(getOwner());
- }
-
- private void init() {
- /* LIST PANEL */
- MapReader readers[];
- MapWriter writers[];
-
- try {
- readers = pluginLoader.getReaders();
- writers = pluginLoader.getWriters();
- String[] plugins = new String[readers.length + writers.length];
-
- for (int i = 0; i < readers.length; i++) {
- plugins[i] = readers[i].getPluginPackage();
- }
- for (int i = 0; i < writers.length; i++) {
- plugins[i + readers.length] = writers[i].getPluginPackage();
- }
- pluginList = new JList(plugins);
- } catch (Throwable e) {
- e.printStackTrace();
- pluginList = new JList();
- }
-
- pluginList.addListSelectionListener(this);
-
- JScrollPane pluginScrollPane = new JScrollPane(pluginList);
- pluginScrollPane.setAutoscrolls(true);
- pluginScrollPane.setPreferredSize(new Dimension(200, 150));
-
-
- /* BUTTON PANEL */
- infoButton = new JButton("Info");
- removeButton = new JButton("Remove");
- closeButton = new JButton("Close");
- infoButton.addActionListener(this);
- removeButton.addActionListener(this);
- closeButton.addActionListener(this);
-
- JPanel buttonPanel = new VerticalStaticJPanel();
- buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
- buttonPanel.add(infoButton);
- buttonPanel.add(Box.createRigidArea(new Dimension(5, 0)));
- buttonPanel.add(removeButton);
- buttonPanel.add(Box.createGlue());
- buttonPanel.add(Box.createRigidArea(new Dimension(5, 0)));
- buttonPanel.add(closeButton);
-
- JPanel mainPanel = new JPanel();
- mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
- mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- mainPanel.add(pluginScrollPane);
- mainPanel.add(Box.createRigidArea(new Dimension(0, 5)));
- mainPanel.add(buttonPanel);
-
- setContentPane(mainPanel);
- getRootPane().setDefaultButton(closeButton);
- setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- updateButtons();
- }
-
- public void actionPerformed(ActionEvent event) {
- Object source = event.getSource();
-
- if (source == closeButton) {
- this.dispose();
- } else if (source == removeButton) {
- // TODO: Implement plugin remove functionality
- } else if (source == infoButton) {
- JDialog info = new JDialog(this);
- JTextArea ta = new JTextArea(25, 30);
- int index = pluginList.getSelectedIndex();
-
- MapReader[] readers;
- MapWriter[] writers;
- try {
- readers = pluginLoader.getReaders();
- writers = pluginLoader.getWriters();
- if (index < readers.length) {
- ta.setText(readers[index].getDescription());
- info.setTitle(readers[index].getPluginPackage());
- } else {
- index -= readers.length;
- ta.setText(writers[index].getDescription());
- info.setTitle(writers[index].getPluginPackage());
- }
- } catch (Throwable t) {
- t.printStackTrace();
- }
- ta.setEditable(false);
- ta.setFont(new Font("Courier", Font.PLAIN, 12));
- info.getContentPane().add(ta);
- info.setLocationRelativeTo(this);
- info.pack();
- info.setVisible(true);
- }
- }
-
- public void valueChanged(ListSelectionEvent event) {
- updateButtons();
- }
-
- private void updateButtons() {
- boolean validSelection = pluginList.getSelectedIndex() >= 0;
- infoButton.setEnabled(validSelection);
- // TODO: Enable "Remove" button when functional
- removeButton.setEnabled(validSelection && false);
- }
-}
Deleted: trunk/tiled/mapeditor/PropertiesDialog.java
===================================================================
--- trunk/tiled/mapeditor/PropertiesDialog.java 2006-01-26 06:42:52 UTC (rev 564)
+++ trunk/tiled/mapeditor/PropertiesDialog.java 2006-01-27 08:46:18 UTC (rev 565)
@@ -1,143 +0,0 @@
-/*
- * Tiled Map Editor, (c) 2004
- *
- * 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;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Properties;
-import javax.swing.*;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-
-import tiled.mapeditor.util.*;
-import tiled.mapeditor.widget.*;
-
-public class PropertiesDialog extends JDialog implements ActionListener,
- ListSelectionListener
-{
- private JTable tProperties;
- private JButton bOk, bCancel, bDel;
- private Properties properties;
- private PropertiesTableModel tableModel;
-
- public PropertiesDialog(JFrame parent, Properties p) {
- super(parent, "Properties", true);
- properties = p;
- init();
- pack();
- setLocationRelativeTo(getOwner());
- }
-
- private void init() {
- tableModel = new PropertiesTableModel();
- tProperties = new JTable(tableModel);
- tProperties.getSelectionModel().addListSelectionListener(this);
- JScrollPane propScrollPane = new JScrollPane(tProperties);
- propScrollPane.setPreferredSize(new Dimension(200, 150));
-
- bOk = new JButton("OK");
- bCancel = new JButton("Cancel");
- try {
- bDel = new JButton(new ImageIcon(MapEditor.loadImageResource("resources/gnome-delete.png")));
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- bOk.addActionListener(this);
- bCancel.addActionListener(this);
- bDel.addActionListener(this);
-
- JPanel user = new VerticalStaticJPanel();
- user.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
- user.setLayout(new BoxLayout(user, BoxLayout.X_AXIS));
- user.add(Box.createGlue());
- user.add(Box.createRigidArea(new Dimension(5, 0)));
- user.add(bDel);
-
- JPanel buttons = new VerticalStaticJPanel();
- buttons.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
- buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
- buttons.add(Box.createGlue());
- buttons.add(bOk);
- buttons.add(Box.createRigidArea(new Dimension(5, 0)));
- buttons.add(bCancel);
-
- JPanel mainPanel = new JPanel();
- mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
- mainPanel.add(propScrollPane);
- mainPanel.add(user);
- mainPanel.add(buttons);
-
- getContentPane().add(mainPanel);
- getRootPane().setDefaultButton(bOk);
- }
-
- private void updateInfo() {
- // Make a copy of the properties that will be changed by the
- // properties table model.
- Properties props = new Properties();
- Enumeration keys = properties.keys();
- while (keys.hasMoreElements()) {
- String key = (String)keys.nextElement();
- props.put(key, properties.getProperty(key));
- }
- tableModel.update(props);
- }
-
- public void getProps() {
- updateInfo();
- setVisible(true);
- }
-
- public void actionPerformed(ActionEvent event) {
- Object source = event.getSource();
-
- if (source == bOk) {
- // Copy over the new set of properties from the properties table
- // model.
- properties.clear();
-
- Properties newProps = tableModel.getProperties();
- Enumeration keys = newProps.keys();
- while (keys.hasMoreElements()) {
- String key = (String)keys.nextElement();
- properties.put(key, newProps.getProperty(key));
- }
-
- dispose();
- } else if (source == bCancel) {
- dispose();
- } else if (source == bDel) {
- int total = tProperties.getSelectedRowCount();
- Object[] keys = new Object[total];
- int[] selRows = tProperties.getSelectedRows();
-
- for(int i = 0; i < total; i++) {
- keys[i] = tProperties.getValueAt(selRows[i], 0);
- }
-
- for (int i = 0; i < total; i++) {
- if (keys[i] != null) {
- tableModel.remove(keys[i]);
- }
- }
- }
- }
-
- public void valueChanged(ListSelectionEvent e) {
- }
-}
Deleted: trunk/tiled/mapeditor/ResizeDialog.java
===================================================================
--- trunk/tiled/mapeditor/ResizeDialog.java 2006-01-26 06:42:52 UTC (rev 564)
+++ trunk/tiled/mapeditor/ResizeDialog.java 2006-01-27 08:46:18 UTC (rev 565)
@@ -1,196 +0,0 @@
-/*
- * Tiled Map Editor, (c) 2004
- *
- * 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;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import javax.swing.*;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-
-import tiled.core.Map;
-import tiled.mapeditor.widget.*;
-
-public class ResizeDialog extends JDialog implements ActionListener,
- PropertyChangeListener, ChangeListener
-{
- private Map currentMap;
- private IntegerSpinner width, height, offsetX, offsetY;
- private JButton bOk, bCancel;
- private ResizePanel orient;
-
- public ResizeDialog(JFrame parent, MapEditor m) {
- super(parent, "Resize Map", true);
- currentMap = m.getCurrentMap();
- init();
- setLocationRelativeTo(getOwner());
- }
-
- private void init() {
- // Create the primitives
-
- bOk = new JButton("OK");
- bCancel = new JButton("Cancel");
-
- width = new IntegerSpinner(currentMap.getWidth(), 1);
- height = new IntegerSpinner(currentMap.getHeight(), 1);
- offsetX = new IntegerSpinner();
- offsetY = new IntegerSpinner();
-
- offsetX.addChangeListener(this);
- offsetY.addChangeListener(this);
-
- orient = new ResizePanel(currentMap);
- orient.addPropertyChangeListener(this);
-
- // Offset panel
- JPanel offsetPanel = new VerticalStaticJPanel();
- offsetPanel.setBorder(BorderFactory.createCompoundBorder(
- BorderFactory.createTitledBorder("Offset"),
- BorderFactory.createEmptyBorder(0, 5, 5, 5)));
- offsetPanel.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
- c.anchor = GridBagConstraints.WEST;
- c.fill = GridBagConstraints.BOTH; c.weighty = 1;
- c.insets = new Insets(5, 0, 0, 0);
- offsetPanel.add(new JLabel("X: "), c);
- c.gridy = 1;
- offsetPanel.add(new JLabel("Y: "), c);
- c.gridx = 1; c.gridy = 0;
- offsetPanel.add(offsetX, c);
- c.gridy = 1;
- offsetPanel.add(offsetY, c);
- c.gridx = 2; c.gridy = 0; c.gridheight = 2; c.weightx = 1;
- offsetPanel.add(new JPanel(), c);
- c.gridx = 0; c.gridy = 2; c.gridwidth = 3; c.gridheight = 1;
- //offsetPanel.add(orient, c);
-
- // New size panel
- JPanel newSizePanel = new VerticalStaticJPanel(new GridBagLayout());
- newSizePanel.setBorder(BorderFactory.createCompoundBorder(
- BorderFactory.createTitledBorder("New size"),
- BorderFactory.createEmptyBorder(0, 5, 5, 5)));
- c = new GridBagConstraints();
- c.anchor = GridBagConstraints.WEST;
- c.fill = GridBagConstraints.BOTH; c.weighty = 1;
- c.insets = new Insets(5, 0, 0, 0);
- newSizePanel.add(new JLabel("Width: "), c);
- c.gridy = 1;
- newSizePanel.add(new JLabel("Height: "), c);
- c.fill = GridBagConstraints.HORIZONTAL;
- c.gridx = 1; c.gridy = 0; c.weightx = 1;
- newSizePanel.add(width, c);
- c.gridy = 1;
- newSizePanel.add(height, c);
-
- // Original size panel
- JPanel origSizePanel = new VerticalStaticJPanel(new GridBagLayout());
- origSizePanel.setBorder(BorderFactory.createCompoundBorder(
- BorderFactory.createTitledBorder("Current size"),
- BorderFactory.createEmptyBorder(0, 5, 5, 5)));
- c = new GridBagConstraints();
- c.anchor = GridBagConstraints.EAST;
- c.fill = GridBagConstraints.BOTH; c.weighty = 1; c.weightx = 1;
- c.insets = new Insets(5, 0, 0, 0);
- origSizePanel.add(new JLabel("Width: "), c);
- c.gridy = 1;
- origSizePanel.add(new JLabel("Height: "), c);
- c.anchor = GridBagConstraints.WEST;
- c.insets = new Insets(5, 10, 0, 0);
- c.gridx = 1; c.gridy = 0;
- origSizePanel.add(new JLabel("" + currentMap.getWidth()), c);
- c.gridy = 1;
- origSizePanel.add(new JLabel("" + currentMap.getHeight()), c);
-
- // Putting two size panels next to eachother
- JPanel sizePanels = new VerticalStaticJPanel(new GridBagLayout());
- c = new GridBagConstraints();
- c.fill = GridBagConstraints.BOTH;
- c.gridx = 0; c.gridy = 0; c.weighty = 1; c.weightx = 0;
- sizePanels.add(origSizePanel, c);
- c.gridx = 1; c.weightx = 1;
- sizePanels.add(newSizePanel, c);
-
- // Buttons panel
- bOk.addActionListener(this);
- bCancel.addActionListener(this);
- JPanel buttons = new VerticalStaticJPanel();
- buttons.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
- buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
- buttons.add(Box.createGlue());
- buttons.add(bOk);
- buttons.add(Box.createRigidArea(new Dimension(5, 0)));
- buttons.add(bCancel);
-
- // Putting the main panel together
- JPanel mainPanel = new JPanel();
- mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS));
- mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- mainPanel.add(sizePanels);
- mainPanel.add(offsetPanel);
- mainPanel.add(Box.createRigidArea(new Dimension(0, 5)));
- mainPanel.add(Box.createGlue());
- mainPanel.add(buttons);
-
- getContentPane().add(mainPanel);
- getRootPane().setDefaultButton(bOk);
- pack();
- }
-
- public void actionPerformed(ActionEvent e) {
- Object src = e.getSource();
-
- if (src == bOk) {
- int nwidth = width.intValue();
- int nheight = height.intValue();
- int dx = offsetX.intValue();
- int dy = offsetY.intValue();
- // Math works out in MapLayer#resize
- currentMap.resize(nwidth, nheight, dx, dy);
- dispose();
- } else if (src == bCancel) {
- dispose();
- } else {
- System.out.println(e.getActionCommand());
- }
- }
-
- public void propertyChange(PropertyChangeEvent evt) {
- double zoom = orient.getZoom();
-
- if (evt.getPropertyName().equalsIgnoreCase("offsetX")) {
- int val = ((Integer)evt.getNewValue()).intValue();
- offsetX.setValue((int)(val / (currentMap.getTileWidth() * zoom)));
- } else if(evt.getPropertyName().equalsIgnoreCase("offsetY")) {
- int val = ((Integer)evt.getNewValue()).intValue();
- offsetY.setValue((int)(val / (currentMap.getTileHeight() * zoom)));
- }
- }
-
- public void stateChanged(ChangeEvent e) {
- Object source = e.getSource();
-
- if (source == offsetX || source == offsetY) {
- int dx = offsetX.intValue();
- int dy = offsetY.intValue();
- double zoom = orient.getZoom();
-
- orient.moveMap(
- (int)(dx * (currentMap.getTileWidth() * zoom)),
- (int)(dy * (currentMap.getTileHeight() * zoom)));
- }
- }
-}
Deleted: trunk/tiled/mapeditor/SearchDialog.java
===================================================================
--- trunk/tiled/mapeditor/SearchDialog.java 2006-01-26 06:42:52 UTC (rev 564)
+++ trunk/tiled/mapeditor/SearchDialog.java 2006-01-27 08:46:18 UTC (rev 565)
@@ -1,261 +0,0 @@
-/*
- * Tiled Map Editor, (c) 2004
- *
- * 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;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.util.*;
-import javax.swing.*;
-
-import tiled.mapeditor.selection.SelectionLayer;
-import tiled.mapeditor.util.MultisetListRenderer;
-import tiled.mapeditor.widget.*;
-import tiled.core.*;
-import tiled.core.Map;
-
-
-public class SearchDialog extends JDialog implements ActionListener
-{
- private Map myMap;
- private JComboBox searchCBox, replaceCBox;
- private JButton bFind, bFindAll;
- private JButton bReplace, bReplaceAll;
- private JButton bClose;
- private Point currentMatch = null;
- private SelectionLayer sl;
-
- public SearchDialog(JFrame parent) {
- this(parent, null);
- }
-
- public SearchDialog(JFrame parent, Map map) {
- super(parent, "Search/Replace", false);
- myMap = map;
- init();
- setLocationRelativeTo(parent);
- }
-
- private void init() {
- /* SEARCH PANEL */
- JPanel searchPanel = new JPanel();
- searchPanel.setBorder(BorderFactory.createEtchedBorder());
- searchPanel.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
- c.fill = GridBagConstraints.BOTH;
- c.weightx = 2; c.weighty = 1;
- searchPanel.add(new JLabel("Find:"), c);
- c.gridx = 1;
- searchCBox = new JComboBox();
- searchCBox.setRenderer(new MultisetListRenderer(myMap, .5));
- //searchCBox.setSelectedIndex(1);
- searchCBox.setEditable(false);
- searchPanel.add(searchCBox, c);
- c.gridy = 1;
- c.gridx = 0;
- searchPanel.add(new JLabel("Replace:"), c);
- c.gridx = 1;
- replaceCBox = new JComboBox();
- replaceCBox.setRenderer(new MultisetListRenderer(myMap, .5));
- //searchCBox.setSelectedIndex(1);
- replaceCBox.setEditable(false);
- searchPanel.add(replaceCBox,c);
- queryTiles(searchCBox);
- //replaceCBox.addItem(null);
- queryTiles(replaceCBox);
-
- /* SCOPE PANEL */
- /*
- JPanel scopePanel = new JPanel();
- scopePanel.setBorder(BorderFactory.createCompoundBorder(
- BorderFactory.createTitledBorder("Scope"),
- BorderFactory.createEmptyBorder(0, 5, 5, 5)));
- */
-
- bFind = new JButton("Find");
- bFindAll = new JButton("Find All");
- bReplace = new JButton("Replace");
- bReplaceAll = new JButton("Replace All");
- bClose = new JButton("Close");
-
- bFind.addActionListener(this);
- bFindAll.addActionListener(this);
- bReplace.addActionListener(this);
- bReplaceAll.addActionListener(this);
- bClose.addActionListener(this);
-
-
- /* BUTTONS PANEL */
- JPanel buttonPanel = new JPanel();
- buttonPanel.setLayout(new GridLayout(2, 2, 5, 5));
- buttonPanel.add(bFind);
- buttonPanel.add(bFindAll);
- buttonPanel.add(bReplace);
- buttonPanel.add(bReplaceAll);
-
- JPanel closePanel = new VerticalStaticJPanel();
- closePanel.setLayout(new BorderLayout());
- closePanel.add(bClose, BorderLayout.EAST);
-
- JPanel mainPanel = new JPanel();
- mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
- mainPanel.add(searchPanel, BorderLayout.NORTH);
- mainPanel.add(Box.createRigidArea(new Dimension(0, 5)));
- //mainPanel.add(scopePanel);
- //mainPanel.add(Box.createRigidArea(new Dimension(0, 5)));
- mainPanel.add(buttonPanel);
- mainPanel.add(Box.createRigidArea(new Dimension(0, 5)));
- mainPanel.add(closePanel);
-
- getContentPane().add(mainPanel);
- getRootPane().setDefaultButton(bFind);
- pack();
- }
-
- private void queryTiles(JComboBox b) {
- Vector sets = myMap.getTilesets();
- int curSlot = 0;
- Iterator itr = sets.iterator();
-
- while (itr.hasNext()) {
- TileSet ts = (TileSet)itr.next();
- b.addItem(ts);
-
- Iterator tileIterator = ts.iterator();
- while (tileIterator.hasNext()) {
- Tile tile = (Tile)tileIterator.next();
- b.addItem(tile);
- }
- }
- }
-
- public void actionPerformed(ActionEvent e) {
- String command = e.getActionCommand();
-
- if (command.equalsIgnoreCase("close")) {
- myMap.removeLayerSpecial(sl);
- this.dispose();
- } else if (command.equalsIgnoreCase("find")) {
- if (searchCBox.getSelectedItem() instanceof Tile) {
- find((Tile)searchCBox.getSelectedItem());
- }
- } else if (command.equalsIgnoreCase("find all")) {
- if (sl != null) {
- myMap.removeLayerSpecial(sl);
- }
-
- sl = new SelectionLayer(myMap.getWidth(), myMap.getHeight());
- ListIterator itr = myMap.getLayers();
- while (itr.hasNext()) {
- MapLayer layer = (MapLayer) itr.next();
- if (layer instanceof TileLayer) {
- Rectangle bounds = layer.getBounds();
- for (int y = 0; y < bounds.height; y++) {
- for (int x = 0; x < bounds.width; x++) {
- if (((TileLayer)layer).getTileAt(x,y) == (Tile) searchCBox.getSelectedItem()) {
- sl.select(x,y);
- }
- }
- }
- }
- }
- myMap.addLayerSpecial(sl);
- myMap.touch();
-
- } else if (command.equalsIgnoreCase("replace all")) {
- if (!(searchCBox.getSelectedItem() instanceof TileSet) && !(replaceCBox.getSelectedItem() instanceof TileSet))
- replaceAll((Tile) searchCBox.getSelectedItem(),(Tile) replaceCBox.getSelectedItem());
- } else if (command.equalsIgnoreCase("replace")) {
- if ((searchCBox.getSelectedItem() instanceof Tile) && (replaceCBox.getSelectedItem() instanceof Tile)) {
- if (currentMatch == null) {
- find((Tile)searchCBox.getSelectedItem());
- }
-
- // run through the layers, look for the first instance of the
- // tile we need to replace
- ListIterator itr = myMap.getLayers();
- while (itr.hasNext()) {
- MapLayer layer = (MapLayer) itr.next();
- if (layer instanceof TileLayer) {
- if (((TileLayer)layer).getTileAt(currentMatch.x,currentMatch.y) == (Tile) searchCBox.getSelectedItem()) {
- ((TileLayer)layer).setTileAt(currentMatch.x,currentMatch.y, (Tile) replaceCBox.getSelectedItem());
- break;
- }
- }
- }
- // find the next instance, effectively stepping forward in our
- // replace
- find((Tile)searchCBox.getSelectedItem());
- }
- }
-
- }
-
- private void replaceAll(Tile f, Tile r) {
- // TODO: Allow for "scopes" of one or more layers, rather than all
- // layers
- ListIterator itr = myMap.getLayers();
- while (itr.hasNext()) {
- MapLayer layer = (MapLayer) itr.next();
- if (layer instanceof TileLayer) {
- ((TileLayer)layer).replaceTile(f,r);
- }
- }
- myMap.touch();
- }
-
- private void find(Tile f) {
- boolean bFound = false;
-
- if (sl != null) {
- myMap.removeLayerSpecial(sl);
- myMap.touch();
- }
-
- sl = new SelectionLayer(myMap.getWidth(), myMap.getHeight());
-
-
- int startx = currentMatch == null ? 0 : currentMatch.x;
- int starty = currentMatch == null ? 0 : currentMatch.y;
-
- for (int y = starty; y < myMap.getHeight() && !bFound; y++) {
- for (int x = startx; x < myMap.getWidth() && !bFound; x++) {
- ListIterator itr = myMap.getLayers();
- while (itr.hasNext()) {
- MapLayer layer = (MapLayer) itr.next();
-
- if (layer instanceof TileLayer) {
- Rectangle bounds = layer.getBounds();
-
- if (((TileLayer)layer).getTileAt(x,y) == (Tile) searchCBox.getSelectedItem()) {
- if (currentMatch != null) {
- if (currentMatch.equals(new Point(x,y))) {
- continue;
- }
- }
- sl.select(x,y);
- bFound = true;
- currentMatch = new Point(x,y);
- break;
- }
- }
- }
- }
- }
-
- if (bFound) {
- myMap.addLayerSpecial(sl);
- myMap.touch();
- }
- }
-}
Deleted: trunk/tiled/mapeditor/TileDialog.java
===================================================================
--- trunk/tiled/mapeditor/TileDialog.java 2006-01-26 06:42:52 UTC (rev 564)
+++ trunk/tiled/mapeditor/TileDialog.java 2006-01-27 08:46:18 UTC (rev 565)
@@ -1,546 +0,0 @@
-/*
- * Tiled Map Editor, (c) 2004
- *
- * 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>
- * Rainer Deyke <rainerd at eldwood.com>
- */
-
-package tiled.mapeditor;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.image.BufferedImage;
-import java.io.File;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Vector;
-import javax.imageio.ImageIO;
-import javax.swing.*;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-
-import tiled.core.*;
-import tiled.mapeditor.animation.AnimationDialog;
-import tiled.mapeditor.util.*;
-import tiled.mapeditor.widget.*;
-
-
-public class TileDialog extends JDialog
- implements ActionListener, ListSelectionListener
-{
- private Tile currentTile;
- private TileSet tileset;
- private JList tileList, imageList;
- private JTable tileProperties;
- private JButton bOk, bNew, bDelete, bChangeI, bDuplicate;
- private JButton bAddImage, bDeleteImage, bDeleteAllUnusedImages;
- private JButton bAnimation;
- private String location;
- private JTextField tilesetNameEntry;
- private JCheckBox externalBitmapCheck;
- //private JCheckBox sharedImagesCheck;
- private JTabbedPane tabs;
- private int currentImageIndex = -1;
-
- public TileDialog(Dialog parent, TileSet s) {
- super(parent, "Edit Tileset '" + s.getName() + "'", true);
- location = "";
- tileset = s; //unofficial
- init();
- setTileset(s);
- setCurrentTile(null);
- pack();
- setLocationRelativeTo(getOwner());
- }
-
- private JPanel createTilePanel() {
- // Create the buttons
-
- bDelete = new JButton("Delete Tile");
- bChangeI = new JButton("Change Image");
- bDuplicate = new JButton("Duplicate Tile");
- bNew = new JButton("Add Tile");
- bAnimation = new JButton("Animation");
-
- bDelete.addActionListener(this);
- bChangeI.addActionListener(this);
- bDuplicate.addActionListener(this);
- bNew.addActionListener(this);
- bAnimation.addActionListener(this);
-
- tileList = new JList();
- tileList.setCellRenderer(new TileDialogListRenderer());
-
-
- // Tile properties table
-
- tileProperties = new JTable(new PropertiesTableModel());
- tileProperties.getSelectionModel().addListSelectionListener(this);
- JScrollPane propScrollPane = new JScrollPane(tileProperties);
- propScrollPane.setPreferredSize(new Dimension(150, 150));
-
-
- // Tile list
-
- tileList.addListSelectionListener(this);
- JScrollPane sp = new JScrollPane();
- sp.getViewport().setView(tileList);
- sp.setPreferredSize(new Dimension(150, 150));
-
- // The split pane
-
- JSplitPane splitPane = new JSplitPane(
- JSplitPane.HORIZONTAL_SPLIT, true);
- splitPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
- splitPane.setResizeWeight(0.25);
- splitPane.setLeftComponent(sp);
- splitPane.setRightComponent(propScrollPane);
-
-
- // The buttons
-
- JPanel buttons = new VerticalStaticJPanel();
- buttons.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
- buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
- buttons.add(bNew);
- buttons.add(Box.createRigidArea(new Dimension(5, 0)));
- buttons.add(bDelete);
- buttons.add(Box.createRigidArea(new Dimension(5, 0)));
- buttons.add(bChangeI);
- buttons.add(Box.createRigidArea(new Dimension(5, 0)));
- buttons.add(bDuplicate);
- buttons.add(Box.createRigidArea(new Dimension(5, 0)));
- buttons.add(bAnimation);
- buttons.add(Box.createRigidArea(new Dimension(5, 0)));
- buttons.add(Box.createGlue());
-
-
- // Putting it all together
-
- JPanel mainPanel = new JPanel();
- mainPanel.setLayout(new GridBagLayout());
- mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- GridBagConstraints c = new GridBagConstraints();
- c.fill = GridBagConstraints.BOTH;
- c.weightx = 1; c.weighty = 1;
- mainPanel.add(splitPane, c);
- c.weightx = 0; c.weighty = 0; c.gridy = 1;
- mainPanel.add(buttons, c);
-
- return mainPanel;
- }
-
- private JPanel createTilesetPanel()
- {
- JLabel name_label = new JLabel("Name: ");
- tilesetNameEntry = new JTextField(32);
- //sharedImagesCheck = new JCheckBox("Use shared images");
- externalBitmapCheck = new JCheckBox("Use external bitmap");
- //sharedImagesCheck.addActionListener(this);
- externalBitmapCheck.addActionListener(this);
-
- JPanel mainPanel = new JPanel();
- mainPanel.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
- c.gridx = 0; c.gridy = 0;
- mainPanel.add(name_label, c);
- c.gridx = 1; c.gridy = 0;
- mainPanel.add(tilesetNameEntry);
- c.gridx = 0; c.gridy = 1; c.gridwidth = 2;
- //mainPanel.add(sharedImagesCheck, c);
- c.gridx = 0; c.gridy = 2; c.gridwidth = 2;
- mainPanel.add(externalBitmapCheck, c);
-
- return mainPanel;
- }
-
- private JPanel createImagePanel()
- {
- imageList = new JList();
- imageList.setCellRenderer(new ImageCellRenderer());
- imageList.setLayoutOrientation(JList.HORIZONTAL_WRAP);
- imageList.addListSelectionListener(this);
- JScrollPane sp = new JScrollPane();
- sp.getViewport().setView(imageList);
- sp.setPreferredSize(new Dimension(150, 150));
-
- // Buttons
- bAddImage = new JButton("Add Image");
- bAddImage.addActionListener(this);
- bDeleteImage = new JButton("Delete Image");
- bDeleteImage.addActionListener(this);
- bDeleteAllUnusedImages = new JButton("Delete Unused Images");
- bDeleteAllUnusedImages.addActionListener(this);
- JPanel buttons = new VerticalStaticJPanel();
- buttons.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
- buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
- buttons.add(bAddImage);
- buttons.add(Box.createRigidArea(new Dimension(5, 0)));
- buttons.add(bDeleteImage);
- buttons.add(Box.createRigidArea(new Dimension(5, 0)));
- buttons.add(bDeleteAllUnusedImages);
-
- JPanel mainPanel = new JPanel();
- mainPanel.setLayout(new GridBagLayout());
- mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- GridBagConstraints c = new GridBagConstraints();
- c.fill = GridBagConstraints.BOTH;
- c.weightx = 1; c.weighty = 1;
- mainPanel.add(sp, c);
- c.weightx = 0; c.weighty = 0; c.gridy = 1;
- mainPanel.add(buttons, c);
- return mainPanel;
- }
-
- private void init() {
- tabs = new JTabbedPane(JTabbedPane.TOP);
- tabs.addTab("Tileset", createTilesetPanel());
- tabs.addTab("Tiles", createTilePanel());
- tabs.addTab("Images", createImagePanel());
-
- bOk = new JButton("OK");
- bOk.addActionListener(this);
-
- JPanel buttons = new VerticalStaticJPanel();
- buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
- buttons.add(Box.createGlue());
- buttons.add(bOk);
-
- JPanel mainPanel = new JPanel();
- mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
- mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- mainPanel.add(tabs);
- mainPanel.add(Box.createRigidArea(new Dimension(0, 5)));
- mainPanel.add(buttons);
-
- getContentPane().add(mainPanel);
- getRootPane().setDefaultButton(bOk);
- }
-
- private void changeImage() {
- if (currentTile == null) {
- return;
- }
- if (tileset.usesSharedImages()) {
- TileImageDialog d = new TileImageDialog(this, tileset,
- currentTile.getImageId(), currentTile.getImageOrientation());
- d.setVisible(true);
- if (d.getImageId() >= 0) {
- currentTile.setImage(d.getImageId());
- currentTile.setImageOrientation(d.getImageOrientation());
- }
- } else {
- Image img = loadImage();
- if (img != null) {
- currentTile.setImage(img);
- }
- }
- }
-
- private Image loadImage() {
- JFileChooser ch = new JFileChooser(location);
- int ret = ch.showOpenDialog(this);
-
- if (ret == JFileChooser.APPROVE_OPTION) {
- File file = ch.getSelectedFile();
- try {
- BufferedImage image = ImageIO.read(file);
- if (image != null) {
- location = file.getAbsolutePath();
- return image;
- } else {
- JOptionPane.showMessageDialog(this, "Error loading image",
- "Error loading image", JOptionPane.ERROR_MESSAGE);
- return null;
- }
- } catch (Exception e) {
- e.printStackTrace();
- JOptionPane.showMessageDialog(this, e.getMessage(),
- "Error loading image", JOptionPane.ERROR_MESSAGE);
- }
- }
-
- return null;
- }
-
- private void newTile() {
- NewTileDialog d = new NewTileDialog(this, tileset);
- if(d.createTile() != null) queryTiles();
- }
-
- public void setTileset(TileSet s) {
- tileset = s;
-
- if (tileset != null) {
- // Find new tile images at the location of the tileset
- if (tileset.getSource() != null) {
- location = tileset.getSource();
- } else if (tileset.getMap() != null) {
- location = tileset.getMap().getFilename();
- }
- tilesetNameEntry.setText(tileset.getName());
- //sharedImagesCheck.setSelected(tileset.usesSharedImages());
- externalBitmapCheck.setSelected(tileset.getTilebmpFile() != null);
- }
-
- queryTiles();
- queryImages();
- updateEnabledState();
- }
-
- public void queryTiles() {
- Vector listData;
-
- if (tileset != null && tileset.size() > 0) {
- listData = new Vector();
- Iterator tileIterator = tileset.iterator();
-
- while (tileIterator.hasNext()) {
- Tile tile = (Tile)tileIterator.next();
- listData.add(tile);
- }
-
- tileList.setListData(listData);
- }
-
- if (currentTile != null) {
- tileList.setSelectedIndex(currentTile.getId() - 1);
- tileList.ensureIndexIsVisible(currentTile.getId() - 1);
- }
- }
-
- public void queryImages() {
- Vector listData = new Vector();
-
- Enumeration ids = tileset.getImageIds();
- while(ids.hasMoreElements()) {
- Image img = tileset.getImageById(ids.nextElement());
- if(img != null)
- listData.add(img);
- }
-
- imageList.setListData(listData);
- if (currentImageIndex != -1) {
- imageList.setSelectedIndex(currentImageIndex);
- imageList.ensureIndexIsVisible(currentImageIndex);
- }
- }
-
- private void setCurrentTile(Tile tile) {
- // Update the old current tile's properties
- // (happens automatically as properties are changed in place now)
- /*
- if (currentTile != null) {
- PropertiesTableModel model =
- (PropertiesTableModel)tileProperties.getModel();
- currentTile.setProperties(model.getProperties());
- }
- */
-
- currentTile = tile;
- updateTileInfo();
- updateEnabledState();
- }
-
- private void setImageIndex(int i) {
- currentImageIndex = i;
- updateEnabledState();
- }
-
- private void updateEnabledState() {
- // boolean internal = (tileset.getSource() == null);
- boolean tilebmp = (tileset.getTilebmpFile() != null);
- boolean tileSelected = (currentTile != null);
- boolean sharedImages = tileset.usesSharedImages();
- boolean atLeastOneSharedImage = sharedImages
- && tileset.getTotalImages() >= 1;
-
- bNew.setEnabled(atLeastOneSharedImage || !tilebmp);
- bDelete.setEnabled((sharedImages || !tilebmp) && tileSelected);
- bChangeI.setEnabled((atLeastOneSharedImage || !tilebmp)
- && tileSelected);
- bDuplicate.setEnabled((sharedImages || !tilebmp) && tileSelected);
- bAnimation.setEnabled((sharedImages || !tilebmp) && tileSelected &&
- currentTile instanceof AnimatedTile);
- tileProperties.setEnabled((sharedImages || !tilebmp) && tileSelected);
- externalBitmapCheck.setEnabled(tilebmp); // Can't turn this off yet
- //sharedImagesCheck.setEnabled(!tilebmp || !sharedImages
- // || tileset.safeToDisableSharedImages());
- tabs.setEnabledAt(2, sharedImages);
- if (sharedImages) {
- bAddImage.setEnabled(!tilebmp);
- bDeleteAllUnusedImages.setEnabled(!tilebmp);
- boolean image_used = false;
- Iterator tileIterator = tileset.iterator();
-
- while (tileIterator.hasNext()) {
- Tile tile = (Tile)tileIterator.next();
- if (tile.getImageId() == currentImageIndex) {
- image_used = true;
- }
- }
- bDeleteImage.setEnabled(!tilebmp && currentImageIndex >= 0
- && !image_used);
- }
- }
-
- /**
- * Updates the properties table with the properties of the current tile.
- */
- private void updateTileInfo() {
- if (currentTile == null) {
- return;
- }
-
- Properties tileProps = currentTile.getProperties();
-
- // (disabled making a copy, as properties are changed in place now)
- /*
- Properties editProps = new Properties();
- for (Enumeration keys = tileProps.keys(); keys.hasMoreElements();) {
- String key = (String)keys.nextElement();
- editProps.put(key, tileProps.getProperty(key));
- }
- */
-
- ((PropertiesTableModel)tileProperties.getModel()).update(tileProps);
- }
-
- public void actionPerformed(ActionEvent event) {
- Object source = event.getSource();
-
- if (source == bOk) {
- tileset.setName(tilesetNameEntry.getText());
- this.dispose();
- } else if (source == bDelete) {
- int answer = JOptionPane.showConfirmDialog(
- this, "Delete tile?", "Are you sure?",
- JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
- if (answer == JOptionPane.YES_OPTION) {
- Tile tile = (Tile)tileList.getSelectedValue();
- if (tile != null) {
- tileset.removeTile(tile.getId());
- }
- queryTiles();
- }
- } else if (source == bChangeI) {
- changeImage();
- } else if (source == bNew) {
- newTile();
- } else if (source == bDuplicate) {
- Tile n = new Tile(currentTile);
- tileset.addNewTile(n);
- queryTiles();
- // Select the last (cloned) tile
- tileList.setSelectedIndex(tileset.size() - 1);
- tileList.ensureIndexIsVisible(tileset.size() - 1);
- } else if (source == externalBitmapCheck) {
- if (!externalBitmapCheck.isSelected()) {
- int answer = JOptionPane.showConfirmDialog(
- this,
- "Warning: this operation cannot currently be reversed.\n" +
- "Disable the use of an external bitmap?",
- "Are you sure?",
- JOptionPane.YES_NO_OPTION,
- JOptionPane.WARNING_MESSAGE);
- if (answer == JOptionPane.YES_OPTION) {
- tileset.setTilesetImageFilename(null);
- updateEnabledState();
- } else {
- externalBitmapCheck.setSelected(true);
- }
- }
- } else if (source == bAnimation) {
- AnimationDialog ad = new AnimationDialog(this, ((AnimatedTile)currentTile).getSprite());
- ad.setVisible(true);
- }
- /*
- else if (source == sharedImagesCheck) {
- if (sharedImagesCheck.isSelected()) {
- tileset.enableSharedImages();
- updateEnabledState();
- } else {
- int answer = JOptionPane.YES_OPTION;
- if (!tileset.safeToDisableSharedImages()) {
- answer = JOptionPane.showConfirmDialog(
- this, "This tileset uses features that require the "
- + "use of shared images. Disable the use of shared "
- + "images?",
- "Are you sure?",
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
- }
- if (answer == JOptionPane.YES_OPTION) {
- tileset.disableSharedImages();
- updateEnabledState();
- } else {
- sharedImagesCheck.setSelected(true);
- }
- }
- }
- */
- else if (source == bAddImage) {
- Image img = loadImage();
- if (img != null) {
- tileset.addImage(img);
- }
- queryImages();
- } else if (source == bDeleteImage) {
- int answer = JOptionPane.showConfirmDialog(
- this, "Delete this image?",
- "Are you sure?",
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
- if (answer == JOptionPane.YES_OPTION) {
- Image img = (Image)imageList.getSelectedValue();
- tileset.removeImage(Integer.toString(tileset.getIdByImage(img)));
- queryImages();
- }
- } else if (source == bDeleteAllUnusedImages) {
- int answer = JOptionPane.showConfirmDialog(
- this, "Delete all unused images?",
- "Are you sure?",
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
- if (answer == JOptionPane.YES_OPTION) {
-
- Enumeration ids = tileset.getImageIds();
- while(ids.hasMoreElements()) {
- int id = Integer.parseInt((String)ids.nextElement());
- boolean image_used = false;
- Iterator tileIterator = tileset.iterator();
-
- while (tileIterator.hasNext()) {
- Tile tile = (Tile)tileIterator.next();
- if (tile.getImageId() == id) {
- image_used = true;
- }
- }
-
- if (!image_used) {
- tileset.removeImage(Integer.toString(id));
- }
- }
-
- queryImages();
- }
- }
-
- repaint();
- }
-
- public void valueChanged(ListSelectionEvent e) {
- if (e.getSource() == tileList) {
- setCurrentTile((Tile)tileList.getSelectedValue());
- } else if (e.getSource() == imageList) {
- setImageIndex(imageList.getSelectedIndex());
- }
- }
-}
Deleted: trunk/tiled/mapeditor/TileImageDialog.java
===================================================================
--- trunk/tiled/mapeditor/TileImageDialog.java 2006-01-26 06:42:52 UTC (rev 564)
+++ trunk/tiled/mapeditor/TileImageDialog.java 2006-01-27 08:46:18 UTC (rev 565)
@@ -1,187 +0,0 @@
-/*
- * Tiled Map Editor, (c) 2004
- *
- * 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>
- * Rainer Deyke <rainerd at eldwood.com>
- */
-
-package tiled.mapeditor;
-
-import java.awt.*;
-import java.awt.event.*;
-//import java.awt.image.BufferedImage;
-import java.util.Enumeration;
-import java.util.Vector;
-
-//import javax.imageio.ImageIO;
-import javax.swing.*;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-
-import tiled.core.*;
-import tiled.mapeditor.util.*;
-import tiled.mapeditor.widget.*;
-
-
-public class TileImageDialog extends JDialog
- implements ActionListener, ListSelectionListener
-{
- private JList imageList;
- private JButton bOk, bCancel;
- private JCheckBox horizFlipCheck, vertFlipCheck, rotateCheck;
- private int imageId, imageOrientation;
- private TileSet tileset;
- private JLabel imageLabel;
- private int[] imageIds;
-
- public TileImageDialog(Dialog parent, TileSet set) {
- this(parent, set, 0, 0);
- }
-
- public TileImageDialog(Dialog parent, TileSet set, int id,
- int orientation) {
- super(parent, "Choose Tile Image", true);
- tileset = set;
- imageId = id;
- imageOrientation = orientation;
-
- init();
- queryImages();
- updateImageLabel();
- pack();
- setLocationRelativeTo(getOwner());
- }
-
- private void init() {
- // image list
- imageList = new JList();
- imageList.setCellRenderer(new ImageCellRenderer());
- imageList.setLayoutOrientation(JList.HORIZONTAL_WRAP);
- imageList.addListSelectionListener(this);
- JScrollPane sp = new JScrollPane();
- sp.getViewport().setView(imageList);
- sp.setPreferredSize(new Dimension(150, 150));
-
- // image panel
- JPanel image_panel = new JPanel();
- image_panel.setLayout(new BoxLayout(image_panel, BoxLayout.Y_AXIS));
- imageLabel = new JLabel(new ImageIcon());
- horizFlipCheck = new JCheckBox("Flip horizontally",
- (imageOrientation & 1) == 1);
- horizFlipCheck.addActionListener(this);
- vertFlipCheck = new JCheckBox("Flip vertically",
- (imageOrientation & 2) == 2);
- vertFlipCheck.addActionListener(this);
- rotateCheck = new JCheckBox("Rotate",
- (imageOrientation & 4) == 4);
- rotateCheck.addActionListener(this);
-
- image_panel.add(imageLabel);
- image_panel.add(horizFlipCheck);
- image_panel.add(vertFlipCheck);
- image_panel.add(rotateCheck);
-
- // buttons
- bOk = new JButton("OK");
- bOk.addActionListener(this);
- bCancel = new JButton("Cancel");
- bCancel.addActionListener(this);
- JPanel buttons = new VerticalStaticJPanel();
- buttons.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
- buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
- buttons.add(bCancel);
- buttons.add(bOk);
-
- // main panel
- JPanel mainPanel = new JPanel();
- mainPanel.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
- c.fill = GridBagConstraints.BOTH;
- c.weightx = 1; c.weighty = 1;
- mainPanel.add(sp, c);
- c.weightx = 0; c.gridx = 1;
- mainPanel.add(image_panel, c);
- c.gridx = 0; c.weighty = 0; c.gridy = 1; c.gridwidth = 2;
- mainPanel.add(buttons, c);
- getContentPane().add(mainPanel);
- getRootPane().setDefaultButton(bOk);
- }
-
- public void queryImages() {
- Vector listData = new Vector();
- int initialIndex = 0;
-
- Enumeration ids = tileset.getImageIds();
- imageIds = new int[tileset.getTotalImages()];
- for (int i = 0; i < imageIds.length; ++i) {
- imageIds[i] = Integer.parseInt((String)ids.nextElement());
- }
-
- java.util.Arrays.sort(imageIds);
-
- for (int i = 0; i < imageIds.length; ++i) {
- if (imageIds[i] == imageId) initialIndex = i;
- Image img = tileset.getImageById(Integer.toString(imageIds[i]));
- // assert img != null;
- listData.add(img);
- }
-
- imageList.setListData(listData);
- imageList.setSelectedIndex(initialIndex);
- imageList.ensureIndexIsVisible(initialIndex);
- }
-
- private void updateEnabledState() {
- bOk.setEnabled(imageId >= 0);
- }
-
- public void actionPerformed(ActionEvent event) {
- Object source = event.getSource();
-
- if (source == bOk) {
- this.dispose();
- } else if (source == bCancel) {
- imageId = -1;
- this.dispose();
- } else if (source == horizFlipCheck) {
- imageOrientation ^= 1;
- updateImageLabel();
- } else if (source == vertFlipCheck) {
- imageOrientation ^= 2;
- updateImageLabel();
- } else if (source == rotateCheck) {
- imageOrientation ^= 4;
- updateImageLabel();
- }
-
- repaint();
- }
-
- private void updateImageLabel() {
- if (imageId >= 0) {
- Image img = tileset.getImageById(Integer.toString(imageId));
- img = ImageGroup.orientImage(img, imageOrientation);
- imageLabel.setIcon(new ImageIcon(img));
- }
- }
-
- public void valueChanged(ListSelectionEvent e) {
- imageId = imageIds[imageList.getSelectedIndex()];
- updateImageLabel();
- updateEnabledState();
- }
-
- public int getImageId() {
- return imageId;
- }
-
- int getImageOrientation() {
- return imageOrientation;
- }
-}
Deleted: trunk/tiled/mapeditor/TilePaletteDialog.java
===================================================================
--- trunk/tiled/mapeditor/TilePaletteDialog.java 2006-01-26 06:42:52 UTC (rev 564)
+++ trunk/tiled/mapeditor/TilePaletteDialog.java 2006-01-27 08:46:18 UTC (rev 565)
@@ -1,104 +0,0 @@
-/*
- * Tiled Map Editor, (c) 2004
- *
- * 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;
-
-import java.awt.event.*;
-import java.awt.*;
-import java.util.Vector;
-import javax.swing.*;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-
-import tiled.core.*;
-import tiled.mapeditor.util.*;
-import tiled.mapeditor.widget.*;
-
-
-public class TilePaletteDialog extends JDialog implements ActionListener,
- TileSelectionListener, ListSelectionListener
-{
- private MapEditor editor;
- private Map currentMap;
- private TilePalettePanel pc;
- private JList sets;
- private Tile currentTile;
-
- public TilePaletteDialog(MapEditor editor, Map map) {
- super(editor.getAppFrame(), "Palette", false);
- this.editor = editor;
- init();
- setMap(map);
- setSize(new Dimension(300, 200));
- setLocationRelativeTo(getOwner());
- setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
- }
-
- public void setMap(Map map) {
- Vector tilesets = new Vector();
- currentMap = map;
- if (currentMap != null) {
- tilesets = currentMap.getTilesets();
- }
- pc.setTilesets(tilesets);
- sets.setListData(tilesets);
- }
-
- private void init() {
- sets = new JList();
- //TODO: the full functionality for multiple sets is not yet available.
- //sets.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- sets.addListSelectionListener(this);
- JScrollPane setsSp = new JScrollPane(sets);
-
- pc = new TilePalettePanel();
- pc.addTileSelectionListener(this);
- JScrollPane paletteScrollPane = new JScrollPane(pc,
- JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
- JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
-
- JSplitPane splitPane = new JSplitPane(
- JSplitPane.HORIZONTAL_SPLIT, true);
- splitPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
- splitPane.setResizeWeight(0.75);
- splitPane.setLeftComponent(paletteScrollPane);
- splitPane.setRightComponent(setsSp);
-
- 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);
-
- getContentPane().add(mainPanel);
- }
-
- public void actionPerformed(ActionEvent e) {
- }
-
- public void tileSelected(TileSelectionEvent event) {
- Tile tile = event.getTile();
- if (tile != null) {
- editor.setCurrentTile(tile);
- }
- }
-
- public void valueChanged(ListSelectionEvent e) {
- Vector add = new Vector();
- Object[] setlist = sets.getSelectedValues();
- for (int i = 0; i < setlist.length; i++) {
- add.add(setlist[i]);
- }
- pc.setTilesets(add);
- }
-}
Deleted: trunk/tiled/mapeditor/TilesetManager.java
===================================================================
--- trunk/tiled/mapeditor/TilesetManager.java 2006-01-26 06:42:52 UTC (rev 564)
+++ trunk/tiled/mapeditor/TilesetManager.java 2006-01-27 08:46:18 UTC (rev 565)
@@ -1,231 +0,0 @@
-/*
- * Tiled Map Editor, (c) 2004
- *
- * 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>
- * Rainer Deyke <rainerd at eldwood.com>
- */
-
-package tiled.mapeditor;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.io.File;
-import java.util.Iterator;
-import java.util.Vector;
-import javax.swing.*;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-
-import tiled.core.*;
-import tiled.io.MapHelper;
-import tiled.io.MapWriter;
-import tiled.mapeditor.util.*;
-import tiled.mapeditor.plugin.PluginClassLoader;
-
-
-public class TilesetManager extends JDialog implements ActionListener,
- ListSelectionListener
-{
- private Map map;
- private Vector tileSets;
-
- private JButton saveAsButton, saveButton, embedButton;
- private JButton removeButton, editButton, closeButton;
- private JTable tilesetTable;
-
- public TilesetManager(JFrame parent, Map map) {
- super(parent, "Tileset Manager", true);
- this.map = map;
- init();
- pack();
- setLocationRelativeTo(getOwner());
- }
-
- private void init() {
- // Create the tileset table
- tilesetTable = new JTable(new TilesetTableModel(map));
- tilesetTable.getSelectionModel().addListSelectionListener(this);
- JScrollPane tilesetScrollPane = new JScrollPane(tilesetTable);
- tilesetScrollPane.setPreferredSize(new Dimension(360, 150))