TAxisEditor.cxx

Go to the documentation of this file.
00001 // @(#)root/ged:$Id: TAxisEditor.cxx 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Ilka Antcheva   11/05/04
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 //////////////////////////////////////////////////////////////////////////
00013 //                                                                      //
00014 //  TAxisEditor                                                         //
00015 //                                                                      //
00016 //  Implements GUI for axis attributes.                                 //
00017 //     axis color                                                       //
00018 //     ticks parameters: length, setting on both axis sides,            //
00019 //     logarithmic or linear scale along the selected axis,             //
00020 //     primary, secondary and tertiary axis divisions,                  //
00021 //     setting more logarithmic labels,                                 //
00022 //     optimizing labels' position if available                         //
00023 //     axis title - a title can be added via the text entry field       // 
00024 //     and can be set to be centered or rotated via the corresponding   // 
00025 //     check buttons, the title color, offset, font can be set easily   //
00026 //     axis labels - their color, size, offset can be set similarly,    //
00027 //     in addition there is a check box for no exponent choice,         //
00028 //     and another one for setting the same decimal part for all labels //                                                                      //
00029 //                                                                      //
00030 //////////////////////////////////////////////////////////////////////////
00031 //Begin_Html
00032 /*
00033 <img src="gif/TAxisEditor.gif">
00034 */
00035 //End_Html
00036 
00037 
00038 #include "TAxisEditor.h"
00039 #include "TAxis.h"
00040 #include "TGedEditor.h"
00041 #include "TGColorSelect.h"
00042 #include "TGComboBox.h"
00043 #include "TGNumberEntry.h"
00044 #include "TGTextEntry.h"
00045 #include "TGToolTip.h"
00046 #include "TGLabel.h"
00047 #include "TColor.h"
00048 #include "TVirtualPad.h"
00049 #include "TStyle.h"
00050 
00051 ClassImp(TAxisEditor)
00052 
00053 enum EAxisWid {
00054    kCOL_AXIS,
00055    kCOL_TIT,
00056    kCOL_LBL,
00057    kFONT_TIT,
00058    kFONT_LBL,
00059    kTITLE,
00060    kAXIS_TICKS,
00061    kAXIS_DIV1,
00062    kAXIS_DIV2,
00063    kAXIS_DIV3,
00064    kAXIS_OPTIM,
00065    kAXIS_LOG,
00066    kAXIS_TITSIZE,
00067    kAXIS_TITOFFSET,
00068    kAXIS_CENTERED,
00069    kAXIS_ROTATED,
00070    kAXIS_LBLSIZE,
00071    kAXIS_LBLOFFSET,
00072    kAXIS_TICKSBOTH,
00073    kAXIS_LBLLOG,
00074    kAXIS_LBLEXP,
00075    kAXIS_LBLDIR,
00076    kAXIS_LBLSORT,
00077    kAXIS_LBLDEC
00078 };
00079 
00080 
00081 //______________________________________________________________________________
00082 TAxisEditor::TAxisEditor(const TGWindow *p, Int_t width,
00083                          Int_t height, UInt_t options, Pixel_t back)
00084   : TGedFrame(p, width, height, options | kVerticalFrame, back)
00085 {
00086    // Constructor of axis attribute GUI.
00087    
00088    fAxis = 0;
00089    
00090    MakeTitle("Axis");
00091  
00092    TGCompositeFrame *f2 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
00093    fAxisColor = new TGColorSelect(f2, 0, kCOL_AXIS);
00094    f2->AddFrame(fAxisColor, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
00095    fAxisColor->Associate(this);
00096    TGLabel *fTicksLabel = new TGLabel(f2, "Ticks:");
00097    f2->AddFrame(fTicksLabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 1, 1));
00098    fTickLength = new TGNumberEntry(f2, 0.03, 5, kAXIS_TICKS, 
00099                                        TGNumberFormat::kNESRealTwo,
00100                                        TGNumberFormat::kNEAAnyNumber,
00101                                        TGNumberFormat::kNELLimitMinMax,-1.,1.);
00102    fTickLength->GetNumberEntry()->SetToolTipText("Set ticks' length");
00103    f2->AddFrame(fTickLength, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
00104    AddFrame(f2, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
00105 
00106    TGCompositeFrame *f3 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
00107    TGCompositeFrame *f4a = new TGCompositeFrame(f3, 40, 20, kVerticalFrame);
00108    f3->AddFrame(f4a, new TGLayoutHints(kLHintsTop, 0, 1, 0, 0));
00109    fTicksBoth = new TGCheckButton(f4a, "+-", kAXIS_TICKSBOTH);
00110    fTicksBoth->SetToolTipText("Draw ticks on both axis sides");
00111    f4a->AddFrame(fTicksBoth, new TGLayoutHints(kLHintsLeft | kLHintsBottom, 3, 1, 1, 0));
00112    fLogAxis = new TGCheckButton(f4a, "Log", kAXIS_LOG);
00113    fLogAxis->SetToolTipText("Draw logarithmic scale");
00114    f4a->AddFrame(fLogAxis, new TGLayoutHints(kLHintsLeft | kLHintsBottom, 3, 1, 0, 0));
00115 
00116    TGCompositeFrame *f4b = new TGCompositeFrame(f3, 40, 20, kVerticalFrame);
00117    f3->AddFrame(f4b, new TGLayoutHints(kLHintsTop, 0, 1, 0, 0));
00118    fOptimize = new TGCheckButton(f4b, "Optimize", kAXIS_OPTIM);
00119    fOptimize->SetState(kButtonDown);
00120    fOptimize->SetToolTipText("Optimize the number of axis divisions");
00121    f4b->AddFrame(fOptimize, new TGLayoutHints(kLHintsTop, 17, 1, 1, 0));
00122    fMoreLog = new TGCheckButton(f4b, "MoreLog", kAXIS_LBLLOG);
00123    fMoreLog->SetToolTipText("Draw more logarithmic labels");
00124    f4b->AddFrame(fMoreLog, new TGLayoutHints(kLHintsLeft, 17, 1, 0, 0));
00125 
00126    AddFrame(f3, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
00127 
00128    TGCompositeFrame *f5 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
00129    fDiv3 = new TGNumberEntry(f5, 10, 2,kAXIS_DIV1, TGNumberFormat::kNESInteger,
00130                                        TGNumberFormat::kNEANonNegative, 
00131                                        TGNumberFormat::kNELLimitMinMax, 0, 99);
00132    fDiv3->GetNumberEntry()->SetToolTipText("Tertiary axis divisions");
00133    f5->AddFrame(fDiv3, new TGLayoutHints(kLHintsLeft, 27, 0, 1, 1));
00134    fDiv2 = new TGNumberEntry(f5, 5, 2, kAXIS_DIV2, TGNumberFormat::kNESInteger,
00135                                        TGNumberFormat::kNEANonNegative, 
00136                                        TGNumberFormat::kNELLimitMinMax, 0, 99);
00137    fDiv2->GetNumberEntry()->SetToolTipText("Secondary axis divisions");
00138    f5->AddFrame(fDiv2, new TGLayoutHints(kLHintsLeft, 1, 0, 1, 1));
00139    fDiv1 = new TGNumberEntry(f5, 0, 2, kAXIS_DIV3, TGNumberFormat::kNESInteger,
00140                                        TGNumberFormat::kNEANonNegative, 
00141                                        TGNumberFormat::kNELLimitMinMax, 0, 99);
00142    fDiv1->GetNumberEntry()->SetToolTipText("Primary axis divisions");
00143    f5->AddFrame(fDiv1, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1, 1, 1, 1));
00144    AddFrame(f5, new TGLayoutHints(kLHintsLeft, 1, 1, 4, 4));
00145    fTicksFlag = 1;
00146 
00147    MakeTitle("Title");
00148   
00149    fTitlePrec = 2;
00150    fTitle = new TGTextEntry(this, new TGTextBuffer(50), kTITLE);
00151    fTitle->Resize(135, fTitle->GetDefaultHeight());
00152    fTitle->SetToolTipText("Enter the axis title string");
00153    AddFrame(fTitle, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 1));
00154    
00155    TGCompositeFrame *f6 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
00156    fTitleColor = new TGColorSelect(f6, 0, kCOL_TIT);
00157    f6->AddFrame(fTitleColor, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
00158    fTitleColor->Associate(this);
00159    TGLabel *fSizeLbl1 = new TGLabel(f6, "Size:");                              
00160    f6->AddFrame(fSizeLbl1, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 6, 1, 1, 1));
00161    fTitleSize = new TGNumberEntry(f6, 0.05, 5, kAXIS_TITSIZE, 
00162                                       TGNumberFormat::kNESRealTwo,
00163                                       TGNumberFormat::kNEANonNegative, 
00164                                       TGNumberFormat::kNELLimitMinMax, 0., 1.);
00165    fTitleSize->GetNumberEntry()->SetToolTipText("Set title size");
00166    f6->AddFrame(fTitleSize, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
00167    AddFrame(f6, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
00168 
00169    fTitleFont = new TGFontTypeComboBox(this, kFONT_TIT);
00170    fTitleFont->Resize(137, 20);
00171    AddFrame(fTitleFont, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 1));
00172 
00173    TGCompositeFrame *f7 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
00174    fCentered = new TGCheckButton(f7, "Centered", kAXIS_CENTERED);
00175    fCentered->SetToolTipText("Center axis title");
00176    f7->AddFrame(fCentered, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
00177    TGLabel *fOffsetLbl = new TGLabel(f7, "Offset:");                              
00178    f7->AddFrame(fOffsetLbl, new TGLayoutHints(kLHintsLeft, 23, 1, 3, 0));
00179    AddFrame(f7, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
00180 
00181    TGCompositeFrame *f8 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
00182    fRotated = new TGCheckButton(f8, "Rotated", kAXIS_ROTATED);
00183    fRotated->SetState(kButtonDown);
00184    fRotated->SetToolTipText("Rotate axis title by 180 degrees");
00185    f8->AddFrame(fRotated, new TGLayoutHints(kLHintsTop, 3, 1, 6, 0));
00186    fTitleOffset = new TGNumberEntry(f8, 1.00, 6, kAXIS_TITOFFSET, 
00187                                         TGNumberFormat::kNESRealTwo,
00188                                         TGNumberFormat::kNEAAnyNumber, 
00189                                         TGNumberFormat::kNELLimitMinMax, 0.1, 10.);
00190    fTitleOffset->GetNumberEntry()->SetToolTipText("Set title offset");
00191    f8->AddFrame(fTitleOffset, new TGLayoutHints(kLHintsLeft, 6, 1, 0, 0));
00192    AddFrame(f8, new TGLayoutHints(kLHintsTop, 1, 1, 0, 4));
00193 
00194    MakeTitle("Labels");
00195 
00196    fLabelPrec = 2;
00197    TGCompositeFrame *f9 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
00198    fLabelColor = new TGColorSelect(f9, 0, kCOL_LBL);
00199    f9->AddFrame(fLabelColor, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
00200    fLabelColor->Associate(this);
00201    TGLabel *fSizeLbl2 = new TGLabel(f9, "Size:");                              
00202    f9->AddFrame(fSizeLbl2, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 1, 0, 1, 1));
00203    fLabelSize = new TGNumberEntry(f9, 0.05, 6, kAXIS_LBLSIZE, 
00204                                       TGNumberFormat::kNESRealTwo,
00205                                       TGNumberFormat::kNEANonNegative, 
00206                                       TGNumberFormat::kNELLimitMinMax, 0., 1.);
00207    fLabelSize->GetNumberEntry()->SetToolTipText("Set labels' size");
00208    f9->AddFrame(fLabelSize, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
00209    AddFrame(f9, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
00210 
00211    TGCompositeFrame *f10 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
00212    fNoExponent = new TGCheckButton(f10, "NoExp", kAXIS_LBLEXP);
00213    fNoExponent->SetToolTipText("Labels drawn without exponent notation");
00214    f10->AddFrame(fNoExponent, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 1, 8, 0));
00215    fLabelOffset = new TGNumberEntry(f10, 0.005, 6, kAXIS_LBLOFFSET, 
00216                                          TGNumberFormat::kNESRealThree,
00217                                          TGNumberFormat::kNEAAnyNumber, 
00218                                          TGNumberFormat::kNELLimitMinMax,-1.,1.);
00219    fLabelOffset->GetNumberEntry()->SetToolTipText("Set labels' offset");
00220    f10->AddFrame(fLabelOffset, new TGLayoutHints(kLHintsLeft, 11, 1, 3, 0));
00221    AddFrame(f10, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
00222 
00223    fLabelFont = new TGFontTypeComboBox(this, kFONT_LBL);
00224    fLabelFont->Resize(137, 20);
00225    AddFrame(fLabelFont, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 0));
00226    fLabelFont->Associate(this);
00227 
00228    fDecimal = new TGCheckButton(this, "Decimal labels' part", kAXIS_LBLDEC);
00229    fDecimal->SetToolTipText("Draw the decimal part of labels");
00230    AddFrame(fDecimal, new TGLayoutHints(kLHintsLeft | kLHintsBottom, 3, 1, 3, 0));
00231 }
00232 
00233 //______________________________________________________________________________
00234 TAxisEditor::~TAxisEditor()
00235 {
00236   // Destructor of axis editor.
00237 }
00238 
00239 //______________________________________________________________________________
00240 void TAxisEditor::ConnectSignals2Slots()
00241 {
00242    // Connect signals to slots.
00243 
00244    fAxisColor->Connect("ColorSelected(Pixel_t)", "TAxisEditor", this, "DoAxisColor(Pixel_t)");
00245    fTickLength->Connect("ValueSet(Long_t)", "TAxisEditor", this, "DoTickLength()");
00246    (fTickLength->GetNumberEntry())->Connect("ReturnPressed()", "TAxisEditor", this, "DoTickLength()");
00247    fTicksBoth->Connect("Toggled(Bool_t)","TAxisEditor",this,"DoTicks()");
00248    fOptimize->Connect("Toggled(Bool_t)","TAxisEditor",this,"DoDivisions()");
00249    fLogAxis->Connect("Toggled(Bool_t)","TAxisEditor",this,"DoLogAxis()");
00250    fMoreLog->Connect("Toggled(Bool_t)","TAxisEditor",this,"DoMoreLog()");
00251    fDiv3->Connect("ValueSet(Long_t)", "TAxisEditor", this, "DoDivisions()");
00252    (fDiv3->GetNumberEntry())->Connect("ReturnPressed()", "TAxisEditor", this, "DoDivisions()");
00253    fDiv2->Connect("ValueSet(Long_t)", "TAxisEditor", this, "DoDivisions()");
00254    (fDiv2->GetNumberEntry())->Connect("ReturnPressed()", "TAxisEditor", this, "DoDivisions()");
00255    fDiv1->Connect("ValueSet(Long_t)", "TAxisEditor", this, "DoDivisions()");
00256    (fDiv1->GetNumberEntry())->Connect("ReturnPressed()", "TAxisEditor", this, "DoDivisions()");
00257    fTitle->Connect("TextChanged(const char *)", "TAxisEditor", this, "DoTitle(const char *)");;
00258    fTitleColor->Connect("ColorSelected(Pixel_t)", "TAxisEditor", this, "DoTitleColor(Pixel_t)");
00259    fTitleSize->Connect("ValueSet(Long_t)", "TAxisEditor", this, "DoTitleSize()");
00260    (fTitleSize->GetNumberEntry())->Connect("ReturnPressed()", "TAxisEditor", this, "DoTitleSize()");
00261    fTitleFont->Connect("Selected(Int_t)", "TAxisEditor", this, "DoTitleFont(Int_t)"); 
00262    fCentered->Connect("Toggled(Bool_t)","TAxisEditor",this, "DoTitleCentered()");
00263    fRotated->Connect("Toggled(Bool_t)","TAxisEditor",this,"DoTitleRotated()");
00264    fTitleOffset->Connect("ValueSet(Long_t)","TAxisEditor",this,"DoTitleOffset()");
00265    (fTitleOffset->GetNumberEntry())->Connect("ReturnPressed()","TAxisEditor",this,"DoTitleOffset()");
00266    fLabelColor->Connect("ColorSelected(Pixel_t)", "TAxisEditor", this, "DoLabelColor(Pixel_t)");
00267    fLabelSize->Connect("ValueSet(Long_t)","TAxisEditor",this,"DoLabelSize()");
00268    (fLabelSize->GetNumberEntry())->Connect("ReturnPressed()","TAxisEditor",this,"DoLabelSize()");
00269    fNoExponent->Connect("Toggled(Bool_t)","TAxisEditor",this,"DoNoExponent()");
00270    fDecimal->Connect("Toggled(Bool_t)","TAxisEditor",this,"DoDecimal(Bool_t)");
00271    fLabelOffset->Connect("ValueSet(Long_t)", "TAxisEditor", this, "DoLabelOffset()");
00272    (fLabelOffset->GetNumberEntry())->Connect("ReturnPressed()", "TAxisEditor", this, "DoLabelOffset()");
00273    fLabelFont->Connect("Selected(Int_t)", "TAxisEditor", this, "DoLabelFont(Int_t)"); 
00274    fInit = kFALSE;
00275 }
00276 
00277 //______________________________________________________________________________
00278 void TAxisEditor::SetModel(TObject* obj)
00279 {
00280    // Pick up the used values of axis attributes.
00281    fAxis = (TAxis *)obj;
00282    fAvoidSignal = kTRUE;
00283 
00284    Color_t c = fAxis->GetAxisColor();
00285    Pixel_t p = TColor::Number2Pixel(c);
00286    fAxisColor->SetColor(p);
00287 
00288    Float_t fl = fAxis->GetTickLength();
00289    fTickLength->SetNumber(fl);
00290    
00291    Int_t div = fAxis->GetNdivisions();
00292    fDiv1->SetNumber(div % 100);
00293    fDiv2->SetNumber((div/100) % 100);
00294    fDiv3->SetNumber((div/10000) % 100);
00295    
00296 
00297    if ((!strcmp(fAxis->GetName(),"xaxis") && fGedEditor->GetPad()->GetLogx()) ||
00298        (!strcmp(fAxis->GetName(),"yaxis") && fGedEditor->GetPad()->GetLogy()) ||
00299        (!strcmp(fAxis->GetName(),"zaxis") && fGedEditor->GetPad()->GetLogz())) 
00300 
00301       fLogAxis->SetState(kButtonDown);
00302    else fLogAxis->SetState(kButtonUp);
00303 
00304    if (fLogAxis->GetState() == kButtonUp) {
00305       fMoreLog->SetState(kButtonDisabled);
00306    } else {
00307       Int_t morelog = fAxis->GetMoreLogLabels();
00308       if (morelog) fMoreLog->SetState(kButtonDown);
00309       else         fMoreLog->SetState(kButtonUp);
00310    }
00311    
00312    const char *both = fAxis->GetTicks();
00313    if (!strcmp(both,"+-")) {
00314       fTicksBoth->SetState(kButtonDown);
00315    } else {
00316       fTicksBoth->SetState(kButtonUp);
00317       if (!strcmp(both,"-")) fTicksFlag = -1;
00318       if (!strcmp(both,"+")) fTicksFlag =  1;
00319    }
00320 
00321    const char *text = fAxis->GetTitle();
00322    fTitle->SetText(text);
00323    
00324    c = fAxis->GetTitleColor();
00325    p = TColor::Number2Pixel(c);
00326    fTitleColor->SetColor(p);
00327 
00328    fl = fAxis->GetTitleSize();
00329    fTitleSize->SetNumber(fl);
00330 
00331    Style_t font = fAxis->GetTitleFont();
00332    fTitleFont->Select(font / 10);
00333    fTitlePrec = (Int_t)(font % 10);
00334 
00335    fl = fAxis->GetTitleOffset();
00336    fTitleOffset->SetNumber(fl);
00337 
00338    Int_t centered = fAxis->GetCenterTitle();
00339    if (centered) fCentered->SetState(kButtonDown);
00340    else          fCentered->SetState(kButtonUp);
00341    
00342    Int_t rotated = fAxis->GetRotateTitle();
00343    if (rotated) fRotated->SetState(kButtonDown);
00344    else         fRotated->SetState(kButtonUp);
00345 
00346    c = fAxis->GetLabelColor();
00347    p = TColor::Number2Pixel(c);
00348    fLabelColor->SetColor(p);
00349 
00350    fl = fAxis->GetLabelSize();
00351    fLabelSize->SetNumber(fl);
00352 
00353    font = fAxis->GetLabelFont();
00354    fLabelFont->Select(font / 10);
00355    fLabelPrec = (Int_t)(font % 10);
00356 
00357    fl = fAxis->GetLabelOffset();
00358    fLabelOffset->SetNumber(fl);
00359 
00360    Int_t noexp = fAxis->GetNoExponent();
00361    if (noexp) fNoExponent->SetState(kButtonDown);
00362    else       fNoExponent->SetState(kButtonUp);
00363 
00364    Bool_t on = fAxis->GetDecimals();
00365    if (on) fDecimal->SetState(kButtonDown);
00366    else    fDecimal->SetState(kButtonUp);
00367    
00368    if (fInit) ConnectSignals2Slots();
00369    fAvoidSignal = kFALSE;
00370 }
00371 
00372 //______________________________________________________________________________
00373 void TAxisEditor::DoAxisColor(Pixel_t color)
00374 {
00375    // Slot connected to the axis color.
00376    
00377    if (fAvoidSignal) return;
00378    fAxis->SetAxisColor(TColor::GetColor(color));
00379    Update();
00380 }
00381 
00382 //______________________________________________________________________________
00383 void TAxisEditor::DoTickLength()
00384 {
00385    // Slot connected to the tick length settings.
00386 
00387    if (fAvoidSignal) return;
00388    Float_t ticks = fTickLength->GetNumber();
00389    fAxis->SetTickLength(ticks);
00390    Update();
00391    if (fTickLength->GetNumber() < 0) fTicksFlag = -1;
00392    else fTicksFlag = 1;
00393 }
00394 
00395 //______________________________________________________________________________
00396 void TAxisEditor::DoTicks()
00397 {
00398    // Slot connected to the ticks draw settings.
00399 
00400    if (fAvoidSignal) return;
00401    if (fTicksBoth->GetState() == kButtonDown) {
00402       fAxis->SetTicks("+-");
00403    } else {
00404       if (fTicksFlag == -1) fAxis->SetTicks("-");
00405       else fAxis->SetTicks("");
00406    }
00407    Update();
00408 }
00409 
00410 //______________________________________________________________________________
00411 void TAxisEditor::DoDivisions()
00412 {
00413    // Slot connected to the number of divisions.
00414 
00415    // the number of divisions are used 3 number entry widgets
00416    if (fAvoidSignal) return;
00417    Int_t div = (Int_t)(fDiv1->GetNumber() + fDiv2->GetNumber()  * 100 
00418                                           + fDiv3->GetNumber() * 10000);
00419    fAxis->SetNdivisions(div, fOptimize->GetState());
00420    Update();
00421 }
00422 
00423 //______________________________________________________________________________
00424 void TAxisEditor::DoLogAxis()
00425 {
00426    // Slot for Log scale setting.
00427 
00428    if (fAvoidSignal) return;
00429 
00430    gPad = fGedEditor->GetPad();
00431       
00432    if (fLogAxis->GetState() == kButtonDown) {
00433 
00434       if (!strcmp(fAxis->GetName(),"xaxis")) gPad->SetLogx(1);
00435       if (!strcmp(fAxis->GetName(),"yaxis")) gPad->SetLogy(1);
00436       if (!strcmp(fAxis->GetName(),"zaxis")) gPad->SetLogz(1);
00437 
00438       Int_t morelog = fAxis->GetMoreLogLabels();
00439       if (morelog)  fMoreLog->SetState(kButtonDown);
00440       else          fMoreLog->SetState(kButtonUp);
00441       fOptimize->SetState(kButtonDisabled);
00442 
00443    } else if (fLogAxis->GetState() == kButtonUp){
00444       if (!strcmp(fAxis->GetName(),"xaxis")) gPad->SetLogx(0);
00445       if (!strcmp(fAxis->GetName(),"yaxis")) gPad->SetLogy(0);
00446       if (!strcmp(fAxis->GetName(),"zaxis")) gPad->SetLogz(0);
00447       fMoreLog->SetState(kButtonDisabled);
00448       fOptimize->SetState(kButtonDown);
00449    }
00450    Update();
00451 }
00452 
00453 //______________________________________________________________________________
00454 void TAxisEditor::DoMoreLog()
00455 {
00456    // Slot connected to more Log labels flag
00457 
00458    if (fAvoidSignal) return;
00459    Int_t flag = 0;
00460    if (fMoreLog->GetState() == kButtonDown)    flag = 1;
00461    else if (fMoreLog->GetState() == kButtonUp) flag = 0;
00462    fAxis->SetMoreLogLabels(flag);
00463    Update();
00464 }
00465 
00466 //______________________________________________________________________________
00467 void TAxisEditor::DoTitle(const char *text)
00468 {
00469    // Slot connected to the axis color.
00470    
00471    if (fAvoidSignal) return;
00472    fAxis->SetTitle(text);
00473    Update();
00474 }
00475 
00476 //______________________________________________________________________________
00477 void TAxisEditor::DoTitleColor(Pixel_t color)
00478 {
00479    // Slot connected to the title color.
00480    
00481    if (fAvoidSignal) return;
00482    fAxis->SetTitleColor(TColor::GetColor(color));
00483    Update();
00484 }
00485 
00486 //______________________________________________________________________________
00487 void TAxisEditor::DoTitleSize()
00488 {
00489    // Slot connected to the title font size.
00490 
00491    if (fAvoidSignal) return;
00492    Float_t size = fTitleSize->GetNumber();
00493    fAxis->SetTitleSize(size);
00494    Update();
00495 }
00496 
00497 //______________________________________________________________________________
00498 void TAxisEditor::DoTitleFont(Int_t font)
00499 {
00500    // Slot connected to the title font.
00501 
00502    if (fAvoidSignal) return;
00503    Int_t f = font * 10 + fTitlePrec;
00504    fAxis->SetTitleFont(f);
00505    Update();
00506 }
00507 
00508 //______________________________________________________________________________
00509 void TAxisEditor::DoTitleOffset()
00510 {
00511    // Slot connected to the title offset.
00512 
00513    if (fAvoidSignal) return;
00514    Float_t offset = fTitleOffset->GetNumber();
00515    fAxis->SetTitleOffset(offset);
00516    Update();
00517 }
00518 
00519 //______________________________________________________________________________
00520 void TAxisEditor::DoTitleCentered()
00521 {
00522    // Slot connected to centered title option.
00523 
00524    if (fAvoidSignal) return;
00525    Int_t ctr = fCentered->GetState();
00526    fAxis->CenterTitle(ctr);
00527    Update();
00528 }
00529 
00530 //______________________________________________________________________________
00531 void TAxisEditor::DoTitleRotated()
00532 {
00533    // Slot connected to the title rotation.
00534 
00535    if (fAvoidSignal) return;
00536    Int_t rot = fRotated->GetState();
00537    fAxis->RotateTitle(rot);
00538    Update();
00539 }
00540 
00541 //______________________________________________________________________________
00542 void TAxisEditor::DoLabelColor(Pixel_t color)
00543 {
00544    // Slot connected to the label color.
00545 
00546    if (fAvoidSignal) return;
00547    fAxis->SetLabelColor(TColor::GetColor(color));
00548    Update();
00549 }
00550 
00551 //______________________________________________________________________________
00552 void TAxisEditor::DoLabelSize()
00553 {
00554    // Slot connected to the label size.
00555 
00556    if (fAvoidSignal) return;
00557    Float_t size = fLabelSize->GetNumber();
00558    fAxis->SetLabelSize(size);
00559    Update();
00560 }
00561 
00562 //______________________________________________________________________________
00563 void TAxisEditor::DoLabelFont(Int_t font)
00564 {
00565    // Slot connected to the label font.
00566 
00567    if (fAvoidSignal) return;
00568    Int_t f = font * 10 + fLabelPrec;
00569    fAxis->SetLabelFont(f);
00570    Update();
00571 }
00572 
00573 //______________________________________________________________________________
00574 void TAxisEditor::DoLabelOffset()
00575 {
00576    // Slot connected to the label offset.
00577 
00578    if (fAvoidSignal) return;
00579    Float_t offset = fLabelOffset->GetNumber();
00580    fAxis->SetLabelOffset(offset);
00581    Update();
00582 }
00583 
00584 //______________________________________________________________________________
00585 void TAxisEditor::DoNoExponent()
00586 {
00587    // Slot connected to the labels' exponent flag.
00588 
00589    if (fAvoidSignal) return;
00590    Int_t exp = fNoExponent->GetState();
00591    fAxis->SetNoExponent(exp);
00592    Update();
00593 }
00594 
00595 //______________________________________________________________________________
00596 void TAxisEditor::DoDecimal(Bool_t on)
00597 {
00598    // Slot connected to the decimal part setting.
00599 
00600    if (fAvoidSignal) return;
00601    fAxis->SetDecimals(on);
00602    gStyle->SetStripDecimals(!on);
00603    Update();
00604    gPad->Modified();
00605    gPad->Update();
00606 }
00607 

Generated on Tue Jul 5 14:19:45 2011 for ROOT_528-00b_version by  doxygen 1.5.1