#include "TEveCaloLegoEditor.h"
#include "TEveCalo.h"
#include "TEveGValuators.h"
#include "TGComboBox.h"
#include "TColor.h"
#include "TGColorSelect.h"
#include "TGLabel.h"
#include "TG3DLine.h"
ClassImp(TEveCaloLegoEditor);
TEveCaloLegoEditor::TEveCaloLegoEditor(const TGWindow *p, Int_t width, Int_t height,
UInt_t options, Pixel_t back) :
TGedFrame(p, width, height, options | kVerticalFrame, back),
fM(0),
fTopViewUseMaxColor(0),
fTopViewTowerColor(0),
fGridColor(0),
fFontColor(0),
fPlaneColor(0),
fTransparency(0),
fNZSteps(0),
fProjection(0),
f2DMode(0),
fBoxMode(0),
fRebinFrame(0),
fAutoRebin(0),
fPixelsPerBin(0),
fNormalizeRebin(0)
{
MakeTitle("TEveCaloLego");
{
TGHorizontalFrame* f = new TGHorizontalFrame(this);
TGLabel* lab = new TGLabel(f, "Tower-2D:");
f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 8, 1, 1));
fTopViewTowerColor = new TGColorSelect(f, 0, -1);
f->AddFrame(fTopViewTowerColor, new TGLayoutHints(kLHintsLeft|kLHintsTop, 3, 1, 0, 1));
fTopViewTowerColor->Connect("ColorSelected(Pixel_t)", "TEveCaloLegoEditor", this, "DoTopViewTowerColor(Pixel_t)");
fTopViewUseMaxColor = new TGCheckButton(f, "Auto color");
f->AddFrame(fTopViewUseMaxColor);
fTopViewUseMaxColor->Connect("Clicked()", "TEveCaloLegoEditor", this, "DoTopViewUseMaxColor()");
AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
}
{
TGHorizontalFrame* f = new TGHorizontalFrame(this);
TGLabel* lab = new TGLabel(f, "GridColor:");
f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 10, 1, 1));
fGridColor = new TGColorSelect(f, 0, -1);
f->AddFrame(fGridColor, new TGLayoutHints(kLHintsLeft|kLHintsTop, 3, 1, 0, 1));
fGridColor->Connect("ColorSelected(Pixel_t)", "TEveCaloLegoEditor", this, "DoGridColor(Pixel_t)");
AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
}
{
TGHorizontalFrame* f = new TGHorizontalFrame(this);
TGLabel* lab = new TGLabel(f, "FontColor:");
f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 8, 1, 1));
fFontColor = new TGColorSelect(f, 0, -1);
f->AddFrame(fFontColor, new TGLayoutHints(kLHintsLeft|kLHintsTop, 3, 1, 0, 1));
fFontColor->Connect("ColorSelected(Pixel_t)", "TEveCaloLegoEditor", this, "DoFontColor(Pixel_t)");
AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
}
{
TGHorizontalFrame* f = new TGHorizontalFrame(this);
TGLabel* lab = new TGLabel(f, "PlaneColor:");
f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 1, 1, 1));
fPlaneColor = new TGColorSelect(f, 0, -1);
f->AddFrame(fPlaneColor, new TGLayoutHints(kLHintsLeft|kLHintsTop, 3, 1, 0, 1));
fPlaneColor->Connect("ColorSelected(Pixel_t)", "TEveCaloLegoEditor", this, "DoPlaneColor(Pixel_t)");
fTransparency = new TGNumberEntry(f, 0., 2, -1,
TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELLimitMinMax, 0, 100);
fTransparency->SetHeight(18);
fTransparency->GetNumberEntry()->SetToolTipText("Transparency: 0 is opaque, 100 fully transparent.");
f->AddFrame(fTransparency, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
fTransparency->Connect("ValueSet(Long_t)","TEveCaloLegoEditor", this, "DoTransparency()");
AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
}
Int_t lw = 80;
fNZSteps = new TEveGValuator(this, "ZTickMarks:", 90, 0);
fNZSteps->SetLabelWidth(lw);
fNZSteps->SetNELength(5);
fNZSteps->SetShowSlider(kFALSE);
fNZSteps->Build();
fNZSteps->SetLimits(1, 20);
fNZSteps->SetToolTip("Number of labels along the Z axis.");
fNZSteps->Connect("ValueSet(Double_t)", "TEveCaloLegoEditor", this, "DoNZSteps()");
AddFrame(fNZSteps, new TGLayoutHints(kLHintsTop, 4, 2, 1, 2));
fProjection = MakeLabeledCombo("Project:", 1);
fProjection->AddEntry("Auto", TEveCaloLego::kAuto);
fProjection->AddEntry("3D", TEveCaloLego::k3D);
fProjection->AddEntry("2D", TEveCaloLego::k2D);
fProjection->Connect("Selected(Int_t)", "TEveCaloLegoEditor", this, "DoProjection()");
f2DMode = MakeLabeledCombo("2DMode:", 4);
f2DMode->AddEntry("ValColor", TEveCaloLego::kValColor);
f2DMode->AddEntry("ValSize", TEveCaloLego::kValSize);
f2DMode->Connect("Selected(Int_t)", "TEveCaloLegoEditor", this, "Do2DMode()");
fBoxMode = MakeLabeledCombo("Box:", 4);
fBoxMode->AddEntry("None", TEveCaloLego::kNone);
fBoxMode->AddEntry("Back", TEveCaloLego::kBack);
fBoxMode->AddEntry("FrontBack", TEveCaloLego::kFrontBack);
fBoxMode->Connect("Selected(Int_t)", "TEveCaloLegoEditor", this, "DoBoxMode()");
MakeRebinFrame();
}
void TEveCaloLegoEditor::MakeRebinFrame()
{
fRebinFrame = CreateEditorTabSubFrame("Rebin");
fAutoRebin = new TGCheckButton(fRebinFrame, "AutoRebin");
fRebinFrame->AddFrame(fAutoRebin, new TGLayoutHints(kLHintsLeft, 3, 5, 3, 0));
fAutoRebin->Connect("Toggled(Bool_t)", "TEveCaloLegoEditor", this, "DoAutoRebin()");
fNormalizeRebin = new TGCheckButton(fRebinFrame, "NormalizeRebin");
fRebinFrame->AddFrame(fNormalizeRebin, new TGLayoutHints(kLHintsLeft, 3, 5, 3, 0));
fNormalizeRebin->Connect("Toggled(Bool_t)", "TEveCaloLegoEditor", this, "DoNormalize()");
fPixelsPerBin = new TEveGValuator(fRebinFrame, "PixelsPerBin:", 90, 0);
fPixelsPerBin->SetLabelWidth(80);
fPixelsPerBin->SetNELength(5);
fPixelsPerBin->SetShowSlider(kFALSE);
fPixelsPerBin->Build();
fPixelsPerBin->SetLimits(1, 50);
fPixelsPerBin->SetToolTip("Number of labels along the Z axis.");
fPixelsPerBin->Connect("ValueSet(Double_t)", "TEveCaloLegoEditor", this, "DoPixelsPerBin()");
fRebinFrame->AddFrame(fPixelsPerBin, new TGLayoutHints(kLHintsTop, 4, 2, 1, 2));
}
TGComboBox* TEveCaloLegoEditor::MakeLabeledCombo(const char* name, Int_t off)
{
UInt_t labelW = 60;
UInt_t labelH = 20;
TGHorizontalFrame* hf = new TGHorizontalFrame(this);
TGCompositeFrame *labfr = new TGHorizontalFrame(hf, labelW, labelH, kFixedSize);
TGLabel* label = new TGLabel(labfr, name);
labfr->AddFrame(label, new TGLayoutHints(kLHintsLeft | kLHintsBottom));
hf->AddFrame(labfr, new TGLayoutHints(kLHintsLeft));
TGLayoutHints* clh = new TGLayoutHints(kLHintsLeft, 0,0,0,0);
TGComboBox* combo = new TGComboBox(hf);
combo->Resize(90, 20);
hf->AddFrame(combo, clh);
AddFrame(hf, new TGLayoutHints(kLHintsTop, 4, 1, 1, off));
return combo;
}
void TEveCaloLegoEditor::SetModel(TObject* obj)
{
fM = dynamic_cast<TEveCaloLego*>(obj);
fTopViewUseMaxColor->SetState(fM->GetTopViewUseMaxColor() ? kButtonDown : kButtonUp);
fTopViewTowerColor->SetColor(TColor::Number2Pixel(fM->GetTopViewTowerColor()), kFALSE);
fGridColor->SetColor(TColor::Number2Pixel(fM->GetGridColor()), kFALSE);
fFontColor->SetColor(TColor::Number2Pixel(fM->GetFontColor()), kFALSE);
fPlaneColor->SetColor(TColor::Number2Pixel(fM->GetPlaneColor()), kFALSE);
fTransparency->SetNumber(fM->GetPlaneTransparency());
fNZSteps->SetValue(fM->GetNZSteps());
fProjection->Select(fM->GetProjection(), kFALSE);
f2DMode->Select(fM->Get2DMode(), kFALSE);
fBoxMode->Select(fM->GetBoxMode(), kFALSE);
fPixelsPerBin->SetValue(fM->GetPixelsPerBin());
fAutoRebin->SetState(fM->GetAutoRebin() ? kButtonDown : kButtonUp);
fNormalizeRebin->SetState(fM->GetNormalizeRebin() ? kButtonDown : kButtonUp);
}
void TEveCaloLegoEditor::DoTopViewUseMaxColor()
{
fM->SetTopViewUseMaxColor(fTopViewUseMaxColor->IsOn());
Update();
}
void TEveCaloLegoEditor::DoTopViewTowerColor(Pixel_t pixel)
{
fM->SetTopViewTowerColor(Color_t(TColor::GetColor(pixel)));
Update();
}
void TEveCaloLegoEditor::DoGridColor(Pixel_t pixel)
{
fM->SetGridColor(Color_t(TColor::GetColor(pixel)));
Update();
}
void TEveCaloLegoEditor::DoFontColor(Pixel_t pixel)
{
fM->SetFontColor(Color_t(TColor::GetColor(pixel)));
Update();
}
void TEveCaloLegoEditor::DoPlaneColor(Pixel_t pixel)
{
fM->SetPlaneColor(Color_t(TColor::GetColor(pixel)));
Update();
}
void TEveCaloLegoEditor::DoNZSteps()
{
fM->SetNZSteps((Int_t)fNZSteps->GetValue());
Update();
}
void TEveCaloLegoEditor::DoProjection()
{
fM->SetProjection((TEveCaloLego::EProjection_e)fProjection->GetSelected());
Update();
}
void TEveCaloLegoEditor::Do2DMode()
{
fM->Set2DMode((TEveCaloLego::E2DMode_e)f2DMode->GetSelected());
Update();
}
void TEveCaloLegoEditor::DoBoxMode()
{
fM->SetBoxMode((TEveCaloLego::EBoxMode_e)fBoxMode->GetSelected());
Update();
}
void TEveCaloLegoEditor::DoTransparency()
{
fM->SetPlaneTransparency((UChar_t)(fTransparency->GetNumber()));
Update();
}
void TEveCaloLegoEditor::DoPixelsPerBin()
{
fM->SetPixelsPerBin((Int_t)fPixelsPerBin->GetValue());
Update();
}
void TEveCaloLegoEditor::DoAutoRebin()
{
fM->SetAutoRebin(fAutoRebin->IsOn());
Update();
}
void TEveCaloLegoEditor::DoNormalize()
{
fM->SetNormalizeRebin(fNormalizeRebin->IsOn());
Update();
}
Last change: Tue Aug 26 17:14:54 2008
Last generated: 2008-08-26 17:14
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.