1 #include "NLTPolygonSetEditor.h"
2 #include <Reve/NLTPolygonSet.h>
7 #include <TGNumberEntry.h>
8 #include <TGColorSelect.h>
9 #include <TGColorDialog.h>
14 ClassImp(NLTPolygonSetEditor)
16 NLTPolygonSetEditor::NLTPolygonSetEditor(const TGWindow *p,
17 Int_t width, Int_t height,
18 UInt_t options, Pixel_t back) :
19 TGedFrame(p, width, height, options | kVerticalFrame, back),
26 MakeTitle("NLTPolygonSet");
28 TGCompositeFrame *f1 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
29 TGLabel *l = new TGLabel(f1, "FillColor:");
30 f1->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 25, 2, 1, 1));
31 fFillColor = new TGColorSelect(f1, 0, -1);
32 fFillColor->Connect("ColorSelected(Pixel_t)", "Reve::NLTPolygonSetEditor", this, "DoFillColor(Pixel_t)");
33 f1->AddFrame(fFillColor, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
34 AddFrame(f1, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
38 TGCompositeFrame *f = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
40 TGLabel *l = new TGLabel(f, "LineColor:");
41 f->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 25, 2, 1, 1));
42 fLineColor = new TGColorSelect(f, 0, -1);
43 fLineColor->Connect("ColorSelected(Pixel_t)", "Reve::NLTPolygonSetEditor", this, "DoLineColor(Pixel_t)");
44 f->AddFrame(fLineColor, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
46 fLineWidth = new TGNumberEntry(f, 0., 6, -1,
47 TGNumberFormat::kNESRealOne, TGNumberFormat::kNEAPositive,
48 TGNumberFormat::kNELLimitMinMax, 0.1, 2000.0);
49 fLineWidth->GetNumberEntry()->SetToolTipText("Line witdth of outline.");
50 fLineWidth->Connect("ValueSet(Long_t)", "Reve::NLTPolygonSetEditor", this, "DoLineWidth()");
51 f->AddFrame(fLineWidth, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
53 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
57 TGHorizontalFrame* f = new TGHorizontalFrame(this);
58 TGLabel *l = new TGLabel(f, "Z Depth:");
59 f->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 24, 2, 1, 1));
60 fZDepth = new TGNumberEntry(f, 0., 6, -1,
61 TGNumberFormat::kNESRealOne, TGNumberFormat::kNEAPositive,
62 TGNumberFormat::kNELLimitMinMax, 0.1, 2000.0);
63 fZDepth->GetNumberEntry()->SetToolTipText("Maximum z-coordinate to which the tracks will be drawn.");
64 f->AddFrame(fZDepth, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
65 fZDepth->Connect("ValueSet(Long_t)", "Reve::NLTPolygonSetEditor", this, "DoZDepth()");
66 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
72 /**************************************************************************/
73 NLTPolygonSetEditor::~NLTPolygonSetEditor()
76 /**************************************************************************/
77 void NLTPolygonSetEditor::DoFillColor(Pixel_t pixel)
79 printf("do fill color \n");
80 fPS->SetFillColor(pixel);
83 /**************************************************************************/
84 void NLTPolygonSetEditor::DoLineWidth()
86 // Double_t lw = fLineWidth->GetNumber();
87 //fPS->SetLineWidth(lw);
88 fPS->fLineWidth = fLineWidth->GetNumber();
92 /**************************************************************************/
93 void NLTPolygonSetEditor::DoLineColor(Pixel_t pixel)
95 fPS->SetLineColor(pixel);
99 /**************************************************************************/
100 void NLTPolygonSetEditor::DoZDepth()
102 fPS->fZDepth = fZDepth->GetNumber();
107 /**************************************************************************/
109 void NLTPolygonSetEditor::SetModel(TObject* obj)
111 fPS = dynamic_cast<NLTPolygonSet*>(obj);
112 fFillColor->SetColor(TColor::Number2Pixel(fPS->GetFillColor()), kFALSE);
113 fLineWidth->SetNumber(fPS->fLineWidth);
114 fLineColor->SetColor(TColor::Number2Pixel(fPS->GetLineColor()), kFALSE);
115 fZDepth->SetNumber(fPS->fZDepth);