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)", "TSpiderEditor", this, "DoDisplayAverage(bool)");
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 = false;
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;
257 fAvoidSignal = true;
258
259 bool av = fSpider->GetDisplayAverage();
262
265
266 bool seg = fSpider->GetSegmentDisplay();
267
268 if(seg) fBgroup->SetButton(kSegment,true);
269 else fBgroup->SetButton(kPolyLines,true);
270
272
273 fAddVar->SetText("");
274 fDeleteVar->SetText("");
275
285
287
288 fAvoidSignal = false;
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{
460 else fSpider->SetSegmentDisplay(false);
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
short Style_t
Definition RtypesCore.h:89
short Color_t
Definition RtypesCore.h:92
unsigned int UInt_t
Definition RtypesCore.h:46
long long Long64_t
Definition RtypesCore.h:80
#define ClassImp(name)
Definition Rtypes.h:377
@ kButtonDown
Definition TGButton.h:54
@ kButtonUp
Definition TGButton.h:53
#define gClient
Definition TGClient.h:156
@ 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:2320
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:1839
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:445
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:1117
void ChangeOptions(UInt_t options) override
Change composite frame options. Options is an OR of the EFrameTypes.
Definition TGFrame.cxx:1043
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:605
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:385
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
Pixmap_t GetPicture() const
Definition TGPicture.h:54
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:374
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:95
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition TGedFrame.cxx:72
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:869
The TSpider editor class.
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: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
bool GetDisplayAverage() const
Definition TSpider.h:99
void SetDisplayAverage(bool disp)
Display or not the average.
Definition TSpider.cxx:1025
void SetSegmentDisplay(bool seg)
Set the segment display or not.
Definition TSpider.cxx:1380
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 SetAverageFillStyle(Style_t sty)
Set the FillStyle of the average.
Definition TSpider.cxx:1013
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 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
void GotoFollowing()
Go to the next entry.
Definition TSpider.cxx:774
TF1 * f1
Definition legend1.C:11