PTUndoRedoManager

@interface PTUndoRedoManager : NSObject

The PTUndoRedoManager class is responsible for managing the undo/redo chain of a PTPDFViewCtrl and the NSUndoManager of its toolManager.

  • Initializes a new PTUndoRedoManager instance with the given tool manager.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithToolManager:
        (nonnull PTToolManager *)toolManager;

    Swift

    init(toolManager: PTToolManager)

    Parameters

    toolManager

    the tool manager

    Return Value

    an initialized PTUndoRedoManager instance

  • The PTToolManager associated with the undo-redo manager.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) PTToolManager *toolManager;

    Swift

    weak var toolManager: PTToolManager? { get }
  • Whether the undo-redo manager is enabled and updates the undo/redo state. The value of this property is derived from the PTPDFViewCtrl.isUndoRedoEnabled property of its tool manager’s pdfViewCtrl.

    Declaration

    Objective-C

    @property (readonly, getter=isEnabled, assign, nonatomic) BOOL enabled;

    Swift

    var isEnabled: Bool { get }
  • Undo the last action.

    Declaration

    Objective-C

    - (void)undo;

    Swift

    func undo()
  • Redo the last undo.

    Declaration

    Objective-C

    - (void)redo;

    Swift

    func redo()
  • Creates a new state at the top of the undo/redo chain by taking a snapshot.

    Declaration

    Objective-C

    - (void)takeUndoSnapshot:(nonnull NSString *)actionInfo;

    Swift

    func takeUndoSnapshot(_ actionInfo: String)

    Parameters

    actionInfo

    meta-data to be attached to this new state.

  • Used to notify the undo-redo manager that an annotation has been added.

    Declaration

    Objective-C

    - (void)annotationAdded:(nonnull PTAnnot *)annotation
               onPageNumber:(int)pageNumber;

    Swift

    func annotationAdded(_ annotation: PTAnnot, onPageNumber pageNumber: Int32)

    Parameters

    annotation

    The annotation that was added.

    pageNumber

    The page number of the PDF that the annotation was added to.

  • Used to notify the undo-redo manager that an annotation has been modified

    Declaration

    Objective-C

    - (void)annotationModified:(nonnull PTAnnot *)annotation
                  onPageNumber:(int)pageNumber;

    Swift

    func annotationModified(_ annotation: PTAnnot, onPageNumber pageNumber: Int32)

    Parameters

    annotation

    The annotation that was modified.

    pageNumber

    The page number of the PDF that the annotation was modified on.

  • Used to notify the undo-redo manager that an annotation has been removed.

    Declaration

    Objective-C

    - (void)annotationRemoved:(nonnull PTAnnot *)annotation
                 onPageNumber:(int)pageNumber;

    Swift

    func annotationRemoved(_ annotation: PTAnnot, onPageNumber pageNumber: Int32)

    Parameters

    annotation

    The annotation that was removed.

    pageNumber

    The page number of the PDF that the annotation was removed from.

  • Used to notify the undo-redo manager that the data of a form field has been modified.

    Declaration

    Objective-C

    - (void)formFieldDataModified:(nonnull PTAnnot *)annotation
                     onPageNumber:(int)pageNumber;

    Swift

    func formFieldDataModified(_ annotation: PTAnnot, onPageNumber pageNumber: Int32)

    Parameters

    annotation

    The form field annotation that has modified data.

    pageNumber

    The page number of the PDF that the form field annotation is on.

  • Used to notify the undo-redo manager manager that a page has been added.

    Declaration

    Objective-C

    - (void)pageAddedAtPageNumber:(int)pageNumber;

    Swift

    func pageAdded(atPageNumber pageNumber: Int32)

    Parameters

    pageNumber

    The page number of the page that was added.

  • Used to notify the undo-redo manager manager that a page has been moved. *

    • - parameter: oldPageNumber The old page number of the page.
    • - parameter: newPageNumber The new page number of the page.

    Declaration

    Objective-C

    - (void)pageMovedFromPageNumber:(int)oldPageNumber
                       toPageNumber:(int)newPageNumber;

    Swift

    func pageMoved(fromPageNumber oldPageNumber: Int32, toPageNumber newPageNumber: Int32)
  • Used to notify the undo-redo manager that a page has been removed.

    Declaration

    Objective-C

    - (void)pageRemovedForPageNumber:(int)pageNumber;

    Swift

    func pageRemoved(forPageNumber pageNumber: Int32)

    Parameters

    pageNumber

    The page number of the page that was removed.