Changeset 392

Show
Ignore:
Timestamp:
04/14/07 18:05:18 (1 year ago)
Author:
mronge2
Message:

Working with tracks and layers works through TimelineController. TimelineController makes sure that the view and the model is kept in sync

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/LaserLine_2.0/Src/MainController.h

    r389 r392  
    88@interface MainController : NSObject { 
    99        IBOutlet LZSplitView *splitViewBottom; 
    10         IBOutlet LZSplitView *splitViewTop; 
    1110        IBOutlet LZControlView *controlView; 
    1211        IBOutlet LZRenderedFrameView *renderView; 
    13          
    1412        IBOutlet TimelineController *timelineController; 
    15          
    16         LZLayer *layer; 
    1713        OutputController *output; 
    1814} 
  • trunk/LaserLine_2.0/Src/MainController.m

    r390 r392  
    1818#import "LZDisplayDevice.h" 
    1919 
     20#import "TimelineController.h" 
    2021 
    2122@implementation MainController 
     
    2324        self = [super init]; 
    2425        if(self) { 
    25                 LZTimeline *timeline = [timelineController timeline]; 
    26                 layer = [[LZLayer alloc] init]; 
    27  
    28                 [timeline addTrack:[LZTrack track]]; 
    29                 [[[timeline tracks] objectAtIndex:0] addLayer:layer]; 
    30                  
    31                 output = [[OutputController alloc] init]; 
    32                 [output setupDeviceWithTrack:layer frequency:1/24.]; 
    3326        } 
    3427        return self; 
     
    3831{ 
    3932        [splitViewBottom setDelegate:self]; 
    40         [splitViewTop setDelegate:self]; 
    4133        [splitViewBottom setThickness:1.0]; 
    4234        [splitViewBottom setColor:[NSColor blackColor]]; 
    43         [splitViewTop setThickness:1.0]; 
    44         [splitViewTop setColor:[NSColor blackColor]]; 
    4535         
    4636        //[self addBeamEffect:self]; 
     
    5040        //[self addSpirograph:self]; 
    5141         
     42         
     43        LZTrack *track = [timelineController addTrack]; 
     44        LZLayer *layer = [timelineController addLayerToTrack:track]; 
     45        output = [[OutputController alloc] init]; 
     46        [output setupDeviceWithTrack:layer frequency:1/24.]; 
    5247        [[output frameNotificationCenter] addObserver:[[[LZDisplayDevice alloc] initWithView:renderView] autorelease]]; 
    5348} 
     
    133128  } 
    134129 
    135 - (void)addSequence:(LZSequenceableElement *)sequenceElement withLength:(NSTimeInterval)time 
    136   { 
    137   if([layer count] > 0) 
    138         [layer removeElement:[layer elementAtIndex:0]]; 
    139    
    140   [layer appendElement:sequenceElement withLength:time]; 
    141   } 
     130- (void)addSequence:(LZSequenceableElement *)sequenceElement withLength:(NSTimeInterval)time { 
     131        //TODO Clean this up so it doesn't need to be at index 0, should be able to put where ever user wants 
     132        LZTrack *track = [[timelineController tracks] objectAtIndex:0]; 
     133        LZLayer *layer = [[timelineController layersInTrack:track] objectAtIndex:0]; 
     134        if([layer count] > 0) 
     135                [layer removeElement:[layer elementAtIndex:0]]; 
     136        [layer appendElement:sequenceElement withLength:time]; 
     137
    142138 
    143139@end 
  • trunk/LaserLine_2.0/Src/Sequencing/LZLayer.h

    r381 r392  
    1818  } 
    1919 
     20+ (id)layer; 
    2021- (id)init; 
    2122- (id)initWithDuration:(NSTimeInterval)duration; 
  • trunk/LaserLine_2.0/Src/Sequencing/LZLayer.m

    r376 r392  
    4444 
    4545@implementation LZLayer 
     46+ (id)layer { 
     47        LZLayer *layer = [[[LZLayer alloc] init] autorelease]; 
     48        return layer; 
     49} 
    4650 
    4751- (id)init 
  • trunk/LaserLine_2.0/Src/TimelineController.h

    r390 r392  
    22#import <Timeline/Timeline.h> 
    33 
    4 @class LZTimeline
     4@class LZTimeline,  LZTrack, LZLayer
    55 
    66@interface TimelineController : NSObject { 
     
    99} 
    1010- (LZTimeline *)timeline; 
     11- (LZTrack *)addTrack; 
     12- (NSArray *)tracks; 
     13- (LZLayer *)addLayerToTrack:(LZTrack *)track; 
     14- (NSArray *)layersInTrack:(LZTrack *)track; 
    1115@end 
  • trunk/LaserLine_2.0/Src/TimelineController.m

    r389 r392  
    11#import "TimelineController.h" 
     2 
    23#import "LZTimeline.h" 
     4#import "LZTrack.h" 
     5#import "LZLayer.h" 
    36 
    47@implementation TimelineController 
     
    1417        return timeline; 
    1518} 
     19 
     20- (LZTrack *)addTrack { 
     21        LZTrack *track = [LZTrack track]; 
     22        [timeline addTrack:track]; 
     23        TLTrack *viewTrack = [timelineView addTrackWithDelegate:self withName:@"Test"]; 
     24        [viewTrack setModel:track]; 
     25        return track; 
     26} 
     27 
     28- (NSArray *)tracks { 
     29        return [timeline tracks]; 
     30} 
     31 
     32//TODO Add a layer type to TLView (Timeline) 
     33- (LZLayer *)addLayerToTrack:(LZTrack *)track { 
     34        LZLayer *layer = [LZLayer layer]; 
     35        [track addLayer:layer]; 
     36        return layer; 
     37} 
     38 
     39- (NSArray *)layersInTrack:(LZTrack *)track { 
     40        return [track layers]; 
     41} 
    1642@end 
  • trunk/UI_Elements/CocoaTimeline/src/TimeLine/TLTrack.h

    r283 r392  
    3737        NSMutableArray          *playlist; 
    3838        TLClip                          *playingClip; 
     39         
     40        //Place to store model info 
     41        id model; 
    3942} 
    4043 
     
    8285- (void)setName:(NSString*)aName; 
    8386- (NSString *)name; 
     87- (id)model; 
     88- (void)setModel:(id)aValue; 
    8489 
    8590@end 
  • trunk/UI_Elements/CocoaTimeline/src/TimeLine/TLTrack.m

    r335 r392  
    371371} 
    372372 
     373- (id)model 
     374{ 
     375        return model; 
     376} 
     377 
     378- (void)setModel:(id)aValue 
     379{ 
     380        id oldModel = model; 
     381        model = [aValue retain]; 
     382        [oldModel release]; 
     383} 
     384 
    373385@end