1 #include "application/gui/HitOptionFrame.h"
2 #include "application/gui/MainWindow.h"
4 HitOptionFrame::HitOptionFrame(std::string det,
const TGWindow *p)
5 : TGGroupFrame(p, Form(
"%s hits", det.c_str()), kVerticalFrame), _det(det) {
6 static const std::string routineName(
"HitOptionFrame::HitOptionFrame");
10 cmbox =
new TGComboBox(
this);
11 for (
int i = 0; i < DetectorHit::kHitTypeN; i++) {
12 cmbox->AddEntry(DetectorHit::hitTypeNames[i].c_str(), i);
14 cmbox->Select(_mw->GetDetectorHitType(_det), kFALSE);
15 cmbox->Resize(150, 20);
16 cmbox->Connect(
"Selected(Int_t)",
"HitOptionFrame",
this,
"SetDisplayType(Int_t)");
17 AddFrame(cmbox,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY | kLHintsExpandX));
19 TGHorizontalFrame *thrFrame =
new TGHorizontalFrame(
this);
21 TGLabel *thrLabel =
new TGLabel(thrFrame,
"Threshold:");
22 thrFrame->AddFrame(thrLabel,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
24 thrField =
new TGNumberEntry(thrFrame, 0.001);
25 thrField->SetWidth(80);
26 thrField->SetFormat(TGNumberFormat::kNESRealThree, TGNumberFormat::kNEANonNegative);
27 thrField->SetNumber(_mw->GetDetectorHitThreshold(_det));
28 thrField->Connect(
"ValueSet(Long_t)",
"HitOptionFrame",
this,
"SetThreshold(Long_t)");
29 thrFrame->AddFrame(thrField,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5, 5, 0, 0));
31 TGLabel *unitLabel =
new TGLabel(thrFrame,
"GeV");
32 thrFrame->AddFrame(unitLabel,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
34 AddFrame(thrFrame,
new TGLayoutHints(kLHintsExpandX | kLHintsCenterX | kLHintsCenterY, 5, 5, 5, 5));
36 TGHorizontalFrame *colFrame =
new TGHorizontalFrame(
this);
38 colPick =
new TGColorSelect(colFrame);
39 colPick->Connect(
"ColorSelected(Pixel_t)",
"HitOptionFrame",
this,
"SetColor(Pixel_t)");
40 if (_mw->GetDetectorHitType(_det) == DetectorHit::kColorCodedHit ||
41 _mw->GetDetectorHitType(_det) == DetectorHit::kColorCodedScaleHit)
42 colPick->SetEnabled(kFALSE);
43 colFrame->AddFrame(colPick,
new TGLayoutHints(kLHintsRight | kLHintsCenterY));
45 TGLabel *colLabel =
new TGLabel(colFrame,
"Color:");
46 colFrame->AddFrame(colLabel,
new TGLayoutHints(kLHintsRight | kLHintsCenterY));
48 AddFrame(colFrame,
new TGLayoutHints(kLHintsExpandX | kLHintsCenterX | kLHintsCenterY, 5, 5, 5, 5));
51 void HitOptionFrame::SetDisplayType(Int_t type) {
52 static const std::string routineName(
"HitOptionFrame::SetDisplayType");
55 _mw->SetDetectorHitType(_det, static_cast<DetectorHit::hitType>(type));
57 if (_mw->GetDetectorHitType(_det) == DetectorHit::kColorCodedHit ||
58 _mw->GetDetectorHitType(_det) == DetectorHit::kColorCodedScaleHit) {
59 colPick->SetEnabled(kFALSE);
61 colPick->SetEnabled(kTRUE);
65 void HitOptionFrame::SetThreshold(Long_t ) {
66 static const std::string routineName(
"HitOptionFrame::SetThreshold");
69 float value = (float)thrField->GetNumber();
72 _mw->SetDetectorHitThreshold(_det, value);
75 void HitOptionFrame::SetColor(Pixel_t ) {
76 static const std::string routineName(
"HitOptionFrame::SetColor");
79 Color_t color = TColor::GetColor(colPick->GetColor());
84 _mw->SetDetectorHitColor(_det, color);
#define COUT(level)
Smart log macro. It writes on stdout only if the specified verbosity level is lesser than the maximum...