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