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
26
27/** \class TSpiderEditor
28The TSpider editor class.
29Provides the graphical user interface to the spider plots.
30*/
31
51
52////////////////////////////////////////////////////////////////////////////////
53/// Normal constructor.
54
55TSpiderEditor::TSpiderEditor(const TGWindow* /*p*/, Int_t /*width*/, Int_t /*height*/, UInt_t /*options*/, Pixel_t /*back*/)
56{
57 fPriority = 1;
58 MakeTitle("Spider");
59
60 fBgroup = new TGButtonGroup(this,2,1,0,0, "Plot type");
62 fPolyLines = new TGRadioButton(fBgroup, "PolyLine", kPolyLines);
63 fPolyLines->SetToolTipText("Set a polyline plot type");
64 fSegment = new TGRadioButton(fBgroup, "Segment", kSegment);
65 fSegment->SetToolTipText("Set a segment plot type");
68
70
71 TGLabel *nxLabel = new TGLabel(f1,"Nx:");
72 f1->AddFrame(nxLabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 1, 1));
77 fSetNx->SetToolTipText("Set the X number of plots");
78 fSetNx->Resize(30,20);
79 f1->AddFrame(fSetNx, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
80
81 TGLabel *nyLabel = new TGLabel(f1,"Ny:");
82 f1->AddFrame(nyLabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 1, 1));
87 fSetNy->SetToolTipText("Set the Y number of plots");
88 fSetNy->Resize(30,20);
89 f1->AddFrame(fSetNy, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
90 AddFrame(f1, new TGLayoutHints(kLHintsLeft,1,1,1,1));
91
92 MakeTitle("Average");
93
94 fDisplayAverage = new TGCheckButton(this, "Average",kAverage);
95 fDisplayAverage->SetToolTipText("Display average");
97
99
102
104 fAvLineWidthCombo->Resize(91, 20);
106
107 AddFrame(f2, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
108
110 fAvLineStyleCombo->Resize(137, 20);
112
114
116 f2b->AddFrame(fAvFillColorSelect, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
117
119 f2b->AddFrame(fAvFillPatternSelect, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
120
121 AddFrame(f2b, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
122
123 MakeBrowse();
124}
125
126////////////////////////////////////////////////////////////////////////////////
127/// Destructor of the TSpiderEditor.
128
130{
131 delete fPolyLines;
132 delete fSegment;
133}
134
135////////////////////////////////////////////////////////////////////////////////
136/// Connect signals to slots.
137
139{
140 fDisplayAverage->Connect("Toggled(bool)", "TSpiderEditor", this, "DoDisplayAverage(bool)");
141 fSetNx->Connect("ReturnPressed()", "TSpiderEditor", this, "DoSetNx()");
142 fSetNy->Connect("ReturnPressed()", "TSpiderEditor", this, "DoSetNy()");
143 fBgroup->Connect("Clicked(Int_t)","TSpiderEditor",this,"DoSetPlotType()");
144 fGotoEntry->Connect("ReturnPressed()", "TSpiderEditor", this, "DoGotoEntry()");
145 fGotoNext->Connect("Clicked()","TSpiderEditor",this,"DoGotoNext()");
146 fGotoPrevious->Connect("Clicked()","TSpiderEditor",this,"DoGotoPrevious()");
147 fGotoFollowing->Connect("Clicked()","TSpiderEditor",this,"DoGotoFollowing()");
148 fGotoPreceding->Connect("Clicked()","TSpiderEditor",this,"DoGotoPreceding()");
149 fAddVar->Connect("ReturnPressed()","TSpiderEditor",this,"DoAddVar()");
150 fDeleteVar->Connect("ReturnPressed()","TSpiderEditor",this,"DoDeleteVar()");
151 fAvLineStyleCombo->Connect("Selected(Int_t)", "TSpiderEditor", this, "DoAvLineStyle(Int_t)");
152 fAvLineWidthCombo->Connect("Selected(Int_t)", "TSpiderEditor", this, "DoAvLineWidth(Int_t)");
153 fAvLineColorSelect->Connect("ColorSelected(Pixel_t)", "TSpiderEditor", this, "DoAvLineColor(Pixel_t)");
154 fAvFillColorSelect->Connect("ColorSelected(Pixel_t)", "TSpiderEditor", this, "DoAvFillColor(Pixel_t)");
155 fAvFillPatternSelect->Connect("PatternSelected(Style_t)", "TSpiderEditor", this, "DoAvFillPattern(Style_t)");
156
157 fInit = false;
158}
159
160////////////////////////////////////////////////////////////////////////////////
161/// Make the Browse tab.
162
164{
166
168 title1->AddFrame(new TGLabel(title1, "Entries"),
169 new TGLayoutHints(kLHintsLeft, 3, 1, 0, 0));
170 title1->AddFrame(new TGHorizontal3DLine(title1),
171 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
173
175
176 TGLabel *gotoEntryLabel = new TGLabel(f3,"Go to:");
181 fGotoEntry->SetToolTipText("Jump to a specified entry");
182 fGotoEntry->Resize(60,20);
183 f3->AddFrame(fGotoEntry, new TGLayoutHints(kLHintsRight, 1, 1, 1, 1));
184
186
188
189 fPicPrevious = gClient->GetPicture("first_t.xpm");
191 fGotoPrevious->SetToolTipText("Jump to the last entries");
193
194 fPicPreceding = gClient->GetPicture("previous_t.xpm");
196 fGotoPreceding->SetToolTipText("Jump to the last entries");
198
199 fPicFollowing = gClient->GetPicture("next_t.xpm");
201 fGotoFollowing->SetToolTipText("Jump to the last entries");
203
204 fPicNext = gClient->GetPicture("last_t.xpm");
206 fGotoNext->SetToolTipText("Jump to the next entries");
208
210
212
213 title2->AddFrame(new TGLabel(title2, "Variables"),
214 new TGLayoutHints(kLHintsLeft, 3, 1, 0, 0));
215 title2->AddFrame(new TGHorizontal3DLine(title2),
216 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
218
220
222
223 TGLabel *addVar = new TGLabel(v1,"Add:");
225
226 TGLabel *deleteVar = new TGLabel(v1,"Delete:");
228
229 f4->AddFrame(v1, new TGLayoutHints(kLHintsLeft | kLHintsTop,5,5,0,0));
230
232
233 fAddVar = new TGTextEntry(v2, new TGTextBuffer(50), kAddVar);
234 fAddVar->Resize(60,20);
235 fAddVar->SetToolTipText("Add a variable");
237
239 fDeleteVar->Resize(60,20);
240 fDeleteVar->SetToolTipText("Delete a variable");
242
243 f4->AddFrame(v2, new TGLayoutHints(kLHintsLeft | kLHintsTop,5,5,0,0));
244
246}
247
248////////////////////////////////////////////////////////////////////////////////
249/// Pick up the used spider attributes.
250
289
290////////////////////////////////////////////////////////////////////////////////
291/// Slot to add a variable.
292
294{
295 if (fAvoidSignal) return;
296
297 const char * var = fAddVar->GetText();
298 fSpider->AddVariable(var);
299 Update();
300}
301
302////////////////////////////////////////////////////////////////////////////////
303/// Slot to set the average LineStyle.
304
306{
307 if (fAvoidSignal) return;
308
310 Update();
311}
312
313////////////////////////////////////////////////////////////////////////////////
314/// Slot to set the average LineWidth.
315
317{
318 if (fAvoidSignal) return;
319
321 Update();
322}
323
324////////////////////////////////////////////////////////////////////////////////
325/// Slot to set the average LineColor.
326
334
335////////////////////////////////////////////////////////////////////////////////
336/// Slot to set the average Fill Color.
337
345
346////////////////////////////////////////////////////////////////////////////////
347/// Slot to set the average FillStyle.
348
350{
351 if (fAvoidSignal) return;
352
354 Update();
355}
356
357////////////////////////////////////////////////////////////////////////////////
358/// Slot to delete a variable.
359
361{
362 if (fAvoidSignal) return;
363
364 const char * var = fDeleteVar->GetText();
366 Update();
367}
368
369////////////////////////////////////////////////////////////////////////////////
370/// Slot Connected to the average display.
371
373{
374 if (fAvoidSignal) return;
375
377 Update();
378}
379
380////////////////////////////////////////////////////////////////////////////////
381/// Slot to select an entry by number.
382
384{
385 if (fAvoidSignal) return;
388 Update();
389}
390
391////////////////////////////////////////////////////////////////////////////////
392/// Slot to Go to next entries.
393
395{
396 if (fAvoidSignal) return;
397 fSpider->GotoNext();
398 Update();
399}
400
401////////////////////////////////////////////////////////////////////////////////
402/// Slot to go to previous entries.
403
405{
406 if (fAvoidSignal) return;
408 Update();
409}
410
411////////////////////////////////////////////////////////////////////////////////
412/// Slot to go to next entry.
413
415{
416 if (fAvoidSignal) return;
418 Update();
419}
420
421////////////////////////////////////////////////////////////////////////////////
422/// Slot to go to last entry.
423
425{
426 if (fAvoidSignal) return;
428 Update();
429}
430
431////////////////////////////////////////////////////////////////////////////////
432/// Slot connected to the nx setting.
433
435{
436 if (fAvoidSignal) return;
438 fSpider->SetNx(nx);
439 Update();
440}
441
442////////////////////////////////////////////////////////////////////////////////
443/// Slot connected to the nx setting.
444
446{
447 if (fAvoidSignal) return;
449 fSpider->SetNy(ny);
450 Update();
451}
452
453////////////////////////////////////////////////////////////////////////////////
454/// Slot to set the plot type.
455
@ 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
short Style_t
Style number (short)
Definition RtypesCore.h:96
short Color_t
Color number (short)
Definition RtypesCore.h:99
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
Definition RtypesCore.h:60
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:83
@ kButtonDown
Definition TGButton.h:54
@ kButtonUp
Definition TGButton.h:53
#define gClient
Definition TGClient.h:157
@ kLHintsRight
Definition TGLayout.h:26
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsCenterY
Definition TGLayout.h:28
@ kLHintsCenterX
Definition TGLayout.h:25
@ kLHintsBottom
Definition TGLayout.h:29
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
winID h TVirtualViewer3D TVirtualGLPainter p
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:2445
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:1926
Organizes TGButton widgets in a group.
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:439
virtual EButtonState GetState() const
Definition TGButton.h:112
Selects different options.
Definition TGButton.h:264
void SetState(EButtonState state, Bool_t emit=kFALSE) override
Set check button state.
Like a checkbutton but instead of the check mark there is color area with a little down arrow.
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=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1109
void ChangeOptions(UInt_t options) override
Change composite frame options. Options is an OR of the EFrameTypes.
Definition TGFrame.cxx:1035
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:597
A horizontal 3D line is a line that typically separates a toolbar from the menubar.
Definition TG3DLine.h:18
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:387
This class handles GUI labels.
Definition TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
The TGLineStyleComboBox user callable and it creates a combobox for selecting the line style.
Definition TGComboBox.h:140
The TGLineWidthComboBox user callable and it creates a combobox for selecting the line width.
Definition TGComboBox.h:158
virtual void SetNumber(Double_t val, Bool_t emit=kTRUE)
Set the numeric value (floating point representation).
virtual Double_t GetNumber() const
Get the numeric value (floating point representation).
@ kNEAPositive
Positive number.
@ kNEANonNegative
Non-negative number.
@ kNESInteger
Style of number entry field.
@ kNELLimitMinMax
Both lower and upper limits.
Yield an action as soon as it is clicked.
Definition TGButton.h:228
Selects different options.
Definition TGButton.h:321
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
A TGTextEntry is a one line text input widget.
Definition TGTextEntry.h:24
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.
A composite frame that layout their children in vertical way.
Definition TGFrame.h:376
ROOT GUI Window base class.
Definition TGWindow.h:23
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by 'owner' in extra tab 'name'.
Bool_t fInit
init flag for setting signals/slots
Definition TGedFrame.h:47
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition TGedFrame.cxx:94
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition TGedFrame.cxx:71
Int_t fPriority
location in GedEditor
Definition TGedFrame.h:53
Bool_t fAvoidSignal
flag for executing slots
Definition TGedFrame.h:50
is a button with pattern area with a little down arrow.
void SetPattern(Style_t pattern, Bool_t emit=kTRUE)
Set pattern.
Mother of all ROOT objects.
Definition TObject.h:41
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:865
virtual void DoSetNy()
Slot connected to the nx setting.
TGNumberEntryField * fGotoEntry
Jump to an entry field.
TSpiderEditor(const TGWindow *p=nullptr, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Normal constructor.
TGPictureButton * fGotoNext
Go to next entries button.
void MakeBrowse()
Make the Browse tab.
TGColorSelect * fAvFillColorSelect
fill color widget for the average.
void SetModel(TObject *obj) override
Pick up the used spider attributes.
virtual void DoAvLineStyle(Int_t)
Slot to set the average LineStyle.
virtual void DoGotoFollowing()
Slot to go to next entry.
TGLineWidthComboBox * fAvLineWidthCombo
line width combo box for the average.
TSpider * fSpider
Pointer to the TSpider.
virtual void DoAvFillPattern(Style_t)
Slot to set the average FillStyle.
const TGPicture * fPicNext
Go to next entries picture.
TGCheckButton * fDisplayAverage
Button for the display of the average.
const TGPicture * fPicPreceding
Go to last entry picture.
virtual void DoGotoEntry()
Slot to select an entry by number.
TGNumberEntryField * fSetNy
To set the ny number of subpads.
virtual void DoGotoPreceding()
Slot to go to last entry.
virtual void DoSetNx()
Slot connected to the nx setting.
TGRadioButton * fPolyLines
Polyline option.
virtual void DoAvLineWidth(Int_t)
Slot to set the average LineWidth.
TGCompositeFrame * fBrowse
Browse tab.
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
Group of the plot type selection.
TGRadioButton * fSegment
Segment option.
TGLineStyleComboBox * fAvLineStyleCombo
line style combo box for the average.
const TGPicture * fPicFollowing
Go to next entry picture.
virtual void DoDisplayAverage(bool av)
Slot Connected to the average display.
TGPictureButton * fGotoFollowing
Go to next entry button.
const TGPicture * fPicPrevious
Go to previous entries picture.
TGPictureButton * fGotoPreceding
Go to last entry button.
virtual void DoDeleteVar()
Slot to delete a variable.
TGedPatternSelect * fAvFillPatternSelect
fill pattern widget for the average.
TGColorSelect * fAvLineColorSelect
line color widget for the average.
virtual void DoAvFillColor(Pixel_t)
Slot to set the average Fill Color.
TGPictureButton * fGotoPrevious
Go to previous entries button.
TGTextEntry * fDeleteVar
Delete variable field.
virtual void DoSetPlotType()
Slot to set the plot type.
~TSpiderEditor() override
Destructor of the TSpiderEditor.
TGNumberEntryField * fSetNx
To set the nx number of subpads.
TGTextEntry * fAddVar
Add variable field.
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
bool GetDisplayAverage() const
Definition TSpider.h:99
void SetDisplayAverage(bool disp)
Display or not the average.
Definition TSpider.cxx:1024
void SetSegmentDisplay(bool seg)
Set the segment display or not.
Definition TSpider.cxx:1379
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 SetAverageFillStyle(Style_t sty)
Set the FillStyle of the average.
Definition TSpider.cxx:1012
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 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
void GotoFollowing()
Go to the next entry.
Definition TSpider.cxx:773
TF1 * f1
Definition legend1.C:11