- Left mousebutton now sets the caret (and middle button still acts
authorPeter Dennis Bartok <pbartok@mono-cvs.ximian.com>
Fri, 17 Dec 2004 09:23:23 +0000 (09:23 -0000)
committerPeter Dennis Bartok <pbartok@mono-cvs.ximian.com>
Fri, 17 Dec 2004 09:23:23 +0000 (09:23 -0000)
  as formatting tester, which must go away soon)
- Added Debug section for Deleting/Combining lines
- Fixed calculations for UpdateView after Combining lines

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

mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs

index b6b4ebb6f088bd429a833c97640b4f2ca122c8c0..2e4c0ff4c94aba56a918f7f6974933484d3c25a8 100644 (file)
@@ -488,7 +488,6 @@ Console.WriteLine("Destroying caret");
                                                case Keys.Enter: {
                                                        document.Split(document.CaretLine, document.CaretTag, document.CaretPosition);
                                                        document.UpdateView(document.CaretLine, 2, 0);
-                                                       //document.RecalculateDocument(CreateGraphics(), document.CaretLine.line_no, document.CaretLine.line_no+1, true);
                                                        document.MoveCaret(CaretDirection.CharForward);
                                                        return;
                                                }
@@ -523,7 +522,18 @@ Console.WriteLine("Destroying caret");
 
                                                                        line = document.GetLine(document.CaretLine.LineNo + 1);
                                                                        document.Combine(document.CaretLine, line);
-                                                                       document.UpdateView(line, 1, 0);
+                                                                       document.UpdateView(document.CaretLine, 2, 0);
+
+                                                                       #if Debug
+                                                                               Line    check_first;
+                                                                               Line    check_second;
+
+                                                                               check_first = document.GetLine(document.CaretLine.LineNo);
+                                                                               check_second = document.GetLine(check_first.line_no + 1);
+
+                                                                               Console.WriteLine("Post-UpdateView: Y of first line: {0}, second line: {1}", check_first.Y, check_second.Y);
+                                                                       #endif
+
                                                                        // Caret doesn't move
                                                                }
                                                        } else {
@@ -624,7 +634,7 @@ Console.WriteLine("Received expose: {0}", pevent.ClipRectangle);
                        Line    line;\r
                        int     pos;\r
 \r
-if (e.Button == MouseButtons.Middle) {\r
+if (e.Button == MouseButtons.Left) {\r
                        document.PositionCaret(e.X, e.Y);\r
                        return;\r
 }\r
@@ -662,11 +672,9 @@ document.AlignCaret();
                }\r
 \r
                private void TextBoxBase_MouseUp(object sender, MouseEventArgs e) {\r
-                       if (e.Button == MouseButtons.Middle) {\r
-                               this.caret_tag = document.FindCursor(e.X, e.Y, out caret_pos);\r
-                               XplatUI.CreateCaret(this.Handle, 2, this.caret_tag.height);\r
-                               XplatUI.SetCaretPos(this.Handle, (int)caret_tag.line.widths[caret_pos], caret_tag.line.Y + caret_tag.line.height - this.caret_tag.height);\r
-                               XplatUI.CaretVisible(this.Handle, true);\r
+                       if (e.Button == MouseButtons.Left) {\r
+                               document.PositionCaret(e.X, e.Y);\r
+                               document.DisplayCaret();\r
                                return;\r
                        }\r
                }\r