2004-12-05 20:52:36 +00:00
|
|
|
/* GormSound.m
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 Free Software Foundation, Inc.
|
|
|
|
*
|
|
|
|
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
|
|
|
* Date: Dec 2004
|
|
|
|
*
|
|
|
|
* This file is part of GNUstep.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <Foundation/NSString.h>
|
|
|
|
#include <AppKit/NSSound.h>
|
2005-03-02 02:27:55 +00:00
|
|
|
#include <AppKit/NSImage.h>
|
2004-12-05 20:52:36 +00:00
|
|
|
#include "GormSound.h"
|
|
|
|
|
|
|
|
// sound proxy object...
|
|
|
|
@implementation GormSound
|
2004-12-07 05:23:00 +00:00
|
|
|
+ (GormSound*) soundForPath: (NSString *)aPath
|
2004-12-05 20:52:36 +00:00
|
|
|
{
|
2005-01-04 04:52:46 +00:00
|
|
|
return [GormSound soundForPath: aPath inWrapper: NO];
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (GormSound*) soundForPath: (NSString *)aPath inWrapper: (BOOL)flag
|
|
|
|
{
|
|
|
|
return AUTORELEASE([[GormSound alloc] initWithPath: aPath inWrapper: flag]);
|
2004-12-07 05:23:00 +00:00
|
|
|
}
|
|
|
|
|
2005-01-04 04:52:46 +00:00
|
|
|
- (id) initWithName: (NSString *)aName
|
|
|
|
path: (NSString *)aPath
|
|
|
|
inWrapper: (BOOL)flag
|
2004-12-05 20:52:36 +00:00
|
|
|
{
|
2005-03-02 02:27:55 +00:00
|
|
|
if((self = [super initWithName: aName path: aPath inWrapper: flag]) != nil)
|
|
|
|
{
|
|
|
|
NSSound *sound = [[NSSound alloc] initWithContentsOfFile: aPath
|
|
|
|
byReference: YES];
|
|
|
|
|
|
|
|
[(NSSound *)sound setName: aName]; // cache the sound under the given name.
|
|
|
|
}
|
2004-12-05 20:52:36 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *)inspectorClassName
|
|
|
|
{
|
|
|
|
return @"GormSoundInspector";
|
|
|
|
}
|
|
|
|
|
2005-04-14 04:40:48 +00:00
|
|
|
- (NSString *) classInspectorClassName
|
2004-12-05 20:52:36 +00:00
|
|
|
{
|
|
|
|
return @"GormNotApplicableInspector";
|
|
|
|
}
|
|
|
|
|
2005-04-14 04:40:48 +00:00
|
|
|
- (NSString *) connectInspectorClassName
|
2004-12-05 20:52:36 +00:00
|
|
|
{
|
|
|
|
return @"GormNotApplicableInspector";
|
|
|
|
}
|
|
|
|
|
2005-04-14 04:40:48 +00:00
|
|
|
- (NSString *) objectNameForInspectorTitle
|
|
|
|
{
|
|
|
|
return @"Sound";
|
|
|
|
}
|
|
|
|
|
2005-03-02 02:27:55 +00:00
|
|
|
- (NSImage *) imageForViewer
|
2004-12-05 20:52:36 +00:00
|
|
|
{
|
2005-03-02 02:27:55 +00:00
|
|
|
static NSImage *image = nil;
|
2005-01-22 17:16:16 +00:00
|
|
|
|
2005-03-02 02:27:55 +00:00
|
|
|
if (image == nil)
|
|
|
|
{
|
|
|
|
NSBundle *bundle = [NSBundle mainBundle];
|
|
|
|
NSString *bpath = [bundle pathForImageResource: @"GormSound"];
|
2005-01-22 17:16:16 +00:00
|
|
|
|
2005-03-02 02:27:55 +00:00
|
|
|
image = [[NSImage alloc] initWithContentsOfFile: bpath];
|
|
|
|
}
|
|
|
|
return image;
|
2005-01-22 17:16:16 +00:00
|
|
|
}
|
2004-12-05 20:52:36 +00:00
|
|
|
@end
|