From a3912979d277c6e4a2d24ac8dc2c552b8db5b750 Mon Sep 17 00:00:00 2001 From: mtadel Date: Fri, 9 Jun 2006 11:28:37 +0000 Subject: [PATCH] Use RGDoubleValuator for range-selection widget. --- EVE/Reve/PointSetArrayEditor.cxx | 25 ++++++++++++++----------- EVE/Reve/PointSetArrayEditor.h | 8 +++++--- EVE/Reve/TrackEditors.cxx | 28 ++++++++++++++-------------- EVE/Reve/TrackEditors.h | 7 ++++++- 4 files changed, 39 insertions(+), 29 deletions(-) diff --git a/EVE/Reve/PointSetArrayEditor.cxx b/EVE/Reve/PointSetArrayEditor.cxx index ee9b1683d9c..33d85d8bc3f 100644 --- a/EVE/Reve/PointSetArrayEditor.cxx +++ b/EVE/Reve/PointSetArrayEditor.cxx @@ -2,6 +2,7 @@ #include "PointSetArrayEditor.h" #include +#include #include #include @@ -27,11 +28,14 @@ PointSetArrayEditor::PointSetArrayEditor(const TGWindow *p, Int_t id, Int_t widt fM = 0; MakeTitle("PointSetArray"); - fSlider = new TGDoubleHSlider(this); - fSlider->Resize(260, 20); - AddFrame(fSlider, new TGLayoutHints(kLHintsLeft, 0, 5)); - fSlider->Connect("PositionChanged()", "Reve::PointSetArrayEditor", - this, "DoScroll()"); + fRange = new RGDoubleValuator(this,"Range", 200, 0); + fRange->SetNELength(6); + //fRange->SetLabelWidth(labelW); + fRange->Build(); + fRange->GetSlider()->SetWidth(224); + fRange->Connect("ValueSet()", + "Reve::PointSetArrayEditor", this, "DoRange()"); + AddFrame(fRange, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1)); // Register the editor. TClass *cl = PointSetArray::Class(); @@ -63,17 +67,16 @@ void PointSetArrayEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t ) printf("FullRange(%f, %f) Selected(%f,%f)\n", fM->GetMin(), fM->GetMax(), fM->GetCurMin(), fM->GetCurMax()); - fSlider->SetRange(fM->GetMin(), fM->GetMax()); - fSlider->SetPosition(fM->GetCurMin(), fM->GetCurMax()); + + fRange->SetLimits(fM->fMin, fM->fMax, TGNumberFormat::kNESRealTwo); + fRange->SetValues(fM->fCurMin, fM->fCurMax); SetActive(); } /**************************************************************************/ -void PointSetArrayEditor::DoScroll() +void PointSetArrayEditor::DoRange() { - Double_t min = fSlider->GetMinPosition(), max = fSlider->GetMaxPosition(); - printf("PointSet range: min=%f max=%f\n", min, max); - fM->SetRange(min, max); + fM->SetRange(fRange->GetMin(), fRange->GetMax()); } diff --git a/EVE/Reve/PointSetArrayEditor.h b/EVE/Reve/PointSetArrayEditor.h index 5aa7de8f565..9fa89421640 100644 --- a/EVE/Reve/PointSetArrayEditor.h +++ b/EVE/Reve/PointSetArrayEditor.h @@ -8,10 +8,12 @@ class TGCheckButton; class TGNumberEntry; class TGColorSelect; -class TGDoubleHSlider; namespace Reve { +class RGValuator; +class RGDoubleValuator; + class PointSetArray; class PointSetArrayEditor : public TGedFrame @@ -19,7 +21,7 @@ class PointSetArrayEditor : public TGedFrame protected: PointSetArray* fM; // fModel dynamic-casted to PointSetArrayEditor - TGDoubleHSlider* fSlider; + Reve::RGDoubleValuator* fRange; public: PointSetArrayEditor(const TGWindow* p, Int_t id, Int_t width = 170, Int_t height = 30, UInt_t options = kChildFrame, Pixel_t back = GetDefaultFrameBackground()); @@ -27,7 +29,7 @@ public: virtual void SetModel(TVirtualPad* pad, TObject* obj, Int_t event); - void DoScroll(); + void DoRange(); ClassDef(PointSetArrayEditor, 1); // Editor for PointSetArray }; // endclass PointSetArrayEditor diff --git a/EVE/Reve/TrackEditors.cxx b/EVE/Reve/TrackEditors.cxx index 37279057df6..e8e7d24e3e4 100644 --- a/EVE/Reve/TrackEditors.cxx +++ b/EVE/Reve/TrackEditors.cxx @@ -3,6 +3,8 @@ #include "TrackEditors.h" #include +#include + #include #include @@ -125,14 +127,14 @@ TrackListEditor::TrackListEditor(const TGWindow *p, Int_t id, Int_t width, Int_t // --- Selectors - TGDoubleHSlider* hs = new TGDoubleHSlider(this); - hs->SetRange(0.1, 10); - hs->SetPosition(0.1, 10); - hs->Resize(260, 20); - AddFrame(hs, new TGLayoutHints(kLHintsLeft, 0, 5)); - hs->Connect("PositionChanged()", "Reve::TrackListEditor", - this, "DoPtScroll()"); - + fPtRange = new RGDoubleValuator(this,"Pt Range", 200, 0); + fPtRange->SetNELength(6); + fPtRange->Build(); + fPtRange->GetSlider()->SetWidth(224); + fPtRange->SetLimits(0.1, 10, TGNumberFormat::kNESRealTwo); + fPtRange->Connect("ValueSet()", + "Reve::TrackListEditor", this, "DoPtRange()"); + AddFrame(fPtRange, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1)); // Register the editor. TClass *cl = TrackList::Class(); @@ -174,6 +176,8 @@ void TrackListEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t ) fFitDaughters->SetState(fTC->GetFitDaughters() ? kButtonDown : kButtonUp); fFitDecay->SetState(fTC->GetFitDecay() ? kButtonDown : kButtonUp); + fPtRange->SetValues(0.1, 10); + SetActive(); } @@ -240,11 +244,7 @@ void TrackListEditor::DoFitDecay() /**************************************************************************/ -void TrackListEditor::DoPtScroll() +void TrackListEditor::DoPtRange() { - TGDoubleHSlider* hs = (TGDoubleHSlider*)gTQSender; - - Double_t min = hs->GetMinPosition(), max = hs->GetMaxPosition(); - printf("Track pt range: min=%f max=%f\n", min, max); - fTC->SelectByPt(min, max); + fTC->SelectByPt(fPtRange->GetMin(), fPtRange->GetMax()); } diff --git a/EVE/Reve/TrackEditors.h b/EVE/Reve/TrackEditors.h index 6e32c1ada9d..9ce6a031351 100644 --- a/EVE/Reve/TrackEditors.h +++ b/EVE/Reve/TrackEditors.h @@ -11,6 +11,9 @@ class TGColorSelect; namespace Reve { +class RGValuator; +class RGDoubleValuator; + class TrackList; class TrackListEditor : public TGedFrame @@ -30,6 +33,8 @@ protected: TGCheckButton* fFitDaughters; TGCheckButton* fFitDecay; + RGDoubleValuator* fPtRange; + public: TrackListEditor(const TGWindow* p, Int_t id, Int_t width = 170, Int_t height = 30, UInt_t options = kChildFrame, Pixel_t back = GetDefaultFrameBackground()); ~TrackListEditor(); @@ -48,7 +53,7 @@ public: void DoFitDaughters(); void DoFitDecay(); - void DoPtScroll(); + void DoPtRange(); ClassDef(TrackListEditor, 1); // Editor for TrackList }; // endclass TrackListEditor -- 2.43.0