3 #include "TrackRnrStyleEditor.h"
4 #include <Reve/Track.h>
6 #include <Reve/RGValuators.h>
7 #include <Reve/ReveManager.h>
9 #include <TVirtualPad.h>
15 #include <TGNumberEntry.h>
16 #include <TGColorSelect.h>
17 #include <TGDoubleSlider.h>
18 #include <TGComboBox.h>
19 #include <TAttMarkerEditor.h>
23 //______________________________________________________________________
24 // TrackRnrStyleSubEditor
28 ClassImp(TrackRnrStyleSubEditor)
30 TrackRnrStyleSubEditor::TrackRnrStyleSubEditor(const TGWindow *p):
57 fMaxR = new RGValuator(this, "Max R:", 90, 0);
58 fMaxR->SetLabelWidth(labelW);
59 fMaxR->SetNELength(6);
61 fMaxR->SetLimits(0.1, 1000, 101, TGNumberFormat::kNESRealOne);
62 fMaxR->SetToolTip("Maximum radius to which the tracks will be drawn.");
63 fMaxR->Connect("ValueSet(Double_t)", "Reve::TrackRnrStyleSubEditor", this, "DoMaxR()");
64 AddFrame(fMaxR, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
66 fMaxZ = new RGValuator(this, "Max Z:", 90, 0);
67 fMaxZ->SetLabelWidth(labelW);
68 fMaxZ->SetNELength(6);
70 fMaxZ->SetLimits(0.1, 2000, 101, TGNumberFormat::kNESRealOne);
71 fMaxZ->SetToolTip("Maximum z-coordinate to which the tracks will be drawn.");
72 fMaxZ->Connect("ValueSet(Double_t)", "Reve::TrackRnrStyleSubEditor", this, "DoMaxZ()");
73 AddFrame(fMaxZ, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
75 fMaxOrbits = new RGValuator(this, "Orbits:", 90, 0);
76 fMaxOrbits->SetLabelWidth(labelW);
77 fMaxOrbits->SetNELength(6);
79 fMaxOrbits->SetLimits(0.1, 10, 101, TGNumberFormat::kNESRealOne);
80 fMaxOrbits->SetToolTip("Maximal angular path of tracks' orbits (1 ~ 2Pi).");
81 fMaxOrbits->Connect("ValueSet(Double_t)", "Reve::TrackRnrStyleSubEditor", this, "DoMaxOrbits()");
82 AddFrame(fMaxOrbits, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
84 fMinAng = new RGValuator(this, "Angle:", 90, 0);
85 fMinAng->SetLabelWidth(labelW);
86 fMinAng->SetNELength(6);
88 fMinAng->SetLimits(1, 160, 81, TGNumberFormat::kNESRealOne);
89 fMinAng->SetToolTip("Minimal angular step between two helix points.");
90 fMinAng->Connect("ValueSet(Double_t)", "Reve::TrackRnrStyleSubEditor", this, "DoMinAng()");
91 AddFrame(fMinAng, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
93 fDelta = new RGValuator(this, "Delta:", 90, 0);
94 fDelta->SetLabelWidth(labelW);
95 fDelta->SetNELength(6);
97 fDelta->SetLimits(0.001, 10, 101, TGNumberFormat::kNESRealThree);
98 fDelta->SetToolTip("Maximal error at the mid-point of the line connecting to helix points.");
99 fDelta->Connect("ValueSet(Double_t)", "Reve::TrackRnrStyleSubEditor", this, "DoDelta()");
100 AddFrame(fDelta, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
103 //______________________________________________________________________________
104 void TrackRnrStyleSubEditor::CreateRefsContainer(TGVerticalFrame* p)
106 // Create a frame containing track-reference controls under parent
109 fRefsCont = new TGCompositeFrame(p, 80, 20, kVerticalFrame);
110 fPMFrame = new TGVerticalFrame(fRefsCont);
111 // Rendering control.
113 TGGroupFrame* fitPM = new TGGroupFrame(fPMFrame, "PathMarks:", kLHintsTop | kLHintsCenterX);
114 fitPM->SetTitlePos(TGGroupFrame::kLeft);
115 fPMFrame->AddFrame( fitPM, new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 3, 3, 3, 3));
117 TGMatrixLayout *ml = new TGMatrixLayout(fitPM, 0,1,6);
118 fitPM->SetLayoutManager(ml);
120 fFitDaughters = new TGCheckButton(fitPM, "Fit Daughters", PathMark::Daughter);
121 fFitReferences = new TGCheckButton(fitPM, "Fit Refs", PathMark::Reference);
122 fFitDecay = new TGCheckButton(fitPM, "Fit Decay", PathMark::Decay);
124 fitPM->AddFrame(fFitDaughters);
125 fitPM->AddFrame(fFitReferences);
126 fitPM->AddFrame(fFitDecay);
128 fFitDecay->Connect("Clicked()","Reve::TrackRnrStyleSubEditor", this, "DoFitPM()");
129 fFitReferences->Connect("Clicked()","Reve::TrackRnrStyleSubEditor", this, "DoFitPM()");
130 fFitDaughters->Connect("Clicked()","Reve::TrackRnrStyleSubEditor", this, "DoFitPM()");
132 // Kinematics fitting.
134 TGGroupFrame* rnrPM = new TGGroupFrame(fPMFrame, "PathMarks:", kLHintsTop | kLHintsCenterX);
135 rnrPM->SetTitlePos(TGGroupFrame::kLeft);
136 fPMFrame->AddFrame( rnrPM, new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 3, 3, 3, 3));
138 TGMatrixLayout *ml = new TGMatrixLayout(rnrPM, 0,1,6);
139 rnrPM->SetLayoutManager(ml);
141 fRnrDaughters = new TGCheckButton(rnrPM, "Rnr Daughters", PathMark::Daughter);
142 fRnrReferences = new TGCheckButton(rnrPM, "Rnr Refs", PathMark::Reference);
143 fRnrDecay = new TGCheckButton(rnrPM, "Rnr Decay", PathMark::Decay);
145 rnrPM->AddFrame(fRnrDaughters);
146 rnrPM->AddFrame(fRnrReferences);
147 rnrPM->AddFrame(fRnrDecay);
149 fRnrDecay->Connect("Clicked()","Reve::TrackRnrStyleSubEditor", this, "DoRnrPM()");
150 fRnrReferences->Connect("Clicked()","Reve::TrackRnrStyleSubEditor", this, "DoRnrPM()");
151 fRnrDaughters->Connect("Clicked()","Reve::TrackRnrStyleSubEditor", this, "DoRnrPM()");
153 fRefsCont->AddFrame(fPMFrame, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
155 // Marker attributes.
157 fPMAtt = new TAttMarkerEditor(fRefsCont);
158 TGFrameElement *el = (TGFrameElement*) fPMAtt->GetList()->First();
159 TGFrame *f = el->fFrame; fPMAtt->RemoveFrame(f);
160 f->DestroyWindow(); delete f;
161 fRefsCont->AddFrame(fPMAtt, new TGLayoutHints(kLHintsTop, 1, 1, 3, 1));
165 TGCompositeFrame *title1 = new TGCompositeFrame(fRefsCont, 145, 10,
170 title1->AddFrame(new TGLabel(title1, "FirstVertex"),
171 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
172 title1->AddFrame(new TGHorizontal3DLine(title1),
173 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 5));
174 fRefsCont->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
176 fRnrFV = new TGCheckButton(fRefsCont, "Rnr");
177 fRnrFV->Connect("Clicked()","Reve::TrackRnrStyleSubEditor", this, "DoRnrFV()");
178 fRefsCont->AddFrame(fRnrFV, new TGLayoutHints(kLHintsTop, 5, 1, 2, 0));
180 fFVAtt = new TAttMarkerEditor(fRefsCont);
181 TGFrameElement *el = (TGFrameElement*) fFVAtt->GetList()->First();
182 TGFrame *f = el->fFrame; fFVAtt->RemoveFrame(f);
183 f->DestroyWindow(); delete f;
184 fRefsCont->AddFrame(fFVAtt, new TGLayoutHints(kLHintsTop, 1, 1, 3, 1));
186 p->AddFrame(fRefsCont,new TGLayoutHints(kLHintsTop| kLHintsExpandX));
189 //______________________________________________________________________________
190 void TrackRnrStyleSubEditor::SetModel(TrackRnrStyle* m)
196 fMaxR->SetValue(fM->fMaxR);
197 fMaxZ->SetValue(fM->fMaxZ);
198 fMaxOrbits->SetValue(fM->fMaxOrbs);
199 fMinAng->SetValue(fM->fMinAng);
200 fDelta->SetValue(fM->fDelta);
202 if(fM->fEditPathMarks)
205 fRnrDaughters->SetState(fM->fRnrDaughters ? kButtonDown : kButtonUp);
206 fRnrReferences->SetState(fM->fRnrReferences ? kButtonDown : kButtonUp);
207 fRnrDecay->SetState(fM->fRnrDecay ? kButtonDown : kButtonUp);
209 fFitDaughters->SetState(fM->fFitDaughters ? kButtonDown : kButtonUp);
210 fFitReferences->SetState(fM->fFitReferences ? kButtonDown : kButtonUp);
211 fFitDecay->SetState(fM->fFitDecay ? kButtonDown : kButtonUp);
213 fPMAtt->SetModel(&fM->fPMAtt);
217 fRefsCont->HideFrame(fPMFrame);
220 fRnrFV->SetState(fM->fRnrFV ? kButtonDown : kButtonUp);
221 fFVAtt->SetModel(&fM->fFVAtt);
224 /******************************************************************************/
226 //______________________________________________________________________________
227 void TrackRnrStyleSubEditor::Changed()
229 // Update registered tracks and emit "Changed()" signal.
231 fM->UpdateBackPtrItems();
235 /******************************************************************************/
237 void TrackRnrStyleSubEditor::DoMaxR()
239 fM->SetMaxR(fMaxR->GetValue());
243 void TrackRnrStyleSubEditor::DoMaxZ()
245 fM->SetMaxZ(fMaxZ->GetValue());
249 void TrackRnrStyleSubEditor::DoMaxOrbits()
251 fM->SetMaxOrbs(fMaxOrbits->GetValue());
255 void TrackRnrStyleSubEditor::DoMinAng()
257 fM->SetMinAng(fMinAng->GetValue());
261 void TrackRnrStyleSubEditor::DoDelta()
263 fM->SetDelta(fDelta->GetValue());
267 /******************************************************************************/
269 void TrackRnrStyleSubEditor::DoFitPM()
271 TGButton* b = (TGButton *) gTQSender;
272 PathMark::Type_e type = PathMark::Type_e(b->WidgetId());
273 Bool_t on = b->IsOn();
277 case PathMark::Daughter:
278 fM->SetFitDaughters(on);
280 case PathMark::Reference:
281 fM->SetFitReferences(on);
283 case PathMark::Decay:
292 void TrackRnrStyleSubEditor::DoRnrPM()
294 TGButton * b = (TGButton *) gTQSender;
295 PathMark::Type_e type = PathMark::Type_e(b->WidgetId());
296 Bool_t on = b->IsOn();
298 case PathMark::Daughter:
299 fM->SetRnrDaughters(on);
301 case PathMark::Reference:
302 fM->SetRnrReferences(on);
304 case PathMark::Decay:
314 void TrackRnrStyleSubEditor::DoRnrFV()
316 fM->SetRnrFV(fRnrFV->IsOn());
321 //______________________________________________________________________________
322 // TrackRnrStyleEditor
324 // GUI editor for TrackRnrStyle.
325 // It's only a wrapper around a TrackRnrStyleSubEditor that holds actual
328 ClassImp(TrackRnrStyleEditor)
330 //______________________________________________________________________________
331 TrackRnrStyleEditor::TrackRnrStyleEditor(const TGWindow *p,
332 Int_t width, Int_t height,
333 UInt_t options, Pixel_t back) :
334 TGedFrame(p, width, height, options | kVerticalFrame, back),
340 MakeTitle("RenderStyle");
342 fRSSubEditor = new TrackRnrStyleSubEditor(this);
343 fRSSubEditor->Connect("Changed()", "Reve::TrackRnrStyleEditor", this, "Update()");
344 AddFrame(fRSSubEditor, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 0,0,0));
346 TGVerticalFrame* refsFrame = CreateEditorTabSubFrame("Refs");
347 TGCompositeFrame *title1 = new TGCompositeFrame(refsFrame, 145, 10,
352 title1->AddFrame(new TGLabel(title1, "PathMarks"),
353 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
354 title1->AddFrame(new TGHorizontal3DLine(title1),
355 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
356 refsFrame->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
359 fRSSubEditor->CreateRefsContainer(refsFrame);
360 fRSSubEditor->fPMAtt->SetGedEditor((TGedEditor*)gReve->GetEditor());
361 fRSSubEditor->fFVAtt->SetGedEditor((TGedEditor*)gReve->GetEditor());
363 fRSSubEditor->Connect("Changed()", "Reve::TrackRnrStyleEditor", this, "Update()");
366 //______________________________________________________________________________
367 TrackRnrStyleEditor::~TrackRnrStyleEditor()
372 /******************************************************************************/
374 //______________________________________________________________________________
375 void TrackRnrStyleEditor::SetModel(TObject* obj)
379 fM = dynamic_cast<TrackRnrStyle*>(obj);
380 fRSSubEditor->SetModel(fM);