This is FineSlider.m in view mode; [Download] [Up]
/* FineSlider.m by Mike Gravina December 1991
* A subclass of Slider that allows Alternate key to slow slider
* down by scale factor
*
* Copyright (C) 1991 The Board of Trustees of
* The Leland Stanford Junior University. All Rights Reserved.
*/
#import "FineSlider.h"
const char FineSlider_h_rcsid[] = FINESLIDER_H_ID;
const char FineSlider_m_rcsid[] = "$Id: FineSlider.m,v 2.2 1992/12/05 20:19:11 pfkeb Exp $";
#import <appkit/Application.h>
@implementation FineSlider
+ new
{
self = [super new];
inAltSequence = NO;
offset = 0.0;
scaleFactor = 20.0;
return self;
}
- (float) floatValue
{
NXEvent *thisEvent;
float newValue;
newValue = [super floatValue];
thisEvent = [NXApp currentEvent];
if (thisEvent->flags & NX_ALTERNATEMASK) {
if (!inAltSequence) {
inAltSequence = YES;
centerValue = newValue - offset; /* save rubberband end point */
returnValue = centerValue;
} else {
returnValue = centerValue + (newValue - centerValue) / scaleFactor;
offset = newValue - returnValue; /* save rubberband's new
* length */
}
} else {
inAltSequence = NO;
returnValue = newValue - offset; /* rubberband treated as
* rigid */
}
if (thisEvent->type == NX_LMOUSEUP) {
centerValue = returnValue; /* set rubberband end point to
* current point */
offset = 0.0; /* set rubberband length to zero */
}
[super setFloatValue:returnValue];
return returnValue;
}
- setScaleFactor:(float) aFloat
{
scaleFactor = aFloat;
return self;
}
@end
/* Following is fix to annoying warning messages due to inconsistent
* method declarations in Slider.h and SoundMeter.h.
*/
@implementation Slider(fix)
- (double) mmaxValue
{
return [self maxValue];
}
- (double) mminValue
{
return [self minValue];
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.