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
42#include "TGSpeedo.h"
43
44
46
47////////////////////////////////////////////////////////////////////////////////
48/// TGSpeedo widget constructor.
49
51 : TGFrame(p, 1, 1), TGWidget (id), fImage(0), fImage2(0), fBase(0)
52{
53 fAngleMin = -133.5;
54 fAngleMax = 133.5;
55 fAngle = -133.5;
56 fScaleMin = 0.0;
57 fScaleMax = 100.0;
58 fValue = 0.0;
59 fCounter = 0;
62 fPeakVal = 0.0;
63 fMeanVal = 0.0;
65 fThreshold[0] = fThreshold[1] = fThreshold[2] = 0.0;
70 fPicName = "speedo.gif";
72 if (!fImage || !fImage->IsValid())
73 Error("TGSpeedo::Build", "%s not found", fPicName.Data());
74 Build();
76}
77
78////////////////////////////////////////////////////////////////////////////////
79/// TGSpeedo widget constructor.
80
82 const char *lbl1, const char *lbl2, const char *dsp1,
83 const char *dsp2, int id)
84 : TGFrame(p, 1, 1), TGWidget (id), fImage(0), fImage2(0), fBase(0)
85{
86 fAngleMin = -133.5;
87 fAngleMax = 133.5;
88 fAngle = -133.5;
89 fScaleMin = smin;
90 fScaleMax = smax;
91 fValue = smin;
92 fCounter = 0;
93 fLabel1 = lbl1;
94 fLabel2 = lbl2;
95 fDisplay1 = dsp1;
96 fDisplay2 = dsp2;
99 fPeakVal = 0.0;
100 fMeanVal = 0.0;
102 fThreshold[0] = fThreshold[1] = fThreshold[2] = 0.0;
107 fPicName = "speedo.gif";
109 if (!fImage || !fImage->IsValid())
110 Error("TGSpeedo::Build", "%s not found", fPicName.Data());
111 Build();
113}
114
115////////////////////////////////////////////////////////////////////////////////
116/// Build TGSpeedo widget.
117
119{
120 TString sc;
121 Float_t step, mark[5];
122 TString ar = "arialbd.ttf";
123 Int_t i, nexe, offset;
124
125 const TGFont *counterFont = fClient->GetFont("-*-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*");
126 if (!counterFont) return;
127 fCounterFS = counterFont->GetFontStruct();
128
129 const TGFont *textFont = fClient->GetFont("-*-helvetica-bold-r-*-*-8-*-*-*-*-*-*-*");
130 if (!textFont) return;
131 fTextFS = textFont->GetFontStruct();
132
133 const TGFont *labelFont = fClient->GetFont("-*-helvetica-bold-r-*-*-14-*-*-*-*-*-*-*");
134 if (!labelFont) return;
135 FontStruct_t labelFS = labelFont->GetFontStruct();
136
137 if (fImage && fImage->IsValid()) {
140 // center of the image
141 Float_t xc = (Float_t)(fBase ? (fBase->GetWidth() + 1) / 2 : 96.0);
142 Float_t yc = (Float_t)(fBase ? (fBase->GetHeight() + 1) / 2 : 96.0);
143
144 // compute scale ticks steps
145 step = (fScaleMax - fScaleMin) / 4.0;
146 mark[0] = fScaleMin;
147 mark[4] = fScaleMax;
148 for (i=1; i<4; i++) {
149 mark[i] = mark[i-1] + step;
150 }
151 // format tick labels
152 if (fScaleMax >= 1000.0) {
153 nexe = 0;
154 while (1) {
155 nexe++;
156 for (i=0; i<5; i++) {
157 mark[i] /= 10.0;
158 }
159 // coverity[loop_condition]: ignore - false positive
160 if (mark[4] < 1000.0) break;
161 }
162 // draw multiplier
163 fImage->DrawText((Int_t)xc - 11, (Int_t)yc + 15, "x10", 12, "#ffffff", ar);
164 sc.Form("%d", nexe);
165 fImage->DrawText((Int_t)xc + 11, (Int_t)yc + 13, sc.Data(), 10, "#ffffff", ar);
166 }
167 else if (fScaleMax < 100.0) {
168 nexe = 0;
169 while (1) {
170 nexe--;
171 for (i=0; i<5; i++) {
172 mark[i] *= 10.0;
173 }
174 // coverity[loop_condition]: ignore - false positive
175 if (mark[4] > 99.9 ) break;
176 }
177 // draw multiplier
178 fImage->DrawText((Int_t)xc - 11, (Int_t)yc + 15, "x10", 12, "#ffffff", ar);
179 sc.Form("%d", nexe);
180 fImage->DrawText((Int_t)xc + 11, (Int_t)yc + 13, sc.Data(), 10, "#ffffff", ar);
181 }
182 // Format and draw scale tickmarks
183 sc.Form("%d",(Int_t)mark[0]);
184 fImage->DrawText((Int_t)xc - 51, (Int_t)yc + 30, sc.Data(), 14, "#ffffff", ar);
185 sc.Form("%d",(Int_t)mark[1]);
186 fImage->DrawText((Int_t)xc - 59, (Int_t)yc - 29, sc.Data(), 14, "#ffffff", ar);
187 sc.Form("%d",(Int_t)mark[2]);
188 offset = gVirtualX->TextWidth(labelFS, sc.Data(), sc.Length()) / 2;
189 fImage->DrawText((Int_t)xc - offset, (Int_t)yc - 65, sc.Data(), 14, "#ffffff", ar);
190 sc.Form("%d",(Int_t)mark[3]);
191 offset = 60 - gVirtualX->TextWidth(labelFS, sc.Data(), sc.Length());
192 fImage->DrawText((Int_t)xc + offset, (Int_t)yc - 29, sc.Data(), 14, "#ffffff", ar);
193 sc.Form("%d",(Int_t)mark[4]);
194 offset = 52 - gVirtualX->TextWidth(labelFS, sc.Data(), sc.Length());
195 fImage->DrawText((Int_t)xc + offset, (Int_t)yc + 30, sc.Data(), 14, "#ffffff", ar);
196 // draw main label (two lines)
197 fImage->DrawText((Int_t)xc + 13, (Int_t)yc - 17, fLabel1.Data(), 14, "#ffffff", ar);
198 fImage->DrawText((Int_t)xc + 13, (Int_t)yc - 4, fLabel2.Data(), 12, "#ffffff", ar);
199 if (fBase)
200 gVirtualX->ShapeCombineMask(fId, 0, 0, fBase->GetMask());
201 }
202}
203
204////////////////////////////////////////////////////////////////////////////////
205/// TGSpeedo widget Destructor.
206
208{
209 if (fImage && fImage->IsValid())
210 delete fImage;
211 if (fImage2 && fImage2->IsValid())
212 delete fImage2;
213 if (fBase)
215}
216
217////////////////////////////////////////////////////////////////////////////////
218/// Return default dimension of the widget.
219
221{
222 if (fBase)
224 return TGDimension(100, 100);
225}
226
227////////////////////////////////////////////////////////////////////////////////
228/// Make speedo glowing.
229
231{
232 static EGlowColor act_col = kNoglow;
233 TImage *glowImage = 0;
234
235 if (col == act_col)
236 return;
237
238 if (fImage && fImage->IsValid())
239 delete fImage;
240
241 switch (col) {
242 case kNoglow:
243 break;
244 case kGreen:
245 glowImage = TImage::Open("glow_green.png");
246 if (!glowImage || !glowImage->IsValid()) {
247 Error("TGSpeedo::Glow", "glow_green.png not found");
248 glowImage = 0;
249 }
250 break;
251 case kOrange:
252 glowImage = TImage::Open("glow_orange.png");
253 if (!glowImage || !glowImage->IsValid()) {
254 Error("TGSpeedo::Glow", "glow_orange.png not found");
255 glowImage = 0;
256 }
257 break;
258 case kRed:
259 glowImage = TImage::Open("glow_red.png");
260 if (!glowImage || !glowImage->IsValid()) {
261 Error("TGSpeedo::Glow", "glow_red.png not found");
262 glowImage = 0;
263 }
264 break;
265 }
267 if (fImage && fImage->IsValid() && glowImage && glowImage->IsValid()) {
268 fImage->Merge(glowImage);
269 delete glowImage;
270 }
271 act_col = col;
272 Build();
273 DrawText();
274}
275
276////////////////////////////////////////////////////////////////////////////////
277/// Handle mouse button event.
278
280{
281 if (fBase) {
282 int xc = (fBase->GetWidth() + 1) / 2;
283 int yc = (fBase->GetHeight() + 1) / 2;
284 if (event->fType == kButtonRelease && event->fCode == kButton1) {
285 // check if in the selector area
286 if ((event->fX > (xc - 26)) && (event->fX < (xc + 26)) &&
287 (event->fY < (yc + 50)) && (event->fY > (yc + 28))) {
288 OdoClicked();
289 }
290 // check if in the led area
291 else if ((event->fX > (xc + 30)) && (event->fX < (xc + 40)) &&
292 (event->fY > (yc + 57)) && (event->fY < (yc + 67))) {
293 LedClicked();
294 }
295 }
296 if (event->fType == kButtonRelease && event->fCode == kButton3) {
297 ResetPeakVal();
298 }
299 }
300 return kTRUE;
301}
302
303////////////////////////////////////////////////////////////////////////////////
304/// Set actual value of odo meter.
305
307{
308 // avoid useless redraw
309 if (val == fCounter)
310 return;
311 fCounter = val;
312 DrawText();
313 DrawNeedle();
314}
315
316////////////////////////////////////////////////////////////////////////////////
317/// Set small display text (two lines).
318
319void TGSpeedo::SetDisplayText(const char *text1, const char *text2)
320{
321 if (!(fDisplay1.CompareTo(text1)) &&
322 !(fDisplay2.CompareTo(text2)))
323 return;
324 fDisplay1 = text1;
325 fDisplay2 = text2;
326 DrawText();
327 DrawNeedle();
328}
329
330////////////////////////////////////////////////////////////////////////////////
331/// Set main label text (two lines).
332
333void TGSpeedo::SetLabelText(const char *text1, const char *text2)
334{
335 if (fImage && fImage->IsValid())
336 delete fImage;
337 fLabel1 = text1;
338 fLabel2 = text2;
340 if (!fImage || !fImage->IsValid())
341 Error("TGSpeedo::Build", "%s not found", fPicName.Data());
342 Build();
343 DrawText();
344}
345
346////////////////////////////////////////////////////////////////////////////////
347/// Set min and max scale values.
348
350{
351 if (fImage && fImage->IsValid())
352 delete fImage;
353 fScaleMin = min;
354 fScaleMax = max;
356 if (!fImage || !fImage->IsValid())
357 Error("TGSpeedo::Build", "%s not found", fPicName.Data());
358 Build();
359 DrawText();
360}
361
362////////////////////////////////////////////////////////////////////////////////
363/// Set actual scale (needle position) value.
364
366{
367 // avoid useless redraw
368 if (val == fValue)
369 return;
370
371 fValue = val;
372 if (fValue > fScaleMax)
374 else if (fValue < fScaleMin)
376
377 if (fThresholdActive) {
378 if (fValue < fThreshold[0])
379 Glow(kNoglow);
380 if (fValue >= fThreshold[0] && fValue < fThreshold[1])
382 if (fValue >= fThreshold[1] && fValue < fThreshold[2])
384 if (fValue >= fThreshold[2])
386 }
387 if (fValue > fPeakVal)
389
391 (fAngleMax - fAngleMin)));
392
393 if (fAngle > fAngleMax)
395 else if (fAngle < fAngleMin)
397 DrawNeedle();
398}
399
400////////////////////////////////////////////////////////////////////////////////
401/// Set actual scale (needle position) value.
402
404{
405 Float_t i;
406 Float_t old_val = fValue;
407 Float_t step, new_val = val;
408 // avoid useless redraw
409 if (val == fValue)
410 return;
411
412 if ((damping > 0) || (gVirtualX->InheritsFrom("TGX11")))
413 step = 2.0;
414 else
415 step = 0.15;
416
417 Float_t diff_angle = fAngleMax - fAngleMin;
418 Float_t diff_scale = fScaleMax - fScaleMin;
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);
422
423 if (new_angle > old_angle) {
424 for (i=old_angle; i<new_angle; i+=step) {
425 new_val = (i - fAngleMin) * diff_ratio;
426 SetScaleValue(new_val);
427 if (damping > 0)
428 gSystem->Sleep(damping);
429 }
430 }
431 if (new_angle < old_angle) {
432 for (i=old_angle; i>new_angle; i-=step) {
433 new_val = (i - fAngleMin) * diff_ratio;
434 SetScaleValue(new_val);
435 if (damping > 0)
436 gSystem->Sleep(damping);
437 }
438 }
439 // Last step
440 SetScaleValue(val);
441}
442
443////////////////////////////////////////////////////////////////////////////////
444/// Increment/decrement scale (needle position) of "step" value.
445
447{
448 SetScaleValue(fValue + step);
449}
450
451////////////////////////////////////////////////////////////////////////////////
452/// Translate distance from center and angle to xy coordinates.
453
455{
456 Float_t xc = (Float_t)(fBase ? (fBase->GetWidth() + 1) / 2 : 96.0);
457 Float_t yc = (Float_t)(fBase ? (fBase->GetHeight() + 1) / 2 : 96.0);
458 *x = (Int_t)(xc + val * sin(angle * TMath::Pi() / 180) + 0.5);
459 *y = (Int_t)(yc - val * cos(angle * TMath::Pi() / 180) + 0.5);
460}
461
462////////////////////////////////////////////////////////////////////////////////
463/// Draw needle in speedo widget.
464
466{
467 Int_t xch0, xch1, ych0, ych1;
468 Int_t xpk0, ypk0, xpk1, ypk1;
469 Int_t xmn0, ymn0, xmn1, ymn1;
471 (fAngleMax - fAngleMin));
472
473 // compute x/y position of the needle
474 Translate(9.0, fAngle, &xch0, &ych0);
475 Translate(73.0, fAngle, &xch1, &ych1);
476
477 // compute x/y position of the peak mark
478 Float_t angle = fAngleMin + (fPeakVal / ((fScaleMax - fScaleMin) /
479 (fAngleMax - fAngleMin)));
480 Translate(80.0, angle, &xpk0, &ypk0);
481 Translate(67.0, angle, &xpk1, &ypk1);
482
483 // compute x/y position of the peak mark
484 angle = fAngleMin + (fMeanVal / ((fScaleMax - fScaleMin) /
485 (fAngleMax - fAngleMin)));
486 Translate(80.0, angle, &xmn0, &ymn0);
487 Translate(70.0, angle, &xmn1, &ymn1);
488
489 if (fImage2 && fImage2->IsValid()) {
490 // First clone original image.
491 TImage *img = (TImage*)fImage2->Clone("img");
492 if (!img || !img->IsValid()) return;
493 if (fPeakMark) {
494 img->DrawLine(xpk0, ypk0, xpk1, ypk1, "#00ff00", 3);
495 img->DrawLine(xpk0, ypk0, xpk1, ypk1, "#ffffff", 1);
496 }
497 if (fMeanMark) {
498 img->DrawLine(xmn0, ymn0, xmn1, ymn1, "#ffff00", 3);
499 img->DrawLine(xmn0, ymn0, xmn1, ymn1, "#ff0000", 1);
500 }
501 // draw line (used to render the needle) directly on the image
502 img->DrawLine(xch0, ych0, xch1, ych1, "#ff0000", 2);
503 // finally paint image to the widget
504 img->PaintImage(fId, 0, 0, 0, 0, 0, 0, "opaque");
505 // and finally, to avoid memory leaks
506 delete img;
507 }
508 gVirtualX->Update();
509}
510
511////////////////////////////////////////////////////////////////////////////////
512/// Draw text in speedo widget.
513
515{
516 char sval[80];
517 char dsval[80];
518 Int_t strSize;
519
520 // center of the image
521 Float_t xc = fBase ? (fBase->GetWidth() + 1) / 2 : 96.0;
522 Float_t yc = fBase ? (fBase->GetHeight() + 1) / 2 : 96.0;
523
524 if (fImage && fImage->IsValid()) {
525 // First clone original image.
526 if (fImage2 && fImage2->IsValid())
527 delete fImage2;
528 fImage2 = (TImage*)fImage->Clone("fImage2");
529 if (!fImage2 || !fImage2->IsValid()) return;
530 TString ar = "arialbd.ttf";
531 // format counter value
532 Int_t nexe = 0;
533 Int_t ww = fCounter;
534 if (fCounter >= 10000) {
535 while (1) {
536 nexe++;
537 ww /= 10;
538 if (nexe%3 == 0 && ww < 10000) break;
539 }
540 fImage2->DrawText((Int_t)xc - 9, (Int_t)yc + 72, "x10", 10, "#ffffff", ar);
541 snprintf(sval, 80, "%d", nexe);
542 fImage2->DrawText((Int_t)xc + 9, (Int_t)yc + 69, sval, 8, "#ffffff", ar);
543 }
544 snprintf(sval, 80, "%04d", (int)ww);
545 snprintf(dsval, 80, "%c %c %c %c", sval[0], sval[1], sval[2], sval[3]);
546 // draw text in the counter
547 if (gVirtualX->InheritsFrom("TGX11")) {
548 // as there is a small difference between Windows and Linux...
549 fImage2->DrawText((Int_t)xc - 18, (Int_t)yc + 55, dsval, 12, "#ffffff", ar);
550 }
551 else {
552 fImage2->DrawText((Int_t)xc - 16, (Int_t)yc + 56, dsval, 12, "#ffffff", ar);
553 }
554 // compute the size of the string to draw in the small display box
555 // first line
556 strSize = gVirtualX->TextWidth(fTextFS, fDisplay1.Data(), fDisplay1.Length()) - 6;
557 // draw text directly on the imaget_t)yc + 29, fDispla
558 fImage2->DrawText((Int_t)xc - (strSize / 2), (Int_t)yc + 29, fDisplay1.Data(), 8, "#ffffff", ar);
559 // second line
560 strSize = gVirtualX->TextWidth(fTextFS, fDisplay2.Data(), fDisplay2.Length()) - 6;
561 fImage2->DrawText((Int_t)xc - (strSize / 2), (Int_t)yc + 38, fDisplay2.Data(), 8, "#ffffff", ar);
562 }
563}
564
565////////////////////////////////////////////////////////////////////////////////
566/// Redraw speedo widget.
567
569{
570 char sval[80];
571 char dsval[80];
572 Int_t strSize;
573 Int_t xch0, xch1, ych0, ych1;
574 Int_t xpk0, ypk0, xpk1, ypk1;
575 Int_t xmn0, ymn0, xmn1, ymn1;
576 static Bool_t first = kTRUE;
577 if (first) {
579 first = kFALSE;
580 }
582 (fAngleMax - fAngleMin));
583
584 // center of the image
585 Float_t xc = fBase ? (fBase->GetWidth() + 1) / 2 : 96.0;
586 Float_t yc = fBase ? (fBase->GetHeight() + 1) / 2 : 96.0;
587
588 // compute x/y position of the needle
589 Translate(9.0, fAngle, &xch0, &ych0);
590 Translate(73.0, fAngle, &xch1, &ych1);
591
592 // compute x/y position of the peak mark
593 Float_t angle = fAngleMin + (fPeakVal / ((fScaleMax - fScaleMin) /
594 (fAngleMax - fAngleMin)));
595 Translate(80.0, angle, &xpk0, &ypk0);
596 Translate(67.0, angle, &xpk1, &ypk1);
597
598 // compute x/y position of the peak mark
599 angle = fAngleMin + (fMeanVal / ((fScaleMax - fScaleMin) /
600 (fAngleMax - fAngleMin)));
601 Translate(80.0, angle, &xmn0, &ymn0);
602 Translate(70.0, angle, &xmn1, &ymn1);
603
604 if (fImage && fImage->IsValid()) {
605 // First clone original image.
606 if (fImage2 && fImage2->IsValid())
607 delete fImage2;
608 fImage2 = (TImage*)fImage->Clone("fImage2");
609 if (!fImage2 || !fImage2->IsValid()) return;
610 TString ar = "arialbd.ttf";
611 // format counter value
612 Int_t nexe = 0;
613 Int_t ww = fCounter;
614 if (fCounter >= 10000) {
615 while (1) {
616 nexe++;
617 ww /= 10;
618 if (nexe%3 == 0 && ww < 10000) break;
619 }
620 fImage2->DrawText((Int_t)xc - 9, (Int_t)yc + 72, "x10", 10, "#ffffff", ar);
621 snprintf(sval, 80, "%d", nexe);
622 fImage2->DrawText((Int_t)xc + 9, (Int_t)yc + 69, sval, 8, "#ffffff", ar);
623 }
624 snprintf(sval, 80, "%04d", (int)ww);
625 snprintf(dsval, 80, "%c %c %c %c", sval[0], sval[1], sval[2], sval[3]);
626 // draw text in the counter
627 if (gVirtualX->InheritsFrom("TGX11")) {
628 // as there is a small difference between Windows and Linux...
629 fImage2->DrawText((Int_t)xc - 18, (Int_t)yc + 55, dsval, 12, "#ffffff", ar);
630 }
631 else {
632 fImage2->DrawText((Int_t)xc - 16, (Int_t)yc + 56, dsval, 12, "#ffffff", ar);
633 }
634 // compute the size of the string to draw in the small display box
635 // first line
636 strSize = gVirtualX->TextWidth(fTextFS, fDisplay1.Data(), fDisplay1.Length()) - 6;
637 // draw text directly on the imaget_t)yc + 29, fDispla
638 fImage2->DrawText((Int_t)xc - (strSize / 2), (Int_t)yc + 29, fDisplay1.Data(), 8, "#ffffff", ar);
639 // second line
640 strSize = gVirtualX->TextWidth(fTextFS, fDisplay2.Data(), fDisplay2.Length()) - 6;
641 fImage2->DrawText((Int_t)xc - (strSize / 2), (Int_t)yc + 38, fDisplay2.Data(), 8, "#ffffff", ar);
642 TImage *img = (TImage*)fImage2->Clone("img");
643 if (!img || !img->IsValid()) return;
644 if (fPeakMark) {
645 img->DrawLine(xpk0, ypk0, xpk1, ypk1, "#00ff00", 3);
646 img->DrawLine(xpk0, ypk0, xpk1, ypk1, "#ffffff", 1);
647 }
648 if (fMeanMark) {
649 img->DrawLine(xmn0, ymn0, xmn1, ymn1, "#ffff00", 3);
650 img->DrawLine(xmn0, ymn0, xmn1, ymn1, "#ff0000", 1);
651 }
652 // draw line (used to render the needle) directly on the image
653 img->DrawLine(xch0, ych0, xch1, ych1, "#ff0000", 2);
654 // finally paint image to the widget
655 img->PaintImage(fId, 0, 0, 0, 0, 0, 0, "opaque");
656 // and finally, to avoid memory leaks
657 delete img;
658 }
659}
@ 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:41
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
float Float_t
Definition: RtypesCore.h:53
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassImp(name)
Definition: Rtypes.h:365
XFontStruct * id
Definition: TGX11.cxx:108
double cos(double)
double sin(double)
R__EXTERN TSystem * gSystem
Definition: TSystem.h:560
#define gVirtualX
Definition: TVirtualX.h:345
#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:321
virtual void DoRedraw()
Redraw the frame.
Definition: TGFrame.cxx:412
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:306
virtual ~TGSpeedo()
TGSpeedo widget Destructor.
Definition: TGSpeedo.cxx:207
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:446
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:319
Float_t fAngleMin
Definition: TGSpeedo.h:57
TString fDisplay1
Definition: TGSpeedo.h:52
virtual void DoRedraw()
Redraw speedo widget.
Definition: TGSpeedo.cxx:568
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:230
void SetMinMaxScale(Float_t min, Float_t max)
Set min and max scale values.
Definition: TGSpeedo.cxx:349
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:279
FontStruct_t fCounterFS
Definition: TGSpeedo.h:47
void DrawText()
Draw text in speedo widget.
Definition: TGSpeedo.cxx:514
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:220
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:454
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:333
TImage * fImage2
Definition: TGSpeedo.h:45
void SetScaleValue(Float_t val)
Set actual scale (needle position) value.
Definition: TGSpeedo.cxx:365
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:118
void DrawNeedle()
Draw needle in speedo widget.
Definition: TGSpeedo.cxx:465
TGSpeedo(const TGWindow *p=0, int id=-1)
TGSpeedo widget constructor.
Definition: TGSpeedo.cxx:50
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:880
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:942
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
Definition: TSystem.cxx:447
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