Undoing Automation Operations
(Document and Medical Imaging toolkits)
The LEADTOOLS C DLL features include an Undo/Redo engine for undoing annotation automation operations. The undo depth determines the number of operations that can be undone. There is only one undo depth value per root container. Subcontainers do not have their own separate values.
LEADTOOLS provides a number of functions for handling the undo capabilities.
To determine the current undo level of the automation handle, call L_AnnGetUndoDepth. To set a new undo depth for the automation handle, call L_AnnSetUndoDepth.
L_AnnUndo undoes the last automation operation performed.
Generally, operations are undone one operation at a time. If the last operation performed cut several objects from a container, undoing that operation would return the objects to the container. Occasionally, it may be best to group several operations, such as object additions or property changes, together so that calling L_AnnUndo undoes the whole group of operations and not just the last operation performed. This can be accomplished by:
1. |
Call L_AnnSetUndoDepth to set the number of undo actions that can take place. |
2. |
Call L_AnnAddUndoNode to add an undo node to the automation object. |
3. |
Disable the undo feature by calling L_AnnSetAutoUndoEnable (FALSE). |
4. |
Perform the operations to be combined into one undo. |
5. |
Re-enable the undo feature by calling L_AnnSetAutoUndoEnable (TRUE). |
Now, all three operations can be undone with one call to L_AnnUndo instead of three calls to L_AnnUndo.