Removed trailing whitespaces in tilemanager source files (yes I know that code needs...
[supertux.git] / tools / tilemanager / Application.cs
index 457132f..b3bbe99 100644 (file)
@@ -24,10 +24,12 @@ public class Application {
     [Glade.Widget]
     private Gtk.CheckButton DontUseCheckButton;
     [Glade.Widget]
+    private Gtk.CheckButton HiddenCheckButton;
+    [Glade.Widget]
     private Gtk.Entry DataEntry;
     [Glade.Widget]
     private Gtk.Entry AnimFpsEntry;
-    [Glade.Widget]                 
+    [Glade.Widget]
     private Gtk.Entry IDEntry;
     [Glade.Widget]
     private Gnome.AppBar AppBar;
@@ -55,7 +57,7 @@ public class Application {
 
     private string currentimage;
     private Gdk.Pixbuf pixbuf;
-    
+
     public static int Main(string[] args) {
         Program kit = new Program("tiler", "0.0.1", Modules.UI, args);
 
@@ -87,9 +89,9 @@ public class Application {
         MainLayout.PackStart(AppBar, false, false, 0);
         AppBar.Show();
 
-        TileGroupComboBox.Entry.Activated 
+        TileGroupComboBox.Entry.Activated
             += new EventHandler (OnTileGroupComboBoxEntryActivated);
-        
+
         MainWindow.Show();
     }
 
@@ -128,30 +130,30 @@ public class Application {
         FileSelection selection = new FileSelection("Select ImageFile");
         selection.OkButton.Clicked += new EventHandler(OnSelectImageOk);
         selection.CancelButton.Clicked += new EventHandler(OnSelectImageCancel);
-        selection.Show();                           
+        selection.Show();
     }
 
     private void OnSelectImageCancel(object o, EventArgs args) {
         FileSelection selection = ((FileSelection.FSButton) o).FileSelection;
         selection.Destroy();
     }
-    
+
     private void OnSelectImageOk(object o, EventArgs args) {
         FileSelection selection = ((FileSelection.FSButton) o).FileSelection;
         string file = selection.Filename;
         selection.Destroy();
 
         ChangeImage(new FileInfo(file).Name);
-        
+
         int startid = tileset.Tiles.Count;
         for(int y = 0; y < TilesY; ++y) {
             for(int x = 0; x < TilesX; ++x) {
                 int i = y*TilesX+x;
-                Tile tile = new Tile();                                   
+                Tile tile = new Tile();
                 tile.ID = startid + i;
                 ImageRegion region = new ImageRegion();
                 region.ImageFile = currentimage;
-                region.Region = new Rectangle(x*32, y*32, 32, 32);
+                region.Region = new System.Drawing.Rectangle(x*32, y*32, 32, 32);
                 tile.Images.Add(region);
                 if(Tiles[i] != null) {
                     Console.WriteLine(
@@ -174,8 +176,7 @@ public class Application {
         try {
             pixbuf = new Pixbuf(tilesetdir + "/" + file);
             if(pixbuf.Width % 32 != 0 || pixbuf.Height % 32 != 0)
-                throw new Exception(
-                        "Image Width or Height is not a multiple of 32");
+                Console.WriteLine("Warning: Image Width or Height is not a multiple of 32");
         } catch(Exception e) {
             ShowException(e);
             return;
@@ -185,7 +186,7 @@ public class Application {
         TilesY = pixbuf.Height / 32;
         SelectionArray = new bool[TilesX * TilesY];
         Tiles = new Tile[TilesX * TilesY];
-        
+
         // search tileset for tiles with matching image
         foreach(Tile tile in tileset.Tiles) {
             if(tile == null)
@@ -209,9 +210,9 @@ public class Application {
                 }
                 Tiles[i] = tile;
             }
-        } 
+        }
 
-        /*   DrawingArea.Allocation 
+        /*   DrawingArea.Allocation
             = new Gdk.Rectangle(0, 0, pixbuf.Width, pixbuf.Height);*/
         DrawingArea.WidthRequest = pixbuf.Width;
         DrawingArea.HeightRequest = pixbuf.Height;
@@ -241,10 +242,10 @@ public class Application {
 
     private void OnAppBarUserResponse(object o, EventArgs e) {
         try {
-            if(AppBar.Response == null || AppBar.Response == "" 
+            if(AppBar.Response == null || AppBar.Response == ""
                     || Tiles == null)
                 return;
-        
+
             // remap tiles
             int id;
             try {
@@ -256,7 +257,7 @@ public class Application {
             foreach(Tile tile in Selection) {
                 if(tile.ID == -1)
                     continue;
-                
+
                 int oldid = tile.ID;
                 tile.ID = id++;
                 // remap in all tilegroups...
@@ -285,7 +286,7 @@ public class Application {
 
         gc.RgbFgColor = new Color(0xff, 0, 0);
         foreach(Tile tile in Selection) {
-            System.Drawing.Rectangle rect 
+            System.Drawing.Rectangle rect
                 = ((ImageRegion) tile.Images[0]).Region;
             drawable.DrawRectangle(gc, false, rect.X, rect.Y, rect.Width,
                     rect.Height);
@@ -299,7 +300,7 @@ public class Application {
             return;
 
         selecting = true;
-        
+
         for(int i = 0; i < SelectionArray.Length; ++i)
             SelectionArray[i] = false;
         select((int) e.Event.X, (int) e.Event.Y);
@@ -338,6 +339,8 @@ public class Application {
                 tile.Water = WaterCheckButton.Active;
             if(sender == SlopeCheckButton)
                 tile.Slope = SlopeCheckButton.Active;
+            if(sender == HiddenCheckButton)
+                tile.Hidden = HiddenCheckButton.Active;
             if(sender == DontUseCheckButton)
                 tile.ID = DontUseCheckButton.Active ? -1 : 0;
         }
@@ -365,7 +368,7 @@ public class Application {
         for(int i = 0; i < SelectionArray.Length; ++i) {
             if(!SelectionArray[i])
                 continue;
-            
+
             if(Tiles[i] == null) {
                 Console.WriteLine("Tile doesn't exist yet");
                 // TODO ask user to create new tile...
@@ -388,6 +391,7 @@ public class Application {
                 IceCheckButton.Active = tile.Ice;
                 WaterCheckButton.Active = tile.Water;
                 SlopeCheckButton.Active = tile.Slope;
+                HiddenCheckButton.Active = tile.Hidden;
                 DontUseCheckButton.Active = tile.ID == -1;
                 DataEntry.Text = tile.Data.ToString();
                 AnimFpsEntry.Text = tile.AnimFps.ToString();
@@ -401,10 +405,10 @@ public class Application {
             } else {
                 IDEntry.Text += "," + tile.ID.ToString();
                 IDEntry.Editable = false;
-                if(tile.Images.Count > 0 
+                if(tile.Images.Count > 0
                         && ((ImageRegion) tile.Images[0]).ImageFile != nextimage) {
                     nextimage = "";
-                    pixbuf = null;       
+                    pixbuf = null;
                 }
             }
         }
@@ -437,7 +441,7 @@ public class Application {
                 store.AppendValues(new object[] { id.ToString() });
             }
         }
-        
+
         TileList.Model = store;
         TileList.Selection.Mode = SelectionMode.Multiple;
     }
@@ -475,7 +479,7 @@ public class Application {
     private void OnTileListCursorChanged(object sender, EventArgs e) {
         TreeModel model;
         TreePath[] selectpaths =
-            TileList.Selection.GetSelectedRows(out model); 
+            TileList.Selection.GetSelectedRows(out model);
 
         Selection.Clear();
         foreach(TreePath path in selectpaths) {