Fixed bug [ 1870906 ] There are few problems selection text by mouse in RichTextCt
Fixed bug [ 1870265 ] window does not scroll after pasting text Fixed bug [ 1870264 ] wxTextUrlEvent after click in empty space Fixed bug [ 1806479 ] wxRichText URL issues (URL event triggered when clicking on blank space) Fixed bug [ 1806953 ] wxRichTextControl::AddParagraph() is broken Fixed a bug in SelectWord causing bad selections. Added Ctrl+Backspace word deletion. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@52109 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -308,7 +308,8 @@ int wxRichTextCompositeObject::HitTest(wxDC& dc, const wxPoint& pt, long& textPo
|
|||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
return wxRICHTEXT_HITTEST_NONE;
|
textPosition = GetRange().GetEnd()-1;
|
||||||
|
return wxRICHTEXT_HITTEST_AFTER|wxRICHTEXT_HITTEST_OUTSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Finds the absolute position and row height for the given character position
|
/// Finds the absolute position and row height for the given character position
|
||||||
@@ -3822,7 +3823,7 @@ int wxRichTextParagraph::HitTest(wxDC& dc, const wxPoint& pt, long& textPosition
|
|||||||
wxSize lineSize = line->GetSize();
|
wxSize lineSize = line->GetSize();
|
||||||
wxRichTextRange lineRange = line->GetAbsoluteRange();
|
wxRichTextRange lineRange = line->GetAbsoluteRange();
|
||||||
|
|
||||||
if (pt.y >= linePos.y && pt.y <= linePos.y + lineSize.y)
|
if (pt.y <= linePos.y + lineSize.y)
|
||||||
{
|
{
|
||||||
if (pt.x < linePos.x)
|
if (pt.x < linePos.x)
|
||||||
{
|
{
|
||||||
@@ -5783,6 +5784,8 @@ bool wxRichTextBuffer::PasteFromClipboard(long position)
|
|||||||
if (richTextBuffer)
|
if (richTextBuffer)
|
||||||
{
|
{
|
||||||
InsertParagraphsWithUndo(position+1, *richTextBuffer, GetRichTextCtrl(), wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE);
|
InsertParagraphsWithUndo(position+1, *richTextBuffer, GetRichTextCtrl(), wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE);
|
||||||
|
if (GetRichTextCtrl())
|
||||||
|
GetRichTextCtrl()->ShowPosition(position + richTextBuffer->GetRange().GetEnd());
|
||||||
delete richTextBuffer;
|
delete richTextBuffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5806,6 +5809,9 @@ bool wxRichTextBuffer::PasteFromClipboard(long position)
|
|||||||
#endif
|
#endif
|
||||||
InsertTextWithUndo(position+1, text2, GetRichTextCtrl());
|
InsertTextWithUndo(position+1, text2, GetRichTextCtrl());
|
||||||
|
|
||||||
|
if (GetRichTextCtrl())
|
||||||
|
GetRichTextCtrl()->ShowPosition(position + text2.Length());
|
||||||
|
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
else if (wxTheClipboard->IsSupported(wxDF_BITMAP))
|
else if (wxTheClipboard->IsSupported(wxDF_BITMAP))
|
||||||
|
@@ -416,7 +416,7 @@ void wxRichTextCtrl::OnLeftUp(wxMouseEvent& event)
|
|||||||
wxPoint logicalPt = event.GetLogicalPosition(dc);
|
wxPoint logicalPt = event.GetLogicalPosition(dc);
|
||||||
int hit = GetBuffer().HitTest(dc, logicalPt, position);
|
int hit = GetBuffer().HitTest(dc, logicalPt, position);
|
||||||
|
|
||||||
if (hit != wxRICHTEXT_HITTEST_NONE)
|
if ((hit != wxRICHTEXT_HITTEST_NONE) && !(hit & wxRICHTEXT_HITTEST_OUTSIDE))
|
||||||
{
|
{
|
||||||
wxTextAttrEx attr;
|
wxTextAttrEx attr;
|
||||||
if (GetStyle(position, attr))
|
if (GetStyle(position, attr))
|
||||||
@@ -663,6 +663,18 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
// Submit range in character positions, which are greater than caret positions,
|
// Submit range in character positions, which are greater than caret positions,
|
||||||
if (m_caretPosition < GetBuffer().GetRange().GetEnd()+1 && !HasSelection())
|
if (m_caretPosition < GetBuffer().GetRange().GetEnd()+1 && !HasSelection())
|
||||||
{
|
{
|
||||||
|
bool processed = false;
|
||||||
|
if (event.CmdDown())
|
||||||
|
{
|
||||||
|
long pos = wxRichTextCtrl::FindNextWordPosition(-1);
|
||||||
|
if (pos != -1 && (pos < m_caretPosition))
|
||||||
|
{
|
||||||
|
GetBuffer().DeleteRangeWithUndo(wxRichTextRange(pos+1, m_caretPosition), this);
|
||||||
|
processed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!processed)
|
||||||
GetBuffer().DeleteRangeWithUndo(wxRichTextRange(m_caretPosition+1, m_caretPosition+1), this);
|
GetBuffer().DeleteRangeWithUndo(wxRichTextRange(m_caretPosition+1, m_caretPosition+1), this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1901,13 +1913,17 @@ bool wxRichTextCtrl::DoSaveFile(const wxString& filename, int fileType)
|
|||||||
/// Add a new paragraph of text to the end of the buffer
|
/// Add a new paragraph of text to the end of the buffer
|
||||||
wxRichTextRange wxRichTextCtrl::AddParagraph(const wxString& text)
|
wxRichTextRange wxRichTextCtrl::AddParagraph(const wxString& text)
|
||||||
{
|
{
|
||||||
return GetBuffer().AddParagraph(text);
|
wxRichTextRange range = GetBuffer().AddParagraph(text);
|
||||||
|
LayoutContent();
|
||||||
|
return range;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add an image
|
/// Add an image
|
||||||
wxRichTextRange wxRichTextCtrl::AddImage(const wxImage& image)
|
wxRichTextRange wxRichTextCtrl::AddImage(const wxImage& image)
|
||||||
{
|
{
|
||||||
return GetBuffer().AddImage(image);
|
wxRichTextRange range = GetBuffer().AddImage(image);
|
||||||
|
LayoutContent();
|
||||||
|
return range;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -1943,6 +1959,9 @@ bool wxRichTextCtrl::SelectWord(long position)
|
|||||||
if (!para)
|
if (!para)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (position == para->GetRange().GetEnd())
|
||||||
|
position --;
|
||||||
|
|
||||||
long positionStart = position;
|
long positionStart = position;
|
||||||
long positionEnd = position;
|
long positionEnd = position;
|
||||||
|
|
||||||
@@ -1970,6 +1989,9 @@ bool wxRichTextCtrl::SelectWord(long position)
|
|||||||
if (positionEnd >= para->GetRange().GetEnd())
|
if (positionEnd >= para->GetRange().GetEnd())
|
||||||
positionEnd = para->GetRange().GetEnd();
|
positionEnd = para->GetRange().GetEnd();
|
||||||
|
|
||||||
|
if (positionEnd < positionStart)
|
||||||
|
return false;
|
||||||
|
|
||||||
SetSelection(positionStart, positionEnd+1);
|
SetSelection(positionStart, positionEnd+1);
|
||||||
|
|
||||||
if (positionStart >= 0)
|
if (positionStart >= 0)
|
||||||
|
Reference in New Issue
Block a user