home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1994 June / NEBULA_SE.ISO / SourceCode / MiscKit / Palettes / MiscLogSliderPalette / MiscLogSlider.subproj / MiscLogSliderCell.h < prev    next >
Encoding:
Text File  |  1994-03-27  |  1.6 KB  |  54 lines

  1. //
  2. //    MiscLogSliderCell.m -- a SliderCell with logarithmic transfer function
  3. //        Written by Don Yacktman, Copyright (c) 1994 by Don Yacktman.
  4. //                Version 1.0  All rights reserved.
  5. //        This notice may not be removed from this source code.
  6. //
  7. //    This object is included in the MiscKit by permission from the author
  8. //    and its use is governed by the MiscKit license, found in the file
  9. //    "LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
  10. //    for a list of all applicable permissions and restrictions.
  11. //    
  12.  
  13.  
  14. // how we do a log slider:  we have a slider that thinks it goes from 0 to 1.
  15. // then, whenever a value is set or requested, we re-map that value based
  16. // upon the realMin, realMax, and base variables.  So we're basically
  17. // filtering the values to give them a non-linear transfer function.
  18.  
  19. #import <appkit/SliderCell.h>
  20.  
  21. @interface MiscLogSliderCell:SliderCell
  22. {
  23.     @private
  24.     double base, realMax, realMin; // access these only via methods!
  25.     
  26.     // These next two are used to optimize:  log(base, max), log(base, min)
  27.     // by caching these, we don't have to calc them every time.
  28.     double _lbx, _lbn;
  29. }
  30.  
  31. - init;
  32. - setBase:(double)newBase;
  33. - (double)base;
  34.  
  35. // overridden methods:
  36. - setMaxValue:(double)aDouble;
  37. - (double)maxValue;
  38. - setMinValue:(double)aDouble;
  39. - (double)minValue;
  40. - (const char *)stringValue;
  41. - setStringValue:(const char *)aString;
  42. - (int)intValue;
  43. - setIntValue:(int)anInt;
  44. - (float)floatValue;
  45. - setFloatValue:(float)aFloat;
  46. - (double)doubleValue;
  47. - setDoubleValue:(double)aDouble;
  48.  
  49. - read:(NXTypedStream *)stream;
  50. - write:(NXTypedStream *)stream;
  51. - awake;
  52.  
  53. @end
  54.