X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=tools%2Ftilemanager%2FApplication.cs;h=a8fe0a936bd3cb8702570c3ef061f058fae1426f;hb=43db9a6c44b6ee544e7694d1bb234ba559b0849c;hp=a72031c4ecfceaa5b5e7782e0be4d3f42d9016fc;hpb=afd5f1b33c110104a7f286d6d7854157919a0a52;p=supertux.git diff --git a/tools/tilemanager/Application.cs b/tools/tilemanager/Application.cs index a72031c4e..a8fe0a936 100644 --- a/tools/tilemanager/Application.cs +++ b/tools/tilemanager/Application.cs @@ -3,7 +3,6 @@ using System.IO; using System.Collections; using Gtk; using Gdk; -using Gnome; using Glade; public class Application { @@ -32,16 +31,17 @@ public class Application { [Glade.Widget] private Gtk.Entry IDEntry; [Glade.Widget] - private Gnome.AppBar AppBar; - [Glade.Widget] - private Gtk.VBox MainLayout; - [Glade.Widget] private Gtk.TreeView TileList; [Glade.Widget] private Gtk.Combo TileGroupComboBox; [Glade.Widget] private Gtk.MenuItem AddTileGroupMenu; + [Glade.Widget] + private Gtk.Dialog RemapDialog; + [Glade.Widget] + private Gtk.SpinButton RD_spinButton; + private string tilesetdir; private string tilesetfile; private TileSet tileset; @@ -75,20 +75,13 @@ public class Application { Glade.XML gxml = new Glade.XML(null, "tiler.glade", null, null); gxml.Autoconnect(this); - if(MainWindow == null || DrawingArea == null || AppBar == null) + if(MainWindow == null || DrawingArea == null || RemapDialog == null) throw new Exception("some widgets not found"); DrawingArea.AddEvents((int) Gdk.EventMask.ButtonPressMask); DrawingArea.AddEvents((int) Gdk.EventMask.ButtonReleaseMask); DrawingArea.AddEvents((int) Gdk.EventMask.ButtonMotionMask); - // libglade missed interactivity property :-/ - MainLayout.Remove(AppBar); - AppBar = new AppBar(true, true, PreferencesType.Always); - AppBar.UserResponse += new EventHandler(OnAppBarUserResponse); - MainLayout.PackStart(AppBar, false, false, 0); - AppBar.Show(); - MainWindow.Show(); } @@ -291,35 +284,39 @@ public class Application { } protected void OnRemapTiles(object o, EventArgs e) { - AppBar.SetPrompt("Start-ID:", true); - } - - protected void OnCreateTileGroup(object o, EventArgs e) { + if(Tiles == null) + return; + RemapDialog.Show(); } - protected void OnRenameTileGroup(object o, EventArgs e) { + protected void OnRemapDialogCancel(object o, EventArgs e) { + RemapDialog.Hide(); } - protected void OnAppBarUserResponse(object o, EventArgs e) { + protected void OnRemapDialogApply(object o, EventArgs e) { + RemapDialog.Hide(); try { - if(AppBar.Response == null || AppBar.Response == "" - || Tiles == null) - return; // remap tiles int id; try { - id = Int32.Parse(AppBar.Response); + id = RD_spinButton.ValueAsInt; } catch(Exception exception) { ShowException(exception); return; } RemapTiles(id); } finally { - AppBar.ClearPrompt(); + RD_spinButton.Value = 1; } } + protected void OnCreateTileGroup(object o, EventArgs e) { + } + + protected void OnRenameTileGroup(object o, EventArgs e) { + } + protected void RemapTiles(int startID) { if(Tiles == null) return;