Added class JSDSlider by Dr.H.Reh.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10275 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
25d65010fc
commit
f0307bad5c
31
headers/private/print/libprint/JSDSlider.h
Normal file
31
headers/private/print/libprint/JSDSlider.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
JSDSlider.h
|
||||||
|
Dr.H.Reh
|
||||||
|
27.11.2004
|
||||||
|
|
||||||
|
Based on source code from Be Inc. RIP
|
||||||
|
Copyright 1995 Be Incorporated, All Rights Reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __JSD_SLIDER_H
|
||||||
|
#define __JSD_SLIDER_H
|
||||||
|
|
||||||
|
#include <Slider.h>
|
||||||
|
#include <String.h>
|
||||||
|
|
||||||
|
|
||||||
|
class JSDSlider : public BSlider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
JSDSlider(BRect frame, const char* name, const char *label, BMessage *msg,
|
||||||
|
int32 min, int32 max, thumb_style t);
|
||||||
|
|
||||||
|
~JSDSlider();
|
||||||
|
|
||||||
|
char* UpdateText() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
BString* fResult;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
50
src/add-ons/print/drivers/shared/libprint/JSDSlider.cpp
Normal file
50
src/add-ons/print/drivers/shared/libprint/JSDSlider.cpp
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
JSDSlider.cpp
|
||||||
|
Dr.H.Reh
|
||||||
|
27.11.2004
|
||||||
|
|
||||||
|
Based on source code from Be Inc. RIP
|
||||||
|
Copyright 1995 Be Incorporated, All Rights Reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "JSDSlider.h"
|
||||||
|
|
||||||
|
#include <Window.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
JSDSlider :: JSDSlider(BRect frame, const char* name, const char *label,
|
||||||
|
BMessage *msg, int32 min, int32 max, thumb_style t)
|
||||||
|
: BSlider(frame, name, label, msg, min, max, t)
|
||||||
|
{
|
||||||
|
fResult = new BString();
|
||||||
|
}
|
||||||
|
|
||||||
|
JSDSlider :: ~JSDSlider()
|
||||||
|
{
|
||||||
|
delete fResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* JSDSlider :: UpdateText() const
|
||||||
|
{
|
||||||
|
// When the slider's Draw method is called, this method
|
||||||
|
// will also be called. If its return value is non-NULL,
|
||||||
|
// then it will be drawn with the rest of the slider
|
||||||
|
static char string[64];
|
||||||
|
string[0] = 0;
|
||||||
|
|
||||||
|
if (!strcmp("gamma", Name()) ) {
|
||||||
|
float gamma;
|
||||||
|
gamma = exp((Value() * log(2.0) * 0.01) );
|
||||||
|
sprintf(string, " %.2f", gamma);
|
||||||
|
} else if (!strcmp("inkDensity", Name()) ) {
|
||||||
|
float density;
|
||||||
|
density = 127 - Value();
|
||||||
|
sprintf(string," %.2f", density/127.0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
*fResult = string;
|
||||||
|
return (char *)fResult->String();
|
||||||
|
}
|
@ -11,6 +11,7 @@ StaticLibrary print :
|
|||||||
GraphicsDriver.cpp
|
GraphicsDriver.cpp
|
||||||
Halftone.cpp
|
Halftone.cpp
|
||||||
HalftoneView.cpp
|
HalftoneView.cpp
|
||||||
|
JSDSlider.cpp
|
||||||
JobData.cpp
|
JobData.cpp
|
||||||
JobSetupDlg.cpp
|
JobSetupDlg.cpp
|
||||||
PackBits.cpp
|
PackBits.cpp
|
||||||
|
Loading…
x
Reference in New Issue
Block a user