Made column and row spans members so they don't interfere with app-defined properties.
Added identifier to wxRichTextObject so objects can be addressed by name. Generalised wxRICHTEXT_CHANGE_OBJECT command so it can now apply to a paragraph as well as an object within a paragraph. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75124 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -531,6 +531,7 @@ void wxRichTextObject::Copy(const wxRichTextObject& obj)
|
||||
m_properties = obj.m_properties;
|
||||
m_descent = obj.m_descent;
|
||||
m_show = obj.m_show;
|
||||
m_id = obj.m_id;
|
||||
}
|
||||
|
||||
// Get/set the top-level container of this object.
|
||||
@@ -9389,6 +9390,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxRichTextCell, wxRichTextBox)
|
||||
wxRichTextCell::wxRichTextCell(wxRichTextObject* parent):
|
||||
wxRichTextBox(parent)
|
||||
{
|
||||
m_colSpan = 1;
|
||||
m_rowSpan = 1;
|
||||
}
|
||||
|
||||
/// Draw the item
|
||||
@@ -9561,6 +9564,23 @@ bool wxRichTextCell::AdjustAttributes(wxRichTextAttr& attr, wxRichTextDrawingCon
|
||||
void wxRichTextCell::Copy(const wxRichTextCell& obj)
|
||||
{
|
||||
wxRichTextBox::Copy(obj);
|
||||
|
||||
m_colSpan = obj.m_colSpan;
|
||||
m_rowSpan = obj.m_rowSpan;
|
||||
}
|
||||
|
||||
void wxRichTextCell::SetColSpan(int span)
|
||||
{
|
||||
wxASSERT(span >= 1);
|
||||
if (span >= 1)
|
||||
m_colSpan = span;
|
||||
}
|
||||
|
||||
void wxRichTextCell::SetRowSpan(int span)
|
||||
{
|
||||
wxASSERT(span >= 1);
|
||||
if (span >= 1)
|
||||
m_rowSpan = span;
|
||||
}
|
||||
|
||||
// Edit properties via a GUI
|
||||
@@ -9643,29 +9663,6 @@ bool wxRichTextCell::EditProperties(wxWindow* parent, wxRichTextBuffer* buffer)
|
||||
return false;
|
||||
}
|
||||
|
||||
// The next 2 methods return span values. Note that the default is 1, not 0
|
||||
int wxRichTextCell::GetColSpan() const
|
||||
{
|
||||
int span = 1;
|
||||
if (GetProperties().HasProperty(wxT("colspan")))
|
||||
{
|
||||
span = GetProperties().GetPropertyLong(wxT("colspan"));
|
||||
}
|
||||
|
||||
return span;
|
||||
}
|
||||
|
||||
int wxRichTextCell::GetRowSpan() const
|
||||
{
|
||||
int span = 1;
|
||||
if (GetProperties().HasProperty(wxT("rowspan")))
|
||||
{
|
||||
span = GetProperties().GetPropertyLong(wxT("rowspan"));
|
||||
}
|
||||
|
||||
return span;
|
||||
}
|
||||
|
||||
WX_DEFINE_OBJARRAY(wxRichTextObjectPtrArrayArray)
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxRichTextTable, wxRichTextBox)
|
||||
@@ -11574,21 +11571,29 @@ bool wxRichTextAction::Do()
|
||||
// The plan is to swap the current object with the stored, previous-state, clone
|
||||
// We can't get 'node' from the containing buffer (as it doesn't directly store objects)
|
||||
// so use the parent paragraph
|
||||
wxRichTextParagraph* para = wxDynamicCast(obj->GetParent(), wxRichTextParagraph);
|
||||
wxCHECK_MSG(para, false, "Invalid parent paragraph");
|
||||
wxRichTextCompositeObject* parent = wxDynamicCast(obj->GetParent(), wxRichTextCompositeObject);
|
||||
wxCHECK_MSG(parent, false, wxT("Invalid parent"));
|
||||
|
||||
// The stored object, m_object, may have a stale parent paragraph. This would cause
|
||||
// a crash during layout, so use obj's parent para, which should be the correct one.
|
||||
// Check that at least one is a paragraph, but not both.
|
||||
wxCHECK_MSG((!obj->IsKindOf(CLASSINFO(wxRichTextParagraph)) && parent->IsKindOf(CLASSINFO(wxRichTextParagraph))) ||
|
||||
(obj->IsKindOf(CLASSINFO(wxRichTextParagraph)) && !parent->IsKindOf(CLASSINFO(wxRichTextParagraph)))
|
||||
, false, wxT("Either the object or the parent must be a paragraph"));
|
||||
|
||||
// The stored object, m_object, may have a stale parent. This would cause
|
||||
// a crash during layout, so use obj's parent, which should be the correct one.
|
||||
// (An alternative would be to return the parent too from m_objectAddress.GetObject(),
|
||||
// or to set obj's parent there before returning)
|
||||
m_object->SetParent(para);
|
||||
|
||||
wxRichTextObjectList::compatibility_iterator node = para->GetChildren().Find(obj);
|
||||
if (node)
|
||||
m_object->SetParent(parent);
|
||||
if (parent)
|
||||
{
|
||||
wxRichTextObject* obj = node->GetData();
|
||||
node->SetData(m_object);
|
||||
m_object = obj;
|
||||
wxRichTextObjectList::compatibility_iterator node = parent->GetChildren().Find(obj);
|
||||
if (node)
|
||||
{
|
||||
wxRichTextObject* obj = node->GetData();
|
||||
node->SetData(m_object);
|
||||
m_object = obj;
|
||||
m_object->SetParent(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user