Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
51 ClassImp(TAxisEditor);
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 
84 TAxisEditor::TAxisEditor(const TGWindow *p, Int_t width,
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 
92  TGCompositeFrame *f2 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
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,
99  TGNumberFormat::kNESRealTwo,
100  TGNumberFormat::kNEAAnyNumber,
101  TGNumberFormat::kNELLimitMinMax,-1.,1.);
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);
119  fOptimize->SetState(kButtonDown);
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,
130  TGNumberFormat::kNEANonNegative,
131  TGNumberFormat::kNELLimitMinMax, 0, 99);
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,
135  TGNumberFormat::kNEANonNegative,
136  TGNumberFormat::kNELLimitMinMax, 0, 99);
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,
140  TGNumberFormat::kNEANonNegative,
141  TGNumberFormat::kNELLimitMinMax, 0, 99);
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);
151  fTitle->Resize(135, fTitle->GetDefaultHeight());
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,
162  TGNumberFormat::kNESRealTwo,
163  TGNumberFormat::kNEANonNegative,
164  TGNumberFormat::kNELLimitMinMax, 0., 1.);
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);
183  fRotated->SetState(kButtonDown);
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,
187  TGNumberFormat::kNESRealTwo,
188  TGNumberFormat::kNEAAnyNumber,
189  TGNumberFormat::kNELLimitMinMax, 0.1, 10.);
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,
204  TGNumberFormat::kNESRealTwo,
205  TGNumberFormat::kNEANonNegative,
206  TGNumberFormat::kNELLimitMinMax, 0., 1.);
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,
216  TGNumberFormat::kNESRealThree,
217  TGNumberFormat::kNEAAnyNumber,
218  TGNumberFormat::kNELLimitMinMax,-1.,1.);
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");
230  AddFrame(fDecimal, new TGLayoutHints(kLHintsLeft | kLHintsBottom, 3, 1, 3, 0));
231 }
232 
233 ////////////////////////////////////////////////////////////////////////////////
234 /// Destructor of axis editor.
235 
236 TAxisEditor::~TAxisEditor()
237 {
238 }
239 
240 ////////////////////////////////////////////////////////////////////////////////
241 /// Connect signals to slots.
242 
243 void TAxisEditor::ConnectSignals2Slots()
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 
281 void TAxisEditor::SetModel(TObject* obj)
282 {
283  fAxis = (TAxis *)obj;
284  fAvoidSignal = kTRUE;
285 
286  Color_t c = fAxis->GetAxisColor();
287  Pixel_t p = TColor::Number2Pixel(c);
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 
303  fLogAxis->SetState(kButtonDown);
304  else fLogAxis->SetState(kButtonUp);
305 
306  if (fLogAxis->GetState() == kButtonUp) {
307  fMoreLog->SetState(kButtonDisabled);
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,"+-")) {
316  fTicksBoth->SetState(kButtonDown);
317  } else {
318  fTicksBoth->SetState(kButtonUp);
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);
342  else fCentered->SetState(kButtonUp);
343 
344  Int_t rotated = fAxis->GetRotateTitle();
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);
364  else fNoExponent->SetState(kButtonUp);
365 
366  Bool_t on = fAxis->GetDecimals();
367  if (on) fDecimal->SetState(kButtonDown);
368  else fDecimal->SetState(kButtonUp);
369 
370  if (fInit) ConnectSignals2Slots();
371  fAvoidSignal = kFALSE;
372 }
373 
374 ////////////////////////////////////////////////////////////////////////////////
375 /// Slot connected to the axis color.
376 
377 void TAxisEditor::DoAxisColor(Pixel_t color)
378 {
379  if (fAvoidSignal) return;
380  fAxis->SetAxisColor(TColor::GetColor(color));
381  Update();
382 }
383 
384 ////////////////////////////////////////////////////////////////////////////////
385 /// Slot connected to the tick length settings.
386 
387 void TAxisEditor::DoTickLength()
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 
400 void TAxisEditor::DoTicks()
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 
415 void TAxisEditor::DoDivisions()
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);
421  fAxis->SetNdivisions(div, (fOptimize->GetState() != kButtonUp));
422  Update();
423 }
424 
425 ////////////////////////////////////////////////////////////////////////////////
426 /// Slot for Log scale setting.
427 
428 void TAxisEditor::DoLogAxis()
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);
443  fOptimize->SetState(kButtonDisabled);
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);
449  fMoreLog->SetState(kButtonDisabled);
450  fOptimize->SetState(kButtonDown);
451  }
452  Update();
453 }
454 
455 ////////////////////////////////////////////////////////////////////////////////
456 /// Slot connected to more Log labels flag
457 
458 void TAxisEditor::DoMoreLog()
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 
481 void TAxisEditor::DoTitleColor(Pixel_t color)
482 {
483  if (fAvoidSignal) return;
484  fAxis->SetTitleColor(TColor::GetColor(color));
485  Update();
486 }
487 
488 ////////////////////////////////////////////////////////////////////////////////
489 /// Slot connected to the title font size.
490 
491 void TAxisEditor::DoTitleSize()
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 
502 void TAxisEditor::DoTitleFont(Int_t font)
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 
513 void TAxisEditor::DoTitleOffset()
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 
524 void TAxisEditor::DoTitleCentered()
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 
535 void TAxisEditor::DoTitleRotated()
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 
546 void TAxisEditor::DoLabelColor(Pixel_t color)
547 {
548  if (fAvoidSignal) return;
549  fAxis->SetLabelColor(TColor::GetColor(color));
550  Update();
551 }
552 
553 ////////////////////////////////////////////////////////////////////////////////
554 /// Slot connected to the label size.
555 
556 void TAxisEditor::DoLabelSize()
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 
567 void TAxisEditor::DoLabelFont(Int_t font)
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 
578 void TAxisEditor::DoLabelOffset()
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 
589 void TAxisEditor::DoNoExponent()
590 {
591  if (fAvoidSignal) return;
592  Int_t exp = fNoExponent->GetState();
593  fAxis->SetNoExponent(exp);
594  Update();
595 }
596 
597 ////////////////////////////////////////////////////////////////////////////////
598 /// Slot connected to the decimal part setting.
599 
600 void TAxisEditor::DoDecimal(Bool_t on)
601 {
602  if (fAvoidSignal) return;
603  fAxis->SetDecimals(on);
604  gStyle->SetStripDecimals(!on);
605  Update();
606  gPad->Modified();
607  gPad->Update();
608 }
609