[Monodevelop-patches-list] r504 - trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Gui/Dialogs
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Fri Jan 16 16:53:25 EST 2004
Author: benm
Date: 2004-01-16 16:53:25 -0500 (Fri, 16 Jan 2004)
New Revision: 504
Modified:
trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Gui/Dialogs/GotoLineNumberDialog.cs
Log:
gladify goto
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Gui/Dialogs/GotoLineNumberDialog.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Gui/Dialogs/GotoLineNumberDialog.cs 2004-01-16 21:53:13 UTC (rev 503)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Gui/Dialogs/GotoLineNumberDialog.cs 2004-01-16 21:53:25 UTC (rev 504)
@@ -16,55 +16,41 @@
using ICSharpCode.Core.Services;
using ICSharpCode.TextEditor;
-using Gtk;
+using Gtk;
+using Glade;
namespace ICSharpCode.SharpDevelop.Gui.Dialogs
{
- public class GotoLineNumberDialog : Dialog
+ public class GotoLineNumberDialog
{
public static bool IsVisible = false;
-
- Entry gotoEntry;
+
+ [Widget] Dialog GotoLineDialog;
+ [Widget] Entry line_number_entry;
public GotoLineNumberDialog ()
{
- this.Title = "Goto Line Number...";
- this.BorderWidth = 6;
- this.HasSeparator = false;
-
- VBox mainbox = new VBox (false, 2);
- HBox entrybox = new HBox (false, 2);
-
- ResourceService rs = (ResourceService)ServiceManager.Services.GetService (typeof (IResourceService));
- string text = rs.GetString ("Dialog.GotoLineNumber.label1Text");
- Label label = new Label (text.Replace ("&", ""));
-
- gotoEntry = new Entry ();
-
- entrybox.PackStart (label, false, false, 2);
- entrybox.PackStart (gotoEntry, false, true, 2);
-
- Button okButton = new Button (Stock.JumpTo);
- okButton.Clicked += new EventHandler (closeEvent);
-
- Button cancelButton = new Button (Stock.Cancel);
- cancelButton.Clicked += new EventHandler (cancelEvent);
-
- this.ActionArea.PackStart (cancelButton);
- this.ActionArea.PackStart (okButton);
-
- mainbox.PackStart (entrybox);
-
- this.VBox.PackStart (mainbox);
- this.ShowAll ();
+ new Glade.XML (null, "texteditoraddin.glade", "GotoLineDialog", null).Autoconnect (this);
+
+ GotoLineDialog.ShowAll ();
}
+
+ public void Run ()
+ {
+ GotoLineDialog.Run ();
+ }
+
+ public void Hide ()
+ {
+ GotoLineDialog.Hide ();
+ }
- void cancelEvent(object sender, EventArgs e)
+ void on_btn_close_clicked (object sender, EventArgs e)
{
- this.Hide();
+ GotoLineDialog.Hide ();
}
- void closeEvent(object sender, EventArgs e)
+ void on_btn_go_to_line_clicked (object sender, EventArgs e)
{
try {
IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
@@ -73,14 +59,14 @@
if (window != null && window.ViewContent is ITextEditorControlProvider) {
TextEditorControl textarea = ((ITextEditorControlProvider)window.ViewContent).TextEditorControl;
- int i = Math.Min(textarea.Document.TotalNumberOfLines, Math.Max(1, Int32.Parse(gotoEntry.Text)));
+ int i = Math.Min(textarea.Document.TotalNumberOfLines, Math.Max(1, Int32.Parse(line_number_entry.Text)));
textarea.ActiveTextAreaControl.Caret.Line = i - 1;
textarea.ActiveTextAreaControl.ScrollToCaret();
}
} catch (Exception) {
} finally {
- this.Hide();
+ GotoLineDialog.Hide ();
}
}
}
More information about the Monodevelop-patches-list
mailing list