]>
Commit | Line | Data |
---|---|---|
092578a7 | 1 | // $Header$ |
2 | ||
3 | #include "TPCSectorVizEditor.h" | |
4 | #include <Alieve/TPCSectorViz.h> | |
5 | ||
5987168b | 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 | // TPCSectorVizEditor | |
23 | // | |
24 | ||
25 | ClassImp(TPCSectorVizEditor) | |
26 | ||
e8f20a25 | 27 | TPCSectorVizEditor::TPCSectorVizEditor(const TGWindow *p, Int_t id, |
265ecb21 | 28 | Int_t width, Int_t height, |
29 | UInt_t options, Pixel_t back) : | |
e8f20a25 | 30 | TGedFrame(p, id, width, height, options | kVerticalFrame, back), |
265ecb21 | 31 | fM(0), |
32 | fSectorID (0), fTrans (0), | |
33 | fRnrInn (0), fRnrOut1 (0), fRnrOut2(0), | |
34 | fThreshold (0), fMaxVal (0), | |
35 | fTime (0) | |
092578a7 | 36 | { |
092578a7 | 37 | MakeTitle("TPCSectorViz"); |
38 | ||
5987168b | 39 | Int_t labelW = 60; |
092578a7 | 40 | |
5987168b | 41 | fSectorID = new RGValuator(this, "SectorID", 110, 0); |
42 | fSectorID->SetLabelWidth(labelW); | |
43 | fSectorID->SetShowSlider(kFALSE); | |
44 | fSectorID->SetNELength(4); | |
45 | fSectorID->Build(); | |
46 | fSectorID->SetLimits(0, 35); | |
47 | fSectorID->SetToolTip("0-17 +z plate; 18-35 -z plate"); | |
48 | fSectorID->Connect("ValueSet(Double_t)", | |
49 | "Alieve::TPCSectorVizEditor", this, "DoSectorID()"); | |
02937761 | 50 | // Reuse sectorID for transformation button |
51 | fTrans = new TGCheckButton(fSectorID, "Trans"); | |
52 | fTrans->SetToolTipText("Translate to true position"); | |
53 | fSectorID->AddFrame(fTrans, new TGLayoutHints(kLHintsLeft, 12, 0, 1, 0)); | |
54 | fTrans->Connect("Toggled(Bool_t)","Alieve::TPCSectorVizEditor", this, "DoTrans()"); | |
5987168b | 55 | AddFrame(fSectorID, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); |
092578a7 | 56 | |
092578a7 | 57 | { |
58 | TGHorizontalFrame* f = new TGHorizontalFrame(this); | |
59 | ||
60 | fRnrInn = new TGCheckButton(f, "Inner"); | |
61 | f->AddFrame(fRnrInn, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0)); | |
62 | fRnrInn->Connect("Toggled(Bool_t)","Alieve::TPCSectorVizEditor", this, "DoRnrInn()"); | |
63 | ||
64 | fRnrOut1 = new TGCheckButton(f, "Outer 1"); | |
65 | f->AddFrame(fRnrOut1, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0)); | |
66 | fRnrOut1->Connect("Toggled(Bool_t)","Alieve::TPCSectorVizEditor", this, "DoRnrOut1()"); | |
67 | ||
68 | fRnrOut2 = new TGCheckButton(f, "Outer 2"); | |
69 | f->AddFrame(fRnrOut2, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0)); | |
70 | fRnrOut2->Connect("Toggled(Bool_t)","Alieve::TPCSectorVizEditor", this, "DoRnrOut2()"); | |
71 | ||
72 | AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); | |
73 | } | |
5987168b | 74 | |
75 | fThreshold = new RGValuator(this, "Threshold", 200, 0); | |
76 | fThreshold->SetNELength(4); | |
77 | fThreshold->SetLabelWidth(labelW); | |
78 | fThreshold->Build(); | |
79 | fThreshold->GetSlider()->SetWidth(120); | |
80 | fThreshold->SetLimits(0,149); | |
81 | fThreshold->Connect("ValueSet(Double_t)", | |
82 | "Alieve::TPCSectorVizEditor", this, "DoThreshold()"); | |
83 | AddFrame(fThreshold, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1)); | |
84 | ||
85 | fMaxVal = new RGValuator(this,"MaxVal", 200, 0); | |
86 | fMaxVal->SetNELength(4); | |
87 | fMaxVal->SetLabelWidth(labelW); | |
88 | fMaxVal->Build(); | |
89 | fMaxVal->GetSlider()->SetWidth(120); | |
90 | fMaxVal->SetLimits(0, 299); | |
91 | fMaxVal->Connect("ValueSet(Double_t)", | |
92 | "Alieve::TPCSectorVizEditor", this, "DoMaxVal()"); | |
93 | AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1)); | |
94 | ||
95 | fTime = new RGDoubleValuator(this,"Time", 200, 0); | |
96 | fTime->SetNELength(4); | |
97 | fTime->SetLabelWidth(labelW); | |
98 | fTime->Build(); | |
99 | fTime->GetSlider()->SetWidth(224); | |
100 | fTime->SetLimits(0, 1023, TGNumberFormat::kNESInteger); | |
101 | fTime->Connect("ValueSet()", | |
102 | "Alieve::TPCSectorVizEditor", this, "DoTime()"); | |
103 | AddFrame(fTime, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1)); | |
e8f20a25 | 104 | |
105 | ||
106 | // Register the editor. | |
107 | TClass *cl = TPCSectorViz::Class(); | |
108 | TGedElement *ge = new TGedElement; | |
109 | ge->fGedFrame = this; | |
110 | ge->fCanvas = 0; | |
111 | cl->GetEditorList()->Add(ge); | |
092578a7 | 112 | } |
113 | ||
114 | TPCSectorVizEditor::~TPCSectorVizEditor() | |
115 | {} | |
116 | ||
117 | /**************************************************************************/ | |
118 | ||
e8f20a25 | 119 | void TPCSectorVizEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t /*event*/) |
092578a7 | 120 | { |
e8f20a25 | 121 | fModel = 0; |
122 | fPad = 0; | |
123 | ||
124 | if (!obj || !obj->InheritsFrom(TPCSectorViz::Class()) || obj->InheritsFrom(TVirtualPad::Class())) { | |
125 | SetActive(kFALSE); | |
126 | return; | |
127 | } | |
128 | ||
129 | fModel = obj; | |
130 | fPad = pad; | |
131 | ||
132 | fM = dynamic_cast<TPCSectorViz*>(fModel); | |
092578a7 | 133 | |
5987168b | 134 | fSectorID->SetValue(fM->fSectorID); |
02937761 | 135 | fTrans->SetState(fM->fTrans ? kButtonDown : kButtonUp); |
5987168b | 136 | |
137 | fRnrInn ->SetState(fM->fRnrInn ? kButtonDown : kButtonUp); | |
092578a7 | 138 | fRnrOut1->SetState(fM->fRnrOut1 ? kButtonDown : kButtonUp); |
139 | fRnrOut2->SetState(fM->fRnrOut2 ? kButtonDown : kButtonUp); | |
092578a7 | 140 | |
5987168b | 141 | fThreshold->SetValue(fM->fThreshold); |
142 | fMaxVal->SetValue(fM->fMaxVal); | |
143 | ||
144 | fTime->SetValues(fM->fMinTime, fM->fMaxTime); | |
e8f20a25 | 145 | |
146 | SetActive(); | |
092578a7 | 147 | } |
148 | ||
149 | /**************************************************************************/ | |
150 | ||
151 | void TPCSectorVizEditor::DoSectorID() | |
152 | { | |
5987168b | 153 | fM->SetSectorID((Int_t) fSectorID->GetValue()); |
092578a7 | 154 | Update(); |
155 | } | |
156 | ||
02937761 | 157 | void TPCSectorVizEditor::DoTrans() |
158 | { | |
159 | fM->SetTrans(fTrans->IsOn()); | |
160 | Update(); | |
161 | } | |
162 | ||
092578a7 | 163 | /**************************************************************************/ |
164 | ||
165 | void TPCSectorVizEditor::DoRnrInn() | |
166 | { | |
167 | fM->SetRnrInn(fRnrInn->IsOn()); | |
168 | Update(); | |
169 | } | |
170 | ||
171 | void TPCSectorVizEditor::DoRnrOut1() | |
172 | { | |
173 | fM->SetRnrOut1(fRnrOut1->IsOn()); | |
174 | Update(); | |
175 | } | |
176 | ||
177 | void TPCSectorVizEditor::DoRnrOut2() | |
178 | { | |
179 | fM->SetRnrOut2(fRnrOut2->IsOn()); | |
180 | Update(); | |
181 | } | |
182 | ||
183 | /**************************************************************************/ | |
184 | ||
185 | void TPCSectorVizEditor::DoThreshold() | |
186 | { | |
5987168b | 187 | fM->SetThreshold((Short_t) fThreshold->GetValue()); |
a89f67d8 | 188 | fThreshold->SetValue(fM->fThreshold); |
092578a7 | 189 | Update(); |
190 | } | |
191 | ||
192 | void TPCSectorVizEditor::DoMaxVal() | |
193 | { | |
5987168b | 194 | fM->SetMaxVal((Int_t) fMaxVal->GetValue()); |
a89f67d8 | 195 | fMaxVal->SetValue(fM->fMaxVal); |
092578a7 | 196 | Update(); |
197 | } | |
198 | ||
199 | /**************************************************************************/ | |
200 | ||
092578a7 | 201 | void TPCSectorVizEditor::DoTime() |
202 | { | |
5987168b | 203 | fM->SetMinTime((Int_t) fTime->GetMin()); |
204 | fM->SetMaxTime((Int_t) fTime->GetMax()); | |
092578a7 | 205 | Update(); |
206 | } |