-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
vspader
committed
Jun 2, 2005
0 parents
commit 655c5d7
Showing
997 changed files
with
348,887 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* AppController */ | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
#import "PlaylistController.h" | ||
|
||
@interface AppController : NSObject | ||
{ | ||
IBOutlet PlaylistController *playlistController; | ||
IBOutlet NSPanel *infoPanel; | ||
IBOutlet NSWindow *mainWindow; | ||
} | ||
- (IBAction)addFiles:(id)sender; | ||
- (IBAction)delEntries:(id)sender; | ||
- (IBAction)showInfo:(id)sender; | ||
- (IBAction)savePlaylist:(id)sender; | ||
- (IBAction)savePlaylistAs:(id)sender; | ||
- (IBAction)loadPlaylist:(id)sender; | ||
|
||
- (void)openPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo; | ||
|
||
//Fun stuff | ||
- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag; | ||
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename; | ||
- (void)application:(NSApplication *)theApplication openFiles:(NSArray *)filenames; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
#import "AppController.h" | ||
|
||
@implementation AppController | ||
|
||
- (IBAction)addFiles:(id)sender | ||
{ | ||
NSOpenPanel *p; | ||
|
||
p = [NSOpenPanel openPanel]; | ||
|
||
[p setCanChooseDirectories:YES]; | ||
[p setAllowsMultipleSelection:YES]; | ||
|
||
// [p beginSheetForDirectory:nil file:nil types:[`listController acceptableFileTypes] modalForWindow:mainWindow modalDelegate:self didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL]; | ||
// [p beginForDirectory:nil file:nil types:[playlistController acceptableFileTypes] modelessDelegate:self didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:nil]; | ||
|
||
if ([p runModalForTypes:[playlistController acceptableFileTypes]] == NSOKButton) | ||
{ | ||
[playlistController addPaths:[p filenames] sort:NO]; | ||
} | ||
|
||
} | ||
|
||
- (void)openPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo | ||
{ | ||
if (returnCode == NSOKButton) | ||
{ | ||
[playlistController addPaths:[panel filenames] sort:NO]; | ||
} | ||
|
||
[panel release]; | ||
} | ||
|
||
- (IBAction)delEntries:(id)sender | ||
{ | ||
[playlistController remove:self]; | ||
} | ||
|
||
- (IBAction)showInfo:(id)sender | ||
{ | ||
[infoPanel makeKeyAndOrderFront:self]; | ||
} | ||
|
||
- (PlaylistEntry *)currentEntry | ||
{ | ||
return [playlistController currentEntry]; | ||
} | ||
|
||
- (BOOL)application:(NSApplication *)sender delegateHandlesKey:(NSString *)key | ||
{ | ||
// DBLog(@"W00t"); | ||
return [key isEqualToString:@"currentEntry"]; | ||
} | ||
|
||
- (void)awakeFromNib | ||
{ | ||
// DBLog(@"AWAKe"); | ||
NSString *filename = @"~/Library/Application Support/Cog/Default.playlist"; | ||
[playlistController loadPlaylist:[filename stringByExpandingTildeInPath]]; | ||
} | ||
|
||
- (void)applicationWillTerminate:(NSNotification *)aNotification | ||
{ | ||
// DBLog(@"QUITTING"); | ||
NSFileManager *fileManager = [NSFileManager defaultManager]; | ||
NSString *folder = @"~/Library/Application Support/Cog/"; | ||
|
||
folder = [folder stringByExpandingTildeInPath]; | ||
|
||
if ([fileManager fileExistsAtPath: folder] == NO) | ||
{ | ||
[fileManager createDirectoryAtPath: folder attributes: nil]; | ||
} | ||
|
||
NSString *fileName = @"Default.playlist"; | ||
|
||
[playlistController savePlaylist:[folder stringByAppendingPathComponent: fileName]]; | ||
|
||
} | ||
|
||
- (IBAction)savePlaylist:(id)sender | ||
{ | ||
if ([playlistController playlistFilename] == nil) | ||
[self savePlaylistAs:sender]; | ||
|
||
[playlistController savePlaylist:[playlistController playlistFilename]]; | ||
} | ||
- (IBAction)savePlaylistAs:(id)sender | ||
{ | ||
NSSavePanel *p; | ||
|
||
p = [NSSavePanel savePanel]; | ||
|
||
[p setAllowedFileTypes:[playlistController acceptablePlaylistTypes]]; | ||
|
||
if ([p runModalForDirectory:nil file:[[playlistController playlistFilename] lastPathComponent]] == NSOKButton) | ||
{ | ||
[playlistController setPlaylistFilename:[p filename]]; | ||
|
||
[playlistController savePlaylist:[p filename]]; | ||
} | ||
} | ||
- (IBAction)loadPlaylist:(id)sender | ||
{ | ||
NSOpenPanel *p; | ||
|
||
p = [NSOpenPanel openPanel]; | ||
|
||
[p setCanChooseDirectories:NO]; | ||
[p setAllowsMultipleSelection:NO]; | ||
|
||
if ([p runModalForTypes:[playlistController acceptablePlaylistTypes]] == NSOKButton) | ||
{ | ||
[playlistController setPlaylistFilename:[p filename]]; | ||
|
||
[playlistController loadPlaylist:[p filename]]; | ||
} | ||
} | ||
|
||
- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag | ||
{ | ||
// if (flag == NO) | ||
[mainWindow makeKeyAndOrderFront:self]; | ||
|
||
return NO; | ||
} | ||
|
||
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename | ||
{ | ||
if ([playlistController addPaths:[NSArray arrayWithObject:filename] sort:NO] != 1) | ||
return NO; | ||
|
||
return YES; | ||
} | ||
|
||
- (void)application:(NSApplication *)theApplication openFiles:(NSArray *)filenames | ||
{ | ||
[playlistController addPaths:filenames sort:YES]; | ||
[theApplication replyToOpenOrPrint:NSApplicationDelegateReplySuccess]; | ||
} | ||
|
||
@end |
Oops, something went wrong.