[Mono-list] sqlsharpgtk patches - (gtk-sharp 0.17, editor, open reader)

Gonia Eric - egonia egonia@mail15.com
Sat, 28 Feb 2004 15:07:58 -0600


--=-mtLTjzinZlEttpVxxQUb
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Attached are three patches for sqlsharpgtk. I am guessing this would be
the list to post these to instead of mono-devel since they are dealing
with a tool and not directly with mono.

gtkupgrade.diff
Upgrade to gtk-sharp 0.17

editorfix.diff
Fix problem with returns at the end of a line in the Sql Editor.
Fix highlight and type over problem.

openreaderfix.diff
Fix reader left open after update sql statements run.

This is my first time to contribute changes back to an open source
project so it is very possible I have done this wrong, so please feel
free to correct me or provide suggestions on how to submit or create
these in the future.

Eric

--=-mtLTjzinZlEttpVxxQUb
Content-Disposition: attachment; filename=editorfix.diff
Content-Type: text/x-patch; name=editorfix.diff; charset=
Content-Transfer-Encoding: 7bit

Index: sqlsharpgtk/sqlsharpgtk/SqlEditorSharp.cs
===================================================================
RCS file: /mono/sqlsharpgtk/sqlsharpgtk/SqlEditorSharp.cs,v
retrieving revision 1.2
diff -u -r1.2 SqlEditorSharp.cs
--- sqlsharpgtk/sqlsharpgtk/SqlEditorSharp.cs	11 Jan 2004 05:27:58 -0000	1.2
+++ sqlsharpgtk/sqlsharpgtk/SqlEditorSharp.cs	28 Feb 2004 22:01:10 -0000
@@ -410,7 +410,7 @@
 			int i;
 			char ch;
 
