]> git.saurik.com Git - wxWidgets.git/commitdiff
Moved default margins to buffer class Init; reduced chance of accidental selection...
authorJulian Smart <julian@anthemion.co.uk>
Tue, 8 May 2012 17:31:06 +0000 (17:31 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Tue, 8 May 2012 17:31:06 +0000 (17:31 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71378 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/richtext/richtextbuffer.cpp
src/richtext/richtextctrl.cpp

index 1a679f671128f5a93856f8ee59ecfda015d39be7..c4086d5dce1db065182c8d543fa04d546209e8d4 100644 (file)
@@ -1657,7 +1657,6 @@ void wxRichTextParagraphLayoutBox::Init()
 
     m_invalidRange = wxRICHTEXT_ALL;
 
-    SetMargins(4);
     m_partialParagraph = false;
     m_floatCollector = NULL;
 }
@@ -6851,6 +6850,7 @@ void wxRichTextBuffer::Init()
     m_suppressUndo = 0;
     m_handlerFlags = 0;
     m_scale = 1.0;
+    SetMargins(4);
 }
 
 /// Initialisation
index 624863542592ab078daf2edbf36c15e92f47ae17..7468172126a8ece82323600037e154e0f7e0409b 100644 (file)
@@ -741,12 +741,17 @@ void wxRichTextCtrl::OnLeftUp(wxMouseEvent& event)
 void wxRichTextCtrl::OnMoveMouse(wxMouseEvent& event)
 {
 #if wxUSE_DRAG_AND_DROP
-    // See if we're starting Drag'n'Drop
-    if (m_preDrag)
+    size_t distance = 0;
+    if (m_preDrag || m_dragging)
     {
         int x = m_dragStartPoint.x - event.GetPosition().x;
         int y = m_dragStartPoint.y - event.GetPosition().y;
-        size_t distance = abs(x) + abs(y);
+        distance = abs(x) + abs(y);
+    }
+
+    // See if we're starting Drag'n'Drop
+    if (m_preDrag)
+    {
 #if wxUSE_DATETIME
         wxTimeSpan diff = wxDateTime::UNow() - m_dragStartTime;
 #endif
@@ -853,6 +858,7 @@ void wxRichTextCtrl::OnMoveMouse(wxMouseEvent& event)
 #if wxUSE_DRAG_AND_DROP
         && !m_preDrag
 #endif
+        && (distance > 4)
         )
     {
         wxRichTextParagraphLayoutBox* commonAncestor = NULL;
@@ -930,9 +936,9 @@ void wxRichTextCtrl::OnMoveMouse(wxMouseEvent& event)
 #if wxUSE_DRAG_AND_DROP
         && !m_preDrag
 #endif
+        && (distance > 4)
         )
     {
-        // TODO: test closeness
         SetCaretPositionAfterClick(container, position, hit, true /* extend selection */);
     }
 }