DrawKit
Vector and illustration framework for Mac OS X
Instance Methods | List of all members
DKUndoManager Class Reference

This subclass of NSUndoManager can coalesce consecutive tasks that it receives so that only one task is recorded to undo a series of otherwise identical ones. More...

Inheritance diagram for DKUndoManager:
Inheritance graph
[legend]

Instance Methods

(BOOL- enableUndoTaskCoalescing:
 
- Instance Methods inherited from GCUndoManager
(void) - _processEndOfEventNotification:
 
(BOOL- automaticallyDiscardsEmptyGroups
 
(void) - beginUndoGrouping
 
(BOOL- canRedo
 
(BOOL- canUndo
 
(NSUInteger- changeCount
 
(void) - checkpoint
 
(void) - clearRedoStack
 
(GCUndoTaskCoalescingKind) - coalescingKind
 
(void) - conditionallyBeginUndoGrouping
 
(GCUndoGroup *) - currentGroup
 
(void) - disableUndoRegistration
 
(void) - disableUndoTaskCoalescing
 
(void) - enableUndoRegistration
 
(void) - enableUndoTaskCoalescing
 
(void) - endUndoGrouping
 
(void) - explodeTopUndoAction
 
(void) - forwardInvocation:
 
(NSUInteger- groupingLevel
 
(BOOL- groupsByEvent
 
(BOOL- isRedoing
 
(BOOL- isUndoing
 
(BOOL- isUndoRegistrationEnabled
 
(BOOL- isUndoTaskCoalescingEnabled
 
(NSUInteger- levelsOfUndo
 
(NSUInteger- numberOfRedoActions
 
(NSUInteger- numberOfUndoActions
 
(GCUndoGroup *) - peekRedo
 
(GCUndoGroup *) - peekUndo
 
(GCUndoGroup *) - popRedo
 
(void) - popRedoAndPerformTasks
 
(GCUndoGroup *) - popUndo
 
(void) - popUndoAndPerformTasks
 
(id- prepareWithInvocationTarget:
 
(void) - pushGroupOntoRedoStack:
 
(void) - pushGroupOntoUndoStack:
 
(void) - redo
 
(NSString *) - redoActionName
 
(NSString *) - redoMenuItemTitle
 
(NSString *) - redoMenuTitleForUndoActionName:
 
(NSArray *) - redoStack
 
(void) - registerUndoWithTarget:selector:object:
 
(void) - removeAllActions
 
(void) - removeAllActionsWithTarget:
 
(void) - reset
 
(void) - resetChangeCount
 
(BOOL- retainsTargets
 
(NSArray *) - runLoopModes
 
(void) - setActionName:
 
(void) - setAutomaticallyDiscardsEmptyGroups:
 
(void) - setCoalescingKind:
 
(void) - setGroupsByEvent:
 
(void) - setLevelsOfUndo:
 
(void) - setNextTarget:
 
(void) - setRetainsTargets:
 
(void) - setRunLoopModes:
 
(void) - setUndoManagerState:
 
(BOOL- submitUndoTask:
 
(void) - undo
 
(NSString *) - undoActionName
 
(GCUndoManagerState) - undoManagerState
 
(NSString *) - undoMenuItemTitle
 
(NSString *) - undoMenuTitleForUndoActionName:
 
(void) - undoNestedGroup
 
(NSArray *) - undoStack
 
- Instance Methods inherited from NSObject
(NSString *) - address
 
(DKStyleRegistry *) - applicationWillReturnStyleRegistry
 
(BOOL- canBeUsedWithSelectionTool
 
(id- categoryManager:shouldReplaceObject:withObject:
 
(Class- classForCoder
 
(NSColor *) - colorValue
 
(NSColor *) - colourValue
 
(id- copy
 
(void) - dealloc
 
(id- deepCopy
 
(NSDictionary *) - dimensionValuesForArrowStroke:
 
(CGFloat- drawing:convertDistanceToExternalCoordinates:
 
(NSPoint) - drawing:convertLocationToExternalCoordinates:
 
(void) - drawing:didDrawRect:inView:
 
(void) - drawing:willDrawRect:inView:
 
(NSString *) - drawing:willReturnAbbreviationForUnit:
 
(NSString *) - drawing:willReturnFormattedCoordinateForDistance:
 
(CGFloat- drawingWillReturnUnitToPointsConversonFactor:
 
(void) - finalize
 
(NSString *) - hexString
 
(void) - hotspot:didEndTrackingWithEvent:inView:
 
(void) - hotspot:isTrackingWithEvent:inView:
 
(void) - hotspot:willBeginTrackingWithEvent:inView:
 
(NSData *) - imageData
 
(NSImage *) - imageResourceNamed:
 
(id- init
 
(id- initWithExpression:
 
(id- instantiateObjectWithShortName:parameters:
 
(BOOL- isLiteralValue
 
(void) - layoutManager:willPlaceGlyphAtIndex:atLocation:pathAngle:yOffset:
 
(void) - menuItem:wasAddedForObject:inCategory:
 
(BOOL- moveObjectTo:position:slope:userInfo:
 
(id- mutableCopy
 
(void) - oneShotComplete
 
(void) - oneShotHasReached:
 
(void) - oneShotWillBegin
 
(void) - path:elementIndex:type:points:subPathIndex:subPathClosed:contextInfo:
 
(id- placeLinkFromPoint:toPoint:onPath:linkNumber:userInfo:
 
(id- placeObjectAtPoint:onPath:position:slope:userInfo:
 
(NSPoint) - point
 
(NSPoint) - pointForTextLayout
 
(DKStyle *) - registry:shouldReplaceStyle:withStyle:
 
(NSBezierPath *) - renderer:willRenderPath:
 
(void) - routeFinder:progressHasReached:
 
(void) - setValue:forNumericParameter:
 
(NSString *) - stringValue
 
(CGFloat- taperFactorAtDistance:onPath:ofLength:
 
(void) - toolDidPerformUndoableAction:
 
(void) - toolWillPerformUndoableAction:
 
(NSURL *) - url
 
- Instance Methods inherited from <NSObject>
(NSString *) - description
 
(NSUInteger- hash
 
(BOOL- isEqual:
 
- Instance Methods inherited from <NSKeyValueBindingCreation>
(void) - bind:toObject:withKeyPath:options:
 
(NSArray *) - exposedBindings
 
(NSDictionary *) - infoForBinding:
 
(NSArray *) - optionDescriptionsForBinding:
 
(void) - unbind:
 
(Class- valueClassForBinding:
 

Additional Inherited Members

- Class Methods inherited from NSObject
(id+ alloc
 
(Class+ class
 
(void) + initialize
 
(void) + load
 
(id+ new
 
- Class Methods inherited from <NSKeyValueBindingCreation>
(void) + exposeBinding:
 

Detailed Description

This subclass of NSUndoManager can coalesce consecutive tasks that it receives so that only one task is recorded to undo a series of otherwise identical ones.

This is very useful when interactively editing objects where a large stream of identical tasks can be received. It is largely safe to use with coalescing enabled even for normal undo situations, so coalescing is enabled by default.

It also records a change count which is an easy way to check if the state of the undo stack has changed from some earlier time - just compare the change count with one you recorded earlier.

          NOTE - THIS DOES NOT WORK - DO NOT ENABLE GROUP DEFERRAL!! ***************

Group deferral is another useful thing that works around an NSUndoManager bug. When beginUndoGrouping is called, the group is not actually opened at that point - instead it is flagged as deferred. If an actual task is received, the group is opened if the defer flag is set. This ensures that a group is only created when there is something to put in it - NSUndoManager creates a bogus Undo item on the stack for empty groups. This allows client code to simply open a group on mouse down, do stuff in dragged, and close the group at mouse up without creating bogus stack states.

Method Documentation

- (BOOL) enableUndoTaskCoalescing: (BOOL enable