Author: mkrueger
Date: 2008-01-25 06:48:40 -0500 (Fri, 25 Jan 2008)
New Revision: 93885

Modified:
   trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/DefaultEditActions.cs
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditorOptions.cs
Log:
* Mono.TextEditor/DefaultEditActions.cs, Mono.TextEditor/TextEditor.cs,
  Mono.TextEditor/TextEditorOptions.cs: Optimized drawing a bit,
  added syntax mode enabled option.

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-01-25 
11:37:44 UTC (rev 93884)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-01-25 
11:48:40 UTC (rev 93885)
@@ -1,5 +1,17 @@
 2008-01-25  Mike Krüger <[EMAIL PROTECTED]> 
 
+       * Mono.TextEditor/DefaultEditActions.cs, Mono.TextEditor/TextEditor.cs,
+         Mono.TextEditor/TextEditorOptions.cs: Optimized drawing a bit, added
+         syntax mode enabled option.
+
+2008-01-25  Mike Krüger <[EMAIL PROTECTED]> 
+
+       * Mono.TextEditor/DefaultEditActions.cs, Mono.TextEditor/TextEditor.cs,
+         Mono.TextEditor/TextEditorOptions.cs: Optimized drawing a bit, added
+         syntax mode enabled option.
+
+2008-01-25  Mike Krüger <[EMAIL PROTECTED]> 
+
        * Mono.TextEditor/TextEditor.cs, Mono.TextEditor/TextEditorOptions.cs: 
Added
          property change event.
 

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/DefaultEditActions.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/DefaultEditActions.cs
     2008-01-25 11:37:44 UTC (rev 93884)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/DefaultEditActions.cs
     2008-01-25 11:48:40 UTC (rev 93885)
@@ -793,7 +793,6 @@
                                rtf.Append (@"\par");
                        } while (iter.MoveNext ());
                        rtf.Append("}");
-                       System.Console.WriteLine(rtf);
                        this.rtf = rtf.ToString ();
                }
                

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs 
    2008-01-25 11:37:44 UTC (rev 93884)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs 
    2008-01-25 11:48:40 UTC (rev 93885)
@@ -315,7 +315,8 @@
                public void RedrawPosition (int logicalLine, int logicalColumn)
                {
 //                     Console.WriteLine ("redraw:" + logicalLine);
-                       this.QueueDrawArea (0, 
(int)-this.textEditorData.VAdjustment.Value + Document.LogicalToVisualLine 
(logicalLine) * LineHeight, this.Allocation.Width, LineHeight);
+                       RedrawLine (logicalLine);
+//                     this.QueueDrawArea (0, 
(int)-this.textEditorData.VAdjustment.Value + Document.LogicalToVisualLine 
(logicalLine) * LineHeight, this.Allocation.Width, LineHeight);
                }
                
                public void RedrawLines (int start, int end)
@@ -491,7 +492,7 @@
                {
                        return new Color ((byte)(((byte)color.Red * 19) / 20),
                                          (byte)(((byte)color.Green * 19) / 20),
-                                         (byte)(((byte)color.Blue * 19) / 
20));                        
+                                         (byte)(((byte)color.Blue * 19) / 20));
                }
 
                void DrawRectangleWithRuler (Gdk.Window win, Gdk.GC gc, int x, 
Gdk.Rectangle area, Gdk.Color color)
@@ -634,7 +635,7 @@
                                }
                        }
                        if (line.EndOffset - offset > 0) {
-                               if (Document.SyntaxMode != null) {
+                               if (Document.SyntaxMode != null && 
TextEditorOptions.Options.EnableSyntaxHighlighting) {
                                        Chunk[] chunks = 
Document.SyntaxMode.GetChunks (Document, TextEditorData.ColorStyle, line, 
offset, line.Offset + line.EditableLength - offset);
                                        int start  = offset;
                                        int xStart = xPos;
@@ -858,7 +859,6 @@
                {
                        Gdk.Window    win = e.Window;
                        Gdk.Rectangle area = e.Area;
-                       
                        int width;
                        if (TextEditorOptions.Options.ShowRuler) {
                                layout.SetText (new string (' ', 
TextEditorOptions.Options.RulerColumn));
@@ -871,8 +871,14 @@
                        }
                        int reminder  = 
(int)this.textEditorData.VAdjustment.Value % LineHeight;
                        int firstLine = 
(int)(this.textEditorData.VAdjustment.Value / LineHeight);
-                       
-                       for (int visualLineNumber = area.Top / this.LineHeight; 
visualLineNumber <= area.Bottom / this.LineHeight; visualLineNumber++) {
+                       int startLine = area.Top / this.LineHeight;
+                       int endLine   = startLine + (area.Height / 
this.LineHeight);
+                       if (area.Height % this.LineHeight == 0) {
+                               startLine = (area.Top + reminder) / 
this.LineHeight;
+                               endLine   = startLine + (area.Height / 
this.LineHeight) - 1;
+                       }
+//                     System.Console.WriteLine(startLine + " -- " + endLine);
+                       for (int visualLineNumber = startLine; visualLineNumber 
<= endLine; visualLineNumber++) {
                                int curX = 0;
                                int logicalLineNumber = 
Document.VisualToLogicalLine (visualLineNumber + firstLine);
                                foreach (IMargin margin in this.margins) {

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditorOptions.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditorOptions.cs
      2008-01-25 11:37:44 UTC (rev 93884)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditorOptions.cs
      2008-01-25 11:48:40 UTC (rev 93885)
@@ -59,7 +59,7 @@
                bool showTabs   = false;
                bool showSpaces = false;
                bool showEolMarkers = false;
-               
+               bool enableSyntaxHighlighting = true;
                bool highlightCaretLine = false;
                string fontName = DEFAULT_FONT;
                
@@ -214,7 +214,19 @@
                                }
                        }
                }
+               public virtual bool EnableSyntaxHighlighting {
+                       get {
+                               return enableSyntaxHighlighting;
+                       }
+                       set {
+                               if (value != EnableSyntaxHighlighting) {
+                                       enableSyntaxHighlighting = value;
+                                       OnChanged (EventArgs.Empty);
+                               }
+                       }
+               }
                
+               
                public virtual Pango.FontDescription Font {
                        get {
                                return Pango.FontDescription.FromString 
(FontName);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to