Author: mkrueger
Date: 2008-02-13 07:49:26 -0500 (Wed, 13 Feb 2008)
New Revision: 95573

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/TextViewMargin.cs
Log:
* Mono.TextEditor/TextViewMargin.cs, Mono.TextEditor/TextEditor.cs:
  Fixed drawing glicht caused by false adjustment.

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-13 
12:42:12 UTC (rev 95572)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-13 
12:49:26 UTC (rev 95573)
@@ -1,5 +1,10 @@
 2008-02-13  Mike Krüger <[EMAIL PROTECTED]> 
 
+       * Mono.TextEditor/TextViewMargin.cs, Mono.TextEditor/TextEditor.cs: 
Fixed
+         drawing glicht caused by false adjustment.
+
+2008-02-13  Mike Krüger <[EMAIL PROTECTED]> 
+
        * Mono.TextEditor/TextEditor.cs: Changed scrolling a bit.
 
 2008-02-13  Mike Krüger <[EMAIL PROTECTED]> 

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 12:42:12 UTC (rev 95572)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs 
    2008-02-13 12:49:26 UTC (rev 95573)
@@ -98,8 +98,10 @@
                                buffer.Dispose ();
                                flipBuffer.Dispose ();
                        }
-                       buffer = new Gdk.Pixmap (this.GdkWindow, 
allocation.Width, allocation.Height);
-                       flipBuffer = new Gdk.Pixmap (this.GdkWindow, 
allocation.Width, allocation.Height);
+                       if (this.IsRealized) {
+                               buffer = new Gdk.Pixmap (this.GdkWindow, 
allocation.Width, allocation.Height);
+                               flipBuffer = new Gdk.Pixmap (this.GdkWindow, 
allocation.Width, allocation.Height);
+                       }
                }
                
                protected override void OnSetScrollAdjustments (Adjustment 
hAdjustement, Adjustment vAdjustement)
@@ -109,7 +111,7 @@
                        
                        if (hAdjustement == null || vAdjustement == null)
                                return;
-                       SetAdjustments ();
+                       
                        this.textEditorData.HAdjustment.ValueChanged += 
delegate {
                                this.QueueDraw ();
                        };
@@ -645,23 +647,24 @@
                {
                        if (IsRealized) 
                                AllocateWindowBuffer (allocation);
-                       SetAdjustments ();
+                       SetAdjustments (allocation);
                        base.OnSizeAllocated (allocation);
                }
                
-               internal void SetAdjustments ()
+               internal void SetAdjustments (Gdk.Rectangle allocation)
                {
-                       this.textEditorData.VAdjustment.SetBounds (0, 
-                                              (Splitter.LineCount + 10) * 
this.LineHeight, 
-                                              LineHeight,
-                                              this.Allocation.Height,
-                                              this.Allocation.Height);
-                       if (longestLine != null)
+                       if (this.textEditorData.VAdjustment != null)
+                               this.textEditorData.VAdjustment.SetBounds (0, 
+                                                                          
(Splitter.LineCount + 10) * this.LineHeight, 
+                                                                          
LineHeight,
+                                                                          
allocation.Height,
+                                                                          
allocation.Height);
+                       if (longestLine != null && 
this.textEditorData.HAdjustment != null)
                                this.textEditorData.HAdjustment.SetBounds (0, 
                                                       (longestLine.Length + 
100) * this.textViewMargin.charWidth, 
                                                       
this.textViewMargin.charWidth,
-                                                      this.Allocation.Width,
-                                                      this.Allocation.Width);
+                                                      allocation.Width,
+                                                      allocation.Width);
                }
                
                public int GetWidth (string text)
@@ -703,7 +706,7 @@
                protected override bool OnExposeEvent (Gdk.EventExpose e)
                {
                        if (oldRequest != Splitter.LineCount * this.LineHeight) 
{
-                               SetAdjustments ();
+                               SetAdjustments (this.Allocation);
                                oldRequest = Splitter.LineCount * 
this.LineHeight;
                        }
                        

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 12:42:12 UTC (rev 95572)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs
 2008-02-13 12:49:26 UTC (rev 95573)
@@ -609,7 +609,7 @@
                        
                        if (textEditor.longestLine == null 
|| line.EditableLength > textEditor.longestLine.EditableLength) {
                                textEditor.longestLine = line;
-                               textEditor.SetAdjustments ();
+                               textEditor.SetAdjustments 
(textEditor.Allocation);
                        }
                        
                        // Draw remaining line

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

Reply via email to