[Monodevelop-patches-list] r452 - in trunk/MonoDevelop/src/Main/Base: Commands Gui/Dialogs

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Sun Jan 11 18:17:02 EST 2004


Author: jluke
Date: 2004-01-11 18:17:02 -0500 (Sun, 11 Jan 2004)
New Revision: 452

Modified:
   trunk/MonoDevelop/src/Main/Base/Commands/HelpCommands.cs
   trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/CommonAboutDialog.cs
   trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ViewGPLDialog.cs
   trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/WordCountDialog.cs
Log:
use dialog.AddButton () in the dialogs
move the ViewGPLDialog into its own file



Modified: trunk/MonoDevelop/src/Main/Base/Commands/HelpCommands.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Commands/HelpCommands.cs	2004-01-11 23:04:39 UTC (rev 451)
+++ trunk/MonoDevelop/src/Main/Base/Commands/HelpCommands.cs	2004-01-11 23:17:02 UTC (rev 452)
@@ -46,34 +46,9 @@
 	{
 		public override void Run()
 		{
-			FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
-			string filename = fileUtilityService.SharpDevelopRootPath + 
-			Path.DirectorySeparatorChar + "doc" +
-			Path.DirectorySeparatorChar + "license.txt";
-			if (fileUtilityService.TestFileExists(filename)) {
-				Dialog hd = new Dialog ("GNU GENERAL PUBLIC LICENSE",  (Gtk.Window) WorkbenchSingleton.Workbench , DialogFlags.DestroyWithParent);	
-				hd.SetDefaultSize (600, 400);
-				hd.AddButton (Stock.Ok,(int) ResponseType.Ok);
-				
-				ScrolledWindow sw = new  ScrolledWindow ();
-				sw.SetPolicy (PolicyType.Automatic, Gtk.PolicyType.Automatic);
-				
-				TextView view = new TextView ();
-				TextBuffer buffer = view.Buffer;
-				StreamReader streamReader = new StreamReader(filename);
-				buffer.InsertAtCursor(streamReader.ReadToEnd());
-
-				sw.Add (view);
-				hd.VBox.PackStart(sw);
-				hd.ShowAll();
-				hd.Run ();
-				hd.Hide ();
-				hd.Dispose ();
-			}
-		//	using (ViewGPLDialog totdd = new ViewGPLDialog()) {
-		//		totdd.Owner = (Form)WorkbenchSingleton.Workbench;
-		//		totdd.ShowDialog();
-		//	}
+			ViewGPLDialog vgd = new ViewGPLDialog();
+			vgd.Run ();
+			vgd.Hide ();
 		}
 	}
 	
@@ -132,8 +107,7 @@
 		{
 			CommonAboutDialog ad = new CommonAboutDialog("About SharpDevelop", (Window) WorkbenchSingleton.Workbench, DialogFlags.DestroyWithParent);
 			ad.Run ();
-			ad.Hide ();
-			ad.Dispose ();
+			ad.Hide ();
 		}
 	}
 }

Modified: trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/CommonAboutDialog.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/CommonAboutDialog.cs	2004-01-11 23:04:39 UTC (rev 451)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/CommonAboutDialog.cs	2004-01-11 23:17:02 UTC (rev 452)
@@ -83,7 +83,8 @@
 			//text = "\"No proper program contains an indication which as an operator-applied occurrence identifies an operator-defining occurrence which as an indication-applied occurrence identifies an indication-defining occurrence different from the one identified by the given indication as an indication- applied occurrence.\"\n   -- ALGOL 68 Report\n\n\n";
 			//text = "\"The '#pragma' command is specified in the ANSI standard to have an arbitrary implementation-defined effect. In the GNU C preprocessor, `#pragma' first attempts to run the game rogue; if that fails, it tries to run the game hack; if that fails, it tries to run GNU Emacs displaying the Tower of Hanoi; if that fails, it reports a fatal error. In any case, preprocessing does not continue.\"\n   --From an old GNU C Preprocessor document";
 			
-			Gtk.Function ScrollHandler = new Gtk.Function (ScrollDown);			hndlr = Timeout.Add (20, ScrollHandler);
+			Gtk.Function ScrollHandler = new Gtk.Function (ScrollDown);
+			hndlr = Timeout.Add (30, ScrollHandler);
 		}
 		
 		bool ScrollDown ()
@@ -179,10 +180,9 @@
 			nb.AppendPage (changelog, new Label ("ChangeLog"));
 			nb.AppendPage (vinfo, new Label ("Version Info"));
 			this.VBox.PackStart (nb);
-			Gtk.Button close = new Gtk.Button (Gtk.Stock.Close);
-			close.Clicked += new EventHandler (OnCloseClicked);
+			Button close = new Button (Stock.Close);
 			close.Show ();
