80 const char *lbl1,
const char *lbl2,
const char *dsp1,
81 const char *dsp2,
int id)
123 Int_t i, nexe, offset;
125 const TGFont *counterFont =
fClient->GetFont(
"-*-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*");
126 if (!counterFont)
return;
129 const TGFont *textFont =
fClient->GetFont(
"-*-helvetica-bold-r-*-*-8-*-*-*-*-*-*-*");
130 if (!textFont)
return;
133 const TGFont *labelFont =
fClient->GetFont(
"-*-helvetica-bold-r-*-*-14-*-*-*-*-*-*-*");
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;
256 if (!glowImage || !glowImage->
IsValid()) {
257 Error(
"TGSpeedo::Glow",
"glow_green.png not found");
263 if (!glowImage || !glowImage->
IsValid()) {
264 Error(
"TGSpeedo::Glow",
"glow_orange.png not found");
270 if (!glowImage || !glowImage->
IsValid()) {
271 Error(
"TGSpeedo::Glow",
"glow_red.png not found");
292 int xc = (
fBase->GetWidth() + 1) / 2;
293 int yc = (
fBase->GetHeight() + 1) / 2;
296 if ((event->
fX > (xc - 26)) && (event->
fX < (xc + 26)) &&
297 (event->
fY < (yc + 50)) && (event->
fY > (yc + 28))) {
301 else if ((event->
fX > (xc + 30)) && (event->
fX < (xc + 40)) &&
302 (event->
fY > (yc + 57)) && (event->
fY < (yc + 67))) {
449 if ((damping > 0) || (
gVirtualX->InheritsFrom(
"TGX11")))
456 Float_t diff_ratio = diff_scale / diff_angle;
460 if (new_angle > old_angle) {
461 for (i=old_angle; i<new_angle; i+=step) {
468 if (new_angle < old_angle) {
469 for (i=old_angle; i>new_angle; i-=step) {
504 Int_t xch0, xch1, ych0, ych1;
505 Int_t xpk0, ypk0, xpk1, ypk1;
506 Int_t xmn0, ymn0, xmn1, ymn1;
531 if (!img || !img->
IsValid())
return;
533 img->
DrawLine(xpk0, ypk0, xpk1, ypk1,
"#00ff00", 3);
534 img->
DrawLine(xpk0, ypk0, xpk1, ypk1,
"#ffffff", 1);
537 img->
DrawLine(xmn0, ymn0, xmn1, ymn1,
"#ffff00", 3);
538 img->
DrawLine(xmn0, ymn0, xmn1, ymn1,
"#ff0000", 1);
541 img->
DrawLine(xch0, ych0, xch1, ych1,
"#ff0000", 2);
577 if (nexe%3 == 0 && ww < 10000)
break;
583 snprintf(sval, 80,
"%04d", (
int)ww);
584 snprintf(dsval, 80,
"%c %c %c %c", sval[0], sval[1], sval[2], sval[3]);
612 Int_t xch0, xch1, ych0, ych1;
613 Int_t xpk0, ypk0, xpk1, ypk1;
614 Int_t xmn0, ymn0, xmn1, ymn1;
657 if (nexe%3 == 0 && ww < 10000)
break;
663 snprintf(sval, 80,
"%04d", (
int)ww);
664 snprintf(dsval, 80,
"%c %c %c %c", sval[0], sval[1], sval[2], sval[3]);
682 if (!img || !img->
IsValid())
return;
684 img->
DrawLine(xpk0, ypk0, xpk1, ypk1,
"#00ff00", 3);
685 img->
DrawLine(xpk0, ypk0, xpk1, ypk1,
"#ffffff", 1);
688 img->
DrawLine(xmn0, ymn0, xmn1, ymn1,
"#ffff00", 3);
689 img->
DrawLine(xmn0, ymn0, xmn1, ymn1,
"#ff0000", 1);
692 img->
DrawLine(xch0, ych0, xch1, ych1,
"#ff0000", 2);
const Mask_t kButtonPressMask
const Mask_t kButtonReleaseMask
Handle_t FontStruct_t
Pointer to font structure.
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
float Float_t
Float 4 bytes (float).
Encapsulate fonts used in the GUI system.
FontStruct_t GetFontStruct() const
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
TGFrame(const TGFrame &)=delete
void DoRedraw() override
Redraw the frame.
TGClient * fClient
Connection to display server.
Handle_t fId
X11/Win32 Window identifier.
const TGPicture * fBase
picture used as background
Int_t fBufferSize
circular buffer size
void SetOdoValue(Int_t val)
Set actual value of odo meter.
Float_t GetMean()
Compute and return the mean of the circular buffer content.
Bool_t HandleButton(Event_t *event) override
Handle mouse button event.
TString fLabel1
main label (first line)
void StepScale(Float_t step)
Increment/decrement scale (needle position) of "step" value.
EGlowColor fThresholdColor[3]
glowing threshold colors
void SetDisplayText(const char *text1, const char *text2="")
Set small display text (two lines).
TString fDisplay1
first line in the small display
~TGSpeedo() override
TGSpeedo widget Destructor.
void Glow(EGlowColor col=kGreen)
Make speedo glowing.
void SetMinMaxScale(Float_t min, Float_t max)
Set min and max scale values.
Float_t fMeanVal
mean value mark
TGSpeedo(const TGWindow *p=nullptr, int id=-1)
TGSpeedo widget constructor.
Int_t fCounter
small odo meter (4 digits)
TImage * fImage
image used as background
void SetBufferSize(Int_t size)
Change the circular buffer size (used for the automatic mean calculation).
FontStruct_t fCounterFS
font structures for text rendering
void DrawText()
Draw text in speedo widget.
TString fDisplay2
second line in the small display
Float_t fScaleMax
needle min and max scale
Float_t fPeakVal
maximum peak mark
Int_t fBufferCount
circular buffer count
TString fPicName
name of picture used as background
Bool_t fThresholdActive
kTRUE if glowing thresholds are active
void Translate(Float_t val, Float_t angle, Int_t *x, Int_t *y)
Translate distance from center and angle to xy coordinates.
Float_t fThreshold[3]
glowing thresholds
void SetLabelText(const char *text1, const char *text2="")
Set main label text (two lines).
TImage * fImage2
intermediate image used as background
void SetScaleValue(Float_t val)
Set actual scale (needle position) value.
Bool_t fMeanMark
kTRUE if mean mark is active
std::vector< Float_t > fBuffer
circular buffer for mean calculation
TString fLabel2
main label (second line)
Float_t fAngleMax
needle min and max angle
TGDimension GetDefaultSize() const override
Return default dimension of the widget.
void Build()
Build TGSpeedo widget.
void DoRedraw() override
Redraw speedo widget.
void DrawNeedle()
Draw needle in speedo widget.
Bool_t fPeakMark
kTRUE if peak mark is active
Float_t fValue
needle angle and corresponding value
An abstract interface to image processing library.
static TImage * Open(const char *file, EImageFileTypes type=kUnknown)
Open a specified image file.
virtual void DrawLine(UInt_t, UInt_t, UInt_t, UInt_t, const char *="#000000", UInt_t=1)
virtual Bool_t IsValid() const
virtual void PaintImage(Drawable_t, Int_t, Int_t, Int_t=0, Int_t=0, UInt_t=0, UInt_t=0, Option_t *="")
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
const char * Data() const
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
EGEventType fType
of event (see EGEventType)
Int_t fY
pointer x, y coordinates in event window
UInt_t fCode
key or button code