Author: jackson
Date: 2007-05-14 18:12:02 -0400 (Mon, 14 May 2007)
New Revision: 77384
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MaskedTextBox.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs
Log:
* TextBoxBase.cs: Implement some of the new 2.0 methods.
* RichTextBox.cs: We need to override these methods on 2.0.
* MaskedTextBox.cs: These are implemented now
* TextControl.cs: This was off by one.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-05-14 21:42:51 UTC (rev 77383)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-05-14 22:12:02 UTC (rev 77384)
@@ -1,5 +1,12 @@
2007-05-14 Jackson Harper <[EMAIL PROTECTED]>
+ * TextBoxBase.cs: Implement some of the new 2.0 methods.
+ * RichTextBox.cs: We need to override these methods on 2.0.
+ * MaskedTextBox.cs: These are implemented now
+ * TextControl.cs: This was off by one.
+
+2007-05-14 Jackson Harper <[EMAIL PROTECTED]>
+
* TextControl.cs: Because the line endings are including in the
text, we don't need to add them in anymore.
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MaskedTextBox.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MaskedTextBox.cs
2007-05-14 21:42:51 UTC (rev 77383)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MaskedTextBox.cs
2007-05-14 22:12:02 UTC (rev 77384)
@@ -162,7 +162,7 @@
{
base.CreateHandle ();
}
-#if notyet
+
public override char GetCharFromPosition (Point pt)
{
return base.GetCharFromPosition (pt);
@@ -172,7 +172,7 @@
{
return base.GetCharIndexFromPosition (pt);
}
-#endif
+
[EditorBrowsable (EditorBrowsableState.Never)]
public int GetFirstCharIndexFromLine (int lineNumber)
{
@@ -190,12 +190,12 @@
{
return 0;
}
-#if notyet
+
public override Point GetPositionFromCharIndex (int index)
{
return base.GetPositionFromCharIndex (index);
}
-#endif
+
protected override bool IsInputKey (Keys keyData)
{
return base.IsInputKey (keyData);
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs
2007-05-14 21:42:51 UTC (rev 77383)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs
2007-05-14 22:12:02 UTC (rev 77384)
@@ -827,7 +827,11 @@
return Find(str, -1, -1, options);
}
- public char GetCharFromPosition(Point pt) {
+ public
+#if NET_2_0
+ override
+#endif
+ char GetCharFromPosition(Point pt) {
LineTag tag;
int pos;
@@ -841,7 +845,11 @@
}
- public int GetCharIndexFromPosition(Point pt) {
+ public
+#if NET_2_0
+ override
+#endif
+ int GetCharIndexFromPosition(Point pt) {
LineTag tag;
int pos;
@@ -850,7 +858,11 @@
return document.LineTagToCharIndex(tag.line, pos);
}
- public int GetLineFromCharIndex(int index) {
+ public
+#if NET_2_0
+ override
+#endif
+ int GetLineFromCharIndex(int index) {
Line line;
LineTag tag;
int pos;
@@ -860,7 +872,11 @@
return line.LineNo - 1;
}
- public Point GetPositionFromCharIndex(int index) {
+ public
+#if NET_2_0
+ override
+#endif
+ Point GetPositionFromCharIndex(int index) {
Line line;
LineTag tag;
int pos;
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
2007-05-14 21:42:51 UTC (rev 77383)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
2007-05-14 22:12:02 UTC (rev 77384)
@@ -769,6 +769,90 @@
public void Undo() {
document.undo.Undo();
}
+
+#if NET_2_0
+ public virtual char GetCharFromPosition (Point p)
+ {
+ int index;
+ LineTag tag = document.FindCursor (p.X, p.Y, out index);
+ if (tag == null)
+ return (char) 0; // Shouldn't happen
+
+ if (index >= tag.line.text.Length) {
+
+ if (tag.line.ending == LineEnding.Wrap) {
+ // If we have wrapped text, we return
the first char of the next line
+ Line line = document.GetLine
(tag.line.line_no + 1);
+ if (line != null)
+ return line.text [0];
+
+ }
+
+ if (tag.line.line_no == document.Lines) {
+ // Last line returns the last char
+ return tag.line.text
[tag.line.text.Length - 1];
+ }
+
+ // This really shouldn't happen
+ return (char) 0;
+ }
+ return tag.line.text [index];
+ }
+
+ public virtual int GetCharIndexFromPosition (Point p)
+ {
+ int line_index;
+ LineTag tag = document.FindCursor (p.X, p.Y, out
line_index);
+ if (tag == null)
+ return 0;
+
+ if (line_index >= tag.line.text.Length) {
+
+ if (tag.line.ending == LineEnding.Wrap) {
+ // If we have wrapped text, we return
the first char of the next line
+ Line line = document.GetLine
(tag.line.line_no + 1);
+ if (line != null)
+ return
document.LineTagToCharIndex (line, 0);
+ }
+
+ if (tag.line.line_no == document.Lines) {
+ // Last line returns the last char
+ return document.LineTagToCharIndex
(tag.line, tag.line.text.Length - 1);
+ }
+
+ return 0;
+ }
+
+ return document.LineTagToCharIndex (tag.line,
line_index);
+ }
+
+ public virtual Point GetPositionFromCharIndex (int index)
+ {
+ int pos;
+ Line line;
+ LineTag tag;
+
+ document.CharIndexToLineTag (index, out line, out tag,
out pos);
+
+ return new Point ((int) (line.widths [pos] +
+ line.X +
document.viewport_x),
+ line.Y + document.viewport_y +
tag.shift);
+ }
+
+ public int GetFirstCharIndexFromLine (int line_number)
+ {
+ Line line = document.GetLine (line_number + 1);
+ if (line == null)
+ return -1;
+
+ return document.LineTagToCharIndex (line, 0);
+ }
+
+ public int GetFirstCharIndexOfCurrentLine ()
+ {
+ return document.LineTagToCharIndex
(document.caret.line, 0);
+ }
+#endif
#endregion // Public Instance Methods
#region Protected Instance Methods
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs
2007-05-14 21:42:51 UTC (rev 77383)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs
2007-05-14 22:12:02 UTC (rev 77384)
@@ -3643,7 +3643,7 @@
tag = line.tags;
while (tag != null) {
- if (index < (start + tag.start
+ tag.length)) {
+ if (index < (start + tag.start
+ tag.length - 1)) {
line_out = line;
tag_out =
LineTag.GetFinalTag (tag);
pos = index - start;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches