[tiled] r701 - in trunk: . src/tiled/mapeditor/widget

svn at biggeruniverse.com svn at biggeruniverse.com
Sat Oct 14 13:23:45 PDT 2006


Author: bjorn
Date: 2006-10-14 15:23:44 -0500 (Sat, 14 Oct 2006)
New Revision: 701

Modified:
   trunk/CHANGES
   trunk/TODO
   trunk/src/tiled/mapeditor/widget/TilePalettePanel.java
Log:
Made tile palette scroll when creation of stamp brush goes out of view.


Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES	2006-10-07 21:37:01 UTC (rev 700)
+++ trunk/CHANGES	2006-10-14 20:23:44 UTC (rev 701)
@@ -7,7 +7,7 @@
 * Report out of memory error when saving map as image
 * Properties table now displays the properties in alphabetical order
 * Fixed properties dialog to also save values that were still being edited
-* Fixed automatically adding the file extention when not given
+* Fixed automatically adding the file extension when not given
 * Worked around an issue with the open file dialog on GNU classpath
 * Worked around an issue with setting a null cursor on GNU classpath
 

Modified: trunk/TODO
===================================================================
--- trunk/TODO	2006-10-07 21:37:01 UTC (rev 700)
+++ trunk/TODO	2006-10-14 20:23:44 UTC (rev 701)
@@ -1,35 +1,20 @@
 ROADMAP TO FUTURE RELEASES
 
 0.7.0
-* Check that tile palette panel doesn't keep listening after being replaced.
-
-* Remove copy constructors in favour of clone method (DONE)
-
-* Add import/export of options (DONE)
-
-    Update translations for dialog.saveas.confirm.mismatch and add translations
-    for import/export
-
-* Allow embedding of tile palette beneath the map view (WIP)
-
-    Make continuous layout and tiles per row behaviour configurable.
-
-    Fix default tabbed tilesets panel height.
-
+* Check that tile palette panel doesn't keep listening after being replaced
+* Update translations for dialog.saveas.confirm.mismatch and add translations
+  for import/export
+* Make continuous layout and tiles per row behaviour configurable
+* Fix default tabbed tilesets panel height
+* Fix redraw issue on empty area in tile palette panel
 * Replace tile button with a brush preview beneath the layer table
-
-* Allow creation of stamp brush from the tile palette (WIP)
-
-    Do not reset brush when switching tools (but do show a small tile highlight
-    while other tools than stamp brush are selected)
-
+* Do not reset brush when switching tools (but do show a small tile highlight
+  while other tools than stamp brush are selected)
 * Add support for tile instance properties (see Christian's patch) (WIP)
+  - Fix big memory usage, maybe reference properties from a HashMap instead of
+    from each tile? Also check the amount of information stored for undo/redo
+  - Implement an effective way of displaying the presence of these properties
 
-    Fix big memory usage, maybe reference properties from a HashMap instead of
-    from each tile? Also check the amount of information stored for undo/redo.
-
-    Implement an effective way of displaying the presence of these properties.
-
 0.8.0
 * Set up a layer->map->mapview changes event trail to automatically handle
   repainting changes in all views on the map.

Modified: trunk/src/tiled/mapeditor/widget/TilePalettePanel.java
===================================================================
--- trunk/src/tiled/mapeditor/widget/TilePalettePanel.java	2006-10-07 21:37:01 UTC (rev 700)
+++ trunk/src/tiled/mapeditor/widget/TilePalettePanel.java	2006-10-14 20:23:44 UTC (rev 701)
@@ -51,6 +51,7 @@
             public void mousePressed(MouseEvent e) {
                 origin = getTileCoordinates(e.getX(), e.getY());
                 setSelection(new Rectangle(origin.x, origin.y, 0, 0));
+                scrollTileToVisible(origin);
                 Tile clickedTile = getTileAt(origin.x, origin.y);
                 if (clickedTile != null) {
                     fireTileSelectionEvent(clickedTile);
@@ -63,6 +64,7 @@
                 select.add(point);
                 if (!select.equals(selection)) {
                     setSelection(select);
+                    scrollTileToVisible(point);
                 }
                 fireTileRegionSelectionEvent(selection);
             }
@@ -74,6 +76,8 @@
     /**
      * Adds tile selection listener. The listener will be notified when the
      * user selects a tile.
+     *
+     * @param listener the listener to add
      */
     public void addTileSelectionListener(TileSelectionListener listener) {
         tileSelectionListeners.add(listener);
@@ -81,6 +85,8 @@
 
     /**
      * Removes tile selection listener.
+     *
+     * @param listener the listener to remove
      */
     public void removeTileSelectionListener(TileSelectionListener listener) {
         tileSelectionListeners.remove(listener);
@@ -107,6 +113,7 @@
 
     /**
      * Creates a tile layer from a certain region of the tile palette.
+     *
      * @param rect the rectangular region from which a tile layer is created
      * @return the created tile layer
      */
@@ -126,7 +133,7 @@
     /**
      * Change the tileset displayed by this palette panel.
      *
-     * @param tileset
+     * @param tileset the tileset to be displayed by this palette panel
      */
     public void setTileset(TileSet tileset) {
         // Remove any existing listener
@@ -156,6 +163,10 @@
      * Converts pixel coordinates to tile coordinates. The returned coordinates
      * are at least 0 and adjusted with respect to the number of tiles per row
      * and the number of rows.
+     *
+     * @param x x coordinate
+     * @param y y coordinate
+     * @return tile coordinates
      */
     private Point getTileCoordinates(int x, int y) {
         int twidth = tileset.getTileWidth() + 1;
@@ -175,6 +186,8 @@
      * Retrieves the tile at the given tile coordinates. It assumes the tile
      * coordinates are adjusted to the number of tiles per row.
      *
+     * @param x x tile coordinate
+     * @param y y tile coordinate
      * @return the tile at the given tile coordinates, or <code>null</code>
      *         if the index is out of range
      */
@@ -192,6 +205,8 @@
     /**
      * Returns the number of tiles to display per row. This gets calculated
      * dynamically unless the tileset specifies this value.
+     *
+     * @return the number of tiles to display per row, is at least 1
      */
     private int getTilesPerRow() {
         // todo: It should be an option to follow the tiles per row given
@@ -221,6 +236,16 @@
         }
     }
 
+    private void scrollTileToVisible(Point tile) {
+        int twidth = tileset.getTileWidth() + 1;
+        int theight = tileset.getTileHeight() + 1;
+
+        scrollRectToVisible(new Rectangle(
+                tile.x * twidth,
+                tile.y * theight,
+                twidth + 1, theight + 1));
+    }
+
     public void paint(Graphics g) {
         Rectangle clip = g.getClipBounds();
 
@@ -275,6 +300,8 @@
 
     /**
      * Draws checkerboard background.
+     *
+     * @param g the {@link Graphics} instance to draw on
      */
     private static void paintBackground(Graphics g) {
         Rectangle clip = g.getClipBounds();




More information about the tiled-commit mailing list