/* BBBasicAtomAttributesController.h				 
 *
 * This subclass of MiscInspector is in charge of the basicAtom attributes
 * settings.
 *
 * For more interface-info see the header file. In depth information
 * can be found here in the source-code.
 *
 * Written by: 		Thomas Engel
 * Created:    		12.01.1994 (Copyleft)
 * Last modified: 	12.05.1994
 */

#import "BBBasicAtomAttributesController.h"
#import "../../BBBasicAtom.h"

@implementation BBBasicAtomAttributesController

- textDidChange:sender
{
	[self touch:self];
	return self;
}

- ok:sender
{
	id	anAtom;
	
	anAtom = [self selection];
	[(BBBasicAtom *)anAtom setName:[nameField stringValue]];
	[anAtom setSymbol:[symbolField stringValue]];
	[anAtom setNeutrons:(short)[neutronsField intValue]];
	[anAtom setMass:[massField floatValue]];
	[anAtom setRadius:[radiusField floatValue]];
	[anAtom setVanDerWaalsRadius:[vanDerWaalsField floatValue]];

	return self;
}

- revert:sender
{
	id	anAtom;
	
	anAtom = [self selection];
	[nameField setStringValue:[anAtom name]];
	[symbolField setStringValue:[anAtom symbol]];
	[protonsField setIntValue:[anAtom protons]];
	[neutronsField setIntValue:[anAtom neutrons]];
	[massField setFloatValue:[anAtom mass]];
	[radiusField setFloatValue:[anAtom radius]];
	[vanDerWaalsField setFloatValue:[anAtom vanDerWaalsRadius]];

	return self;
}

@end

/*
 * History: 12.05.94 Converted to fit BB... naming
 *
 *			25.02.94 New-MiscSwapKit conform
 *
 *			12.01.94 First implementation.
 *
 *
 * Bugs: - Not very likely. I know I could have cached the selection but it
 *		   is not necessary...so I saved the memory.
 */