ftp.nice.ch/pub/next/developer/resources/classes/misckit/MiscKit.1.10.0.s.gnutar.gz#/MiscKit/Palettes/MiscSwapKitPalette/MiscSVInspector.m

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

// Copyright (C) 1995
// Use is governed by the MiscKit license

#import "MiscSwapKit.subproj/MiscSwapView.h"
#import "MiscSVInspector.h"

@implementation MiscSVInspector

// Load the Inspector

- init
{
    char buf[MAXPATHLEN + 1];
    id bundle;
    
    [super init];
    
    bundle = [NXBundle bundleForClass:[MiscSwapView class]];

    if ([bundle getPath: buf forResource: "MiscSVInspector" ofType:"nib"])
		[NXApp loadNibFile:buf owner:self withNames:NO fromZone:[self zone]];

	bundle = [NXBundle bundleForClass: [self class] ];
	
	// Load up the images for the backGround gray matrix of buttons.
	
	if ([bundle getPath: buf forResource: "boxBlack" ofType: "tiff"])
		[ [bGrayMatrix cellAt: 0 : 3] setImage:	
						[ [NXImage alloc] initFromFile: buf] ];
	if ([bundle getPath: buf forResource: "boxDkgray" ofType: "tiff"])
		[ [bGrayMatrix cellAt: 0 : 2] setImage:
						[ [NXImage alloc ] initFromFile: buf] ];
	if ([bundle getPath: buf forResource: "boxLtgray" ofType: "tiff"])
		[ [bGrayMatrix cellAt: 0 : 1] setImage:
						[ [NXImage alloc] initFromFile: buf] ];
	if ([bundle getPath: buf forResource: "boxWhite" ofType: "tiff"])	
		[ [bGrayMatrix cellAt: 0 : 0] setImage:
						[ [NXImage alloc] initFromFile: buf] ];
	[bGrayMatrix display];
	
    return self;
}



// Query the object for it's attributes

- revert: sender
{
  int  tag = 0;
  float  gray = 0.0;
  
	[ [optionMatrix cellAt: 0 : 0] setState: [object doesTagComparison] ];
	[ [optionMatrix cellAt: 1 : 0] setState: [object doesUseBuffering] ];
	[optionMatrix display];	

	gray = [object backgroundGray];
	
	// Anyone have a better way to do this? I tried just comparing gray
	// to NX_BLACK, etc and it did not work.
	
	if (gray >= 0.75) tag = 0;
	if (gray < 0.75 && gray >= 0.51) tag = 1;
	if (gray < 0.51 && gray >= 0.25) tag = 2;
	if (gray < 0.25) tag = 3;
	
	[ [bGrayMatrix selectCellWithTag: tag] display];

	return [super revert: sender];
}



- grayChanged:sender
{
  float  gray = NX_LTGRAY;
  
	switch ([ [bGrayMatrix selectedCell] tag])
	{
		case 0: gray = NX_WHITE; break;
		case 1: gray = NX_LTGRAY; break;
		case 2: gray = NX_DKGRAY; break;
		case 3: gray = NX_BLACK; break;
	 }
	[object setBackgroundGray: gray]; 
	[object display];

    return [super ok: sender];
}



- optionChanged:sender
{
	switch ([ [optionMatrix selectedCell] tag])
	{
		case 0:		
			[object setTagComparison: [ [optionMatrix cellAt: 0 :0] state] ];
			break;
			
		case 1:		
			[object setUseBuffering: [ [optionMatrix cellAt: 1 : 0] state ] ];
			break;
	 }
	 
    return [super ok: sender];
}



- (BOOL)wantsButtons
{
	return NO;
}

@end


@implementation MiscSwapView (IBInspector)

- (const char *)getInspectorClassName
{
	return "MiscSVInspector";
}

@end

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