PTUndoRedoManager
@interface PTUndoRedoManager : NSObject <PTOverridable>
The PTUndoRedoManager class is responsible for managing the undo/redo chain of a PTPDFViewCtrl
and an NSUndoManager instance.
-
Initializes a new
PTUndoRedoManagerinstance with the given PDFViewCtrl.Declaration
Objective-C
- (nonnull instancetype)initWithPDFViewCtrl: (nonnull PTPDFViewCtrl *)pdfViewCtrl;Swift
init(pdfViewCtrl: PTPDFViewCtrl)Parameters
pdfViewCtrlthe PDFViewCtrl
Return Value
an initialized
PTUndoRedoManagerinstance -
The
PTPDFViewCtrlassociated with the undo-redo manager.Declaration
Objective-C
@property (nonatomic, strong, readonly) PTPDFViewCtrl *_Nonnull pdfViewCtrl;Swift
var pdfViewCtrl: PTPDFViewCtrl { get } -
Whether the undo-redo manager is enabled and updates the undo/redo state.
When disabled (value is set to
NO), theNSUndoManagerowned by thepdfViewCtrlis cleared of all its actions and no new undo/redo changes will be registered.The default value of this property is
YES.Note
Change-snapshotting will still be performed on the
pdfViewCtrlregardless of this property’s value. Other functionality, such as annotation change processing, relies on the information produced by change-snapshots.Note
The value of this property is also derived from the
PTPDFViewCtrl.isUndoRedoEnabledproperty of this undo-redo manager’spdfViewCtrl.Declaration
Objective-C
@property (nonatomic, getter=isEnabled) BOOL enabled;Swift
var isEnabled: Bool { get set } -
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
actionInfometa-data to be attached to this new state.
-
Registers a generic change with the undo-redo manager.
Declaration
Objective-C
- (void)registerChangeWithActionName:(nullable NSString *)actionName;Swift
func registerChange(withActionName actionName: String?)Parameters
actionNameThe name of the action
-
Undocumented
Declaration
Objective-C
- (instancetype)init NS_UNAVAILABLE;
-
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
annotationThe annotation that was added.
pageNumberThe page number of the PDF that the annotation was added to.
-
Used to notify the undo-redo manager that annotations have been added.
Declaration
Objective-C
- (void)annotationsAdded:(nonnull NSArray<PTAnnot *> *)annotations onPageNumber:(int)pageNumber;Swift
func annotationsAdded(_ annotations: [PTAnnot], onPageNumber pageNumber: Int32)Parameters
annotationsThe annotations that were added.
pageNumberThe page number of the PDF that the annotations were 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
annotationThe annotation that was modified.
pageNumberThe page number of the PDF that the annotation was modified on.
-
Used to notify the undo-redo manager that annotations have been modified
Declaration
Objective-C
- (void)annotationsModified:(nonnull NSArray<PTAnnot *> *)annotations onPageNumber:(int)pageNumber;Swift
func annotationsModified(_ annotations: [PTAnnot], onPageNumber pageNumber: Int32)Parameters
annotationsThe annotations that were modified.
pageNumberThe page number of the PDF that the annotations were 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
annotationThe annotation that was removed.
pageNumberThe page number of the PDF that the annotation was removed from.
-
Used to notify the undo-redo manager that annotations have been removed.
Declaration
Objective-C
- (void)annotationsRemoved:(nonnull NSArray<PTAnnot *> *)annotations onPageNumber:(int)pageNumber;Swift
func annotationsRemoved(_ annotations: [PTAnnot], onPageNumber pageNumber: Int32)Parameters
annotationsThe annotations that were removed.
pageNumberThe page number of the PDF that the annotations were 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
annotationThe form field annotation that has modified data.
pageNumberThe 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
pageNumberThe page number of the page that was added.
-
Used to notify the undo-redo manager manager that a page has been moved.
Declaration
Objective-C
- (void)pageMovedFromPageNumber:(int)oldPageNumber toPageNumber:(int)newPageNumber;Swift
func pageMoved(fromPageNumber oldPageNumber: Int32, toPageNumber newPageNumber: Int32)Parameters
oldPageNumberThe old page number of the page.
newPageNumberThe new page number of the page.
-
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
pageNumberThe page number of the page that was removed.
-
Used to notify the undo-redo manager that a page has been rotated.
Declaration
Objective-C
- (void)pageRotatedForPageNumber:(int)pageNumber;Swift
func pageRotated(forPageNumber pageNumber: Int32)Parameters
pageNumberThe page number of the page that was rotated.
-
Used to notify the undo-redo manager that pages have been rotated.
Declaration
Objective-C
- (void)pagesRotatedForPageNumbers:(nonnull NSIndexSet *)pageNumbers;Swift
func pagesRotated(forPageNumbers pageNumbers: IndexSet)Parameters
pageNumbersThe page numbers of the pages that were rotated.
-
Used to notify the undo-redo manager that a page’s content has changed.
Declaration
Objective-C
- (void)pageContentModifiedOnPageNumber:(int)pageNumber;Swift
func pageContentModified(onPageNumber pageNumber: Int32)Parameters
pageNumberThe page number of the page that had its content changed.
PTUndoRedoManager Class Reference