3 #include "RGBAPaletteEditor.h"
4 #include <Reve/RGBAPalette.h>
5 #include <Reve/RGValuators.h>
7 #include <TVirtualPad.h>
12 #include <TGNumberEntry.h>
13 #include <TGColorSelect.h>
15 #include <TGDoubleSlider.h>
20 RGBAPaletteSubEditor::RGBAPaletteSubEditor(const TGWindow* p) :
35 TGHorizontalFrame* f = new TGHorizontalFrame(this);
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)");
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()");
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()");
53 fMinVal = new RGValuator(this, "MinVal", 200, 0);
54 fMinVal->SetNELength(4);
55 fMinVal->SetLabelWidth(labelW);
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));
62 fMaxVal = new RGValuator(this,"MaxVal", 200, 0);
63 fMaxVal->SetNELength(4);
64 fMaxVal->SetLabelWidth(labelW);
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));
74 /**************************************************************************/
76 void RGBAPaletteSubEditor::SetModel(RGBAPalette* p)
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);
89 /**************************************************************************/
91 void RGBAPaletteSubEditor::Changed()
96 /**************************************************************************/
98 void RGBAPaletteSubEditor::DoMinVal()
100 fM->SetMin((Int_t) fMinVal->GetValue());
101 fMinVal->SetValue(fM->fMinVal);
105 void RGBAPaletteSubEditor::DoMaxVal()
107 fM->SetMax((Int_t) fMaxVal->GetValue());
108 fMaxVal->SetValue(fM->fMaxVal);
113 void RGBAPaletteSubEditor::DoInterpolate()
115 fM->SetInterpolate(fInterpolate->IsOn());
119 void RGBAPaletteSubEditor::DoWrap()
121 fM->SetWrap(fWrap->IsOn());
125 void RGBAPaletteSubEditor::DoDefaultColor(Pixel_t color)
127 fM->SetDefaultColor(color);
131 /**************************************************************************/
132 /**************************************************************************/
133 /**************************************************************************/
134 /**************************************************************************/
136 //______________________________________________________________________
140 ClassImp(RGBAPaletteEditor)
142 RGBAPaletteEditor::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),
148 MakeTitle("RGBAPalette");
150 fSE = new RGBAPaletteSubEditor(this);
151 AddFrame(fSE, new TGLayoutHints(kLHintsTop, 2, 0, 2, 2));
152 fSE->Connect("Changed()", "Reve::RGBAPaletteEditor", this, "Update()");
155 RGBAPaletteEditor::~RGBAPaletteEditor()
158 /**************************************************************************/
160 void RGBAPaletteEditor::SetModel(TObject* obj)
162 fM = dynamic_cast<RGBAPalette*>(obj);