28 ClassImp(TSpiderEditor);
58 TSpiderEditor::TSpiderEditor(
const TGWindow* , Int_t , Int_t , UInt_t , Pixel_t )
63 fBgroup =
new TGButtonGroup(
this,2,1,0,0,
"Plot type");
64 fBgroup->SetRadioButtonExclusive(kTRUE);
65 fPolyLines =
new TGRadioButton(fBgroup,
"PolyLine", kPolyLines);
66 fPolyLines->SetToolTipText(
"Set a polyline plot type");
67 fSegment =
new TGRadioButton(fBgroup,
"Segment", kSegment);
68 fSegment->SetToolTipText(
"Set a segment plot type");
69 fBgroup->ChangeOptions(kFitWidth|kChildFrame);
70 AddFrame(fBgroup,
new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 4, 1, 0, 0));
72 TGHorizontalFrame *f1 =
new TGHorizontalFrame(
this);
74 TGLabel *nxLabel =
new TGLabel(f1,
"Nx:");
75 f1->AddFrame(nxLabel,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 1, 1));
76 fSetNx =
new TGNumberEntryField(f1, kNx, 2,
77 TGNumberFormat::kNESInteger,
78 TGNumberFormat::kNEAPositive,
79 TGNumberFormat::kNELLimitMinMax, 0, 99);
80 fSetNx->SetToolTipText(
"Set the X number of plots");
81 fSetNx->Resize(30,20);
82 f1->AddFrame(fSetNx,
new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
84 TGLabel *nyLabel =
new TGLabel(f1,
"Ny:");
85 f1->AddFrame(nyLabel,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 1, 1));
86 fSetNy =
new TGNumberEntryField(f1, kNy, 2,
87 TGNumberFormat::kNESInteger,
88 TGNumberFormat::kNEAPositive,
89 TGNumberFormat::kNELLimitMinMax, 0, 99);
90 fSetNy->SetToolTipText(
"Set the Y number of plots");
91 fSetNy->Resize(30,20);
92 f1->AddFrame(fSetNy,
new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
93 AddFrame(f1,
new TGLayoutHints(kLHintsLeft,1,1,1,1));
97 fDisplayAverage =
new TGCheckButton(
this,
"Average",kAverage);
98 fDisplayAverage->SetToolTipText(
"Display average");
99 AddFrame(fDisplayAverage,
new TGLayoutHints(kLHintsTop, 3, 1, 1, 1));
101 TGHorizontalFrame *f2 =
new TGHorizontalFrame(
this);
103 fAvLineColorSelect =
new TGColorSelect(f2, 0, kAvLineColor);
104 f2->AddFrame(fAvLineColorSelect,
new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
106 fAvLineWidthCombo =
new TGLineWidthComboBox(f2, kAvLineWidth);
107 fAvLineWidthCombo->Resize(91, 20);
108 f2->AddFrame(fAvLineWidthCombo,
new TGLayoutHints(kLHintsLeft, 3, 1, 1, 1));
110 AddFrame(f2,
new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
112 fAvLineStyleCombo =
new TGLineStyleComboBox(
this, kAvLineStyle);
113 fAvLineStyleCombo->Resize(137, 20);
114 AddFrame(fAvLineStyleCombo,
new TGLayoutHints(kLHintsLeft, 3, 1, 1, 1));
116 TGHorizontalFrame *f2b =
new TGHorizontalFrame(
this);
118 fAvFillColorSelect =
new TGColorSelect(f2b, 0, kAvFillColor);
119 f2b->AddFrame(fAvFillColorSelect,
new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
121 fAvFillPatternSelect =
new TGedPatternSelect(f2b, 1, kAvFillStyle);
122 f2b->AddFrame(fAvFillPatternSelect,
new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
124 AddFrame(f2b,
new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
132 TSpiderEditor::~TSpiderEditor()
141 void TSpiderEditor::ConnectSignals2Slots()
143 fDisplayAverage->Connect(
"Toggled(Bool_t)",
"TSpiderEditor",
this,
"DoDisplayAverage(Bool_t)");
144 fSetNx->Connect(
"ReturnPressed()",
"TSpiderEditor",
this,
"DoSetNx()");
145 fSetNy->Connect(
"ReturnPressed()",
"TSpiderEditor",
this,
"DoSetNy()");
146 fBgroup->Connect(
"Clicked(Int_t)",
"TSpiderEditor",
this,
"DoSetPlotType()");
147 fGotoEntry->Connect(
"ReturnPressed()",
"TSpiderEditor",
this,
"DoGotoEntry()");
148 fGotoNext->Connect(
"Clicked()",
"TSpiderEditor",
this,
"DoGotoNext()");
149 fGotoPrevious->Connect(
"Clicked()",
"TSpiderEditor",
this,
"DoGotoPrevious()");
150 fGotoFollowing->Connect(
"Clicked()",
"TSpiderEditor",
this,
"DoGotoFollowing()");
151 fGotoPreceding->Connect(
"Clicked()",
"TSpiderEditor",
this,
"DoGotoPreceding()");
152 fAddVar->Connect(
"ReturnPressed()",
"TSpiderEditor",
this,
"DoAddVar()");
153 fDeleteVar->Connect(
"ReturnPressed()",
"TSpiderEditor",
this,
"DoDeleteVar()");
154 fAvLineStyleCombo->Connect(
"Selected(Int_t)",
"TSpiderEditor",
this,
"DoAvLineStyle(Int_t)");
155 fAvLineWidthCombo->Connect(
"Selected(Int_t)",
"TSpiderEditor",
this,
"DoAvLineWidth(Int_t)");
156 fAvLineColorSelect->Connect(
"ColorSelected(Pixel_t)",
"TSpiderEditor",
this,
"DoAvLineColor(Pixel_t)");
157 fAvFillColorSelect->Connect(
"ColorSelected(Pixel_t)",
"TSpiderEditor",
this,
"DoAvFillColor(Pixel_t)");
158 fAvFillPatternSelect->Connect(
"PatternSelected(Style_t)",
"TSpiderEditor",
this,
"DoAvFillPattern(Style_t)");
166 void TSpiderEditor::MakeBrowse()
168 fBrowse = CreateEditorTabSubFrame(
"Browse");
170 TGHorizontalFrame *title1 =
new TGHorizontalFrame(fBrowse);
171 title1->AddFrame(
new TGLabel(title1,
"Entries"),
172 new TGLayoutHints(kLHintsLeft, 3, 1, 0, 0));
173 title1->AddFrame(
new TGHorizontal3DLine(title1),
174 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
175 fBrowse->AddFrame(title1,
new TGLayoutHints(kLHintsExpandX, 0, 0, 2, 0));
177 TGHorizontalFrame *f3 =
new TGHorizontalFrame(fBrowse);
179 TGLabel *gotoEntryLabel =
new TGLabel(f3,
"Go to:");
180 f3->AddFrame(gotoEntryLabel,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 18, 1, 5));
181 fGotoEntry =
new TGNumberEntryField(f3, kGotoEntry, 0,
182 TGNumberFormat::kNESInteger,
183 TGNumberFormat::kNEANonNegative);
184 fGotoEntry->SetToolTipText(
"Jump to a specified entry");
185 fGotoEntry->Resize(60,20);
186 f3->AddFrame(fGotoEntry,
new TGLayoutHints(kLHintsRight, 1, 1, 1, 1));
188 fBrowse->AddFrame(f3,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
190 TGHorizontalFrame *f2 =
new TGHorizontalFrame(fBrowse);
192 fPicPrevious = gClient->GetPicture(
"first_t.xpm");
193 fGotoPrevious =
new TGPictureButton(f2,fPicPrevious,kPicPrevious);
194 fGotoPrevious->SetToolTipText(
"Jump to the last entries");
195 f2->AddFrame(fGotoPrevious,
new TGLayoutHints(kLHintsCenterX | kLHintsBottom, 1, 1, 1, 1));
197 fPicPreceding = gClient->GetPicture(
"previous_t.xpm");
198 fGotoPreceding =
new TGPictureButton(f2,fPicPreceding,kPicPreceding);
199 fGotoPreceding->SetToolTipText(
"Jump to the last entries");
200 f2->AddFrame(fGotoPreceding,
new TGLayoutHints(kLHintsCenterX | kLHintsBottom, 1, 1, 1, 1));
202 fPicFollowing = gClient->GetPicture(
"next_t.xpm");
203 fGotoFollowing =
new TGPictureButton(f2,fPicFollowing,kPicFollowing);
204 fGotoFollowing->SetToolTipText(
"Jump to the last entries");
205 f2->AddFrame(fGotoFollowing,
new TGLayoutHints(kLHintsCenterX | kLHintsBottom, 1, 1, 1, 1));
207 fPicNext = gClient->GetPicture(
"last_t.xpm");
208 fGotoNext =
new TGPictureButton(f2,fPicNext,kPicNext);
209 fGotoNext->SetToolTipText(
"Jump to the next entries");
210 f2->AddFrame(fGotoNext,
new TGLayoutHints(kLHintsCenterX | kLHintsBottom, 1, 1, 1, 1));
212 fBrowse->AddFrame(f2,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY));
214 TGHorizontalFrame *title2 =
new TGHorizontalFrame(fBrowse);
216 title2->AddFrame(
new TGLabel(title2,
"Variables"),
217 new TGLayoutHints(kLHintsLeft, 3, 1, 0, 0));
218 title2->AddFrame(
new TGHorizontal3DLine(title2),
219 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
220 fBrowse->AddFrame(title2,
new TGLayoutHints(kLHintsExpandX, 0, 0, 2, 0));
222 TGHorizontalFrame *f4 =
new TGHorizontalFrame(fBrowse);
224 TGVerticalFrame *v1 =
new TGVerticalFrame(f4);
226 TGLabel *addVar =
new TGLabel(v1,
"Add:");
227 v1->AddFrame(addVar,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
229 TGLabel *deleteVar =
new TGLabel(v1,
"Delete:");
230 v1->AddFrame(deleteVar,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
232 f4->AddFrame(v1,
new TGLayoutHints(kLHintsLeft | kLHintsTop,5,5,0,0));
234 TGVerticalFrame *v2 =
new TGVerticalFrame(f4);
236 fAddVar =
new TGTextEntry(v2,
new TGTextBuffer(50), kAddVar);
237 fAddVar->Resize(60,20);
238 fAddVar->SetToolTipText(
"Add a variable");
239 v2->AddFrame(fAddVar,
new TGLayoutHints(kLHintsRight | kLHintsTop));
241 fDeleteVar =
new TGTextEntry(v2,
new TGTextBuffer(50), kAddVar);
242 fDeleteVar->Resize(60,20);
243 fDeleteVar->SetToolTipText(
"Delete a variable");
244 v2->AddFrame(fDeleteVar,
new TGLayoutHints(kLHintsRight | kLHintsTop));
246 f4->AddFrame(v2,
new TGLayoutHints(kLHintsLeft | kLHintsTop,5,5,0,0));
248 fBrowse->AddFrame(f4,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
254 void TSpiderEditor::SetModel(TObject* obj)
257 fSpider =
dynamic_cast<TSpider*
>(obj);
258 if (!fSpider)
return;
259 fAvoidSignal = kTRUE;
261 Bool_t av = fSpider->GetDisplayAverage();
262 if(av) fDisplayAverage->SetState(kButtonDown);
263 else fDisplayAverage->SetState(kButtonUp);
265 fSetNx->SetNumber(fSpider->GetNx());
266 fSetNy->SetNumber(fSpider->GetNy());
268 Bool_t seg = fSpider->GetSegmentDisplay();
270 if(seg) fBgroup->SetButton(kSegment,kTRUE);
271 else fBgroup->SetButton(kPolyLines,kTRUE);
273 fGotoEntry->SetNumber(fSpider->GetCurrentEntry());
275 fAddVar->SetText(
"");
276 fDeleteVar->SetText(
"");
278 fAvLineStyleCombo->Select(fSpider->GetAverageLineStyle());
279 fAvLineWidthCombo->Select(fSpider->GetAverageLineWidth());
280 Color_t c = fSpider->GetAverageLineColor();
281 Pixel_t p = TColor::Number2Pixel(c);
282 fAvLineColorSelect->SetColor(p);
283 c = fSpider->GetAverageFillColor();
284 p = TColor::Number2Pixel(c);
285 fAvFillColorSelect->SetColor(p,kFALSE);
286 fAvFillPatternSelect->SetPattern(fSpider->GetAverageFillStyle(),kFALSE);
288 if (fInit) ConnectSignals2Slots();
290 fAvoidSignal = kFALSE;
296 void TSpiderEditor::DoAddVar()
298 if (fAvoidSignal)
return;
300 const char * var = fAddVar->GetText();
301 fSpider->AddVariable(var);
308 void TSpiderEditor::DoAvLineStyle(Int_t a)
310 if (fAvoidSignal)
return;
312 fSpider->SetAverageLineStyle(a);
319 void TSpiderEditor::DoAvLineWidth(Int_t a)
321 if (fAvoidSignal)
return;
323 fSpider->SetAverageLineWidth(a);
330 void TSpiderEditor::DoAvLineColor(Pixel_t a)
332 if (fAvoidSignal)
return;
334 fSpider->SetAverageLineColor(TColor::GetColor(a));
341 void TSpiderEditor::DoAvFillColor(Pixel_t a)
343 if (fAvoidSignal)
return;
345 fSpider->SetAverageFillColor(TColor::GetColor(a));
352 void TSpiderEditor::DoAvFillPattern(Style_t a)
354 if (fAvoidSignal)
return;
356 fSpider->SetAverageFillStyle(a);
363 void TSpiderEditor::DoDeleteVar()
365 if (fAvoidSignal)
return;
367 const char * var = fDeleteVar->GetText();
368 fSpider->DeleteVariable(var);
375 void TSpiderEditor::DoDisplayAverage(Bool_t av)
377 if (fAvoidSignal)
return;
379 fSpider->SetDisplayAverage(av);
386 void TSpiderEditor::DoGotoEntry()
388 if (fAvoidSignal)
return;
389 Long64_t ev = (Long64_t)fGotoEntry->GetNumber();
390 fSpider->GotoEntry(ev);
397 void TSpiderEditor::DoGotoNext()
399 if (fAvoidSignal)
return;
407 void TSpiderEditor::DoGotoPrevious()
409 if (fAvoidSignal)
return;
410 fSpider->GotoPrevious();
417 void TSpiderEditor::DoGotoFollowing()
419 if (fAvoidSignal)
return;
420 fSpider->GotoFollowing();
427 void TSpiderEditor::DoGotoPreceding()
429 if (fAvoidSignal)
return;
430 fSpider->GotoPreceding();
437 void TSpiderEditor::DoSetNx()
439 if (fAvoidSignal)
return;
440 UInt_t nx = (UInt_t)fSetNx->GetNumber();
448 void TSpiderEditor::DoSetNy()
450 if (fAvoidSignal)
return;
451 UInt_t ny = (UInt_t)fSetNy->GetNumber();
459 void TSpiderEditor::DoSetPlotType()
461 if(fSegment->GetState() == kButtonDown) fSpider->SetSegmentDisplay(kTRUE);
462 else fSpider->SetSegmentDisplay(kFALSE);