]>
Commit | Line | Data |
---|---|---|
092578a7 | 1 | // $Header$ |
2 | ||
3 | #include "TPCSector3DEditor.h" | |
4 | #include <Alieve/TPCSector3D.h> | |
5 | ||
e2bf98a4 | 6 | #include <Reve/RGValuators.h> |
7 | ||
092578a7 | 8 | #include <TVirtualPad.h> |
9 | #include <TColor.h> | |
10 | ||
11 | #include <TGLabel.h> | |
12 | #include <TGButton.h> | |
13 | #include <TGNumberEntry.h> | |
14 | #include <TGColorSelect.h> | |
15 | #include <TGSlider.h> | |
16 | #include <TGDoubleSlider.h> | |
17 | ||
18 | using namespace Reve; | |
19 | using namespace Alieve; | |
20 | ||
21 | //______________________________________________________________________ | |
22 | // TPCSector3DEditor | |
23 | // | |
24 | ||
25 | ClassImp(TPCSector3DEditor) | |
26 | ||
265ecb21 | 27 | TPCSector3DEditor::TPCSector3DEditor(const TGWindow *p, Int_t id, |
28 | Int_t width, Int_t height, | |
092578a7 | 29 | UInt_t options, Pixel_t back) : |
265ecb21 | 30 | TGedFrame(p, id, width, height, options | kVerticalFrame, back), |
31 | fM(0), | |
32 | fRnrFrame(0), fDriftVel(0), fPointFrac(0), fPointSize(0) | |
092578a7 | 33 | { |
092578a7 | 34 | MakeTitle("TPCSector3D"); |
35 | ||
e2bf98a4 | 36 | Int_t labelW = 60; |
37 | ||
092578a7 | 38 | fRnrFrame = new TGCheckButton(this, "ShowFrame"); |
39 | AddFrame(fRnrFrame, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0)); | |
40 | fRnrFrame->Connect | |
41 | ("Toggled(Bool_t)","Alieve::TPCSector3DEditor", this, "DoRnrFrame()"); | |
42 | ||
e2bf98a4 | 43 | fDriftVel = new RGValuator(this, "Vdrift fac", 110, 0); |
44 | fDriftVel->SetLabelWidth(labelW); | |
45 | fDriftVel->SetShowSlider(kFALSE); | |
46 | fDriftVel->SetNELength(6); | |
47 | fDriftVel->Build(); | |
48 | fDriftVel->SetLimits(0.1, 10, 1, TGNumberFormat::kNESRealThree); | |
49 | fDriftVel->SetToolTip("Drift velocity factor"); | |
50 | fDriftVel->Connect("ValueSet(Double_t)", | |
51 | "Alieve::TPCSector3DEditor", this, "DoDriftVel()"); | |
52 | AddFrame(fDriftVel, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1)); | |
53 | ||
54 | fPointFrac = new RGValuator(this,"Point frac", 200, 0); | |
55 | fPointFrac->SetLabelWidth(labelW); | |
56 | fPointFrac->SetNELength(4); | |
57 | fPointFrac->Build(); | |
58 | fPointFrac->GetSlider()->SetWidth(101 + 16); | |
59 | fPointFrac->SetLimits(0.0, 1.0, 101); | |
60 | fPointFrac->SetToolTip("Fraction of signal range displayed as points"); | |
61 | fPointFrac->Connect("ValueSet(Double_t)", | |
62 | "Alieve::TPCSector3DEditor", this, "DoPointFrac()"); | |
63 | AddFrame(fPointFrac, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1)); | |
092578a7 | 64 | |
8a08431f | 65 | fPointSize = new RGValuator(this,"Point size", 200, 0); |
66 | fPointSize->SetLabelWidth(labelW); | |
67 | fPointSize->SetShowSlider(kFALSE); | |
68 | fPointSize->SetNELength(4); | |
69 | fPointSize->Build(); | |
70 | //fPointSize->GetSlider()->SetWidth(101 + 16); | |
71 | fPointSize->SetLimits(0.1, 32.0, 1, TGNumberFormat::kNESRealOne); | |
72 | fPointSize->SetToolTip("Size of displayed points"); | |
73 | fPointSize->Connect("ValueSet(Double_t)", | |
74 | "Alieve::TPCSector3DEditor", this, "DoPointSize()"); | |
75 | AddFrame(fPointSize, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1)); | |
76 | ||
092578a7 | 77 | // Register the editor. |
78 | TClass *cl = TPCSector3D::Class(); | |
79 | TGedElement *ge = new TGedElement; | |
80 | ge->fGedFrame = this; | |
81 | ge->fCanvas = 0; | |
82 | cl->GetEditorList()->Add(ge); | |
83 | } | |
84 | ||
85 | TPCSector3DEditor::~TPCSector3DEditor() | |
86 | {} | |
87 | ||
88 | /**************************************************************************/ | |
89 | ||
90 | void TPCSector3DEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t /*event*/) | |
91 | { | |
92 | fModel = 0; | |
93 | fPad = 0; | |
94 | ||
95 | if (!obj || !obj->InheritsFrom(TPCSector3D::Class()) || obj->InheritsFrom(TVirtualPad::Class())) { | |
96 | SetActive(kFALSE); | |
97 | return; | |
98 | } | |
99 | ||
100 | fModel = obj; | |
101 | fPad = pad; | |
102 | ||
103 | fM = dynamic_cast<TPCSector3D*>(fModel); | |
104 | ||
105 | fRnrFrame->SetState(fM->fRnrFrame ? kButtonDown : kButtonUp); | |
e2bf98a4 | 106 | fDriftVel->SetValue(fM->fDriftVel); |
107 | ||
108 | fPointFrac->SetValue(fM->fPointFrac); | |
8a08431f | 109 | fPointSize->SetValue(fM->fPointSize); |
092578a7 | 110 | |
111 | SetActive(); | |
112 | } | |
113 | ||
114 | /**************************************************************************/ | |
115 | ||
116 | void TPCSector3DEditor::DoRnrFrame() | |
117 | { | |
118 | fM->SetRnrFrame(fRnrFrame->IsOn()); | |
119 | Update(); | |
120 | } | |
121 | ||
122 | void TPCSector3DEditor::DoDriftVel() | |
123 | { | |
e2bf98a4 | 124 | fM->SetDriftVel(fDriftVel->GetValue()); |
092578a7 | 125 | Update(); |
126 | } | |
e2bf98a4 | 127 | |
128 | void TPCSector3DEditor::DoPointFrac() | |
129 | { | |
130 | fM->SetPointFrac(fPointFrac->GetValue()); | |
131 | Update(); | |
132 | } | |
133 | ||
8a08431f | 134 | void TPCSector3DEditor::DoPointSize() |
135 | { | |
136 | fM->SetPointSize(fPointSize->GetValue()); | |
137 | Update(); | |
138 | } | |
139 |