]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveDet/AliEveTPCSector2DEditor.cxx
Repairing leak in AliEveFMDLoader.
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveTPCSector2DEditor.cxx
1 // $Id$
2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4 /**************************************************************************
5  * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
7  * full copyright notice.                                                 *
8  **************************************************************************/
9
10 #include "AliEveTPCSector2DEditor.h"
11 #include <EveDet/AliEveTPCSector2D.h>
12
13 #include <TGButton.h>
14 #include <TGComboBox.h>
15 #include <TGLabel.h>
16
17
18 //______________________________________________________________________________
19 //
20 // Editor for AliEveTPCSector2D.
21
22 ClassImp(AliEveTPCSector2DEditor)
23
24 AliEveTPCSector2DEditor::AliEveTPCSector2DEditor(const TGWindow *p,
25                                                  Int_t width, Int_t height,
26                                                  UInt_t options, Pixel_t back) :
27   TGedFrame(p, width, height, options | kVerticalFrame, back),
28   fM(0),
29   fShowMax(0), fAverage(0), fUseTexture(0), fPickEmpty(0), fPickMode(0)
30 {
31   // Constructor.
32
33   MakeTitle("AliEveTPCSector2D");
34
35   {
36     TGHorizontalFrame* f = new TGHorizontalFrame(this);
37     fShowMax = new TGCheckButton(f, "ShowMax");
38     f->AddFrame(fShowMax, new TGLayoutHints(kLHintsLeft, 3, 16, 1, 0));
39     fShowMax->Connect("Toggled(Bool_t)","AliEveTPCSector2DEditor", this, "DoShowMax()");
40     fAverage = new TGCheckButton(f, "Average");
41     f->AddFrame(fAverage, new TGLayoutHints(kLHintsLeft, 3, 1, 1, 0));
42     fAverage->Connect("Toggled(Bool_t)","AliEveTPCSector2DEditor", this, "DoAverage()");
43     AddFrame(f);
44   }
45   {
46     TGHorizontalFrame* f = new TGHorizontalFrame(this);
47     fUseTexture = new TGCheckButton(f, "UseTexture");
48     f->AddFrame(fUseTexture, new TGLayoutHints(kLHintsTop, 3, 9, 1, 0));
49     fUseTexture->Connect("Toggled(Bool_t)","AliEveTPCSector2DEditor", this, "DoUseTexture()");
50     fPickEmpty = new TGCheckButton(f, "PickEmpty");
51     f->AddFrame(fPickEmpty, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
52     fPickEmpty->Connect("Toggled(Bool_t)","AliEveTPCSector2DEditor", this, "DoPickEmpty()");
53     AddFrame(f);
54   }
55   {
56     TGHorizontalFrame* f = new TGHorizontalFrame(this);
57     TGLabel* lab = new TGLabel(f, "PickMode");
58     f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 10, 1, 2));
59     fPickMode = new TGComboBox(f);
60     fPickMode->AddEntry("Print", 0);
61     fPickMode->AddEntry("1D histo", 1);
62     fPickMode->AddEntry("2D histo", 2);
63     TGListBox* lb = fPickMode->GetListBox();
64     lb->Resize(lb->GetWidth(), 3*18);
65     fPickMode->Resize(80, 20);
66     fPickMode->Connect("Selected(Int_t)", "AliEveTPCSector2DEditor", this, "DoPickMode(Int_t)");
67     f->AddFrame(fPickMode, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
68     AddFrame(f);
69   }
70 }
71
72 /******************************************************************************/
73
74 void AliEveTPCSector2DEditor::SetModel(TObject* obj)
75 {
76   // Set model object.
77
78   fM = static_cast<AliEveTPCSector2D*>(obj);
79
80   fShowMax->SetState(fM->fShowMax ? kButtonDown : kButtonUp);
81   SetupAverage();
82
83   fUseTexture->SetState(fM->fUseTexture ? kButtonDown : kButtonUp);
84   fPickEmpty->SetState(fM->fPickEmpty ? kButtonDown : kButtonUp);
85   fPickMode->Select(fM->fPickMode, kFALSE);
86 }
87
88 /******************************************************************************/
89
90 void AliEveTPCSector2DEditor::DoShowMax()
91 {
92   // Slot for ShowMax.
93
94   fM->SetShowMax(fShowMax->IsOn());
95   SetupAverage();
96   Update();
97 }
98
99 void AliEveTPCSector2DEditor::DoAverage()
100 {
101   // Slot for Average.
102
103   fM->SetAverage(fAverage->IsOn());
104   Update();
105 }
106
107 void AliEveTPCSector2DEditor::SetupAverage()
108 {
109   // Setup Average button according to mode.
110
111   if (fM->fShowMax) {
112     fAverage->SetEnabled(kFALSE);
113   } else {
114     fAverage->SetEnabled(kTRUE);
115     fAverage->SetState(fM->fAverage ? kButtonDown : kButtonUp);
116   }
117 }
118
119 /******************************************************************************/
120
121 void AliEveTPCSector2DEditor::DoUseTexture()
122 {
123   // Slot for UseTexture.
124
125   fM->fUseTexture = fUseTexture->IsOn();
126   Update();
127 }
128
129 void AliEveTPCSector2DEditor::DoPickEmpty()
130 {
131   // Slot for PickEmpty.
132
133   fM->fPickEmpty = fPickEmpty->IsOn();
134 }
135
136 void AliEveTPCSector2DEditor::DoPickMode(Int_t mode)
137 {
138   // Slot for PickMode.
139
140   fM->fPickMode = mode;
141 }