]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Alieve/TPCSector2DEditor.cxx
Waiting for a tagged version of Root. All the development is in EVE-dev
[u/mrichter/AliRoot.git] / EVE / Alieve / TPCSector2DEditor.cxx
1 // $Header$
2
3 #include "TPCSector2DEditor.h"
4 #include <Alieve/TPCSector2D.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
16 using namespace Reve;
17 using namespace Alieve;
18
19 //______________________________________________________________________
20 // TPCSector2DEditor
21 //
22
23 ClassImp(TPCSector2DEditor)
24
25 TPCSector2DEditor::TPCSector2DEditor(const TGWindow *p, Int_t id,
26                                      Int_t width, Int_t height,
27                                      UInt_t options, Pixel_t back) :
28   TGedFrame(p, id, width, height, options | kVerticalFrame, back),
29   fM(0),
30   fShowMax(0), fAverage(0), fUseTexture(0)
31 {
32   MakeTitle("TPCSector2D");
33
34   fUseTexture = new TGCheckButton(this, "UseTexture");
35   AddFrame(fUseTexture, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
36   fUseTexture->Connect
37     ("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoUseTexture()");
38
39   {
40     TGHorizontalFrame* f = new TGHorizontalFrame(this);
41     fShowMax = new TGCheckButton(f, "ShowMax");
42     f->AddFrame(fShowMax, new TGLayoutHints(kLHintsLeft, 3, 16, 1, 0));
43     fShowMax->Connect("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoShowMax()");
44     fAverage = new TGCheckButton(f, "Average");
45     f->AddFrame(fAverage, new TGLayoutHints(kLHintsLeft, 3, 1, 1, 0));
46     fAverage->Connect("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoAverage()");
47     AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
48   }
49
50   // Register the editor.
51   TClass *cl = TPCSector2DEditor::Class();
52   TGedElement *ge = new TGedElement;
53   ge->fGedFrame = this;
54   ge->fCanvas = 0;
55   cl->GetEditorList()->Add(ge);
56 }
57
58 TPCSector2DEditor::~TPCSector2DEditor()
59 {}
60
61 /**************************************************************************/
62
63 void TPCSector2DEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t )
64 {
65   fModel = 0;
66   fPad   = 0;
67
68   if (!obj || !obj->InheritsFrom(TPCSector2D::Class()) || obj->InheritsFrom(TVirtualPad::Class())) {
69     SetActive(kFALSE);
70     return;
71   }
72
73   fModel = obj;
74   fPad   = pad;
75
76   fM = dynamic_cast<TPCSector2D*>(fModel);
77
78   fShowMax->SetState(fM->fShowMax ? kButtonDown : kButtonUp);
79   SetupAverage();
80
81   fUseTexture->SetState(fM->fUseTexture ? kButtonDown : kButtonUp);
82
83   SetActive();
84 }
85
86 /**************************************************************************/
87
88 void TPCSector2DEditor::DoShowMax()
89 {
90   fM->SetShowMax(fShowMax->IsOn());
91   SetupAverage();
92   Update();
93 }
94
95 void TPCSector2DEditor::DoAverage()
96 {
97   fM->SetAverage(fAverage->IsOn());
98   Update();
99 }
100
101 void TPCSector2DEditor::SetupAverage()
102 {
103   if(fM->fShowMax) {
104     fAverage->SetEnabled(kFALSE);
105   } else {
106     fAverage->SetEnabled(kTRUE);
107     fAverage->SetState(fM->fAverage ? kButtonDown : kButtonUp);
108   }
109 }
110
111 /**************************************************************************/
112
113 void TPCSector2DEditor::DoUseTexture()
114 {
115   fM->fUseTexture = fUseTexture->IsOn();
116   Update();
117 }