]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Alieve/TPCSector2DEditor.cxx
2848d0777c81411f151027b5032da56ed3ae8bb7
[u/mrichter/AliRoot.git] / EVE / Alieve / TPCSector2DEditor.cxx
1 // $Header$
2
3 #include "TPCSector2DEditor.h"
4 #include <Alieve/TPCSector2D.h>
5
6 #include <TGButton.h>
7 #include <TGComboBox.h>
8 #include <TGLabel.h>
9
10 using namespace Reve;
11 using namespace Alieve;
12
13 //______________________________________________________________________
14 // TPCSector2DEditor
15 //
16
17 ClassImp(TPCSector2DEditor)
18
19 TPCSector2DEditor::TPCSector2DEditor(const TGWindow *p,
20                                      Int_t width, Int_t height,
21                                      UInt_t options, Pixel_t back) :
22   TGedFrame(p, width, height, options | kVerticalFrame, back),
23   fM(0),
24   fShowMax(0), fAverage(0), fUseTexture(0), fPickEmpty(0), fPickMode(0)
25 {
26   MakeTitle("TPCSector2D");
27
28   {
29     TGHorizontalFrame* f = new TGHorizontalFrame(this);
30     fShowMax = new TGCheckButton(f, "ShowMax");
31     f->AddFrame(fShowMax, new TGLayoutHints(kLHintsLeft, 3, 16, 1, 0));
32     fShowMax->Connect("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoShowMax()");
33     fAverage = new TGCheckButton(f, "Average");
34     f->AddFrame(fAverage, new TGLayoutHints(kLHintsLeft, 3, 1, 1, 0));
35     fAverage->Connect("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoAverage()");
36     AddFrame(f);
37   }
38   {
39     TGHorizontalFrame* f = new TGHorizontalFrame(this);
40     fUseTexture = new TGCheckButton(f, "UseTexture");
41     f->AddFrame(fUseTexture, new TGLayoutHints(kLHintsTop, 3, 9, 1, 0));
42     fUseTexture->Connect("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoUseTexture()");
43     fPickEmpty = new TGCheckButton(f, "PickEmpty");
44     f->AddFrame(fPickEmpty, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
45     fPickEmpty->Connect("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoPickEmpty()");
46     AddFrame(f);
47   }
48   {
49     TGHorizontalFrame* f = new TGHorizontalFrame(this);
50     TGLabel* lab = new TGLabel(f, "PickMode");
51     f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 10, 1, 2));
52     fPickMode = new TGComboBox(f);
53     fPickMode->AddEntry("Print", 0);
54     fPickMode->AddEntry("1D histo", 1);
55     fPickMode->AddEntry("2D histo", 2);
56     TGListBox* lb = fPickMode->GetListBox();
57     lb->Resize(lb->GetWidth(), 3*18);
58     fPickMode->Resize(80, 20);
59     fPickMode->Connect("Selected(Int_t)", "Alieve::TPCSector2DEditor", this, "DoPickMode(Int_t)");
60     f->AddFrame(fPickMode, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
61     AddFrame(f);
62   }
63 }
64
65 TPCSector2DEditor::~TPCSector2DEditor()
66 {}
67
68 /**************************************************************************/
69
70 void TPCSector2DEditor::SetModel(TObject* obj)
71 {
72   fM = dynamic_cast<TPCSector2D*>(obj);
73
74   fShowMax->SetState(fM->fShowMax ? kButtonDown : kButtonUp);
75   SetupAverage();
76
77   fUseTexture->SetState(fM->fUseTexture ? kButtonDown : kButtonUp);
78   fPickEmpty->SetState(fM->fPickEmpty ? kButtonDown : kButtonUp);
79   fPickMode->Select(fM->fPickMode, kFALSE);
80 }
81
82 /**************************************************************************/
83
84 void TPCSector2DEditor::DoShowMax()
85 {
86   fM->SetShowMax(fShowMax->IsOn());
87   SetupAverage();
88   Update();
89 }
90
91 void TPCSector2DEditor::DoAverage()
92 {
93   fM->SetAverage(fAverage->IsOn());
94   Update();
95 }
96
97 void TPCSector2DEditor::SetupAverage()
98 {
99   if(fM->fShowMax) {
100     fAverage->SetEnabled(kFALSE);
101   } else {
102     fAverage->SetEnabled(kTRUE);
103     fAverage->SetState(fM->fAverage ? kButtonDown : kButtonUp);
104   }
105 }
106
107 /**************************************************************************/
108
109 void TPCSector2DEditor::DoUseTexture()
110 {
111   fM->fUseTexture = fUseTexture->IsOn();
112   Update();
113 }
114
115 void TPCSector2DEditor::DoPickEmpty()
116 {
117   fM->fPickEmpty = fPickEmpty->IsOn();
118   // Update();
119 }
120
121 void TPCSector2DEditor::DoPickMode(Int_t mode)
122 {
123   fM->fPickMode = mode;
124   // Update();
125 }