ROOT logo
// @(#)root/eve:$Id: TEveTrackEditor.cxx 26034 2008-10-31 14:01:05Z matevz $
// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#include "TEveTrackEditor.h"
#include "TEveTrack.h"
#include "TEveTrackPropagator.h"
#include "TEveTrackPropagatorEditor.h"
#include "TEveManager.h"

#include "TEveGValuators.h"

#include "TVirtualPad.h"
#include "TColor.h"

#include "TGedEditor.h"
#include "TAttMarkerEditor.h"
#include "TGLabel.h"
#include "TG3DLine.h"
#include "TGButton.h"
#include "TGNumberEntry.h"
#include "TGColorSelect.h"
#include "TGDoubleSlider.h"

//______________________________________________________________________________
// TEveTrackEditor
//
// Editor for TEveTrack class.

ClassImp(TEveTrackEditor);

//______________________________________________________________________________
TEveTrackEditor::TEveTrackEditor(const TGWindow *p, Int_t width, Int_t height,
                                 UInt_t options, Pixel_t back) :
   TGedFrame(p, width, height, options | kVerticalFrame, back),
   fM(0),
   fRSEditor(0)
{
   // Constructor.

   MakeTitle("TEveTrack");

   TGHorizontalFrame* f = new TGHorizontalFrame(this);

   fRSEditor =  new TGTextButton(f, "Edit Propagator");
   fRSEditor->Connect("Clicked()", "TEveTrackEditor", this, "DoEditPropagator()");
   f->AddFrame(fRSEditor, new TGLayoutHints(kLHintsLeft, 2, 1, 4, 4));

   AddFrame(f, new TGLayoutHints(kLHintsTop, 0,0,2,1));
}

//______________________________________________________________________________
void TEveTrackEditor::SetModel(TObject* obj)
{
   // Set model object.

   fM = dynamic_cast<TEveTrack*>(obj);
}

//______________________________________________________________________________
void TEveTrackEditor::DoEditPropagator()
{
   // Slot for EditPropagator.

   fGedEditor->SetModel(fGedEditor->GetPad(), fM->GetPropagator(), kButton1Down);
}


//______________________________________________________________________________
// TEveTrackListEditor
//
// Editor for TEveTrackList class.

ClassImp(TEveTrackListEditor);

//______________________________________________________________________________
TEveTrackListEditor::TEveTrackListEditor(const TGWindow *p,
                                         Int_t width, Int_t height,
                                         UInt_t options, Pixel_t back) :
   TGedFrame(p, width, height, options | kVerticalFrame, back),

   fTC         (0),
   fPtRange    (0),
   fPRange     (0),
   fRSSubEditor(0)
{
   // Constructor.

   {
      TGHorizontalFrame* f = new TGHorizontalFrame(this);

      fRnrPoints = new TGCheckButton(f, "Draw Marker");
      f->AddFrame(fRnrPoints, new TGLayoutHints(kLHintsLeft, 2,1,0,0));
      fRnrPoints->Connect("Toggled(Bool_t)"," TEveTrackListEditor", this, "DoRnrPoints()");

      fRnrLine  = new TGCheckButton(f, "Draw Line");
      f->AddFrame(fRnrLine, new TGLayoutHints(kLHintsLeft, 1,2,0,0));
      fRnrLine->Connect("Toggled(Bool_t)", "TEveTrackListEditor", this, "DoRnrLine()");

      AddFrame(f, new TGLayoutHints(kLHintsTop, 0,0,2,1));
   }
   {  // --- Selectors
      Int_t labelW = 51;
      Int_t dbW    = 210;

      fPtRange = new TEveGDoubleValuator(this,"Pt rng:", 40, 0);
      fPtRange->SetNELength(6);
      fPtRange->SetLabelWidth(labelW);
      fPtRange->Build();
      fPtRange->GetSlider()->SetWidth(dbW);
      fPtRange->SetLimits(0, 10, TGNumberFormat::kNESRealTwo);
      fPtRange->Connect("ValueSet()",
                        "TEveTrackListEditor", this, "DoPtRange()");
      AddFrame(fPtRange, new TGLayoutHints(kLHintsTop, 1, 1, 4, 1));

      fPRange = new TEveGDoubleValuator(this,"P rng:", 40, 0);
      fPRange->SetNELength(6);
      fPRange->SetLabelWidth(labelW);
      fPRange->Build();
      fPRange->GetSlider()->SetWidth(dbW);
      fPRange->SetLimits(0, 100, TGNumberFormat::kNESRealTwo);
      fPRange->Connect("ValueSet()",
                       "TEveTrackListEditor", this, "DoPRange()");
      AddFrame(fPRange, new TGLayoutHints(kLHintsTop, 1, 1, 4, 1));
   }

   MakeTitle("RenderStyle");
   fRSSubEditor = new TEveTrackPropagatorSubEditor(this);
   fRSSubEditor->Connect("Changed()", "TEveTrackListEditor", this, "Update()");
   AddFrame(fRSSubEditor, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0,0,0,0));
   CreateRefsTab();
}

