TGeoConeEditor.cxx

Go to the documentation of this file.
00001 // @(#):$Id: TGeoConeEditor.cxx 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: M.Gheata 
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 //  TGeoConeEditor                                                      //
00015 //                                                                      //
00016 //////////////////////////////////////////////////////////////////////////
00017 //Begin_Html
00018 /*
00019 <img src="gif/cone_pic.gif">
00020 */
00021 //End_Html
00022 //Begin_Html
00023 /*
00024 <img src="gif/cone_ed.jpg">
00025 */
00026 //End_Html
00027 
00028 #include "TGeoConeEditor.h"
00029 #include "TGeoTabManager.h"
00030 #include "TGeoCone.h"
00031 #include "TGeoManager.h"
00032 #include "TVirtualGeoPainter.h"
00033 #include "TPad.h"
00034 #include "TView.h"
00035 #include "TGTab.h"
00036 #include "TGComboBox.h"
00037 #include "TGButton.h"
00038 #include "TGTextEntry.h"
00039 #include "TGNumberEntry.h"
00040 #include "TGLabel.h"
00041 #include "TGDoubleSlider.h"
00042 
00043 ClassImp(TGeoConeEditor)
00044 
00045 enum ETGeoConeWid {
00046    kCONE_NAME, kCONE_RMIN1, kCONE_RMIN2, kCONE_RMAX1, kCONE_RMAX2, kCONE_Z,
00047    kCONE_APPLY, kCONE_UNDO
00048 };
00049 
00050 //______________________________________________________________________________
00051 TGeoConeEditor::TGeoConeEditor(const TGWindow *p, Int_t width,
00052                                    Int_t height, UInt_t options, Pixel_t back)
00053    : TGeoGedFrame(p, width, height, options | kVerticalFrame, back)
00054 {
00055    // Constructor for volume editor
00056    fShape   = 0;
00057    fRmini1 = fRmaxi1 = fRmini2 = fRmaxi2 = fDzi = 0.0;
00058    fNamei = "";
00059    fIsModified = kFALSE;
00060    fIsShapeEditable = kTRUE;
00061 
00062    // TextEntry for shape name
00063    MakeTitle("Name");
00064    fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kCONE_NAME);
00065    fShapeName->Resize(135, fShapeName->GetDefaultHeight());
00066    fShapeName->SetToolTipText("Enter the cone name");
00067    fShapeName->Associate(this);
00068    AddFrame(fShapeName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5));
00069 
00070    TGTextEntry *nef;
00071    MakeTitle("Cone dimensions");
00072    TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame);
00073    
00074    // Number entry for Rmin1
00075    TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
00076    f1->AddFrame(new TGLabel(f1, "Rmin1"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
00077    fERmin1 = new TGNumberEntry(f1, 0., 5, kCONE_RMIN1);
00078    fERmin1->SetNumAttr(TGNumberFormat::kNEANonNegative);
00079    nef = (TGTextEntry*)fERmin1->GetNumberEntry();
00080    nef->SetToolTipText("Enter the inner radius");
00081    fERmin1->Associate(this);
00082    fERmin1->Resize(100, fERmin1->GetDefaultHeight());
00083    f1->AddFrame(fERmin1, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
00084    compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
00085    
00086   // Number entry for Rmax1
00087    f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
00088    f1->AddFrame(new TGLabel(f1, "Rmax1"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
00089    fERmax1 = new TGNumberEntry(f1, 0., 5, kCONE_RMAX1);
00090    fERmax1->SetNumAttr(TGNumberFormat::kNEANonNegative);
00091    nef = (TGTextEntry*)fERmax1->GetNumberEntry();
00092    nef->SetToolTipText("Enter the outer radius");
00093    fERmax1->Associate(this);
00094    fERmax1->Resize(100, fERmax1->GetDefaultHeight());
00095    f1->AddFrame(fERmax1, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
00096    compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
00097     
00098    // Number entry for Rmin2
00099    f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
00100    f1->AddFrame(new TGLabel(f1, "Rmin2"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
00101    fERmin2 = new TGNumberEntry(f1, 0., 5, kCONE_RMIN2);
00102    fERmin2->SetNumAttr(TGNumberFormat::kNEANonNegative);
00103    nef = (TGTextEntry*)fERmin2->GetNumberEntry();
00104    nef->SetToolTipText("Enter the inner radius");
00105    fERmin2->Associate(this);
00106    fERmin2->Resize(100, fERmin2->GetDefaultHeight());
00107    f1->AddFrame(fERmin2, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
00108    compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
00109     
00110    // Number entry for Rmax2
00111    f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
00112    f1->AddFrame(new TGLabel(f1, "Rmax2"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
00113    fERmax2 = new TGNumberEntry(f1, 0., 5, kCONE_RMAX2);
00114    fERmax2->SetNumAttr(TGNumberFormat::kNEANonNegative);
00115    nef = (TGTextEntry*)fERmax1->GetNumberEntry();
00116    nef->SetToolTipText("Enter the outer radius");
00117    fERmax2->Associate(this);
00118    fERmax2->Resize(100, fERmax2->GetDefaultHeight());
00119    f1->AddFrame(fERmax2, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
00120    compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
00121    
00122    // Number entry for dz
00123    f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
00124    f1->AddFrame(new TGLabel(f1, "DZ"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
00125    fEDz = new TGNumberEntry(f1, 0., 5, kCONE_Z);
00126    fEDz->SetNumAttr(TGNumberFormat::kNEAPositive);
00127    nef = (TGTextEntry*)fEDz->GetNumberEntry();
00128    nef->SetToolTipText("Enter the cone half-lenth in Z");
00129    fEDz->Associate(this);
00130    fEDz->Resize(100, fEDz->GetDefaultHeight());
00131    f1->AddFrame(fEDz, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
00132    compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
00133    
00134    compxyz->Resize(150,30);
00135    AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
00136       
00137    // Delayed draw
00138    fDFrame = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth | kSunkenFrame);
00139    fDelayed = new TGCheckButton(fDFrame, "Delayed draw");
00140    fDFrame->AddFrame(fDelayed, new TGLayoutHints(kLHintsLeft , 2, 2, 2, 2));
00141    AddFrame(fDFrame,  new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));  
00142 
00143    // Buttons
00144    fBFrame = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
00145    fApply = new TGTextButton(fBFrame, "Apply");
00146    fBFrame->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
00147    fApply->Associate(this);
00148    fUndo = new TGTextButton(fBFrame, "Undo");
00149    fBFrame->AddFrame(fUndo, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
00150    fUndo->Associate(this);
00151    AddFrame(fBFrame,  new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));  
00152    fUndo->SetSize(fApply->GetSize());
00153 }
00154 
00155 //______________________________________________________________________________
00156 TGeoConeEditor::~TGeoConeEditor()
00157 {
00158 // Destructor
00159    TGFrameElement *el;
00160    TIter next(GetList());
00161    while ((el = (TGFrameElement *)next())) {
00162       if (el->fFrame->IsComposite()) 
00163          TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame);
00164    }
00165    Cleanup();   
00166 }
00167 
00168 //______________________________________________________________________________
00169 void TGeoConeEditor::ConnectSignals2Slots()
00170 {
00171    // Connect signals to slots.
00172    fApply->Connect("Clicked()", "TGeoConeEditor", this, "DoApply()");
00173    fUndo->Connect("Clicked()", "TGeoConeEditor", this, "DoUndo()");
00174    fShapeName->Connect("TextChanged(const char *)", "TGeoConeEditor", this, "DoModified()");
00175    fERmin1->Connect("ValueSet(Long_t)", "TGeoConeEditor", this, "DoRmin1()");
00176    fERmin2->Connect("ValueSet(Long_t)", "TGeoConeEditor", this, "DoRmin2()");
00177    fERmax1->Connect("ValueSet(Long_t)", "TGeoConeEditor", this, "DoRmax1()");
00178    fERmax2->Connect("ValueSet(Long_t)", "TGeoConeEditor", this, "DoRmax2()");
00179    fEDz->Connect("ValueSet(Long_t)", "TGeoConeEditor", this, "DoDz()");
00180    fERmin1->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoConeEditor", this, "DoRmin1()");
00181    fERmin2->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoConeEditor", this, "DoRmin2()");
00182    fERmax1->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoConeEditor", this, "DoRmax1()");
00183    fERmax2->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoConeEditor", this, "DoRmax2()");
00184    fEDz->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoConeEditor", this, "DoDz()");
00185    fInit = kFALSE;
00186 }
00187 
00188 
00189 //______________________________________________________________________________
00190 void TGeoConeEditor::SetModel(TObject* obj)
00191 {
00192    // Connect to the selected object.
00193    if (obj == 0 || (obj->IsA()!=TGeoCone::Class())) {
00194       SetActive(kFALSE);
00195       return;                 
00196    } 
00197    fShape = (TGeoCone*)obj;
00198    fRmini1 = fShape->GetRmin1();
00199    fRmini2 = fShape->GetRmin2();
00200    fRmaxi1 = fShape->GetRmax1();
00201    fRmaxi2 = fShape->GetRmax2();
00202    fDzi = fShape->GetDz();
00203    fNamei = fShape->GetName();
00204    fShapeName->SetText(fShape->GetName());
00205    fERmin1->SetNumber(fRmini1);
00206    fERmin2->SetNumber(fRmini2);
00207    fERmax1->SetNumber(fRmaxi1);
00208    fERmax2->SetNumber(fRmaxi2);
00209    fEDz->SetNumber(fDzi);
00210    fApply->SetEnabled(kFALSE);
00211    fUndo->SetEnabled(kFALSE);
00212    
00213    if (fInit) ConnectSignals2Slots();
00214    SetActive();
00215 }
00216 
00217 //______________________________________________________________________________
00218 Bool_t TGeoConeEditor::IsDelayed() const
00219 {
00220 // Check if shape drawing is delayed.
00221    return (fDelayed->GetState() == kButtonDown);
00222 }
00223 
00224 //______________________________________________________________________________
00225 void TGeoConeEditor::DoName()
00226 {
00227    // Slot for name.
00228    DoModified();
00229 }
00230 
00231 //______________________________________________________________________________
00232 void TGeoConeEditor::DoApply()
00233 {
00234    //Slot for applying current parameters.
00235    fApply->SetEnabled(kFALSE);
00236    const char *name = fShapeName->GetText();
00237    if (strcmp(name,fShape->GetName())) fShape->SetName(name);
00238    Double_t rmin1 = fERmin1->GetNumber();
00239    Double_t rmin2 = fERmin2->GetNumber();
00240    Double_t rmax1 = fERmax1->GetNumber();
00241    Double_t rmax2 = fERmax2->GetNumber();
00242    Double_t dz = fEDz->GetNumber();
00243    if (rmin1<0 || rmin1>rmax1) return; 
00244    if (rmin2<0 || rmin2>rmax2) return;
00245    if (dz<=0) return;
00246    if (rmin1==rmax1 && rmin2==rmax2) return; 
00247    fShape->SetConeDimensions(dz, rmin1, rmax1, rmin2, rmax2);
00248    fShape->ComputeBBox();
00249    fUndo->SetEnabled();
00250    if (fPad) {
00251       if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) {
00252          fShape->Draw();
00253          fPad->GetView()->ShowAxis();
00254       } else Update();
00255    }   
00256 }
00257 
00258 //______________________________________________________________________________
00259 void TGeoConeEditor::DoModified()
00260 {
00261    //Slot for modifing current parameters.
00262    fApply->SetEnabled();
00263 }
00264 
00265 //______________________________________________________________________________
00266 void TGeoConeEditor::DoUndo()
00267 {
00268    // Slot for undoing current operation.
00269    fERmin1->SetNumber(fRmini1);
00270    fERmin2->SetNumber(fRmini2);
00271    fERmax1->SetNumber(fRmaxi1);
00272    fERmax2->SetNumber(fRmaxi2);
00273    fEDz->SetNumber(fDzi);
00274    DoApply();
00275    fUndo->SetEnabled(kFALSE);
00276    fApply->SetEnabled(kFALSE);
00277 }
00278    
00279 //______________________________________________________________________________
00280 void TGeoConeEditor::DoRmin1()
00281 {
00282    // Slot for Rmin1
00283    Double_t rmin1 = fERmin1->GetNumber();
00284    Double_t rmax1 = fERmax1->GetNumber();
00285    if (rmin1<0) {
00286       rmin1 = 0;
00287       fERmin1->SetNumber(rmin1);
00288    }   
00289    if (rmin1>rmax1) {
00290       rmin1 = rmax1;
00291       fERmin1->SetNumber(rmin1);
00292    }   
00293    DoModified();
00294    if (!IsDelayed()) DoApply();
00295 }
00296 
00297 //______________________________________________________________________________
00298 void TGeoConeEditor::DoRmax1()
00299 {
00300    // Slot for Rmax1
00301    Double_t rmin1 = fERmin1->GetNumber();
00302    Double_t rmax1 = fERmax1->GetNumber();
00303    if (rmax1<rmin1) {
00304       rmax1 = rmin1;
00305       fERmax1->SetNumber(rmax1);
00306    }   
00307    DoModified();
00308    if (!IsDelayed()) DoApply();
00309 }
00310 
00311 //______________________________________________________________________________
00312 void TGeoConeEditor::DoRmin2()
00313 {
00314    // Slot for Rmin2
00315    Double_t rmin2 = fERmin2->GetNumber();
00316    Double_t rmax2 = fERmax2->GetNumber();
00317    if (rmin2<0) {
00318       rmin2 = 0;
00319       fERmin2->SetNumber(rmin2);
00320    }   
00321    if (rmin2>rmax2) {
00322       rmin2 = rmax2;
00323       fERmin2->SetNumber(rmin2);
00324    }   
00325    DoModified();
00326    if (!IsDelayed()) DoApply();
00327 }
00328 
00329 //______________________________________________________________________________
00330 void TGeoConeEditor::DoRmax2()
00331 {
00332    // Slot for  Rmax2
00333    Double_t rmin2 = fERmin2->GetNumber();
00334    Double_t rmax2 = fERmax2->GetNumber();
00335    if (rmax2<rmin2) {
00336       rmax2 = rmin2;
00337       fERmax2->SetNumber(rmax2);
00338    }   
00339    DoModified();
00340    if (!IsDelayed()) DoApply();
00341 }
00342 
00343 //______________________________________________________________________________
00344 void TGeoConeEditor::DoDz()
00345 {
00346    // Slot for Dz
00347    Double_t dz = fEDz->GetNumber();
00348    if (dz<=0) {
00349       dz = 0.1;
00350       fEDz->SetNumber(dz);
00351    }   
00352    DoModified();
00353    if (!IsDelayed()) DoApply();
00354 }
00355 
00356 //////////////////////////////////////////////////////////////////////////
00357 //                                                                      //
00358 //  TGeoConeSegEditor                                                   //
00359 //                                                                      //
00360 //////////////////////////////////////////////////////////////////////////
00361 //Begin_Html
00362 /*
00363 <img src="gif/cons_pic.gif">
00364 */
00365 //End_Html
00366 //Begin_Html
00367 /*
00368 <img src="gif/cons_ed.jpg">
00369 */
00370 //End_Html
00371 
00372 ClassImp(TGeoConeSegEditor)
00373 
00374 enum ETGeoConeSegWid {
00375    kCONESEG_PHI1, kCONESEG_PHI2, kCONESEG_PHI
00376 };
00377 
00378 //______________________________________________________________________________
00379 TGeoConeSegEditor::TGeoConeSegEditor(const TGWindow *p, Int_t width,
00380                                    Int_t height, UInt_t options, Pixel_t back)
00381                  : TGeoConeEditor(p, width, height, options | kVerticalFrame, back)
00382 {
00383    // Constructor for cone segment editor
00384    fLock = kFALSE;
00385    MakeTitle("Phi range");
00386    TGTextEntry *nef;
00387    TGCompositeFrame *compxyz = new TGCompositeFrame(this, 155, 110, kHorizontalFrame | kFixedWidth | kFixedHeight | kRaisedFrame);
00388    // Vertical slider
00389    fSPhi = new TGDoubleVSlider(compxyz,100);
00390    fSPhi->SetRange(0.,720.);
00391    fSPhi->Resize(fSPhi->GetDefaultWidth(), 100);
00392    compxyz->AddFrame(fSPhi, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4)); 
00393    TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 135, 100, kVerticalFrame | kFixedHeight);
00394    f1->AddFrame(new TGLabel(f1, "Phi min."), new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 6, 0));
00395    fEPhi1 = new TGNumberEntry(f1, 0., 5, kCONESEG_PHI1);
00396    fEPhi1->Resize(100, fEPhi1->GetDefaultHeight());
00397    fEPhi1->SetNumAttr(TGNumberFormat::kNEANonNegative);
00398    nef = (TGTextEntry*)fEPhi1->GetNumberEntry();
00399    nef->SetToolTipText("Enter the phi1 value");
00400    fEPhi1->Associate(this);
00401    f1->AddFrame(fEPhi1, new TGLayoutHints(kLHintsTop | kLHintsRight, 2, 2, 2, 2));
00402 
00403    fEPhi2 = new TGNumberEntry(f1, 0., 5, kCONESEG_PHI2);
00404    fEPhi2->Resize(100, fEPhi2->GetDefaultHeight());
00405    fEPhi2->SetNumAttr(TGNumberFormat::kNEANonNegative);
00406    nef = (TGTextEntry*)fEPhi2->GetNumberEntry();
00407    nef->SetToolTipText("Enter the phi2 value");
00408    fEPhi2->Associate(this);
00409    f1->AddFrame(fEPhi2, new TGLayoutHints(kLHintsBottom | kLHintsRight, 2, 2, 2, 2));
00410    f1->AddFrame(new TGLabel(f1, "Phi max."), new TGLayoutHints(kLHintsBottom, 0, 0, 6, 2));
00411    compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
00412    
00413 //   compxyz->Resize(150,150);
00414    AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
00415    TGeoTabManager::MoveFrame(fDFrame, this);
00416    TGeoTabManager::MoveFrame(fBFrame, this);
00417 }
00418 
00419 //______________________________________________________________________________
00420 TGeoConeSegEditor::~TGeoConeSegEditor()
00421 {
00422 // Destructor
00423    TGFrameElement *el;
00424    TIter next(GetList());
00425    while ((el = (TGFrameElement *)next())) {
00426       if (el->fFrame->IsComposite()) 
00427          TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame);
00428    }
00429    Cleanup();   
00430 }
00431 
00432 //______________________________________________________________________________
00433 void TGeoConeSegEditor::ConnectSignals2Slots()
00434 {
00435    // Connect signals to slots.
00436    TGeoConeEditor::ConnectSignals2Slots();
00437    Disconnect(fApply, "Clicked()",(TGeoConeEditor*)this, "DoApply()");
00438    Disconnect(fUndo, "Clicked()",(TGeoConeEditor*)this, "DoUndo()");
00439    fApply->Connect("Clicked()", "TGeoConeSegEditor", this, "DoApply()");
00440    fUndo->Connect("Clicked()", "TGeoConeSegEditor", this, "DoUndo()");
00441    fEPhi1->Connect("ValueSet(Long_t)", "TGeoConeSegEditor", this, "DoPhi1()");
00442    fEPhi2->Connect("ValueSet(Long_t)", "TGeoConeSegEditor", this, "DoPhi2()");
00443 //   fEPhi1->GetNumberEntry()->Connect("TextChanged(const char *)","TGeoConeSegEditor", this, "DoPhi1()");
00444 //   fEPhi2->GetNumberEntry()->Connect("TextChanged(const char *)","TGeoConeSegEditor", this, "DoPhi2()");
00445    fSPhi->Connect("PositionChanged()","TGeoConeSegEditor", this, "DoPhi()");
00446 }
00447 
00448 //______________________________________________________________________________
00449 void TGeoConeSegEditor::SetModel(TObject* obj)
00450 {
00451    // Connect to the selected object.
00452    if (obj == 0 || (obj->IsA()!=TGeoConeSeg::Class())) {
00453       SetActive(kFALSE);
00454       return;                 
00455    } 
00456    fShape = (TGeoCone*)obj;
00457    fRmini1 = fShape->GetRmin1();
00458    fRmaxi1 = fShape->GetRmax1();
00459    fRmini2 = fShape->GetRmin2();
00460    fRmaxi2 = fShape->GetRmax2();
00461    fDzi = fShape->GetDz();
00462    fNamei = fShape->GetName();
00463    fPmini = ((TGeoConeSeg*)fShape)->GetPhi1();
00464    fPmaxi = ((TGeoConeSeg*)fShape)->GetPhi2();
00465    fShapeName->SetText(fShape->GetName());
00466    fEPhi1->SetNumber(fPmini);
00467    fEPhi2->SetNumber(fPmaxi);
00468    fSPhi->SetPosition(fPmini,fPmaxi);
00469    fERmin1->SetNumber(fRmini1);
00470    fERmax1->SetNumber(fRmaxi1);
00471    fERmin2->SetNumber(fRmini2);
00472    fERmax2->SetNumber(fRmaxi2);
00473    fEDz->SetNumber(fDzi);
00474    fApply->SetEnabled(kFALSE);
00475    fUndo->SetEnabled(kFALSE);
00476    
00477    if (fInit) ConnectSignals2Slots();
00478    SetActive();
00479 }
00480 
00481 //______________________________________________________________________________
00482 void TGeoConeSegEditor::DoPhi1()
00483 {
00484    //Slot for Phi1
00485    Double_t phi1 = fEPhi1->GetNumber();
00486    Double_t phi2 = fEPhi2->GetNumber();
00487    if (phi1 > 360-1.e-10) {
00488       phi1 = 0.;
00489       fEPhi1->SetNumber(phi1);
00490    }   
00491    if (phi2<phi1+1.e-10) {
00492       phi1 = phi2 - 0.1;
00493       fEPhi1->SetNumber(phi1);
00494    }   
00495    if (!fLock) {
00496       DoModified();
00497       fLock = kTRUE;
00498       fSPhi->SetPosition(phi1,phi2);
00499    } else fLock = kFALSE;
00500    if (!IsDelayed()) DoApply();
00501 }
00502 
00503 //______________________________________________________________________________
00504 void TGeoConeSegEditor::DoPhi2()
00505 {
00506    // Slot for Phi2
00507    Double_t phi1 = fEPhi1->GetNumber();
00508    Double_t phi2 = fEPhi2->GetNumber();
00509    if (phi2-phi1 > 360.) {
00510       phi2 -= 360.;
00511       fEPhi2->SetNumber(phi2);
00512    }   
00513    if (phi2<phi1+1.e-10) {
00514       phi2 = phi1 + 0.1;
00515       fEPhi2->SetNumber(phi2);
00516    }   
00517    if (!fLock) {
00518       DoModified();
00519       fLock = kTRUE;
00520       fSPhi->SetPosition(phi1,phi2);
00521    } else fLock = kFALSE;
00522    if (!IsDelayed()) DoApply();
00523 }
00524 
00525 //______________________________________________________________________________
00526 void TGeoConeSegEditor::DoPhi()
00527 {
00528    // Slot for Phi
00529    if (!fLock) {
00530       DoModified();
00531       fLock = kTRUE;
00532       fEPhi1->SetNumber(fSPhi->GetMinPosition());
00533       fLock = kTRUE;
00534       fEPhi2->SetNumber(fSPhi->GetMaxPosition());
00535    } else fLock = kFALSE;   
00536    if (!IsDelayed()) DoApply();
00537 }
00538 
00539 //______________________________________________________________________________
00540 void TGeoConeSegEditor::DoApply()
00541 {
00542    // Slot for applying current parameters.
00543    fApply->SetEnabled(kFALSE);
00544    const char *name = fShapeName->GetText();
00545    if (strcmp(name,fShape->GetName())) fShape->SetName(name);
00546    Double_t rmin1 = fERmin1->GetNumber();
00547    Double_t rmax1 = fERmax1->GetNumber();
00548    if (rmin1<0 || rmax1<rmin1) return;
00549    Double_t rmin2 = fERmin2->GetNumber();
00550    Double_t rmax2 = fERmax2->GetNumber();
00551    if (rmin2<0 || rmax2<rmin2) return;
00552    Double_t dz = fEDz->GetNumber();
00553    Double_t phi1 = fEPhi1->GetNumber();
00554    Double_t phi2 = fEPhi2->GetNumber();
00555    if ((phi2-phi1) > 360.001) {
00556       phi1 = 0.;
00557       phi2 = 360.;
00558       fEPhi1->SetNumber(phi1);
00559       fEPhi2->SetNumber(phi2);
00560       fLock = kTRUE;
00561       fSPhi->SetPosition(phi1,phi2);
00562       fLock = kFALSE;
00563    }   
00564    ((TGeoConeSeg*)fShape)->SetConsDimensions(dz, rmin1, rmax1, rmin2,rmax2, phi1, phi2);
00565    fShape->ComputeBBox();
00566    fUndo->SetEnabled();
00567    if (fPad) {
00568       if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) {
00569          fShape->Draw();
00570          fPad->GetView()->ShowAxis();
00571       } else Update();
00572    }   
00573 }
00574 
00575 //______________________________________________________________________________
00576 void TGeoConeSegEditor::DoUndo()
00577 {
00578    // Slot for undoing last operation.
00579    fERmin1->SetNumber(fRmini1);
00580    fERmin2->SetNumber(fRmini2);
00581    fERmax1->SetNumber(fRmaxi1);
00582    fERmax2->SetNumber(fRmaxi2);
00583    fEDz->SetNumber(fDzi);
00584    fEPhi1->SetNumber(fPmini);
00585    fEPhi2->SetNumber(fPmaxi);
00586    fSPhi->SetPosition(fPmini,fPmaxi);
00587    DoApply();
00588    fUndo->SetEnabled(kFALSE);
00589    fApply->SetEnabled(kFALSE);
00590 }
00591 
00592 
00593 
00594    

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