From 43db9a6c44b6ee544e7694d1bb234ba559b0849c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Milo=C5=A1=20Klou=C4=8Dek?= Date: Fri, 24 Oct 2008 17:01:13 +0000 Subject: [PATCH] Replaced Gnome.AppBar with a dialog (stored in .glade file) SVN-Revision: 5802 --- tools/tilemanager/Application.cs | 45 ++++---- tools/tilemanager/Makefile | 2 +- tools/tilemanager/tiler.glade | 219 ++++++++++++++++++++++++++++++++------- 3 files changed, 205 insertions(+), 61 deletions(-) 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; diff --git a/tools/tilemanager/Makefile b/tools/tilemanager/Makefile index 642e9c8da..e483bd213 100644 --- a/tools/tilemanager/Makefile +++ b/tools/tilemanager/Makefile @@ -1,6 +1,6 @@ GOAL=tilemanager.exe SOURCES=$(wildcard *.cs) -CSFLAGS=-debug -pkg:gtk-sharp-2.0 -pkg:glade-sharp-2.0 -pkg:gnome-sharp-2.0 -r:System.Drawing +CSFLAGS=-debug -pkg:gtk-sharp-2.0 -pkg:glade-sharp-2.0 -r:System.Drawing RESOURCES=tiler.glade CSFLAGS+=$(foreach file,$(RESOURCES),-resource:$(file) ) diff --git a/tools/tilemanager/tiler.glade b/tools/tilemanager/tiler.glade index 359b5ac14..8a0b330f2 100644 --- a/tools/tilemanager/tiler.glade +++ b/tools/tilemanager/tiler.glade @@ -2,7 +2,6 @@ - True @@ -19,6 +18,8 @@ False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST + True + False @@ -30,6 +31,8 @@ True + GTK_PACK_DIRECTION_LTR + GTK_PACK_DIRECTION_LTR @@ -147,8 +150,8 @@ True - gtk-help - True + Help + True @@ -202,6 +205,9 @@ False False True + False + False + False @@ -231,7 +237,7 @@ 0 True - * + * False @@ -291,6 +297,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 6 @@ -304,7 +314,7 @@ 6 True 6 - 2 + 3 False 6 6 @@ -437,6 +447,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -457,7 +471,7 @@ 0 True - * + * False @@ -483,6 +497,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -503,7 +521,7 @@ 0 True - * + * False @@ -529,6 +547,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -549,7 +571,7 @@ 0 True - * + * False @@ -584,28 +606,29 @@ - - - True - True - Hidden - True - GTK_RELIEF_NORMAL - True - False - False - True - - - - 2 - 3 - 0 - 1 - fill - - - + + + + True + True + Hidden + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 2 + 3 + 0 + 1 + fill + + + 0 @@ -626,18 +649,142 @@ True + + + - - + + 5 + Tile Manager - Question + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + True + False + False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + False + + + + True + False + 0 + + + True - True - True - + GTK_BUTTONBOX_END + + + + True + True + True + gtk-apply + True + GTK_RELIEF_NORMAL + True + -10 + + + + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + True + -6 + + + 0 False - False + True + GTK_PACK_END + + + + + + True + False + 0 + + + + True + False + 0 + + + + True + Start-ID: + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + 120 + True + True + 1 + 0 + False + GTK_UPDATE_ALWAYS + False + False + 1 0 100 1 10 10 + + + 5 + True + True + + + + + 0 + False + False + + + + + 0 + True + True -- 2.11.0