3 #include "QuadSetEditor.h"
4 #include <Reve/QuadSet.h>
6 #include <Reve/RGValuators.h>
7 #include <Reve/ZTransEditor.h>
8 #include <Reve/RGBAPaletteEditor.h>
10 #include <TVirtualPad.h>
17 #include <TGNumberEntry.h>
18 #include <TGColorSelect.h>
19 #include <TGDoubleSlider.h>
23 //______________________________________________________________________
27 ClassImp(QuadSetEditor)
29 QuadSetEditor::QuadSetEditor(const TGWindow *p, Int_t width, Int_t height,
30 UInt_t options, Pixel_t back) :
31 TGedFrame(p, width, height, options | kVerticalFrame, back),
35 // Initialize widget pointers to 0
37 MakeTitle("Transformation matrix");
39 fHMTrans = new ZTransSubEditor(this);
40 fHMTrans->Connect("UseTrans()", "Reve::QuadSetEditor", this, "Update()");
41 fHMTrans->Connect("TransChanged()", "Reve::QuadSetEditor", this, "Update()");
42 AddFrame(fHMTrans, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 0, 0, 0));
45 MakeTitle("Palette controls");
47 fPalette = new RGBAPaletteSubEditor(this);
48 fPalette->Connect("Changed", "Reve::QuadSetEditor", this, "Update()");
49 AddFrame(fPalette, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 0, 0, 0));
54 fHistoButtFrame = new TGHorizontalFrame(this);
58 b = new TGTextButton(fHistoButtFrame, "Histo");
59 b->SetToolTipText("Show histogram over full range.");
60 fHistoButtFrame->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
61 b->Connect("Clicked()", "Reve::QuadSetEditor", this, "DoHisto()");
63 b = new TGTextButton(fHistoButtFrame, "Range Histo");
64 b->SetToolTipText("Show histogram over selected range.");
65 fHistoButtFrame->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
66 b->Connect("Clicked()", "Reve::QuadSetEditor", this, "DoRangeHisto()");
68 AddFrame(fHistoButtFrame, new TGLayoutHints(kLHintsExpandX, 2, 0, 0, 0));
71 QuadSetEditor::~QuadSetEditor()
74 /**************************************************************************/
76 void QuadSetEditor::SetModel(TObject* obj)
78 fM = dynamic_cast<QuadSet*>(obj);
80 fHMTrans->SetDataFromTrans(&fM->fHMTrans);
82 if (fM->fValueIsColor || fM->fPalette == 0) {
83 fPalette->UnmapWindow();
85 fPalette->SetModel(fM->fPalette);
86 fPalette->MapWindow();
90 // Set values of widgets
91 // fXYZZ->SetValue(fM->GetXYZZ());
93 if (fM->fHistoButtons)
94 fHistoButtFrame->MapWindow();
96 fHistoButtFrame->UnmapWindow();
99 /**************************************************************************/
101 void QuadSetEditor::DoHisto()
105 min = fM->fPalette->GetLowLimit();
106 max = fM->fPalette->GetHighLimit();
108 fM->ScanMinMaxValues(min, max);
113 void QuadSetEditor::DoRangeHisto()
117 min = fM->fPalette->GetMinVal();
118 max = fM->fPalette->GetMaxVal();
120 fM->ScanMinMaxValues(min, max);
125 void QuadSetEditor::PlotHisto(Int_t min, Int_t max)
127 Int_t nbins = max-min+1;
131 TH1F* h = new TH1F(fM->GetName(), fM->GetTitle(), nbins, min-0.5, max+0.5);
133 h->SetBit(kCanDelete);
134 VoidCPlex::iterator qi(fM->fPlex);
136 h->Fill(((QuadSet::QuadBase*)qi())->fValue);
138 gStyle->SetOptStat(1111111);