]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/Reve/RGBAPaletteEditor.cxx
Fix effc++ warnings.
[u/mrichter/AliRoot.git] / EVE / Reve / RGBAPaletteEditor.cxx
CommitLineData
8373e543 1// $Header$
2
3#include "RGBAPaletteEditor.h"
4#include <Reve/RGBAPalette.h>
5#include <Reve/RGValuators.h>
6
7#include <TVirtualPad.h>
8#include <TColor.h>
9
10#include <TGLabel.h>
11#include <TGButton.h>
12#include <TGNumberEntry.h>
13#include <TGColorSelect.h>
14#include <TGSlider.h>
15#include <TGDoubleSlider.h>
16
17using namespace Reve;
18
19
20RGBAPaletteSubEditor::RGBAPaletteSubEditor(const TGWindow* p) :
3c67f72c 21 TGVerticalFrame(p),
22
23 fM(0),
24 fMinVal(0),
25 fMaxVal(0),
26 fInterpolate(0),
27 fWrap(0),
28 fDefaultColor(0)
8373e543 29{
30 // Create weeds.
31
32 Int_t labelW = 42;
33
34 {
35 TGHorizontalFrame* f = new TGHorizontalFrame(this);
36
37 fDefaultColor = new TGColorSelect(f, 0, -1);
38 f->AddFrame(fDefaultColor, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
39 fDefaultColor->Connect("ColorSelected(Pixel_t)",
40 "Reve::RGBAPaletteSubEditor", this, "DoDefaultColor(Pixel_t)");
41
42 fInterpolate = new TGCheckButton(f, "Interpolate");
43 f->AddFrame(fInterpolate, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
44 fInterpolate->Connect("Toggled(Bool_t)",
45 "Reve::RGBAPaletteSubEditor", this, "DoInterpolate()");
46
47 fWrap = new TGCheckButton(f, "Wrap");
48 f->AddFrame(fWrap, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
49 fWrap->Connect("Toggled(Bool_t)",
50 "Reve::RGBAPaletteSubEditor", this, "DoWrap()");
51 }
52
53 fMinVal = new RGValuator(this, "MinVal", 200, 0);
54 fMinVal->SetNELength(4);
55 fMinVal->SetLabelWidth(labelW);
56 fMinVal->Build();
57 fMinVal->GetSlider()->SetWidth(120);
58 fMinVal->Connect("ValueSet(Double_t)",
59 "Reve::RGBAPaletteSubEditor", this, "DoMinVal()");
60 AddFrame(fMinVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
61
62 fMaxVal = new RGValuator(this,"MaxVal", 200, 0);
63 fMaxVal->SetNELength(4);
64 fMaxVal->SetLabelWidth(labelW);
65 fMaxVal->Build();
66 fMaxVal->GetSlider()->SetWidth(120);
67 fMaxVal->SetLimits(0, 500);
68 fMaxVal->Connect("ValueSet(Double_t)",
69 "Reve::RGBAPaletteSubEditor", this, "DoMaxVal()");
70 AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
71
72}
73
74/**************************************************************************/
75
76void RGBAPaletteSubEditor::SetModel(RGBAPalette* p)
77{
78 fM = p;
79
80 fMinVal->SetValue(fM->fMinVal);
81 fMaxVal->SetValue(fM->fMaxVal);
82 fMaxVal->SetLimits(fM->fLowLimit, fM->fHighLimit);
83 fMinVal->SetLimits(fM->fLowLimit, fM->fHighLimit);
84 fInterpolate->SetState(fM->fInterpolate ? kButtonDown : kButtonUp);
85 fWrap->SetState(fM->fWrap ? kButtonDown : kButtonUp);
86 fDefaultColor->SetColor(TColor::Number2Pixel(fM->GetDefaultColor()), kFALSE);
87}
88
89/**************************************************************************/
90
91void RGBAPaletteSubEditor::Changed()
92{
93 Emit("Changed()");
94}
95
96/**************************************************************************/
97
98void RGBAPaletteSubEditor::DoMinVal()
99{
100 fM->SetMin((Int_t) fMinVal->GetValue());
101 fMinVal->SetValue(fM->fMinVal);
102 Changed();
103}
104
105void RGBAPaletteSubEditor::DoMaxVal()
106{
107 fM->SetMax((Int_t) fMaxVal->GetValue());
108 fMaxVal->SetValue(fM->fMaxVal);
109 Changed();
110}
111
112
113void RGBAPaletteSubEditor::DoInterpolate()
114{
115 fM->SetInterpolate(fInterpolate->IsOn());
116 Changed();
117}
118
119void RGBAPaletteSubEditor::DoWrap()
120{
121 fM->SetWrap(fWrap->IsOn());
122 Changed();
123}
124
125void RGBAPaletteSubEditor::DoDefaultColor(Pixel_t color)
126{
127 fM->SetDefaultColor(color);
128 Changed();
129}
130
131/**************************************************************************/
132/**************************************************************************/
133/**************************************************************************/
134/**************************************************************************/
135
136//______________________________________________________________________
137// RGBAPaletteEditor
138//
139
140ClassImp(RGBAPaletteEditor)
141
142RGBAPaletteEditor::RGBAPaletteEditor(const TGWindow *p, Int_t width, Int_t height,
143 UInt_t options, Pixel_t back) :
144 TGedFrame(p, width, height, options | kVerticalFrame, back),
145 fM (0),
146 fSE(0)
147{
148 MakeTitle("RGBAPalette");
149
150 fSE = new RGBAPaletteSubEditor(this);
151 AddFrame(fSE, new TGLayoutHints(kLHintsTop, 2, 0, 2, 2));
152 fSE->Connect("Changed()", "Reve::RGBAPaletteEditor", this, "Update()");
153}
154
155RGBAPaletteEditor::~RGBAPaletteEditor()
156{}
157
158/**************************************************************************/
159
160void RGBAPaletteEditor::SetModel(TObject* obj)
161{
162 fM = dynamic_cast<RGBAPalette*>(obj);
163 fSE->SetModel(fM);
164}