Author: jackson
Date: 2007-02-20 17:26:00 -0500 (Tue, 20 Feb 2007)
New Revision: 73221

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs
Log:

        * TextControl.cs: Remove RecalAlignments call, that was some
        debugging leftovers.
        - Don't use the line indent when we shouldn't.
        * RichTextBox.cs: Add support for paragraph left indents.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-02-20 22:10:38 UTC (rev 73220)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-02-20 22:26:00 UTC (rev 73221)
@@ -1,3 +1,10 @@
+2007-02-20  Jackson Harper  <[EMAIL PROTECTED]>
+
+       * TextControl.cs: Remove RecalAlignments call, that was some
+       debugging leftovers.
+       - Don't use the line indent when we shouldn't.
+       * RichTextBox.cs: Add support for paragraph left indents.
+
 2007-02-20  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>
 
        * Control.cs: Fix BeginInvoke signature for 2.0 profile.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs   
2007-02-20 22:10:38 UTC (rev 73220)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs   
2007-02-20 22:26:00 UTC (rev 73221)
@@ -61,6 +61,7 @@
                private int             rtf_cursor_x;
                private int             rtf_cursor_y;
                private int             rtf_chars;
+               private int rtf_par_line_left_indent;
                #endregion      // Local Variables
 
                #region Public Constructors
@@ -313,7 +314,7 @@
                                return 
GenerateRTF(document.selection_start.line, document.selection_start.pos, 
document.selection_end.line, document.selection_end.pos).ToString();
                        }
 
-                       set {
+                       set {                           
                                MemoryStream    data;
                                int             x;
                                int             y;
@@ -1354,6 +1355,15 @@
                                        break;
                                }
 
+                       case RTF.Major.ParAttr: {
+                               switch (rtf.Minor) {
+                               case Minor.LeftIndent:
+                                       rtf_par_line_left_indent = (int) 
(((float) rtf.Param / 1440.0F) * CreateGraphics ().DpiX + 0.5F);
+                                       break;
+                               }
+                               break;
+                       }
+                               
                                case RTF.Major.SpecialChar: {
                                        //Console.Write("[Got SpecialChar 
control {0}]", rtf.Minor);
                                        SpecialChar(rtf);
@@ -1494,10 +1504,15 @@
 
                        if (rtf_cursor_x == 0) {
                                document.Add(rtf_cursor_y, rtf_line.ToString(), 
rtf_rtfalign, font, rtf_color);
+                               if (rtf_par_line_left_indent != 0) {
+                                       Line line = document.GetLine 
(rtf_cursor_y);
+                                       line.indent = rtf_par_line_left_indent;
+                               }
                        } else {
                                Line    line;
 
                                line = document.GetLine(rtf_cursor_y);
+                               line.indent = rtf_par_line_left_indent;
                                if (rtf_line.Length > 0) {
                                        document.InsertString(line, 
rtf_cursor_x, rtf_line.ToString());
                                        document.FormatText(line, rtf_cursor_x 
+ 1, line, rtf_cursor_x + 1 + length, font, rtf_color, null, 
FormatSpecified.Font | FormatSpecified.Color); // FormatText is 1-based

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs   
2007-02-20 22:10:38 UTC (rev 73220)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs   
2007-02-20 22:26:00 UTC (rev 73221)
@@ -1871,8 +1871,6 @@
                        Brush hilight;
                        Brush hilight_text;
 
-                       RecalculateAlignments ();
-                       
                        // First, figure out from what line to what line we 
need to draw
 
                        if (multiline) {
@@ -4352,7 +4350,7 @@
                public float X {
                        get {
                                if (start == 0)
-                                       return line.X + line.indent;
+                                       return line.X;
                                return line.X + line.widths [start - 1];
                        }
                }
@@ -4396,7 +4394,8 @@
                        dc.DrawString (line.text.ToString (start, end), font, 
brush, x, y, StringFormat.GenericTypographic);
                }
 
-               internal virtual void Draw (Graphics dc, Brush brush, float x, 
float y, int start, int end, string text) {
+               internal virtual void Draw (Graphics dc, Brush brush, float x, 
float y, int start, int end, string text)
+               {
                        dc.DrawString (text.Substring (start, end), font, 
brush, x, y, StringFormat.GenericTypographic);
                }
 

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

Reply via email to