How to detect that an UNDO has happened?
I have a .BRX plugin and got some problems with UNDO. When I load a drawing the dwgInFields is called and I load my data. After that I have to update my database with stuff I have loaded and that's okay. If I create an object and delete it and after that press UNDO, first dwgInFields is loaded and after that ::erased is called.
That works fine. The old data is loaded during dwgInFields and when ::erased is called I can see that it's an UNDO and update my database again with the stuff I load in.
A problem is when I deal with stuff that only updates data and don't create an erasable object. For example I have a dialog and when I exist it, dwgOutFields is called so the file is updated with whatever I did in that menu.
If I now press UNDO (ctrl+z) dwgInFields is called but that only loads my data but I can't update my database since I have no idea that new data is loaded. For objects it's easy. ::erased(const AcDbObject* pObj, Adesk::Boolean pErased) is called and pErased is false so I know it was an UNDO operation and I can restore my database.
But how should I solve it when nothing has been deleted? Is there a way to detect that an UNDO has happened?
That works fine. The old data is loaded during dwgInFields and when ::erased is called I can see that it's an UNDO and update my database again with the stuff I load in.
A problem is when I deal with stuff that only updates data and don't create an erasable object. For example I have a dialog and when I exist it, dwgOutFields is called so the file is updated with whatever I did in that menu.
If I now press UNDO (ctrl+z) dwgInFields is called but that only loads my data but I can't update my database since I have no idea that new data is loaded. For objects it's easy. ::erased(const AcDbObject* pObj, Adesk::Boolean pErased) is called and pErased is false so I know it was an UNDO operation and I can restore my database.
But how should I solve it when nothing has been deleted? Is there a way to detect that an UNDO has happened?
0
Comments
-
maybe override AcDbObject::modifyUndone or AcDbObjectReactor::modifyUndone? Also, maybe you can check the AcDb::FilerType (kUndoFiler) in dwgInFields
0