2005-06-02 18:16:43 +00:00
|
|
|
//
|
|
|
|
// PlaylistView.m
|
|
|
|
// Cog
|
|
|
|
//
|
|
|
|
// Created by Vincent Spader on 3/20/05.
|
2005-07-02 21:02:06 +00:00
|
|
|
// Copyright 2005 Vincent Spader All rights reserved.
|
2005-06-02 18:16:43 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#import "PlaylistView.h"
|
|
|
|
|
2021-02-19 05:23:13 +00:00
|
|
|
#import <Carbon/Carbon.h>
|
|
|
|
|
2008-02-16 19:40:34 +00:00
|
|
|
#import "PlaylistEntry.h"
|
2007-03-14 02:28:30 +00:00
|
|
|
|
2008-02-23 22:20:14 +00:00
|
|
|
#import "CogAudio/Status.h"
|
|
|
|
|
2013-10-13 05:08:34 +00:00
|
|
|
#import "Logging.h"
|
|
|
|
|
2005-06-02 18:16:43 +00:00
|
|
|
@implementation PlaylistView
|
|
|
|
|
2021-01-30 23:14:08 +00:00
|
|
|
- (void)awakeFromNib {
|
2022-02-07 05:49:27 +00:00
|
|
|
[[self menu] setAutoenablesItems:NO];
|
|
|
|
|
|
|
|
// Configure bindings to scale font size and row height
|
|
|
|
NSControlSize s = NSControlSizeSmall;
|
|
|
|
NSFont *f = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:s]];
|
|
|
|
// NSFont *bf = [[NSFontManager sharedFontManager] convertFont:f toHaveTrait:NSBoldFontMask];
|
|
|
|
|
|
|
|
NSArray<NSTableColumn *> *columns = [[NSSet setWithArray:[self tableColumns]] allObjects];
|
|
|
|
|
|
|
|
if([columns count] < [[self tableColumns] count]) {
|
|
|
|
// borkage in saved state
|
|
|
|
NSArray<NSTableColumn *> *borkCols = [[self tableColumns] copy];
|
|
|
|
for(NSTableColumn *col in borkCols) {
|
|
|
|
[self removeTableColumn:col];
|
|
|
|
}
|
|
|
|
for(NSTableColumn *col in columns) {
|
|
|
|
[self addTableColumn:col];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for(NSTableColumn *col in columns) {
|
|
|
|
[[col dataCell] setControlSize:s];
|
|
|
|
[[col dataCell] setFont:f];
|
|
|
|
}
|
|
|
|
|
|
|
|
[self setVerticalMotionCanBeginDrag:YES];
|
|
|
|
|
|
|
|
// Set up header context menu
|
2022-06-18 23:10:18 +00:00
|
|
|
headerContextMenu = [[NSMenu alloc] initWithTitle:NSLocalizedString(@"PlaylistHeaderContextMenuTitle", @"")];
|
2022-02-07 05:49:27 +00:00
|
|
|
|
|
|
|
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"identifier"
|
|
|
|
ascending:YES];
|
|
|
|
NSArray *sortDescriptors = @[sortDescriptor];
|
|
|
|
|
|
|
|
int visibleTableColumns = 0;
|
|
|
|
int menuIndex = 0;
|
|
|
|
for(NSTableColumn *col in [columns sortedArrayUsingDescriptors:sortDescriptors]) {
|
|
|
|
NSString *title;
|
|
|
|
if([[col identifier] isEqualToString:@"status"]) {
|
2022-06-18 23:10:18 +00:00
|
|
|
title = NSLocalizedString(@"PlaylistStatusColumn", @"");
|
2022-02-07 05:49:27 +00:00
|
|
|
} else if([[col identifier] isEqualToString:@"index"]) {
|
2022-06-18 23:10:18 +00:00
|
|
|
title = NSLocalizedString(@"PlaylistIndexColumn", @"");
|
2022-02-07 05:49:27 +00:00
|
|
|
} else {
|
|
|
|
title = [[col headerCell] title];
|
|
|
|
}
|
|
|
|
|
|
|
|
NSMenuItem *contextMenuItem =
|
|
|
|
[headerContextMenu insertItemWithTitle:title
|
|
|
|
action:@selector(toggleColumn:)
|
|
|
|
keyEquivalent:@""
|
|
|
|
atIndex:menuIndex];
|
|
|
|
|
|
|
|
[contextMenuItem setTarget:self];
|
|
|
|
[contextMenuItem setRepresentedObject:col];
|
|
|
|
[contextMenuItem setState:([col isHidden] ? NSControlStateValueOff : NSControlStateValueOn)];
|
|
|
|
|
|
|
|
visibleTableColumns += ![col isHidden];
|
|
|
|
menuIndex++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(visibleTableColumns == 0) {
|
|
|
|
for(NSTableColumn *col in columns) {
|
|
|
|
[col setHidden:NO];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
[[self headerView] setMenu:headerContextMenu];
|
2006-06-19 00:39:41 +00:00
|
|
|
}
|
|
|
|
|
2021-01-30 23:14:08 +00:00
|
|
|
- (IBAction)toggleColumn:(id)sender {
|
2022-02-07 05:49:27 +00:00
|
|
|
id tc = [sender representedObject];
|
2021-01-30 23:14:08 +00:00
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
if([sender state] == NSControlStateValueOff) {
|
|
|
|
[sender setState:NSControlStateValueOn];
|
2021-01-30 23:14:08 +00:00
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
[tc setHidden:NO];
|
|
|
|
} else {
|
|
|
|
[sender setState:NSControlStateValueOff];
|
2021-01-30 23:14:08 +00:00
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
[tc setHidden:YES];
|
|
|
|
}
|
2006-06-19 00:39:41 +00:00
|
|
|
}
|
|
|
|
|
2021-01-30 23:14:08 +00:00
|
|
|
- (BOOL)acceptsFirstResponder {
|
2022-02-07 05:49:27 +00:00
|
|
|
return YES;
|
2005-06-02 18:16:43 +00:00
|
|
|
}
|
2007-02-18 18:59:23 +00:00
|
|
|
|
2021-01-30 23:14:08 +00:00
|
|
|
- (BOOL)resignFirstResponder {
|
2022-02-07 05:49:27 +00:00
|
|
|
return YES;
|
2005-06-02 18:16:43 +00:00
|
|
|
}
|
|
|
|
|
2021-01-30 23:14:08 +00:00
|
|
|
- (BOOL)acceptsFirstMouse:(NSEvent *)mouseDownEvent {
|
2022-06-28 08:55:30 +00:00
|
|
|
return YES;
|
2005-06-30 17:46:07 +00:00
|
|
|
}
|
|
|
|
|
2021-01-30 23:14:08 +00:00
|
|
|
- (void)mouseDown:(NSEvent *)e {
|
2022-02-07 05:49:27 +00:00
|
|
|
[super mouseDown:e];
|
2021-01-30 23:14:08 +00:00
|
|
|
|
2022-06-28 08:55:30 +00:00
|
|
|
if([e type] == NSEventTypeLeftMouseDown) {
|
|
|
|
if([e clickCount] == 1) {
|
|
|
|
NSPoint globalLocation = [e locationInWindow];
|
|
|
|
NSPoint localLocation = [self convertPoint:globalLocation fromView:nil];
|
|
|
|
NSInteger clickedRow = [self rowAtPoint:localLocation];
|
|
|
|
NSInteger clickedColumn = [self columnAtPoint:localLocation];
|
|
|
|
|
|
|
|
if(clickedRow != -1 && clickedColumn != -1) {
|
|
|
|
NSView *cellView = [self viewAtColumn:clickedColumn row:clickedRow makeIfNecessary:YES];
|
|
|
|
NSPoint cellPoint = [cellView convertPoint:localLocation fromView:self];
|
|
|
|
|
|
|
|
[playlistController tableView:self didClickRow:clickedRow column:clickedColumn atPoint:cellPoint];
|
|
|
|
}
|
|
|
|
} else if([e clickCount] == 2 && [[self selectedRowIndexes] count] == 1) {
|
|
|
|
[playbackController play:self];
|
|
|
|
}
|
2022-02-07 05:49:27 +00:00
|
|
|
}
|
2005-06-02 18:16:43 +00:00
|
|
|
}
|
|
|
|
|
2006-05-23 15:12:24 +00:00
|
|
|
// enables right-click selection for "Show in Finder" contextual menu
|
2021-01-30 23:14:08 +00:00
|
|
|
- (NSMenu *)menuForEvent:(NSEvent *)event {
|
2022-02-07 05:49:27 +00:00
|
|
|
// Find which row is under the cursor
|
|
|
|
[[self window] makeFirstResponder:self];
|
|
|
|
NSPoint menuPoint = [self convertPoint:[event locationInWindow] fromView:nil];
|
|
|
|
NSInteger iRow = [self rowAtPoint:menuPoint];
|
|
|
|
NSMenu *tableViewMenu = [self menu];
|
|
|
|
|
|
|
|
/* Update the table selection before showing menu
|
|
|
|
Preserves the selection if the row under the mouse is selected (to allow for
|
|
|
|
multiple items to be selected), otherwise selects the row under the mouse */
|
|
|
|
BOOL currentRowIsSelected = [[self selectedRowIndexes] containsIndex:(NSUInteger)iRow];
|
|
|
|
if(!currentRowIsSelected) {
|
|
|
|
if(iRow == -1) {
|
|
|
|
[self deselectAll:self];
|
|
|
|
} else {
|
|
|
|
[self selectRowIndexes:[NSIndexSet indexSetWithIndex:(NSUInteger)iRow] byExtendingSelection:NO];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if([self numberOfSelectedRows] <= 0) {
|
|
|
|
// No rows are selected, so the table should be displayed with all items disabled
|
|
|
|
int i;
|
|
|
|
for(i = 0; i < [tableViewMenu numberOfItems]; i++) {
|
|
|
|
[[tableViewMenu itemAtIndex:i] setEnabled:NO];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return tableViewMenu;
|
2006-05-23 15:12:24 +00:00
|
|
|
}
|
|
|
|
|
2021-02-19 05:23:13 +00:00
|
|
|
- (void)keyDown:(NSEvent *)event {
|
2022-02-07 05:49:27 +00:00
|
|
|
BOOL modifiersUsed = ([event modifierFlags] & (NSEventModifierFlagShift |
|
|
|
|
NSEventModifierFlagControl |
|
|
|
|
NSEventModifierFlagOption |
|
|
|
|
NSEventModifierFlagCommand)) ?
|
|
|
|
YES :
|
|
|
|
NO;
|
|
|
|
if(modifiersUsed) {
|
|
|
|
[super keyDown:event];
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch([event keyCode]) {
|
|
|
|
case kVK_Space:
|
|
|
|
[playbackController playPauseResume:self];
|
|
|
|
break;
|
|
|
|
case kVK_Escape:
|
|
|
|
[playlistController clearFilterPredicate:self];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case kVK_Delete:
|
|
|
|
case kVK_ForwardDelete:
|
|
|
|
[playlistController remove:self];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case kVK_LeftArrow:
|
|
|
|
[playbackController eventSeekBackward:self];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case kVK_RightArrow:
|
|
|
|
[playbackController eventSeekForward:self];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case kVK_Return:
|
|
|
|
[playbackController play:self];
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
[super keyDown:event];
|
|
|
|
break;
|
|
|
|
}
|
2005-06-02 18:16:43 +00:00
|
|
|
}
|
|
|
|
|
2021-01-30 23:14:08 +00:00
|
|
|
- (IBAction)scrollToCurrentEntry:(id)sender {
|
2022-02-07 05:49:27 +00:00
|
|
|
[self scrollRowToVisible:[[playlistController currentEntry] index]];
|
|
|
|
[self selectRowIndexes:[NSIndexSet indexSetWithIndex:(NSUInteger)[[playlistController currentEntry] index]]
|
|
|
|
byExtendingSelection:NO];
|
2007-05-26 14:09:03 +00:00
|
|
|
}
|
|
|
|
|
2021-01-30 23:14:08 +00:00
|
|
|
- (IBAction)undo:(id)sender {
|
2022-02-07 05:49:27 +00:00
|
|
|
[[playlistController undoManager] undo];
|
2008-02-10 17:13:30 +00:00
|
|
|
}
|
|
|
|
|
2021-01-30 23:14:08 +00:00
|
|
|
- (IBAction)redo:(id)sender {
|
2022-02-07 05:49:27 +00:00
|
|
|
[[playlistController undoManager] redo];
|
2008-02-10 17:13:30 +00:00
|
|
|
}
|
|
|
|
|
2021-01-30 23:14:08 +00:00
|
|
|
- (IBAction)copy:(id)sender {
|
2022-02-07 05:49:27 +00:00
|
|
|
NSPasteboard *pboard = [NSPasteboard generalPasteboard];
|
|
|
|
[pboard clearContents];
|
|
|
|
|
|
|
|
NSArray *entries =
|
|
|
|
[[playlistController content] objectsAtIndexes:[playlistController selectionIndexes]];
|
|
|
|
NSUInteger capacity = [entries count];
|
|
|
|
NSMutableArray *selectedURLs = [NSMutableArray arrayWithCapacity:capacity];
|
|
|
|
|
2022-06-16 14:18:28 +00:00
|
|
|
NSMutableArray *fileSpams = [NSMutableArray array];
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
for(PlaylistEntry *pe in entries) {
|
2022-06-16 14:14:33 +00:00
|
|
|
[selectedURLs addObject:pe.url];
|
2022-06-16 14:18:28 +00:00
|
|
|
[fileSpams addObject:pe.indexedSpam];
|
2022-02-07 05:49:27 +00:00
|
|
|
}
|
|
|
|
|
2022-06-16 14:18:28 +00:00
|
|
|
[pboard writeObjects:@[[fileSpams componentsJoinedByString:@"\n"]]];
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
NSError *error;
|
2022-06-23 05:54:32 +00:00
|
|
|
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:selectedURLs
|
|
|
|
requiringSecureCoding:YES
|
|
|
|
error:&error];
|
2022-02-07 05:49:27 +00:00
|
|
|
|
|
|
|
if(!data) {
|
|
|
|
DLog(@"Error: %@", error);
|
|
|
|
}
|
|
|
|
[pboard setData:data forType:CogUrlsPboardType];
|
|
|
|
|
|
|
|
NSMutableDictionary *tracks = [NSMutableDictionary dictionaryWithCapacity:capacity];
|
|
|
|
|
|
|
|
unsigned long i = 0;
|
|
|
|
for(NSURL *url in selectedURLs) {
|
|
|
|
tracks[[NSString stringWithFormat:@"%lu", i++]] = @{ @"Location": [url absoluteString] };
|
|
|
|
}
|
|
|
|
|
|
|
|
NSDictionary *itunesPlist = @{ @"Tracks": tracks };
|
|
|
|
|
|
|
|
[pboard setPropertyList:itunesPlist forType:iTunesDropType];
|
|
|
|
|
|
|
|
NSMutableArray *filePaths = [NSMutableArray array];
|
|
|
|
|
|
|
|
for(NSURL *url in selectedURLs) {
|
|
|
|
if([url isFileURL]) {
|
|
|
|
[filePaths addObject:url];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if([filePaths count]) {
|
|
|
|
[pboard writeObjects:filePaths];
|
|
|
|
}
|
2013-10-13 05:08:34 +00:00
|
|
|
}
|
|
|
|
|
2021-01-30 23:14:08 +00:00
|
|
|
- (IBAction)cut:(id)sender {
|
2022-02-07 05:49:27 +00:00
|
|
|
[self copy:sender];
|
2021-01-30 23:14:08 +00:00
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
[playlistController removeObjectsAtArrangedObjectIndexes:[playlistController selectionIndexes]];
|
2021-01-30 23:14:08 +00:00
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
if([playlistController shuffle] != ShuffleOff) [playlistController resetShuffleList];
|
2013-10-13 05:08:34 +00:00
|
|
|
}
|
|
|
|
|
2021-01-30 23:14:08 +00:00
|
|
|
- (IBAction)paste:(id)sender {
|
2022-02-07 05:49:27 +00:00
|
|
|
// Determine the type of object that was dropped
|
2022-06-23 05:54:32 +00:00
|
|
|
NSArray *supportedTypes = @[CogUrlsPboardType, NSPasteboardTypeFileURL, iTunesDropType];
|
2022-02-07 05:49:27 +00:00
|
|
|
NSPasteboard *pboard = [NSPasteboard generalPasteboard];
|
|
|
|
NSPasteboardType bestType = [pboard availableTypeFromArray:supportedTypes];
|
2021-04-30 01:16:24 +00:00
|
|
|
#ifdef _DEBUG
|
2022-02-07 05:49:27 +00:00
|
|
|
DLog(@"All types:");
|
|
|
|
for(NSPasteboardType type in [pboard types]) {
|
|
|
|
DLog(@" Type: %@", type);
|
|
|
|
}
|
|
|
|
DLog(@"Supported types:");
|
|
|
|
for(NSPasteboardType type in supportedTypes) {
|
|
|
|
DLog(@" Type: %@", type);
|
|
|
|
}
|
|
|
|
DLog(@"Best type: %@", bestType);
|
2021-04-30 01:16:24 +00:00
|
|
|
#endif
|
2021-01-30 23:14:08 +00:00
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
NSMutableArray *acceptedURLs = [NSMutableArray array];
|
|
|
|
|
|
|
|
// Get files from an file drawer drop
|
|
|
|
if([bestType isEqualToString:CogUrlsPboardType]) {
|
|
|
|
NSError *error;
|
|
|
|
NSData *data = [pboard dataForType:CogUrlsPboardType];
|
|
|
|
NSArray *urls;
|
|
|
|
if(@available(macOS 11.0, *)) {
|
|
|
|
urls = [NSKeyedUnarchiver unarchivedArrayOfObjectsOfClass:[NSURL class]
|
|
|
|
fromData:data
|
|
|
|
error:&error];
|
|
|
|
} else {
|
2022-06-23 05:54:32 +00:00
|
|
|
NSSet *allowed = [NSSet setWithArray:@[[NSArray class], [NSURL class]]];
|
|
|
|
urls = [NSKeyedUnarchiver unarchivedObjectOfClasses:allowed
|
|
|
|
fromData:data
|
|
|
|
error:&error];
|
2022-02-07 05:49:27 +00:00
|
|
|
}
|
|
|
|
if(!urls) {
|
|
|
|
DLog(@"%@", error);
|
|
|
|
} else {
|
|
|
|
DLog(@"URLS: %@", urls);
|
|
|
|
}
|
|
|
|
//[playlistLoader insertURLs: urls atIndex:row sort:YES];
|
|
|
|
[acceptedURLs addObjectsFromArray:urls];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get files from a normal file drop (such as from Finder)
|
2022-06-23 05:54:32 +00:00
|
|
|
if([bestType isEqualToString:NSPasteboardTypeFileURL]) {
|
2022-02-07 05:49:27 +00:00
|
|
|
NSMutableArray *urls = [[NSMutableArray alloc] init];
|
|
|
|
|
2022-06-23 05:54:32 +00:00
|
|
|
for(NSString *file in [pboard propertyListForType:NSPasteboardTypeFileURL]) {
|
2022-02-07 05:49:27 +00:00
|
|
|
[urls addObject:[NSURL fileURLWithPath:file]];
|
|
|
|
}
|
|
|
|
|
|
|
|
//[playlistLoader insertURLs:urls atIndex:row sort:YES];
|
|
|
|
[acceptedURLs addObjectsFromArray:urls];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get files from an iTunes drop
|
|
|
|
if([bestType isEqualToString:iTunesDropType]) {
|
|
|
|
NSDictionary *iTunesDict = [pboard propertyListForType:iTunesDropType];
|
|
|
|
NSDictionary *tracks = [iTunesDict valueForKey:@"Tracks"];
|
|
|
|
|
|
|
|
// Convert the iTunes URLs to URLs....MWAHAHAH!
|
|
|
|
NSMutableArray *urls = [[NSMutableArray alloc] init];
|
|
|
|
|
|
|
|
for(NSDictionary *trackInfo in [tracks allValues]) {
|
|
|
|
[urls addObject:[NSURL URLWithString:[trackInfo valueForKey:@"Location"]]];
|
|
|
|
}
|
|
|
|
|
|
|
|
//[playlistLoader insertURLs:urls atIndex:row sort:YES];
|
|
|
|
[acceptedURLs addObjectsFromArray:urls];
|
|
|
|
}
|
|
|
|
|
|
|
|
if([acceptedURLs count]) {
|
|
|
|
NSUInteger row = [[playlistController content] count];
|
|
|
|
|
2022-07-06 21:28:14 +00:00
|
|
|
NSDictionary *loadEntriesData = @{ @"entries": acceptedURLs,
|
|
|
|
@"index": @(row),
|
|
|
|
@"sort": @(NO),
|
|
|
|
@"origin": @(URLOriginInternal) };
|
2022-02-07 05:49:27 +00:00
|
|
|
|
2022-07-06 21:28:14 +00:00
|
|
|
[playlistController performSelectorInBackground:@selector(insertURLsInBackground:) withObject:loadEntriesData];
|
2022-02-07 05:49:27 +00:00
|
|
|
}
|
2013-10-13 05:08:34 +00:00
|
|
|
}
|
|
|
|
|
2021-01-30 23:14:08 +00:00
|
|
|
- (IBAction)delete:(id)sender {
|
2022-02-07 05:49:27 +00:00
|
|
|
[playlistController removeObjectsAtArrangedObjectIndexes:[playlistController selectionIndexes]];
|
2013-10-13 05:08:34 +00:00
|
|
|
}
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)anItem {
|
|
|
|
SEL action = [anItem action];
|
|
|
|
|
|
|
|
if(action == @selector(undo:)) {
|
|
|
|
return [[playlistController undoManager] canUndo];
|
|
|
|
}
|
|
|
|
if(action == @selector(redo:)) {
|
|
|
|
return [[playlistController undoManager] canRedo];
|
|
|
|
}
|
|
|
|
if(action == @selector(cut:) || action == @selector(copy:) || action == @selector(delete:)) {
|
|
|
|
return [[playlistController selectionIndexes] count] != 0;
|
|
|
|
}
|
|
|
|
if(action == @selector(paste:)) {
|
|
|
|
NSPasteboard *pboard = [NSPasteboard generalPasteboard];
|
|
|
|
|
2022-06-23 05:54:32 +00:00
|
|
|
NSArray *supportedTypes = @[CogUrlsPboardType, NSPasteboardTypeFileURL, iTunesDropType];
|
2022-02-07 05:49:27 +00:00
|
|
|
|
|
|
|
NSString *bestType = [pboard availableTypeFromArray:supportedTypes];
|
|
|
|
|
|
|
|
return bestType != nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(action == @selector(scrollToCurrentEntry:) &&
|
|
|
|
(([playbackController playbackStatus] == CogStatusStopped) ||
|
|
|
|
([playbackController playbackStatus] == CogStatusStopping)))
|
|
|
|
return NO;
|
|
|
|
|
|
|
|
return [super validateUserInterfaceItem:anItem];
|
2008-02-10 17:13:30 +00:00
|
|
|
}
|
|
|
|
|
2022-02-09 03:56:39 +00:00
|
|
|
- (IBAction)refreshCurrentTrack:(id)sender {
|
2022-06-17 17:24:45 +00:00
|
|
|
[self refreshTrack:[playlistController currentEntry]];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (IBAction)refreshTrack:(id)sender {
|
|
|
|
PlaylistEntry *pe = (PlaylistEntry *)sender;
|
2022-06-17 17:25:27 +00:00
|
|
|
if(pe && !pe.deLeted) {
|
|
|
|
unsigned long columns = [[self tableColumns] count];
|
|
|
|
[self reloadDataForRowIndexes:[NSIndexSet indexSetWithIndex:pe.index] columnIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, columns)]];
|
|
|
|
}
|
2022-02-09 03:56:39 +00:00
|
|
|
}
|
|
|
|
|
2018-06-28 10:59:59 +00:00
|
|
|
#if 0
|
2008-02-24 15:47:04 +00:00
|
|
|
- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal
|
|
|
|
{
|
2021-01-27 02:30:19 +00:00
|
|
|
if (isLocal)
|
|
|
|
return NSDragOperationNone;
|
|
|
|
else
|
|
|
|
return NSDragOperationCopy;
|
2008-02-24 15:47:04 +00:00
|
|
|
}
|
2018-06-28 10:59:59 +00:00
|
|
|
#endif
|
2008-02-24 15:47:04 +00:00
|
|
|
|
2005-06-02 18:16:43 +00:00
|
|
|
@end
|