/******************************************************************************/

//______________________________________________________________________________
void TEveTrackListEditor::CreateRefsTab()
{
   // Create tab for control of path-mark display.

   fRefs = CreateEditorTabSubFrame("Refs");

   TGCompositeFrame *title1 = new TGCompositeFrame(fRefs, 145, 10,
                                                   kHorizontalFrame |
                                                   kLHintsExpandX   |
                                                   kFixedWidth      |
                                                   kOwnBackground);
   title1->AddFrame(new TGLabel(title1, "PathMarks"),
                    new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
   title1->AddFrame(new TGHorizontal3DLine(title1),
                    new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
   fRefs->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));

   // path marks
   fRSSubEditor->CreateRefsContainer(fRefs);
   fRSSubEditor->fPMAtt->SetGedEditor((TGedEditor*)gEve->GetEditor());
   fRSSubEditor->fFVAtt->SetGedEditor((TGedEditor*)gEve->GetEditor());
}

/******************************************************************************/

//______________________________________________________________________________
void TEveTrackListEditor::SetModel(TObject* obj)
{
   // Set model object.

   fTC = dynamic_cast<TEveTrackList*>(obj);
   fRnrLine  ->SetState(fTC->GetRnrLine()   ? kButtonDown : kButtonUp);
   fRnrPoints->SetState(fTC->GetRnrPoints() ? kButtonDown : kButtonUp);

   Float_t llim;
   fPtRange->SetValues(fTC->fMinPt, fTC->fMaxPt);
   llim = TMath::Log10(fTC->fLimPt);
   fPtRange->SetLimits(0, fTC->fLimPt, llim < 2 ? TGNumberFormat::kNESRealTwo : (llim < 3 ? TGNumberFormat::kNESRealOne : TGNumberFormat::kNESInteger));
   fPRange ->SetValues(fTC->fMinP, fTC->fMaxP);
   llim = TMath::Log10(fTC->fLimP);
   fPRange ->SetLimits(0, fTC->fLimP, llim < 2 ? TGNumberFormat::kNESRealTwo : (llim < 3 ? TGNumberFormat::kNESRealOne : TGNumberFormat::kNESInteger));

   fRSSubEditor->SetModel(fTC->GetPropagator());
}

/******************************************************************************/

//______________________________________________________________________________
void TEveTrackListEditor::DoRnrLine()
{
   // Slot for RnrLine.

   fTC->SetRnrLine(fRnrLine->IsOn());
   Update();
}

//______________________________________________________________________________
void TEveTrackListEditor::DoRnrPoints()
{
   // Slot for RnrPoints.

   fTC->SetRnrPoints(fRnrPoints->IsOn());
   Update();
}

/******************************************************************************/

//______________________________________________________________________________
void TEveTrackListEditor::DoPtRange()
{
   // Slot for PtRange.

   fTC->SelectByPt(fPtRange->GetMin(), fPtRange->GetMax());
   Update();
}

