Hide/Show table columns through menu selection.
parent
838dd31a64
commit
2884273ff7
|
@ -3,6 +3,8 @@
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
#import "PlaylistController.h"
|
#import "PlaylistController.h"
|
||||||
|
#import "PlaylistView.h"
|
||||||
|
|
||||||
#import "FileTreeController.h"
|
#import "FileTreeController.h"
|
||||||
#import "NDHotKeyEvent.h"
|
#import "NDHotKeyEvent.h"
|
||||||
|
|
||||||
|
@ -10,10 +12,10 @@
|
||||||
@interface AppController : NSObject
|
@interface AppController : NSObject
|
||||||
{
|
{
|
||||||
IBOutlet PlaylistController *playlistController;
|
IBOutlet PlaylistController *playlistController;
|
||||||
|
|
||||||
IBOutlet NSPanel *mainWindow;
|
IBOutlet NSPanel *mainWindow;
|
||||||
|
|
||||||
IBOutlet NSButton *playButton;
|
IBOutlet NSButton *playButton;
|
||||||
IBOutlet NSButton *stopButton;
|
|
||||||
IBOutlet NSButton *prevButton;
|
IBOutlet NSButton *prevButton;
|
||||||
IBOutlet NSButton *nextButton;
|
IBOutlet NSButton *nextButton;
|
||||||
IBOutlet NSButton *addButton;
|
IBOutlet NSButton *addButton;
|
||||||
|
@ -28,6 +30,17 @@
|
||||||
|
|
||||||
IBOutlet FileTreeController *fileTreeController;
|
IBOutlet FileTreeController *fileTreeController;
|
||||||
|
|
||||||
|
IBOutlet PlaylistView *playlistView;
|
||||||
|
|
||||||
|
IBOutlet NSMenuItem *showIndexColumn;
|
||||||
|
IBOutlet NSMenuItem *showTitleColumn;
|
||||||
|
IBOutlet NSMenuItem *showArtistColumn;
|
||||||
|
IBOutlet NSMenuItem *showAlbumColumn;
|
||||||
|
IBOutlet NSMenuItem *showGenreColumn;
|
||||||
|
IBOutlet NSMenuItem *showLengthColumn;
|
||||||
|
IBOutlet NSMenuItem *showTrackColumn;
|
||||||
|
IBOutlet NSMenuItem *showYearColumn;
|
||||||
|
|
||||||
NDHotKeyEvent *playHotKey;
|
NDHotKeyEvent *playHotKey;
|
||||||
NDHotKeyEvent *prevHotKey;
|
NDHotKeyEvent *prevHotKey;
|
||||||
NDHotKeyEvent *nextHotKey;
|
NDHotKeyEvent *nextHotKey;
|
||||||
|
|
|
@ -73,13 +73,33 @@
|
||||||
return [key isEqualToString:@"currentEntry"];
|
return [key isEqualToString:@"currentEntry"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)initShowColumn:(NSMenuItem *)showColumn withIdentifier:(NSString *)identifier
|
||||||
|
{
|
||||||
|
id tc = [playlistView tableColumnWithIdentifier:identifier];
|
||||||
|
|
||||||
|
NSArray *visibleColumnIdentifiers = [[NSUserDefaults standardUserDefaults] objectForKey:[playlistView columnVisibilitySaveName]];
|
||||||
|
if (visibleColumnIdentifiers) {
|
||||||
|
NSEnumerator *enumerator = [visibleColumnIdentifiers objectEnumerator];
|
||||||
|
id column;
|
||||||
|
while (column = [enumerator nextObject]) {
|
||||||
|
if ([visibleColumnIdentifiers containsObject:identifier]) {
|
||||||
|
[showColumn setState:NSOnState];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
[showColumn setState:NSOffState];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[showColumn setRepresentedObject: tc];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)awakeFromNib
|
- (void)awakeFromNib
|
||||||
{
|
{
|
||||||
// [self initDefaults];
|
// [self initDefaults];
|
||||||
|
|
||||||
// DBLog(@"AWAKe");
|
// DBLog(@"AWAKe");
|
||||||
[playButton setToolTip:NSLocalizedString(@"PlayButtonTooltip", @"")];
|
[playButton setToolTip:NSLocalizedString(@"PlayButtonTooltip", @"")];
|
||||||
[stopButton setToolTip:NSLocalizedString(@"StopButtonTooltip", @"")];
|
|
||||||
[prevButton setToolTip:NSLocalizedString(@"PrevButtonTooltip", @"")];
|
[prevButton setToolTip:NSLocalizedString(@"PrevButtonTooltip", @"")];
|
||||||
[nextButton setToolTip:NSLocalizedString(@"NextButtonTooltip", @"")];
|
[nextButton setToolTip:NSLocalizedString(@"NextButtonTooltip", @"")];
|
||||||
[addButton setToolTip:NSLocalizedString(@"AddButtonTooltip", @"")];
|
[addButton setToolTip:NSLocalizedString(@"AddButtonTooltip", @"")];
|
||||||
|
@ -88,6 +108,15 @@
|
||||||
[shuffleButton setToolTip:NSLocalizedString(@"ShuffleButtonTooltip", @"")];
|
[shuffleButton setToolTip:NSLocalizedString(@"ShuffleButtonTooltip", @"")];
|
||||||
[repeatButton setToolTip:NSLocalizedString(@"RepeatButtonTooltip", @"")];
|
[repeatButton setToolTip:NSLocalizedString(@"RepeatButtonTooltip", @"")];
|
||||||
|
|
||||||
|
[self initShowColumn: showIndexColumn withIdentifier: @"index"];
|
||||||
|
[self initShowColumn: showTitleColumn withIdentifier: @"title"];
|
||||||
|
[self initShowColumn: showArtistColumn withIdentifier: @"artist"];
|
||||||
|
[self initShowColumn: showAlbumColumn withIdentifier: @"album"];
|
||||||
|
[self initShowColumn: showGenreColumn withIdentifier: @"genre"];
|
||||||
|
[self initShowColumn: showLengthColumn withIdentifier: @"length"];
|
||||||
|
[self initShowColumn: showTrackColumn withIdentifier: @"track"];
|
||||||
|
[self initShowColumn: showYearColumn withIdentifier: @"year"];
|
||||||
|
|
||||||
[self registerHotKeys];
|
[self registerHotKeys];
|
||||||
|
|
||||||
NSString *filename = @"~/Library/Application Support/Cog/Default.playlist";
|
NSString *filename = @"~/Library/Application Support/Cog/Default.playlist";
|
||||||
|
@ -274,7 +303,7 @@
|
||||||
|
|
||||||
[prevHotKey release];
|
[prevHotKey release];
|
||||||
prevHotKey = [[NDHotKeyEvent alloc]
|
prevHotKey = [[NDHotKeyEvent alloc]
|
||||||
initWithKeyCode: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyPreviousKeyCode"]
|
initWithKeyCode: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyPreviousKeyCode"]
|
||||||
character: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyPreviousCharacter"]
|
character: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyPreviousCharacter"]
|
||||||
modifierFlags: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyPreviousModifiers"]
|
modifierFlags: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyPreviousModifiers"]
|
||||||
];
|
];
|
||||||
|
@ -312,10 +341,5 @@
|
||||||
[nextButton performClick:nil];
|
[nextButton performClick:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)clickStop
|
|
||||||
{
|
|
||||||
[stopButton performClick:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -37,11 +37,19 @@
|
||||||
nextButton = NSButton;
|
nextButton = NSButton;
|
||||||
playButton = NSButton;
|
playButton = NSButton;
|
||||||
playlistController = PlaylistController;
|
playlistController = PlaylistController;
|
||||||
|
playlistView = PlaylistView;
|
||||||
prevButton = NSButton;
|
prevButton = NSButton;
|
||||||
remButton = NSButton;
|
remButton = NSButton;
|
||||||
repeatButton = NSButton;
|
repeatButton = NSButton;
|
||||||
|
showAlbumColumn = NSMenuItem;
|
||||||
|
showArtistColumn = NSMenuItem;
|
||||||
|
showGenreColumn = NSMenuItem;
|
||||||
|
showIndexColumn = NSMenuItem;
|
||||||
|
showLengthColumn = NSMenuItem;
|
||||||
|
showTitleColumn = NSMenuItem;
|
||||||
|
showTrackColumn = NSMenuItem;
|
||||||
|
showYearColumn = NSMenuItem;
|
||||||
shuffleButton = NSButton;
|
shuffleButton = NSButton;
|
||||||
stopButton = NSButton;
|
|
||||||
};
|
};
|
||||||
SUPERCLASS = NSObject;
|
SUPERCLASS = NSObject;
|
||||||
},
|
},
|
||||||
|
@ -118,18 +126,7 @@
|
||||||
},
|
},
|
||||||
{CLASS = PlaylistEntry; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
{CLASS = PlaylistEntry; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||||
{
|
{
|
||||||
ACTIONS = {
|
ACTIONS = {shufflePlaylist = id; sortByPath = id; toggleColumn = id; };
|
||||||
shufflePlaylist = id;
|
|
||||||
sortByPath = id;
|
|
||||||
toggleColumnForAlbum = id;
|
|
||||||
toggleColumnForArtist = id;
|
|
||||||
toggleColumnForGenre = id;
|
|
||||||
toggleColumnForIndex = id;
|
|
||||||
toggleColumnForLength = id;
|
|
||||||
toggleColumnForTitle = id;
|
|
||||||
toggleColumnForTrack = id;
|
|
||||||
toggleColumnForYear = id;
|
|
||||||
};
|
|
||||||
CLASS = PlaylistView;
|
CLASS = PlaylistView;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
OUTLETS = {
|
OUTLETS = {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>IBDocumentLocation</key>
|
<key>IBDocumentLocation</key>
|
||||||
<string>38 327 639 388 0 0 1024 746 </string>
|
<string>66 -65 639 388 0 0 1024 746 </string>
|
||||||
<key>IBEditorPositions</key>
|
<key>IBEditorPositions</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>1063</key>
|
<key>1063</key>
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
<key>1156</key>
|
<key>1156</key>
|
||||||
<string>233 341 241 366 0 0 1024 746 </string>
|
<string>233 341 241 366 0 0 1024 746 </string>
|
||||||
<key>29</key>
|
<key>29</key>
|
||||||
<string>73 702 383 44 0 0 1024 746 </string>
|
<string>85 683 383 44 0 0 1024 746 </string>
|
||||||
<key>463</key>
|
<key>463</key>
|
||||||
<string>358 380 308 279 0 0 1024 746 </string>
|
<string>358 380 308 279 0 0 1024 746 </string>
|
||||||
<key>513</key>
|
<key>513</key>
|
||||||
|
|
Binary file not shown.
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
#import "AppController.h"
|
|
||||||
#import "PlaybackController.h"
|
#import "PlaybackController.h"
|
||||||
#import "PlaylistController.h"
|
#import "PlaylistController.h"
|
||||||
|
|
||||||
|
@ -23,14 +22,7 @@
|
||||||
- (IBAction)sortByPath:(id)sender;
|
- (IBAction)sortByPath:(id)sender;
|
||||||
- (IBAction)shufflePlaylist:(id)sender;
|
- (IBAction)shufflePlaylist:(id)sender;
|
||||||
|
|
||||||
- (IBAction)toggleColumnForIndex:(id)sender;
|
- (IBAction)toggleColumn:(id)sender;
|
||||||
- (IBAction)toggleColumnForTitle:(id)sender;
|
|
||||||
- (IBAction)toggleColumnForArtist:(id)sender;
|
|
||||||
- (IBAction)toggleColumnForAlbum:(id)sender;
|
|
||||||
- (IBAction)toggleColumnForLength:(id)sender;
|
|
||||||
- (IBAction)toggleColumnForYear:(id)sender;
|
|
||||||
- (IBAction)toggleColumnForGenre:(id)sender;
|
|
||||||
- (IBAction)toggleColumnForTrack:(id)sender;
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -45,9 +45,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)toggleColumn:(id)sender withIdentifier:(NSString *)identifier
|
- (IBAction)toggleColumn:(id)sender
|
||||||
{
|
{
|
||||||
NSTableColumn *tc = [super tableColumnWithIdentifier:identifier];
|
id tc = [sender representedObject];
|
||||||
|
|
||||||
if ([sender state] == NSOffState)
|
if ([sender state] == NSOffState)
|
||||||
{
|
{
|
||||||
|
@ -62,47 +62,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)toggleColumnForIndex:(id)sender
|
|
||||||
{
|
|
||||||
[self toggleColumn:sender withIdentifier:@"index"];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)toggleColumnForTitle:(id)sender
|
|
||||||
{
|
|
||||||
[self toggleColumn:sender withIdentifier:@"title"];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)toggleColumnForArtist:(id)sender
|
|
||||||
{
|
|
||||||
[self toggleColumn:sender withIdentifier:@"artist"];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)toggleColumnForAlbum:(id)sender
|
|
||||||
{
|
|
||||||
[self toggleColumn:sender withIdentifier:@"album"];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)toggleColumnForLength:(id)sender
|
|
||||||
{
|
|
||||||
[self toggleColumn:sender withIdentifier:@"length"];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)toggleColumnForYear:(id)sender
|
|
||||||
{
|
|
||||||
[self toggleColumn:sender withIdentifier:@"year"];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)toggleColumnForGenre:(id)sender
|
|
||||||
{
|
|
||||||
[self toggleColumn:sender withIdentifier:@"genre"];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)toggleColumnForTrack:(id)sender
|
|
||||||
{
|
|
||||||
[self toggleColumn:sender withIdentifier:@"track"];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (BOOL)acceptsFirstResponder
|
- (BOOL)acceptsFirstResponder
|
||||||
{
|
{
|
||||||
return YES;
|
return YES;
|
||||||
|
|
Loading…
Reference in New Issue