Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TSpiderEditor.cxx
Go to the documentation of this file.
1// @(#)root/treeviewer:$Id$
2// Author: Bastien Dalla Piazza 20/07/07
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "TSpiderEditor.h"
13#include "TSpider.h"
14#include "TGButton.h"
15#include "TGNumberEntry.h"
16#include "TGButtonGroup.h"
17#include "TGLabel.h"
18#include "TGPicture.h"
19#include "TGTextEntry.h"
20#include "TG3DLine.h"
21#include "TGComboBox.h"
22#include "TGColorSelect.h"
23#include "TGedPatternSelect.h"
24#include "TColor.h"
25
27
28/** \class TSpiderEditor
29The TSpider editor class.
30Provides the graphical user interface to the spider plots.
31*/
32
51};
52
53////////////////////////////////////////////////////////////////////////////////
54/// Normal constructor.
55
56TSpiderEditor::TSpiderEditor(const TGWindow* /*p*/, Int_t /*width*/, Int_t /*height*/, UInt_t /*options*/, Pixel_t /*back*/)
57{
58 fPriority = 1;
59 MakeTitle("Spider");
60
61 fBgroup = new TGButtonGroup(this,2,1,0,0, "Plot type");
63 fPolyLines = new TGRadioButton(fBgroup, "PolyLine", kPolyLines);
64 fPolyLines->SetToolTipText("Set a polyline plot type");
65 fSegment = new TGRadioButton(fBgroup, "Segment", kSegment);
66 fSegment->SetToolTipText("Set a segment plot type");
69
71
72 TGLabel *nxLabel = new TGLabel(f1,"Nx:");
73 f1->AddFrame(nxLabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 1, 1));
78 fSetNx->SetToolTipText("Set the X number of plots");
79 fSetNx->Resize(30,20);
80 f1->AddFrame(fSetNx, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
81
82 TGLabel *nyLabel = new TGLabel(f1,"Ny:");
83 f1->AddFrame(nyLabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 1, 1));
88 fSetNy->SetToolTipText("Set the Y number of plots");
89 fSetNy->Resize(30,20);
90 f1->AddFrame(fSetNy, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
91 AddFrame(f1, new TGLayoutHints(kLHintsLeft,1,1,1,1));
92
93 MakeTitle("Average");
94
95 fDisplayAverage = new TGCheckButton(this, "Average",kAverage);
96 fDisplayAverage->SetToolTipText("Display average");
98
100
103
105 fAvLineWidthCombo->Resize(91, 20);
107
108 AddFrame(f2, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
109
111 fAvLineStyleCombo->Resize(137, 20);
113
114 TGHorizontalFrame *f2b = new TGHorizontalFrame(this);
115
118
121
122 AddFrame(f2b, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
123
124 MakeBrowse();
125}
126
127////////////////////////////////////////////////////////////////////////////////
128/// Destructor of the TSpiderEditor.
129
131{
132 delete fPolyLines;
133 delete fSegment;
134}
135
136////////////////////////////////////////////////////////////////////////////////
137/// Connect signals to slots.
138
140{
141 fDisplayAverage->Connect("Toggled(Bool_t)", "TSpiderEditor", this, "DoDisplayAverage(Bool_t)");
142 fSetNx->Connect("ReturnPressed()", "TSpiderEditor", this, "DoSetNx()");
143 fSetNy->Connect("ReturnPressed()", "TSpiderEditor", this, "DoSetNy()");
144 fBgroup->Connect("Clicked(Int_t)","TSpiderEditor",this,"DoSetPlotType()");
145 fGotoEntry->Connect("ReturnPressed()", "TSpiderEditor", this, "DoGotoEntry()");
146 fGotoNext->Connect("Clicked()","TSpiderEditor",this,"DoGotoNext()");
147 fGotoPrevious->Connect("Clicked()","TSpiderEditor",this,"DoGotoPrevious()");
148 fGotoFollowing->Connect("Clicked()","TSpiderEditor",this,"DoGotoFollowing()");
149 fGotoPreceding->Connect("Clicked()","TSpiderEditor",this,"DoGotoPreceding()");
150 fAddVar->Connect("ReturnPressed()","TSpiderEditor",this,"DoAddVar()");
151 fDeleteVar->Connect("ReturnPressed()","TSpiderEditor",this,"DoDeleteVar()");
152 fAvLineStyleCombo->Connect("Selected(Int_t)", "TSpiderEditor", this, "DoAvLineStyle(Int_t)");
153 fAvLineWidthCombo->Connect("Selected(Int_t)", "TSpiderEditor", this, "DoAvLineWidth(Int_t)");
154 fAvLineColorSelect->Connect("ColorSelected(Pixel_t)", "TSpiderEditor", this, "DoAvLineColor(Pixel_t)");
155 fAvFillColorSelect->Connect("ColorSelected(Pixel_t)", "TSpiderEditor", this, "DoAvFillColor(Pixel_t)");
156 fAvFillPatternSelect->Connect("PatternSelected(Style_t)", "TSpiderEditor", this, "DoAvFillPattern(Style_t)");
157
158 fInit = kFALSE;
159}
160
161////////////////////////////////////////////////////////////////////////////////
162/// Make the Browse tab.
163
165{
167
169 title1->AddFrame(new TGLabel(title1, "Entries"),
170 new TGLayoutHints(kLHintsLeft, 3, 1, 0, 0));
171 title1->AddFrame(new TGHorizontal3DLine(title1),
172 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
173 fBrowse->AddFrame(title1, new TGLayoutHints(kLHintsExpandX, 0, 0, 2, 0));
174
176
177 TGLabel *gotoEntryLabel = new TGLabel(f3,"Go to:");
178 f3->AddFrame(gotoEntryLabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 18, 1, 5));
182 fGotoEntry->SetToolTipText("Jump to a specified entry");
183 fGotoEntry->Resize(60,20);
184 f3->AddFrame(fGotoEntry, new TGLayoutHints(kLHintsRight, 1, 1, 1, 1));
185
187
189
190 fPicPrevious = gClient->GetPicture("first_t.xpm");
192 fGotoPrevious->SetToolTipText("Jump to the last entries");
194
195 fPicPreceding = gClient->GetPicture("previous_t.xpm");
197 fGotoPreceding->SetToolTipText("Jump to the last entries");
199
200 fPicFollowing = gClient->GetPicture("next_t.xpm");
202 fGotoFollowing->SetToolTipText("Jump to the last entries");
204
205 fPicNext = gClient->GetPicture("last_t.xpm");
207 fGotoNext->SetToolTipText("Jump to the next entries");
209
211
213
214 title2->AddFrame(new TGLabel(title2, "Variables"),
215 new TGLayoutHints(kLHintsLeft, 3, 1, 0, 0));
216 title2->AddFrame(new TGHorizontal3DLine(title2),
217 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
218 fBrowse->AddFrame(title2, new TGLayoutHints(kLHintsExpandX, 0, 0, 2, 0));
219
221
223
224 TGLabel *addVar = new TGLabel(v1,"Add:");
225 v1->AddFrame(addVar,new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
226
227 TGLabel *deleteVar = new TGLabel(v1,"Delete:");
228 v1->AddFrame(deleteVar,new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
229
230 f4->AddFrame(v1, new TGLayoutHints(kLHintsLeft | kLHintsTop,5,5,0,0));
231
233
234 fAddVar = new TGTextEntry(v2, new TGTextBuffer(50), kAddVar);
235 fAddVar->Resize(60,20);
236 fAddVar->SetToolTipText("Add a variable");
238
240 fDeleteVar->Resize(60,20);
241 fDeleteVar->SetToolTipText("Delete a variable");
243
244 f4->AddFrame(v2, new TGLayoutHints(kLHintsLeft | kLHintsTop,5,5,0,0));
245
247}
248
249////////////////////////////////////////////////////////////////////////////////
250/// Pick up the used spider attributes.
251
253{
254 if (!obj) return;
255 fSpider = dynamic_cast<TSpider*>(obj);
256 if (!fSpider) return;
258
262
265
267
270
272
273 fAddVar->SetText("");
274 fDeleteVar->SetText("");
275
285
287
289}
290
291////////////////////////////////////////////////////////////////////////////////
292/// Slot to add a variable.
293
295{
296 if (fAvoidSignal) return;
297
298 const char * var = fAddVar->GetText();
299 fSpider->AddVariable(var);
300 Update();
301}
302
303////////////////////////////////////////////////////////////////////////////////
304/// Slot to set the average LineStyle.
305
307{
308 if (fAvoidSignal) return;
309
311 Update();
312}
313
314////////////////////////////////////////////////////////////////////////////////
315/// Slot to set the average LineWidth.
316
318{
319 if (fAvoidSignal) return;
320
322 Update();
323}
324
325////////////////////////////////////////////////////////////////////////////////
326/// Slot to set the average LineColor.
327
329{
330 if (fAvoidSignal) return;
331
333 Update();
334}
335
336////////////////////////////////////////////////////////////////////////////////
337/// Slot to set the average Fill Color.
338
340{
341 if (fAvoidSignal) return;
342
344 Update();
345}
346
347////////////////////////////////////////////////////////////////////////////////
348/// Slot to set the average FillStyle.
349
351{
352 if (fAvoidSignal) return;
353
355 Update();
356}
357
358////////////////////////////////////////////////////////////////////////////////
359/// Slot to delete a variable.
360
362{
363 if (fAvoidSignal) return;
364
365 const char * var = fDeleteVar->GetText();
367 Update();
368}
369
370////////////////////////////////////////////////////////////////////////////////
371/// Slot Connected to the average display.
372
374{
375 if (fAvoidSignal) return;
376
378 Update();
379}
380
381////////////////////////////////////////////////////////////////////////////////
382/// Slot to select an entry by number.
383
385{
386 if (fAvoidSignal) return;
388 fSpider->GotoEntry(ev);
389 Update();
390}
391
392////////////////////////////////////////////////////////////////////////////////
393/// Slot to Go to next entries.
394
396{
397 if (fAvoidSignal) return;
398 fSpider->GotoNext();
399 Update();
400}
401
402////////////////////////////////////////////////////////////////////////////////
403/// Slot to go to previous entries.
404
406{
407 if (fAvoidSignal) return;
409 Update();
410}
411
412////////////////////////////////////////////////////////////////////////////////
413/// Slot to go to next entry.
414
416{
417 if (fAvoidSignal) return;
419 Update();
420}
421
422////////////////////////////////////////////////////////////////////////////////
423/// Slot to go to last entry.
424
426{
427 if (fAvoidSignal) return;
429 Update();
430}
431
432////////////////////////////////////////////////////////////////////////////////
433/// Slot connected to the nx setting.
434
436{
437 if (fAvoidSignal) return;
438 UInt_t nx = (UInt_t)fSetNx->GetNumber();
439 fSpider->SetNx(nx);
440 Update();
441}
442
443////////////////////////////////////////////////////////////////////////////////
444/// Slot connected to the nx setting.
445
447{
448 if (fAvoidSignal) return;
449 UInt_t ny = (UInt_t)fSetNy->GetNumber();
450 fSpider->SetNy(ny);
451 Update();
452}
453
454////////////////////////////////////////////////////////////////////////////////
455/// Slot to set the plot type.
456
458{
461 Update();
462}
@ kChildFrame
Definition GuiTypes.h:379
@ kFitWidth
Definition GuiTypes.h:386
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
#define c(i)
Definition RSha256.hxx:101
#define a(i)
Definition RSha256.hxx:99
unsigned int UInt_t
Definition RtypesCore.h:46
const Bool_t kFALSE
Definition RtypesCore.h:92
short Color_t
Definition RtypesCore.h:83
long long Long64_t
Definition RtypesCore.h:73
short Style_t
Definition RtypesCore.h:80
const Bool_t kTRUE
Definition RtypesCore.h:91
#define ClassImp(name)
Definition Rtypes.h:364
@ kButtonDown
Definition TGButton.h:54
@ kButtonUp
Definition TGButton.h:53
#define gClient
Definition TGClient.h:166
@ kLHintsRight
Definition TGLayout.h:33
@ kLHintsLeft
Definition TGLayout.h:31
@ kLHintsCenterY
Definition TGLayout.h:35
@ kLHintsCenterX
Definition TGLayout.h:32
@ kLHintsBottom
Definition TGLayout.h:36
@ kLHintsTop
Definition TGLayout.h:34
@ kLHintsExpandX
Definition TGLayout.h:37
ESpiderWid
@ kAvFillColor
@ kAvLineStyle
@ kAvLineWidth
@ kPicPreceding
@ kSegment
@ kDeleteVar
@ kNx
@ kAddVar
@ kPicNext
@ kAvFillStyle
@ kPolyLines
@ kNy
@ kAvLineColor
@ kPicFollowing
@ kAverage
@ kGotoEntry
@ kPicPrevious
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition TColor.cxx:2016
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition TColor.cxx:1769
virtual void SetRadioButtonExclusive(Bool_t flag=kTRUE)
If enable is kTRUE, this button group will treat radio buttons as mutually exclusive,...
virtual void SetButton(Int_t id, Bool_t down=kTRUE)
Sets the button with id to be on/down, and if this is an exclusive group, all other button in the gro...
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition TGButton.cxx:398
virtual EButtonState GetState() const
Definition TGButton.h:112
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
void SetColor(Pixel_t color, Bool_t emit=kTRUE)
Set color.
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1102
virtual void ChangeOptions(UInt_t options)
Change composite frame options. Options is an OR of the EFrameTypes.
Definition TGFrame.cxx:1028
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition TGFrame.cxx:590
virtual Double_t GetNumber() const
Get the numeric value (floating point representation).
virtual void SetNumber(Double_t val)
Set the numeric value (floating point representation).
Pixmap_t GetPicture() const
Definition TGPicture.h:65
const char * GetText() const
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
virtual void SetText(const char *text, Bool_t emit=kTRUE)
Sets text entry to text, clears the selection and moves the cursor to the end of the line.
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by 'owner' in extra tab 'name'.
Bool_t fInit
Definition TGedFrame.h:54
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition TGedFrame.cxx:96
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition TGedFrame.cxx:73
Int_t fPriority
Definition TGedFrame.h:60
Bool_t fAvoidSignal
Definition TGedFrame.h:57
void SetPattern(Style_t pattern, Bool_t emit=kTRUE)
Set pattern.
Mother of all ROOT objects.
Definition TObject.h:37
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition TQObject.cxx:866
The TSpider editor class.
virtual void DoSetNy()
Slot connected to the nx setting.
TGNumberEntryField * fGotoEntry
TGPictureButton * fGotoNext
TSpiderEditor(const TGWindow *p=0, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Normal constructor.
void MakeBrowse()
Make the Browse tab.
TGColorSelect * fAvFillColorSelect
virtual void DoAvLineStyle(Int_t)
Slot to set the average LineStyle.
virtual void DoDisplayAverage(Bool_t av)
Slot Connected to the average display.
virtual void DoGotoFollowing()
Slot to go to next entry.
TGLineWidthComboBox * fAvLineWidthCombo
TSpider * fSpider
virtual void DoAvFillPattern(Style_t)
Slot to set the average FillStyle.
const TGPicture * fPicNext
TGCheckButton * fDisplayAverage
const TGPicture * fPicPreceding
virtual void DoGotoEntry()
Slot to select an entry by number.
TGNumberEntryField * fSetNy
virtual void DoGotoPreceding()
Slot to go to last entry.
virtual void DoSetNx()
Slot connected to the nx setting.
TGRadioButton * fPolyLines
virtual void DoAvLineWidth(Int_t)
Slot to set the average LineWidth.
TGCompositeFrame * fBrowse
virtual void DoAvLineColor(Pixel_t)
Slot to set the average LineColor.
virtual void DoGotoNext()
Slot to Go to next entries.
virtual void DoGotoPrevious()
Slot to go to previous entries.
virtual void ConnectSignals2Slots()
Connect signals to slots.
TGButtonGroup * fBgroup
TGRadioButton * fSegment
TGLineStyleComboBox * fAvLineStyleCombo
const TGPicture * fPicFollowing
TGPictureButton * fGotoFollowing
const TGPicture * fPicPrevious
TGPictureButton * fGotoPreceding
virtual void DoDeleteVar()
Slot to delete a variable.
TGedPatternSelect * fAvFillPatternSelect
TGColorSelect * fAvLineColorSelect
virtual void DoAvFillColor(Pixel_t)
Slot to set the average Fill Color.
TGPictureButton * fGotoPrevious
TGTextEntry * fDeleteVar
virtual void DoSetPlotType()
Slot to set the plot type.
~TSpiderEditor()
Destructor of the TSpiderEditor.
TGNumberEntryField * fSetNx
TGTextEntry * fAddVar
virtual void SetModel(TObject *obj)
Pick up the used spider attributes.
virtual void DoAddVar()
Slot to add a variable.
Spider class.
Definition TSpider.h:40
void SetAverageLineStyle(Style_t sty)
Set the LineStyle of the average.
Definition TSpider.cxx:965
void SetAverageFillColor(Color_t col)
Set the Fill Color of the average.
Definition TSpider.cxx:1001
void SetNx(UInt_t nx)
Set the X number of sub pads.
Definition TSpider.cxx:1226
Style_t GetAverageLineStyle() const
Get the LineStyle of the average.
Definition TSpider.cxx:617
Int_t GetNy() const
Definition TSpider.h:103
void GotoPrevious()
Go to the previous entries.
Definition TSpider.cxx:764
void AddVariable(const char *varexp)
Add a variable to the plot from its expression.
Definition TSpider.cxx:215
Int_t GetNx() const
Definition TSpider.h:102
void GotoEntry(Long64_t e)
Go to a specified entry.
Definition TSpider.cxx:744
void SetAverageLineColor(Color_t col)
Set the LineColor of the average.
Definition TSpider.cxx:977
void DeleteVariable(const char *varexp)
Delete a variable from its expression.
Definition TSpider.cxx:353
void SetAverageLineWidth(Width_t wid)
Set the LineWidth of the average.
Definition TSpider.cxx:989
Width_t GetAverageLineWidth() const
Get the LineWidth of the average.
Definition TSpider.cxx:637
Color_t GetAverageLineColor() const
Get the LineColor of the average.
Definition TSpider.cxx:627
void SetDisplayAverage(Bool_t disp)
Display or not the average.
Definition TSpider.cxx:1025
void SetAverageFillStyle(Style_t sty)
Set the FillStyle of the average.
Definition TSpider.cxx:1013
void SetSegmentDisplay(Bool_t seg)
Set the segment display or not.
Definition TSpider.cxx:1380
Color_t GetAverageFillColor() const
Get the Fill Color of the average.
Definition TSpider.cxx:647
Long64_t GetCurrentEntry() const
Definition TSpider.h:100
void SetNy(UInt_t ny)
Set the Y number of sub pads.
Definition TSpider.cxx:1303
Bool_t GetSegmentDisplay() const
Definition TSpider.h:104
Style_t GetAverageFillStyle() const
Get the FillStyle of the average.
Definition TSpider.cxx:657
void GotoNext()
Go to the next entries.
Definition TSpider.cxx:754
void GotoPreceding()
Go to the last entry.
Definition TSpider.cxx:784
Bool_t GetDisplayAverage() const
Definition TSpider.h:99
void GotoFollowing()
Go to the next entry.
Definition TSpider.cxx:774
TF1 * f1
Definition legend1.C:11