From: Arvid Norlander Date: Thu, 15 Feb 2007 16:39:55 +0000 (+0000) Subject: Removed trailing whitespaces in tilemanager source files (yes I know that code needs... X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=7af002362d894832570cffcda1afbd5bafee06eb;p=supertux.git Removed trailing whitespaces in tilemanager source files (yes I know that code needs to be updated to work but I might do that later when I have time, if someone else doesn't do it first) SVN-Revision: 4845 --- diff --git a/tools/tilemanager/Application.cs b/tools/tilemanager/Application.cs index 280b72593..b3bbe9955 100644 --- a/tools/tilemanager/Application.cs +++ b/tools/tilemanager/Application.cs @@ -29,7 +29,7 @@ public class Application { private Gtk.Entry DataEntry; [Glade.Widget] private Gtk.Entry AnimFpsEntry; - [Glade.Widget] + [Glade.Widget] private Gtk.Entry IDEntry; [Glade.Widget] private Gnome.AppBar AppBar; @@ -57,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); @@ -89,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(); } @@ -130,26 +130,26 @@ 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; @@ -186,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) @@ -210,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; @@ -242,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 { @@ -257,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... @@ -286,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); @@ -300,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); @@ -368,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... @@ -405,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; } } } @@ -441,7 +441,7 @@ public class Application { store.AppendValues(new object[] { id.ToString() }); } } - + TileList.Model = store; TileList.Selection.Mode = SelectionMode.Multiple; } @@ -479,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) { diff --git a/tools/tilemanager/Lexer.cs b/tools/tilemanager/Lexer.cs index 28df77a83..bbbd397aa 100644 --- a/tools/tilemanager/Lexer.cs +++ b/tools/tilemanager/Lexer.cs @@ -13,7 +13,7 @@ public class Lexer { public class EOFException : Exception { }; - + public enum TokenType { EOF, OPEN_PAREN, @@ -99,7 +99,7 @@ public class Lexer { if(TokenString == "f") return TokenType.FALSE; - throw new Exception("Unknown constant '" + throw new Exception("Unknown constant '" + TokenString + "'"); default: if(Char.IsDigit(c) || c == '-') { @@ -119,7 +119,7 @@ public class Lexer { NextChar(); } while(!Char.IsWhiteSpace(c) && c != '\"' && c != '(' && c != ')' && c != ';'); - + if(have_nondigits || !have_digits || have_floating_point > 1) return TokenType.SYMBOL; @@ -133,7 +133,7 @@ public class Lexer { NextChar(); } while(!Char.IsWhiteSpace(c) && c != '\"' && c != '(' && c != ')' && c != ';'); - + return TokenType.SYMBOL; } } diff --git a/tools/tilemanager/LispWriter.cs b/tools/tilemanager/LispWriter.cs index 0ec3a3805..6355317e0 100644 --- a/tools/tilemanager/LispWriter.cs +++ b/tools/tilemanager/LispWriter.cs @@ -6,7 +6,7 @@ public class LispWriter { private TextWriter stream; private int IndentDepth; private Stack lists = new Stack(); - + public LispWriter(TextWriter stream) { this.stream = stream; } diff --git a/tools/tilemanager/Parser.cs b/tools/tilemanager/Parser.cs index a09ccd9ce..163a75e10 100644 --- a/tools/tilemanager/Parser.cs +++ b/tools/tilemanager/Parser.cs @@ -9,14 +9,14 @@ public class Parser { START_LIST, END_LIST, SYMBOL, - INTEGER, + INTEGER, STRING, REAL, BOOLEAN }; private Lexer lexer; private Lexer.TokenType token; - + public Parser(StreamReader stream) { lexer = new Lexer(stream); } @@ -31,7 +31,7 @@ public class Parser { depth = 0; return false; } - + /* Console.WriteLine("Token: " + token.ToString() + " - " + lexer.TokenString); diff --git a/tools/tilemanager/Tile.cs b/tools/tilemanager/Tile.cs index 1fc8401b0..d85d9ed29 100644 --- a/tools/tilemanager/Tile.cs +++ b/tools/tilemanager/Tile.cs @@ -56,7 +56,7 @@ public class Tile { } else { Console.WriteLine("no images on tile " + ID); } - + if(Solid) writer.Write("solid", true); if(UniSolid) @@ -206,7 +206,7 @@ public class Tile { throw new Exception("expected integer"); region.Region.Width = parser.IntegerValue; - parser.Parse(); + parser.Parse(); if(parser.Type != Parser.LispType.INTEGER) throw new Exception("expected integer"); region.Region.Height = parser.IntegerValue; @@ -216,4 +216,3 @@ public class Tile { throw new Exception("expected END_LIST"); } } - diff --git a/tools/tilemanager/TileSet.cs b/tools/tilemanager/TileSet.cs index 9ea416468..831ee96d3 100644 --- a/tools/tilemanager/TileSet.cs +++ b/tools/tilemanager/TileSet.cs @@ -31,7 +31,7 @@ public class TileGroup { case "tiles": do { Tiles.Add(parser.IntegerValue); - } while(parser.Parse() + } while(parser.Parse() && parser.Type == Parser.LispType.INTEGER); break; default: @@ -49,7 +49,7 @@ public class TileSet { public void Write(string filename) { FileStream fs = new FileStream(filename, FileMode.Create); - + TextWriter tw = new StreamWriter(fs); LispWriter writer = new LispWriter(tw); @@ -68,7 +68,7 @@ public class TileSet { tw.Close(); fs.Close(); } - + public void Parse(string filename) { FileStream fs = new FileStream(filename, FileMode.Open); StreamReader stream = new StreamReader(fs); @@ -132,4 +132,3 @@ public class TileSet { ; } } -