diff --git a/AppController.h b/AppController.h index 055c31295..ef09b4fd5 100644 --- a/AppController.h +++ b/AppController.h @@ -30,6 +30,9 @@ - (void)openPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo; +- (IBAction)sortByPath:(id)sender; +- (IBAction)shufflePlaylist:(id)sender; + - (IBAction)donate:(id)sender; - (IBAction)toggleInfoDrawer:(id)sender; diff --git a/AppController.m b/AppController.m index 25390f697..36ee678ee 100644 --- a/AppController.m +++ b/AppController.m @@ -166,6 +166,16 @@ [infoButton setState:NSOffState]; } +- (IBAction)sortByPath:(id)sender +{ + [playlistController sortByPath]; +} + +- (IBAction)shufflePlaylist:(id)sender +{ + [playlistController randomizeList]; +} + - (IBAction)donate:(id)sender { [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://sourceforge.net/project/project_donations.php?group_id=140003"]]; diff --git a/Custom/RoundBackgroundCell.m b/Custom/RoundBackgroundCell.m index 446d7cc43..2880b62d6 100644 --- a/Custom/RoundBackgroundCell.m +++ b/Custom/RoundBackgroundCell.m @@ -58,10 +58,10 @@ // Might want to change the text color here // NSColor *originalTextColor = [self textColor]; if (highlightPath) { - [[self backgroundColor] set]; + [[[NSColor controlAlternatingRowBackgroundColors] objectAtIndex:1] set]; [highlightPath fill]; - NSColor *strokeColor = [NSColor colorWithCalibratedHue:[[self backgroundColor] hueComponent] saturation:[[self backgroundColor] saturationComponent] brightness:[[self backgroundColor] brightnessComponent]-0.2 alpha:[[self backgroundColor] alphaComponent]]; + NSColor *strokeColor = [NSColor secondarySelectedControlColor]; [strokeColor set]; [highlightPath stroke]; diff --git a/English.lproj/MainMenu.nib/classes.nib b/English.lproj/MainMenu.nib/classes.nib index b0861c055..68e562703 100644 --- a/English.lproj/MainMenu.nib/classes.nib +++ b/English.lproj/MainMenu.nib/classes.nib @@ -8,6 +8,8 @@ loadPlaylist = id; savePlaylist = id; savePlaylistAs = id; + shufflePlaylist = id; + sortByPath = id; toggleInfoDrawer = id; }; CLASS = AppController; @@ -50,7 +52,7 @@ }, {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, {CLASS = InfoController; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, - {CLASS = InfoView; LANGUAGE = ObjC; SUPERCLASS = NSView; }, + {CLASS = InfoView; LANGUAGE = ObjC; SUPERCLASS = NSScrollView; }, {CLASS = NSSegmentedControl; LANGUAGE = ObjC; SUPERCLASS = NSControl; }, { ACTIONS = { diff --git a/English.lproj/MainMenu.nib/info.nib b/English.lproj/MainMenu.nib/info.nib index 2324eaec5..4cd5a855d 100644 --- a/English.lproj/MainMenu.nib/info.nib +++ b/English.lproj/MainMenu.nib/info.nib @@ -3,13 +3,13 @@ IBDocumentLocation - 273 33 617 240 0 0 1024 746 + 34 369 617 240 0 0 1024 746 IBEditorPositions 29 - 649 654 346 44 0 0 1024 746 + 98 651 409 44 0 0 1024 746 463 - 336 384 352 268 0 0 1024 746 + 358 426 308 187 0 0 1024 746 513 639 190 125 137 0 0 1024 746 @@ -28,10 +28,11 @@ 3 IBOpenObjects - 29 - 21 - 513 823 + 513 + 21 + 463 + 29 IBSystem Version 8I127 diff --git a/English.lproj/MainMenu.nib/keyedobjects.nib b/English.lproj/MainMenu.nib/keyedobjects.nib index 930b2becf..39429861e 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 7ca84f8c1..9848892fb 100644 --- a/Playlist/PlaylistController.m +++ b/Playlist/PlaylistController.m @@ -161,7 +161,9 @@ - (void)tableView:(NSTableView *)tableView didClickTableColumn:(NSTableColumn *)tableColumn { - NSLog(@"SORTING"); + if (shuffle == YES) + [self resetShuffleList]; + [self updateIndexesFromRow:0]; } @@ -287,6 +289,28 @@ [a release]; } +- (void)sortByPath +{ + NSSortDescriptor *s = [[NSSortDescriptor alloc] initWithKey:@"filename" ascending:YES selector:@selector(compare:)]; + [self setSortDescriptors:[NSArray arrayWithObject:s]]; + [s release]; + + if (shuffle == YES) + [self resetShuffleList]; + + [self updateIndexesFromRow:0]; +} + +- (void)randomizeList +{ + [self setSortDescriptors:nil]; + [self setContent:[Shuffle shuffleList:[self content]]]; + if (shuffle == YES) + [self resetShuffleList]; + + [self updateIndexesFromRow:0]; +} + - (IBAction)takeShuffleFromObject:(id)sender { if( [sender respondsToSelector: @selector(boolValue)] ) diff --git a/Playlist/PlaylistEntry.m b/Playlist/PlaylistEntry.m index f7cde13bc..9cf63438d 100644 --- a/Playlist/PlaylistEntry.m +++ b/Playlist/PlaylistEntry.m @@ -283,9 +283,14 @@ [self setGenre:nil]; if ([artist isEqualToString:@""] || [title isEqualToString:@""]) + { [self setDisplay:[filename lastPathComponent]]; + [self setTitle:[filename lastPathComponent]]; + } else + { [self setDisplay:[NSString stringWithFormat:@"%@ - %@", artist, title]]; + } taglib_tag_free_strings(); } @@ -295,6 +300,7 @@ else { [self setDisplay:[filename lastPathComponent]]; + [self setTitle:[filename lastPathComponent]]; } }