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 Int_t i, nexe, offset;
126 if (!counterFont)
return;
130 if (!textFont)
return;
134 if (!labelFont)
return;
148 for (i=1; i<4; i++) {
149 mark[i] = mark[i-1] + step;
156 for (i=0; i<5; i++) {
160 if (mark[4] < 1000.0)
break;
171 for (i=0; i<5; i++) {
175 if (mark[4] > 99.9 )
break;
246 if (!glowImage || !glowImage->
IsValid()) {
247 Error(
"TGSpeedo::Glow",
"glow_green.png not found");
253 if (!glowImage || !glowImage->
IsValid()) {
254 Error(
"TGSpeedo::Glow",
"glow_orange.png not found");
260 if (!glowImage || !glowImage->
IsValid()) {
261 Error(
"TGSpeedo::Glow",
"glow_red.png not found");
286 if ((event->
fX > (xc - 26)) && (
event->fX < (xc + 26)) &&
287 (
event->fY < (yc + 50)) && (
event->fY > (yc + 28))) {
291 else if ((event->
fX > (xc + 30)) && (event->
fX < (xc + 40)) &&
292 (event->
fY > (yc + 57)) && (event->
fY < (yc + 67))) {
412 if ((damping > 0) || (
gVirtualX->InheritsFrom(
"TGX11")))
419 Float_t diff_ratio = diff_scale / diff_angle;
420 Float_t old_angle = fAngleMin + (old_val / diff_ratio);
421 Float_t new_angle = fAngleMin + (new_val / diff_ratio);
423 if (new_angle > old_angle) {
424 for (i=old_angle; i<new_angle; i+=step) {
431 if (new_angle < old_angle) {
432 for (i=old_angle; i>new_angle; i-=step) {
467 Int_t xch0, xch1, ych0, ych1;
468 Int_t xpk0, ypk0, xpk1, ypk1;
469 Int_t xmn0, ymn0, xmn1, ymn1;
492 if (!img || !img->
IsValid())
return;
494 img->
DrawLine(xpk0, ypk0, xpk1, ypk1,
"#00ff00", 3);
495 img->
DrawLine(xpk0, ypk0, xpk1, ypk1,
"#ffffff", 1);
498 img->
DrawLine(xmn0, ymn0, xmn1, ymn1,
"#ffff00", 3);
499 img->
DrawLine(xmn0, ymn0, xmn1, ymn1,
"#ff0000", 1);
502 img->
DrawLine(xch0, ych0, xch1, ych1,
"#ff0000", 2);
538 if (nexe%3 == 0 && ww < 10000)
break;
544 snprintf(sval, 80,
"%04d", (
int)ww);
545 snprintf(dsval, 80,
"%c %c %c %c", sval[0], sval[1], sval[2], sval[3]);
573 Int_t xch0, xch1, ych0, ych1;
574 Int_t xpk0, ypk0, xpk1, ypk1;
575 Int_t xmn0, ymn0, xmn1, ymn1;
618 if (nexe%3 == 0 && ww < 10000)
break;
624 snprintf(sval, 80,
"%04d", (
int)ww);
625 snprintf(dsval, 80,
"%c %c %c %c", sval[0], sval[1], sval[2], sval[3]);
643 if (!img || !img->
IsValid())
return;
645 img->
DrawLine(xpk0, ypk0, xpk1, ypk1,
"#00ff00", 3);
646 img->
DrawLine(xpk0, ypk0, xpk1, ypk1,
"#ffffff", 1);
649 img->
DrawLine(xmn0, ymn0, xmn1, ymn1,
"#ffff00", 3);
650 img->
DrawLine(xmn0, ymn0, xmn1, ymn1,
"#ff0000", 1);
653 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.
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