wxRTC: fixed guidelines overwriting adjacent cell borders; corrected capitalisation in command labels; now sends text update event when an object is changed.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74866 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2013-09-27 13:36:46 +00:00
parent 07aec89fe1
commit f7f8a13c04
3 changed files with 20 additions and 8 deletions

View File

@ -2708,7 +2708,7 @@ public:
Draws the borders and background for the given rectangle and attributes.
@a boxRect is taken to be the outer margin box, not the box around the content.
*/
static bool DrawBoxAttributes(wxDC& dc, wxRichTextBuffer* buffer, const wxRichTextAttr& attr, const wxRect& boxRect, int flags = 0);
static bool DrawBoxAttributes(wxDC& dc, wxRichTextBuffer* buffer, const wxRichTextAttr& attr, const wxRect& boxRect, int flags = 0, wxRichTextObject* obj = NULL);
/**
Draws a border.

View File

@ -2581,7 +2581,7 @@ public:
Draws the borders and background for the given rectangle and attributes.
@a boxRect is taken to be the outer margin box, not the box around the content.
*/
static bool DrawBoxAttributes(wxDC& dc, wxRichTextBuffer* buffer, const wxRichTextAttr& attr, const wxRect& boxRect, int flags = 0);
static bool DrawBoxAttributes(wxDC& dc, wxRichTextBuffer* buffer, const wxRichTextAttr& attr, const wxRect& boxRect, int flags = 0, wxRichTextObject* obj = NULL);
/**
Draws a border.

View File

@ -662,7 +662,7 @@ int wxRichTextObject::ConvertPixelsToTenthsMM(int ppi, int pixels, double scale)
// Draw the borders and background for the given rectangle and attributes.
// Width and height are taken to be the outer margin size, not the content.
bool wxRichTextObject::DrawBoxAttributes(wxDC& dc, wxRichTextBuffer* buffer, const wxRichTextAttr& attr, const wxRect& boxRect, int flags)
bool wxRichTextObject::DrawBoxAttributes(wxDC& dc, wxRichTextBuffer* buffer, const wxRichTextAttr& attr, const wxRect& boxRect, int flags, wxRichTextObject* obj)
{
// Assume boxRect is the area around the content
wxRect marginRect = boxRect;
@ -692,12 +692,24 @@ bool wxRichTextObject::DrawBoxAttributes(wxDC& dc, wxRichTextBuffer* buffer, con
if (flags & wxRICHTEXT_DRAW_GUIDELINES)
{
wxRichTextAttr editBorderAttr = attr;
wxRichTextAttr editBorderAttr;
// TODO: make guideline colour configurable
editBorderAttr.GetTextBoxAttr().GetBorder().SetColour(*wxLIGHT_GREY);
editBorderAttr.GetTextBoxAttr().GetBorder().SetWidth(1, wxTEXT_ATTR_UNITS_PIXELS);
editBorderAttr.GetTextBoxAttr().GetBorder().SetStyle(wxTEXT_BOX_ATTR_BORDER_SOLID);
if (obj)
{
wxRichTextCell* cell = wxDynamicCast(obj, wxRichTextCell);
if (cell)
{
// This ensures that thin lines drawn by adjacent cells (left and above)
// don't get overwritten by the guidelines.
editBorderAttr.GetTextBoxAttr().GetBorder().GetLeft().Reset();
editBorderAttr.GetTextBoxAttr().GetBorder().GetTop().Reset();
}
}
DrawBorder(dc, buffer, editBorderAttr.GetTextBoxAttr().GetBorder(), borderRect, flags);
}
@ -1847,7 +1859,7 @@ bool wxRichTextParagraphLayoutBox::Draw(wxDC& dc, wxRichTextDrawingContext& cont
int theseFlags = flags;
if (!GetParent())
theseFlags &= ~wxRICHTEXT_DRAW_GUIDELINES;
DrawBoxAttributes(dc, GetBuffer(), attr, thisRect, theseFlags);
DrawBoxAttributes(dc, GetBuffer(), attr, thisRect, theseFlags, this);
if (wxRichTextBuffer::GetFloatingLayoutMode())
DrawFloats(dc, context, range, selection, rect, descent, style);
@ -10549,7 +10561,7 @@ bool wxRichTextTable::DeleteRows(int startRow, int noRows)
// Create a clone containing the current state of the table. It will be used to Undo the action
clone = wxStaticCast(this->Clone(), wxRichTextTable);
clone->SetParent(GetParent());
action = new wxRichTextAction(NULL, _("Delete row"), wxRICHTEXT_CHANGE_OBJECT, buffer, this, rtc);
action = new wxRichTextAction(NULL, _("Delete Row"), wxRICHTEXT_CHANGE_OBJECT, buffer, this, rtc);
action->SetObject(this);
action->SetPosition(GetRange().GetStart());
}
@ -10617,7 +10629,7 @@ bool wxRichTextTable::DeleteColumns(int startCol, int noCols)
// Create a clone containing the current state of the table. It will be used to Undo the action
clone = wxStaticCast(this->Clone(), wxRichTextTable);
clone->SetParent(GetParent());
action = new wxRichTextAction(NULL, _("Delete column"), wxRICHTEXT_CHANGE_OBJECT, buffer, this, rtc);
action = new wxRichTextAction(NULL, _("Delete Column"), wxRICHTEXT_CHANGE_OBJECT, buffer, this, rtc);
action->SetObject(this);
action->SetPosition(GetRange().GetStart());
}
@ -11174,7 +11186,7 @@ bool wxRichTextAction::Do()
else
container->InvalidateHierarchy(GetRange());
UpdateAppearance(GetPosition());
UpdateAppearance(GetPosition(), true);
// TODO: send new kind of modification event