Logo ROOT  
Reference Guide
TGSpeedo.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id: TGSpeedo.cxx
2// Author: Bertrand Bellenot 26/10/06
3
4/*************************************************************************
5 * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12//////////////////////////////////////////////////////////////////////////
13// //
14// TGSpeedo //
15// //
16// TGSpeedo is a widget looking like a speedometer, with a needle, //
17// a counter and a small odometer window. //
18// //
19//Begin_Html
20/*
21<img src="gif/speedometer.gif">
22*/
23//End_Html //
24// //
25// Three thresholds are configurable, with their glowing color //
26// A peak mark can be enabled, allowing to keep track of the highest //
27// value displayed. The mark can be reset by right-clicking on the //
28// widget. //
29// Two signals are available: //
30// OdoClicked(): when user click on the small odometer window //
31// LedClicked(): when user click on the small led near the counter //
32// //
33//////////////////////////////////////////////////////////////////////////
34
35#include "TSystem.h"
36#include "TGClient.h"
37#include "TGResourcePool.h"
38#include "TImage.h"
39#include "TEnv.h"
40#include "TMath.h"
41#include "TVirtualX.h"
42
43#include "TGSpeedo.h"
44
45
47
48////////////////////////////////////////////////////////////////////////////////
49/// TGSpeedo widget constructor.
50
52 : TGFrame(p, 1, 1), TGWidget (id), fImage(0), fImage2(0), fBase(0)
53{
54 fAngleMin = -133.5;
55 fAngleMax = 133.5;
56 fAngle = -133.5;
57 fScaleMin = 0.0;
58 fScaleMax = 100.0;
59 fValue = 0.0;
60 fCounter = 0;
63 fPeakVal = 0.0;
64 fMeanVal = 0.0;
66 fThreshold[0] = fThreshold[1] = fThreshold[2] = 0.0;
71 fPicName = "speedo.gif";
73 if (!fImage || !fImage->IsValid())
74 Error("TGSpeedo::Build", "%s not found", fPicName.Data());
75 Build();
77}
78
79////////////////////////////////////////////////////////////////////////////////
80/// TGSpeedo widget constructor.
81
83 const char *lbl1, const char *lbl2, const char *dsp1,
84 const char *dsp2, int id)
85 : TGFrame(p, 1, 1), TGWidget (id), fImage(0), fImage2(0), fBase(0)
86{
87 fAngleMin = -133.5;
88 fAngleMax = 133.5;
89 fAngle = -133.5;
90 fScaleMin = smin;
91 fScaleMax = smax;
92 fValue = smin;
93 fCounter = 0;
94 fLabel1 = lbl1;
95 fLabel2 = lbl2;
96 fDisplay1 = dsp1;
97 fDisplay2 = dsp2;
100 fPeakVal = 0.0;
101 fMeanVal = 0.0;
103 fThreshold[0] = fThreshold[1] = fThreshold[2] = 0.0;
108 fPicName = "speedo.gif";
110 if (!fImage || !fImage->IsValid())
111 Error("TGSpeedo::Build", "%s not found", fPicName.Data());
112 Build();
114}
115
116////////////////////////////////////////////////////////////////////////////////
117/// Build TGSpeedo widget.
118
120{
121 TString sc;
122 Float_t step, mark[5];
123 TString ar = "arialbd.ttf";
124 Int_t i, nexe, offset;
125
126 const TGFont *counterFont = fClient->GetFont("-*-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*");
127 if (!counterFont) return;
128 fCounterFS = counterFont->GetFontStruct();
129
130 const TGFont *textFont = fClient->GetFont("-*-helvetica-bold-r-*-*-8-*-*-*-*-*-*-*");
131 if (!textFont) return;
132 fTextFS = textFont->GetFontStruct();
133
134 const TGFont *labelFont = fClient->GetFont("-*-helvetica-bold-r-*-*-14-*-*-*-*-*-*-*");
135 if (!labelFont) return;
136 FontStruct_t labelFS = labelFont->GetFontStruct();
137
138 if (fImage && fImage->IsValid()) {
141 // center of the image
142 Float_t xc = (Float_t)(fBase ? (fBase->GetWidth() + 1) / 2 : 96.0);
143 Float_t yc = (Float_t)(fBase ? (fBase->GetHeight() + 1) / 2 : 96.0);
144
145 // compute scale ticks steps
146 step = (fScaleMax - fScaleMin) / 4.0;
147 mark[0] = fScaleMin;
148 mark[4] = fScaleMax;
149 for (i=1; i<4; i++) {
150 mark[i] = mark[i-1] + step;
151 }
152 // format tick labels
153 if (fScaleMax >= 1000.0) {
154 nexe = 0;
155 while (1) {
156 nexe++;
157 for (i=0; i<5; i++) {
158 mark[i] /= 10.0;
159 }
160 // coverity[loop_condition]: ignore - false positive
161 if (mark[4] < 1000.0) break;
162 }
163 // draw multiplier
164 fImage->DrawText((Int_t)xc - 11, (Int_t)yc + 15, "x10", 12, "#ffffff", ar);
165 sc.Form("%d", nexe);
166 fImage->DrawText((Int_t)xc + 11, (Int_t)yc + 13, sc.Data(), 10, "#ffffff", ar);
167 }
168 else if (fScaleMax < 100.0) {
169 nexe = 0;
170 while (1) {
171 nexe--;
172 for (i=0; i<5; i++) {
173 mark[i] *= 10.0;
174 }
175 // coverity[loop_condition]: ignore - false positive
176 if (mark[4] > 99.9 ) break;
177 }
178 // draw multiplier
179 fImage->DrawText((Int_t)xc - 11, (Int_t)yc + 15, "x10", 12, "#ffffff", ar);
180 sc.Form("%d", nexe);
181 fImage->DrawText((Int_t)xc + 11, (Int_t)yc + 13, sc.Data(), 10, "#ffffff", ar);
182 }
183 // Format and draw scale tickmarks
184 sc.Form("%d",(Int_t)mark[0]);
185 fImage->DrawText((Int_t)xc - 51, (Int_t)yc + 30, sc.Data(), 14, "#ffffff", ar);
186 sc.Form("%d",(Int_t)mark[1]);
187 fImage->DrawText((Int_t)xc - 59, (Int_t)yc - 29, sc.Data(), 14, "#ffffff", ar);
188 sc.Form("%d",(Int_t)mark[2]);
189 offset = gVirtualX->TextWidth(labelFS, sc.Data(), sc.Length()) / 2;
190 fImage->DrawText((Int_t)xc - offset, (Int_t)yc - 65, sc.Data(), 14, "#ffffff", ar);
191 sc.Form("%d",(Int_t)mark[3]);
192 offset = 60 - gVirtualX->TextWidth(labelFS, sc.Data(), sc.Length());
193 fImage->DrawText((Int_t)xc + offset, (Int_t)yc - 29, sc.Data(), 14, "#ffffff", ar);
194 sc.Form("%d",(Int_t)mark[4]);
195 offset = 52 - gVirtualX->TextWidth(labelFS, sc.Data(), sc.Length());
196 fImage->DrawText((Int_t)xc + offset, (Int_t)yc + 30, sc.Data(), 14, "#ffffff", ar);
197 // draw main label (two lines)
198 fImage->DrawText((Int_t)xc + 13, (Int_t)yc - 17, fLabel1.Data(), 14, "#ffffff", ar);
199 fImage->DrawText((Int_t)xc + 13, (Int_t)yc - 4, fLabel2.Data(), 12, "#ffffff", ar);
200 if (fBase)
201 gVirtualX->ShapeCombineMask(fId, 0, 0, fBase->GetMask());
202 }
203}
204
205////////////////////////////////////////////////////////////////////////////////
206/// TGSpeedo widget Destructor.
207
209{
210 if (fImage && fImage->IsValid())
211 delete fImage;
212 if (fImage2 && fImage2->IsValid())
213 delete fImage2;
214 if (fBase)
216}
217
218////////////////////////////////////////////////////////////////////////////////
219/// Return default dimension of the widget.
220
222{
223 if (fBase)
225 return TGDimension(100, 100);
226}
227
228////////////////////////////////////////////////////////////////////////////////
229/// Make speedo glowing.
230
232{
233 static EGlowColor act_col = kNoglow;
234 TImage *glowImage = 0;
235
236 if (col == act_col)
237 return;
238
239 if (fImage && fImage->IsValid())
240 delete fImage;
241
242 switch (col) {
243 case kNoglow:
244 break;
245 case kGreen:
246 glowImage = TImage::Open("glow_green.png");
247 if (!glowImage || !glowImage->IsValid()) {
248 Error("TGSpeedo::Glow", "glow_green.png not found");
249 glowImage = 0;
250 }
251 break;
252 case kOrange:
253 glowImage = TImage::Open("glow_orange.png");
254 if (!glowImage || !glowImage->IsValid()) {
255 Error("TGSpeedo::Glow", "glow_orange.png not found");
256 glowImage = 0;
257 }
258 break;
259 case kRed:
260 glowImage = TImage::Open("glow_red.png");
261 if (!glowImage || !glowImage->IsValid()) {
262 Error("TGSpeedo::Glow", "glow_red.png not found");
263 glowImage = 0;
264 }
265 break;
266 }
268 if (fImage && fImage->IsValid() && glowImage && glowImage->IsValid()) {
269 fImage->Merge(glowImage);
270 delete glowImage;
271 }
272 act_col = col;
273 Build();
274 DrawText();
275}
276
277////////////////////////////////////////////////////////////////////////////////
278/// Handle mouse button event.
279
281{
282 if (fBase) {
283 int xc = (fBase->GetWidth() + 1) / 2;
284 int yc = (fBase->GetHeight() + 1) / 2;
285 if (event->fType == kButtonRelease && event->fCode == kButton1) {
286 // check if in the selector area
287 if ((event->fX > (xc - 26)) && (event->fX < (xc + 26)) &&
288 (event->fY < (yc + 50)) && (event->fY > (yc + 28))) {
289 OdoClicked();
290 }
291 // check if in the led area
292 else if ((event->fX > (xc + 30)) && (event->fX < (xc + 40)) &&
293 (event->fY > (yc + 57)) && (event->fY < (yc + 67))) {
294 LedClicked();
295 }
296 }
297 if (event->fType == kButtonRelease && event->fCode == kButton3) {
298 ResetPeakVal();
299 }
300 }
301 return kTRUE;
302}
303
304////////////////////////////////////////////////////////////////////////////////
305/// Set actual value of odo meter.
306
308{
309 // avoid useless redraw
310 if (val == fCounter)
311 return;
312 fCounter = val;
313 DrawText();
314 DrawNeedle();
315}
316
317////////////////////////////////////////////////////////////////////////////////
318/// Set small display text (two lines).
319
320void TGSpeedo::SetDisplayText(const char *text1, const char *text2)
321{
322 if (!(fDisplay1.CompareTo(text1)) &&
323 !(fDisplay2.CompareTo(text2)))
324 return;
325 fDisplay1 = text1;
326 fDisplay2 = text2;
327 DrawText();
328 DrawNeedle();
329}
330
331////////////////////////////////////////////////////////////////////////////////
332/// Set main label text (two lines).
333
334void TGSpeedo::SetLabelText(const char *text1, const char *text2)
335{
336 if (fImage && fImage->IsValid())
337 delete fImage;
338 fLabel1 = text1;
339 fLabel2 = text2;
341 if (!fImage || !fImage->IsValid())
342 Error("TGSpeedo::Build", "%s not found", fPicName.Data());
343 Build();
344 DrawText();
345}
346
347////////////////////////////////////////////////////////////////////////////////
348/// Set min and max scale values.
349
351{
352 if (fImage && fImage->IsValid())
353 delete fImage;
354 fScaleMin = min;
355 fScaleMax = max;
357 if (!fImage || !fImage->IsValid())
358 Error("TGSpeedo::Build", "%s not found", fPicName.Data());
359 Build();
360 DrawText();
361}
362
363////////////////////////////////////////////////////////////////////////////////
364/// Set actual scale (needle position) value.
365
367{
368 // avoid useless redraw
369 if (val == fValue)
370 return;
371
372 fValue = val;
373 if (fValue > fScaleMax)
375 else if (fValue < fScaleMin)
377
378 if (fThresholdActive) {
379 if (fValue < fThreshold[0])
380 Glow(kNoglow);
381 if (fValue >= fThreshold[0] && fValue < fThreshold[1])
383 if (fValue >= fThreshold[1] && fValue < fThreshold[2])
385 if (fValue >= fThreshold[2])
387 }
388 if (fValue > fPeakVal)
390
392 (fAngleMax - fAngleMin)));
393
394 if (fAngle > fAngleMax)
396 else if (fAngle < fAngleMin)
398 DrawNeedle();
399}
400
401////////////////////////////////////////////////////////////////////////////////
402/// Set actual scale (needle position) value.
403
405{
406 Float_t i;
407 Float_t old_val = fValue;
408 Float_t step, new_val = val;
409 // avoid useless redraw
410 if (val == fValue)
411 return;
412
413 if ((damping > 0) || (gVirtualX->InheritsFrom("TGX11")))
414 step = 2.0;
415 else
416 step = 0.15;
417
418 Float_t diff_angle = fAngleMax - fAngleMin;
419 Float_t diff_scale = fScaleMax - fScaleMin;
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);
423
424 if (new_angle > old_angle) {
425 for (i=old_angle; i<new_angle; i+=step) {
426 new_val = (i - fAngleMin) * diff_ratio;
427 SetScaleValue(new_val);
428 if (damping > 0)
429 gSystem->Sleep(damping);
430 }
431 }
432 if (new_angle < old_angle) {
433 for (i=old_angle; i>new_angle; i-=step) {
434 new_val = (i - fAngleMin) * diff_ratio;
435 SetScaleValue(new_val);
436 if (damping > 0)
437 gSystem->Sleep(damping);
438 }
439 }
440 // Last step
441 SetScaleValue(val);
442}
443
444////////////////////////////////////////////////////////////////////////////////
445/// Increment/decrement scale (needle position) of "step" value.
446
448{
449 SetScaleValue(fValue + step);
450}
451
452////////////////////////////////////////////////////////////////////////////////
453/// Translate distance from center and angle to xy coordinates.
454
456{
457 Float_t xc = (Float_t)(fBase ? (fBase->GetWidth() + 1) / 2 : 96.0);
458 Float_t yc = (Float_t)(fBase ? (fBase->GetHeight() + 1) / 2 : 96.0);
459 *x = (Int_t)(xc + val * sin(angle * TMath::Pi() / 180) + 0.5);
460 *y = (Int_t)(yc - val * cos(angle * TMath::Pi() / 180) + 0.5);
461}
462
463////////////////////////////////////////////////////////////////////////////////
464/// Draw needle in speedo widget.
465
467{
468 Int_t xch0, xch1, ych0, ych1;
469 Int_t xpk0, ypk0, xpk1, ypk1;
470 Int_t xmn0, ymn0, xmn1, ymn1;
472 (fAngleMax - fAngleMin));
473
474 // compute x/y position of the needle
475 Translate(9.0, fAngle, &xch0, &ych0);
476 Translate(73.0, fAngle, &xch1, &ych1);
477
478 // compute x/y position of the peak mark
479 Float_t angle = fAngleMin + (fPeakVal / ((fScaleMax - fScaleMin) /
480 (fAngleMax - fAngleMin)));
481 Translate(80.0, angle, &xpk0, &ypk0);
482 Translate(67.0, angle, &xpk1, &ypk1);
483
484 // compute x/y position of the peak mark
485 angle = fAngleMin + (fMeanVal / ((fScaleMax - fScaleMin) /
486 (fAngleMax - fAngleMin)));
487 Translate(80.0, angle, &xmn0, &ymn0);
488 Translate(70.0, angle, &xmn1, &ymn1);
489
490 if (fImage2 && fImage2->IsValid()) {
491 // First clone original image.
492 TImage *img = (TImage*)fImage2->Clone("img");
493 if (!img || !img->IsValid()) return;
494 if (fPeakMark) {
495 img->DrawLine(xpk0, ypk0, xpk1, ypk1, "#00ff00", 3);
496 img->DrawLine(xpk0, ypk0, xpk1, ypk1, "#ffffff", 1);
497 }
498 if (fMeanMark) {
499 img->DrawLine(xmn0, ymn0, xmn1, ymn1, "#ffff00", 3);
500 img->DrawLine(xmn0, ymn0, xmn1, ymn1, "#ff0000", 1);
501 }
502 // draw line (used to render the needle) directly on the image
503 img->DrawLine(xch0, ych0, xch1, ych1, "#ff0000", 2);
504 // finally paint image to the widget
505 img->PaintImage(fId, 0, 0, 0, 0, 0, 0, "opaque");
506 // and finally, to avoid memory leaks
507 delete img;
508 }
509 gVirtualX->Update();
510}
511
512////////////////////////////////////////////////////////////////////////////////
513/// Draw text in speedo widget.
514
516{
517 char sval[80];
518 char dsval[80];
519 Int_t strSize;
520
521 // center of the image
522 Float_t xc = fBase ? (fBase->GetWidth() + 1) / 2 : 96.0;
523 Float_t yc = fBase ? (fBase->GetHeight() + 1) / 2 : 96.0;
524
525 if (fImage && fImage->IsValid()) {
526 // First clone original image.
527 if (fImage2 && fImage2->IsValid())
528 delete fImage2;
529 fImage2 = (TImage*)fImage->Clone("fImage2");
530 if (!fImage2 || !fImage2->IsValid()) return;
531 TString ar = "arialbd.ttf";
532 // format counter value
533 Int_t nexe = 0;
534 Int_t ww = fCounter;
535 if (fCounter >= 10000) {
536 while (1) {
537 nexe++;
538 ww /= 10;
539 if (nexe%3 == 0 && ww < 10000) break;
540 }
541 fImage2->DrawText((Int_t)xc - 9, (Int_t)yc + 72, "x10", 10, "#ffffff", ar);
542 snprintf(sval, 80, "%d", nexe);
543 fImage2->DrawText((Int_t)xc + 9, (Int_t)yc + 69, sval, 8, "#ffffff", ar);
544 }
545 snprintf(sval, 80, "%04d", (int)ww);
546 snprintf(dsval, 80, "%c %c %c %c", sval[0], sval[1], sval[2], sval[3]);
547 // draw text in the counter
548 if (gVirtualX->InheritsFrom("TGX11")) {
549 // as there is a small difference between Windows and Linux...
550 fImage2->DrawText((Int_t)xc - 18, (Int_t)yc + 55, dsval, 12, "#ffffff", ar);
551 }
552 else {
553 fImage2->DrawText((Int_t)xc - 16, (Int_t)yc + 56, dsval, 12, "#ffffff", ar);
554 }
555 // compute the size of the string to draw in the small display box
556 // first line
557 strSize = gVirtualX->TextWidth(fTextFS, fDisplay1.Data(), fDisplay1.Length()) - 6;
558 // draw text directly on the imaget_t)yc + 29, fDispla
559 fImage2->DrawText((Int_t)xc - (strSize / 2), (Int_t)yc + 29, fDisplay1.Data(), 8, "#ffffff", ar);
560 // second line
561 strSize = gVirtualX->TextWidth(fTextFS, fDisplay2.Data(), fDisplay2.Length()) - 6;
562 fImage2->DrawText((Int_t)xc - (strSize / 2), (Int_t)yc + 38, fDisplay2.Data(), 8, "#ffffff", ar);
563 }
564}
565
566////////////////////////////////////////////////////////////////////////////////
567/// Redraw speedo widget.
568
570{
571 char sval[80];
572 char dsval[80];
573 Int_t strSize;
574 Int_t xch0, xch1, ych0, ych1;
575 Int_t xpk0, ypk0, xpk1, ypk1;
576 Int_t xmn0, ymn0, xmn1, ymn1;
577 static Bool_t first = kTRUE;
578 if (first) {
580 first = kFALSE;
581 }
583 (fAngleMax - fAngleMin));
584
585 // center of the image
586 Float_t xc = fBase ? (fBase->GetWidth() + 1) / 2 : 96.0;
587 Float_t yc = fBase ? (fBase->GetHeight() + 1) / 2 : 96.0;
588
589 // compute x/y position of the needle
590 Translate(9.0, fAngle, &xch0, &ych0);
591 Translate(73.0, fAngle, &xch1, &ych1);
592
593 // compute x/y position of the peak mark
594 Float_t angle = fAngleMin + (fPeakVal / ((fScaleMax - fScaleMin) /
595 (fAngleMax - fAngleMin)));
596 Translate(80.0, angle, &xpk0, &ypk0);
597 Translate(67.0, angle, &xpk1, &ypk1);
598
599 // compute x/y position of the peak mark
600 angle = fAngleMin + (fMeanVal / ((fScaleMax - fScaleMin) /
601 (fAngleMax - fAngleMin)));
602 Translate(80.0, angle, &xmn0, &ymn0);
603 Translate(70.0, angle, &xmn1, &ymn1);
604
605 if (fImage && fImage->IsValid()) {
606 // First clone original image.
607 if (fImage2 && fImage2->IsValid())
608 delete fImage2;
609 fImage2 = (TImage*)fImage->Clone("fImage2");
610 if (!fImage2 || !fImage2->IsValid()) return;
611 TString ar = "arialbd.ttf";
612 // format counter value
613 Int_t nexe = 0;
614 Int_t ww = fCounter;
615 if (fCounter >= 10000) {
616 while (1) {
617 nexe++;
618 ww /= 10;
619 if (nexe%3 == 0 && ww < 10000) break;
620 }
621 fImage2->DrawText((Int_t)xc - 9, (Int_t)yc + 72, "x10", 10, "#ffffff", ar);
622 snprintf(sval, 80, "%d", nexe);
623 fImage2->DrawText((Int_t)xc + 9, (Int_t)yc + 69, sval, 8, "#ffffff", ar);
624 }
625 snprintf(sval, 80, "%04d", (int)ww);
626 snprintf(dsval, 80, "%c %c %c %c", sval[0], sval[1], sval[2], sval[3]);
627 // draw text in the counter
628 if (gVirtualX->InheritsFrom("TGX11")) {
629 // as there is a small difference between Windows and Linux...
630 fImage2->DrawText((Int_t)xc - 18, (Int_t)yc + 55, dsval, 12, "#ffffff", ar);
631 }
632 else {
633 fImage2->DrawText((Int_t)xc - 16, (Int_t)yc + 56, dsval, 12, "#ffffff", ar);
634 }
635 // compute the size of the string to draw in the small display box
636 // first line
637 strSize = gVirtualX->TextWidth(fTextFS, fDisplay1.Data(), fDisplay1.Length()) - 6;
638 // draw text directly on the imaget_t)yc + 29, fDispla
639 fImage2->DrawText((Int_t)xc - (strSize / 2), (Int_t)yc + 29, fDisplay1.Data(), 8, "#ffffff", ar);
640 // second line
641 strSize = gVirtualX->TextWidth(fTextFS, fDisplay2.Data(), fDisplay2.Length()) - 6;
642 fImage2->DrawText((Int_t)xc - (strSize / 2), (Int_t)yc + 38, fDisplay2.Data(), 8, "#ffffff", ar);
643 TImage *img = (TImage*)fImage2->Clone("img");
644 if (!img || !img->IsValid()) return;
645 if (fPeakMark) {
646 img->DrawLine(xpk0, ypk0, xpk1, ypk1, "#00ff00", 3);
647 img->DrawLine(xpk0, ypk0, xpk1, ypk1, "#ffffff", 1);
648 }
649 if (fMeanMark) {
650 img->DrawLine(xmn0, ymn0, xmn1, ymn1, "#ffff00", 3);
651 img->DrawLine(xmn0, ymn0, xmn1, ymn1, "#ff0000", 1);
652 }
653 // draw line (used to render the needle) directly on the image
654 img->DrawLine(xch0, ych0, xch1, ych1, "#ff0000", 2);
655 // finally paint image to the widget
656 img->PaintImage(fId, 0, 0, 0, 0, 0, 0, "opaque");
657 // and finally, to avoid memory leaks
658 delete img;
659 }
660}
@ kButtonRelease
Definition: GuiTypes.h:59
const Mask_t kButtonPressMask
Definition: GuiTypes.h:160
const Handle_t kNone
Definition: GuiTypes.h:87
const Mask_t kButtonReleaseMask
Definition: GuiTypes.h:161
Handle_t FontStruct_t
Definition: GuiTypes.h:38
@ kButton3
Definition: GuiTypes.h:213
@ kButton1
Definition: GuiTypes.h:213
int Int_t
Definition: RtypesCore.h:43
const Bool_t kFALSE
Definition: RtypesCore.h:90
float Float_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:89
#define ClassImp(name)
Definition: Rtypes.h:361
XFontStruct * id
Definition: TGX11.cxx:108
double cos(double)
double sin(double)
R__EXTERN TSystem * gSystem
Definition: TSystem.h:556
#define gVirtualX
Definition: TVirtualX.h:338
#define snprintf
Definition: civetweb.c:1540
TGFont * GetFont(const char *font, Bool_t fixedDefault=kTRUE)
Get a font from the font pool.
Definition: TGClient.cxx:348
TGPicturePool * GetPicturePool() const
Definition: TGClient.h:135
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition: TGClient.cxx:308
Definition: TGFont.h:149
FontStruct_t GetFontStruct() const
Definition: TGFont.h:193
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition: TGFrame.cxx:323
virtual void DoRedraw()
Redraw the frame.
Definition: TGFrame.cxx:414
TGClient * fClient
Definition: TGObject.h:37
Handle_t fId
Definition: TGObject.h:36
const TGPicture * GetPicture(const char *name)
Get a picture from the picture pool.
Definition: TGPicture.cxx:80
Pixmap_t GetMask() const
Definition: TGPicture.h:66
UInt_t GetHeight() const
Definition: TGPicture.h:64
UInt_t GetWidth() const
Definition: TGPicture.h:63
const TGPicture * fBase
Definition: TGSpeedo.h:46
void SetOdoValue(Int_t val)
Set actual value of odo meter.
Definition: TGSpeedo.cxx:307
virtual ~TGSpeedo()
TGSpeedo widget Destructor.
Definition: TGSpeedo.cxx:208
void ResetPeakVal()
Definition: TGSpeedo.h:106
TString fLabel1
Definition: TGSpeedo.h:50
void StepScale(Float_t step)
Increment/decrement scale (needle position) of "step" value.
Definition: TGSpeedo.cxx:447
FontStruct_t fTextFS
Definition: TGSpeedo.h:47
EGlowColor fThresholdColor[3]
Definition: TGSpeedo.h:60
void SetDisplayText(const char *text1, const char *text2="")
Set small display text (two lines).
Definition: TGSpeedo.cxx:320
Float_t fAngleMin
Definition: TGSpeedo.h:57
TString fDisplay1
Definition: TGSpeedo.h:52
virtual void DoRedraw()
Redraw speedo widget.
Definition: TGSpeedo.cxx:569
Float_t fScaleMin
Definition: TGSpeedo.h:58
EGlowColor
Definition: TGSpeedo.h:41
@ kGreen
Definition: TGSpeedo.h:41
@ kOrange
Definition: TGSpeedo.h:41
@ kNoglow
Definition: TGSpeedo.h:41
@ kRed
Definition: TGSpeedo.h:41
Float_t fAngle
Definition: TGSpeedo.h:54
void Glow(EGlowColor col=kGreen)
Make speedo glowing.
Definition: TGSpeedo.cxx:231
void SetMinMaxScale(Float_t min, Float_t max)
Set min and max scale values.
Definition: TGSpeedo.cxx:350
Float_t fMeanVal
Definition: TGSpeedo.h:56
Int_t fCounter
Definition: TGSpeedo.h:48
TImage * fImage
Definition: TGSpeedo.h:44
void OdoClicked()
Definition: TGSpeedo.h:109
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event.
Definition: TGSpeedo.cxx:280
FontStruct_t fCounterFS
Definition: TGSpeedo.h:47
void DrawText()
Draw text in speedo widget.
Definition: TGSpeedo.cxx:515
TString fDisplay2
Definition: TGSpeedo.h:53
Float_t fScaleMax
Definition: TGSpeedo.h:58
Float_t fPeakVal
Definition: TGSpeedo.h:55
virtual TGDimension GetDefaultSize() const
Return default dimension of the widget.
Definition: TGSpeedo.cxx:221
TString fPicName
Definition: TGSpeedo.h:49
Bool_t fThresholdActive
Definition: TGSpeedo.h:61
void Translate(Float_t val, Float_t angle, Int_t *x, Int_t *y)
Translate distance from center and angle to xy coordinates.
Definition: TGSpeedo.cxx:455
Float_t fThreshold[3]
Definition: TGSpeedo.h:59
void SetLabelText(const char *text1, const char *text2="")
Set main label text (two lines).
Definition: TGSpeedo.cxx:334
TImage * fImage2
Definition: TGSpeedo.h:45
void SetScaleValue(Float_t val)
Set actual scale (needle position) value.
Definition: TGSpeedo.cxx:366
Bool_t fMeanMark
Definition: TGSpeedo.h:63
TString fLabel2
Definition: TGSpeedo.h:51
Float_t fAngleMax
Definition: TGSpeedo.h:57
void LedClicked()
Definition: TGSpeedo.h:110
void Build()
Build TGSpeedo widget.
Definition: TGSpeedo.cxx:119
void DrawNeedle()
Draw needle in speedo widget.
Definition: TGSpeedo.cxx:466
TGSpeedo(const TGWindow *p=0, int id=-1)
TGSpeedo widget constructor.
Definition: TGSpeedo.cxx:51
Bool_t fPeakMark
Definition: TGSpeedo.h:62
Float_t fValue
Definition: TGSpeedo.h:54
An abstract interface to image processing library.
Definition: TImage.h:29
static TImage * Open(const char *file, EImageFileTypes type=kUnknown)
Open a specified image file.
Definition: TImage.cxx:119
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)
Definition: TImage.h:200
virtual void DrawLine(UInt_t, UInt_t, UInt_t, UInt_t, const char *="#000000", UInt_t=1)
Definition: TImage.h:184
virtual Bool_t IsValid() const
Definition: TImage.h:230
virtual void Merge(const TImage *, const char *="alphablend", Int_t=0, Int_t=0)
Definition: TImage.h:172
virtual Pixmap_t GetPixmap()
Definition: TImage.h:235
virtual void PaintImage(Drawable_t, Int_t, Int_t, Int_t=0, Int_t=0, UInt_t=0, UInt_t=0, Option_t *="")
Definition: TImage.h:243
virtual TObject * Clone(const char *) const
Make a clone of an object using the Streamer facility.
Definition: TImage.h:111
virtual Pixmap_t GetMask()
Definition: TImage.h:236
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:891
Basic string class.
Definition: TString.h:131
Ssiz_t Length() const
Definition: TString.h:405
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
Definition: TString.cxx:418
const char * Data() const
Definition: TString.h:364
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2289
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition: TSystem.cxx:930
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
Definition: TSystem.cxx:435
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
constexpr Double_t Pi()
Definition: TMath.h:38
Definition: first.py:1
EGEventType fType
Definition: GuiTypes.h:174
Int_t fY
Definition: GuiTypes.h:177
Int_t fX
Definition: GuiTypes.h:177
UInt_t fCode
Definition: GuiTypes.h:179
#define mark(osub)
Definition: triangle.c:1206