Assorted whitespace cleanup and typo fixes.
[haiku.git] / src / libs / print / libprint / JSDSlider.cpp
blob536f67bf6b77e8ce82ed7e71bf3db4b43b7aa496
1 /*
2 JSDSlider.cpp
3 Dr.H.Reh
4 27.11.2004
6 Based on source code from Be Inc. RIP
7 Copyright 1995 Be Incorporated, All Rights Reserved.
8 */
10 #include "JSDSlider.h"
12 #include <stdlib.h>
13 #include <stdio.h>
14 #include <string.h>
17 JSDSlider::JSDSlider(const char* name, const char* label,
18 BMessage* msg, int32 min, int32 max)
19 : BSlider(name, label, msg, min, max, B_HORIZONTAL)
24 JSDSlider::~JSDSlider()
29 const char*
30 JSDSlider::UpdateText() const
32 // When the slider's Draw method is called, this method will also be called.
33 // If its return value is non-NULL, then it will be drawn with the rest of
34 // the slider
35 static char string[64];
36 string[0] = 0;
38 if (!strcmp("gamma", Name())) {
39 float gamma;
40 gamma = exp((Value() * log(2.0) * 0.01) );
41 sprintf(string, " %.2f", gamma);
42 } else if (!strcmp("inkDensity", Name()) ) {
43 float density = Value();
44 density = (density / 127.0) * 100.0;
45 sprintf(string," %.0f%%", density);
48 fResult.SetTo(string);
49 return fResult.String();