File: SMDoubleSliderCell.m

package info (click to toggle)
lynkeos.app 3.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 6,740 kB
  • sloc: objc: 40,528; ansic: 811; cpp: 150; sh: 68; makefile: 27
file content (678 lines) | stat: -rw-r--r-- 19,673 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
//
//  SMDoubleSliderCell.m
//
//SMDoubleSlider Copyright (c) 2003-2008, Snowmint Creative Solutions LLC http://www.snowmintcs.com/
//All rights reserved.
// Copyright 2020 J-E Lamiaud
//
//Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
//
//• Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
//• Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
//• Neither the name of Snowmint Creative Solutions LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
//
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

#import <AppKit/AppKit.h>

#import "SMDoubleSliderCell.h"
#import "SMDoubleSlider.h"


@interface SMDoubleSliderCell(_sm_Private)
	// A private method to calculate the rectangle of the low knob.
	- (NSRect)_sm_loKnobRect;
@end

@implementation SMDoubleSliderCell

- (id)initWithCoder:(NSCoder *)aDecoder
{
    BOOL	tempBool;

    self = [ super initWithCoder:aDecoder ];

    if ( nil != self )
    {
		if ( [ aDecoder allowsKeyedCoding ] )
		{
			_sm_loValue = [ aDecoder decodeDoubleForKey:@"loValue" ];
			tempBool = [ aDecoder decodeBoolForKey:@"lockedSliders" ];
		}
		else
		{
			[ aDecoder decodeValueOfObjCType:@encode(double) at:&_sm_loValue ];
			[ aDecoder decodeValueOfObjCType:@encode(BOOL) at:&tempBool ];
		}

		_sm_flags.lockedSliders = tempBool;

		// Make sure our value is between min and max.
		if ( [ self minValue ] > _sm_loValue )
			_sm_loValue = [ self minValue ];
		if ( [ self maxValue ] < _sm_loValue )
			_sm_loValue = [ self maxValue ];

		_sm_flags.isTrackingLoKnob = YES;
	}
	
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{
    BOOL	tempBool;

    [ super encodeWithCoder:aCoder ];

	tempBool = _sm_flags.lockedSliders;

	if ( [ aCoder allowsKeyedCoding ] )
	{
		[ aCoder encodeDouble:_sm_loValue forKey:@"loValue" ];
		[ aCoder encodeBool:tempBool forKey:@"lockedSliders" ];
	}
	else
	{
		[ aCoder encodeValueOfObjCType:@encode(double) at:&_sm_loValue ];
		[ aCoder encodeValueOfObjCType:@encode(BOOL) at:&tempBool ];
	}
}

- (id)copyWithZone:(NSZone *)zone
{
    SMDoubleSliderCell *copy;

    copy = [ super copyWithZone:zone ];

    [ copy setDoubleLoValue:[ self doubleLoValue ] ];
    [ copy setLockedSliders:[ self lockedSliders ] ];

    return copy;
}

- (void)setMinValue:(double)aDouble
{
    // Make sure we check both lo and hi values.
    if ( [ self doubleLoValue ] < aDouble )
        [ self setDoubleLoValue:aDouble ];
    if ( [ self doubleHiValue ] < aDouble )
        [ self setDoubleHiValue:aDouble ];

    [ super setMinValue:aDouble ];
}

- (void)setMaxValue:(double)aDouble
{
    // Make sure we check both lo and hi values.
    if ( [ self doubleLoValue ] > aDouble )
        [ self setDoubleLoValue:aDouble ];
    if ( [ self doubleHiValue ] > aDouble )
        [ self setDoubleHiValue:aDouble ];

    [ super setMaxValue:aDouble ];
}

/*- (void)setShowsFirstResponder:(BOOL)inValue
{
    NSLog( @"%x -setShowsFirstResponder:%d (was %d) dir=%d", self, inValue, _cFlags.showsFirstResponder,
                [ [ [ self controlView ] window ] keyViewSelectionDirection ] );
    if ( inValue && !_cFlags.showsFirstResponder &&
                [ [ [ self controlView ] window ] keyViewSelectionDirection ] != NSDirectSelection )
    {
        [ self setTrackingLoKnob:( [ [ [ self controlView ] window ] keyViewSelectionDirection ] ==
                    NSSelectingNext ) ];
    }

    [ super setShowsFirstResponder:inValue ];
}*/

/*- (BOOL)acceptsFirstResponder
{
    BOOL		result;

    NSLog( @"%x -acceptsFirstResponder called", self );
    result = [ super acceptsFirstResponder ];
    if ( result && [ [ [ self controlView ] window ] keyViewSelectionDirection ] != NSDirectSelection )
        [ self setTrackingLoKnob:( [ [ [ self controlView ] window ] keyViewSelectionDirection ] == NSSelectingNext ) ];

    return result;
}*/

- (void)drawKnob
{
    NSRect	loKnobRect;
    double	saveValue = [super doubleValue];
#if ! defined GNUSTEP
    BOOL	savePressed = _scFlags.isPressed;
#endif

    // Draw the lower knob first.
    if ( !_sm_flags.mouseTrackingSwapped )
        // If we're tracking the lo knob with the mouse, _value already has the lo knob value.
        // Otherwise, we need to stuff the lo value into _value to calculate correctly.
        [super setDoubleValue:_sm_loValue];

    // Figure out the focus ring style and pressed state of the low knob.
#if ! defined GNUSTEP
    _sm_flags.removeFocusRingStyle = ( _cFlags.showsFirstResponder && ![ self trackingLoKnob ] );
    _scFlags.isPressed = ( savePressed && [ self trackingLoKnob ] );
#endif

    loKnobRect = [ self knobRectFlipped:[ [ self controlView ] isFlipped ] ];
    [ self drawKnob:loKnobRect ];

    // Now, draw the upper knob in the correct state.
    if ( _sm_flags.mouseTrackingSwapped )
        // If we're tracking the lo knob, the hi knob value is saved in _sm_saveValue.
        [super setDoubleValue:_sm_saveValue];
    else
        // Restore to proper position of hi knob.
        [super setDoubleValue:saveValue];

    // Figure out the focus ring style and pressed state of the high knob.
#if ! defined GNUSTEP
    _sm_flags.removeFocusRingStyle = ( _cFlags.showsFirstResponder && [ self trackingLoKnob ] );
    _scFlags.isPressed = ( savePressed && ![ self trackingLoKnob ] );
#endif

    [ super drawKnob ];

    // Reset to whatever values we had at the beginning of this method.
    [super setDoubleValue:saveValue];
#if ! defined GNUSTEP
    _scFlags.isPressed = savePressed;
#endif
    _sm_flags.removeFocusRingStyle = NO;
}

- (void)drawKnob:(NSRect)inRect
{
	NSFocusRingType t_focus_ring_type = 0;

    if ( _sm_flags.removeFocusRingStyle )
	{
		if ( [ self respondsToSelector:@selector(focusRingType) ] )
		{
			t_focus_ring_type = [ self focusRingType ];
			[ self setFocusRingType:NSFocusRingTypeNone ];
		}

		// This seems backwards, but the problem is that NSSliderCell has set the focus ring style,
		// and we want to remove that style.  So, we pop the graphics state off the stack.
        [ [ NSGraphicsContext currentContext ] restoreGraphicsState ];
	}

    [ super drawKnob:inRect ];

    if ( _sm_flags.removeFocusRingStyle )
    {
		if ( [ self respondsToSelector:@selector(focusRingType) ] )
		{
			[ self setFocusRingType:t_focus_ring_type ];
		}

		// Reset the graphics context stack and add the correct focus ring style back in.
		[ [ NSGraphicsContext currentContext ] saveGraphicsState ];
#if !defined GNUSTEP
		NSSetFocusRingStyle( NSFocusRingAbove );
#endif
    }
}

// Mouse tracking doesn't use the accessor methods for the value.
// That means, we need to do some hocus pocus here to make it work right.
- (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView
{
    NSRect		loKnobRect;

    // Determine if we're tracking the low knob or not.
    loKnobRect = [ self _sm_loKnobRect ];
    if ( [ self isVertical ] )
    {
        if ( [ controlView isFlipped ] )
            [ self setTrackingLoKnob:( startPoint.y > loKnobRect.origin.y ) ];
        else
            [ self setTrackingLoKnob:( startPoint.y < loKnobRect.origin.y +
                        loKnobRect.size.height ) ];
    }
    else
        [ self setTrackingLoKnob:( startPoint.x < loKnobRect.origin.x + loKnobRect.size.width ) ];

    // Make sure that the user hasn't jammed both knobs up against the minimum value.
    if ( [ self trackingLoKnob ] && NSEqualRects( loKnobRect,
                [ self knobRectFlipped:[ controlView isFlipped ] ] ) )
        [ self setTrackingLoKnob:( _sm_loValue > [ self minValue ] ) ];

    // Make sure that the entire lo knob gets erased if it's moved the first time.
    if ( [ self trackingLoKnob ] )
        [ controlView setNeedsDisplayInRect:loKnobRect ];

    // Save the value of the hi knob.
    _sm_saveValue = [super doubleValue];

    // The _value variable (NSSliderCell implementation without accessor method calls) is used to track
    // any knob with the mouse.
    // However, if the user is tracking the lo knob, we need to switch in our lo value for the knob.
    _sm_flags.mouseTrackingSwapped = [ self trackingLoKnob ];
    if ( _sm_flags.mouseTrackingSwapped )
        [super setDoubleValue:_sm_loValue];

    return [ super startTrackingAt:startPoint inView:controlView ];
}

- (BOOL)continueTracking:(NSPoint)lastPoint at:(NSPoint)currentPoint inView:(NSView *)controlView
{
    BOOL	result;

    result = [ super continueTracking:lastPoint at:currentPoint inView:controlView ];

    // NOTE: This doesn't seem to be a problem for continuous sliders, although I did think about that.
    // If the super implementation of this method sent the action method, we'd be hosed because we're possibly
    // changing the values below here.  However, Cocoa seems to send the action after this method is complete.
    // That's exactly what we want. :)
    if ( _sm_flags.mouseTrackingSwapped )
    {
        // Limit to maximum of hi knob value (saved in _sm_saveValue).
        if ( [super doubleValue] > _sm_saveValue )
            [super setDoubleValue:_sm_saveValue];

		// Only update the bound controller if this slider is continuous
		if ([self isContinuous])
		{
			[(SMDoubleSlider*)controlView updateBoundControllerLoValue:[super doubleValue]];
		}
    }
    else
    {
        // Limit to minimum of lo knob value.
        if ( [super doubleValue] < _sm_loValue )
            [super setDoubleValue:_sm_loValue];
		
		// Only update the bound controller if this slider is continuous
		if ([self isContinuous])
		{
			[(SMDoubleSlider*)controlView updateBoundControllerHiValue:[super doubleValue]];
		}
    }

    return result;
}

- (void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint inView:(NSView *)controlView mouseIsUp:(BOOL)flag
{
    if ( _sm_flags.mouseTrackingSwapped )
    {
        // If we were tracking the lo knob, stick the correct values into the correct places.
        _sm_loValue = [super doubleValue];
        [super setDoubleValue:_sm_saveValue];
        _sm_flags.mouseTrackingSwapped = NO;
        [ controlView setNeedsDisplayInRect:[ self _sm_loKnobRect ] ];
		
		// Update the bound controller whether the slider is continuous or not
		[(SMDoubleSlider*)controlView updateBoundControllerLoValue:_sm_loValue];
    }
    else
    {
		// Update the bound controller whether the slider is continuous or not
		[(SMDoubleSlider*)controlView updateBoundControllerHiValue:[super doubleValue]];
    }

    [ super stopTracking:lastPoint at:stopPoint inView:controlView mouseIsUp:flag ];
}

#pragma mark -

- (BOOL)trackingLoKnob
{
    return _sm_flags.isTrackingLoKnob;
}

- (void)setTrackingLoKnob:(BOOL)inValue
{
    if ( _sm_flags.isTrackingLoKnob != inValue )
    {
        _sm_flags.isTrackingLoKnob = inValue;
        [ (NSControl *)[ self controlView ] updateCell:self ];
    }
}

- (BOOL)lockedSliders
{
    return _sm_flags.lockedSliders;
}

- (void)setLockedSliders:(BOOL)inLocked
{
    if ( _sm_flags.lockedSliders != inLocked )
    {
        _sm_flags.lockedSliders = inLocked;

        if ( inLocked )
            [ self setDoubleLoValue:[ self doubleHiValue ] ];

        [ (NSControl *)[ self controlView ] updateCell:self ];
    }
}

#pragma mark -

- (NSString *)stringValue
{
    if ( [ self trackingLoKnob ] )
        return [ self stringLoValue ];
    else
        return [ self stringHiValue ];
}

- (id)objectValue
{
    if ( [ self trackingLoKnob ] )
        return [ self objectLoValue ];
    else
        return [ self objectHiValue ];
}

- (int)intValue
{
    if ( [ self trackingLoKnob ] )
        return [ self intLoValue ];
    else
        return [ self intHiValue ];
}

- (float)floatValue
{
    if ( [ self trackingLoKnob ] )
        return [ self floatLoValue ];
    else
        return [ self floatHiValue ];
}

- (double)doubleValue
{
    if ( [ self trackingLoKnob ] )
        return [ self doubleLoValue ];
    else
        return [ self doubleHiValue ];
}

- (void)setStringValue:(NSString *)aString
{
    if ( [ self trackingLoKnob ] )
        [ self setStringLoValue:aString ];
    else
        [ self setStringHiValue:aString ];
}

- (void)setObjectValue:(id)obj
{
    if ( [ self trackingLoKnob ] )
        [ self setObjectLoValue:obj ];
    else
        [ self setObjectHiValue:obj ];
}

- (void)setIntValue:(int)anInt
{
    if ( [ self trackingLoKnob ] )
        [ self setIntLoValue:anInt ];
    else
        [ self setIntHiValue:anInt ];
}

- (void)setFloatValue:(float)aFloat
{
    if ( [ self trackingLoKnob ] )
        [ self setFloatLoValue:aFloat ];
    else
        [ self setFloatHiValue:aFloat ];
}

- (void)setDoubleValue:(double)aDouble
{
    if ( [ self trackingLoKnob ] )
        [ self setDoubleLoValue:aDouble ];
    else
        [ self setDoubleHiValue:aDouble ];
}

#pragma mark -

- (double)doubleHiValue
{
//    NSLog( @"SMDSCell -doubleHiValue called %g (%d)", [ super doubleValue ],
//                _sm_flags.mouseTrackingSwapped );
    if ( _sm_flags.mouseTrackingSwapped )
        return _sm_saveValue;
    else
        return [ super doubleValue ];
}

- (void)setDoubleHiValue:(double)aDouble
{
//    NSLog( @"SMDSCell -setDoubleHiValue:%g called (%d)", aDouble,
//                _sm_flags.mouseTrackingSwapped );

    // Limit to minimum of lo knob value.
    if ( aDouble < [ self doubleLoValue ] )
        aDouble = [ self doubleLoValue ];
    if ( aDouble > [ self maxValue ] )
        aDouble = [ self maxValue ];

    if ( _sm_flags.mouseTrackingSwapped )
    {
        _sm_saveValue = aDouble;
        [ (NSControl *)[ self controlView ] updateCell:self ];
    }
    else
        [ super setDoubleValue:aDouble ];
}

- (id)objectHiValue
{
    return [ NSNumber numberWithDouble:[ self doubleHiValue ] ];
}

- (void)setObjectHiValue:(id)obj
{
    if ( [ obj respondsToSelector:@selector(doubleHiValue) ] )
        [ self setDoubleHiValue:[ obj doubleHiValue ] ];
    else if ( [ obj respondsToSelector:@selector(doubleValue) ] )
        [ self setDoubleHiValue:[ obj doubleValue ] ];
    else if ( [ obj respondsToSelector:@selector(floatValue) ] )
        [ self setDoubleHiValue:[ obj floatValue ] ];
    else if ( [ obj respondsToSelector:@selector(intValue) ] )
        [ self setDoubleHiValue:[ obj intValue ] ];
    else if ( [ obj respondsToSelector:@selector(stringValue) ] )
        [ self setStringHiValue:[ obj stringValue ] ];
	else
		[ self setDoubleHiValue:0.0 ];
}

- (NSString *)stringHiValue
{
    return [ NSString stringWithFormat:@"%g", [ self doubleHiValue ] ];
}

- (void)setStringHiValue:(NSString *)aString
{
    NSParameterAssert( nil != aString );

    [ self setDoubleHiValue:[ aString doubleValue ] ];
}

- (int)intHiValue
{
    return (int)[ self doubleHiValue ];
}

- (void)setIntHiValue:(int)anInt
{
    [ self setDoubleHiValue:anInt ];
}

- (float)floatHiValue
{
    return (float)[ self doubleHiValue ];
}

- (void)setFloatHiValue:(float)aFloat
{
    [ self setDoubleHiValue:aFloat ];
}

/*- (void)takeIntHiValueFrom:(id)sender
{
    [ super takeIntValueFrom:sender ];
}

- (void)takeFloatHiValueFrom:(id)sender
{
    [ super takeFloatValueFrom:sender ];
}

- (void)takeDoubleHiValueFrom:(id)sender
{
    [ super takeDoubleValueFrom:sender ];
}

- (void)takeStringHiValueFrom:(id)sender
{
    [ super takeStringValueFrom:sender ];
}

- (void)takeObjectHiValueFrom:(id)sender
{
    [ super takeObjectValueFrom:sender ];
}*/

#pragma mark -

- (double)doubleLoValue
{
//    NSLog( @"SMDSCell -doubleLoValue called %g (%d)", _sm_loValue, _sm_flags.mouseTrackingSwapped );
    if ( _sm_flags.mouseTrackingSwapped )
        return [super doubleValue];
    else
        return _sm_loValue;
}

- (void)setDoubleLoValue:(double)aDouble
{
//    NSLog( @"SMDSCell -setDoubleLoValue:%g called (%d)", aDouble,
//                _sm_flags.mouseTrackingSwapped );
    if ( aDouble > [ self doubleHiValue ] )
        aDouble = [ self doubleHiValue ];
    if ( aDouble < [ self minValue ] )
        aDouble = [ self minValue ];

    if ( _sm_flags.mouseTrackingSwapped )
        [ super setDoubleValue:aDouble ];
    else
    {
        _sm_loValue = aDouble;
        [ (NSControl *)[ self controlView ] updateCell:self ];
    }
}

- (id)objectLoValue
{
    return [ NSNumber numberWithDouble:[ self doubleLoValue ] ];
}

- (void)setObjectLoValue:(id)obj
{
    if ( [ obj respondsToSelector:@selector(doubleLoValue) ] )
        [ self setDoubleLoValue:[ obj doubleLoValue ] ];
    else if ( [ obj respondsToSelector:@selector(doubleValue) ] )
        [ self setDoubleLoValue:[ obj doubleValue ] ];
    else if ( [ obj respondsToSelector:@selector(floatValue) ] )
        [ self setDoubleLoValue:[ obj floatValue ] ];
    else if ( [ obj respondsToSelector:@selector(intValue) ] )
        [ self setDoubleLoValue:[ obj intValue ] ];
    else if ( [ obj respondsToSelector:@selector(stringValue) ] )
        [ self setStringLoValue:[ obj stringValue ] ];
	else
        [ self setDoubleLoValue:0.0 ];
}

- (NSString *)stringLoValue
{
    return [ NSString stringWithFormat:@"%g", [ self doubleLoValue ] ];
}

- (void)setStringLoValue:(NSString *)aString
{
    NSParameterAssert( nil != aString );

    [ self setDoubleLoValue:[ aString doubleValue ] ];
}

- (int)intLoValue
{
    return (int)[ self doubleLoValue ];
}

- (void)setIntLoValue:(int)anInt
{
    [ self setDoubleLoValue:anInt ];
}

- (float)floatLoValue
{
    return (float)[ self doubleLoValue ];
}

- (void)setFloatLoValue:(float)aFloat
{
    [ self setDoubleLoValue:aFloat ];
}

/*- (void)takeIntLoValueFrom:(id)sender
{
    _sm_loValue = [ sender intValue ];
    [ (NSControl *)[ self controlView ] updateCell:self ];
}

- (void)takeFloatLoValueFrom:(id)sender
{
    _sm_loValue = [ sender floatValue ];
    [ (NSControl *)[ self controlView ] updateCell:self ];
}

- (void)takeDoubleLoValueFrom:(id)sender
{
    _sm_loValue = [ sender doubleValue ];
    [ (NSControl *)[ self controlView ] updateCell:self ];
}

- (void)takeStringLoValueFrom:(id)sender
{
    _sm_loValue = [ [ sender stringValue ] doubleValue ];
    [ (NSControl *)[ self controlView ] updateCell:self ];
}

- (void)takeObjectLoValueFrom:(id)sender
{
    [ self setObjectLoValue:[ sender objectValue ] ];
}*/

#pragma mark -

- (NSRect)_sm_loKnobRect
{
    NSRect	loKnobRect;
    double	saveValue;

    // Adjust the current value of the slider, get the rectangle, then reset the current value.
    saveValue = [super doubleValue];
    [super setDoubleValue:_sm_loValue];
    loKnobRect = [ self knobRectFlipped:[ [ self controlView ] isFlipped ] ];
    [super setDoubleValue:saveValue];

    return loKnobRect;
}

@end