//
//  GSUndoManager.h
//  Glyphs
//
//  Created by Georg Seifert on 19.06.09.
//  Copyright 2009 schriftgestaltung.de. All rights reserved.
//

@protocol GSUndoClientProtocol

- (void)updateChangeCount:(NSDocumentChangeType)changeType;

- (nullable NSDocument *)document;

- (void)stopUpdates;

- (void)startUpdates;

@property BOOL editable;

@property BOOL locked;

@property BOOL justLocked;

@property (nonatomic, strong, nullable) NSDate *lastChange;

// needed for control cached interpolation stuff. lastChange is reset on undo so it can’t cover this.
@property (atomic) NSTimeInterval lastOperationInterval;

@end

@interface GSUndoManager : NSUndoManager
@property (atomic, unsafe_unretained, nullable) NSObject<GSUndoClientProtocol> *glyph;
@property (nonatomic) BOOL isRegisteringUndo;

#if DEBUG
@property (nonatomic) NSInteger debug_shouldNotTouchUndo;
#endif
@end

#if DEBUG
@interface GSUndoManager (debug)

@property NSInteger debug_shouldNotTouchUndo;

@property NSInteger debug_shouldNotTouchUndo_store;

- (void)decreaseDebug_shouldNotTouchUndo:(nonnull NSString *)context;

- (void)increaseDebug_shouldNotTouchUndo:(nonnull NSString *)context;

@end
#endif
