This is MiscLogSliderCell.h in view mode; [Download] [Up]
// // MiscLogSliderCell.m -- a SliderCell with logarithmic transfer function // Written by Don Yacktman, Copyright (c) 1994 by Don Yacktman. // Version 1.0 All rights reserved. // This notice may not be removed from this source code. // // This object is included in the MiscKit by permission from the author // and its use is governed by the MiscKit license, found in the file // "LICENSE.rtf" in the MiscKit distribution. Please refer to that file // for a list of all applicable permissions and restrictions. // // how we do a log slider: we have a slider that thinks it goes from 0 to 1. // then, whenever a value is set or requested, we re-map that value based // upon the realMin, realMax, and base variables. So we're basically // filtering the values to give them a non-linear transfer function. #import <appkit/SliderCell.h> @interface MiscLogSliderCell:SliderCell { @private double base, realMax, realMin; // access these only via methods! // These next two are used to optimize: log(base, max), log(base, min) // by caching these, we don't have to calc them every time. double _lbx, _lbn; } - init; - setBase:(double)newBase; - (double)base; // overridden methods: - setMaxValue:(double)aDouble; - (double)maxValue; - setMinValue:(double)aDouble; - (double)minValue; - (const char *)stringValue; - setStringValue:(const char *)aString; - (int)intValue; - setIntValue:(int)anInt; - (float)floatValue; - setFloatValue:(float)aFloat; - (double)doubleValue; - setDoubleValue:(double)aDouble; - read:(NXTypedStream *)stream; - write:(NXTypedStream *)stream; - awake; @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.