Moved default margins to buffer class Init; reduced chance of accidental selection when clicking

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71378 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2012-05-08 17:31:06 +00:00
parent 20d09da5f8
commit f819ed5d42
2 changed files with 11 additions and 5 deletions

View File

@@ -1657,7 +1657,6 @@ void wxRichTextParagraphLayoutBox::Init()
m_invalidRange = wxRICHTEXT_ALL; m_invalidRange = wxRICHTEXT_ALL;
SetMargins(4);
m_partialParagraph = false; m_partialParagraph = false;
m_floatCollector = NULL; m_floatCollector = NULL;
} }
@@ -6851,6 +6850,7 @@ void wxRichTextBuffer::Init()
m_suppressUndo = 0; m_suppressUndo = 0;
m_handlerFlags = 0; m_handlerFlags = 0;
m_scale = 1.0; m_scale = 1.0;
SetMargins(4);
} }
/// Initialisation /// Initialisation

View File

@@ -741,12 +741,17 @@ void wxRichTextCtrl::OnLeftUp(wxMouseEvent& event)
void wxRichTextCtrl::OnMoveMouse(wxMouseEvent& event) void wxRichTextCtrl::OnMoveMouse(wxMouseEvent& event)
{ {
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
// See if we're starting Drag'n'Drop size_t distance = 0;
if (m_preDrag) if (m_preDrag || m_dragging)
{ {
int x = m_dragStartPoint.x - event.GetPosition().x; int x = m_dragStartPoint.x - event.GetPosition().x;
int y = m_dragStartPoint.y - event.GetPosition().y; 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 #if wxUSE_DATETIME
wxTimeSpan diff = wxDateTime::UNow() - m_dragStartTime; wxTimeSpan diff = wxDateTime::UNow() - m_dragStartTime;
#endif #endif
@@ -853,6 +858,7 @@ void wxRichTextCtrl::OnMoveMouse(wxMouseEvent& event)
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
&& !m_preDrag && !m_preDrag
#endif #endif
&& (distance > 4)
) )
{ {
wxRichTextParagraphLayoutBox* commonAncestor = NULL; wxRichTextParagraphLayoutBox* commonAncestor = NULL;
@@ -930,9 +936,9 @@ void wxRichTextCtrl::OnMoveMouse(wxMouseEvent& event)
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
&& !m_preDrag && !m_preDrag
#endif #endif
&& (distance > 4)
) )
{ {
// TODO: test closeness
SetCaretPositionAfterClick(container, position, hit, true /* extend selection */); SetCaretPositionAfterClick(container, position, hit, true /* extend selection */);
} }
} }