From 8c92d7d5c03b857226fdd07f94b492187a12bdcb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Milo=C5=A1=20Klou=C4=8Dek?= Date: Sat, 16 Aug 2008 17:30:58 +0000 Subject: [PATCH] splitted OnAppBarUserResponse() and code that remaps tiles. SVN-Revision: 5728 --- tools/tilemanager/Application.cs | 41 ++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/tools/tilemanager/Application.cs b/tools/tilemanager/Application.cs index dfc1bed04..45922006f 100644 --- a/tools/tilemanager/Application.cs +++ b/tools/tilemanager/Application.cs @@ -277,27 +277,36 @@ public class Application { ShowException(exception); return; } - foreach(Tile tile in Selection) { - if(tile.ID == -1) - continue; - - int oldid = tile.ID; - tile.ID = id++; - // remap in all tilegroups... - foreach(TileGroup tilegroup in tileset.TileGroups) { - int idx = tilegroup.Tiles.IndexOf(oldid); - if(idx >= 0) { - tilegroup.Tiles[idx] = tile.ID; - } - } - } - FillTileList(); - SelectionChanged(); + RemapTiles(id); } finally { AppBar.ClearPrompt(); } } + protected void RemapTiles(int startID) { + if(Tiles == null) + return; + + // remap tiles + int id = startID; + foreach(Tile tile in Selection) { + if(tile.ID == -1) + continue; + + int oldid = tile.ID; + tile.ID = id++; + // remap in all tilegroups... + foreach(TileGroup tilegroup in tileset.TileGroups) { + int idx = tilegroup.Tiles.IndexOf(oldid); + if(idx >= 0) { + tilegroup.Tiles[idx] = tile.ID; + } + } + } + FillTileList(); + SelectionChanged(); + } + protected void OnDrawingAreaExpose(object o, ExposeEventArgs e) { if(pixbuf == null) return; -- 2.11.0