Logo ROOT  
Reference Guide
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 "TGFrame.h"
15#include "TGButton.h"
16#include "TGNumberEntry.h"
17#include "TGButtonGroup.h"
18#include <Riostream.h>
19#include "TGLabel.h"
20#include "TGPicture.h"
21#include "TGTextEntry.h"
22#include "TG3DLine.h"
23#include "TGComboBox.h"
24#include "TGColorSelect.h"
25#include "TGedPatternSelect.h"
26#include "TColor.h"
27
29
30/** \class TSpiderEditor
31The TSpider editor class.
32Provides the graphical user interface to the spider plots.
33*/
34
53};
54
55////////////////////////////////////////////////////////////////////////////////
56/// Normal constructor.
57
58TSpiderEditor::TSpiderEditor(const TGWindow* /*p*/, Int_t /*width*/, Int_t /*height*/, UInt_t /*options*/, Pixel_t /*back*/)
59{
60 fPriority = 1;
61 MakeTitle("Spider");
62
63 fBgroup = new TGButtonGroup(this,2,1,0,0, "Plot type");
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");
71
73
74 TGLabel *nxLabel = new TGLabel(f1,"Nx:");
75 f1->AddFrame(nxLabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 1, 1));
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));
83
84 TGLabel *nyLabel = new TGLabel(f1,"Ny:");
85 f1->AddFrame(nyLabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 1, 1));
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));
94
95 MakeTitle("Average");
96
97 fDisplayAverage = new TGCheckButton(this, "Average",kAverage);
98 fDisplayAverage->SetToolTipText("Display average");
100
101 TGHorizontalFrame *f2 = new TGHorizontalFrame(this);
102
105
107 fAvLineWidthCombo->Resize(91, 20);
109
110 AddFrame(f2, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
111
113 fAvLineStyleCombo->Resize(137, 20);
115
116 TGHorizontalFrame *f2b = new TGHorizontalFrame(this);
117
120
123
124 AddFrame(f2b, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
125
126 MakeBrowse();
127}
128
129////////////////////////////////////////////////////////////////////////////////
130/// Destructor of the TSpiderEditor.
131
133{
134 delete fPolyLines;
135 delete fSegment;
136}
137
138////////////////////////////////////////////////////////////////////////////////
139/// Connect signals to slots.
140
142{
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)");
159
160 fInit = kFALSE;
161}
162
163////////////////////////////////////////////////////////////////////////////////
164/// Make the Browse tab.
165
167{
169
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));
176
178
179 TGLabel *gotoEntryLabel = new TGLabel(f3,"Go to:");
180 f3->AddFrame(gotoEntryLabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 18, 1, 5));
184 fGotoEntry->SetToolTipText("Jump to a specified entry");
185 fGotoEntry->Resize(60,20);
186 f3->AddFrame(fGotoEntry, new TGLayoutHints(kLHintsRight, 1, 1, 1, 1));
187
189
191
192 fPicPrevious = gClient->GetPicture("first_t.xpm");
194 fGotoPrevious->SetToolTipText("Jump to the last entries");
196
197 fPicPreceding = gClient->GetPicture("previous_t.xpm");
199 fGotoPreceding->SetToolTipText("Jump to the last entries");
201
202 fPicFollowing = gClient->GetPicture("next_t.xpm");
204 fGotoFollowing->SetToolTipText("Jump to the last entries");
206
207 fPicNext = gClient->GetPicture("last_t.xpm");
209 fGotoNext->SetToolTipText("Jump to the next entries");
211
213
215
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));
221
223
225
226 TGLabel *addVar = new TGLabel(v1,"Add:");
227 v1->AddFrame(addVar,new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
228
229 TGLabel *deleteVar = new TGLabel(v1,"Delete:");
230 v1->AddFrame(deleteVar,new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
231
232 f4->AddFrame(v1, new TGLayoutHints(kLHintsLeft | kLHintsTop,5,5,0,0));
233
235
236 fAddVar = new TGTextEntry(v2, new TGTextBuffer(50), kAddVar);
237 fAddVar->Resize(60,20);
238 fAddVar->SetToolTipText("Add a variable");
240
242 fDeleteVar->Resize(60,20);
243 fDeleteVar->SetToolTipText("Delete a variable");
245
246 f4->AddFrame(v2, new TGLayoutHints(kLHintsLeft | kLHintsTop,5,5,0,0));
247
249}
250
251////////////////////////////////////////////////////////////////////////////////
252/// Pick up the used spider attributes.
253
255{
256 if (!obj) return;
257 fSpider = dynamic_cast<TSpider*>(obj);
258 if (!fSpider) return;
260
264
267
269
272
274
275 fAddVar->SetText("");
276 fDeleteVar->SetText("");
277
287
289
291}
292
293////////////////////////////////////////////////////////////////////////////////
294/// Slot to add a variable.
295
297{
298 if (fAvoidSignal) return;
299
300 const char * var = fAddVar->GetText();
301 fSpider->AddVariable(var);
302 Update();
303}
304
305////////////////////////////////////////////////////////////////////////////////
306/// Slot to set the average LineStyle.
307
309{
310 if (fAvoidSignal) return;
311
313 Update();
314}
315
316////////////////////////////////////////////////////////////////////////////////
317/// Slot to set the average LineWidth.
318
320{
321 if (fAvoidSignal) return;
322
324 Update();
325}
326
327////////////////////////////////////////////////////////////////////////////////
328/// Slot to set the average LineColor.
329
331{
332 if (fAvoidSignal) return;
333
335 Update();
336}
337
338////////////////////////////////////////////////////////////////////////////////
339/// Slot to set the average Fill Color.
340
342{
343 if (fAvoidSignal) return;
344
346 Update();
347}
348
349////////////////////////////////////////////////////////////////////////////////
350/// Slot to set the average FillStyle.
351
353{
354 if (fAvoidSignal) return;
355
357 Update();
358}
359
360////////////////////////////////////////////////////////////////////////////////
361/// Slot to delete a variable.
362
364{
365 if (fAvoidSignal) return;
366
367 const char * var = fDeleteVar->GetText();
369 Update();
370}
371
372////////////////////////////////////////////////////////////////////////////////
373/// Slot Connected to the average display.
374
376{
377 if (fAvoidSignal) return;
378
380 Update();
381}
382
383////////////////////////////////////////////////////////////////////////////////
384/// Slot to select an entry by number.
385
387{
388 if (fAvoidSignal) return;
390 fSpider->GotoEntry(ev);
391 Update();
392}
393
394////////////////////////////////////////////////////////////////////////////////
395/// Slot to Go to next entries.
396
398{
399 if (fAvoidSignal) return;
400 fSpider->GotoNext();
401 Update();
402}
403
404////////////////////////////////////////////////////////////////////////////////
405/// Slot to go to previous entries.
406
408{
409 if (fAvoidSignal) return;
411 Update();
412}
413
414////////////////////////////////////////////////////////////////////////////////
415/// Slot to go to next entry.
416
418{
419 if (fAvoidSignal) return;
421 Update();
422}
423
424////////////////////////////////////////////////////////////////////////////////
425/// Slot to go to last entry.
426
428{
429 if (fAvoidSignal) return;
431 Update();
432}
433
434////////////////////////////////////////////////////////////////////////////////
435/// Slot connected to the nx setting.
436
438{
439 if (fAvoidSignal) return;
440 UInt_t nx = (UInt_t)fSetNx->GetNumber();
441 fSpider->SetNx(nx);
442 Update();
443}
444
445////////////////////////////////////////////////////////////////////////////////
446/// Slot connected to the nx setting.
447
449{
450 if (fAvoidSignal) return;
451 UInt_t ny = (UInt_t)fSetNy->GetNumber();
452 fSpider->SetNy(ny);
453 Update();
454}
455
456////////////////////////////////////////////////////////////////////////////////
457/// Slot to set the plot type.
458
460{
463 Update();
464}
@ kChildFrame
Definition: GuiTypes.h:379
@ kFitWidth
Definition: GuiTypes.h:386
ULong_t Pixel_t
Definition: GuiTypes.h:39
#define c(i)
Definition: RSha256.hxx:101
unsigned int UInt_t
Definition: RtypesCore.h:44
const Bool_t kFALSE
Definition: RtypesCore.h:90
short Color_t
Definition: RtypesCore.h:81
long long Long64_t
Definition: RtypesCore.h:71
short Style_t
Definition: RtypesCore.h:78
const Bool_t kTRUE
Definition: RtypesCore.h:89
#define ClassImp(name)
Definition: Rtypes.h:361
@ 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:397
virtual EButtonState GetState() const
Definition: TGButton.h:112
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1202
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...
Definition: TGComboBox.cxx:451
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1101
virtual void ChangeOptions(UInt_t options)
Change composite frame options. Options is an OR of the EFrameTypes.
Definition: TGFrame.cxx:1027
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:589
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).
const char * GetText() const
Definition: TGTextEntry.h:134
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'.
Definition: TGedFrame.cxx:123
Bool_t fInit
Definition: TGedFrame.h:53
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:59
Bool_t fAvoidSignal
Definition: TGedFrame.h:56
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.
Definition: TSpiderEditor.h:39
virtual void DoSetNy()
Slot connected to the nx setting.
TGNumberEntryField * fGotoEntry
Definition: TSpiderEditor.h:54
TGPictureButton * fGotoNext
Definition: TSpiderEditor.h:55
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
Definition: TSpiderEditor.h:46
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
Definition: TSpiderEditor.h:44
TSpider * fSpider
Definition: TSpiderEditor.h:41
virtual void DoAvFillPattern(Style_t)
Slot to set the average FillStyle.
const TGPicture * fPicNext
Definition: TSpiderEditor.h:56
TGCheckButton * fDisplayAverage
Definition: TSpiderEditor.h:42
const TGPicture * fPicPreceding
Definition: TSpiderEditor.h:62
virtual void DoGotoEntry()
Slot to select an entry by number.
TGNumberEntryField * fSetNy
Definition: TSpiderEditor.h:49
virtual void DoGotoPreceding()
Slot to go to last entry.
virtual void DoSetNx()
Slot connected to the nx setting.
TGRadioButton * fPolyLines
Definition: TSpiderEditor.h:51
virtual void DoAvLineWidth(Int_t)
Slot to set the average LineWidth.
TGCompositeFrame * fBrowse
Definition: TSpiderEditor.h:53
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
Definition: TSpiderEditor.h:50
TGRadioButton * fSegment
Definition: TSpiderEditor.h:52
TGLineStyleComboBox * fAvLineStyleCombo
Definition: TSpiderEditor.h:43
const TGPicture * fPicFollowing
Definition: TSpiderEditor.h:60
TGPictureButton * fGotoFollowing
Definition: TSpiderEditor.h:59
const TGPicture * fPicPrevious
Definition: TSpiderEditor.h:58
TGPictureButton * fGotoPreceding
Definition: TSpiderEditor.h:61
virtual void DoDeleteVar()
Slot to delete a variable.
TGedPatternSelect * fAvFillPatternSelect
Definition: TSpiderEditor.h:47
TGColorSelect * fAvLineColorSelect
Definition: TSpiderEditor.h:45
virtual void DoAvFillColor(Pixel_t)
Slot to set the average Fill Color.
TGPictureButton * fGotoPrevious
Definition: TSpiderEditor.h:57
TGTextEntry * fDeleteVar
Definition: TSpiderEditor.h:64
virtual void DoSetPlotType()
Slot to set the plot type.
~TSpiderEditor()
Destructor of the TSpiderEditor.
TGNumberEntryField * fSetNx
Definition: TSpiderEditor.h:48
TGTextEntry * fAddVar
Definition: TSpiderEditor.h:63
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:964
void SetAverageFillColor(Color_t col)
Set the Fill Color of the average.
Definition: TSpider.cxx:1000
void SetNx(UInt_t nx)
Set the X number of sub pads.
Definition: TSpider.cxx:1225
Style_t GetAverageLineStyle() const
Get the LineStyle of the average.
Definition: TSpider.cxx:616
Int_t GetNy() const
Definition: TSpider.h:103
void GotoPrevious()
Go to the previous entries.
Definition: TSpider.cxx:763
void AddVariable(const char *varexp)
Add a variable to the plot from its expression.
Definition: TSpider.cxx:214
Int_t GetNx() const
Definition: TSpider.h:102
void GotoEntry(Long64_t e)
Go to a specified entry.
Definition: TSpider.cxx:743
void SetAverageLineColor(Color_t col)
Set the LineColor of the average.
Definition: TSpider.cxx:976
void DeleteVariable(const char *varexp)
Delete a variable from its expression.
Definition: TSpider.cxx:352
void SetAverageLineWidth(Width_t wid)
Set the LineWidth of the average.
Definition: TSpider.cxx:988
Width_t GetAverageLineWidth() const
Get the LineWidth of the average.
Definition: TSpider.cxx:636
Color_t GetAverageLineColor() const
Get the LineColor of the average.
Definition: TSpider.cxx:626
void SetDisplayAverage(Bool_t disp)
Display or not the average.
Definition: TSpider.cxx:1024
void SetAverageFillStyle(Style_t sty)
Set the FillStyle of the average.
Definition: TSpider.cxx:1012
void SetSegmentDisplay(Bool_t seg)
Set the segment display or not.
Definition: TSpider.cxx:1379
Color_t GetAverageFillColor() const
Get the Fill Color of the average.
Definition: TSpider.cxx:646
Long64_t GetCurrentEntry() const
Definition: TSpider.h:100
void SetNy(UInt_t ny)
Set the Y number of sub pads.
Definition: TSpider.cxx:1302
Bool_t GetSegmentDisplay() const
Definition: TSpider.h:104
Style_t GetAverageFillStyle() const
Get the FillStyle of the average.
Definition: TSpider.cxx:656
void GotoNext()
Go to the next entries.
Definition: TSpider.cxx:753
void GotoPreceding()
Go to the last entry.
Definition: TSpider.cxx:783
Bool_t GetDisplayAverage() const
Definition: TSpider.h:99
void GotoFollowing()
Go to the next entry.
Definition: TSpider.cxx:773
TF1 * f1
Definition: legend1.C:11
auto * a
Definition: textangle.C:12