• R/O
  • SSH
  • HTTPS

xspfqt: Commit


Commit MetaInfo

Révision37 (tree)
l'heure2008-09-07 11:43:10
Auteurmasaki

Message de Log

Tagging the 1.1 (36) release of XspfQT project.

Change Summary

Modification

--- tags/release-1.1.36/Info.plist (nonexistent)
+++ tags/release-1.1.36/Info.plist (revision 37)
@@ -0,0 +1,51 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+<plist version="1.0">
4+<dict>
5+ <key>CFBundleDevelopmentRegion</key>
6+ <string>English</string>
7+ <key>CFBundleDocumentTypes</key>
8+ <array>
9+ <dict>
10+ <key>CFBundleTypeExtensions</key>
11+ <array>
12+ <string>xspf</string>
13+ </array>
14+ <key>CFBundleTypeIconFile</key>
15+ <string></string>
16+ <key>CFBundleTypeName</key>
17+ <string>DocumentType</string>
18+ <key>CFBundleTypeOSTypes</key>
19+ <array>
20+ <string>????</string>
21+ </array>
22+ <key>CFBundleTypeRole</key>
23+ <string>Viewer</string>
24+ <key>NSDocumentClass</key>
25+ <string>XspfDocument</string>
26+ </dict>
27+ </array>
28+ <key>CFBundleExecutable</key>
29+ <string>${EXECUTABLE_NAME}</string>
30+ <key>CFBundleIconFile</key>
31+ <string></string>
32+ <key>CFBundleIdentifier</key>
33+ <string>com.masakih.XspfQT</string>
34+ <key>CFBundleInfoDictionaryVersion</key>
35+ <string>6.0</string>
36+ <key>CFBundleName</key>
37+ <string>${PRODUCT_NAME}</string>
38+ <key>CFBundlePackageType</key>
39+ <string>APPL</string>
40+ <key>CFBundleShortVersionString</key>
41+ <string>1.1</string>
42+ <key>CFBundleSignature</key>
43+ <string>????</string>
44+ <key>CFBundleVersion</key>
45+ <string>%%%%REVISION%%%%</string>
46+ <key>NSMainNibFile</key>
47+ <string>MainMenu</string>
48+ <key>NSPrincipalClass</key>
49+ <string>NSApplication</string>
50+</dict>
51+</plist>
--- tags/release-1.1.36/XspfPlayListWindowController.h (nonexistent)
+++ tags/release-1.1.36/XspfPlayListWindowController.h (revision 37)
@@ -0,0 +1,21 @@
1+//
2+// XspfPlayListWindowController.h
3+// XspfQT
4+//
5+// Created by Hori,Masaki on 08/08/31.
6+// Copyright 2008 masakih. All rights reserved.
7+//
8+
9+#import <Cocoa/Cocoa.h>
10+
11+@interface XspfPlayListWindowController : NSWindowController
12+{
13+ IBOutlet NSOutlineView *listView;
14+ IBOutlet NSTreeController *trackListTree;
15+}
16+
17+@end
18+
19+
20+@interface XspfThowSpacebarKeyDownOutlineView : NSOutlineView
21+@end
--- tags/release-1.1.36/XspfPlayListWindowController.m (nonexistent)
+++ tags/release-1.1.36/XspfPlayListWindowController.m (revision 37)
@@ -0,0 +1,72 @@
1+//
2+// XspfPlayListWindowController.m
3+// XspfQT
4+//
5+// Created by Hori,Masaki on 08/08/31.
6+// Copyright 2008 masakih. All rights reserved.
7+//
8+
9+#import "XspfPlayListWindowController.h"
10+#import "XspfDocument.h"
11+
12+
13+@implementation XspfPlayListWindowController
14+
15+- (id)init
16+{
17+ return [super initWithWindowNibName:@"XspfPlayList"];
18+}
19+
20+- (void)awakeFromNib
21+{
22+ [listView setDoubleAction:@selector(changeCurrentTrack:)];
23+// [[self window] setReleasedWhenClosed:NO];
24+}
25+
26+- (IBAction)changeCurrentTrack:(id)sender
27+{
28+ id selections = [trackListTree selectedObjects];
29+ if([selections count] == 0) return;
30+
31+ NSIndexPath *selectionIndexPath = [trackListTree selectionIndexPath];
32+// NSLog(@"Selection %@", selectionIndexPath);
33+// NSLog(@"Selection index %d", [selectionIndexPath indexAtPosition:1]);
34+
35+ if([selectionIndexPath length] > 1) {
36+ [[self document] setPlayTrackindex:[selectionIndexPath indexAtPosition:1]];
37+ }
38+}
39+
40+- (void)keyDown:(NSEvent *)theEvent
41+{
42+ if([theEvent isARepeat]) return;
43+
44+ unsigned short code = [theEvent keyCode];
45+ if(code == 49 /* space bar */) {
46+ [[self document] togglePlayAndPause:self];
47+ }
48+}
49+
50+- (BOOL)windowShouldClose:(id)sender
51+{
52+ [sender orderOut:self];
53+
54+ return NO;
55+}
56+
57+@end
58+
59+@implementation XspfThowSpacebarKeyDownOutlineView
60+- (void)keyDown:(NSEvent *)theEvent
61+{
62+ unsigned short code = [theEvent keyCode];
63+ if(code == 49 /* space bar */) {
64+ if(_delegate && [_delegate respondsToSelector:@selector(keyDown:)]) {
65+ [_delegate keyDown:theEvent];
66+ }
67+ }
68+
69+ [super keyDown:theEvent];
70+}
71+
72+@end
--- tags/release-1.1.36/XspfDocument.h (nonexistent)
+++ tags/release-1.1.36/XspfDocument.h (revision 37)
@@ -0,0 +1,32 @@
1+//
2+// MyDocument.h
3+// XspfQT
4+//
5+// Created by Hori,Masaki on 08/08/29.
6+// Copyright masakih 2008 . All rights reserved.
7+//
8+
9+
10+#import <Cocoa/Cocoa.h>
11+#import <QTKit/QTKit.h>
12+
13+@class XspfComponent;
14+@class XspfMovieWindowController;
15+
16+@interface XspfDocument : NSDocument
17+{
18+ XspfComponent* trackList;
19+ XspfMovieWindowController *movieWindowController;
20+ NSWindowController *playListWindowController;
21+}
22+
23+- (IBAction)togglePlayAndPause:(id)sender;
24+- (IBAction)showPlayList:(id)sender;
25+- (IBAction)dump:(id)sender;
26+
27+- (void)setTrackList:(XspfComponent *)newList;
28+- (XspfComponent *)trackList;
29+
30+- (void)setPlayTrackindex:(unsigned)index;
31+
32+@end
--- tags/release-1.1.36/XspfDocument.m (nonexistent)
+++ tags/release-1.1.36/XspfDocument.m (revision 37)
@@ -0,0 +1,183 @@
1+//
2+// MyDocument.m
3+// XspfQT
4+//
5+// Created by Hori,Masaki on 08/08/29.
6+// Copyright masakih 2008 . All rights reserved.
7+//
8+
9+#import "XspfDocument.h"
10+#import "XspfComponent.h"
11+#import "XspfMovieWindowController.h"
12+#import "XspfPlayListWindowController.h"
13+
14+@interface XspfDocument (Private)
15+- (void)setTrackList:(XspfComponent *)newList;
16+- (XspfComponent *)trackList;
17+- (NSXMLDocument *)XMLDocument;
18+- (NSData *)outputData;
19+@end
20+
21+@implementation XspfDocument
22+
23+- (id)init
24+{
25+ self = [super init];
26+ if (self) {
27+
28+ // Add your subclass-specific initialization here.
29+ // If an error occurs here, send a [self release] message and return nil.
30+
31+ }
32+ return self;
33+}
34+
35+- (void)makeWindowControllers
36+{
37+ playListWindowController = [[XspfPlayListWindowController alloc] init];
38+ [self addWindowController:playListWindowController];
39+
40+ movieWindowController = [[XspfMovieWindowController alloc] init];
41+ [self addWindowController:movieWindowController];
42+ [movieWindowController setQtMovie:[[self trackList] qtMovie]];
43+}
44+//- (NSString *)windowNibName
45+//{
46+// // Override returning the nib file name of the document
47+// // If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers, you should remove this method and override -makeWindowControllers instead.
48+// return @"MyDocument";
49+//}
50+
51+- (void)windowControllerDidLoadNib:(NSWindowController *)windowController
52+{
53+ [super windowControllerDidLoadNib:windowController];
54+ // Add any code here that needs to be executed once the windowController has loaded the document's window.
55+// [self setQtMovie:[[self trackList] qtMovie]];
56+}
57+
58+- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError
59+{
60+ // Insert code here to write your document to data of the specified type. If the given outError != NULL, ensure that you set *outError when returning nil.
61+
62+ // You can also choose to override -fileWrapperOfType:error:, -writeToURL:ofType:error:, or -writeToURL:ofType:forSaveOperation:originalContentsURL:error: instead.
63+
64+ // For applications targeted for Panther or earlier systems, you should use the deprecated API -dataRepresentationOfType:. In this case you can also choose to override -fileWrapperRepresentationOfType: or -writeToFile:ofType: instead.
65+
66+ return [self outputData];
67+ //
68+ //
69+ //
70+
71+ if ( outError != NULL ) {
72+ *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL];
73+ }
74+ return nil;
75+}
76+
77+- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError
78+{
79+ // Insert code here to read your document from the given data of the specified type. If the given outError != NULL, ensure that you set *outError when returning NO.
80+
81+ // You can also choose to override -readFromFileWrapper:ofType:error: or -readFromURL:ofType:error: instead.
82+
83+ // For applications targeted for Panther or earlier systems, you should use the deprecated API -loadDataRepresentation:ofType. In this case you can also choose to override -readFromFile:ofType: or -loadFileWrapperRepresentation:ofType: instead.
84+
85+ NSError *error = nil;
86+ NSXMLDocument *d = [[[NSXMLDocument alloc] initWithData:data
87+ options:0
88+ error:&error] autorelease];
89+ NSXMLElement *root = [d rootElement];
90+
91+ NSArray *trackListElems;
92+ trackListElems = [root elementsForName:@"trackList"];
93+ if(!trackListElems || [trackListElems count] < 1) {
94+ if ( outError != NULL ) {
95+ *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL];
96+ }
97+ return NO;
98+ }
99+
100+ id t = [XspfComponent xspfComponemtWithXMLElement:[trackListElems objectAtIndex:0]];
101+ [t setTitle:[[[self fileURL] path] lastPathComponent]];
102+ [self setTrackList:t];
103+// NSLog(@"trackList -> %@", trackList);
104+
105+// [self setQtMovie:[[self trackList] qtMovie]];
106+
107+ return YES;
108+}
109+
110+- (void)dealloc
111+{
112+ [trackList release];
113+ [playListWindowController release];
114+
115+ [super dealloc];
116+}
117+- (NSString *)displayName
118+{
119+ NSString *trackTitle = [[[self trackList] currentTrack] title];
120+ if(trackTitle) {
121+ return [NSString stringWithFormat:@"%@ - %@",
122+ [super displayName], trackTitle];
123+ }
124+
125+ return [super displayName];
126+}
127+- (IBAction)togglePlayAndPause:(id)sender
128+{
129+ [movieWindowController togglePlayAndPause:sender];
130+}
131+- (IBAction)showPlayList:(id)sender
132+{
133+ [playListWindowController showWindow:self];
134+}
135+
136+- (void)setTrackList:(XspfComponent *)newList
137+{
138+ if(trackList == newList) return;
139+
140+ [trackList autorelease];
141+ trackList = [newList retain];
142+}
143+- (XspfComponent *)trackList
144+{
145+ return trackList;
146+}
147+
148+- (void)setPlayTrackindex:(unsigned)index
149+{
150+ [[self trackList] setSelectionIndex:index];
151+}
152+
153+- (NSData *)outputData
154+{
155+ return [[self XMLDocument] XMLDataWithOptions:NSXMLNodePrettyPrint];
156+}
157+- (NSXMLDocument *)XMLDocument;
158+{
159+ id element = [[self trackList] XMLElement];
160+
161+ id root = [NSXMLElement elementWithName:@"playlist"];
162+ [root addChild:element];
163+ [root addAttribute:[NSXMLNode attributeWithName:@"version"
164+ stringValue:@"0"]];
165+ [root addAttribute:[NSXMLNode attributeWithName:@"xmlns"
166+ stringValue:@"http://xspf.org/ns/0/"]];
167+
168+
169+ id d = [[[NSXMLDocument alloc] initWithRootElement:root] autorelease];
170+ [d setVersion:@"1.0"];
171+ [d setCharacterEncoding:@"UTF-8"];
172+
173+ return d;
174+}
175+- (IBAction)dump:(id)sender
176+{
177+ NSString *s = [[[NSString alloc] initWithData:[self outputData]
178+ encoding:NSUTF8StringEncoding] autorelease];
179+
180+ NSLog(@"%@", s);
181+}
182+@end
183+
--- tags/release-1.1.36/XspfComponent.h (nonexistent)
+++ tags/release-1.1.36/XspfComponent.h (revision 37)
@@ -0,0 +1,58 @@
1+//
2+// XspfComponent.h
3+// XspfQT
4+//
5+// Created by Hori,Masaki on 08/08/29.
6+// Copyright 2008 masakih. All rights reserved.
7+//
8+
9+#import <Cocoa/Cocoa.h>
10+#import <QTKit/QTKit.h>
11+
12+@interface XspfComponent : NSObject
13+{
14+ NSString *title;
15+ BOOL isSelected;
16+ NSIndexPath *selectionIndexPath;
17+
18+ XspfComponent *parent; // not retained.
19+}
20+
21++ (id)xspfComponemtWithXMLElement:(NSXMLElement *)element;
22+- (id)initWithXMLElement:(NSXMLElement *)element;
23+
24+- (NSXMLElement *)XMLElement;
25+
26+- (QTMovie *)qtMovie;
27+
28+- (void)setTitle:(NSString *)title;
29+- (NSString *)title;
30+
31+// selection for playing.
32+- (BOOL)isSelected;
33+- (void)select;
34+- (void)deselect;
35+- (void)setSelectionIndex:(unsigned)index;
36+- (BOOL)setSelectionIndexPath:(NSIndexPath *)indexPath;
37+- (NSIndexPath *)selectionIndexPath;
38+
39+- (XspfComponent *)currentTrack; // default self;
40+- (void)next; // abstract.
41+- (void)previous; // abstract.
42+
43+- (void)setIsPlayed:(BOOL)state;
44+- (BOOL)isPlayed;
45+
46+- (XspfComponent *)parent;
47+- (NSArray *)children; // default nil.
48+- (unsigned)childrenCount; // default [[self children] count].
49+- (BOOL)isLeaf; // default YES.
50+
51+- (void)addChild:(XspfComponent *)child; // not implemented.
52+- (void)removeChild:(XspfComponent *)child; // not implemented.
53+- (void)insertChild:(XspfComponent *)child atIndex:(unsigned)index; // not implemented.
54+- (void)removeChildAtIndex:(unsigned)index; //not implemented.
55+- (void)setParent:(XspfComponent *)parent; // Do not call directly. call in only -addChild: method.
56+
57+
58+@end
--- tags/release-1.1.36/XspfTrackList.m (nonexistent)
+++ tags/release-1.1.36/XspfTrackList.m (revision 37)
@@ -0,0 +1,203 @@
1+//
2+// XspfTrackList.m
3+// XspfQT
4+//
5+// Created by Hori,Masaki on 08/08/29.
6+// Copyright 2008 masakih. All rights reserved.
7+//
8+
9+#import "XspfTrackList.h"
10+#import "XspfTrack.h"
11+
12+
13+@implementation XspfTrackList
14+- (id)initWithXMLElement:(NSXMLElement *)element
15+{
16+ self = [super init];
17+
18+ NSArray *elems = [element elementsForName:@"track"];
19+ if(!elems) {
20+ [self release];
21+ return nil;
22+ }
23+
24+ tracks = [[NSMutableArray alloc] init];
25+
26+ unsigned i, count;
27+ for(i = 0, count = [elems count]; i < count; i++) {
28+ NSXMLElement *trackElem = [elems objectAtIndex:i];
29+ XspfTrack *track = [XspfTrack xspfComponemtWithXMLElement:trackElem];
30+ if(track) {
31+ [self addChild:track];
32+ }
33+ }
34+ [self setCurrentIndex:0];
35+
36+ return self;
37+}
38+- (void)dealloc
39+{
40+ [[self currentTrack] removeObserver:self forKeyPath:@"isPlayed"];
41+
42+ [tracks release];
43+ [title release];
44+
45+ [super dealloc];
46+}
47+- (NSXMLElement *)XMLElement
48+{
49+ id node = [NSXMLElement elementWithName:@"trackList"];
50+
51+ NSEnumerator *tracksEnum = [tracks objectEnumerator];
52+ id n;
53+ while(n = [tracksEnum nextObject]) {
54+ [node addChild:[n XMLElement]];
55+ }
56+
57+ return node;
58+}
59+- (void)observeValueForKeyPath:(NSString *)keyPath
60+ ofObject:(id)object
61+ change:(NSDictionary *)change
62+ context:(void *)context
63+{
64+ if([keyPath isEqual:@"isPlayed"]) {
65+ [self willChangeValueForKey:@"isPlayed"];
66+ [self didChangeValueForKey:@"isPlayed"];
67+ return;
68+ }
69+
70+ [super observeValueForKeyPath:keyPath
71+ ofObject:object
72+ change:change
73+ context:context];
74+}
75+- (void)setSelectionIndex:(unsigned)index
76+{
77+ [self setCurrentIndex:index];
78+}
79+- (void)setCurrentIndex:(unsigned)index
80+{
81+ unsigned prev;
82+
83+ if(index < 0) return;
84+ if([tracks count] <= index) return;
85+
86+ [self willChangeValueForKey:@"qtMovie"];
87+ [self willChangeValueForKey:@"currentTrack"];
88+ prev = currentIndex;
89+ currentIndex = index;
90+ [self didChangeValueForKey:@"qtMovie"];
91+ [self didChangeValueForKey:@"currentTrack"];
92+
93+ [self willChangeValueForKey:@"isPlayed"];
94+ XspfTrack *t= nil;
95+ @try {
96+ t = [tracks objectAtIndex:prev];
97+ [t removeObserver:self forKeyPath:@"isPlayed"];
98+ }
99+ @catch (id ex) {
100+ if(![[ex name] isEqualTo:NSRangeException]) {
101+ NSLog(@"Exception ### named %@", [ex name]);
102+ @throw;
103+ }
104+ }
105+
106+ if(t) {
107+ [t purgeQTMovie];
108+ [t deselect];
109+ }
110+
111+ XspfComponent *t2 = [self currentTrack];
112+ [t2 select];
113+ [t2 addObserver:self
114+ forKeyPath:@"isPlayed"
115+ options:NSKeyValueObservingOptionNew
116+ context:NULL];
117+ [self didChangeValueForKey:@"isPlayed"];
118+
119+}
120+- (unsigned)currentIndex
121+{
122+ return currentIndex;
123+}
124+
125+- (void)next
126+{
127+ [self setCurrentIndex:[self currentIndex] + 1];
128+}
129+- (void)previous
130+{
131+ [self setCurrentIndex:[self currentIndex] - 1];
132+}
133+- (NSArray *)children
134+{
135+ return tracks;
136+}
137+- (BOOL)isLeaf
138+{
139+ return NO;
140+}
141+
142+// primitive.
143+- (void)insertChild:(XspfComponent *)child atIndex:(unsigned)index
144+{
145+ if(!child) return;
146+ if(![child isKindOfClass:[XspfComponent class]]) {
147+ NSLog(@"addChild: argument class is MUST kind of XspfComponent. "
148+ @"but argument class is %@<%p>.",
149+ NSStringFromClass([child class]), child);
150+ return;
151+ }
152+ [tracks insertObject:child atIndex:index];
153+ [child setParent:self];
154+}
155+// primitive.
156+- (void)removeChild:(XspfComponent *)child
157+{
158+ if(!child) return;
159+ if(![tracks containsObject:child]) return;
160+
161+ [child setParent:nil];
162+ [tracks removeObject:child];
163+}
164+
165+- (void)addChild:(XspfComponent *)child
166+{
167+ unsigned num = [tracks count];
168+ [self insertChild:child atIndex:num];
169+}
170+- (void)removeChildAtIndex:(unsigned)index
171+{
172+ id child = [tracks objectAtIndex:index];
173+ [self removeChild:child];
174+}
175+
176+- (NSString *)description
177+{
178+ return [tracks description];
179+}
180+
181+- (XspfComponent *)currentTrack
182+{
183+ if([tracks count] > currentIndex) {
184+ return [tracks objectAtIndex:currentIndex];
185+ }
186+ return nil;
187+}
188+
189+- (QTMovie *)qtMovie
190+{
191+ return [[self currentTrack] qtMovie];
192+}
193+
194+- (void)setIsPlayed:(BOOL)state {}
195+- (BOOL)isPlayed
196+{
197+ XspfComponent *t = [self currentTrack];
198+ if(t) {
199+ return [t isPlayed];
200+ }
201+ return NO;
202+}
203+@end
--- tags/release-1.1.36/XspfComponent.m (nonexistent)
+++ tags/release-1.1.36/XspfComponent.m (revision 37)
@@ -0,0 +1,191 @@
1+//
2+// XspfComponent.m
3+// XspfQT
4+//
5+// Created by Hori,Masaki on 08/08/29.
6+// Copyright 2008 masakih. All rights reserved.
7+//
8+
9+#import "XspfComponent.h"
10+#import "XspfPlaceholderComponent.h"
11+
12+@implementation XspfComponent
13+
14++ (id) allocWithZone : (NSZone *) zone
15+{
16+ if ([self class] == [XspfComponent class]) {
17+ return [XspfPlaceholderComponent sharedInstance];
18+ }
19+
20+ return [super allocWithZone : zone];
21+}
22+
23++ (id)xspfComponemtWithXMLElement:(NSXMLElement *)element
24+{
25+ return [[[self alloc] initWithXMLElement:element] autorelease];
26+}
27+- (id)initWithXMLElement:(NSXMLElement *)element
28+{
29+ [super init];
30+ [self doesNotRecognizeSelector:_cmd];
31+
32+ [self release];
33+
34+ return nil;
35+}
36+
37+- (NSXMLElement *)XMLElement
38+{
39+ [self doesNotRecognizeSelector:_cmd];
40+}
41+
42+- (QTMovie *)qtMovie
43+{
44+ return nil;
45+}
46+- (NSDate *)duration
47+{
48+ return nil;
49+}
50+- (XspfComponent *)parent
51+{
52+ return parent;
53+}
54+- (NSArray *)children
55+{
56+ return nil;
57+}
58+- (unsigned)childrenCount
59+{
60+ return [[self children] count];
61+}
62+- (BOOL)isLeaf
63+{
64+ return YES;
65+}
66+
67+- (void)setParent:(XspfComponent *)new
68+{
69+ parent = new;
70+}
71+- (void)addChild:(XspfComponent *)child
72+{
73+ [self doesNotRecognizeSelector:_cmd];
74+}
75+- (void)removeChild:(XspfComponent *)child
76+{
77+ [self doesNotRecognizeSelector:_cmd];
78+}
79+- (void)insertChild:(XspfComponent *)child atIndex:(unsigned)index
80+{
81+ [self doesNotRecognizeSelector:_cmd];
82+}
83+- (void)removeChildAtIndex:(unsigned)index
84+{
85+ [self doesNotRecognizeSelector:_cmd];
86+}
87+- (void)setTitle:(NSString *)new
88+{
89+ if(title == new) return;
90+ if([title isEqualTo:new]) return;
91+
92+ [title autorelease];
93+ title = [new copy];
94+}
95+- (NSString *)title
96+{
97+ return title;
98+}
99+- (BOOL)isSelected
100+{
101+ return isSelected;
102+}
103+- (void)select
104+{
105+ [self willChangeValueForKey:@"isSelected"];
106+ isSelected = YES;
107+ [self didChangeValueForKey:@"isSelected"];
108+}
109+- (void)deselect
110+{
111+ [self willChangeValueForKey:@"isSelected"];
112+ isSelected = NO;
113+ [self didChangeValueForKey:@"isSelected"];
114+}
115+- (void)setSelectionIndex:(unsigned)index
116+{
117+ [self doesNotRecognizeSelector:_cmd];
118+
119+ // 現在値と違うなら現在値をdeselect
120+
121+ // 新しい値をselect
122+}
123+- (BOOL)setSelectionIndexPath:(NSIndexPath *)indexPath
124+{
125+ unsigned length = [indexPath length];
126+ if(length == 0) {
127+ return NO;
128+ }
129+ unsigned firstIndex = [indexPath indexAtPosition:0];
130+ if(firstIndex > [self childrenCount]) {
131+ return NO;
132+ }
133+
134+ XspfComponent *firstIndexedChild = [[self children] objectAtIndex:firstIndex];
135+ if(length != 1) {
136+ NSIndexPath *deletedFirstIndex = nil;
137+ unsigned *indexP = NULL;
138+ @try {
139+ indexP = calloc(sizeof(unsigned), length - 1);
140+ if(!indexP) {
141+ [NSException raise:NSMallocException
142+ format:@"Not enough memory"];
143+ }
144+ [indexPath getIndexes:indexP];
145+ deletedFirstIndex = [NSIndexPath indexPathWithIndexes:indexP + 1
146+ length:length - 1];
147+ }
148+ @catch (id ex) {
149+ @throw;
150+ }
151+ @finally{
152+ free(indexP);
153+ }
154+ if(!deletedFirstIndex ||
155+ ![firstIndexedChild setSelectionIndexPath:deletedFirstIndex]) {
156+ return NO;
157+ }
158+ } else {
159+ [self setSelectionIndex:firstIndex];
160+ }
161+ if(!isSelected) {
162+ [self select];
163+ }
164+ [selectionIndexPath autorelease];
165+ selectionIndexPath = [indexPath retain];
166+
167+ return YES;
168+}
169+- (NSIndexPath *)selectionIndexPath
170+{
171+ return selectionIndexPath;
172+}
173+- (void)setIsPlayed:(BOOL)state {} // do nothing.
174+- (BOOL)isPlayed
175+{
176+ return NO;
177+}
178+- (XspfComponent *)currentTrack
179+{
180+ return self;
181+}
182+- (void)next
183+{
184+ [self doesNotRecognizeSelector:_cmd];
185+}
186+- (void)previous
187+{
188+ [self doesNotRecognizeSelector:_cmd];
189+}
190+
191+@end
--- tags/release-1.1.36/XspfTrack.m (nonexistent)
+++ tags/release-1.1.36/XspfTrack.m (revision 37)
@@ -0,0 +1,207 @@
1+//
2+// XspfTrack.m
3+// XspfQT
4+//
5+// Created by Hori,Masaki on 08/08/29.
6+// Copyright 2008 masakih. All rights reserved.
7+//
8+
9+#import "XspfTrack.h"
10+
11+@interface XspfTrack (Private)
12+- (void)setSavedDateWithQTTime:(QTTime)qttime;
13+- (NSDate *)duration;
14+@end
15+
16+@implementation XspfTrack
17+- (id)initWithXMLElement:(NSXMLElement *)element
18+{
19+ self = [super init];
20+
21+ NSArray *elems = [element elementsForName:@"location"];
22+ if(!elems || [elems count] == 0) {
23+ [self release];
24+ return nil;
25+ }
26+
27+ NSString *loc = [[elems objectAtIndex:0] stringValue];;
28+ [self setLocationString:loc];
29+
30+ NSString *t;
31+ elems = [element elementsForName:@"title"];
32+ if(!elems || [elems count] == 0) {
33+ t = [[self locationString] lastPathComponent];
34+ } else {
35+ t = [[elems objectAtIndex:0] stringValue];
36+ }
37+ [self setTitle:t];
38+
39+ elems = [element elementsForName:@"duration"];
40+ if(elems && [elems count] != 0) {
41+ t = [[elems objectAtIndex:0] stringValue];
42+ NSTimeInterval ti = [t doubleValue] / 1000;
43+ QTTime q = QTMakeTimeWithTimeInterval(ti);
44+ [self setSavedDateWithQTTime:q];
45+ }
46+
47+ return self;
48+}
49+- (void)dealloc
50+{
51+ [location release];
52+ [title release];
53+ [movie release];
54+ [savedDate release];
55+
56+ [super dealloc];
57+}
58+- (NSXMLElement *)XMLElement
59+{
60+ id node = [NSXMLElement elementWithName:@"track"];
61+
62+ id locElem = [NSXMLElement elementWithName:@"location" stringValue:[self locationString]];
63+ if(locElem) {
64+ [node addChild:locElem];
65+ }
66+ id titleElem = [NSXMLElement elementWithName:@"title" stringValue:[self title]];
67+ if(titleElem) {
68+ [node addChild:titleElem];
69+ }
70+
71+ id d = [self duration];
72+ if(d) {
73+ NSTimeInterval t = [d timeIntervalSince1970];
74+ t += [[NSTimeZone systemTimeZone] secondsFromGMT];
75+ unsigned long long scaledT = (unsigned long long)t;
76+ scaledT *= 1000;
77+ id durationElem = [NSXMLElement elementWithName:@"duration"
78+ stringValue:[NSString stringWithFormat:@"%qu", scaledT]];
79+ if(durationElem) {
80+ [node addChild:durationElem];
81+ }
82+ }
83+
84+ return node;
85+}
86+- (void)setLocation:(NSURL *)loc
87+{
88+ if(location && ![location isKindOfClass:[NSURL class]]) return;
89+ if(location == loc) return;
90+ if([location isEqualTo:loc]) return;
91+
92+ [location autorelease];
93+ location = [loc retain];
94+}
95+- (NSURL *)location
96+{
97+ return location;
98+}
99+- (void)setLocationString:(NSString *)loc
100+{
101+ [self setLocation:[NSURL URLWithString:loc]];
102+}
103+- (NSString *)locationString
104+{
105+ return [[self location] absoluteString];
106+}
107+
108+- (void)setSavedDateWithQTTime:(QTTime)qttime
109+{
110+ id t = [NSValueTransformer valueTransformerForName:@"XspfQTTimeDateTransformer"];
111+ savedDate = [[t transformedValue:[NSValue valueWithQTTime:qttime]] retain];
112+}
113+- (NSDate *)savedDate
114+{
115+ return savedDate;
116+}
117+- (NSDate *)duration
118+{
119+ if(savedDate) return savedDate;
120+
121+ if(!movie) return nil;
122+
123+ [self setSavedDateWithQTTime:[movie duration]];
124+ return [self savedDate];
125+}
126+- (QTMovie *)qtMovie
127+{
128+ if(![QTMovie canInitWithURL:[self location]]) return nil;
129+
130+ NSError *error = nil;
131+ NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:
132+ [self location], QTMovieURLAttribute,
133+ [NSNumber numberWithBool:NO], QTMovieOpenAsyncOKAttribute,
134+ nil];
135+ movie = [[QTMovie alloc] initWithAttributes:attrs error:&error];
136+ {
137+ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
138+// [nc addObserver:self
139+// selector:@selector(notifee:)
140+// name:@"QTMoviePrerollCompleteNotification"
141+// object:movie];
142+ [nc addObserver:self
143+ selector:@selector(notifee:)
144+ name:@"QTMovieRateDidChangeNotification"
145+ object:movie];
146+// [nc addObserver:self
147+// selector:@selector(notifee:)
148+// name:@"QTMovieDidEndNotification"
149+// object:movie];
150+ }
151+
152+
153+ [self willChangeValueForKey:@"duration"];
154+ [self didChangeValueForKey:@"duration"];
155+
156+ return movie;
157+}
158+- (void)setIsPlayed:(BOOL)state
159+{
160+ isPlayed = state;
161+}
162+- (BOOL)isPlayed
163+{
164+ return isPlayed;
165+}
166+- (void)next
167+{
168+ [[self parent] next];
169+}
170+- (void)previous
171+{
172+ [[self parent] previous];
173+}
174+
175+
176+- (void)purgeQTMovie
177+{
178+ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
179+ [nc removeObserver:self
180+ name:nil
181+ object:movie];
182+
183+ [movie release];
184+ movie = nil;
185+}
186+
187+- (void)notifee:(id)notification
188+{
189+// NSLog(@"Notifed: name -> (%@)\ndict -> (%@)", [notification name], [notification userInfo]);
190+
191+ NSNumber *rateValue = [[notification userInfo] objectForKey:QTMovieRateDidChangeNotificationParameter];
192+ if(rateValue) {
193+ float rate = [rateValue doubleValue];
194+ if(rate == 0) {
195+ [self setIsPlayed:NO];
196+ } else if(rate == 1) {
197+ [self setIsPlayed:YES];
198+ }
199+ }
200+}
201+
202+- (NSString *)description
203+{
204+ return [NSString stringWithFormat:@"Title:(%@)\nLocation:(%@)",
205+ [self title], [self location]];
206+}
207+@end
--- tags/release-1.1.36/XspfMovieWindowController.m (nonexistent)
+++ tags/release-1.1.36/XspfMovieWindowController.m (revision 37)
@@ -0,0 +1,394 @@
1+//
2+// XspfMovieWindowController.m
3+// XspfQT
4+//
5+// Created by Hori,Masaki on 08/08/31.
6+// Copyright 2008 masakih. All rights reserved.
7+//
8+
9+#import "XspfMovieWindowController.h"
10+#import "XspfDocument.h"
11+#import "XspfComponent.h"
12+#import "XspfFullScreenWindow.h"
13+
14+
15+@interface XspfMovieWindowController (Private)
16+- (void)sizeTofitWidnow;
17+- (NSSize)fitSizeToSize:(NSSize)toSize;
18+- (NSWindow *)fullscreenWindow;
19+@end
20+
21+@implementation XspfMovieWindowController
22+
23+#pragma mark ### Static variables ###
24+static const float sVolumeDelta = 0.2;
25+static NSString *const kCurrentIndexKeyPath = @"trackList.currentIndex";
26+
27+- (id)init
28+{
29+ if(self = [super initWithWindowNibName:@"XspfDocument"]) {
30+ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
31+ [nc addObserver:self
32+ selector:@selector(applicationWillTerminate:)
33+ name:NSApplicationWillTerminateNotification
34+ object:NSApp];
35+
36+ updateTime = [NSTimer scheduledTimerWithTimeInterval:0.3
37+ target:self
38+ selector:@selector(updateTimeIfNeeded:)
39+ userInfo:NULL
40+ repeats:YES];
41+ }
42+
43+ return self;
44+}
45+
46+- (void)dealloc
47+{
48+ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
49+ [nc removeObserver:self];
50+
51+ [fullscreenWindow release];
52+
53+ [qtMovie release];
54+ [updateTime release];
55+
56+ [prevMouseMovedDate release];
57+
58+ [super dealloc];
59+}
60+- (void)awakeFromNib
61+{
62+ prevMouseMovedDate = [[NSDate dateWithTimeIntervalSinceNow:0.0] retain];
63+
64+ id d = [self document];
65+// NSLog(@"Add Observed! %@", d);
66+ [d addObserver:self
67+ forKeyPath:kCurrentIndexKeyPath
68+ options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld
69+ context:NULL];
70+ [d addObserver:self
71+ forKeyPath:@"trackList.isPlayed"
72+ options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld
73+ context:NULL];
74+
75+ [self sizeTofitWidnow];
76+ [self play];
77+}
78+
79+#pragma mark ### KVO & KVC ###
80+- (void)observeValueForKeyPath:(NSString *)keyPath
81+ ofObject:(id)object
82+ change:(NSDictionary *)change
83+ context:(void *)context
84+{
85+// NSLog(@"Observed!");
86+ if([keyPath isEqual:kCurrentIndexKeyPath]) {
87+ id old = [change objectForKey:NSKeyValueChangeOldKey];
88+ id new = [change objectForKey:NSKeyValueChangeNewKey];
89+ if([old isEqual:new]) return;
90+ [self setQtMovie:[self valueForKeyPath:@"document.trackList.qtMovie"]];
91+ return;
92+ }
93+ if([keyPath isEqual:@"trackList.isPlayed"]) {
94+ id new = [change objectForKey:NSKeyValueChangeNewKey];
95+
96+ if([new boolValue]) {
97+ [playButton setTitle:@"||"];
98+ } else {
99+ [playButton setTitle:@">"];
100+ }
101+ return;
102+ }
103+
104+
105+ [super observeValueForKeyPath:keyPath
106+ ofObject:object
107+ change:change
108+ context:context];
109+}
110+
111+- (void)setQtMovie:(QTMovie *)qt
112+{
113+ if(qtMovie == qt) return;
114+ if([qtMovie isEqual:qt]) return;
115+
116+ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
117+
118+ if(qtMovie) {
119+ [nc removeObserver:self name:nil object:qtMovie];
120+ }
121+ if(qt) {
122+ [nc addObserver:self selector:@selector(didEndMovie:) name:QTMovieDidEndNotification object:qt];
123+ }
124+
125+ if(qtMovie) {
126+ [qt setVolume:[qtMovie volume]];
127+ [qt setMuted:[qtMovie muted]];
128+ }
129+ [qtMovie autorelease];
130+ qtMovie = [qt retain];
131+ [self synchronizeWindowTitleWithDocumentName];
132+
133+ [self sizeTofitWidnow];
134+
135+ [self play];
136+}
137+- (QTMovie *)qtMovie
138+{
139+ return qtMovie;
140+}
141+
142+#pragma mark ### Other functions ###
143+- (void)sizeTofitWidnow
144+{
145+ id window = [self window];
146+ NSRect frame = [window frame];
147+ NSSize newSize = [self fitSizeToSize:frame.size];
148+ frame.origin.y += frame.size.height - newSize.height;
149+ frame.size = newSize;
150+
151+ [window setFrame:frame display:YES animate:YES];
152+}
153+- (NSSize)fitSizeToSize:(NSSize)toSize
154+{
155+ QTMovie *curMovie = [self qtMovie];
156+ if(!curMovie) return toSize;
157+
158+ NSSize qtViewSize = [qtView frame].size;
159+ NSSize currentWindowSize = [[self window] frame].size;
160+
161+ // Area size without QTMovieView.
162+ NSSize delta = NSMakeSize(currentWindowSize.width - qtViewSize.width,
163+ currentWindowSize.height - qtViewSize.height);
164+
165+ NSSize movieSize = [[curMovie attributeForKey:QTMovieNaturalSizeAttribute] sizeValue];
166+
167+ float targetViewWidth = toSize.width - delta.width;
168+ float targetViewHeight = targetViewWidth * (movieSize.height / movieSize.width);
169+
170+ targetViewWidth += delta.width;
171+ targetViewHeight += delta.height;
172+
173+ NSSize newSize = NSMakeSize(targetViewWidth, targetViewHeight);
174+
175+ return newSize;
176+}
177+
178+- (void)play
179+{
180+ [qtView performSelectorOnMainThread:@selector(play:) withObject:self waitUntilDone:NO];
181+}
182+- (void)pause
183+{
184+ [qtView performSelectorOnMainThread:@selector(pause:) withObject:self waitUntilDone:NO];
185+}
186+
187+- (void)enterFullScreen
188+{
189+ NSWindow *w = [self fullscreenWindow];
190+
191+ nomalModeSavedFrame = [qtView frame];
192+
193+ [[self window] orderOut:self];
194+ [w setContentView:qtView];
195+
196+// [NSMenu setMenuBarVisible:NO];
197+ SetSystemUIMode (kUIModeAllHidden, kUIOptionAutoShowMenuBar);
198+
199+ [w makeKeyAndOrderFront:self];
200+ [w makeFirstResponder:qtView];
201+}
202+- (void)exitFullScreen
203+{
204+ NSWindow *w = [self fullscreenWindow];
205+
206+ [qtView retain];
207+ {
208+ [qtView removeFromSuperview];
209+ [qtView setFrame:nomalModeSavedFrame];
210+ [[[self window] contentView] addSubview:qtView];
211+ }
212+ [qtView release];
213+
214+ [NSMenu setMenuBarVisible:YES];
215+ [w orderOut:self];
216+ [[self window] makeKeyAndOrderFront:self];
217+ [[self window] makeFirstResponder:qtView];
218+}
219+
220+- (NSWindow *)fullscreenWindow
221+{
222+ if(fullscreenWindow) return fullscreenWindow;
223+
224+ NSRect mainScreenRect = [[NSScreen mainScreen] frame];
225+ fullscreenWindow = [[XspfFullScreenWindow alloc] initWithContentRect:mainScreenRect
226+ styleMask:NSBorderlessWindowMask
227+ backing:NSBackingStoreBuffered
228+ defer:YES];
229+ [fullscreenWindow setReleasedWhenClosed:NO];
230+ [fullscreenWindow setBackgroundColor:[NSColor blackColor]];
231+ [fullscreenWindow setDelegate:self];
232+
233+ return fullscreenWindow;
234+}
235+
236+#pragma mark ### Actions ###
237+- (IBAction)togglePlayAndPause:(id)sender
238+{
239+ if([[self valueForKeyPath:@"document.trackList.isPlayed"] boolValue]) {
240+ [self pause];
241+ } else {
242+ [self play];
243+ }
244+}
245+
246+- (IBAction)turnUpVolume:(id)sender
247+{
248+ NSNumber *cv = [self valueForKeyPath:@"qtMovie.volume"];
249+ cv = [NSNumber numberWithFloat:[cv floatValue] + sVolumeDelta];
250+ [self setValue:cv forKeyPath:@"qtMovie.volume"];
251+}
252+- (IBAction)turnDownVolume:(id)sender
253+{
254+ NSNumber *cv = [self valueForKeyPath:@"qtMovie.volume"];
255+ cv = [NSNumber numberWithFloat:[cv floatValue] - sVolumeDelta];
256+ [self setValue:cv forKeyPath:@"qtMovie.volume"];
257+}
258+- (IBAction)toggleFullScreenMode:(id)sender
259+{
260+ if(fullScreenMode) {
261+ [self exitFullScreen];
262+ fullScreenMode = NO;
263+ } else {
264+ [self enterFullScreen];
265+ fullScreenMode = YES;
266+ }
267+}
268+
269+- (IBAction)forwardTagValueSecends:(id)sender
270+{
271+ if(![sender respondsToSelector:@selector(tag)]) return;
272+
273+ int tag = [sender tag];
274+ if(tag == 0) return;
275+
276+ QTTime current = [[self qtMovie] currentTime];
277+ NSTimeInterval cur;
278+ if(!QTGetTimeInterval(current, &cur)) return;
279+
280+ QTTime new = QTMakeTimeWithTimeInterval(cur + tag);
281+ [[self qtMovie] setCurrentTime:new];
282+}
283+- (IBAction)backwardTagValueSecends:(id)sender
284+{
285+ if(![sender respondsToSelector:@selector(tag)]) return;
286+
287+ int tag = [sender tag];
288+ if(tag == 0) return;
289+
290+ QTTime current = [[self qtMovie] currentTime];
291+ NSTimeInterval cur;
292+ if(!QTGetTimeInterval(current, &cur)) return;
293+
294+ QTTime new = QTMakeTimeWithTimeInterval(cur - tag);
295+ [[self qtMovie] setCurrentTime:new];
296+}
297+- (IBAction)nextTrack:(id)sender
298+{
299+ [[[self document] trackList] next];
300+}
301+- (IBAction)previousTrack:(id)sender
302+{
303+ [[[self document] trackList] previous];
304+}
305+
306+#pragma mark ### Notification & Timer ###
307+- (void)didEndMovie:(id)notification
308+{
309+ [[[self document] trackList] next];
310+}
311+- (void)updateTimeIfNeeded:(id)timer
312+{
313+ QTMovie *qt = [self qtMovie];
314+ if(qt) {
315+ // force update time indicator.
316+ [qt willChangeValueForKey:@"currentTime"];
317+ [qt didChangeValueForKey:@"currentTime"];
318+ }
319+
320+ // Hide cursor and controller, if mouse didn't move for 3 seconds.
321+ NSPoint mouse = [NSEvent mouseLocation];
322+ if(!NSEqualPoints(prevMouse, mouse)) {
323+ prevMouse = mouse;
324+ [prevMouseMovedDate autorelease];
325+ prevMouseMovedDate = [[NSDate dateWithTimeIntervalSinceNow:0.0] retain];
326+ } else if(fullScreenMode && [prevMouseMovedDate timeIntervalSinceNow] < -3.0 ) {
327+ [NSCursor setHiddenUntilMouseMoves:YES];
328+ //
329+ // hide controller.
330+ }
331+}
332+
333+#pragma mark ### NSResponder ###
334+- (void)cancelOperation:(id)sender
335+{
336+ if(fullScreenMode) {
337+ [self toggleFullScreenMode:self];
338+ }
339+}
340+
341+#pragma mark ### NSMenu valivation ###
342+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
343+{
344+ if([menuItem action] == @selector(toggleFullScreenMode:)) {
345+ if(fullScreenMode) {
346+ [menuItem setTitle:NSLocalizedString(@"Exit Full Screen", @"Exit Full Screen")];
347+ } else {
348+ [menuItem setTitle:NSLocalizedString(@"Full Screen", @"Full Screen")];
349+ }
350+ return YES;
351+ }
352+
353+ return YES;
354+}
355+
356+#pragma mark ### NSApplication Delegate ###
357+- (void)applicationWillTerminate:(NSNotification *)notification
358+{
359+ if(fullScreenMode) {
360+ [self toggleFullScreenMode:self];
361+ }
362+ [[self document] removeObserver:self forKeyPath:kCurrentIndexKeyPath];
363+ [[self document] removeObserver:self forKeyPath:@"trackList.isPlayed"];
364+}
365+
366+#pragma mark ### NSWindow Delegate ###
367+- (BOOL)windowShouldClose:(id)sender
368+{
369+ [qtView pause:self];
370+ [self setQtMovie:nil];
371+
372+ [[self document] removeObserver:self forKeyPath:kCurrentIndexKeyPath];
373+ [[self document] removeObserver:self forKeyPath:@"trackList.isPlayed"];
374+ [self setShouldCloseDocument:YES];
375+
376+ [updateTime release];
377+ updateTime = nil;
378+
379+ return YES;
380+}
381+- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize
382+{
383+ return [self fitSizeToSize:frameSize];
384+}
385+- (void)windowDidMove:(NSNotification *)notification
386+{
387+ if(fullscreenWindow && [notification object] == fullscreenWindow) {
388+ NSRect r = [fullscreenWindow frame];
389+ if(!NSEqualRects(r, NSZeroRect)) {
390+ [fullscreenWindow setFrameOrigin:NSZeroPoint];
391+ }
392+ }
393+}
394+@end
--- tags/release-1.1.36/XspfTrackList.h (nonexistent)
+++ tags/release-1.1.36/XspfTrackList.h (revision 37)
@@ -0,0 +1,23 @@
1+//
2+// XspfTrackList.h
3+// XspfQT
4+//
5+// Created by Hori,Masaki on 08/08/29.
6+// Copyright 2008 masakih. All rights reserved.
7+//
8+
9+#import <Cocoa/Cocoa.h>
10+#import "XspfComponent.h"
11+
12+
13+@interface XspfTrackList : XspfComponent
14+{
15+ NSMutableArray *tracks;
16+
17+ unsigned currentIndex;
18+}
19+
20+- (void)setCurrentIndex:(unsigned)index;
21+- (unsigned)currentIndex;
22+
23+@end
--- tags/release-1.1.36/XspfTrack.h (nonexistent)
+++ tags/release-1.1.36/XspfTrack.h (revision 37)
@@ -0,0 +1,32 @@
1+//
2+// XspfTrack.h
3+// XspfQT
4+//
5+// Created by Hori,Masaki on 08/08/29.
6+// Copyright 2008 masakih. All rights reserved.
7+//
8+
9+#import <Cocoa/Cocoa.h>
10+#import <QTKit/QTKit.h>
11+#import "XspfComponent.h"
12+
13+
14+@interface XspfTrack : XspfComponent
15+{
16+ NSURL *location;
17+
18+ QTMovie *movie;
19+
20+ NSDate *savedDate;
21+
22+ BOOL isPlayed;
23+}
24+
25+- (void)setLocation:(NSURL *)location;
26+- (void)setLocationString:(NSString *)location;
27+- (NSURL *)location;
28+- (NSString *)locationString;
29+
30+- (void)purgeQTMovie;
31+
32+@end
--- tags/release-1.1.36/XspfPlaceholderComponent.h (nonexistent)
+++ tags/release-1.1.36/XspfPlaceholderComponent.h (revision 37)
@@ -0,0 +1,17 @@
1+//
2+// XspfPlaceholderComponent.h
3+// XspfQT
4+//
5+// Created by Hori,Masaki on 08/09/06.
6+// Copyright 2008 masakih. All rights reserved.
7+//
8+
9+#import <Cocoa/Cocoa.h>
10+#import "XspfComponent.h"
11+
12+@interface XspfPlaceholderComponent : XspfComponent
13+{
14+
15+}
16++ (XspfPlaceholderComponent *)sharedInstance;
17+@end
--- tags/release-1.1.36/XspfPlaceholderComponent.m (nonexistent)
+++ tags/release-1.1.36/XspfPlaceholderComponent.m (revision 37)
@@ -0,0 +1,77 @@
1+//
2+// XspfPlaceholderComponent.m
3+// XspfQT
4+//
5+// Created by Hori,Masaki on 08/09/06.
6+// Copyright 2008 masakih. All rights reserved.
7+//
8+
9+#import "XspfPlaceholderComponent.h"
10+#import "XspfTrackList.h"
11+#import "XspfTrack.h"
12+
13+@implementation XspfPlaceholderComponent
14+static XspfPlaceholderComponent *sharedInstance = nil;
15+
16++ (XspfPlaceholderComponent *)sharedInstance
17+{
18+ @synchronized(self) {
19+ if (sharedInstance == nil) {
20+ [[self alloc] init]; // assignment not done here
21+ }
22+ }
23+ return sharedInstance;
24+}
25+
26++ (id)allocWithZone:(NSZone *)zone
27+{
28+ @synchronized(self) {
29+ if (sharedInstance == nil) {
30+ sharedInstance = [super allocWithZone:zone];
31+ return sharedInstance; // assignment and return on first allocation
32+ }
33+ }
34+ return nil; //on subsequent allocation attempts return nil
35+}
36+
37+- (id)copyWithZone:(NSZone *)zone
38+{
39+ return self;
40+}
41+
42+- (id)retain
43+{
44+ return self;
45+}
46+
47+- (unsigned)retainCount
48+{
49+ return UINT_MAX; //denotes an object that cannot be released
50+}
51+
52+- (void)release
53+{
54+ //do nothing
55+}
56+
57+- (id)autorelease
58+{
59+ return self;
60+}
61+
62+#pragma mark ### initializers ###
63+- (id)initWithXMLElement:(NSXMLElement *)element
64+{
65+ NSString *name = [element name];
66+ if([name isEqualTo:@""]) return nil;
67+
68+ if([name isEqualTo:@"trackList"]) {
69+ return [[XspfTrackList alloc] initWithXMLElement:element];
70+ }
71+ if([name isEqualTo:@"track"]) {
72+ return [[XspfTrack alloc] initWithXMLElement:element];
73+ }
74+
75+ return nil;
76+}
77+@end
--- tags/release-1.1.36/XspfMovieWindowController.h (nonexistent)
+++ tags/release-1.1.36/XspfMovieWindowController.h (revision 37)
@@ -0,0 +1,40 @@
1+//
2+// XspfMovieWindowController.h
3+// XspfQT
4+//
5+// Created by Hori,Masaki on 08/08/31.
6+// Copyright 2008 masakih. All rights reserved.
7+//
8+
9+#import <Cocoa/Cocoa.h>
10+#import <QTKit/QTKit.h>
11+
12+
13+@interface XspfMovieWindowController : NSWindowController
14+{
15+ IBOutlet QTMovieView *qtView;
16+ IBOutlet NSButton *playButton;
17+
18+ NSWindow *fullscreenWindow;
19+ NSRect nomalModeSavedFrame;
20+ BOOL fullScreenMode;
21+
22+ QTMovie *qtMovie;
23+ NSTimer *updateTime;
24+
25+ NSPoint prevMouse;
26+ NSDate *prevMouseMovedDate;
27+}
28+
29+- (IBAction)togglePlayAndPause:(id)sender;
30+- (IBAction)toggleFullScreenMode:(id)sender;
31+- (IBAction)forwardTagValueSecends:(id)sender;
32+- (IBAction)backwardTagValueSecends:(id)sender;
33+- (IBAction)nextTrack:(id)sender;
34+- (IBAction)previousTrack:(id)sender;
35+
36+- (void)play;
37+
38+- (void)setQtMovie:(QTMovie *)qt;
39+- (QTMovie *)qtMovie;
40+@end
--- tags/release-1.1.36/Makefile (nonexistent)
+++ tags/release-1.1.36/Makefile (revision 37)
@@ -0,0 +1,56 @@
1+// encoding=utf-8
2+PRODUCT_NAME=XspfQT
3+PRODUCT_EXTENSION=app
4+BUILD_PATH=./build
5+DEPLOYMENT=Release
6+APP_BUNDLE=$(PRODUCT_NAME).$(PRODUCT_EXTENSION)
7+APP=$(BUILD_PATH)/$(DEPLOYMENT)/$(APP_BUNDLE)
8+APP_NAME=$(BUILD_PATH)/$(DEPLOYMENT)/$(PRODUCT_NAME)
9+INFO_PLIST=Info.plist
10+
11+URL_XspfQT = svn+ssh://macmini/usr/local/svnrepos/XspfQT
12+HEAD = $(URL_XspfQT)/XspfQT
13+TAGS_DIR = $(URL_XspfQT)/tags
14+
15+VER_CMD=grep -A1 'CFBundleShortVersionString' $(INFO_PLIST) | tail -1 | tr -d "'\t</string>"
16+VERSION=$(shell $(VER_CMD))
17+
18+all:
19+ @echo do nothig.
20+ @echo use target tagging
21+
22+tagging: update_svn
23+ @echo "Tagging the $(VERSION) (x) release of XspfQT project."
24+ REV=`LC_ALL=C svn info | awk '/Last Changed Rev/ {print $$4}'` ; \
25+ echo svn copy $(HEAD) $(TAGS_DIR)/release-$(VERSION).$${REV}
26+
27+Localizable: BSTRADocument.m
28+ genstrings -o English.lproj $<
29+ (cd English.lproj; ${MAKE} $@;)
30+ genstrings -o Japanese.lproj $<
31+ (cd Japanese.lproj; ${MAKE} $@;)
32+
33+checkLocalizable:
34+ (cd English.lproj; ${MAKE} $@;)
35+ (cd Japanese.lproj; ${MAKE} $@;)
36+
37+release: updateRevision
38+ xcodebuild -configuration $(DEPLOYMENT)
39+ $(MAKE) restorInfoPlist
40+
41+package: release
42+ REV=`LC_ALL=C svn info | awk '/Last Changed Rev/ {print $$4}'`; \
43+ ditto -ck -rsrc --keepParent $(APP) $(APP_NAME)-$(VERSION)-$${REV}.zip
44+
45+updateRevision: update_svn
46+ if [ ! -f $(INFO_PLIST).bak ] ; then cp $(INFO_PLIST) $(INFO_PLIST).bak ; fi ; \
47+ REV=`LC_ALL=C svn info | awk '/Last Changed Rev/ {print $$4}'` ; \
48+ sed -e "s/%%%%REVISION%%%%/$${REV}/" $(INFO_PLIST) > $(INFO_PLIST).r ; \
49+ mv -f $(INFO_PLIST).r $(INFO_PLIST) ; \
50+
51+restorInfoPlist:
52+ if [ -f $(INFO_PLIST).bak ] ; then cp -f $(INFO_PLIST).bak $(INFO_PLIST) ; fi
53+
54+update_svn:
55+ svn up
56+
--- tags/release-1.1.36/main.m (nonexistent)
+++ tags/release-1.1.36/main.m (revision 37)
@@ -0,0 +1,14 @@
1+//
2+// main.m
3+// XspfQT
4+//
5+// Created by Hori,Masaki on 08/08/29.
6+// Copyright masakih 2008 . All rights reserved.
7+//
8+
9+#import <Cocoa/Cocoa.h>
10+
11+int main(int argc, char *argv[])
12+{
13+ return NSApplicationMain(argc, (const char **) argv);
14+}
--- tags/release-1.1.36/XspfFullScreenWindow.h (nonexistent)
+++ tags/release-1.1.36/XspfFullScreenWindow.h (revision 37)
@@ -0,0 +1,17 @@
1+//
2+// XspfFullScreenWindow.h
3+// XspfQT
4+//
5+// Created by Hori,Masaki on 08/08/31.
6+// Copyright 2008 masakih. All rights reserved.
7+//
8+
9+#import <Cocoa/Cocoa.h>
10+
11+
12+@interface XspfFullScreenWindow : NSWindow
13+{
14+
15+}
16+
17+@end
--- tags/release-1.1.36/XspfFullScreenWindow.m (nonexistent)
+++ tags/release-1.1.36/XspfFullScreenWindow.m (revision 37)
@@ -0,0 +1,26 @@
1+//
2+// XspfFullScreenWindow.m
3+// XspfQT
4+//
5+// Created by Hori,Masaki on 08/08/31.
6+// Copyright 2008 masakih. All rights reserved.
7+//
8+
9+#import "XspfFullScreenWindow.h"
10+
11+
12+@implementation XspfFullScreenWindow
13+- (BOOL)canBecomeKeyWindow
14+{
15+ return YES;
16+}
17+- (void)cancelOperation:(id)sender
18+{
19+ id d = [self delegate];
20+ if(d && [d respondsToSelector:_cmd]) {
21+ [d performSelector:_cmd withObject:sender];
22+ }
23+
24+ [super cancelOperation:sender];
25+}
26+@end
--- tags/release-1.1.36/XspfAppDelegate.h (nonexistent)
+++ tags/release-1.1.36/XspfAppDelegate.h (revision 37)
@@ -0,0 +1,17 @@
1+//
2+// XspfAppDelegate.h
3+// XspfQT
4+//
5+// Created by Hori,Masaki on 08/08/31.
6+// Copyright 2008 masakih. All rights reserved.
7+//
8+
9+#import <Cocoa/Cocoa.h>
10+
11+
12+@interface XspfAppDelegate : NSObject
13+{
14+
15+}
16+
17+@end
--- tags/release-1.1.36/XspfAppDelegate.m (nonexistent)
+++ tags/release-1.1.36/XspfAppDelegate.m (revision 37)
@@ -0,0 +1,27 @@
1+//
2+// XspfAppDelegate.m
3+// XspfQT
4+//
5+// Created by Hori,Masaki on 08/08/31.
6+// Copyright 2008 masakih. All rights reserved.
7+//
8+
9+#import "XspfAppDelegate.h"
10+#import "XspfValueTransformers.h"
11+
12+@implementation XspfAppDelegate
13+
14++ (void)initialize
15+{
16+ [NSValueTransformer setValueTransformer:[[[XspfQTTimeTransformer alloc] init] autorelease]
17+ forName:@"XspfQTTimeTransformer"];
18+ [NSValueTransformer setValueTransformer:[[[XspfQTTimeDateTransformer alloc] init] autorelease]
19+ forName:@"XspfQTTimeDateTransformer"];
20+}
21+
22+- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
23+{
24+ return NO;
25+}
26+
27+@end
--- tags/release-1.1.36/XspfValueTransformers.h (nonexistent)
+++ tags/release-1.1.36/XspfValueTransformers.h (revision 37)
@@ -0,0 +1,15 @@
1+//
2+// XspfValueTransformers.h
3+// XspfQT
4+//
5+// Created by Hori,Masaki on 08/08/31.
6+// Copyright 2008 masakih. All rights reserved.
7+//
8+
9+#import <Cocoa/Cocoa.h>
10+
11+
12+@interface XspfQTTimeTransformer : NSValueTransformer
13+@end
14+@interface XspfQTTimeDateTransformer : NSValueTransformer
15+@end
--- tags/release-1.1.36/XspfValueTransformers.m (nonexistent)
+++ tags/release-1.1.36/XspfValueTransformers.m (revision 37)
@@ -0,0 +1,103 @@
1+//
2+// XspfValueTransformers.m
3+// XspfQT
4+//
5+// Created by Hori,Masaki on 08/08/31.
6+// Copyright 2008 masakih. All rights reserved.
7+//
8+
9+#import <QTKit/QTKit.h>
10+
11+#import "XspfValueTransformers.h"
12+
13+
14+@implementation XspfQTTimeTransformer
15++ (Class)transformedValueClass
16+{
17+ return [NSNumber class];
18+}
19++ (BOOL)allowsReverseTransformation
20+{
21+ return YES;
22+}
23+- (id)transformedValue:(id)value
24+{
25+ if(!value) return nil;
26+
27+// static first = YES;
28+// if(first) {
29+// first = NO;
30+// NSLog(@"%@ in value class -> %@", NSStringFromSelector(_cmd), NSStringFromClass([value class]));
31+// NSLog(@"value -> %@", value);
32+// }
33+
34+ QTTime t = [value QTTimeValue];
35+ NSTimeInterval res;
36+
37+ if(!QTGetTimeInterval(t, &res)) {return nil;}
38+
39+ return [NSNumber numberWithDouble:res];
40+}
41+- (id)reverseTransformedValue:(id)value
42+{
43+ if(!value) return nil;
44+
45+// static first = YES;
46+// if(first) {
47+// first = NO;
48+// NSLog(@"%@ in value class -> %@", NSStringFromSelector(_cmd), NSStringFromClass([value class]));
49+// NSLog(@"value -> %@", value);
50+// }
51+
52+ QTTime t = QTMakeTimeWithTimeInterval([value doubleValue]);
53+
54+ return [NSValue valueWithQTTime:t];
55+}
56+@end
57+
58+@implementation XspfQTTimeDateTransformer
59++ (Class)transformedValueClass
60+{
61+ return [NSDate class];
62+}
63++ (BOOL)allowsReverseTransformation
64+{
65+ return NO;
66+}
67+- (id)transformedValue:(id)value
68+{
69+ if(!value) return nil;
70+
71+// static first = YES;
72+// if(first) {
73+// first = NO;
74+// NSLog(@"%@ in value class -> %@", NSStringFromSelector(_cmd), NSStringFromClass([value class]));
75+// NSLog(@"value -> %@", value);
76+// }
77+
78+ QTTime t = [value QTTimeValue];
79+ NSTimeInterval res;
80+
81+ if(!QTGetTimeInterval(t, &res)) {return nil;}
82+
83+ res -= [[NSTimeZone systemTimeZone] secondsFromGMT];
84+
85+ return [NSDate dateWithTimeIntervalSince1970:res];
86+}
87+//- (id)reverseTransformedValue:(id)value
88+//{
89+// if(!value) return nil;
90+//
91+// static first = YES;
92+// if(first) {
93+// first = NO;
94+// NSLog(@"%@ in value class -> %@", NSStringFromSelector(_cmd), NSStringFromClass([value class]));
95+// NSLog(@"value -> %@", value);
96+// }
97+// NSTimeInterval val = [value timeIntervalSinceReferenceDate];
98+// val += [[NSTimeZone systemTimeZone] secondsFromGMT];
99+// QTTime t = QTMakeTimeWithTimeInterval(val);
100+//
101+// return [NSValue valueWithQTTime:t];
102+//}
103+@end
\ No newline at end of file
Afficher sur ancien navigateur de dépôt.