]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/Alieve/TPCSector3DEditor.cxx
Increased precision of drift velocity widget.
[u/mrichter/AliRoot.git] / EVE / Alieve / TPCSector3DEditor.cxx
CommitLineData
092578a7 1// $Header$
2
3#include "TPCSector3DEditor.h"
4#include <Alieve/TPCSector3D.h>
5
6#include <TVirtualPad.h>
7#include <TColor.h>
8
9#include <TGLabel.h>
10#include <TGButton.h>
11#include <TGNumberEntry.h>
12#include <TGColorSelect.h>
13#include <TGSlider.h>
14#include <TGDoubleSlider.h>
15
16using namespace Reve;
17using namespace Alieve;
18
19//______________________________________________________________________
20// TPCSector3DEditor
21//
22
23ClassImp(TPCSector3DEditor)
24
25TPCSector3DEditor::TPCSector3DEditor(const TGWindow *p, Int_t id, Int_t width, Int_t height,
26 UInt_t options, Pixel_t back) :
27 TGedFrame(p, id, width, height, options | kVerticalFrame, back)
28{
29 fM = 0;
30 MakeTitle("TPCSector3D");
31
32 fRnrFrame = new TGCheckButton(this, "ShowFrame");
33 AddFrame(fRnrFrame, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
34 fRnrFrame->Connect
35 ("Toggled(Bool_t)","Alieve::TPCSector3DEditor", this, "DoRnrFrame()");
36
37 {
38 TGHorizontalFrame* f = new TGHorizontalFrame(this);
39 TGLabel *l = new TGLabel(f, "Drift Velocity factor:");
40 f->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 25, 2, 1, 1));
41 fDriftVel = new TGNumberEntry(f, 0., 6, -1,
e0f87120 42 TGNumberFormat::kNESRealThree, TGNumberFormat::kNEAPositive,
092578a7 43 TGNumberFormat::kNELLimitMinMax, 0.001, 1000.0);
44 fDriftVel->GetNumberEntry()->SetToolTipText("Drift velocity factor.");
45 f->AddFrame(fDriftVel, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
46 fDriftVel->Associate(f);
47 fDriftVel->Connect("ValueSet(Long_t)", "Alieve::TPCSector3DEditor", this, "DoDriftVel()");
48 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
49 }
50
51 // Register the editor.
52 TClass *cl = TPCSector3D::Class();
53 TGedElement *ge = new TGedElement;
54 ge->fGedFrame = this;
55 ge->fCanvas = 0;
56 cl->GetEditorList()->Add(ge);
57}
58
59TPCSector3DEditor::~TPCSector3DEditor()
60{}
61
62/**************************************************************************/
63
64void TPCSector3DEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t /*event*/)
65{
66 fModel = 0;
67 fPad = 0;
68
69 if (!obj || !obj->InheritsFrom(TPCSector3D::Class()) || obj->InheritsFrom(TVirtualPad::Class())) {
70 SetActive(kFALSE);
71 return;
72 }
73
74 fModel = obj;
75 fPad = pad;
76
77 fM = dynamic_cast<TPCSector3D*>(fModel);
78
79 fRnrFrame->SetState(fM->fRnrFrame ? kButtonDown : kButtonUp);
80 fDriftVel->SetNumber(fM->fDriftVel);
81
82 SetActive();
83}
84
85/**************************************************************************/
86
87void TPCSector3DEditor::DoRnrFrame()
88{
89 fM->SetRnrFrame(fRnrFrame->IsOn());
90 Update();
91}
92
93void TPCSector3DEditor::DoDriftVel()
94{
95 fM->SetDriftVel((Float_t) fDriftVel->GetNumber());
96 Update();
97}