Removed some comment crap.
[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, Int_t width, Int_t height,
26                                      UInt_t options, Pixel_t back) :
27   TGedFrame(p, id, width, height, options | kVerticalFrame, back)
28 {
29   fM = 0;
30   MakeTitle("TPCSector2D");
31
32   fUseTexture = new TGCheckButton(this, "UseTexture");
33   AddFrame(fUseTexture, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
34   fUseTexture->Connect
35     ("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoUseTexture()");
36
37   {
38     TGHorizontalFrame* f = new TGHorizontalFrame(this);
39     fShowMax = new TGCheckButton(f, "ShowMax");
40     f->AddFrame(fShowMax, new TGLayoutHints(kLHintsLeft, 3, 16, 1, 0));
41     fShowMax->Connect("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoShowMax()");
42     fAverage = new TGCheckButton(f, "Average");
43     f->AddFrame(fAverage, new TGLayoutHints(kLHintsLeft, 3, 1, 1, 0));
44     fAverage->Connect("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoAverage()");
45     AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
46   }
47
48   // Register the editor.
49   TClass *cl = TPCSector2DEditor::Class();
50   TGedElement *ge = new TGedElement;
51   ge->fGedFrame = this;
52   ge->fCanvas = 0;
53   cl->GetEditorList()->Add(ge);
54 }
55
56 TPCSector2DEditor::~TPCSector2DEditor()
57 {}
58
59 /**************************************************************************/
60
61 void TPCSector2DEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t )
62 {
63   fModel = 0;
64   fPad   = 0;
65
66   if (!obj || !obj->InheritsFrom(TPCSector2D::Class()) || obj->InheritsFrom(TVirtualPad::Class())) {
67     SetActive(kFALSE);
68     return;
69   }
70
71   fModel = obj;
72   fPad   = pad;
73
74   fM = dynamic_cast<TPCSector2D*>(fModel);
75
76   fShowMax->SetState(fM->fShowMax ? kButtonDown : kButtonUp);
77   SetupAverage();
78
79   fUseTexture->SetState(fM->fUseTexture ? kButtonDown : kButtonUp);
80
81   SetActive();
82 }
83
84 /**************************************************************************/
85
86 void TPCSector2DEditor::DoShowMax()
87 {
88   fM->SetShowMax(fShowMax->IsOn());
89   SetupAverage();
90   Update();
91 }
92
93 void TPCSector2DEditor::DoAverage()
94 {
95   fM->SetAverage(fAverage->IsOn());
96   Update();
97 }
98
99 void TPCSector2DEditor::SetupAverage()
100 {
101   if(fM->fShowMax) {
102     fAverage->SetEnabled(kFALSE);
103   } else {
104     fAverage->SetEnabled(kTRUE);
105     fAverage->SetState(fM->fAverage ? kButtonDown : kButtonUp);
106   }
107 }
108
109 /**************************************************************************/
110
111 void TPCSector2DEditor::DoUseTexture()
112 {
113   fM->fUseTexture = fUseTexture->IsOn();
114   Update();
115 }