//
//  LCObjectsTimelineManager.h
//  LogoistCore
//
//  Created by Mendel Kucharzeck on 05.08.12.
//  Copyright (c) 2012 AvisNocturna Software. All rights reserved.
//

@protocol LCObjectsTimelineManagerDelegateProtocol;
@class LCObjectsContainer;
@class LCObjectsTimelineProperty;
@class LCObjectsTimelinePropertyChange;

@interface LCObjectsTimelineManager : NSObject
{
    float currentTime;
    BOOL isCurrentlyChangingTime;
    
    NSMutableArray *delegates;
    LCObjectsContainer *objectsContainer;
    
    NSMutableArray *properties;
    float changeSelectionThreshold;
    
    BOOL automaticallyAddNewPropertiesForChangedObjects;
    
    //Play
    NSTimer *playTimer;
    NSDate *lastPlayTimerFireDate;
    float playStopTime;
}

@property (assign) float currentTime;
- (void) reapplyChangesForCurrentTimeAndCallDelegates:(BOOL)callDelegates;  //Call this when any of the properties changed, for example a changes time
@property (readonly) BOOL isCurrentlyChangingTime;

@property (assign) LCObjectsContainer *objectsContainer;

- (void) addDelegate:(id <LCObjectsTimelineManagerDelegateProtocol>)d;
- (void) removeDelegate:(id <LCObjectsTimelineManagerDelegateProtocol>)d;

- (void) callDelegatesForChangedProperties:(NSArray*)properties;
- (void) callDelegatesForChangedPropertyChanges:(NSArray*)changes;
- (void) callDelegatesForChangedTimeOfPropertyChanges:(NSArray*)changes;

@property (assign) float changeSelectionThreshold;

@property (readonly) float earliestPropertyChangeTime;
@property (readonly) float latestPropertyChangeTime;

@end
