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:
@@ -7733,20 +7733,17 @@ bool wxRichTextParagraphLayoutBox::SetObjectPropertiesWithUndo(wxRichTextObject&
|
|||||||
wxRichTextAction* action = NULL;
|
wxRichTextAction* action = NULL;
|
||||||
wxRichTextObject* clone = 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())
|
if (rtc->SuppressingUndo())
|
||||||
obj.SetProperties(properties);
|
objToSet->SetProperties(properties);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
clone = obj.Clone();
|
clone = obj.Clone();
|
||||||
if (objToSet)
|
objToSet->SetProperties(properties);
|
||||||
{
|
|
||||||
// Necessary e.g. if when setting a wxRichTextCell's properties, when obj will be the parent table
|
|
||||||
objToSet->SetProperties(properties);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
obj.SetProperties(properties);
|
|
||||||
}
|
|
||||||
|
|
||||||
// The 'true' parameter in the next line says "Ignore first time"; otherwise the objects are prematurely switched
|
// 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);
|
action = new wxRichTextAction(NULL, _("Change Properties"), wxRICHTEXT_CHANGE_OBJECT, buffer, obj.GetParentContainer(), rtc, true);
|
||||||
|
Reference in New Issue
Block a user