ftp.nice.ch/pub/next/developer/resources/classes/Gauges.1.0.s.tar.gz#/Gauges/ValuatorGauge.m

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

/* Generated by Interface Builder */

#import "ValuatorGauge.h"

@implementation ValuatorGauge

+ newFrame: (NXRect *) r
{
	self = [super newFrame:r];
	return self;
}

#define POINTWIDTH	0.05	/* 5% of the scale */
-drawSelf:(NXRect *)drawRects :(int)rectCount
{
	NXRect	dataRect;
	
	dataRect = FaceRect;
	PScomposite(0.0,0.0,bounds.size.width,bounds.size.height,
		GaugeDat.bmgState,0.0, 0.0,NX_COPY);
	/* now draw the pointer */
	PSsetgray(GaugeDat.ptGray);
	if (NX_WIDTH(&bounds) > NX_HEIGHT(&bounds)){
		/* do horizontal pointer */
		NX_X(&dataRect) += (((GaugeDat.value - GaugeDat.startValue) 
				/ GAUGESIZE) 
				* NX_WIDTH(&dataRect) -
				(NX_WIDTH(&FaceRect) * POINTWIDTH / 2));			
		dataRect.size.width = (NX_WIDTH(&FaceRect) * POINTWIDTH);
	}else{
		/* do vertical pointer */
		NX_Y(&dataRect) += (((GaugeDat.value - GaugeDat.startValue)
				/ GAUGESIZE)
				* NX_HEIGHT(&dataRect) -
				(NX_HEIGHT(&FaceRect) * POINTWIDTH / 2));
		dataRect.size.height = (NX_HEIGHT(&FaceRect) * POINTWIDTH);

	}
	if (GaugeFlags.borderType == NX_NOBORDER) {
		if (GaugeFlags.labelTicsOn){
			PSsetlinewidth(1.0);
			if (NX_WIDTH(&bounds) > NX_HEIGHT(&bounds)){
			    PSmoveto(NX_X(&dataRect),NX_MAXY(&dataRect));
			    PSlineto(NX_MAXX(&dataRect),NX_MAXY(&dataRect));
			    PSlineto(NX_X(&dataRect)+NX_WIDTH(&dataRect)/2.,
			    	NX_Y(&dataRect));
			    PSfill();
			}else{
			    PSmoveto(NX_MAXX(&dataRect),NX_MAXY(&dataRect));
			    PSlineto(NX_MAXX(&dataRect),NX_Y(&dataRect));
			    PSlineto(NX_X(&dataRect),
			    	NX_Y(&dataRect)+(NX_HEIGHT(&dataRect)/2.));
			    PSfill();
			}
		}else NXRectFill(&dataRect);
		if (GaugeFlags.overFlow) NXHighlightRect(&bounds);
		return self; /* exit quick */
	}
	PSsetgray(GaugeDat.ticGray);
	FancyRect(&dataRect);
	if (GaugeFlags.overFlow) NXHighlightRect(&bounds);
	return self;
}

@end

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