[MonoDevelop] Patch for some newed TextEditor Property bindings

John BouAntoun jba-mono@optusnet.com.au
Sat, 07 Feb 2004 21:24:52 +1100


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

Hi Guys,

Spent a fair while looking at the newed's SourceEditorDisplayBinding and
related files trying to figure out what could and couldn't be changed.

I ended up modifying the "void PropertiesChanged (object sender,
PropertyEventArgs e)" event so that it had place holders for all the
Text Editor options in the option panel.

Where the existing gtksourceview functionality was able to map to the
TextEditorProperties I wired them in.

Not much code, but a great deal of time spent trying to understand how
it all works. I'd be interested to hear from BenM about how he intends
to add in the other properties that don't already map to sourceview,
because I would like to help.

Also where is a good place to get api docs of the SourceView component?

Anyways, here is the patch. It adds stuff like tab size, showing the
vertical ruler, and tabs as spaces. It seemed to have a problem
displaying the end of line marker though.

Regards, 

JBA

--=-x2KlkQv7cHz0C3esFhMR
Content-Disposition: attachment; filename=SourceEditorDisplayBinding-PropertyChanges.patch
Content-Type: text/x-patch; name=SourceEditorDisplayBinding-PropertyChanges.patch; charset=UTF-8
Content-Transfer-Encoding: 7bit

Index: SourceEditorDisplayBinding.cs
===================================================================
--- SourceEditorDisplayBinding.cs	(revision 803)
+++ SourceEditorDisplayBinding.cs	(working copy)
@@ -275,7 +275,58 @@
 		
 		void PropertiesChanged (object sender, PropertyEventArgs e)
 		{
+			// FIXME: should probably have a switch on the e.Key 
+			// to find out which property it was that changed
+			
+			// NOTE: don't need to set these property changes, since they are 
+			// used as getter properties in the SourcEditorView IFormattableDocument implementation
+			// DONOTDO: indentation -> none, auto or smart
+			// DONOTDO: auto insert curly braces
+			
+			// TODO: CodeCompletion
+			// TODO: Code Folding
+			// TODO: Double Buffering
+			
+			// font
 			se.View.ModifyFont (TextEditorProperties.Font);
+			
+			// TODO: Show Invalid Lines
+			
+			// show line numbers
+			se.View.ShowLineNumbers = TextEditorProperties.ShowLineNumbers;
+			
+			// TODO: hilight matching bracket
+			// TODO: show spaces
+			// TODO: show tabs
+			
+			// show eol makers
+			se.View.ShowLineMarkers = TextEditorProperties.ShowEOLMarker;
+			// FIXME: doesn't seem to do anything except widen the line
+			
+			// TODO: underline errors
+			// TODO: show horizontal ruler
+			
+			// show column ruler after n cols
+			se.View.ShowMargin = TextEditorProperties.ShowVerticalRuler;
+			if (TextEditorProperties.VerticalRulerRow > -1) {
+				se.View.Margin = (uint) TextEditorProperties.VerticalRulerRow;
+			} else {
+				se.View.Margin = (uint) 80;		// FIXME: should i be doing this on a bad vruller setting?
+			}
+			
+			// tab width
+			if (TextEditorProperties.TabIndent > -1) {
+				se.View.TabsWidth = (uint) TextEditorProperties.TabIndent;
+			} else {
+				se.View.TabsWidth = (uint) 8;	// FIXME: should i be doing this on a bad tabindent setting?
+			}
+			
+			// TODO: convert tabs to spaces
+			se.View.InsertSpacesInsteadOfTabs = TextEditorProperties.ConvertTabsToSpaces;
+			
+			// TODO: can move past EOL
+			// TODO: auot insert template			
+			// TODO: hide mouse while typing
 		}
 
 	}

--=-x2KlkQv7cHz0C3esFhMR--