* TextControl.cs: Remove RecalAlignments call, that was some
authorJackson Harper <jackson@novell.com>
Tue, 20 Feb 2007 22:26:00 +0000 (22:26 -0000)
committerJackson Harper <jackson@novell.com>
Tue, 20 Feb 2007 22:26:00 +0000 (22:26 -0000)
        debugging leftovers.
        - Don't use the line indent when we shouldn't.
        * RichTextBox.cs: Add support for paragraph left indents.

svn path=/trunk/mcs/; revision=73221

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs

index d1e6735e5b84b98e087e728d65cbe01f68aef7c7..db4afbefc01d1056390e93474dc4c24f9789fda2 100644 (file)
@@ -1,3 +1,10 @@
+2007-02-20  Jackson Harper  <jackson@ximian.com>
+
+       * 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  <RKvinge@novell.com>
 
        * Control.cs: Fix BeginInvoke signature for 2.0 profile.
index 0e4446a64e82ed54abf83b610f33c38674c9d519..6101d3a678975b6e272790b6528cdad9a36f459d 100644 (file)
@@ -61,6 +61,7 @@ namespace System.Windows.Forms {
                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 @@ namespace System.Windows.Forms {
                                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 @@ namespace System.Windows.Forms {
                                        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 @@ namespace System.Windows.Forms {
 
                        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
index a5f872022c9c48755f11d8a479d9f84451165f6a..ff0f809190e78e6b2858e5d0d44b2fd6d0376b92 100644 (file)
@@ -1871,8 +1871,6 @@ namespace System.Windows.Forms {
                        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 @@ namespace System.Windows.Forms {
                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 @@ namespace System.Windows.Forms {
                        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);
                }