Changeset 393

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

Fixed up the TimelineController. Now a clip is added to a track when a generator is chosen

Files:

Legend:

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

    r392 r393  
    4141         
    4242         
    43         LZTrack *track = [timelineController addTrack]; 
    44         LZLayer *layer = [timelineController addLayerToTrack:track]; 
     43        LZTrack *track = [[timelineController addTrack] model]; 
    4544        output = [[OutputController alloc] init]; 
    46         [output setupDeviceWithTrack:layer frequency:1/24.]; 
     45        [output setupDeviceWithTrack:[[track layers] objectAtIndex:0] frequency:1/24.]; 
    4746        [[output frameNotificationCenter] addObserver:[[[LZDisplayDevice alloc] initWithView:renderView] autorelease]]; 
    4847} 
     
    129128 
    130129- (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]; 
     130        // Very ghetto 
     131        TLTrack *viewTrack = [[timelineController tracks] objectAtIndex:0]; 
     132        LZTrack *track = [viewTrack model]; 
     133        LZLayer *layer = [[track layers] objectAtIndex:0]; 
    134134        if([layer count] > 0) 
    135135                [layer removeElement:[layer elementAtIndex:0]]; 
    136        [layer appendElement:sequenceElement withLength:time]; 
     136       [timelineController addSequence:sequenceElement withLength:time toTrack:viewTrack]; 
    137137} 
    138138 
  • trunk/LaserLine_2.0/Src/TimelineController.h

    r392 r393  
    22#import <Timeline/Timeline.h> 
    33 
    4 @class LZTimeline,  LZTrack, LZLayer
     4@class LZSequenceableElement
    55 
    66@interface TimelineController : NSObject { 
    77        IBOutlet TLView *timelineView;   
    8         LZTimeline *timeline; 
    98} 
    10 - (LZTimeline *)timeline; 
    11 - (LZTrack *)addTrack; 
     9- (TLView *)timeline; 
     10- (TLTrack *)addTrack; 
    1211- (NSArray *)tracks; 
    13 - (LZLayer *)addLayerToTrack:(LZTrack *)track; 
    14 - (NSArray *)layersInTrack:(LZTrack *)track; 
     12- (void)addSequence:(LZSequenceableElement *)sequence withLength:(NSTimeInterval)time toTrack:(TLTrack *)track; 
    1513@end 
  • trunk/LaserLine_2.0/Src/TimelineController.m

    r392 r393  
    66 
    77@implementation TimelineController 
    8 - (id)init { 
    9         self = [super init]; 
    10         if(self) { 
    11                 timeline = [[LZTimeline alloc] init]; 
    12         } 
    13         return self; 
     8- (void)awakeFromNib { 
     9        [timelineView setModel:[[[LZTimeline alloc] init] autorelease]]; 
    1410} 
    1511 
    16 - (LZTimeline *)timeline { 
    17         return timeline
     12- (TLView *)timeline { 
     13        return timelineView
    1814} 
    1915 
    20 - (LZTrack *)addTrack { 
     16- (TLTrack *)addTrack { 
    2117        LZTrack *track = [LZTrack track]; 
    22         [timeline addTrack:track]; 
     18        [[timelineView model] addTrack:track]; 
     19        [track addLayer:[LZLayer layer]]; //So we always have a layer 
    2320        TLTrack *viewTrack = [timelineView addTrackWithDelegate:self withName:@"Test"]; 
    2421        [viewTrack setModel:track]; 
    25         return track; 
     22        return viewTrack; 
    2623} 
    2724 
    2825- (NSArray *)tracks { 
    29         return [timeline tracks]; 
     26        return [timelineView allTracks]; 
    3027} 
    3128 
    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; 
     29- (void)addSequence:(LZSequenceableElement *)sequence withLength:(NSTimeInterval)time toTrack:(TLTrack *)track { 
     30        LZLayer *layer = [[[track model] layers] objectAtIndex:0]; 
     31        [layer appendElement:sequence withLength:time]; 
     32         
     33        //TODO make a NSTimeInterval to TLTime utility function 
     34        TLTime newTime; 
     35        newTime.length = time; 
     36        newTime.position = 0; 
     37        newTime.start = 0; 
     38        newTime.end = newTime.length;    
     39        [track addClipWithTime:newTime image:nil title:@"" identifier:nil]; 
    3740} 
    3841 
    39 - (NSArray *)layersInTrack:(LZTrack *)track { 
    40         return [track layers]; 
     42/* Delegates */ 
     43 
     44- (void)clipDidStartPlaying:(TLClip *)aClip inTrack:(TLTrack *)aTrack atTimeInClip:(float)timeInClip atTimeInTrack:(float)timeInTrack { 
     45
     46 
     47- (void)clipDidStopPlaying:(TLClip *)aClip inTrack:(TLTrack *)aTrack atTimeInClip:(float)timeInClip atTimeInTrack:(float)timeInTrack { 
     48
     49 
     50- (void)userMovedPositionToClip:(TLClip *)aClip inTrack:(TLTrack *)aTrack atTimeInClip:(float)timeInClip atTimeInTrack:(float)timeInTrack { 
     51
     52 
     53- (void)userAddedClip:(TLClip *)aClip inTrack:(TLTrack *)aTrack atTimeInTrack:(float)timeInTrack { 
     54
     55 
     56- (void)userMovedClip:(TLClip *)aClip inTrack:(TLTrack *)aTrack atTimeInTrack:(float)timeInTrack { 
     57
     58 
     59- (void)userResizedClip:(TLClip *)aClip inTrack:(TLTrack *)aTrack { 
     60
     61 
     62- (BOOL)shouldClipMove:(TLClip *)aClip inTrack:(TLTrack *)aTrack by:(float)length { 
     63        return YES; 
     64
     65 
     66- (BOOL)shouldClipResizeFromBeg:(TLClip *)aClip inTrack:(TLTrack *)aTrack by:(float)length { 
     67        return YES; 
     68
     69 
     70- (BOOL)shouldClipResizeFromEnd:(TLClip *)aClip inTrack:(TLTrack *)aTrack by:(float)length { 
     71        return YES; 
     72
     73 
     74- (void)didAddTrack:(TLTrack *)aTrack { 
    4175} 
    4276@end 
  • trunk/UI_Elements/CocoaTimeline/CocoaTimeline.xcodeproj/project.pbxproj

    r390 r393  
    9999                32CA4F630368D1EE00C91783 /* CocoaTimeline_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocoaTimeline_Prefix.pch; sourceTree = "<group>"; }; 
    100100                8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; }; 
    101                 8D1107320486CEB800E47090 /* CocoaTimeline.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = CocoaTimeline.app; sourceTree = BUILT_PRODUCTS_DIR; }; 
     101                8D1107320486CEB800E47090 /* CocoaTimeline.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CocoaTimeline.app; sourceTree = BUILT_PRODUCTS_DIR; }; 
    102102                C4184E960B910043006DB017 /* TLClip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLClip.h; sourceTree = "<group>"; }; 
    103103                C4184E970B910043006DB017 /* TLClip.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLClip.m; sourceTree = "<group>"; }; 
  • trunk/UI_Elements/CocoaTimeline/src/TimeLine/TLClip.h

    r283 r393  
    3434        id                      identifier; 
    3535        NSString        *uuid; 
     36         
     37        // Model info 
     38        id model; 
    3639} 
    3740 
     
    6366- (NSString*)title; 
    6467- (id)identifier; 
     68- (id)model; 
     69- (void)setModel:(id)aValue; 
    6570 
    6671@end 
  • trunk/UI_Elements/CocoaTimeline/src/TimeLine/TLClip.m

    r298 r393  
    367367} 
    368368 
     369- (id)model 
     370{ 
     371        return model; 
     372} 
     373 
     374- (void)setModel:(id)aValue 
     375{ 
     376        id oldModel = model; 
     377        model = [aValue retain]; 
     378        [oldModel release]; 
     379} 
    369380@end 
  • trunk/UI_Elements/CocoaTimeline/src/TimeLine/TLView.h

    r283 r393  
    2929        NSMutableArray *tracks; 
    3030        TLTrack                 *selectedTrack; 
     31         
     32        //Model 
     33        id model; 
    3134         
    3235        //AHHHH 
     
    6972- (TLSlider *)getTimeSlider; 
    7073- (float)framesPerSecond; 
     74- (id)model; 
     75- (void)setModel:(id)aValue; 
    7176 
    7277@end 
  • trunk/UI_Elements/CocoaTimeline/src/TimeLine/TLView.m

    r283 r393  
    399399} 
    400400 
     401- (id)model 
     402{ 
     403        return model; 
     404} 
     405 
     406- (void)setModel:(id)aValue 
     407{ 
     408        id oldModel = model; 
     409        model = [aValue retain]; 
     410        [oldModel release]; 
     411} 
    401412@end