+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.
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
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;
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);
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
Brush hilight;
Brush hilight_text;
- RecalculateAlignments ();
-
// First, figure out from what line to what line we need to draw
if (multiline) {
public float X {
get {
if (start == 0)
- return line.X + line.indent;
+ return line.X;
return line.X + line.widths [start - 1];
}
}
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);
}