diff --git a/English.lproj/MainMenu.nib/info.nib b/English.lproj/MainMenu.nib/info.nib
index dff491ab7..fec6bb7dd 100644
--- a/English.lproj/MainMenu.nib/info.nib
+++ b/English.lproj/MainMenu.nib/info.nib
@@ -7,9 +7,11 @@
IBEditorPositions
1063
- 0 228 136 49 0 0 1024 746
+ 0 320 136 49 0 0 1680 1028
1156
719 527 241 366 0 0 1680 1028
+ 1324
+ 788 657 137 182 0 0 1680 1028
29
-3 975 383 44 0 0 1680 1028
463
@@ -33,11 +35,13 @@
IBOpenObjects
513
- 29
463
- 1156
+ 29
21
1307
+ 1063
+ 1156
+ 1324
IBSystem Version
8L2127
diff --git a/English.lproj/MainMenu.nib/keyedobjects.nib b/English.lproj/MainMenu.nib/keyedobjects.nib
index 8d48334cf..d8d8b164d 100644
Binary files a/English.lproj/MainMenu.nib/keyedobjects.nib and b/English.lproj/MainMenu.nib/keyedobjects.nib differ
diff --git a/Playlist/PlaylistController.m b/Playlist/PlaylistController.m
index 197ed881d..049f2133e 100644
--- a/Playlist/PlaylistController.m
+++ b/Playlist/PlaylistController.m
@@ -29,15 +29,6 @@
return self;
}
-- (void)awakeFromNib
-{
- [super awakeFromNib];
-
- NSNotificationCenter* ns = [NSNotificationCenter defaultCenter];
- [ns addObserver:self selector:@selector(handlePlaylistViewHeaderNotification:) name:@"PlaylistViewColumnSeparatorDoubleClick" object:nil];
-}
-
-
- (void)tableView:(NSTableView *)tableView
didClickTableColumn:(NSTableColumn *)tableColumn
{
@@ -457,63 +448,4 @@
[ws selectFile:[url path] inFileViewerRootedAtPath:[url path]];
}
-- (void)handlePlaylistViewHeaderNotification:(NSNotification*)notif
-{
- NSTableView *tv = [notif object];
- NSNumber *colIdx = [[notif userInfo] objectForKey:@"column"];
- NSTableColumn *col = [[tv tableColumns] objectAtIndex:[colIdx intValue]];
-
- //Change to use NSSelectorFromString and NSMethodSignature returnType, see http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_7.html for info
- //Maybe we can pull the column bindings out somehow, instead of selectorfromstring
-
- // find which function to call on PlaylistEntry*
- SEL sel;
- NSString* identifier = [col identifier];
- BOOL isNumeric = NO;
- if ([identifier compare:@"title"] == NSOrderedSame)
- sel = @selector(title);
- else if ([identifier compare:@"length"] == NSOrderedSame)
- sel = @selector(lengthString);
- else if ([identifier compare:@"index"] == NSOrderedSame) {
- sel = @selector(index);
- isNumeric = YES;
- }
- else if ([identifier compare:@"artist"] == NSOrderedSame)
- sel = @selector(artist);
- else if ([identifier compare:@"album"] == NSOrderedSame)
- sel = @selector(album);
- else if ([identifier compare:@"year"] == NSOrderedSame)
- sel = @selector(year);
- else if ([identifier compare:@"genre"] == NSOrderedSame)
- sel = @selector(genre);
- else if ([identifier compare:@"track"] == NSOrderedSame) {
- sel = @selector(track);
- isNumeric = YES;
- }
- else
- return;
-
- NSCell *cell = [col dataCell];
- NSAttributedString * as = [cell attributedStringValue];
-
- // find the longest string display length in that column
- NSArray *entries = [self arrangedObjects];
- NSEnumerator *enumerator = [entries objectEnumerator];
- PlaylistEntry *entry;
- float maxlength = -1;
- NSString *ret;
- while (entry = [enumerator nextObject]) {
- if (isNumeric)
- ret = [NSString stringWithFormat:@"%d", objc_msgSend(entry, sel)];
- else
- ret = objc_msgSend(entry, sel);
- if ([ret sizeWithAttributes:[as attributesAtIndex:0 effectiveRange:nil]].width > maxlength)
- maxlength = [ret sizeWithAttributes:[as attributesAtIndex:0 effectiveRange:nil]].width;
- }
-
-
- // set the new width (plus a 5 pixel extra to avoid "..." string substitution)
- [col setWidth:maxlength+5];
-}
-
@end
diff --git a/Playlist/PlaylistHeaderView.m b/Playlist/PlaylistHeaderView.m
index f0da31176..d2c3b84fa 100644
--- a/Playlist/PlaylistHeaderView.m
+++ b/Playlist/PlaylistHeaderView.m
@@ -33,12 +33,32 @@
clickedSeperator = YES;
if (clickedSeperator) {
+ NSTableColumn *col = [[[self tableView] tableColumns] objectAtIndex:column];
+
+ //Info about the font and such
+ NSCell *cell = [col dataCell];
+ NSAttributedString * as = [cell attributedStringValue];
+
+ //Binding info...reaching deep!
+ NSDictionary *bindingInfo = [col infoForBinding:@"value"];
+ NSArray *boundArray = [[bindingInfo objectForKey:NSObservedObjectKey] valueForKeyPath:[bindingInfo objectForKey:NSObservedKeyPathKey]];
- NSNotificationCenter *center;
- center = [NSNotificationCenter defaultCenter];
- [center postNotificationName: @"PlaylistViewColumnSeparatorDoubleClick" object:
- [self tableView] userInfo:
- [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:column],@"column", nil]];
+ //find the longest string display length in that column
+ float max_width = -1;
+ id row;
+ NSEnumerator *enumerator = [boundArray objectEnumerator];
+ while (row = [enumerator nextObject]) {
+ NSString *s = [row description];
+
+ float width = [s sizeWithAttributes:[as attributesAtIndex:0 effectiveRange:nil]].width;
+ if (width > max_width)
+ max_width = width;
+ }
+
+
+ // set the new width (plus a 5 pixel extra to avoid "..." string substitution)
+ [col setWidth:max_width+5];
+
}
else
[super mouseDown: theEvent];
@@ -47,4 +67,12 @@
[super mouseDown: theEvent];
}
+-(NSMenu*)menuForEvent:(NSEvent*)event
+{
+ NSString *hi = @"This is a test";
+ //Show a menu!
+ NSLog(@"MENU FOR HEADER!");
+
+ return nil;
+}
@end
diff --git a/TODO b/TODO
index 3ed7e7f57..569075b4e 100644
--- a/TODO
+++ b/TODO
@@ -1,2 +1,5 @@
-Changed SourceNode to BufferedSource. It's not really a node.
-Fix all plugins besides ogg vorbis (already fixed), so they use callbacks and the source.
+Make playlist table header menu, (See Play _streamTableHeaderContextMenu).
+Make PlaylistEntry numbers use NSNumber.
+Instead of LengthString, use a formatter.
+
+Add automatic header seperator without testing explicit types. Pull out binding? Perhaps the table column can do a objectAtIndex and then get a stringValue to get the width.
\ No newline at end of file