Page up/down behaviour now takes into account margins and scale
GetTextForRange takes composites into account properly HasCharacterAttributes correction git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@77980 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1416,6 +1416,9 @@ wxString wxRichTextCompositeObject::GetTextForRange(const wxRichTextRange& range
|
|||||||
wxRichTextRange childRange = range;
|
wxRichTextRange childRange = range;
|
||||||
if (!child->GetRange().IsOutside(range))
|
if (!child->GetRange().IsOutside(range))
|
||||||
{
|
{
|
||||||
|
if (child->IsTopLevel())
|
||||||
|
childRange = child->GetOwnRange();
|
||||||
|
else
|
||||||
childRange.LimitTo(child->GetRange());
|
childRange.LimitTo(child->GetRange());
|
||||||
|
|
||||||
wxString childText = child->GetTextForRange(childRange);
|
wxString childText = child->GetTextForRange(childRange);
|
||||||
@@ -3111,6 +3114,9 @@ wxString wxRichTextParagraphLayoutBox::GetTextForRange(const wxRichTextRange& ra
|
|||||||
if (!child->GetRange().IsOutside(range))
|
if (!child->GetRange().IsOutside(range))
|
||||||
{
|
{
|
||||||
wxRichTextRange childRange = range;
|
wxRichTextRange childRange = range;
|
||||||
|
if (child->IsTopLevel())
|
||||||
|
childRange = child->GetOwnRange();
|
||||||
|
else
|
||||||
childRange.LimitTo(child->GetRange());
|
childRange.LimitTo(child->GetRange());
|
||||||
|
|
||||||
wxString childText = child->GetTextForRange(childRange);
|
wxString childText = child->GetTextForRange(childRange);
|
||||||
@@ -3641,6 +3647,7 @@ bool wxRichTextParagraphLayoutBox::HasCharacterAttributes(const wxRichTextRange&
|
|||||||
{
|
{
|
||||||
foundCount ++;
|
foundCount ++;
|
||||||
wxRichTextAttr textAttr = para->GetCombinedAttributes(child->GetAttributes());
|
wxRichTextAttr textAttr = para->GetCombinedAttributes(child->GetAttributes());
|
||||||
|
textAttr.SetFlags(textAttr.GetFlags() & ~wxTEXT_ATTR_PARAGRAPH);
|
||||||
|
|
||||||
if (textAttr.EqPartial(style, false /* strong test - attributes must be valid in both objects */))
|
if (textAttr.EqPartial(style, false /* strong test - attributes must be valid in both objects */))
|
||||||
matchingCount ++;
|
matchingCount ++;
|
||||||
|
@@ -2416,7 +2416,10 @@ bool wxRichTextCtrl::PageDown(int noPages, int flags)
|
|||||||
if (line)
|
if (line)
|
||||||
{
|
{
|
||||||
wxSize clientSize = GetClientSize();
|
wxSize clientSize = GetClientSize();
|
||||||
int newY = line->GetAbsolutePosition().y + noPages*clientSize.y;
|
int topMargin = GetBuffer().GetTopMargin();
|
||||||
|
int bottomMargin = GetBuffer().GetBottomMargin();
|
||||||
|
int height = int( 0.5 + ((clientSize.y - topMargin - bottomMargin) / GetScale()));
|
||||||
|
int newY = line->GetAbsolutePosition().y + noPages*height;
|
||||||
|
|
||||||
wxRichTextLine* newLine = GetFocusObject()->GetLineAtYPosition(newY);
|
wxRichTextLine* newLine = GetFocusObject()->GetLineAtYPosition(newY);
|
||||||
if (newLine)
|
if (newLine)
|
||||||
@@ -3951,7 +3954,9 @@ wxRichTextLine* wxRichTextCtrl::GetVisibleLineForCaretPosition(long caretPositio
|
|||||||
if (caretPosition == lineRange.GetStart()-1 &&
|
if (caretPosition == lineRange.GetStart()-1 &&
|
||||||
(para->GetRange().GetStart() != lineRange.GetStart()))
|
(para->GetRange().GetStart() != lineRange.GetStart()))
|
||||||
{
|
{
|
||||||
if (!m_caretAtLineStart)
|
// Only test for caret start/end position if we're looking at the current caret position,
|
||||||
|
// otherwise m_caretAtLineStart is meaningless
|
||||||
|
if (!m_caretAtLineStart && (caretPosition == m_caretPosition))
|
||||||
line = GetFocusObject()->GetLineAtPosition(caretPosition-1, true);
|
line = GetFocusObject()->GetLineAtPosition(caretPosition-1, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user