How to Create an Undo transation in Illustrator C++ plug-in?
Hi,
I'm trying to determine how to create an undo transaction in an Illustrator C++ plug-in so that clicking Edit > Undo in the menu undoes the operation. The undo transaction is created automatically if the functionality is called from a menu item created by the plug-in or from a tool created by the plug-in as long as the edits are performed in one of the mouse event handlers or the EditTool event handler; however, outside of these two scenarios, an undo transaction is created. I tried to create an undo group by pushing an AIAppContext as shown below but it didn't work.
AIAppContextHandle appContextHandle;
err = sAIAppContext->PushAppContext(message->d.self, &appContextHandle);
sAIAppContext->SetAppContextKind(kAIAppContextUndoRedoKind);
AIBoolean prevState;
sAIAppContext->AllowAllChanges(1, &prevState);
<perform edits>
sAIAppContext->PopAppContext(appContextHandle);Can you please shed some insight on this?
Thanks,
Martin