-			for (i = 0; i < char_count; i++) {
+			for (i = 0; i < text.Length; i++) {
 				match_start1 = start_iter;
 				match_end1 = start_iter;

--=-mtLTjzinZlEttpVxxQUb
Content-Disposition: attachment; filename=gtkupgrade.diff
Content-Type: text/x-patch; name=gtkupgrade.diff; charset=
Content-Transfer-Encoding: 7bit

Index: sqlsharpgtk/sqlsharpgtk/DataGrid.cs
===================================================================
RCS file: /mono/sqlsharpgtk/sqlsharpgtk/DataGrid.cs,v
retrieving revision 1.2
diff -u -r1.2 DataGrid.cs
--- sqlsharpgtk/sqlsharpgtk/DataGrid.cs	11 Jan 2004 05:27:58 -0000	1.2
+++ sqlsharpgtk/sqlsharpgtk/DataGrid.cs	28 Feb 2004 21:37:33 -0000
@@ -227,7 +227,7 @@
 		public TreeIter NewRow () 
 		{ 
 			TreeIter rowTreeIter = new TreeIter();
-			store.Append (out rowTreeIter);
+			rowTreeIter = store.Append ();
 			return rowTreeIter;
 		}
 
Index: sqlsharpgtk/sqlsharpgtk/FileSelectionDialog.cs
===================================================================
RCS file: /mono/sqlsharpgtk/sqlsharpgtk/FileSelectionDialog.cs,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 FileSelectionDialog.cs
--- sqlsharpgtk/sqlsharpgtk/FileSelectionDialog.cs	17 Oct 2003 04:11:49 -0000	1.1.1.1
+++ sqlsharpgtk/sqlsharpgtk/FileSelectionDialog.cs	28 Feb 2004 21:37:34 -0000
@@ -11,7 +11,6 @@
 using System;
 
 using Gtk;
-using GtkSharp;
 
 namespace Mono.GtkSharp.Goodies 
 {
Index: sqlsharpgtk/sqlsharpgtk/LoginDialog.cs
===================================================================
RCS file: /mono/sqlsharpgtk/sqlsharpgtk/LoginDialog.cs,v
retrieving revision 1.2
diff -u -r1.2 LoginDialog.cs
--- sqlsharpgtk/sqlsharpgtk/LoginDialog.cs	11 Jan 2004 05:27:58 -0000	1.2
+++ sqlsharpgtk/sqlsharpgtk/LoginDialog.cs	28 Feb 2004 21:37:34 -0000
@@ -17,7 +17,6 @@
 	using System.Text;
 	using System.IO;
 	using Gtk;
-	using GtkSharp;
 	using SqlEditorSharp;
 	using System.Reflection;
 	using System.Runtime.Remoting;
Index: sqlsharpgtk/sqlsharpgtk/SqlEditorSharp.cs
===================================================================
RCS file: /mono/sqlsharpgtk/sqlsharpgtk/SqlEditorSharp.cs,v
retrieving revision 1.2
diff -u -r1.2 SqlEditorSharp.cs
--- sqlsharpgtk/sqlsharpgtk/SqlEditorSharp.cs	11 Jan 2004 05:27:58 -0000	1.2
+++ sqlsharpgtk/sqlsharpgtk/SqlEditorSharp.cs	28 Feb 2004 21:37:36 -0000
@@ -195,13 +195,13 @@
 			char ch = ' ';
 
 			insert_mark = sqlTextBuffer.InsertMark;
-			sqlTextBuffer.GetIterAtMark (out insert_iter, insert_mark);
+			insert_iter = sqlTextBuffer.GetIterAtMark (insert_mark);
 			//line = insert_iter.Line;
 			
 			/* get the starting and ending text iterators */
-			sqlTextBuffer.GetIterAtOffset (out start_iter, 0);
+			start_iter = sqlTextBuffer.GetIterAtOffset (0);
 			char_count = sqlTextBuffer.CharCount;
-			sqlTextBuffer.GetIterAtOffset (out end_iter, char_count);
+			end_iter = sqlTextBuffer.GetIterAtOffset (char_count);
 			
 			SqlSharpGtk.DebugWriteLine ("char_count: " + char_count);
 			
@@ -317,7 +317,7 @@
 			 * - SQL keywords (SELECT, FROM, WHERE, UPDATE, etc)
 			 *********************************************************************/
 			//if (line != line_last_changed) {
-			sqlTextBuffer.GetIterAtOffset (out start_iter, 0);
+			start_iter = sqlTextBuffer.GetIterAtOffset (0);
 			//}
 			//else {
 			//	if (insert_iter.StartsLine () == true) {
@@ -332,7 +332,7 @@
 			// get starting and ending iters 
 			// and character count of line
 			char_count = sqlTextBuffer.CharCount;
-			sqlTextBuffer.GetIterAtOffset (out end_iter, char_count);
+			end_iter = sqlTextBuffer.GetIterAtOffset (char_count);
 			
 			// for each line, look for:
 			// line comments, constants, and keywoards 
@@ -651,7 +651,7 @@
 			StreamWriter sw = null;
 			
 			sw = new StreamWriter(outFilename);			
-			sqlTextBuffer.GetIterAtOffset (out iter, 0);
+			iter = sqlTextBuffer.GetIterAtOffset (0);
 			start_iter = iter;
 			while (iter.ForwardLine()) {
 				text = sqlTextBuffer.GetText(start_iter, iter, false);
Index: sqlsharpgtk/sqlsharpgtk/sqlsharpgtk.cs
===================================================================
RCS file: /mono/sqlsharpgtk/sqlsharpgtk/sqlsharpgtk.cs,v
retrieving revision 1.3
diff -u -r1.3 sqlsharpgtk.cs
--- sqlsharpgtk/sqlsharpgtk/sqlsharpgtk.cs	26 Jan 2004 02:11:09 -0000	1.3
+++ sqlsharpgtk/sqlsharpgtk/sqlsharpgtk.cs	28 Feb 2004 21:37:39 -0000
@@ -29,7 +29,6 @@
 
 	using Gdk;
 	using Gtk;
-	using GtkSharp;
 	
 	using Mono.GtkSharp.Goodies;
 
@@ -112,7 +111,7 @@
 		public void CreateGui() 
 		{
 			win = new Gtk.Window (ApplicationName);
-			win.DeleteEvent += new GtkSharp.DeleteEventHandler(OnWindow_Delete);
+			win.DeleteEvent += new DeleteEventHandler(OnWindow_Delete);
 			win.BorderWidth = 4;
 			win.DefaultSize = new Size (450, 300);
 			
@@ -137,7 +136,7 @@
 			NewEditorTab();
 			paned.Add1 (sourceFileNotebook);
 			sourceFileNotebook.SwitchPage += new 
-				GtkSharp.SwitchPageHandler(OnEditorTabSwitched);
+				SwitchPageHandler(OnEditorTabSwitched);
 
 			// bottom panel
 			resultsNotebook = CreateOutputResultsGui ();
@@ -156,8 +155,8 @@
 			editor = new SqlEditorSharp ();
 			editor.UseSyntaxHiLighting = true;
 			editor.View.Show ();
-			editor.View.KeyPressEvent +=
-				new GtkSharp.KeyPressEventHandler(OnKeyPressEventKey);
+			editor.View.KeyPressEvent +=
+				new KeyPressEventHandler(OnKeyPressEventKey);
 
 			lastUnknownFile ++;
 			string unknownFile = "Unknown" + 
@@ -231,20 +230,20 @@
 			return sw;
 		}
 
-		void OnKeyPressEventKey(object o, GtkSharp.KeyPressEventArgs args) 
-		{
-			if (o is TextView) {
-				TextView tv = (TextView) o;
-				//Gdk.EventKey k = args.Event;
-
-				// if the F5 key was pressed
-				if (args.Event.keyval == 0xFFC2) {
-					if (tv.Editable == true) {
-						// execute SQL
-						ExecuteSQL (ExecuteOutputType.Normal, "");
-					}
-				}
-			}
+		void OnKeyPressEventKey(object o, KeyPressEventArgs args) 
+		{
+			if (o is TextView) {
+				TextView tv = (TextView) o;
+				//Gdk.EventKey k = args.Event;
+
+				// if the F5 key was pressed
+				if (args.Event.KeyValue == 0xFFC2) {
+					if (tv.Editable == true) {
+						// execute SQL
+						ExecuteSQL (ExecuteOutputType.Normal, "");
+					}
+				}
+			}
 		}
 
 		Toolbar CreateToolbar () 
@@ -521,9 +520,9 @@
 		{
 			TextIter iter;
 			buffer.MoveMark(buf.InsertMark, buffer.EndIter);
-			if(text != null) 
+			if(text != null) 
 			{
-				if (text.Equals ("") == false) 
+				if (text.Equals ("") == false) 
 				{				
 					iter = buffer.EndIter;
 					buffer.Insert (iter, text);
@@ -605,14 +604,14 @@
 			win.Title = title;
 		}
 
-		void OnEditorTabSwitched (object o, GtkSharp.SwitchPageArgs args) 
+		void OnEditorTabSwitched (object o, SwitchPageArgs args) 
 		{
 			int page = (int) args.PageNum;
 			EditorTab tab = FindEditorTab(page);
 			UpdateTitleBar (tab);
 		}
 
-		void OnWindow_Delete (object o, GtkSharp.DeleteEventArgs args) 
+		void OnWindow_Delete (object o, DeleteEventArgs args) 
 		{
 			QuitApplication();
 		}

--=-mtLTjzinZlEttpVxxQUb
Content-Disposition: attachment; filename=openreaderfix.diff
Content-Type: text/x-patch; name=openreaderfix.diff; charset=us-ascii
Content-Transfer-Encoding: quoted-printable

Index: sqlsharpgtk/sqlsharpgtk/sqlsharpgtk.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /mono/sqlsharpgtk/sqlsharpgtk/sqlsharpgtk.cs,v
retrieving revision 1.3
diff -u -r1.3 sqlsharpgtk.cs
--- sqlsharpgtk/sqlsharpgtk/sqlsharpgtk.cs	26 Jan 2004 02:11:09 -0000	1.3
+++ sqlsharpgtk/sqlsharpgtk/sqlsharpgtk.cs	28 Feb 2004 22:01:13 -0000
@@ -1638,7 +1637,11 @@
 				}
 			}
 			AppendText("Status: " + status);
-
+		=09
+			if (reader !=3D null && ! reader.IsClosed)
+			{
+				reader.Close();
+			}
 			adapter.Dispose();
 			adapter =3D null;
=20

--=-mtLTjzinZlEttpVxxQUb--