-			this.ActionArea.Add (close);
+			this.AddButton (close, (int) ResponseType.Close);
 			this.ShowAll ();
 		}
 		
@@ -193,12 +193,6 @@
 			return tmp;
 		}
 		
-		private void OnCloseClicked (object o, EventArgs args)
-		{
-			this.Hide ();
-			this.Dispose ();
-		}
-		
 		private void OnPageChanged (object o, SwitchPageArgs args)
 		{
 			if (args.PageNum == 1)

Modified: trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ViewGPLDialog.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ViewGPLDialog.cs	2004-01-11 23:04:39 UTC (rev 451)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ViewGPLDialog.cs	2004-01-11 23:17:02 UTC (rev 452)
@@ -7,37 +7,43 @@
 
 using System;
 using System.IO;
-using System.Drawing;
-using System.ComponentModel;
-using System.Windows.Forms;
+using Gtk;
 using System.Resources;
 
 using ICSharpCode.Core.Properties;
-
 using ICSharpCode.Core.Services;
-using ICSharpCode.SharpDevelop.Gui.XmlForms;
 
-//using ICSharpCode.XmlForms;
-
 namespace ICSharpCode.SharpDevelop.Gui.Dialogs
-{/*
-	public class ViewGPLDialog : BaseSharpDevelopForm 
+{
+	public class ViewGPLDialog : Dialog 
 	{
-		public ViewGPLDialog()
+		public ViewGPLDialog () : base ("GNU GENERAL PUBLIC LICENSE", (Window) WorkbenchSingleton.Workbench, DialogFlags.DestroyWithParent)
 		{
-			base.SetupFromXml(Path.Combine(PropertyService.DataDirectory, @"resources\dialogs\ViewGPLDialog.xfrm"));
-			LoadGPL();
-		}
-		
-		void LoadGPL()
-		{
-			string filename = FileUtilityService.SharpDevelopRootPath + 
-			                  Path.DirectorySeparatorChar + "doc" +
-			                  Path.DirectorySeparatorChar + "license.txt";
-			if (FileUtilityService.TestFileExists(filename)) {
-				RichTextBox licenseRichTextBox = (RichTextBox)ControlDictionary["licenseRichTextBox"];
-				licenseRichTextBox.LoadFile(filename, RichTextBoxStreamType.PlainText);
-			}
-		}
-	}*/
-}
+			FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
+			string filename = fileUtilityService.SharpDevelopRootPath + 
+			System.IO.Path.DirectorySeparatorChar + "doc" +
+			System.IO.Path.DirectorySeparatorChar + "license.txt";
+			
+			if (fileUtilityService.TestFileExists(filename)) {
+				this.BorderWidth = 6;
+				this.DefaultResponse = (int) ResponseType.Close;
+				this.HasSeparator = false;	
+				this.SetDefaultSize (600, 400);
+				this.AddButton (Stock.Close, (int) ResponseType.Close);
+				
+				ScrolledWindow sw = new  ScrolledWindow ();
+				sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
+				
+				TextView view = new TextView ();
+				view.Editable = false;
+				view.CursorVisible = false;
+				StreamReader streamReader = new StreamReader (filename);
+				view.Buffer.Text = streamReader.ReadToEnd ();
+
+				sw.Add (view);
+				this.VBox.PackStart(sw);
+				this.ShowAll ();
+			}
+		}
+	}
+}

Modified: trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/WordCountDialog.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/WordCountDialog.cs	2004-01-11 23:04:39 UTC (rev 451)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/WordCountDialog.cs	2004-01-11 23:17:02 UTC (rev 452)
@@ -291,11 +291,10 @@
 			this.Title = "Word Count";
 			Button startButton = new Button (Stock.Execute);
 			startButton.Clicked += new EventHandler (startEvent);
-			this.ActionArea.Add (startButton);
+			this.AddButton (startButton, 7);
 			
-			Button cancelButton = new Button (Stock.Cancel);
-			cancelButton.Clicked += new EventHandler (OnCancelClicked);
-			this.ActionArea.Add (cancelButton);
+			Button cancelButton = new Button (Stock.Cancel);
+			this.AddButton (cancelButton, (int) ResponseType.Cancel);
 			
 			resultListView = new TreeView ();
 			resultListView.RulesHint = true;
@@ -344,11 +343,6 @@
 		private void OnOptionChanged (object o, EventArgs args)
 		{
 			selectedIndex = ((OptionMenu) o).History;
-		}
-		
-		private void OnCancelClicked (object o, EventArgs args)
-		{
-			this.Hide ();
 		}
 	}
 }




More information about the Monodevelop-patches-list mailing list