ROOT  6.06/09
Reference Guide
TAxisEditor.cxx
Go to the documentation of this file.
1 // @(#)root/ged:$Id$
2 // Author: Ilka Antcheva 11/05/04
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2002, 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 //////////////////////////////////////////////////////////////////////////
13 // //
14 // TAxisEditor //
15 // //
16 // Implements GUI for axis attributes. //
17 // axis color //
18 // ticks parameters: length, setting on both axis sides, //
19 // logarithmic or linear scale along the selected axis, //
20 // primary, secondary and tertiary axis divisions, //
21 // setting more logarithmic labels, //
22 // optimizing labels' position if available //
23 // axis title - a title can be added via the text entry field //
24 // and can be set to be centered or rotated via the corresponding //
25 // check buttons, the title color, offset, font can be set easily //
26 // axis labels - their color, size, offset can be set similarly, //
27 // in addition there is a check box for no exponent choice, //
28 // and another one for setting the same decimal part for all labels // //
29 // //
30 //////////////////////////////////////////////////////////////////////////
31 //Begin_Html
32 /*
33 <img src="gif/TAxisEditor.gif">
34 */
35 //End_Html
36 
37 
38 #include "TAxisEditor.h"
39 #include "TAxis.h"
40 #include "TGedEditor.h"
41 #include "TGColorSelect.h"
42 #include "TGComboBox.h"
43 #include "TGNumberEntry.h"
44 #include "TGTextEntry.h"
45 #include "TGToolTip.h"
46 #include "TGLabel.h"
47 #include "TColor.h"
48 #include "TVirtualPad.h"
49 #include "TStyle.h"
50 
52 
53 enum EAxisWid {
54  kCOL_AXIS,
55  kCOL_TIT,
56  kCOL_LBL,
57  kFONT_TIT,
58  kFONT_LBL,
59  kTITLE,
60  kAXIS_TICKS,
61  kAXIS_DIV1,
62  kAXIS_DIV2,
63  kAXIS_DIV3,
64  kAXIS_OPTIM,
65  kAXIS_LOG,
66  kAXIS_TITSIZE,
67  kAXIS_TITOFFSET,
68  kAXIS_CENTERED,
69  kAXIS_ROTATED,
70  kAXIS_LBLSIZE,
71  kAXIS_LBLOFFSET,
72  kAXIS_TICKSBOTH,
73  kAXIS_LBLLOG,
74  kAXIS_LBLEXP,
75  kAXIS_LBLDIR,
76  kAXIS_LBLSORT,
77  kAXIS_LBLDEC
78 };
79 
80 
81 ////////////////////////////////////////////////////////////////////////////////
82 /// Constructor of axis attribute GUI.
83 
85  Int_t height, UInt_t options, Pixel_t back)
86  : TGedFrame(p, width, height, options | kVerticalFrame, back)
87 {
88  fAxis = 0;
89 
90  MakeTitle("Axis");
91 
93  fAxisColor = new TGColorSelect(f2, 0, kCOL_AXIS);
94  f2->AddFrame(fAxisColor, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
95  fAxisColor->Associate(this);
96  TGLabel *fTicksLabel = new TGLabel(f2, "Ticks:");
97  f2->AddFrame(fTicksLabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 1, 1));
98  fTickLength = new TGNumberEntry(f2, 0.03, 5, kAXIS_TICKS,
102  fTickLength->GetNumberEntry()->SetToolTipText("Set ticks' length");
103  f2->AddFrame(fTickLength, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
104  AddFrame(f2, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
105 
106  TGCompositeFrame *f3 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
107  TGCompositeFrame *f4a = new TGCompositeFrame(f3, 40, 20, kVerticalFrame);
108  f3->AddFrame(f4a, new TGLayoutHints(kLHintsTop, 0, 1, 0, 0));
109  fTicksBoth = new TGCheckButton(f4a, "+-", kAXIS_TICKSBOTH);
110  fTicksBoth->SetToolTipText("Draw ticks on both axis sides");
111  f4a->AddFrame(fTicksBoth, new TGLayoutHints(kLHintsLeft | kLHintsBottom, 3, 1, 1, 0));
112  fLogAxis = new TGCheckButton(f4a, "Log", kAXIS_LOG);
113  fLogAxis->SetToolTipText("Draw logarithmic scale");
114  f4a->AddFrame(fLogAxis, new TGLayoutHints(kLHintsLeft | kLHintsBottom, 3, 1, 0, 0));
115 
116  TGCompositeFrame *f4b = new TGCompositeFrame(f3, 40, 20, kVerticalFrame);
117  f3->AddFrame(f4b, new TGLayoutHints(kLHintsTop, 0, 1, 0, 0));
118  fOptimize = new TGCheckButton(f4b, "Optimize", kAXIS_OPTIM);
120  fOptimize->SetToolTipText("Optimize the number of axis divisions");
121  f4b->AddFrame(fOptimize, new TGLayoutHints(kLHintsTop, 17, 1, 1, 0));
122  fMoreLog = new TGCheckButton(f4b, "MoreLog", kAXIS_LBLLOG);
123  fMoreLog->SetToolTipText("Draw more logarithmic labels");
124  f4b->AddFrame(fMoreLog, new TGLayoutHints(kLHintsLeft, 17, 1, 0, 0));
125 
126  AddFrame(f3, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
127 
128  TGCompositeFrame *f5 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
129  fDiv3 = new TGNumberEntry(f5, 10, 2,kAXIS_DIV1, TGNumberFormat::kNESInteger,
132  fDiv3->GetNumberEntry()->SetToolTipText("Tertiary axis divisions");
133  f5->AddFrame(fDiv3, new TGLayoutHints(kLHintsLeft, 27, 0, 1, 1));
134  fDiv2 = new TGNumberEntry(f5, 5, 2, kAXIS_DIV2, TGNumberFormat::kNESInteger,
137  fDiv2->GetNumberEntry()->SetToolTipText("Secondary axis divisions");
138  f5->AddFrame(fDiv2, new TGLayoutHints(kLHintsLeft, 1, 0, 1, 1));
139  fDiv1 = new TGNumberEntry(f5, 0, 2, kAXIS_DIV3, TGNumberFormat::kNESInteger,
142  fDiv1->GetNumberEntry()->SetToolTipText("Primary axis divisions");
143  f5->AddFrame(fDiv1, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1, 1, 1, 1));
144  AddFrame(f5, new TGLayoutHints(kLHintsLeft, 1, 1, 4, 4));
145  fTicksFlag = 1;
146 
147  MakeTitle("Title");
148 
149  fTitlePrec = 2;
150  fTitle = new TGTextEntry(this, new TGTextBuffer(50), kTITLE);
152  fTitle->SetToolTipText("Enter the axis title string");
153  AddFrame(fTitle, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 1));
154 
155  TGCompositeFrame *f6 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
156  fTitleColor = new TGColorSelect(f6, 0, kCOL_TIT);
157  f6->AddFrame(fTitleColor, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
158  fTitleColor->Associate(this);
159  TGLabel *fSizeLbl1 = new TGLabel(f6, "Size:");
160  f6->AddFrame(fSizeLbl1, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 6, 1, 1, 1));
161  fTitleSize = new TGNumberEntry(f6, 0.05, 5, kAXIS_TITSIZE,
165  fTitleSize->GetNumberEntry()->SetToolTipText("Set title size");
166  f6->AddFrame(fTitleSize, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
167  AddFrame(f6, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
168 
169  fTitleFont = new TGFontTypeComboBox(this, kFONT_TIT);
170  fTitleFont->Resize(137, 20);
171  AddFrame(fTitleFont, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 1));
172 
173  TGCompositeFrame *f7 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
174  fCentered = new TGCheckButton(f7, "Centered", kAXIS_CENTERED);
175  fCentered->SetToolTipText("Center axis title");
176  f7->AddFrame(fCentered, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
177  TGLabel *fOffsetLbl = new TGLabel(f7, "Offset:");
178  f7->AddFrame(fOffsetLbl, new TGLayoutHints(kLHintsLeft, 23, 1, 3, 0));
179  AddFrame(f7, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
180 
181  TGCompositeFrame *f8 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
182  fRotated = new TGCheckButton(f8, "Rotated", kAXIS_ROTATED);
184  fRotated->SetToolTipText("Rotate axis title by 180 degrees");
185  f8->AddFrame(fRotated, new TGLayoutHints(kLHintsTop, 3, 1, 6, 0));
186  fTitleOffset = new TGNumberEntry(f8, 1.00, 6, kAXIS_TITOFFSET,
190  fTitleOffset->GetNumberEntry()->SetToolTipText("Set title offset");
191  f8->AddFrame(fTitleOffset, new TGLayoutHints(kLHintsLeft, 6, 1, 0, 0));
192  AddFrame(f8, new TGLayoutHints(kLHintsTop, 1, 1, 0, 4));
193 
194  MakeTitle("Labels");
195 
196  fLabelPrec = 2;
197  TGCompositeFrame *f9 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
198  fLabelColor = new TGColorSelect(f9, 0, kCOL_LBL);
199  f9->AddFrame(fLabelColor, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
200  fLabelColor->Associate(this);
201  TGLabel *fSizeLbl2 = new TGLabel(f9, "Size:");
202  f9->AddFrame(fSizeLbl2, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 1, 0, 1, 1));
203  fLabelSize = new TGNumberEntry(f9, 0.05, 6, kAXIS_LBLSIZE,
207  fLabelSize->GetNumberEntry()->SetToolTipText("Set labels' size");
208  f9->AddFrame(fLabelSize, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
209  AddFrame(f9, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
210 
211  TGCompositeFrame *f10 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
212  fNoExponent = new TGCheckButton(f10, "NoExp", kAXIS_LBLEXP);
213  fNoExponent->SetToolTipText("Labels drawn without exponent notation");
214  f10->AddFrame(fNoExponent, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 1, 8, 0));
215  fLabelOffset = new TGNumberEntry(f10, 0.005, 6, kAXIS_LBLOFFSET,
219  fLabelOffset->GetNumberEntry()->SetToolTipText("Set labels' offset");
220  f10->AddFrame(fLabelOffset, new TGLayoutHints(kLHintsLeft, 11, 1, 3, 0));
221  AddFrame(f10, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
222 
223  fLabelFont = new TGFontTypeComboBox(this, kFONT_LBL);
224  fLabelFont->Resize(137, 20);
225  AddFrame(fLabelFont, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 0));
226  fLabelFont->Associate(this);
227 
228  fDecimal = new TGCheckButton(this, "Decimal labels' part", kAXIS_LBLDEC);
229  fDecimal->SetToolTipText("Draw the decimal part of labels");
231 }
232 
233 ////////////////////////////////////////////////////////////////////////////////
234 /// Destructor of axis editor.
235 
237 {
238 }
239 
240 ////////////////////////////////////////////////////////////////////////////////
241 /// Connect signals to slots.
242 
244 {
245  fAxisColor->Connect("ColorSelected(Pixel_t)", "TAxisEditor", this, "DoAxisColor(Pixel_t)");
246  fTickLength->Connect("ValueSet(Long_t)", "TAxisEditor", this, "DoTickLength()");
247  (fTickLength->GetNumberEntry())->Connect("ReturnPressed()", "TAxisEditor", this, "DoTickLength()");
248  fTicksBoth->Connect("Toggled(Bool_t)","TAxisEditor",this,"DoTicks()");
249  fOptimize->Connect("Toggled(Bool_t)","TAxisEditor",this,"DoDivisions()");
250  fLogAxis->Connect("Toggled(Bool_t)","TAxisEditor",this,"DoLogAxis()");
251  fMoreLog->Connect("Toggled(Bool_t)","TAxisEditor",this,"DoMoreLog()");
252  fDiv3->Connect("ValueSet(Long_t)", "TAxisEditor", this, "DoDivisions()");
253  (fDiv3->GetNumberEntry())->Connect("ReturnPressed()", "TAxisEditor", this, "DoDivisions()");
254  fDiv2->Connect("ValueSet(Long_t)", "TAxisEditor", this, "DoDivisions()");
255  (fDiv2->GetNumberEntry())->Connect("ReturnPressed()", "TAxisEditor", this, "DoDivisions()");
256  fDiv1->Connect("ValueSet(Long_t)", "TAxisEditor", this, "DoDivisions()");
257  (fDiv1->GetNumberEntry())->Connect("ReturnPressed()", "TAxisEditor", this, "DoDivisions()");
258  fTitle->Connect("TextChanged(const char *)", "TAxisEditor", this, "DoTitle(const char *)");;
259  fTitleColor->Connect("ColorSelected(Pixel_t)", "TAxisEditor", this, "DoTitleColor(Pixel_t)");
260  fTitleSize->Connect("ValueSet(Long_t)", "TAxisEditor", this, "DoTitleSize()");
261  (fTitleSize->GetNumberEntry())->Connect("ReturnPressed()", "TAxisEditor", this, "DoTitleSize()");
262  fTitleFont->Connect("Selected(Int_t)", "TAxisEditor", this, "DoTitleFont(Int_t)");
263  fCentered->Connect("Toggled(Bool_t)","TAxisEditor",this, "DoTitleCentered()");
264  fRotated->Connect("Toggled(Bool_t)","TAxisEditor",this,"DoTitleRotated()");
265  fTitleOffset->Connect("ValueSet(Long_t)","TAxisEditor",this,"DoTitleOffset()");
266  (fTitleOffset->GetNumberEntry())->Connect("ReturnPressed()","TAxisEditor",this,"DoTitleOffset()");
267  fLabelColor->Connect("ColorSelected(Pixel_t)", "TAxisEditor", this, "DoLabelColor(Pixel_t)");
268  fLabelSize->Connect("ValueSet(Long_t)","TAxisEditor",this,"DoLabelSize()");
269  (fLabelSize->GetNumberEntry())->Connect("ReturnPressed()","TAxisEditor",this,"DoLabelSize()");
270  fNoExponent->Connect("Toggled(Bool_t)","TAxisEditor",this,"DoNoExponent()");
271  fDecimal->Connect("Toggled(Bool_t)","TAxisEditor",this,"DoDecimal(Bool_t)");
272  fLabelOffset->Connect("ValueSet(Long_t)", "TAxisEditor", this, "DoLabelOffset()");
273  (fLabelOffset->GetNumberEntry())->Connect("ReturnPressed()", "TAxisEditor", this, "DoLabelOffset()");
274  fLabelFont->Connect("Selected(Int_t)", "TAxisEditor", this, "DoLabelFont(Int_t)");
275  fInit = kFALSE;
276 }
277 
278 ////////////////////////////////////////////////////////////////////////////////
279 /// Pick up the used values of axis attributes.
280 
282 {
283  fAxis = (TAxis *)obj;
285 
288  fAxisColor->SetColor(p);
289 
290  Float_t fl = fAxis->GetTickLength();
291  fTickLength->SetNumber(fl);
292 
293  Int_t div = fAxis->GetNdivisions();
294  fDiv1->SetNumber(div % 100);
295  fDiv2->SetNumber((div/100) % 100);
296  fDiv3->SetNumber((div/10000) % 100);
297 
298 
299  if ((!strcmp(fAxis->GetName(),"xaxis") && fGedEditor->GetPad()->GetLogx()) ||
300  (!strcmp(fAxis->GetName(),"yaxis") && fGedEditor->GetPad()->GetLogy()) ||
301  (!strcmp(fAxis->GetName(),"zaxis") && fGedEditor->GetPad()->GetLogz()))
302 
304  else fLogAxis->SetState(kButtonUp);
305 
306  if (fLogAxis->GetState() == kButtonUp) {
308  } else {
309  Int_t morelog = fAxis->GetMoreLogLabels();
310  if (morelog) fMoreLog->SetState(kButtonDown);
311  else fMoreLog->SetState(kButtonUp);
312  }
313 
314  const char *both = fAxis->GetTicks();
315  if (!strcmp(both,"+-")) {
317  } else {
319  if (!strcmp(both,"-")) fTicksFlag = -1;
320  if (!strcmp(both,"+")) fTicksFlag = 1;
321  }
322 
323  const char *text = fAxis->GetTitle();
324  fTitle->SetText(text);
325 
326  c = fAxis->GetTitleColor();
327  p = TColor::Number2Pixel(c);
328  fTitleColor->SetColor(p);
329 
330  fl = fAxis->GetTitleSize();
331  fTitleSize->SetNumber(fl);
332 
333  Style_t font = fAxis->GetTitleFont();
334  fTitleFont->Select(font / 10);
335  fTitlePrec = (Int_t)(font % 10);
336 
337  fl = fAxis->GetTitleOffset();
338  fTitleOffset->SetNumber(fl);
339 
340  Int_t centered = fAxis->GetCenterTitle();
341  if (centered) fCentered->SetState(kButtonDown);
343 
345  if (rotated) fRotated->SetState(kButtonDown);
346  else fRotated->SetState(kButtonUp);
347 
348  c = fAxis->GetLabelColor();
349  p = TColor::Number2Pixel(c);
350  fLabelColor->SetColor(p);
351 
352  fl = fAxis->GetLabelSize();
353  fLabelSize->SetNumber(fl);
354 
355  font = fAxis->GetLabelFont();
356  fLabelFont->Select(font / 10);
357  fLabelPrec = (Int_t)(font % 10);
358 
359  fl = fAxis->GetLabelOffset();
360  fLabelOffset->SetNumber(fl);
361 
362  Int_t noexp = fAxis->GetNoExponent();
363  if (noexp) fNoExponent->SetState(kButtonDown);
365 
366  Bool_t on = fAxis->GetDecimals();
367  if (on) fDecimal->SetState(kButtonDown);
368  else fDecimal->SetState(kButtonUp);
369 
372 }
373 
374 ////////////////////////////////////////////////////////////////////////////////
375 /// Slot connected to the axis color.
376 
378 {
379  if (fAvoidSignal) return;
381  Update();
382 }
383 
384 ////////////////////////////////////////////////////////////////////////////////
385 /// Slot connected to the tick length settings.
386 
388 {
389  if (fAvoidSignal) return;
390  Float_t ticks = fTickLength->GetNumber();
391  fAxis->SetTickLength(ticks);
392  Update();
393  if (fTickLength->GetNumber() < 0) fTicksFlag = -1;
394  else fTicksFlag = 1;
395 }
396 
397 ////////////////////////////////////////////////////////////////////////////////
398 /// Slot connected to the ticks draw settings.
399 
401 {
402  if (fAvoidSignal) return;
403  if (fTicksBoth->GetState() == kButtonDown) {
404  fAxis->SetTicks("+-");
405  } else {
406  if (fTicksFlag == -1) fAxis->SetTicks("-");
407  else fAxis->SetTicks("");
408  }
409  Update();
410 }
411 
412 ////////////////////////////////////////////////////////////////////////////////
413 /// Slot connected to the number of divisions.
414 
416 {
417  // the number of divisions are used 3 number entry widgets
418  if (fAvoidSignal) return;
419  Int_t div = (Int_t)(fDiv1->GetNumber() + fDiv2->GetNumber() * 100
420  + fDiv3->GetNumber() * 10000);
422  Update();
423 }
424 
425 ////////////////////////////////////////////////////////////////////////////////
426 /// Slot for Log scale setting.
427 
429 {
430  if (fAvoidSignal) return;
431 
432  gPad = fGedEditor->GetPad();
433 
434  if (fLogAxis->GetState() == kButtonDown) {
435 
436  if (!strcmp(fAxis->GetName(),"xaxis")) gPad->SetLogx(1);
437  if (!strcmp(fAxis->GetName(),"yaxis")) gPad->SetLogy(1);
438  if (!strcmp(fAxis->GetName(),"zaxis")) gPad->SetLogz(1);
439 
440  Int_t morelog = fAxis->GetMoreLogLabels();
441  if (morelog) fMoreLog->SetState(kButtonDown);
442  else fMoreLog->SetState(kButtonUp);
444 
445  } else if (fLogAxis->GetState() == kButtonUp){
446  if (!strcmp(fAxis->GetName(),"xaxis")) gPad->SetLogx(0);
447  if (!strcmp(fAxis->GetName(),"yaxis")) gPad->SetLogy(0);
448  if (!strcmp(fAxis->GetName(),"zaxis")) gPad->SetLogz(0);
451  }
452  Update();
453 }
454 
455 ////////////////////////////////////////////////////////////////////////////////
456 /// Slot connected to more Log labels flag
457 
459 {
460  if (fAvoidSignal) return;
461  Int_t flag = 0;
462  if (fMoreLog->GetState() == kButtonDown) flag = 1;
463  else if (fMoreLog->GetState() == kButtonUp) flag = 0;
464  fAxis->SetMoreLogLabels(flag);
465  Update();
466 }
467 
468 ////////////////////////////////////////////////////////////////////////////////
469 /// Slot connected to the axis color.
470 
471 void TAxisEditor::DoTitle(const char *text)
472 {
473  if (fAvoidSignal) return;
474  fAxis->SetTitle(text);
475  Update();
476 }
477 
478 ////////////////////////////////////////////////////////////////////////////////
479 /// Slot connected to the title color.
480 
482 {
483  if (fAvoidSignal) return;
485  Update();
486 }
487 
488 ////////////////////////////////////////////////////////////////////////////////
489 /// Slot connected to the title font size.
490 
492 {
493  if (fAvoidSignal) return;
494  Float_t size = fTitleSize->GetNumber();
495  fAxis->SetTitleSize(size);
496  Update();
497 }
498 
499 ////////////////////////////////////////////////////////////////////////////////
500 /// Slot connected to the title font.
501 
503 {
504  if (fAvoidSignal) return;
505  Int_t f = font * 10 + fTitlePrec;
506  fAxis->SetTitleFont(f);
507  Update();
508 }
509 
510 ////////////////////////////////////////////////////////////////////////////////
511 /// Slot connected to the title offset.
512 
514 {
515  if (fAvoidSignal) return;
516  Float_t offset = fTitleOffset->GetNumber();
517  fAxis->SetTitleOffset(offset);
518  Update();
519 }
520 
521 ////////////////////////////////////////////////////////////////////////////////
522 /// Slot connected to centered title option.
523 
525 {
526  if (fAvoidSignal) return;
527  Int_t ctr = fCentered->GetState();
528  fAxis->CenterTitle(ctr);
529  Update();
530 }
531 
532 ////////////////////////////////////////////////////////////////////////////////
533 /// Slot connected to the title rotation.
534 
536 {
537  if (fAvoidSignal) return;
538  Int_t rot = fRotated->GetState();
539  fAxis->RotateTitle(rot);
540  Update();
541 }
542 
543 ////////////////////////////////////////////////////////////////////////////////
544 /// Slot connected to the label color.
545 
547 {
548  if (fAvoidSignal) return;
550  Update();
551 }
552 
553 ////////////////////////////////////////////////////////////////////////////////
554 /// Slot connected to the label size.
555 
557 {
558  if (fAvoidSignal) return;
559  Float_t size = fLabelSize->GetNumber();
560  fAxis->SetLabelSize(size);
561  Update();
562 }
563 
564 ////////////////////////////////////////////////////////////////////////////////
565 /// Slot connected to the label font.
566 
568 {
569  if (fAvoidSignal) return;
570  Int_t f = font * 10 + fLabelPrec;
571  fAxis->SetLabelFont(f);
572  Update();
573 }
574 
575 ////////////////////////////////////////////////////////////////////////////////
576 /// Slot connected to the label offset.
577 
579 {
580  if (fAvoidSignal) return;
581  Float_t offset = fLabelOffset->GetNumber();
582  fAxis->SetLabelOffset(offset);
583  Update();
584 }
585 
586 ////////////////////////////////////////////////////////////////////////////////
587 /// Slot connected to the labels' exponent flag.
588 
590 {
591  if (fAvoidSignal) return;
593  fAxis->SetNoExponent(exp);
594  Update();
595 }
596 
597 ////////////////////////////////////////////////////////////////////////////////
598 /// Slot connected to the decimal part setting.
599 
601 {
602  if (fAvoidSignal) return;
603  fAxis->SetDecimals(on);
604  gStyle->SetStripDecimals(!on);
605  Update();
606  gPad->Modified();
607  gPad->Update();
608 }
609 
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title Offset is a correction factor with respect to the "s...
Definition: TAttAxis.cxx:244
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
virtual Color_t GetAxisColor() const
Definition: TAttAxis.h:51
virtual Color_t GetLabelColor() const
Definition: TAttAxis.h:52
virtual void DoLabelOffset()
Slot connected to the label offset.
virtual void DoTicks()
Slot connected to the ticks draw settings.
virtual Int_t GetLogy() const =0
virtual void DoTickLength()
Slot connected to the tick length settings.
virtual Int_t GetLogz() const =0
virtual void DoMoreLog()
Slot connected to more Log labels flag.
short Style_t
Definition: RtypesCore.h:76
float Float_t
Definition: RtypesCore.h:53
TGCheckButton * fNoExponent
Definition: TAxisEditor.h:64
TGFontTypeComboBox * fTitleFont
Definition: TAxisEditor.h:53
TGNumberEntry * fDiv1
Definition: TAxisEditor.h:44
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
R__EXTERN TStyle * gStyle
Definition: TStyle.h:423
TGCheckButton * fRotated
Definition: TAxisEditor.h:58
virtual void DoTitleCentered()
Slot connected to centered title option.
virtual void SetLabelColor(Color_t color=1, Float_t alpha=1.)
Set color of labels.
Definition: TAttAxis.cxx:155
TGColorSelect * fLabelColor
Definition: TAxisEditor.h:59
void SetColor(Pixel_t color, Bool_t emit=kTRUE)
Set color.
virtual void SetNdivisions(Int_t n=510, Bool_t optim=kTRUE)
Set the number of divisions for this axis.
Definition: TAttAxis.cxx:211
virtual void SetNumber(Double_t val)
virtual void DoTitle(const char *text)
Slot connected to the axis color.
virtual void SetTitleFont(Style_t font=62)
Set the title font.
Definition: TAttAxis.cxx:272
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual TVirtualPad * GetPad() const
Definition: TGedEditor.h:97
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual Color_t GetTitleColor() const
Definition: TAttAxis.h:59
virtual void DoLogAxis()
Slot for Log scale setting.
virtual Style_t GetTitleFont() const
Definition: TAttAxis.h:60
virtual void ConnectSignals2Slots()
Connect signals to slots.
void CenterTitle(Bool_t center=kTRUE)
Center axis title.
Definition: TAxis.h:184
virtual Float_t GetTitleSize() const
Definition: TAttAxis.h:57
virtual void SetModel(TObject *obj)
Pick up the used values of axis attributes.
TGCheckButton * fDecimal
Definition: TAxisEditor.h:65
virtual void SetLabelOffset(Float_t offset=0.005)
Set distance between the axis and the labels The distance is expressed in per cent of the pad width...
Definition: TAttAxis.cxx:175
TGNumberEntry * fTickLength
Definition: TAxisEditor.h:43
virtual void SetLabelFont(Style_t font=62)
Set labels' font.
Definition: TAttAxis.cxx:165
Int_t fLabelPrec
Definition: TAxisEditor.h:61
Bool_t fAvoidSignal
Definition: TGedFrame.h:58
TGNumberEntryField * GetNumberEntry() const
virtual void DoLabelFont(Int_t font)
Slot connected to the label font.
virtual const char * GetTicks() const
Return the ticks option (see SetTicks)
Definition: TAxis.cxx:557
ULong_t Pixel_t
Definition: GuiTypes.h:41
TGCheckButton * fOptimize
Definition: TAxisEditor.h:47
TGNumberEntry * fDiv3
Definition: TAxisEditor.h:46
TGTextEntry * fTitle
Definition: TAxisEditor.h:51
virtual void DoTitleColor(Pixel_t color)
Slot connected to the title color.
virtual Int_t GetLogx() const =0
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition: TGedFrame.cxx:73
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:443
TGCompositeFrame(const TGCompositeFrame &)
TGNumberEntry * fTitleSize
Definition: TAxisEditor.h:55
TGColorSelect * fTitleColor
Definition: TAxisEditor.h:52
TGFontTypeComboBox * fLabelFont
Definition: TAxisEditor.h:60
Int_t fTitlePrec
Definition: TAxisEditor.h:54
virtual Float_t GetTitleOffset() const
Definition: TAttAxis.h:56
short Color_t
Definition: RtypesCore.h:79
virtual void DoLabelSize()
Slot connected to the label size.
TGCheckButton * fMoreLog
Definition: TAxisEditor.h:49
virtual void DoTitleOffset()
Slot connected to the title offset.
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:1135
TGColorSelect * fAxisColor
Definition: TAxisEditor.h:41
Class to manage histogram axis.
Definition: TAxis.h:36
TGCheckButton * fTicksBoth
Definition: TAxisEditor.h:48
virtual EButtonState GetState() const
Definition: TGButton.h:116
virtual void DoDivisions()
Slot connected to the number of divisions.
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:90
unsigned int UInt_t
Definition: RtypesCore.h:42
TGNumberEntry * fTitleOffset
Definition: TAxisEditor.h:56
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:1666
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
const char * GetTitle() const
Returns title of object.
Definition: TAxis.h:133
virtual void DoTitleFont(Int_t font)
Slot connected to the title font.
Bool_t GetDecimals() const
Definition: TAxis.h:121
virtual void SetAxisColor(Color_t color=1, Float_t alpha=1.)
Set color of the line axis and tick marks.
Definition: TAttAxis.cxx:145
void rotated()
Definition: utils.cpp:347
TGNumberEntry * fDiv2
Definition: TAxisEditor.h:45
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels The size is expressed in per cent of the pad width.
Definition: TAttAxis.cxx:186
virtual void DoTitleRotated()
Slot connected to the title rotation.
virtual void SetTitleColor(Color_t color=1)
Set color of axis title.
Definition: TAttAxis.cxx:263
virtual void SetTitleSize(Float_t size=0.04)
Set size of axis title The size is expressed in per cent of the pad width.
Definition: TAttAxis.cxx:254
Bool_t GetNoExponent() const
Definition: TAxis.h:126
virtual ~TAxisEditor()
Destructor of axis editor.
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition: TColor.cxx:1862
void SetNoExponent(Bool_t noExponent=kTRUE)
Set the NoExponent flag By default, an exponent of the form 10^N is used when the label value are eit...
Definition: TAxis.h:223
Bool_t GetCenterTitle() const
Definition: TAxis.h:120
double f(double x)
TGNumberEntry * fLabelSize
Definition: TAxisEditor.h:62
TText * text
virtual void DoLabelColor(Pixel_t color)
Slot connected to the label color.
virtual Style_t GetLabelFont() const
Definition: TAttAxis.h:53
virtual Int_t GetNdivisions() const
Definition: TAttAxis.h:50
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
virtual void SetTicks(Option_t *option="+")
Set ticks orientation.
Definition: TAxis.cxx:895
Int_t fTicksFlag
Definition: TAxisEditor.h:50
void SetDecimals(Bool_t dot=kTRUE)
Sets the decimals flag By default, blank characters are stripped, and then the label is correctly ali...
Definition: TAxis.h:203
Mother of all ROOT objects.
Definition: TObject.h:58
virtual Float_t GetLabelSize() const
Definition: TAttAxis.h:55
virtual void DoAxisColor(Pixel_t color)
Slot connected to the axis color.
TGCheckButton * fLogAxis
Definition: TAxisEditor.h:42
Bool_t fInit
Definition: TGedFrame.h:55
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:254
double f2(const double *x)
void RotateTitle(Bool_t rotate=kTRUE)
Rotate title by 180 degrees.
Definition: TAxis.h:193
void SetMoreLogLabels(Bool_t more=kTRUE)
Set the kMoreLogLabels bit flag When this option is selected more labels are drawn when in log scale ...
Definition: TAxis.h:213
ClassImp(TAxisEditor) enum EAxisWid
Definition: TAxisEditor.cxx:51
#define gPad
Definition: TVirtualPad.h:288
virtual void SetTickLength(Float_t length=0.03)
Set tick mark length The length is expressed in per cent of the pad width.
Definition: TAttAxis.cxx:231
TAxis * fAxis
Definition: TAxisEditor.h:40
virtual Double_t GetNumber() const
TGCheckButton * fCentered
Definition: TAxisEditor.h:57
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1200
virtual void DoNoExponent()
Slot connected to the labels' exponent flag.
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...
double exp(double)
Bool_t GetRotateTitle() const
Definition: TAxis.h:128
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual Float_t GetTickLength() const
Definition: TAttAxis.h:58
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
Definition: TNamed.cxx:152
TObject * obj
TGedEditor * fGedEditor
Definition: TGedFrame.h:56
Bool_t GetMoreLogLabels() const
Definition: TAxis.h:124
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:395
TAxisEditor(const TGWindow *p=0, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor of axis attribute GUI.
Definition: TAxisEditor.cxx:84
TGNumberEntry * fLabelOffset
Definition: TAxisEditor.h:63
virtual void DoDecimal(Bool_t on)
Slot connected to the decimal part setting.
void SetStripDecimals(Bool_t strip=kTRUE)
Set option to strip decimals when drawing axis labels.
Definition: TStyle.cxx:1476
virtual Float_t GetLabelOffset() const
Definition: TAttAxis.h:54
virtual void DoTitleSize()
Slot connected to the title font size.