Corrections to HasCharacterAttributes, HasParagraphAttributes
EditProperties functions don't try to change read-only content Page up/down behaviour now takes into account margins and scale Transparency and y poition corrections to field labels git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77981 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1537,6 +1537,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);
|
||||||
@@ -3277,6 +3280,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);
|
||||||
@@ -3807,6 +3813,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 ++;
|
||||||
@@ -3850,6 +3857,12 @@ bool wxRichTextParagraphLayoutBox::HasParagraphAttributes(const wxRichTextRange&
|
|||||||
// Apply the paragraph style
|
// Apply the paragraph style
|
||||||
wxRichTextApplyStyle(textAttr, para->GetAttributes());
|
wxRichTextApplyStyle(textAttr, para->GetAttributes());
|
||||||
|
|
||||||
|
// These flags can mess up EqPartial because they don't represent existence of the attributes,
|
||||||
|
// only the attributes.
|
||||||
|
int flags = wxTEXT_ATTR_AVOID_PAGE_BREAK_BEFORE|wxTEXT_ATTR_AVOID_PAGE_BREAK_AFTER|wxTEXT_ATTR_PAGE_BREAK;
|
||||||
|
int theseFlags = (textAttr.GetFlags() & ~flags) | (textAttr.GetFlags() & flags & style.GetFlags());
|
||||||
|
textAttr.SetFlags(theseFlags);
|
||||||
|
|
||||||
foundCount ++;
|
foundCount ++;
|
||||||
if (textAttr.EqPartial(style, false /* strong test */))
|
if (textAttr.EqPartial(style, false /* strong test */))
|
||||||
matchingCount ++;
|
matchingCount ++;
|
||||||
@@ -9201,7 +9214,7 @@ bool wxRichTextBox::EditProperties(wxWindow* parent, wxRichTextBuffer* buffer)
|
|||||||
wxRichTextObjectPropertiesDialog boxDlg(this, wxGetTopLevelParent(parent), wxID_ANY, _("Box Properties"));
|
wxRichTextObjectPropertiesDialog boxDlg(this, wxGetTopLevelParent(parent), wxID_ANY, _("Box Properties"));
|
||||||
boxDlg.SetAttributes(GetAttributes());
|
boxDlg.SetAttributes(GetAttributes());
|
||||||
|
|
||||||
if (boxDlg.ShowModal() == wxID_OK)
|
if (boxDlg.ShowModal() == wxID_OK && buffer->GetRichTextCtrl()->IsEditable())
|
||||||
{
|
{
|
||||||
// By passing wxRICHTEXT_SETSTYLE_RESET, indeterminate attributes set by the user will be set as
|
// By passing wxRICHTEXT_SETSTYLE_RESET, indeterminate attributes set by the user will be set as
|
||||||
// indeterminate in the object.
|
// indeterminate in the object.
|
||||||
@@ -9477,10 +9490,11 @@ bool wxRichTextFieldTypeStandard::Draw(wxRichTextField* obj, wxDC& dc, wxRichTex
|
|||||||
int w, h, maxDescent;
|
int w, h, maxDescent;
|
||||||
dc.SetFont(m_font);
|
dc.SetFont(m_font);
|
||||||
dc.GetTextExtent(m_label, & w, &h, & maxDescent);
|
dc.GetTextExtent(m_label, & w, &h, & maxDescent);
|
||||||
|
dc.SetBackgroundMode(wxTRANSPARENT);
|
||||||
dc.SetTextForeground(textColour);
|
dc.SetTextForeground(textColour);
|
||||||
|
|
||||||
int x = clientArea.x + (clientArea.width - w)/2;
|
int x = clientArea.x + (clientArea.width - w)/2;
|
||||||
int y = clientArea.y + (clientArea.height - (h - maxDescent))/2;
|
int y = clientArea.y + (clientArea.height - h)/2;
|
||||||
dc.DrawText(m_label, x, y);
|
dc.DrawText(m_label, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9794,7 +9808,7 @@ bool wxRichTextCell::EditProperties(wxWindow* parent, wxRichTextBuffer* buffer)
|
|||||||
wxRichTextSizePage::ShowPositionControls(true);
|
wxRichTextSizePage::ShowPositionControls(true);
|
||||||
wxRichTextSizePage::ShowFloatingControls(true);
|
wxRichTextSizePage::ShowFloatingControls(true);
|
||||||
|
|
||||||
if (ok)
|
if (ok && buffer->GetRichTextCtrl()->IsEditable())
|
||||||
{
|
{
|
||||||
wxRichTextAttr newAttr = cellDlg.GetAttributes();
|
wxRichTextAttr newAttr = cellDlg.GetAttributes();
|
||||||
if (!(newAttr == attr))
|
if (!(newAttr == attr))
|
||||||
@@ -12635,7 +12649,7 @@ bool wxRichTextImage::EditProperties(wxWindow* parent, wxRichTextBuffer* buffer)
|
|||||||
wxRichTextObjectPropertiesDialog imageDlg(this, wxGetTopLevelParent(parent), wxID_ANY, _("Picture Properties"));
|
wxRichTextObjectPropertiesDialog imageDlg(this, wxGetTopLevelParent(parent), wxID_ANY, _("Picture Properties"));
|
||||||
imageDlg.SetAttributes(GetAttributes());
|
imageDlg.SetAttributes(GetAttributes());
|
||||||
|
|
||||||
if (imageDlg.ShowModal() == wxID_OK)
|
if (imageDlg.ShowModal() == wxID_OK && buffer->GetRichTextCtrl()->IsEditable())
|
||||||
{
|
{
|
||||||
// By passing wxRICHTEXT_SETSTYLE_RESET, indeterminate attributes set by the user will be set as
|
// By passing wxRICHTEXT_SETSTYLE_RESET, indeterminate attributes set by the user will be set as
|
||||||
// indeterminate in the object.
|
// indeterminate in the object.
|
||||||
|
@@ -2639,7 +2639,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)
|
||||||
|
Reference in New Issue
Block a user