1 #include "application/gui/HitOptionFrame.h"
2 #include "application/gui/MainWindow.h"
4 HitOptionFrame::HitOptionFrame(std::string det,
const TGWindow* p) : TGGroupFrame(p, Form(
"%s hits", det.c_str()), kVerticalFrame), _det(det){
5 static const std::string routineName(
"HitOptionFrame::HitOptionFrame");
9 cmbox =
new TGComboBox(
this);
10 for(
int i = 0; i < DetectorHit::kHitTypeN; i++ ){
11 cmbox->AddEntry( DetectorHit::hitTypeNames[i].c_str(), i );
13 cmbox->Select(_mw->GetDetectorHitType(_det), kFALSE);
14 cmbox->Resize(150, 20);
15 cmbox->Connect(
"Selected(Int_t)",
"HitOptionFrame",
this,
"SetDisplayType(Int_t)" );
16 AddFrame(cmbox,
new TGLayoutHints(kLHintsCenterX|kLHintsCenterY|kLHintsExpandX));
18 TGHorizontalFrame* thrFrame =
new TGHorizontalFrame(
this);
20 TGLabel* thrLabel =
new TGLabel(thrFrame,
"Threshold:");
21 thrFrame->AddFrame(thrLabel,
new TGLayoutHints(kLHintsLeft|kLHintsCenterY));
23 thrField =
new TGNumberEntry(thrFrame, 0.001);
24 thrField->SetWidth(80);
25 thrField->SetFormat(TGNumberFormat::kNESRealThree, TGNumberFormat::kNEANonNegative);
26 thrField->SetNumber(_mw->GetDetectorHitThreshold(_det));
27 thrField->Connect(
"ValueSet(Long_t)",
"HitOptionFrame",
this,
"SetThreshold(Long_t)" );
28 thrFrame->AddFrame(thrField,
new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 5, 5, 0, 0));
30 TGLabel* unitLabel =
new TGLabel(thrFrame,
"GeV");
31 thrFrame->AddFrame(unitLabel,
new TGLayoutHints(kLHintsLeft|kLHintsCenterY));
33 AddFrame(thrFrame,
new TGLayoutHints(kLHintsExpandX|kLHintsCenterX|kLHintsCenterY, 5, 5, 5, 5));
35 TGHorizontalFrame* colFrame =
new TGHorizontalFrame(
this);
37 colPick =
new TGColorSelect(colFrame);
38 colPick->Connect(
"ColorSelected(Pixel_t)",
"HitOptionFrame",
this,
"SetColor(Pixel_t)" );
39 if( _mw->GetDetectorHitType(_det) == DetectorHit::kColorCodedHit || _mw->GetDetectorHitType(_det) == DetectorHit::kColorCodedScaleHit ) colPick->SetEnabled(kFALSE);
40 colFrame->AddFrame(colPick,
new TGLayoutHints(kLHintsRight|kLHintsCenterY));
42 TGLabel* colLabel =
new TGLabel(colFrame,
"Color:");
43 colFrame->AddFrame(colLabel,
new TGLayoutHints(kLHintsRight|kLHintsCenterY));
45 AddFrame(colFrame,
new TGLayoutHints(kLHintsExpandX|kLHintsCenterX|kLHintsCenterY, 5, 5, 5, 5));
48 void HitOptionFrame::SetDisplayType(Int_t type){
49 static const std::string routineName(
"HitOptionFrame::SetDisplayType");
52 _mw->SetDetectorHitType(_det, static_cast<DetectorHit::hitType>(type));
54 if( _mw->GetDetectorHitType(_det) == DetectorHit::kColorCodedHit || _mw->GetDetectorHitType(_det) == DetectorHit::kColorCodedScaleHit ) {
55 colPick->SetEnabled(kFALSE);
57 colPick->SetEnabled(kTRUE);
61 void HitOptionFrame::SetThreshold(Long_t ){
62 static const std::string routineName(
"HitOptionFrame::SetThreshold");
65 float value = (float) thrField->GetNumber();
68 _mw->SetDetectorHitThreshold(_det, value);
71 void HitOptionFrame::SetColor(Pixel_t ){
72 static const std::string routineName(
"HitOptionFrame::SetColor");
75 Color_t color = TColor::GetColor(colPick->GetColor());
80 _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...