27 ClassImp(TEveCaloLegoEditor);
32 TEveCaloLegoEditor::TEveCaloLegoEditor(
const TGWindow *p, Int_t width, Int_t height,
33 UInt_t options, Pixel_t back) :
34 TGedFrame(p, width, height, options | kVerticalFrame, back),
53 MakeTitle(
"TEveCaloLego");
56 TGHorizontalFrame* f =
new TGHorizontalFrame(
this);
57 TGLabel* lab =
new TGLabel(f,
"GridColor:");
58 f->AddFrame(lab,
new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 10, 1, 1));
60 fGridColor =
new TGColorSelect(f, 0, -1);
61 f->AddFrame(fGridColor,
new TGLayoutHints(kLHintsLeft|kLHintsTop, 3, 1, 0, 1));
62 fGridColor->Connect(
"ColorSelected(Pixel_t)",
"TEveCaloLegoEditor",
this,
"DoGridColor(Pixel_t)");
64 AddFrame(f,
new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
69 TGHorizontalFrame* f =
new TGHorizontalFrame(
this);
70 TGLabel* lab =
new TGLabel(f,
"FontColor:");
71 f->AddFrame(lab,
new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 8, 1, 1));
73 fFontColor =
new TGColorSelect(f, 0, -1);
74 f->AddFrame(fFontColor,
new TGLayoutHints(kLHintsLeft|kLHintsTop, 3, 1, 0, 1));
75 fFontColor->Connect(
"ColorSelected(Pixel_t)",
"TEveCaloLegoEditor",
this,
"DoFontColor(Pixel_t)");
77 AddFrame(f,
new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
81 TGHorizontalFrame* f =
new TGHorizontalFrame(
this);
82 TGLabel* lab =
new TGLabel(f,
"PlaneColor:");
83 f->AddFrame(lab,
new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 1, 1, 1));
85 fPlaneColor =
new TGColorSelect(f, 0, -1);
86 f->AddFrame(fPlaneColor,
new TGLayoutHints(kLHintsLeft|kLHintsTop, 3, 1, 0, 1));
87 fPlaneColor->Connect(
"ColorSelected(Pixel_t)",
"TEveCaloLegoEditor",
this,
"DoPlaneColor(Pixel_t)");
89 fTransparency =
new TGNumberEntry(f, 0., 2, -1,
90 TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
91 TGNumberFormat::kNELLimitMinMax, 0, 100);
92 fTransparency->SetHeight(18);
93 fTransparency->GetNumberEntry()->SetToolTipText(
"Transparency: 0 is opaque, 100 fully transparent.");
94 f->AddFrame(fTransparency,
new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
95 fTransparency->Connect(
"ValueSet(Long_t)",
"TEveCaloLegoEditor",
this,
"DoTransparency()");
97 AddFrame(f,
new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
102 fProjection = MakeLabeledCombo(
"Project:", 1);
103 fProjection->AddEntry(
"Auto", TEveCaloLego::kAuto);
104 fProjection->AddEntry(
"3D", TEveCaloLego::k3D);
105 fProjection->AddEntry(
"2D", TEveCaloLego::k2D);
106 fProjection->Connect(
"Selected(Int_t)",
"TEveCaloLegoEditor",
this,
"DoProjection()");
108 f2DMode = MakeLabeledCombo(
"2DMode:", 4);
109 f2DMode->AddEntry(
"ValColor", TEveCaloLego::kValColor);
110 f2DMode->AddEntry(
"ValSize", TEveCaloLego::kValSize);
111 f2DMode->AddEntry(
"ValSizeOutline", TEveCaloLego::kValSizeOutline);
112 f2DMode->Connect(
"Selected(Int_t)",
"TEveCaloLegoEditor",
this,
"Do2DMode()");
114 fBoxMode = MakeLabeledCombo(
"Box:", 4);
115 fBoxMode->AddEntry(
"None", TEveCaloLego::kNone);
116 fBoxMode->AddEntry(
"Back", TEveCaloLego::kBack);
117 fBoxMode->AddEntry(
"FrontBack", TEveCaloLego::kFrontBack);
118 fBoxMode->Connect(
"Selected(Int_t)",
"TEveCaloLegoEditor",
this,
"DoBoxMode()");
120 fCell2DTextMin =
new TEveGValuator(
this,
"Cell2DTexMin:", 90, 0);
121 fCell2DTextMin->SetLabelWidth(lw);
122 fCell2DTextMin->SetNELength(5);
123 fCell2DTextMin->SetShowSlider(kFALSE);
124 fCell2DTextMin->Build();
125 fCell2DTextMin->SetLimits(1, 1000);
126 fCell2DTextMin->SetToolTip(
"Draw cell values above N pixels.");
127 fCell2DTextMin->Connect(
"ValueSet(Double_t)",
"TEveCaloLegoEditor",
this,
"DoCell2DTextMin()");
128 AddFrame(fCell2DTextMin,
new TGLayoutHints(kLHintsTop, 1, 2, 1, 2));
135 void TEveCaloLegoEditor::MakeRebinFrame()
137 fRebinFrame = CreateEditorTabSubFrame(
"Rebin");
139 fAutoRebin =
new TGCheckButton(fRebinFrame,
"AutoRebin");
140 fRebinFrame->AddFrame(fAutoRebin,
new TGLayoutHints(kLHintsLeft, 3, 5, 3, 0));
141 fAutoRebin->Connect(
"Toggled(Bool_t)",
"TEveCaloLegoEditor",
this,
"DoAutoRebin()");
143 fNormalizeRebin =
new TGCheckButton(fRebinFrame,
"NormalizeRebin");
144 fRebinFrame->AddFrame(fNormalizeRebin,
new TGLayoutHints(kLHintsLeft, 3, 5, 3, 0));
145 fNormalizeRebin->Connect(
"Toggled(Bool_t)",
"TEveCaloLegoEditor",
this,
"DoNormalize()");
147 fPixelsPerBin =
new TEveGValuator(fRebinFrame,
"PixelsPerBin:", 90, 0);
148 fPixelsPerBin->SetLabelWidth(80);
149 fPixelsPerBin->SetNELength(5);
150 fPixelsPerBin->SetShowSlider(kFALSE);
151 fPixelsPerBin->Build();
152 fPixelsPerBin->SetLimits(1, 50);
153 fPixelsPerBin->SetToolTip(
"Number of labels along the Z axis.");
154 fPixelsPerBin->Connect(
"ValueSet(Double_t)",
"TEveCaloLegoEditor",
this,
"DoPixelsPerBin()");
155 fRebinFrame->AddFrame(fPixelsPerBin,
new TGLayoutHints(kLHintsTop, 4, 2, 1, 2));
161 TGComboBox* TEveCaloLegoEditor::MakeLabeledCombo(
const char* name, Int_t off)
165 TGHorizontalFrame* hf =
new TGHorizontalFrame(
this);
167 TGCompositeFrame *labfr =
new TGHorizontalFrame(hf, labelW, labelH, kFixedSize);
168 TGLabel* label =
new TGLabel(labfr, name);
169 labfr->AddFrame(label,
new TGLayoutHints(kLHintsLeft | kLHintsBottom));
170 hf->AddFrame(labfr,
new TGLayoutHints(kLHintsLeft));
172 TGLayoutHints* clh =
new TGLayoutHints(kLHintsLeft, 0,0,0,0);
173 TGComboBox* combo =
new TGComboBox(hf);
174 combo->Resize(90, 20);
175 hf->AddFrame(combo, clh);
177 AddFrame(hf,
new TGLayoutHints(kLHintsTop, 1, 1, 1, off));
184 void TEveCaloLegoEditor::SetModel(TObject* obj)
186 fM =
dynamic_cast<TEveCaloLego*
>(obj);
188 fGridColor->SetColor(TColor::Number2Pixel(fM->GetGridColor() < 0 ? 0 : fM->GetGridColor()), kFALSE);
189 fFontColor->SetColor(TColor::Number2Pixel(fM->GetFontColor() < 0 ? 0 : fM->GetFontColor()), kFALSE);
191 fPlaneColor->SetColor(TColor::Number2Pixel(fM->GetPlaneColor()), kFALSE);
192 fTransparency->SetNumber(fM->GetPlaneTransparency());
194 fCell2DTextMin->SetValue(fM->GetDrawNumberCellPixels());
196 fProjection->Select(fM->GetProjection(), kFALSE);
197 f2DMode->Select(fM->Get2DMode(), kFALSE);
198 fBoxMode->Select(fM->GetBoxMode(), kFALSE);
200 fPixelsPerBin->SetValue(fM->GetPixelsPerBin());
201 fAutoRebin->SetState(fM->GetAutoRebin() ? kButtonDown : kButtonUp);
202 fNormalizeRebin->SetState(fM->GetNormalizeRebin() ? kButtonDown : kButtonUp);
208 void TEveCaloLegoEditor::DoGridColor(Pixel_t pixel)
210 fM->SetGridColor(Color_t(TColor::GetColor(pixel)));
217 void TEveCaloLegoEditor::DoFontColor(Pixel_t pixel)
219 fM->SetFontColor(Color_t(TColor::GetColor(pixel)));
226 void TEveCaloLegoEditor::DoPlaneColor(Pixel_t pixel)
228 fM->SetPlaneColor(Color_t(TColor::GetColor(pixel)));
235 void TEveCaloLegoEditor::DoCell2DTextMin()
237 fM->SetDrawNumberCellPixels((Int_t)fCell2DTextMin->GetValue());
245 void TEveCaloLegoEditor::DoProjection()
247 fM->SetProjection((TEveCaloLego::EProjection_e)fProjection->GetSelected());
254 void TEveCaloLegoEditor::Do2DMode()
256 fM->Set2DMode((TEveCaloLego::E2DMode_e)f2DMode->GetSelected());
263 void TEveCaloLegoEditor::DoBoxMode()
265 fM->SetBoxMode((TEveCaloLego::EBoxMode_e)fBoxMode->GetSelected());
272 void TEveCaloLegoEditor::DoTransparency()
274 fM->SetPlaneTransparency((Char_t)(fTransparency->GetNumber()));
281 void TEveCaloLegoEditor::DoPixelsPerBin()
283 fM->SetPixelsPerBin((Int_t)fPixelsPerBin->GetValue());
289 void TEveCaloLegoEditor::DoAutoRebin()
291 fM->SetAutoRebin(fAutoRebin->IsOn());
297 void TEveCaloLegoEditor::DoNormalize()
299 fM->SetNormalizeRebin(fNormalizeRebin->IsOn());