Only draw if inside client rectangle
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35950 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -58,9 +58,9 @@
|
|||||||
#include "bitmaps/indentless.xpm"
|
#include "bitmaps/indentless.xpm"
|
||||||
#include "bitmaps/indentmore.xpm"
|
#include "bitmaps/indentmore.xpm"
|
||||||
|
|
||||||
#include "richtextctrl.h"
|
#include "wx/richtext/richtextctrl.h"
|
||||||
#include "richtextstyles.h"
|
#include "wx/richtext/richtextstyles.h"
|
||||||
#include "richtextxml.h"
|
#include "wx/richtext/richtextxml.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// resources
|
// resources
|
||||||
@@ -696,7 +696,7 @@ bool MyFrame::ProcessEvent(wxEvent& event)
|
|||||||
return wxFrame::ProcessEvent(event);
|
return wxFrame::ProcessEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnOpen(wxCommandEvent& event)
|
void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxString filter = wxRichTextBuffer::GetExtWildcard(false, false);
|
wxString filter = wxRichTextBuffer::GetExtWildcard(false, false);
|
||||||
if (!filter.IsEmpty())
|
if (!filter.IsEmpty())
|
||||||
@@ -734,7 +734,7 @@ void MyFrame::OnSave(wxCommandEvent& event)
|
|||||||
m_richTextCtrl->SaveFile();
|
m_richTextCtrl->SaveFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnSaveAs(wxCommandEvent& event)
|
void MyFrame::OnSaveAs(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxString filter = wxRichTextBuffer::GetExtWildcard(false, true);
|
wxString filter = wxRichTextBuffer::GetExtWildcard(false, true);
|
||||||
wxString path = wxEmptyString;
|
wxString path = wxEmptyString;
|
||||||
@@ -758,17 +758,17 @@ void MyFrame::OnSaveAs(wxCommandEvent& event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnBold(wxCommandEvent& event)
|
void MyFrame::OnBold(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
m_richTextCtrl->ApplyBoldToSelection();
|
m_richTextCtrl->ApplyBoldToSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnItalic(wxCommandEvent& event)
|
void MyFrame::OnItalic(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
m_richTextCtrl->ApplyItalicToSelection();
|
m_richTextCtrl->ApplyItalicToSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnUnderline(wxCommandEvent& event)
|
void MyFrame::OnUnderline(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
m_richTextCtrl->ApplyUnderlineToSelection();
|
m_richTextCtrl->ApplyUnderlineToSelection();
|
||||||
}
|
}
|
||||||
@@ -789,17 +789,17 @@ void MyFrame::OnUpdateUnderline(wxUpdateUIEvent& event)
|
|||||||
event.Check(m_richTextCtrl->IsSelectionUnderlined());
|
event.Check(m_richTextCtrl->IsSelectionUnderlined());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnAlignLeft(wxCommandEvent& event)
|
void MyFrame::OnAlignLeft(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
m_richTextCtrl->ApplyAlignmentToSelection(wxTEXT_ALIGNMENT_LEFT);
|
m_richTextCtrl->ApplyAlignmentToSelection(wxTEXT_ALIGNMENT_LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnAlignCentre(wxCommandEvent& event)
|
void MyFrame::OnAlignCentre(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
m_richTextCtrl->ApplyAlignmentToSelection(wxTEXT_ALIGNMENT_CENTRE);
|
m_richTextCtrl->ApplyAlignmentToSelection(wxTEXT_ALIGNMENT_CENTRE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnAlignRight(wxCommandEvent& event)
|
void MyFrame::OnAlignRight(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
m_richTextCtrl->ApplyAlignmentToSelection(wxTEXT_ALIGNMENT_RIGHT);
|
m_richTextCtrl->ApplyAlignmentToSelection(wxTEXT_ALIGNMENT_RIGHT);
|
||||||
}
|
}
|
||||||
@@ -819,7 +819,7 @@ void MyFrame::OnUpdateAlignRight(wxUpdateUIEvent& event)
|
|||||||
event.Check(m_richTextCtrl->IsSelectionAligned(wxTEXT_ALIGNMENT_RIGHT));
|
event.Check(m_richTextCtrl->IsSelectionAligned(wxTEXT_ALIGNMENT_RIGHT));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnFont(wxCommandEvent& event)
|
void MyFrame::OnFont(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
if (!m_richTextCtrl->HasSelection())
|
if (!m_richTextCtrl->HasSelection())
|
||||||
return;
|
return;
|
||||||
@@ -846,7 +846,7 @@ void MyFrame::OnFont(wxCommandEvent& event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnIndentMore(wxCommandEvent& event)
|
void MyFrame::OnIndentMore(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxTextAttrEx attr;
|
wxTextAttrEx attr;
|
||||||
attr.SetFlags(wxTEXT_ATTR_LEFT_INDENT);
|
attr.SetFlags(wxTEXT_ATTR_LEFT_INDENT);
|
||||||
@@ -865,7 +865,7 @@ void MyFrame::OnIndentMore(wxCommandEvent& event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnIndentLess(wxCommandEvent& event)
|
void MyFrame::OnIndentLess(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxTextAttrEx attr;
|
wxTextAttrEx attr;
|
||||||
attr.SetFlags(wxTEXT_ATTR_LEFT_INDENT);
|
attr.SetFlags(wxTEXT_ATTR_LEFT_INDENT);
|
||||||
@@ -886,7 +886,7 @@ void MyFrame::OnIndentLess(wxCommandEvent& event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnLineSpacingHalf(wxCommandEvent& event)
|
void MyFrame::OnLineSpacingHalf(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxTextAttrEx attr;
|
wxTextAttrEx attr;
|
||||||
attr.SetFlags(wxTEXT_ATTR_LINE_SPACING);
|
attr.SetFlags(wxTEXT_ATTR_LINE_SPACING);
|
||||||
@@ -905,7 +905,7 @@ void MyFrame::OnLineSpacingHalf(wxCommandEvent& event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnLineSpacingDouble(wxCommandEvent& event)
|
void MyFrame::OnLineSpacingDouble(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxTextAttrEx attr;
|
wxTextAttrEx attr;
|
||||||
attr.SetFlags(wxTEXT_ATTR_LINE_SPACING);
|
attr.SetFlags(wxTEXT_ATTR_LINE_SPACING);
|
||||||
@@ -924,7 +924,7 @@ void MyFrame::OnLineSpacingDouble(wxCommandEvent& event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnLineSpacingSingle(wxCommandEvent& event)
|
void MyFrame::OnLineSpacingSingle(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxTextAttrEx attr;
|
wxTextAttrEx attr;
|
||||||
attr.SetFlags(wxTEXT_ATTR_LINE_SPACING);
|
attr.SetFlags(wxTEXT_ATTR_LINE_SPACING);
|
||||||
@@ -943,7 +943,7 @@ void MyFrame::OnLineSpacingSingle(wxCommandEvent& event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnParagraphSpacingMore(wxCommandEvent& event)
|
void MyFrame::OnParagraphSpacingMore(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxTextAttrEx attr;
|
wxTextAttrEx attr;
|
||||||
attr.SetFlags(wxTEXT_ATTR_PARA_SPACING_AFTER);
|
attr.SetFlags(wxTEXT_ATTR_PARA_SPACING_AFTER);
|
||||||
@@ -962,7 +962,7 @@ void MyFrame::OnParagraphSpacingMore(wxCommandEvent& event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnParagraphSpacingLess(wxCommandEvent& event)
|
void MyFrame::OnParagraphSpacingLess(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxTextAttrEx attr;
|
wxTextAttrEx attr;
|
||||||
attr.SetFlags(wxTEXT_ATTR_PARA_SPACING_AFTER);
|
attr.SetFlags(wxTEXT_ATTR_PARA_SPACING_AFTER);
|
||||||
@@ -984,7 +984,7 @@ void MyFrame::OnParagraphSpacingLess(wxCommandEvent& event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnViewHTML(wxCommandEvent& event)
|
void MyFrame::OnViewHTML(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxDialog dialog(this, wxID_ANY, _("HTML"), wxDefaultPosition, wxSize(500, 400), wxDEFAULT_DIALOG_STYLE);
|
wxDialog dialog(this, wxID_ANY, _("HTML"), wxDefaultPosition, wxSize(500, 400), wxDEFAULT_DIALOG_STYLE);
|
||||||
|
|
||||||
|
@@ -487,7 +487,7 @@ void wxRichTextParagraphLayoutBox::Init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Draw the item
|
/// Draw the item
|
||||||
bool wxRichTextParagraphLayoutBox::Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextRange& selectionRange, const wxRect& WXUNUSED(rect), int descent, int style)
|
bool wxRichTextParagraphLayoutBox::Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextRange& selectionRange, const wxRect& rect, int descent, int style)
|
||||||
{
|
{
|
||||||
wxRichTextObjectList::compatibility_iterator node = m_children.GetFirst();
|
wxRichTextObjectList::compatibility_iterator node = m_children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -498,8 +498,13 @@ bool wxRichTextParagraphLayoutBox::Draw(wxDC& dc, const wxRichTextRange& range,
|
|||||||
if (child && !child->GetRange().IsOutside(range))
|
if (child && !child->GetRange().IsOutside(range))
|
||||||
{
|
{
|
||||||
wxRect childRect(child->GetPosition(), child->GetCachedSize());
|
wxRect childRect(child->GetPosition(), child->GetCachedSize());
|
||||||
|
|
||||||
child->Draw(dc, child->GetRange(), selectionRange, childRect, descent, style);
|
if (childRect.GetTop() > rect.GetBottom() || childRect.GetBottom() < rect.GetTop())
|
||||||
|
{
|
||||||
|
// Skip
|
||||||
|
}
|
||||||
|
else
|
||||||
|
child->Draw(dc, child->GetRange(), selectionRange, childRect, descent, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
|
@@ -231,7 +231,7 @@ void wxRichTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
wxRegion dirtyRegion = GetUpdateRegion();
|
wxRegion dirtyRegion = GetUpdateRegion();
|
||||||
|
|
||||||
wxRect availableSpace(wxPoint(0, 0), GetClientSize());
|
wxRect availableSpace(GetLogicalPoint(wxPoint(0, 0)), GetClientSize());
|
||||||
if (GetBuffer().GetDirty())
|
if (GetBuffer().GetDirty())
|
||||||
{
|
{
|
||||||
GetBuffer().Layout(dc, availableSpace, wxRICHTEXT_FIXED_WIDTH|wxRICHTEXT_VARIABLE_HEIGHT);
|
GetBuffer().Layout(dc, availableSpace, wxRICHTEXT_FIXED_WIDTH|wxRICHTEXT_VARIABLE_HEIGHT);
|
||||||
|
Reference in New Issue
Block a user