From: Julian Smart Date: Tue, 1 Oct 2013 16:33:24 +0000 (+0000) Subject: Further refine of #15226: wxRichTextCtrl: Implement setting properties with undo... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4b263e5ef358411a345dee9ffef3ba69c19be40e?ds=sidebyside 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 --- diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 33f257e6e4..be804ef4d0 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -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);