ftp.nice.ch/pub/next/science/chemistry/BeakerBoy.0.31.s.tar.gz#/BeakerBoy.0.31.s/Preferences.subproj/BBPreferencesManager.m

This is BBPreferencesManager.m in view mode; [Download] [Up]

/* BBPreferencesManager.m				 
 *
 * This class controls the Preferences' modules and Panel.
 *
 * For more interface-info see the header file. More in depth information
 * can be found here in the source-code.
 *
 * Written by: 		Thomas Engel
 * Created:    		04.11.1993 (Copyleft)
 * Last modified: 	14.05.1994
 */

#import "BBPreferencesManager.h"
#import "BBDefaultApp.h"
#import "BBDefaultCamera.h"
#import <misckit/MiscSwapView.h>

@implementation BBPreferencesManager

- init
{	
	self = [super init];
	if( !self ) return self;

	// OK. We really are an object...load the NIB and let's get the defaults.
	// Every controller will get the chance to fethc the defaults.
	// They might implement lazy defaults too. We don't really care.
	
	if( [NXApp loadNibSection:"Preferences.nib" owner:self] == nil )
		NXRunAlertPanel( NULL, "Couldn't load Preferences.nib",
						 "OK", NULL, NULL);

	[swapView setUseBuffering:YES];

	// Let's get all the defaults. The order is significant if there are two
	// providers for the same class or when the speed is concerned for how
	// fast it is to find a provider.
	
	defaultsProviders = [List new];
	[defaultsProviders addObject:defaultCamera];
	[defaultsProviders addObject:defaultApp];
	
	return self;
}

- free
{
	[defaultsProviders free];
	return [super free];
}

- makeKeyAndOrderFront:sender
{
	// This include triggering a swap to set the first selected popup item
	
	[swapView swapContentView:self];
	
	[window makeKeyAndOrderFront:self];
	return self;
}

- findDefaultFor:anObject
{
	// Let' search for the provider that wants to serve this class.
	
	int	i;
	id 	provider;
	id	someProvider;
	
	provider = nil;
	
	for( i=0; i<[defaultsProviders count]; i++ )
	{
		someProvider = [defaultsProviders objectAt:i];
		if( [someProvider hasDefaultsFor:anObject] )
		{
			provider = someProvider;
			break;
		}
	}
	return provider;
}

@end

/*
 * History: 14.05.94 New name (BB..) and new approach to serving the data.
 *
 *			08.03.94 Added topic searching.
 *
 *			25.01.94 Made it compatible with the new MiscSwap stuff.
 *
 *			08.01.94 Some code cleaning done.
 *
 *
 * Bugs: - ?
 */

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.