2002-11-05 00:35:17 +00:00
|
|
|
/** <title>GormSoundInspector</title>
|
|
|
|
|
|
|
|
<abstract>allow user to select custom classes</abstract>
|
|
|
|
|
|
|
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
|
|
|
Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
|
|
|
Date: September 2002
|
|
|
|
|
|
|
|
This file is part of GNUstep.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library 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
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
License along with this library; see the file COPYING.LIB.
|
|
|
|
If not, write to the Free Software Foundation,
|
|
|
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* All Rights reserved */
|
|
|
|
|
|
|
|
#include <AppKit/AppKit.h>
|
|
|
|
#include "GormSoundInspector.h"
|
|
|
|
#include "GormPrivate.h"
|
|
|
|
#include "GormClassManager.h"
|
|
|
|
#include "GormDocument.h"
|
|
|
|
#include "GormPrivate.h"
|
2004-05-01 15:45:47 +00:00
|
|
|
#include "GormSoundView.h"
|
2002-11-05 00:35:17 +00:00
|
|
|
|
|
|
|
@implementation GormSoundInspector
|
|
|
|
+ (void) initialize
|
|
|
|
{
|
|
|
|
if (self == [GormSoundInspector class])
|
|
|
|
{
|
|
|
|
// TBD
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) init
|
|
|
|
{
|
|
|
|
self = [super init];
|
|
|
|
if (self != nil)
|
|
|
|
{
|
|
|
|
// initialize all member variables...
|
|
|
|
// none...
|
|
|
|
|
|
|
|
// load the gui...
|
|
|
|
if (![NSBundle loadNibNamed: @"GormSoundInspector"
|
|
|
|
owner: self])
|
|
|
|
{
|
|
|
|
NSLog(@"Could not open gorm GormSoundInspector");
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[[NSNotificationCenter defaultCenter]
|
|
|
|
addObserver: self
|
|
|
|
selector: @selector(handleNotification:)
|
|
|
|
name: IBSelectionChangedNotification
|
|
|
|
object: nil];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) dealloc
|
|
|
|
{
|
|
|
|
RELEASE(_currentSound);
|
|
|
|
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
2003-10-28 05:25:14 +00:00
|
|
|
[super dealloc];
|
2002-11-05 00:35:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) handleNotification: (NSNotification*)aNotification
|
|
|
|
{
|
2002-11-05 05:42:45 +00:00
|
|
|
id selection = [[aNotification object] selection];
|
|
|
|
id sndobject = nil;
|
2002-11-05 00:35:17 +00:00
|
|
|
|
2002-11-05 05:42:45 +00:00
|
|
|
// get the sound object...
|
|
|
|
if(selection != nil)
|
2002-11-05 00:35:17 +00:00
|
|
|
{
|
2002-11-05 05:42:45 +00:00
|
|
|
if([selection count] > 0)
|
|
|
|
{
|
|
|
|
sndobject = [selection objectAtIndex: 0];
|
|
|
|
}
|
|
|
|
}
|
2004-05-14 06:32:24 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
_currentSound = nil;
|
|
|
|
}
|
2002-11-05 05:42:45 +00:00
|
|
|
|
|
|
|
// if its not nil, load it...
|
|
|
|
if(sndobject != nil)
|
|
|
|
{
|
|
|
|
if([sndobject isKindOfClass: [GormSound class]])
|
|
|
|
{
|
2003-10-28 05:25:14 +00:00
|
|
|
NSDebugLog(@"Sound inspector notified: %@",sndobject);
|
2002-11-05 05:42:45 +00:00
|
|
|
RELEASE(_currentSound);
|
|
|
|
_currentSound = [[NSSound alloc] initWithContentsOfFile: [sndobject soundPath]
|
|
|
|
byReference: YES];
|
2004-05-01 15:45:47 +00:00
|
|
|
[soundView setSound: _currentSound];
|
2002-11-05 05:42:45 +00:00
|
|
|
RETAIN(_currentSound);
|
2003-10-28 05:25:14 +00:00
|
|
|
NSDebugLog(@"Loaded sound");
|
2002-11-05 05:42:45 +00:00
|
|
|
}
|
2002-11-05 00:35:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) stop: (id)sender
|
|
|
|
{
|
2003-10-28 05:25:14 +00:00
|
|
|
NSDebugLog(@"Stop");
|
2002-11-05 00:35:17 +00:00
|
|
|
[_currentSound stop];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) play: (id)sender
|
|
|
|
{
|
2004-02-21 18:48:48 +00:00
|
|
|
NSDebugLog(@"Play");
|
2002-11-05 00:35:17 +00:00
|
|
|
[_currentSound play];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) pause: (id)sender
|
|
|
|
{
|
2003-10-28 05:25:14 +00:00
|
|
|
NSDebugLog(@"Pause");
|
2002-11-05 00:35:17 +00:00
|
|
|
[_currentSound pause];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) record: (id)sender
|
|
|
|
{
|
2003-10-28 05:25:14 +00:00
|
|
|
NSDebugLog(@"Record");
|
2002-11-05 00:35:17 +00:00
|
|
|
// [_currentSound record];
|
|
|
|
}
|
|
|
|
@end
|