64 fTextFS = fCounterFS =
kNone;
65 fThreshold[0] = fThreshold[1] = fThreshold[2] = 0.0;
66 fThresholdColor[0] =
kGreen;
68 fThresholdColor[2] =
kRed;
70 fPicName =
"speedo.gif";
72 if (!fImage || !fImage->IsValid())
73 Error(
"TGSpeedo::Build",
"%s not found", fPicName.Data());
82 const char *lbl1,
const char *lbl2,
const char *dsp1,
83 const char *dsp2,
int id)
123 TString ar = fp +
"/arialbd.ttf";
124 Int_t i, nexe, offset;
127 if (!counterFont)
return;
131 if (!textFont)
return;
135 if (!labelFont)
return;
149 for (i=1; i<4; i++) {
150 mark[i] = mark[i-1] + step;
157 for (i=0; i<5; i++) {
161 if (mark[4] < 1000.0)
break;
172 for (i=0; i<5; i++) {
176 if (mark[4] > 99.9 )
break;
247 if (!glowImage || !glowImage->
IsValid()) {
248 Error(
"TGSpeedo::Glow",
"glow_green.png not found");
254 if (!glowImage || !glowImage->
IsValid()) {
255 Error(
"TGSpeedo::Glow",
"glow_orange.png not found");
261 if (!glowImage || !glowImage->
IsValid()) {
262 Error(
"TGSpeedo::Glow",
"glow_red.png not found");
287 if ((event->
fX > (xc - 26)) && (
event->fX < (xc + 26)) &&
288 (
event->fY < (yc + 50)) && (
event->fY > (yc + 28))) {
292 else if ((event->
fX > (xc + 30)) && (event->
fX < (xc + 40)) &&
293 (event->
fY > (yc + 57)) && (event->
fY < (yc + 67))) {
413 if ((damping > 0) || (
gVirtualX->InheritsFrom(
"TGX11")))
420 Float_t diff_ratio = diff_scale / diff_angle;
421 Float_t old_angle = fAngleMin + (old_val / diff_ratio);
422 Float_t new_angle = fAngleMin + (new_val / diff_ratio);
424 if (new_angle > old_angle) {
425 for (i=old_angle; i<new_angle; i+=step) {
432 if (new_angle < old_angle) {
433 for (i=old_angle; i>new_angle; i-=step) {
468 Int_t xch0, xch1, ych0, ych1;
469 Int_t xpk0, ypk0, xpk1, ypk1;
470 Int_t xmn0, ymn0, xmn1, ymn1;
493 if (!img || !img->
IsValid())
return;
495 img->
DrawLine(xpk0, ypk0, xpk1, ypk1,
"#00ff00", 3);
496 img->
DrawLine(xpk0, ypk0, xpk1, ypk1,
"#ffffff", 1);
499 img->
DrawLine(xmn0, ymn0, xmn1, ymn1,
"#ffff00", 3);
500 img->
DrawLine(xmn0, ymn0, xmn1, ymn1,
"#ff0000", 1);
503 img->
DrawLine(xch0, ych0, xch1, ych1,
"#ff0000", 2);
532 TString ar = fp +
"/arialbd.ttf";
540 if (nexe%3 == 0 && ww < 10000)
break;
546 snprintf(sval, 80,
"%04d", (
int)ww);
547 snprintf(dsval, 80,
"%c %c %c %c", sval[0], sval[1], sval[2], sval[3]);
575 Int_t xch0, xch1, ych0, ych1;
576 Int_t xpk0, ypk0, xpk1, ypk1;
577 Int_t xmn0, ymn0, xmn1, ymn1;
613 TString ar = fp +
"/arialbd.ttf";
621 if (nexe%3 == 0 && ww < 10000)
break;
627 snprintf(sval, 80,
"%04d", (
int)ww);
628 snprintf(dsval, 80,
"%c %c %c %c", sval[0], sval[1], sval[2], sval[3]);
646 if (!img || !img->
IsValid())
return;
648 img->
DrawLine(xpk0, ypk0, xpk1, ypk1,
"#00ff00", 3);
649 img->
DrawLine(xpk0, ypk0, xpk1, ypk1,
"#ffffff", 1);
652 img->
DrawLine(xmn0, ymn0, xmn1, ymn1,
"#ffff00", 3);
653 img->
DrawLine(xmn0, ymn0, xmn1, ymn1,
"#ff0000", 1);
656 img->
DrawLine(xch0, ych0, xch1, ych1,
"#ff0000", 2);
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
virtual Bool_t IsValid() const
void SetDisplayText(const char *text1, const char *text2="")
Set small display text (two lines).
void DrawNeedle()
Draw needle in speedo widget.
void StepScale(Float_t step)
Increment/decrement scale (needle position) of "step" value.
void DrawText()
Draw text in speedo widget.
void Translate(Float_t val, Float_t angle, Int_t *x, Int_t *y)
Translate distance from center and angle to xy coordinates.
An abstract interface to image processing library.
virtual void Merge(const TImage *, const char *="alphablend", Int_t=0, Int_t=0)
virtual Pixmap_t GetPixmap()
virtual void DoRedraw()
Redraw the frame.
void SetMinMaxScale(Float_t min, Float_t max)
Set min and max scale values.
TGPicturePool * GetPicturePool() const
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
void FreePicture(const TGPicture *pic)
Free picture resource.
TGSpeedo(const TGWindow *p=0, int id=-1)
TGSpeedo widget constructor.
virtual TGDimension GetDefaultSize() const
Return default dimension of the widget.
void SetOdoValue(Int_t val)
Set actual value of odo meter.
void Error(const char *location, const char *msgfmt,...)
const Mask_t kButtonPressMask
virtual void PaintImage(Drawable_t, Int_t, Int_t, Int_t=0, Int_t=0, UInt_t=0, UInt_t=0, Option_t *="")
void SetScaleValue(Float_t val)
Set actual scale (needle position) value.
R__EXTERN TSystem * gSystem
void Glow(EGlowColor col=kGreen)
Make speedo glowing.
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
void SetLabelText(const char *text1, const char *text2="")
Set main label text (two lines).
virtual TObject * Clone(const char *) const
Make a clone of an object using the Streamer facility.
const TGPicture * GetPicture(const char *name)
Get a picture from the picture pool.
virtual ~TGSpeedo()
TGSpeedo widget Destructor.
void Build()
Build TGSpeedo widget.
virtual void DrawText(Int_t=0, Int_t=0, const char *="", Int_t=12, const char *=0, const char *="fixed", EText3DType=TImage::kPlain, const char *=0, Float_t=0)
virtual Pixmap_t GetMask()
const Mask_t kButtonReleaseMask
FontStruct_t GetFontStruct() const
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
virtual void DrawLine(UInt_t, UInt_t, UInt_t, UInt_t, const char *="#000000", UInt_t=1)
EGlowColor fThresholdColor[3]
static TImage * Open(const char *file, EImageFileTypes type=kUnknown)
Open a specified image file.
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event.
TGFont * GetFont(const char *font, Bool_t fixedDefault=kTRUE)
Get a font from the font pool.
virtual void DoRedraw()
Redraw speedo widget.
const char * Data() const