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