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