[Monodevelop-patches-list] r681 - trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Tue Jan 27 13:00:34 EST 2004


Author: benm
Date: 2004-01-27 13:00:34 -0500 (Tue, 27 Jan 2004)
New Revision: 681

Modified:
   trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs
   trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
   trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs
Log:
refactor

Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs	2004-01-27 17:47:35 UTC (rev 680)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs	2004-01-27 18:00:34 UTC (rev 681)
@@ -1,12 +1,21 @@
 using Gtk;
 using GtkSharp;
 
+using ICSharpCode.SharpDevelop.Gui;
+using ICSharpCode.SharpDevelop.Internal.Project;
+using ICSharpCode.Core.Properties;
+using ICSharpCode.Core.AddIns;
+using ICSharpCode.Core.Services;
+using ICSharpCode.SharpDevelop.Services;
+using ICSharpCode.Core.AddIns.Codons;
+
 using System;
 using System.IO;
 using System.Runtime.InteropServices;
 	
 namespace MonoDevelop.SourceEditor.Gui {
-	public class SourceEditorBuffer : SourceBuffer {
+	public class SourceEditorBuffer : SourceBuffer,
+		IClipboardHandler {
 		
 		SourceLanguagesManager slm = new SourceLanguagesManager ();
 		
@@ -41,5 +50,73 @@
 			s.Write (Text);
 			s.Close ();
 		}
+
+#region IClipboardHandler
+		bool HasSelection {
+			get {
+				TextIter dummy, dummy2;
+				return GetSelectionBounds (out dummy, out dummy2);
+			}
+		}
+		
+		bool IClipboardHandler.EnableCut {
+			get { return HasSelection; }
+		}
+		
+		bool IClipboardHandler.EnableCopy {
+			get { return HasSelection; }
+		}
+		
+		bool IClipboardHandler.EnablePaste {
+			get {
+				return clipboard.WaitIsTextAvailable ();
+			}
+		}
+		
+		bool IClipboardHandler.EnableDelete {
+			get { return HasSelection; }
+		}
+		
+		bool IClipboardHandler.EnableSelectAll {
+			get { return true; }
+		}
+		
+		void IClipboardHandler.Cut (object sender, EventArgs e)
+		{
+			CutClipboard (clipboard, true);
+		}
+		
+		void IClipboardHandler.Copy (object sender, EventArgs e)
+		{
+			CopyClipboard (clipboard);
+		}
+		
+		void IClipboardHandler.Paste (object sender, EventArgs e)
+		{
+			PasteClipboard (clipboard);
+		}
+		
+		void IClipboardHandler.Delete (object sender, EventArgs e)
+		{
+			DeleteSelection (true, true);
+		}
+		
+		void IClipboardHandler.SelectAll (object sender, EventArgs e)
+		{
+			// Sadly, this is not in our version of the bindings:
+			//
+			//gtk_text_view_select_all (GtkWidget *widget,
+			//			  gboolean select)
+			//{
+			//	gtk_text_buffer_get_bounds (buffer, &start_iter, &end_iter);
+			//	gtk_text_buffer_move_mark_by_name (buffer, "insert", &start_iter);
+			//	gtk_text_buffer_move_mark_by_name (buffer, "selection_bound", &end_iter);
+			
+			MoveMark ("insert", StartIter);
+			MoveMark ("selection_bound", EndIter);
+		}
+		
+		Gtk.Clipboard clipboard = Gtk.Clipboard.Get (Gdk.Atom.Intern ("CLIPBOARD", false));
+#endregion
 	}
 }
\ No newline at end of file

Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs	2004-01-27 17:47:35 UTC (rev 680)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs	2004-01-27 18:00:34 UTC (rev 681)
@@ -62,7 +62,7 @@
 	}
 	
 	public class SourceEditorDisplayBindingWrapper : AbstractViewContent,
-		IEditable, IClipboardHandler
+		IEditable
 	{
 		internal SourceEditor se;
 		
@@ -122,7 +122,7 @@
 		
 #region IEditable
 		public IClipboardHandler ClipboardHandler {
-			get { return this; }
+			get { return se.Buffer; }
 		}
 		
 		public string Text {
@@ -140,76 +140,6 @@
 			se.Buffer.Redo ();
 		}
 #endregion
-#region IClipboardHandler
-		//
-		// TODO: All of this ;-)
-		//
-		
-		bool HasSelection {
-			get {
-				TextIter dummy, dummy2;
-				return se.Buffer.GetSelectionBounds (out dummy, out dummy2);
-			}
-		}
-		
-		public bool EnableCut {
-			get { return HasSelection; }
-		}
-		
-		public bool EnableCopy {
-			get { return HasSelection; }
-		}
-		
-		public bool EnablePaste {
-			get {
-				return clipboard.WaitIsTextAvailable ();
-			}
-		}
-		
-		public bool EnableDelete {
-			get { return HasSelection; }
-		}
-		
-		public bool EnableSelectAll {
-			get { return true; }
-		}
-		
-		public void Cut (object sender, EventArgs e)
-		{
-			se.Buffer.CutClipboard (clipboard, true);
-		}
-		
-		public void Copy (object sender, EventArgs e)
-		{
-			se.Buffer.CopyClipboard (clipboard);
-		}
-		
-		public void Paste (object sender, EventArgs e)
-		{
-			se.Buffer.PasteClipboard (clipboard);
-		}
-		
-		public void Delete (object sender, EventArgs e)
-		{
-			se.Buffer.DeleteSelection (true, true);
-		}
-		
-		public void SelectAll (object sender, EventArgs e)
-		{
-			// Sadly, this is not in our version of the bindings:
-			//
-			//gtk_text_view_select_all (GtkWidget *widget,
-			//			  gboolean select)
-			//{
-			//	gtk_text_buffer_get_bounds (buffer, &start_iter, &end_iter);
-			//	gtk_text_buffer_move_mark_by_name (buffer, "insert", &start_iter);
-			//	gtk_text_buffer_move_mark_by_name (buffer, "selection_bound", &end_iter);
-			
-			se.Buffer.MoveMark ("insert", se.Buffer.StartIter);
-			se.Buffer.MoveMark ("selection_bound", se.Buffer.EndIter);
-		}
-		
-		Gtk.Clipboard clipboard = Gtk.Clipboard.Get (Gdk.Atom.Intern ("CLIPBOARD", false));
-#endregion
+
 	}
 }

Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs	2004-01-27 17:47:35 UTC (rev 680)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs	2004-01-27 18:00:34 UTC (rev 681)
@@ -11,7 +11,6 @@
 		public readonly SourceEditorBuffer Buffer;
 		SourceView sv;
 		
-
 		public SourceEditor ()
 		{
 			Buffer = new SourceEditorBuffer ();
@@ -26,8 +25,6 @@
 			
 			Add (sv);
 		}
-
-
 		
 		public string Text {
 			get { return Buffer.Text; }




More information about the Monodevelop-patches-list mailing list