ftp.nice.ch/pub/next/developer/objc/appkit/NMK.s.tar.gz#/NMK/Recorders/RSliderVars.m

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

/***** RSliderVars.m -- SliderCellCover variable holder object implementation
	NeXTstep Measurement Kit
	by Alex Meyer <ameyer@phoenix.Princeton.EDU>
	for computer science senior thesis
	24 April 1992 -- created from RButtonVars.m
*****/

#import <stdlib.h>
#import <stdio.h>
#import <string.h>
#import <appkit/Application.h>
#import "RSliderVars.h"

@implementation RSliderVars

- init	/* do not use */
{
	[self free];
	return (nil);
}


- initString:(const char *)str
	tag:(int)tg
	rect:(const NXRect *)rect
{
	int i;
	char temp[512];

	[super init];
	linker = NXGetNamedObject(LINKERNAME,NXApp);
	sprintf(temp,"%s|%d|%f|%f|%f|%f",str,tg,
		rect->origin.x,rect->origin.y,
		rect->size.width,rect->size.height);
	key = NXUniqueString(temp);
	lastHitTime = 0;
	stats.numHits = 0;
	stats.timeIn = 0;
	stats.timeBetween = 0;
	for (i = 0;i < SLIDERHIST;++i)
		stats.histogram[i] = 0;
	[linker connect:self];
	return (self);
}


- incHits
{
	++stats.numHits;
	return (self);
}


- timeFrom:(double)time0
	to:(double)time1
{
	stats.timeIn += time1 - time0;
	if (lastHitTime)
		stats.timeBetween += time0 - lastHitTime;
	lastHitTime = time1;
	return (self);
}


- incHist:(int)ind
{
	++stats.histogram[ind];
	return (self);
}


- (unsigned)type
{
	return (TM_SLIDER);
}


- (NXAtom)key
{
	return (key);
}


- (NXAtom)desc
{
	return (NXUniqueString("{idd[10i]}"));
}


- (unsigned)statsSize
{
	return (sizeof(stats));
}


- (void *)copyOfStats
{
	void *cpy;

	cpy = malloc(sizeof(stats));
	memcpy(cpy,&stats,sizeof(stats));
	return (cpy);
}


- copyInStats:(void *)NewStats
{
	memcpy(&stats,NewStats,sizeof(stats));
	return (self);
}

@end

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