A manipulator can be configured to support undo/redo functionality when it invokes an associated operation that records the actions performed by the manipulator in the undo/redo buffer. This operation can be a custom operation or an existing operation. (See Creating an Operation for details on operation creation.) In the manipulator class Init method, specify a string value for the OPERATION_IDENTIFIER keyword to indicate the name of the operation associated with the manipulator.
OPERATION_IDENTIFIER='SET_PROPERTY'as shown in Creating a Manipulator Init Method. This built-in operation automates undo/redo transactions.
When using the SET_PROPERTY operation, you must also set the PARAMETER_IDENTIFIER keyword during initialization. Set this keyword to the property identifier of the property being manipulated. To determine the identifiers of a visualization's properties, you can retrieve the object's identifier and retrieve the names of all registered properties as described in Retrieving Property Information. The following example uses the itPropertyReport procedure to print all the registered property names and identifiers supported by the object to the Output Log window. The following sample code shows how to retrieve the properties associated with an image.
; Get the tool reference. idtool=ITGETCURRENT(TOOL = oTool) ; Retrieve the parameter identifier for the the image. ; Print the identifier, name and type of each associated ; registered property using the ItPropertyReport procedure. vImage = oTool->FindIdentifiers('*image*', /VISUALIZATION) itPropertyReport, otool, vImage
The initial and final values of the manipulated item must be recorded so that the operation can be undone and redone. Two manipulator object methods allow you to specify when values are initially recorded and committed. The RecordUndoValues and CommitUndoValues methods work in conjunction with the operation defined during manipulator initialization by the OPERATION_IDENTIFIER keyword. The RecordUndoValues and CommitUndoValues methods are inherited by classes that subclass from IDLitManipulator.
The RecordUndoValues method records the initial values of the item being manipulated. This method is typically called in the OnMouseDown or OnKeyboard method of an interactive manipulator. When called, the manipulator retrieves the associated operation and calls the operation's RecordInitialValues method. See Creating a RecordInitialValues Method for more information on this method.
If your manipulator uses the built-in SET_PROPERTY operation, the initial value of the property specified in the PARAMETER_IDENTIFIER is recorded and automatically transacted when you call the RecordUndoValues method. See Implementing an OnMouseDown Method for a short example.
The CommitUndoValues method records final values resulting from the manipulator action. When a transaction is completed, call the CommitUndoValues method to place initial and final values into the undo/redo buffer. This method is typically called in the OnMouseUp method or OnKeyboard method of an interactive manipulator. When called, the manipulator retrieves the associated operation and calls the operation's RecordFinalValues method. See Creating a RecordFinalValues Method for more information on this method.
If your manipulator uses the built-in SET_PROPERTY operation, the final value of the property specified in the PARAMETER_IDENTIFIER is recorded and automatically transacted when you call the CommitUndoValues method. See Implementing an OnMouseUp Method for a short example.