Further refine of #15226: wxRichTextCtrl: Implement setting properties with undo for objects e.g. wxRichTextTable (dghart)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74910 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2013-10-01 16:33:24 +00:00
parent c9c6a86918
commit 4b263e5ef3

View File

@@ -7733,20 +7733,17 @@ bool wxRichTextParagraphLayoutBox::SetObjectPropertiesWithUndo(wxRichTextObject&
wxRichTextAction* action = NULL;
wxRichTextObject* clone = NULL;
// The object on which to set properties will usually be 'obj', but use objToSet if it's valid.
// This is necessary e.g. on setting a wxRichTextCell's properties, when obj will be the parent table
if (objToSet == NULL)
objToSet = &obj;
if (rtc->SuppressingUndo())
obj.SetProperties(properties);
objToSet->SetProperties(properties);
else
{
clone = obj.Clone();
if (objToSet)
{
// Necessary e.g. if when setting a wxRichTextCell's properties, when obj will be the parent table
objToSet->SetProperties(properties);
}
else
{
obj.SetProperties(properties);
}
objToSet->SetProperties(properties);
// The 'true' parameter in the next line says "Ignore first time"; otherwise the objects are prematurely switched
action = new wxRichTextAction(NULL, _("Change Properties"), wxRICHTEXT_CHANGE_OBJECT, buffer, obj.GetParentContainer(), rtc, true);