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