//______________________________________________________________________________
void TEveTrackListEditor::DoPRange()
{
   // Slot for PRange.

   fTC->SelectByP(fPRange->GetMin(), fPRange->GetMax());
   Update();
}

 TEveTrackEditor.cxx:1
 TEveTrackEditor.cxx:2
 TEveTrackEditor.cxx:3
 TEveTrackEditor.cxx:4
 TEveTrackEditor.cxx:5
 TEveTrackEditor.cxx:6
 TEveTrackEditor.cxx:7
 TEveTrackEditor.cxx:8
 TEveTrackEditor.cxx:9
 TEveTrackEditor.cxx:10
 TEveTrackEditor.cxx:11
 TEveTrackEditor.cxx:12
 TEveTrackEditor.cxx:13
 TEveTrackEditor.cxx:14
 TEveTrackEditor.cxx:15
 TEveTrackEditor.cxx:16
 TEveTrackEditor.cxx:17
 TEveTrackEditor.cxx:18
 TEveTrackEditor.cxx:19
 TEveTrackEditor.cxx:20
 TEveTrackEditor.cxx:21
 TEveTrackEditor.cxx:22
 TEveTrackEditor.cxx:23
 TEveTrackEditor.cxx:24
 TEveTrackEditor.cxx:25
 TEveTrackEditor.cxx:26
 TEveTrackEditor.cxx:27
 TEveTrackEditor.cxx:28
 TEveTrackEditor.cxx:29
 TEveTrackEditor.cxx:30
 TEveTrackEditor.cxx:31
 TEveTrackEditor.cxx:32
 TEveTrackEditor.cxx:33
 TEveTrackEditor.cxx:34
 TEveTrackEditor.cxx:35
 TEveTrackEditor.cxx:36
 TEveTrackEditor.cxx:37
 TEveTrackEditor.cxx:38
 TEveTrackEditor.cxx:39
 TEveTrackEditor.cxx:40
 TEveTrackEditor.cxx:41
 TEveTrackEditor.cxx:42
 TEveTrackEditor.cxx:43
 TEveTrackEditor.cxx:44
 TEveTrackEditor.cxx:45
 TEveTrackEditor.cxx:46
 TEveTrackEditor.cxx:47
 TEveTrackEditor.cxx:48
 TEveTrackEditor.cxx:49
 TEveTrackEditor.cxx:50
 TEveTrackEditor.cxx:51
 TEveTrackEditor.cxx:52
 TEveTrackEditor.cxx:53
 TEveTrackEditor.cxx:54
 TEveTrackEditor.cxx:55
 TEveTrackEditor.cxx:56
 TEveTrackEditor.cxx:57
 TEveTrackEditor.cxx:58
 TEveTrackEditor.cxx:59
 TEveTrackEditor.cxx:60
 TEveTrackEditor.cxx:61
 TEveTrackEditor.cxx:62
 TEveTrackEditor.cxx:63
 TEveTrackEditor.cxx:64
 TEveTrackEditor.cxx:65
 TEveTrackEditor.cxx:66
 TEveTrackEditor.cxx:67
 TEveTrackEditor.cxx:68
 TEveTrackEditor.cxx:69
 TEveTrackEditor.cxx:70
 TEveTrackEditor.cxx:71
 TEveTrackEditor.cxx:72
 TEveTrackEditor.cxx:73
 TEveTrackEditor.cxx:74
 TEveTrackEditor.cxx:75
 TEveTrackEditor.cxx:76
 TEveTrackEditor.cxx:77
 TEveTrackEditor.cxx:78
 TEveTrackEditor.cxx:79
 TEveTrackEditor.cxx:80
 TEveTrackEditor.cxx:81
 TEveTrackEditor.cxx:82
 TEveTrackEditor.cxx:83
 TEveTrackEditor.cxx:84
 TEveTrackEditor.cxx:85
 TEveTrackEditor.cxx:86
 TEveTrackEditor.cxx:87
 TEveTrackEditor.cxx:88
 TEveTrackEditor.cxx:89
 TEveTrackEditor.cxx:90
 TEveTrackEditor.cxx:91
 TEveTrackEditor.cxx:92
 TEveTrackEditor.cxx:93
 TEveTrackEditor.cxx:94
 TEveTrackEditor.cxx:95
 TEveTrackEditor.cxx:96
 TEveTrackEditor.cxx:97
 TEveTrackEditor.cxx:98
 TEveTrackEditor.cxx:99
 TEveTrackEditor.cxx:100
 TEveTrackEditor.cxx:101
 TEveTrackEditor.cxx:102
 TEveTrackEditor.cxx:103
 TEveTrackEditor.cxx:104
 TEveTrackEditor.cxx:105
 TEveTrackEditor.cxx:106
 TEveTrackEditor.cxx:107
 TEveTrackEditor.cxx:108
 TEveTrackEditor.cxx:109
 TEveTrackEditor.cxx:110
 TEveTrackEditor.cxx:111
 TEveTrackEditor.cxx:112
 TEveTrackEditor.cxx:113
 TEveTrackEditor.cxx:114
 TEveTrackEditor.cxx:115
 TEveTrackEditor.cxx:116
 TEveTrackEditor.cxx:117
 TEveTrackEditor.cxx:118
 TEveTrackEditor.cxx:119
 TEveTrackEditor.cxx:120
 TEveTrackEditor.cxx:121
 TEveTrackEditor.cxx:122
 TEveTrackEditor.cxx:123
 TEveTrackEditor.cxx:124
 TEveTrackEditor.cxx:125
 TEveTrackEditor.cxx:126
 TEveTrackEditor.cxx:127
 TEveTrackEditor.cxx:128
 TEveTrackEditor.cxx:129
 TEveTrackEditor.cxx:130
 TEveTrackEditor.cxx:131
 TEveTrackEditor.cxx:132
 TEveTrackEditor.cxx:133
 TEveTrackEditor.cxx:134
 TEveTrackEditor.cxx:135
 TEveTrackEditor.cxx:136
 TEveTrackEditor.cxx:137
 TEveTrackEditor.cxx:138
 TEveTrackEditor.cxx:139
 TEveTrackEditor.cxx:140
 TEveTrackEditor.cxx:141
 TEveTrackEditor.cxx:142
 TEveTrackEditor.cxx:143
 TEveTrackEditor.cxx:144
 TEveTrackEditor.cxx:145
 TEveTrackEditor.cxx:146
 TEveTrackEditor.cxx:147
 TEveTrackEditor.cxx:148
 TEveTrackEditor.cxx:149
 TEveTrackEditor.cxx:150
 TEveTrackEditor.cxx:151
 TEveTrackEditor.cxx:152
 TEveTrackEditor.cxx:153
 TEveTrackEditor.cxx:154
 TEveTrackEditor.cxx:155
 TEveTrackEditor.cxx:156
 TEveTrackEditor.cxx:157
 TEveTrackEditor.cxx:158
 TEveTrackEditor.cxx:159
 TEveTrackEditor.cxx:160
 TEveTrackEditor.cxx:161
 TEveTrackEditor.cxx:162
 TEveTrackEditor.cxx:163
 TEveTrackEditor.cxx:164
 TEveTrackEditor.cxx:165
 TEveTrackEditor.cxx:166
 TEveTrackEditor.cxx:167
 TEveTrackEditor.cxx:168
 TEveTrackEditor.cxx:169
 TEveTrackEditor.cxx:170
 TEveTrackEditor.cxx:171
 TEveTrackEditor.cxx:172
 TEveTrackEditor.cxx:173
 TEveTrackEditor.cxx:174
 TEveTrackEditor.cxx:175
 TEveTrackEditor.cxx:176
 TEveTrackEditor.cxx:177
 TEveTrackEditor.cxx:178
 TEveTrackEditor.cxx:179
 TEveTrackEditor.cxx:180
 TEveTrackEditor.cxx:181
 TEveTrackEditor.cxx:182
 TEveTrackEditor.cxx:183
 TEveTrackEditor.cxx:184
 TEveTrackEditor.cxx:185
 TEveTrackEditor.cxx:186
 TEveTrackEditor.cxx:187
 TEveTrackEditor.cxx:188
 TEveTrackEditor.cxx:189
 TEveTrackEditor.cxx:190
 TEveTrackEditor.cxx:191
 TEveTrackEditor.cxx:192
 TEveTrackEditor.cxx:193
 TEveTrackEditor.cxx:194
 TEveTrackEditor.cxx:195
 TEveTrackEditor.cxx:196
 TEveTrackEditor.cxx:197
 TEveTrackEditor.cxx:198
 TEveTrackEditor.cxx:199
 TEveTrackEditor.cxx:200
 TEveTrackEditor.cxx:201
 TEveTrackEditor.cxx:202
 TEveTrackEditor.cxx:203
 TEveTrackEditor.cxx:204
 TEveTrackEditor.cxx:205
 TEveTrackEditor.cxx:206
 TEveTrackEditor.cxx:207
 TEveTrackEditor.cxx:208
 TEveTrackEditor.cxx:209
 TEveTrackEditor.cxx:210
 TEveTrackEditor.cxx:211
 TEveTrackEditor.cxx:212
 TEveTrackEditor.cxx:213
 TEveTrackEditor.cxx:214
 TEveTrackEditor.cxx:215
 TEveTrackEditor.cxx:216
 TEveTrackEditor.cxx:217
 TEveTrackEditor.cxx:218
 TEveTrackEditor.cxx:219
 TEveTrackEditor.cxx:220
 TEveTrackEditor.cxx:221
 TEveTrackEditor.cxx:222
 TEveTrackEditor.cxx:223
 TEveTrackEditor.cxx:224
 TEveTrackEditor.cxx:225
 TEveTrackEditor.cxx:226
 TEveTrackEditor.cxx:227
 TEveTrackEditor.cxx:228