Author: mkrueger
Date: 2008-02-13 08:14:28 -0500 (Wed, 13 Feb 2008)
New Revision: 95576

Modified:
   trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextMarker.cs
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs
Log:
* Mono.TextEditor/TextViewMargin.cs, Mono.TextEditor/TextMarker.cs,
  Mono.TextEditor/TextEditor.cs: Optimized drawing.

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-13 
13:10:10 UTC (rev 95575)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-13 
13:14:28 UTC (rev 95576)
@@ -1,5 +1,10 @@
 2008-02-13  Mike Krüger <[EMAIL PROTECTED]> 
 
+       * Mono.TextEditor/TextViewMargin.cs, Mono.TextEditor/TextMarker.cs,
+         Mono.TextEditor/TextEditor.cs: Optimized drawing.
+
+2008-02-13  Mike Krüger <[EMAIL PROTECTED]> 
+
        * Mono.TextEditor/TextViewMargin.cs, Mono.TextEditor/TextEditor.cs: 
Fixed
          drawing glicht caused by false adjustment.
 

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs 
    2008-02-13 13:10:10 UTC (rev 95575)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs 
    2008-02-13 13:14:28 UTC (rev 95576)
@@ -113,7 +113,7 @@
                                return;
                        
                        this.textEditorData.HAdjustment.ValueChanged += 
delegate {
-                               this.QueueDraw ();
+                               this.QueueDrawArea 
(this.textViewMargin.XOffset, 0, this.Allocation.Width - 
this.textViewMargin.XOffset, this.Allocation.Height);
                        };
                        this.textEditorData.VAdjustment.ValueChanged += 
delegate {
                                if (this.textEditorData.VAdjustment.Value != 
System.Math.Ceiling (this.textEditorData.VAdjustment.Value)) {
@@ -608,6 +608,12 @@
                        }
                }
                
+               public TextViewMargin TextViewMargin {
+                       get {
+                               return textViewMargin;
+                       }
+               }
+               
                public Gdk.Point DocumentToVisualLocation (DocumentLocation loc)
                {
                        Gdk.Point result = new Point ();
@@ -694,8 +700,9 @@
                                foreach (IMargin margin in this.margins) {
                                        if (margin.IsVisible) {
                                                margin.XOffset = curX;
-                                               margin.Draw (win, area, 
logicalLineNumber, curX, curY);
                                                curX += margin.Width;
+                                               if (curX > area.X || 
margin.Width < 0)
+                                                       margin.Draw (win, area, 
logicalLineNumber, margin.XOffset, curY);
                                        }
                                }
                                curY += LineHeight;

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextMarker.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextMarker.cs 
    2008-02-13 13:10:10 UTC (rev 95575)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextMarker.cs 
    2008-02-13 13:14:28 UTC (rev 95576)
@@ -51,11 +51,10 @@
                                int width1 = editor.GetWidth 
(editor.Buffer.GetTextAt (line.Offset, startColumn));
                                int width2 = editor.GetWidth 
(editor.Buffer.GetTextAt (line.Offset + startColumn, endColumn - startColumn));
                                gc.RgbFgColor = editor.ColorStyle.GetChunkStyle 
(style).Color;
-                               win.DrawLine (gc, 
-                                             startXPos + width1,
-                                             y + editor.LineHeight - 1,
-                                             startXPos + width1 + width2,
-                                             y + editor.LineHeight - 1);
+                               int from = System.Math.Max 
(editor.TextViewMargin.XOffset, startXPos + width1);
+                               int to   = System.Math.Max 
(editor.TextViewMargin.XOffset, startXPos + width1 + width2);
+                               if (from < to)
+                                       win.DrawLine (gc, from, y + 
editor.LineHeight - 1, to, y + editor.LineHeight - 1);
                        }
                }
        }

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs
 2008-02-13 13:10:10 UTC (rev 95575)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs
 2008-02-13 13:14:28 UTC (rev 95576)
@@ -487,11 +487,15 @@
                public override void Draw (Gdk.Drawable win, Gdk.Rectangle 
area, int lineNr, int x, int y)
                {
                        layout.Alignment = Pango.Alignment.Left;
+                       
                        LineSegment line = lineNr < Document.Splitter.LineCount 
? Document.Splitter.Get (lineNr) : null;
-                       
-                       gc.ClipRectangle = new Gdk.Rectangle (x, y, 
textEditor.Allocation.Width - x, LineHeight);
+                       int xStart = System.Math.Max (area.X, XOffset);
+                       gc.ClipRectangle = new Gdk.Rectangle (xStart, 
+                                                             y, 
+                                                             area.Right - 
xStart,
+                                                             LineHeight);
                
-                       Gdk.Rectangle lineArea = new Gdk.Rectangle (x, y, 
area.Width - x, LineHeight);
+                       Gdk.Rectangle lineArea = new Gdk.Rectangle (XOffset, y, 
textEditor.Allocation.Width - XOffset, LineHeight);
                        bool isSelected = false;
                        bool drawDefaultBg = true;
                        bool eolSelected = false;

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

Reply via email to