
/* Generated by Interface Builder */

#import "NXYInspector.h"
#import "Plot.h"
#import "NXYView.h"
#import <appkit/Application.h>
#import <appkit/Panel.h>
#import <appkit/ButtonCell.h>
#import <appkit/Button.h>
#import <appkit/FormCell.h>
#import <appkit/Form.h>

#import <nib/InterfaceBuilder.h>


@implementation NXYInspector

+ finishLoading:(struct mach_header *)header 
{
    NIBDidLoadClass(self, header);
    return nil;
}

+ startUnloading 
{
    NIBWillUnloadClass(self);
    return nil;
}

- init
{

    [super init];
    [NXApp loadNibSection:"NXYInspector.nib" owner:self];
    return self;
}

- ok:sender
{
	[object setGrid:[gridSwitch state]];

	[object setBorder:[borderSwitch state]];

	[object setLogoFlag:[logoSwitch state]];
	
	if([autoMaxMinSet state] == 0){
		[object setXincValue:[xincValue floatValue]];
		[object setXminValue:[xminValue floatValue]];
		[object setXmaxValue:[xmaxValue floatValue]];
		[object setYincValue:[yincValue floatValue]];
		[object setYminValue:[yminValue floatValue]];
		[object setYmaxValue:[ymaxValue floatValue]];
		[object setAutoMaxMinState:NO];
		}
	else
		[object setAutoMaxMinState:YES];

	[object setXaxisLabel:[titleLabelForm stringValueAt:0]];
	[object setYaxisLabel:[titleLabelForm stringValueAt:1]]; 
	[object setMainTitle:[titleLabelForm stringValueAt:2]]; 
	
	switch([paperTypeSel selectedRow])
	{
		case 0:
			[object setXLinLogState:LINEAR];
			[object setYLinLogState:LINEAR];
			[object setAutoPaperState:NO];
			[object setPaperSwitchRow:0];
			break;
		case 1:
			[object setXLinLogState:LINEAR];
			[object setYLinLogState:LOG];
			[object setAutoPaperState:NO];
			[object setPaperSwitchRow:1];
			break;
		case 2:
			[object setXLinLogState:LOG];
			[object setYLinLogState:LINEAR];
			[object setAutoPaperState:NO];
			[object setPaperSwitchRow:2];
			break;
		case 3:
			[object setXLinLogState:LOG];
			[object setYLinLogState:LOG];
			[object setAutoPaperState:NO];
			[object setPaperSwitchRow:3];
			break;						
		default:
			[object setAutoPaperState:YES];
			[object setPaperSwitchRow:4];
			break;
	}

    return [super ok:sender];  // Somehow this forces a redraw of the view
}

- revert:sender
{
    // Give the nxyView a pointer to its inspector.    
    [object setInspector:self];

	[gridSwitch setState:[object gridState]];
	[borderSwitch setState:[object borderState]];
	[logoSwitch setState:[object logoFlag]];
	
	[paperTypeSel setState:1 at:[object paperSwitchRow] :0];

	[autoMaxMinSet setState:[object autoMaxMinState]];
	if([object autoMaxMinState] == 0){
	[xincValue setFloatValue:[object xIncValue]];
	[xminValue setFloatValue:[object xMinValue]];
	[xmaxValue setFloatValue:[object xMaxValue]];
	[yincValue setFloatValue:[object yIncValue]];
	[yminValue setFloatValue:[object yMinValue]];
	[ymaxValue setFloatValue:[object yMaxValue]];
	}
		
	[titleLabelForm setStringValue:[object xaxisLabel] at:0];
	[titleLabelForm setStringValue:[object yaxisLabel] at:1];
	[titleLabelForm setStringValue:[object mainTitle] at:2];
	
    return [super revert:sender];

}



@end
