TGeoManagerEditor.cxx

Go to the documentation of this file.
00001 // @(#):$Id: TGeoManagerEditor.cxx 36535 2010-11-08 14:41:54Z agheata $
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 //  TGeoManagerEditor                                                    //
00015 //
00016 //////////////////////////////////////////////////////////////////////////
00017 /*
00018    Editor for TGeoManager class. Provides also builder functionality for the 
00019    main TGeo objects: TGeoVolume, TGeoShape - derived classes, TGeoMaterial,
00020    TGeoMatrix - derived transformations and TGeoMedium.
00021    The GUI represents the main entry point for editing geometry classes. It
00022    can be started either by:
00023    1. TGeoManager::Edit(). The method must be used when starting from a new 
00024    geometry.
00025    2. Left-click on the 40x40 pixels top-right corner of a pad containing a
00026    drawn volume. The region is always accesible when drawing geometry elements 
00027    and allows also restoring the manager editor in the "Style" tab of the GED
00028    editor anytime.
00029    
00030    The TGeoManager editor is vertically split by a TGShutter widget into the
00031    following categories:
00032    
00033    - General. This allows changing the name/title of the geometry, setting the
00034    top volume, closing the geometry and saving the geometry in a file. The name
00035    of the geometry file is formed by geometry_name.C/.root depending if the geometry
00036    need to be saved as a C macro or a .root file.
00037    - Shapes. The category provide buttons for creation of all supported shapes. The 
00038    new shape name is chosen by the interface, but can be changed from the shape 
00039    editor GUI. Existing shapes can be browsed and edited from the same category. 
00040    - Volumes. The category allows the creation of a new volume having a given name,
00041    shape and medium. For creating a volume assembly only the name is relevant. 
00042    Existing volumes can be browsed or edited from this category.
00043    - Materials. Allows creation of new materials/mixtures or editing existing ones.
00044    - Media. The same for creation/editing of tracking media (materials having a set
00045    of properties related to tracking)
00046    - Matrices. Allows creation of translations, rotations or combined transformations.
00047    Existing matrices can also be browser/edited.   
00048 */   
00049 
00050 #include "TVirtualPad.h"
00051 #include "TCanvas.h"
00052 #include "TBaseClass.h"
00053 #include "TGTab.h"
00054 #include "TG3DLine.h"
00055 #include "TGComboBox.h"
00056 #include "TGButton.h"
00057 #include "TGButtonGroup.h"
00058 #include "TGTextEntry.h"
00059 #include "TGNumberEntry.h"
00060 #include "TGLabel.h"
00061 #include "TGShutter.h"
00062 
00063 #include "TGeoVolumeEditor.h"
00064 #include "TGeoNodeEditor.h"
00065 #include "TGeoTabManager.h"
00066 #include "TGeoVolume.h"
00067 #include "TGeoManager.h"
00068 #include "TGeoMatrix.h"
00069 #include "TGeoBBox.h"
00070 #include "TGeoPara.h"
00071 #include "TGeoArb8.h"
00072 #include "TGeoTube.h"
00073 #include "TGeoEltu.h"
00074 #include "TGeoHype.h"
00075 #include "TGeoTorus.h"
00076 #include "TGeoTrd1.h"
00077 #include "TGeoTrd2.h"
00078 #include "TGeoCone.h"
00079 #include "TGeoSphere.h"
00080 #include "TGeoPcon.h"
00081 #include "TGeoPgon.h"
00082 #include "TGeoElement.h"
00083 #include "TGeoMaterial.h"
00084 #include "TView.h"
00085 
00086 #include "TGeoManagerEditor.h"
00087 #include "TGedEditor.h"
00088 
00089 ClassImp(TGeoManagerEditor)
00090 
00091 enum ETGeoVolumeWid {
00092    kMANAGER_NAME, kMANAGER_TITLE, 
00093    kMANAGER_SHAPE_SELECT, kMANAGER_MEDIA_SELECT,kMANAGER_MATERIAL_SELECT, kMANAGER_ELEMENT_SELECT,
00094    kMANAGER_SHAPE_SELECT2, kMANAGER_MEDIUM_SELECT2, kMANAGER_VOLUME_SELECT,
00095    kMANAGER_EDIT_SHAPE, kMANAGER_EDIT_MEDIUM, kMANAGER_DENSITY_SELECT, kMANAGER_NELEM_SELECT,
00096    kMANAGER_MATERIAL_SELECT2, kMANAGER_MEDIUM_SELECT, kMANAGER_MATRIX_SELECT, kMANAGER_TOP_SELECT,
00097    kEXPORT_ROOT, kEXPORT_C, kEXPORT_GEOMETRY,
00098    kCAT_GENERAL, kCAT_SHAPES, kCAT_VOLUMES, kCAT_MEDIA, kCAT_MATERIALS, kCAT_MATRICES,
00099    kCREATE_BOX, kCREATE_PARA, kCREATE_TRD1, kCREATE_TRD2,
00100    kCREATE_TRAP, kCREATE_GTRA, kCREATE_XTRU, kCREATE_ARB8,
00101    kCREATE_TUBE, kCREATE_TUBS, kCREATE_CONE, kCREATE_CONS,
00102    kCREATE_SPHE, kCREATE_CTUB, kCREATE_ELTU, kCREATE_TORUS,
00103    kCREATE_PCON, kCREATE_PGON, kCREATE_HYPE, kCREATE_PARAB, kCREATE_COMP,
00104    kCREATE_MATERIAL, kCREATE_MIXTURE, kCREATE_MEDIUM, kCREATE_VOLUME, kCREATE_ASSEMBLY,
00105    kCREATE_TRANSLATION, kCREATE_ROTATION, kCREATE_COMBI,
00106    kMEDIUM_NAME, kMEDIUM_ID, kMATRIX_NAME, kMATERIAL_NAME, kVOLUME_NAME,
00107    kMANAGER_APPLY, kMANAGER_CANCEL, kMANAGER_UNDO
00108 };
00109 
00110 //______________________________________________________________________________
00111 TGeoManagerEditor::TGeoManagerEditor(const TGWindow *p, Int_t width,
00112                                      Int_t height, UInt_t options, Pixel_t back)
00113    : TGedFrame(p, width, height, options | kVerticalFrame, back)
00114 {
00115    // Constructor for manager editor.
00116    fGeometry = gGeoManager;
00117    fTabMgr   = 0;
00118    fTab      = 0;
00119    fConnectedCanvas = 0;
00120 
00121    fIsModified = kFALSE;   
00122    TGCompositeFrame *f1;
00123    TGLabel *label;
00124    
00125    // TGShutter for categories
00126    fCategories = new TGShutter(this, kSunkenFrame | kFixedHeight);
00127 
00128    TGCompositeFrame *container;
00129    Pixel_t color;
00130    // General settings
00131    TGShutterItem *si = new TGShutterItem(fCategories, new TGHotString("General"),kCAT_GENERAL);
00132    container = (TGCompositeFrame*)si->GetContainer();
00133    container->SetBackgroundColor(GetDefaultFrameBackground());
00134    fCategories->AddItem(si);
00135    // TextEntry for manager name
00136    f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth);
00137    f1->AddFrame(label = new TGLabel(f1, "Name/Title"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
00138    f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
00139    gClient->GetColorByName("#ff0000", color);
00140    label->SetTextColor(color);
00141    container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
00142    fManagerName = new TGTextEntry(container, new TGTextBuffer(50), kMANAGER_NAME);
00143    fManagerName->Resize(135, fManagerName->GetDefaultHeight());
00144    fManagerName->SetToolTipText("Enter the geometry name");
00145    container->AddFrame(fManagerName, new TGLayoutHints(kLHintsLeft, 3, 1, 0, 0));
00146    fManagerTitle = new TGTextEntry(container, new TGTextBuffer(50), kMANAGER_TITLE);
00147    fManagerTitle->Resize(135, fManagerTitle->GetDefaultHeight());
00148    fManagerTitle->SetToolTipText("Enter the geometry name");
00149    container->AddFrame(fManagerTitle, new TGLayoutHints(kLHintsLeft, 3, 1, 0, 0));
00150    f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth);
00151    f1->AddFrame(label = new TGLabel(f1, "Export geometry"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
00152    f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
00153    gClient->GetColorByName("#ff0000", color);
00154    label->SetTextColor(color);
00155    container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 6, 0));
00156    TString stitle = "Options";
00157    f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth);
00158    TGButtonGroup *bg = new TGVButtonGroup(f1, stitle);
00159    fExportOption[0] = new TGRadioButton(bg, ".root", kEXPORT_ROOT);
00160    fExportOption[1] = new TGRadioButton(bg, ".C", kEXPORT_C);
00161    fExportButton = new TGTextButton(f1, "Export", kEXPORT_GEOMETRY);
00162    bg->SetRadioButtonExclusive();
00163    bg->SetButton(kEXPORT_ROOT);
00164    bg->Show();
00165    f1->AddFrame(bg, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
00166    f1->AddFrame(fExportButton, new TGLayoutHints(kLHintsLeft, 20, 2, 22, 0));
00167    container->AddFrame(f1, new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 2, 2));
00168    // Close geometry
00169    f7 = new TGCompositeFrame(container, 155, 10, kVerticalFrame | kFixedWidth);
00170    f1 = new TGCompositeFrame(f7, 155, 10, kHorizontalFrame | kFixedWidth);
00171    f1->AddFrame(label = new TGLabel(f1, "Close geometry"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
00172    f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
00173    gClient->GetColorByName("#ff0000", color);
00174    label->SetTextColor(color);
00175    f7->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
00176    f1 = new TGCompositeFrame(f7, 155, 30, kHorizontalFrame | kFixedWidth);
00177    fLSelTop = new TGLabel(f1, "Select top");
00178    gClient->GetColorByName("#0000ff", color);
00179    fLSelTop->SetTextColor(color);
00180    fLSelTop->ChangeOptions(kSunkenFrame | kDoubleBorder);
00181    f1->AddFrame(fLSelTop, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2));
00182    fBSelTop = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kMANAGER_TOP_SELECT);
00183    fBSelTop->SetToolTipText("Select the top volume");
00184    fBSelTop->Associate(this);
00185    f1->AddFrame(fBSelTop, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
00186    fCloseGeometry = new TGTextButton(f1, "Close");
00187    f1->AddFrame(fCloseGeometry, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2));
00188    fCloseGeometry->SetToolTipText("Close geometry to make it ready for tracking");
00189    fCloseGeometry->Associate(this);
00190    f7->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
00191    container->AddFrame(f7, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
00192    
00193 
00194    si = new TGShutterItem(fCategories, new TGHotString("Shapes"),kCAT_SHAPES);
00195    container = (TGCompositeFrame*)si->GetContainer();
00196    container->SetBackgroundColor(GetDefaultFrameBackground());
00197    fCategories->AddItem(si);
00198 
00199    // Shape creators
00200    f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth);
00201    f1->AddFrame(label = new TGLabel(f1, "Create new shape"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
00202    f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
00203    gClient->GetColorByName("#ff0000", color);
00204    label->SetTextColor(color);
00205    container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
00206    TGLayoutHints *lhb = new TGLayoutHints(kLHintsLeft, 0, 4, 0, 0);
00207    TGLayoutHints *lhf1 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 2, 2);
00208    Int_t ipict;
00209    f1 = new TGCompositeFrame(container, 118, 30, kHorizontalFrame);
00210    fShapeButton[0] = new TGPictureButton(f1, fClient->GetPicture("geobbox_t.xpm"), kCREATE_BOX);
00211    fShapeButton[0]->SetToolTipText("Create a box");
00212    fShapeButton[1] = new TGPictureButton(f1, fClient->GetPicture("geopara_t.xpm"), kCREATE_PARA);
00213    fShapeButton[1]->SetToolTipText("Create a parallelipiped");
00214    fShapeButton[2] = new TGPictureButton(f1, fClient->GetPicture("geotrd1_t.xpm"), kCREATE_TRD1);
00215    fShapeButton[2]->SetToolTipText("Create a TRD1 trapezoid");
00216    fShapeButton[3] = new TGPictureButton(f1, fClient->GetPicture("geotrd2_t.xpm"), kCREATE_TRD2);
00217    fShapeButton[3]->SetToolTipText("Create a TRD2 trapezoid");
00218    fShapeButton[4] = new TGPictureButton(f1, fClient->GetPicture("geotrap_t.xpm"), kCREATE_TRAP);
00219    fShapeButton[4]->SetToolTipText("Create a general trapezoid");
00220    fShapeButton[5] = new TGPictureButton(f1, fClient->GetPicture("geogtra_t.xpm"), kCREATE_GTRA);
00221    fShapeButton[5]->SetToolTipText("Create a general twisted trapezoid");
00222    for (ipict=0; ipict<6; ipict++) f1->AddFrame(fShapeButton[ipict],lhb);
00223    container->AddFrame(f1, lhf1);
00224    f1 = new TGCompositeFrame(container, 118, 30, kHorizontalFrame);
00225    fShapeButton[6] = new TGPictureButton(f1, fClient->GetPicture("geoxtru_t.xpm"), kCREATE_XTRU);
00226    fShapeButton[6]->SetToolTipText("Create a extruded polygone");
00227    fShapeButton[7] = new TGPictureButton(f1, fClient->GetPicture("geoarb8_t.xpm"), kCREATE_ARB8);
00228    fShapeButton[7]->SetToolTipText("Create an arbitrary trapezoid with 8 vertices");
00229    fShapeButton[8] = new TGPictureButton(f1, fClient->GetPicture("geotube_t.xpm"), kCREATE_TUBE);
00230    fShapeButton[8]->SetToolTipText("Create a cylindrical pipe");
00231    fShapeButton[9] = new TGPictureButton(f1, fClient->GetPicture("geotubeseg_t.xpm"), kCREATE_TUBS);
00232    fShapeButton[9]->SetToolTipText("Create a cylindrical pipe within a phi range");
00233    fShapeButton[10] = new TGPictureButton(f1, fClient->GetPicture("geocone_t.xpm"), kCREATE_CONE);
00234    fShapeButton[10]->SetToolTipText("Create a conical pipe");
00235    fShapeButton[11] = new TGPictureButton(f1, fClient->GetPicture("geoconeseg_t.xpm"), kCREATE_CONS);
00236    fShapeButton[11]->SetToolTipText("Create a conical pipe within a phi range");
00237    for (ipict=0; ipict<6; ipict++) f1->AddFrame(fShapeButton[ipict+6],lhb);
00238    container->AddFrame(f1, lhf1);
00239    f1 = new TGCompositeFrame(container, 118, 30, kHorizontalFrame);
00240    fShapeButton[12] = new TGPictureButton(f1, fClient->GetPicture("geosphere_t.xpm"), kCREATE_SPHE);
00241    fShapeButton[12]->SetToolTipText("Create a spherical sector");
00242    fShapeButton[13] = new TGPictureButton(f1, fClient->GetPicture("geoctub_t.xpm"), kCREATE_CTUB);
00243    fShapeButton[13]->SetToolTipText("Create a cut tube");
00244    fShapeButton[14] = new TGPictureButton(f1, fClient->GetPicture("geoeltu_t.xpm"), kCREATE_ELTU);
00245    fShapeButton[14]->SetToolTipText("Create an eliptical tube");
00246    fShapeButton[15] = new TGPictureButton(f1, fClient->GetPicture("geotorus_t.xpm"), kCREATE_TORUS);
00247    fShapeButton[15]->SetToolTipText("Create a toroidal tube with a phi range");
00248    fShapeButton[16] = new TGPictureButton(f1, fClient->GetPicture("geopcon_t.xpm"), kCREATE_PCON);
00249    fShapeButton[16]->SetToolTipText("Create a polycone shape");
00250    fShapeButton[17] = new TGPictureButton(f1, fClient->GetPicture("geopgon_t.xpm"), kCREATE_PGON);
00251    fShapeButton[17]->SetToolTipText("Create a polygon shape");
00252    for (ipict=0; ipict<6; ipict++) f1->AddFrame(fShapeButton[ipict+12],lhb);
00253    container->AddFrame(f1, lhf1);
00254    f1 = new TGCompositeFrame(container, 118, 30, kHorizontalFrame);
00255    fShapeButton[18] = new TGPictureButton(f1, fClient->GetPicture("geohype_t.xpm"), kCREATE_HYPE);
00256    fShapeButton[18]->SetToolTipText("Create a hyperboloid");
00257    fShapeButton[19] = new TGPictureButton(f1, fClient->GetPicture("geoparab_t.xpm"), kCREATE_PARAB);
00258    fShapeButton[19]->SetToolTipText("Create a paraboloid");
00259    fShapeButton[20] = new TGPictureButton(f1, fClient->GetPicture("geocomposite_t.xpm"), kCREATE_COMP);
00260    fShapeButton[20]->SetToolTipText("Create a composite shape");
00261    for (ipict=0; ipict<3; ipict++) f1->AddFrame(fShapeButton[ipict+18],lhb);
00262    container->AddFrame(f1, lhf1);
00263 
00264    // List of shapes
00265    f2 = new TGCompositeFrame(container, 155, 10, kVerticalFrame | kFixedWidth);
00266    f1 = new TGCompositeFrame(f2, 155, 10, kHorizontalFrame | kFixedWidth);
00267    f1->AddFrame(label = new TGLabel(f1, "Existing shapes"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
00268    f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
00269    gClient->GetColorByName("#ff0000", color);
00270    label->SetTextColor(color);
00271    f2->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
00272    f1 = new TGCompositeFrame(f2, 155, 30, kHorizontalFrame | kFixedWidth);
00273    fSelectedShape = 0;
00274    fLSelShape = new TGLabel(f1, "Select shape");
00275    gClient->GetColorByName("#0000ff", color);
00276    fLSelShape->SetTextColor(color);
00277    fLSelShape->ChangeOptions(kSunkenFrame | kDoubleBorder);
00278    f1->AddFrame(fLSelShape, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2));
00279    fBSelShape = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kMANAGER_SHAPE_SELECT);
00280    fBSelShape->SetToolTipText("Select one of the existing shapes");
00281    fBSelShape->Associate(this);
00282    f1->AddFrame(fBSelShape, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
00283    fEditShape = new TGTextButton(f1, "Edit");
00284    f1->AddFrame(fEditShape, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2));
00285    fEditShape->SetToolTipText("Edit selected shape");
00286    fEditShape->Associate(this);   
00287    f2->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
00288    container->AddFrame(f2, new TGLayoutHints(kLHintsLeft, 0, 0, 6, 0));
00289    
00290    // Volumes category
00291    si = new TGShutterItem(fCategories, new TGHotString("Volumes"),kCAT_VOLUMES);
00292    container = (TGCompositeFrame*)si->GetContainer();
00293    container->SetBackgroundColor(GetDefaultFrameBackground());
00294    fCategories->AddItem(si);
00295 
00296    f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth);
00297    f1->AddFrame(label = new TGLabel(f1, "Create new volume"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
00298    f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
00299    gClient->GetColorByName("#ff0000", color);
00300    label->SetTextColor(color);
00301    container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
00302 
00303    f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth);
00304    f1->AddFrame(new TGLabel(f1, "Name"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
00305    fVolumeName = new TGTextEntry(f1, new TGTextBuffer(50), kVOLUME_NAME);
00306    fVolumeName->Resize(100, fVolumeName->GetDefaultHeight());
00307    fVolumeName->SetToolTipText("Enter the name for the new volume");
00308    f1->AddFrame(fVolumeName, new TGLayoutHints(kLHintsRight, 3, 1, 2, 5));
00309    container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
00310 
00311    // ComboBox for shape component
00312    f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth);
00313    fSelectedShape2 = 0;
00314    fLSelShape2 = new TGLabel(f1, "Select shape");
00315    gClient->GetColorByName("#0000ff", color);
00316    fLSelShape2->SetTextColor(color);
00317    fLSelShape2->ChangeOptions(kSunkenFrame | kDoubleBorder);
00318    f1->AddFrame(fLSelShape2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2));
00319    fBSelShape2 = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kMANAGER_SHAPE_SELECT2);
00320    fBSelShape2->SetToolTipText("Select one of the existing shapes");
00321    fBSelShape2->Associate(this);
00322    f1->AddFrame(fBSelShape2, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
00323    container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
00324 
00325    // ComboBox for medium component
00326    f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth);
00327    fSelectedMedium2 = 0;
00328    fLSelMedium2 = new TGLabel(f1, "Select medium");
00329    gClient->GetColorByName("#0000ff", color);
00330    fLSelMedium2->SetTextColor(color);
00331    fLSelMedium2->ChangeOptions(kSunkenFrame | kDoubleBorder);
00332    f1->AddFrame(fLSelMedium2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2));
00333    fBSelMedium2 = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kMANAGER_MEDIUM_SELECT2);
00334    fBSelMedium2->SetToolTipText("Select one of the existing media");
00335    fBSelMedium2->Associate(this);
00336    f1->AddFrame(fBSelMedium2, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
00337    container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
00338    // Picture buttons for different volumes
00339    f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth);
00340    f1->AddFrame(new TGLabel(f1, "Create..."), new TGLayoutHints(kLHintsLeft, 1, 5, 6, 0));
00341    fVolumeButton[0] = new TGPictureButton(f1, fClient->GetPicture("geovolume_t.xpm"), kCREATE_VOLUME);
00342    fVolumeButton[0]->SetToolTipText("Create a new volume from shape and medium");
00343    fVolumeButton[1] = new TGPictureButton(f1, fClient->GetPicture("geoassembly_t.xpm"), kCREATE_ASSEMBLY);
00344    fVolumeButton[1]->SetToolTipText("Create a new volume assemby having the selected name");
00345    for (ipict=0; ipict<2; ipict++) f1->AddFrame(fVolumeButton[ipict],lhb);
00346    container->AddFrame(f1, lhf1);
00347    // List of volumes
00348    f3 = new TGCompositeFrame(container, 155, 10, kVerticalFrame | kFixedWidth);
00349    f1 = new TGCompositeFrame(f3, 155, 10, kHorizontalFrame | kFixedWidth);
00350    f1->AddFrame(label = new TGLabel(f1, "Existing volumes"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
00351    f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
00352    gClient->GetColorByName("#ff0000", color);
00353    label->SetTextColor(color);
00354    f3->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
00355    f1 = new TGCompositeFrame(f3, 155, 30, kHorizontalFrame | kFixedWidth);
00356    fSelectedVolume = 0;
00357    fLSelVolume = new TGLabel(f1, "Select volume");
00358    gClient->GetColorByName("#0000ff", color);
00359    fLSelVolume->SetTextColor(color);
00360    fLSelVolume->ChangeOptions(kSunkenFrame | kDoubleBorder);
00361    f1->AddFrame(fLSelVolume, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2));
00362    fBSelVolume = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kMANAGER_VOLUME_SELECT);
00363    fBSelVolume->SetToolTipText("Select one of the existing volumes");
00364    fBSelVolume->Associate(this);
00365    f1->AddFrame(fBSelVolume, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2));
00366    f3->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
00367    f1 = new TGCompositeFrame(f3, 155, 30, kHorizontalFrame | kFixedWidth);
00368    fEditVolume = new TGTextButton(f1, " Edit ");
00369    f1->AddFrame(fEditVolume, new TGLayoutHints(kLHintsLeft, 20, 1, 2, 2));
00370    fEditVolume->SetToolTipText("Edit selected volume");
00371    fEditVolume->Associate(this);
00372    fSetTopVolume = new TGTextButton(f1, "Set top");
00373    f1->AddFrame(fSetTopVolume, new TGLayoutHints(kLHintsRight, 1, 20, 2, 2));
00374    fSetTopVolume->SetToolTipText("Set top volume for geometry");
00375    fSetTopVolume->Associate(this);
00376    f3->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
00377    container->AddFrame(f3, new TGLayoutHints(kLHintsLeft, 0, 0, 6, 0));
00378 
00379    // Materials category
00380    si = new TGShutterItem(fCategories, new TGHotString("Materials"),kCAT_MATERIALS);
00381    container = (TGCompositeFrame*)si->GetContainer();
00382    container->SetBackgroundColor(GetDefaultFrameBackground());
00383    fCategories->AddItem(si);
00384 
00385    // Material creators
00386    gGeoManager->BuildDefaultMaterials();
00387    f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth);
00388    f1->AddFrame(label = new TGLabel(f1, "Create material/mixt."), new TGLayoutHints(kLHintsLeft, 2, 1, 0, 0));
00389    f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
00390    gClient->GetColorByName("#ff0000", color);
00391    label->SetTextColor(color);
00392    container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
00393    f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth);
00394    f1->AddFrame(new TGLabel(f1, "Name"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
00395    fMaterialName = new TGTextEntry(f1, new TGTextBuffer(50), kMATERIAL_NAME);
00396    fMaterialName->Resize(100, fMaterialName->GetDefaultHeight());
00397    fMaterialName->SetToolTipText("Enter the new material name");
00398    f1->AddFrame(fMaterialName, new TGLayoutHints(kLHintsRight, 3, 1, 2, 5));
00399    container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
00400 
00401    f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth);
00402    f1->AddFrame(new TGLabel(f1, "Element"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
00403    fElementList = new TGComboBox(f1, kMANAGER_ELEMENT_SELECT);
00404    fElementList->Resize(100, fManagerName->GetDefaultHeight());
00405    TGeoElementTable *table = gGeoManager->GetElementTable();
00406    if (table) {
00407       TGeoElement *element;
00408       for (Int_t i=0; i<table->GetNelements(); i++) {
00409          element = table->GetElement(i);
00410          fElementList->AddEntry(element->GetTitle(),i);
00411       }
00412    }      
00413    fElementList->Select(0);
00414    f1->AddFrame(fElementList, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
00415    container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
00416    // Number entry for density
00417    f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth);
00418    f1->AddFrame(new TGLabel(f1, "Density"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
00419    fEntryDensity = new TGNumberEntry(f1, 0., 5, kMANAGER_DENSITY_SELECT);
00420    fEntryDensity->SetNumStyle(TGNumberFormat::kNESRealThree);
00421    fEntryDensity->SetNumAttr(TGNumberFormat::kNEANonNegative);
00422    fEntryDensity->Resize(100,fEntryDensity->GetDefaultHeight()); 
00423    TGTextEntry *nef = (TGTextEntry*)fEntryDensity->GetNumberEntry();
00424    nef->SetToolTipText("Enter material/mixture density");
00425    fEntryDensity->SetNumber(0);
00426    fEntryDensity->Associate(this);
00427    f1->AddFrame(fEntryDensity, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
00428    container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
00429    // Buttons for creating materials/mixtures
00430    // Picture buttons for different volumes
00431    f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth);
00432    f1->AddFrame(new TGLabel(f1, "Create..."), new TGLayoutHints(kLHintsLeft, 1, 5, 6, 0));
00433    fMaterialButton[0] = new TGPictureButton(f1, fClient->GetPicture("geomaterial_t.xpm"), kCREATE_MATERIAL);
00434    fMaterialButton[0]->SetToolTipText("Create a new material from element and density");
00435    fMaterialButton[1] = new TGPictureButton(f1, fClient->GetPicture("geomixture_t.xpm"), kCREATE_MIXTURE);
00436    fMaterialButton[1]->SetToolTipText("Create a new mixture with selected density");
00437    for (ipict=0; ipict<2; ipict++) f1->AddFrame(fMaterialButton[ipict],lhb);
00438    container->AddFrame(f1, lhf1);
00439    
00440    // List of materials
00441    f4 = new TGCompositeFrame(container, 155, 10, kVerticalFrame | kFixedWidth);
00442    f1 = new TGCompositeFrame(f4, 155, 10, kHorizontalFrame | kFixedWidth);
00443    f1->AddFrame(label = new TGLabel(f1, "Existing materials"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
00444    f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
00445    gClient->GetColorByName("#ff0000", color);
00446    label->SetTextColor(color);
00447    f4->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
00448    f1 = new TGCompositeFrame(f4, 155, 30, kHorizontalFrame | kFixedWidth);
00449    fSelectedMaterial = 0;
00450    fLSelMaterial = new TGLabel(f1, "Select material");
00451    gClient->GetColorByName("#0000ff", color);
00452    fLSelMaterial->SetTextColor(color);
00453    fLSelMaterial->ChangeOptions(kSunkenFrame | kDoubleBorder);
00454    f1->AddFrame(fLSelMaterial, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2));
00455    fBSelMaterial = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kMANAGER_MATERIAL_SELECT);
00456    fBSelMaterial->SetToolTipText("Select one of the existing materials");
00457    fBSelMaterial->Associate(this);
00458    f1->AddFrame(fBSelMaterial, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
00459    fEditMaterial = new TGTextButton(f1, "Edit");
00460    f1->AddFrame(fEditMaterial, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2));
00461    fEditMaterial->SetToolTipText("Edit selected material");
00462    fEditMaterial->Associate(this);
00463    f4->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
00464    container->AddFrame(f4, new TGLayoutHints(kLHintsLeft, 0, 0, 6, 0));
00465    
00466    si = new TGShutterItem(fCategories, new TGHotString("Media"),kCAT_MEDIA);
00467    container = (TGCompositeFrame*)si->GetContainer();
00468    container->SetBackgroundColor(GetDefaultFrameBackground());
00469    fCategories->AddItem(si);
00470 
00471    // Media category
00472    f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth);
00473    f1->AddFrame(label = new TGLabel(f1, "Create new medium"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
00474    f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
00475    gClient->GetColorByName("#ff0000", color);
00476    label->SetTextColor(color);
00477    container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
00478 
00479    f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth);
00480    f1->AddFrame(new TGLabel(f1, "Name"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
00481    fMediumName = new TGTextEntry(f1, new TGTextBuffer(50), kMEDIUM_NAME);
00482    fMediumName->Resize(60, fMediumName->GetDefaultHeight());
00483    fMediumName->SetToolTipText("Enter the new medium name");
00484    f1->AddFrame(fMediumName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5));
00485 
00486    fMediumId = new TGNumberEntry(f1, 0., 5, kMEDIUM_ID);
00487    fMediumId->SetNumStyle(TGNumberFormat::kNESInteger);
00488    fMediumId->SetNumAttr(TGNumberFormat::kNEAPositive);
00489    fMediumId->Resize(35,fMediumId->GetDefaultHeight()); 
00490    nef = (TGTextEntry*)fMediumId->GetNumberEntry();
00491    nef->SetToolTipText("Enter medium ID");
00492    fMediumId->SetNumber(fGeometry->GetListOfMedia()->GetSize());
00493    fMediumId->Associate(this);
00494    f1->AddFrame(fMediumId, new TGLayoutHints(kLHintsRight, 2, 2, 2 ,2));
00495    f1->AddFrame(new TGLabel(f1, "ID"), new TGLayoutHints(kLHintsRight, 1, 1, 6, 0));   
00496    container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 0));
00497    // ComboBox for materials
00498    f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth);
00499    fSelectedMaterial2 = 0;
00500    fLSelMaterial2 = new TGLabel(f1, "Select material");
00501    gClient->GetColorByName("#0000ff", color);
00502    fLSelMaterial2->SetTextColor(color);
00503    fLSelMaterial2->ChangeOptions(kSunkenFrame | kDoubleBorder);
00504    f1->AddFrame(fLSelMaterial2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2));
00505    fBSelMaterial2 = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kMANAGER_MATERIAL_SELECT2);
00506    fBSelMaterial2->SetToolTipText("Select one of the existing materials");
00507    fBSelMaterial2->Associate(this);
00508    f1->AddFrame(fBSelMaterial2, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
00509    container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
00510    f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth);
00511    f1->AddFrame(new TGLabel(f1, "Create..."), new TGLayoutHints(kLHintsLeft, 1, 5, 6, 0));
00512    fMediumButton = new TGPictureButton(f1, fClient->GetPicture("geomedium_t.xpm"), kCREATE_MEDIUM);
00513    fMediumButton->SetToolTipText("Create a new medium from selected material");
00514    fMediumButton->Associate(this);
00515    f1->AddFrame(fMediumButton, new TGLayoutHints(kLHintsLeft, 5, 2, 2, 2));
00516    container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
00517 
00518    // List of media
00519    f5 = new TGCompositeFrame(container, 155, 10, kVerticalFrame | kFixedWidth);
00520    f1 = new TGCompositeFrame(f5, 145, 10, kHorizontalFrame | kLHintsExpandX | kFixedWidth | kOwnBackground);
00521    f1->AddFrame(label = new TGLabel(f1, "Existing media"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
00522    f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
00523    gClient->GetColorByName("#ff0000", color);
00524    label->SetTextColor(color);
00525    f5->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
00526    f1 = new TGCompositeFrame(f5, 155, 30, kHorizontalFrame | kFixedWidth);
00527    fSelectedMedium = 0;
00528    fLSelMedium = new TGLabel(f1, "Select medium");
00529    gClient->GetColorByName("#0000ff", color);
00530    fLSelMedium->SetTextColor(color);
00531    fLSelMedium->ChangeOptions(kSunkenFrame | kDoubleBorder);
00532    f1->AddFrame(fLSelMedium, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2));
00533    fBSelMedium = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kMANAGER_MEDIA_SELECT);
00534    fBSelMedium->SetToolTipText("Select one of the existing media");
00535    fBSelMedium->Associate(this);
00536    f1->AddFrame(fBSelMedium, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
00537    fEditMedium = new TGTextButton(f1, "Edit");
00538    f1->AddFrame(fEditMedium, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2));
00539    fEditMedium->SetToolTipText("Edit selected medium");
00540    fEditMedium->Associate(this);
00541    f5->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
00542    container->AddFrame(f5, new TGLayoutHints(kLHintsLeft, 0, 0, 6, 0));
00543 
00544    // Matrix category
00545    si = new TGShutterItem(fCategories, new TGHotString("Matrices"),kCAT_MATRICES);
00546    container = (TGCompositeFrame*)si->GetContainer();
00547    container->SetBackgroundColor(GetDefaultFrameBackground());
00548    fCategories->AddItem(si);
00549    // Name entry
00550    f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth);
00551    f1->AddFrame(label = new TGLabel(f1, "Create new matrix"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
00552    f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
00553    gClient->GetColorByName("#ff0000", color);
00554    label->SetTextColor(color);
00555    container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
00556 
00557    f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth);
00558    f1->AddFrame(new TGLabel(f1, "Name"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
00559    fMatrixName = new TGTextEntry(f1, new TGTextBuffer(50), kMATRIX_NAME);
00560    fMatrixName->Resize(100, fMatrixName->GetDefaultHeight());
00561    fMatrixName->SetToolTipText("Enter the new matrix name");
00562    f1->AddFrame(fMatrixName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5));
00563    container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 0));
00564    // Picture buttons for different matrices
00565    f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth);
00566    f1->AddFrame(new TGLabel(f1, "Create..."), new TGLayoutHints(kLHintsLeft, 1, 5, 6, 0));
00567    fMatrixButton[0] = new TGPictureButton(f1, fClient->GetPicture("geotranslation_t.xpm"), kCREATE_TRANSLATION);
00568    fMatrixButton[0]->SetToolTipText("Create a translation");
00569    fMatrixButton[1] = new TGPictureButton(f1, fClient->GetPicture("georotation_t.xpm"), kCREATE_ROTATION);
00570    fMatrixButton[1]->SetToolTipText("Create a rotation");
00571    fMatrixButton[2] = new TGPictureButton(f1, fClient->GetPicture("geocombi_t.xpm"), kCREATE_COMBI);
00572    fMatrixButton[2]->SetToolTipText("Create a rotation + translation");
00573    for (ipict=0; ipict<3; ipict++) f1->AddFrame(fMatrixButton[ipict],lhb);
00574    container->AddFrame(f1, lhf1);
00575    // List of matrices
00576    f6 = new TGCompositeFrame(container, 155, 10, kVerticalFrame | kFixedWidth);
00577    f1 = new TGCompositeFrame(f6, 155, 10, kHorizontalFrame | kFixedWidth);
00578    f1->AddFrame(label = new TGLabel(f1, "Existing matrices"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
00579    f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
00580    gClient->GetColorByName("#ff0000", color);
00581    label->SetTextColor(color);
00582    f6->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
00583    f1 = new TGCompositeFrame(f6, 155, 30, kHorizontalFrame | kFixedWidth);
00584    fSelectedMatrix = 0;
00585    fLSelMatrix = new TGLabel(f1, "Select matrix");
00586    gClient->GetColorByName("#0000ff", color);
00587    fLSelMatrix->SetTextColor(color);
00588    fLSelMatrix->ChangeOptions(kSunkenFrame | kDoubleBorder);
00589    f1->AddFrame(fLSelMatrix, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2));
00590    fBSelMatrix = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kMANAGER_MATRIX_SELECT);
00591    fBSelMatrix->SetToolTipText("Select one of the existing matrices");
00592    fBSelMatrix->Associate(this);
00593    f1->AddFrame(fBSelMatrix, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
00594    fEditMatrix = new TGTextButton(f1, "Edit");
00595    f1->AddFrame(fEditMatrix, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2));
00596    fEditMatrix->SetToolTipText("Edit selected matrix");
00597    fEditMatrix->Associate(this);
00598    f6->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
00599    container->AddFrame(f6, new TGLayoutHints(kLHintsLeft, 0, 0, 6, 0));
00600    
00601    fCategories->Resize(163,370);
00602    AddFrame(fCategories, new TGLayoutHints(kLHintsLeft, 0, 0, 4, 4));
00603 
00604    fVolumeTab = CreateEditorTabSubFrame("Volume");
00605 
00606    // Set the fTab and dissconnect editor from the canvas.
00607    fTab = fGedEditor->GetTab();
00608    TCanvas* edCanvas = fGedEditor->GetCanvas();
00609    fGedEditor->DisconnectFromCanvas();
00610    if (edCanvas != fConnectedCanvas) {
00611       DisconnectSelected();
00612       if (edCanvas)
00613          ConnectSelected(edCanvas);
00614       fConnectedCanvas = edCanvas;
00615    }
00616 }
00617 
00618 //______________________________________________________________________________
00619 TGeoManagerEditor::~TGeoManagerEditor()
00620 {
00621 // Destructor.
00622    TGCompositeFrame *cont;
00623    cont = (TGCompositeFrame*)fCategories->GetItem("General")->GetContainer();
00624    TGeoTabManager::Cleanup(cont);
00625    fCategories->GetItem("General")->SetCleanup(0);
00626    cont = (TGCompositeFrame*)fCategories->GetItem("Shapes")->GetContainer();
00627    TGeoTabManager::Cleanup(cont);
00628    fCategories->GetItem("Shapes")->SetCleanup(0);
00629    cont = (TGCompositeFrame*)fCategories->GetItem("Volumes")->GetContainer();
00630    TGeoTabManager::Cleanup(cont);
00631    fCategories->GetItem("Volumes")->SetCleanup(0);
00632    cont = (TGCompositeFrame*)fCategories->GetItem("Materials")->GetContainer();
00633    TGeoTabManager::Cleanup(cont);
00634    fCategories->GetItem("Materials")->SetCleanup(0);
00635    cont = (TGCompositeFrame*)fCategories->GetItem("Media")->GetContainer();
00636    TGeoTabManager::Cleanup(cont);
00637    fCategories->GetItem("Media")->SetCleanup(0);
00638    cont = (TGCompositeFrame*)fCategories->GetItem("Matrices")->GetContainer();
00639    TGeoTabManager::Cleanup(cont);
00640    fCategories->GetItem("Matrices")->SetCleanup(0);
00641 
00642    delete fExportOption[0]; delete fExportOption[1];
00643 
00644    Cleanup();   
00645 
00646    if (fTabMgr) {
00647       fTabMgr->GetVolumeTab()->Cleanup();
00648       delete fTabMgr;
00649    }   
00650 }
00651 
00652 //______________________________________________________________________________
00653 void TGeoManagerEditor::SelectedSlot(TVirtualPad* /*pad*/, TObject* obj, Int_t event)
00654 {
00655    // Connected to TCanvas::Selected. TGeoManagerEditor takes this
00656    // function from TGedEditor and only uses it if obj is a TGeoVolume.
00657 
00658    if (event == kButton1 && obj->InheritsFrom(TGeoVolume::Class())) {
00659       TGeoVolume* v = (TGeoVolume*) obj;
00660       fTabMgr->SetVolTabEnabled();
00661       fTabMgr->SetTab();
00662       fTabMgr->GetVolumeEditor(v);
00663       v->Draw();
00664    }
00665 }
00666 
00667 void TGeoManagerEditor::ConnectSelected(TCanvas *c)
00668 {
00669    // Connect to TCanvas::Selected.
00670 
00671    c->Connect("Selected(TVirtualPad*,TObject*,Int_t)", "TGeoManagerEditor",
00672               this, "SelectedSlot(TVirtualPad*,TObject*,Int_t)");
00673 }
00674 
00675 void TGeoManagerEditor::DisconnectSelected()
00676 {
00677    // Disconnect from TCanvas::Selected.
00678 
00679    if (fConnectedCanvas)
00680       Disconnect(fConnectedCanvas, "Selected(TVirtualPad*,TObject*,Int_t)",
00681                  this, "SelectedSlot(TVirtualPad*,TObject*,Int_t)");
00682 
00683 }
00684 
00685 //______________________________________________________________________________
00686 void TGeoManagerEditor::ConnectSignals2Slots()
00687 {
00688    // Connect signals to slots.
00689    fManagerName->Connect("TextChanged(const char *)", "TGeoManagerEditor", this, "DoName()");
00690    fManagerTitle->Connect("TextChanged(const char *)", "TGeoManagerEditor", this, "DoName()");
00691    fExportButton->Connect("Clicked()", "TGeoManagerEditor", this, "DoExportGeometry()");
00692    fCloseGeometry->Connect("Clicked()", "TGeoManagerEditor", this, "DoCloseGeometry()");
00693    fShapeButton[0]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateBox()");
00694    fShapeButton[1]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreatePara()");
00695    fShapeButton[2]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateTrd1()");
00696    fShapeButton[3]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateTrd2()");
00697    fShapeButton[4]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateTrap()");
00698    fShapeButton[5]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateGtra()");
00699    fShapeButton[6]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateXtru()");
00700    fShapeButton[7]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateArb8()");
00701    fShapeButton[8]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateTube()");
00702    fShapeButton[9]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateTubs()");
00703    fShapeButton[10]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateCone()");
00704    fShapeButton[11]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateCons()");
00705    fShapeButton[12]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateSphe()");
00706    fShapeButton[13]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateCtub()");
00707    fShapeButton[14]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateEltu()");
00708    fShapeButton[15]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateTorus()");
00709    fShapeButton[16]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreatePcon()");
00710    fShapeButton[17]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreatePgon()");
00711    fShapeButton[18]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateHype()");
00712    fShapeButton[19]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateParab()");
00713    fShapeButton[20]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateComposite()");
00714    fMatrixButton[0]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateTranslation()");
00715    fMatrixButton[1]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateRotation()");
00716    fMatrixButton[2]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateCombi()");
00717    fVolumeButton[0]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateVolume()");
00718    fVolumeButton[1]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateAssembly()");
00719    fBSelTop->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectTopVolume()");
00720    fBSelVolume->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectVolume()");
00721    fBSelShape->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectShape()");
00722    fBSelShape2->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectShape2()");
00723    fBSelMatrix->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectMatrix()");
00724    fBSelMaterial->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectMaterial()");
00725    fBSelMaterial2->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectMaterial2()");
00726    fBSelMedium->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectMedium()");
00727    fBSelMedium2->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectMedium2()");
00728    fSetTopVolume->Connect("Clicked()", "TGeoManagerEditor", this, "DoSetTopVolume()");
00729    fEditShape->Connect("Clicked()", "TGeoManagerEditor", this, "DoEditShape()");
00730    fEditMedium->Connect("Clicked()", "TGeoManagerEditor", this, "DoEditMedium()");
00731    fEditMaterial->Connect("Clicked()", "TGeoManagerEditor", this, "DoEditMaterial()");
00732    fEditMatrix->Connect("Clicked()", "TGeoManagerEditor", this, "DoEditMatrix()");
00733    fEditVolume->Connect("Clicked()", "TGeoManagerEditor", this, "DoEditVolume()");
00734    
00735    fMaterialButton[0]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateMaterial()");
00736    fMaterialButton[1]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateMixture()");
00737    fMediumButton->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateMedium()");
00738 }
00739 
00740 //______________________________________________________________________________
00741 void TGeoManagerEditor::SetModel(TObject* obj)
00742 {
00743    // Refresh editor according the selected obj.
00744    fGeometry = (TGeoManager*)obj;
00745    fManagerName->SetText(fGeometry->GetName());
00746    fManagerTitle->SetText(fGeometry->GetTitle());
00747    fMatrixName->SetText(TString::Format("matrix%i", fGeometry->GetListOfMatrices()->GetEntries()));
00748    fMaterialName->SetText(TString::Format("material%i", fGeometry->GetListOfMaterials()->GetSize()));
00749    fMediumName->SetText(TString::Format("medium%i", fGeometry->GetListOfMedia()->GetSize()));
00750    fVolumeName->SetText(TString::Format("volume%i", fGeometry->GetListOfVolumes()->GetEntries()));
00751    // Check if master volume can be set
00752    if (fGeometry->GetMasterVolume()) fSetTopVolume->SetEnabled(kFALSE);
00753    else fSetTopVolume->SetEnabled(kTRUE);
00754    // Check if geometry is already closed
00755    if (!fGeometry->IsClosed()) fCloseGeometry->SetEnabled(kTRUE);
00756    else {
00757       fCloseGeometry->SetEnabled(kFALSE);
00758       fBSelTop->SetEnabled(kFALSE);
00759    }   
00760    // Check if volumes category can be activated
00761    if (!fGeometry->GetListOfShapes()->GetEntries() || !fGeometry->GetListOfMedia()->GetSize())
00762       fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kFALSE);
00763    else    
00764       fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
00765    if (!fGeometry->GetListOfShapes()->GetEntries()) ShowSelectShape(kFALSE);
00766    else ShowSelectShape();
00767    if (!fGeometry->GetListOfVolumes()->GetEntries()) ShowSelectVolume(kFALSE);
00768    else ShowSelectVolume();
00769    if (!fGeometry->GetListOfMedia()->GetSize()) ShowSelectMedium(kFALSE);
00770    else ShowSelectMedium();
00771    if (!fGeometry->GetListOfMatrices()->GetEntries()) ShowSelectMatrix(kFALSE);
00772    else ShowSelectMatrix();
00773 
00774    // Check if media category can be activated
00775    if (!fGeometry->GetListOfMaterials()->GetSize()) {
00776       fCategories->GetItem("Media")->GetButton()->SetEnabled(kFALSE);
00777       ShowSelectMaterial(kFALSE);
00778    } else {
00779       fCategories->GetItem("Media")->GetButton()->SetEnabled(kTRUE);
00780       ShowSelectMaterial();
00781    }   
00782    
00783    fTab->SetTab(0);
00784    fCategories->Layout();
00785    if (fTabMgr == 0) {
00786       fTabMgr = TGeoTabManager::GetMakeTabManager(fGedEditor);
00787       fTabMgr->fVolumeTab  = fVolumeTab;
00788    }
00789    if (fInit) ConnectSignals2Slots();
00790    // SetActive();
00791 }
00792 
00793 //______________________________________________________________________________
00794 void TGeoManagerEditor::DoName()
00795 {
00796 // Change name/title of the geometry
00797    fGeometry->SetName(fManagerName->GetText());
00798    fGeometry->SetTitle(fManagerTitle->GetText());
00799 }
00800 
00801 //______________________________________________________________________________
00802 void TGeoManagerEditor::DoExportGeometry()
00803 {
00804 // Export geometry as .root or .C file
00805    Bool_t asroot = fExportOption[0]->IsDown();
00806    TString s = fGeometry->GetName();
00807    s = s.Strip();
00808    s.Remove(20);
00809    const char *name;
00810    if (asroot) name = TString::Format("%s.root", s.Data());
00811    else        name = TString::Format("%s.C", s.Data());
00812    fGeometry->Export(name);
00813 }
00814 
00815 //______________________________________________________________________________
00816 void TGeoManagerEditor::DoCreateBox()
00817 {
00818 // Create a box.
00819    Int_t id = gGeoManager->GetListOfShapes()->GetEntries();
00820    fSelectedShape = new TGeoBBox(TString::Format("box_%i",id), 1., 1., 1.);
00821    ShowSelectShape();
00822    // Check if volumes category can be activated
00823    if (fGeometry->GetListOfMedia()->GetSize())
00824       fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
00825    DoEditShape();
00826 }
00827 
00828 //______________________________________________________________________________
00829 void TGeoManagerEditor::DoCreatePara()
00830 {
00831 // Create a parallelipiped.
00832    Int_t id = gGeoManager->GetListOfShapes()->GetEntries();
00833    fSelectedShape = new TGeoPara(TString::Format("para_%i",id), 1., 1., 1., 30., 20., 45.);
00834    ShowSelectShape();
00835    if (fGeometry->GetListOfMedia()->GetSize())
00836       fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
00837    DoEditShape();
00838 }
00839 
00840 //______________________________________________________________________________
00841 void TGeoManagerEditor::DoCreateTrd1()
00842 {
00843 // Create a Trd1.
00844    Int_t id = gGeoManager->GetListOfShapes()->GetEntries();
00845    fSelectedShape = new TGeoTrd1(TString::Format("trd1_%i",id), 0.5, 1., 1., 1.);
00846    ShowSelectShape();
00847    if (fGeometry->GetListOfMedia()->GetSize())
00848       fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
00849    DoEditShape();
00850 }
00851 
00852 //______________________________________________________________________________
00853 void TGeoManagerEditor::DoCreateTrd2()
00854 {
00855 // Create a Trd2.
00856    Int_t id = gGeoManager->GetListOfShapes()->GetEntries();
00857    fSelectedShape = new TGeoTrd2(TString::Format("trd2_%i",id), 0.5, 1., 0.5, 1., 1.);
00858    ShowSelectShape();
00859    if (fGeometry->GetListOfMedia()->GetSize())
00860       fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
00861    DoEditShape();
00862 }
00863 
00864 //______________________________________________________________________________
00865 void TGeoManagerEditor::DoCreateTrap()
00866 {
00867 // Create a general trapezoid.
00868    Int_t id = gGeoManager->GetListOfShapes()->GetEntries();
00869    fSelectedShape = new TGeoTrap(TString::Format("trap_%i",id), 1., 15., 45., 0.5, 0.3, 0.5, 30., 0.5, 0.3, 0.5, 30.);
00870    ShowSelectShape();
00871    if (fGeometry->GetListOfMedia()->GetSize())
00872       fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
00873    DoEditShape();
00874 }
00875 
00876 //______________________________________________________________________________
00877 void TGeoManagerEditor::DoCreateGtra()
00878 {
00879 // Create a twisted trapezoid.
00880    Int_t id = gGeoManager->GetListOfShapes()->GetEntries();
00881    fSelectedShape = new TGeoGtra(TString::Format("gtra_%i",id), 1., 15., 45., 45.,0.5, 0.3, 0.5, 30., 0.5, 0.3, 0.5, 30.);
00882    ShowSelectShape();
00883    if (fGeometry->GetListOfMedia()->GetSize())
00884       fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
00885    DoEditShape();
00886 }
00887 
00888 //______________________________________________________________________________
00889 void TGeoManagerEditor::DoCreateXtru()
00890 {
00891 // Create an extruded polygone.
00892 }
00893 
00894 //______________________________________________________________________________
00895 void TGeoManagerEditor::DoCreateArb8()
00896 {
00897 // Create an arbitrary polygone with maximum 8 vertices sitting on 2 parallel
00898 // planes
00899 }
00900 
00901 //______________________________________________________________________________
00902 void TGeoManagerEditor::DoCreateTube()
00903 {
00904 // Create a tube.
00905    Int_t id = gGeoManager->GetListOfShapes()->GetEntries();
00906    fSelectedShape = new TGeoTube(TString::Format("tube_%i",id), 0.5, 1., 1.);
00907    ShowSelectShape();
00908    if (fGeometry->GetListOfMedia()->GetSize())
00909       fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
00910    DoEditShape();
00911 }
00912 
00913 //______________________________________________________________________________
00914 void TGeoManagerEditor::DoCreateTubs()
00915 {
00916 // Create a tube segment.
00917    Int_t id = gGeoManager->GetListOfShapes()->GetEntries();
00918    fSelectedShape = new TGeoTubeSeg(TString::Format("tubs_%i",id), 0.5, 1., 1.,0.,45.);
00919    ShowSelectShape();
00920    if (fGeometry->GetListOfMedia()->GetSize())
00921       fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
00922    DoEditShape();
00923 }
00924 
00925 //______________________________________________________________________________
00926 void TGeoManagerEditor::DoCreateCone()
00927 {
00928 // Create a cone.
00929    Int_t id = gGeoManager->GetListOfShapes()->GetEntries();
00930    fSelectedShape = new TGeoCone(TString::Format("cone_%i",id), 0.5, 0.5, 1., 1.5, 2.);
00931    ShowSelectShape();
00932    if (fGeometry->GetListOfMedia()->GetSize())
00933       fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
00934    DoEditShape();
00935 }
00936 
00937 //______________________________________________________________________________
00938 void TGeoManagerEditor::DoCreateCons()
00939 {
00940 // Create a cone segment.
00941    Int_t id = gGeoManager->GetListOfShapes()->GetEntries();
00942    fSelectedShape = new TGeoConeSeg(TString::Format("cons_%i",id), 0.5, 0.5, 1., 1.5, 2.,0.,45.);
00943    ShowSelectShape();
00944    if (fGeometry->GetListOfMedia()->GetSize())
00945       fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
00946    DoEditShape();
00947 }
00948 
00949 //______________________________________________________________________________
00950 void TGeoManagerEditor::DoCreateSphe()
00951 {
00952 // Create a sphere.
00953    Int_t id = gGeoManager->GetListOfShapes()->GetEntries();
00954    fSelectedShape = new TGeoSphere(TString::Format("sphere_%i",id), 0.5, 1., 0., 180., 0.,360.);
00955    ShowSelectShape();
00956    if (fGeometry->GetListOfMedia()->GetSize())
00957       fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
00958    DoEditShape();   
00959 }
00960 
00961 //______________________________________________________________________________
00962 void TGeoManagerEditor::DoCreateCtub()
00963 {
00964 // Create a cut tube.
00965    Int_t id = gGeoManager->GetListOfShapes()->GetEntries();
00966    fSelectedShape = new TGeoCtub(TString::Format("ctub_%i",id), 0.5, 1., 1.,0.,45.,0.,0.,-1,0.,0.,1);
00967    ShowSelectShape();
00968    if (fGeometry->GetListOfMedia()->GetSize())
00969       fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
00970    DoEditShape();
00971 }
00972 
00973 //______________________________________________________________________________
00974 void TGeoManagerEditor::DoCreateEltu()
00975 {
00976 // Create an eliptical tube.
00977    Int_t id = gGeoManager->GetListOfShapes()->GetEntries();
00978    fSelectedShape = new TGeoEltu(TString::Format("para_%i",id), 1., 2., 1.5 );
00979    ShowSelectShape();
00980    if (fGeometry->GetListOfMedia()->GetSize())
00981       fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
00982    DoEditShape();
00983 }
00984 
00985 //______________________________________________________________________________
00986 void TGeoManagerEditor::DoCreateTorus()
00987 {
00988 // Create a torus shape.
00989    Int_t id = gGeoManager->GetListOfShapes()->GetEntries();
00990    fSelectedShape = new TGeoTorus(TString::Format("torus_%i",id), 10., 1., 1.5, 0, 360.);
00991    ShowSelectShape();
00992    if (fGeometry->GetListOfMedia()->GetSize())
00993       fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
00994    DoEditShape();
00995 
00996 }
00997 
00998 //______________________________________________________________________________
00999 void TGeoManagerEditor::DoCreatePcon()
01000 {
01001 // Create a polycone shape.
01002    Int_t id = gGeoManager->GetListOfShapes()->GetEntries();
01003    fSelectedShape = new TGeoPcon(TString::Format("pcon_%i",id), 0., 360., 2);
01004    ((TGeoPcon*)fSelectedShape)->DefineSection(0, -1, 0.5, 1.);
01005    ((TGeoPcon*)fSelectedShape)->DefineSection(1, 1, 0.2, 0.5);
01006    ShowSelectShape();
01007    if (fGeometry->GetListOfMedia()->GetSize())
01008       fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
01009    DoEditShape();   
01010 }
01011 
01012 //______________________________________________________________________________
01013 void TGeoManagerEditor::DoCreatePgon()
01014 {
01015 // Create a polygone shape.
01016    Int_t id = gGeoManager->GetListOfShapes()->GetEntries();
01017    fSelectedShape = new TGeoPgon(TString::Format("pgon_%i",id), 0., 360.,6,2);
01018    ((TGeoPcon*)fSelectedShape)->DefineSection(0, -1, 0.5, 1.);
01019    ((TGeoPcon*)fSelectedShape)->DefineSection(1, 1, 0.2, 0.5);
01020    ShowSelectShape();
01021    if (fGeometry->GetListOfMedia()->GetSize())
01022       fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
01023    DoEditShape();   
01024 }
01025 
01026 //______________________________________________________________________________
01027 void TGeoManagerEditor::DoCreateHype()
01028 {
01029 // Create a hyperboloid.
01030    Int_t id = gGeoManager->GetListOfShapes()->GetEntries();
01031    fSelectedShape = new TGeoHype(TString::Format("hype_%i",id), 1., 15., 2., 30., 5.);
01032    ShowSelectShape();
01033    if (fGeometry->GetListOfMedia()->GetSize())
01034       fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
01035    DoEditShape();
01036 }
01037 
01038 //______________________________________________________________________________
01039 void TGeoManagerEditor::DoCreateParab()
01040 {
01041 // Create a paraboloid.
01042 }
01043 
01044 //______________________________________________________________________________
01045 void TGeoManagerEditor::DoCreateComposite()
01046 {
01047 // Create a composite shape.
01048 }
01049 
01050 //______________________________________________________________________________
01051 void TGeoManagerEditor::DoCreateMaterial()
01052 {
01053 // Create a new material.
01054    TGeoElement *el = fGeometry->GetElementTable()->GetElement(fElementList->GetSelected());
01055    Double_t density = fEntryDensity->GetNumber();
01056    const char *name = fMaterialName->GetText();
01057    fSelectedMaterial = new TGeoMaterial(name, el, density);
01058    ShowSelectMaterial();
01059    fCategories->GetItem("Media")->GetButton()->SetEnabled(kTRUE);
01060    DoEditMaterial();
01061    fMaterialName->SetText(TString::Format("material%i", fGeometry->GetListOfMaterials()->GetSize()));
01062 }
01063 
01064 //______________________________________________________________________________
01065 void TGeoManagerEditor::DoCreateMixture()
01066 {
01067 // Create a new mixture.
01068    Double_t density = fEntryDensity->GetNumber();
01069    const char *name = fMaterialName->GetText();
01070    fSelectedMaterial = new TGeoMixture(name, 1, density);
01071    ShowSelectMaterial();
01072    fCategories->GetItem("Media")->GetButton()->SetEnabled(kTRUE);
01073    DoEditMaterial();
01074    fMaterialName->SetText(TString::Format("material%i", fGeometry->GetListOfMaterials()->GetSize()));
01075 }
01076 
01077 //______________________________________________________________________________
01078 void TGeoManagerEditor::DoCreateMedium()
01079 {
01080 // Create a new medium.
01081    Int_t id = fMediumId->GetIntNumber();
01082    if (!fSelectedMaterial2) return;
01083    const char *name = fMediumName->GetText();
01084    fSelectedMedium = new TGeoMedium(name, id, fSelectedMaterial2);
01085    ShowSelectMedium();
01086    if (fGeometry->GetListOfShapes()->GetEntries())
01087       fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
01088    DoEditMedium();
01089    fMediumName->SetText(TString::Format("medium%i", fGeometry->GetListOfMedia()->GetSize()));
01090 }
01091 
01092 //______________________________________________________________________________
01093 void TGeoManagerEditor::DoCreateTranslation()
01094 {
01095 // Create a new translation.
01096    const char *name = fMatrixName->GetText();
01097    fSelectedMatrix = new TGeoTranslation(name, 0., 0., 0.);
01098    fSelectedMatrix->SetBit(TGeoMatrix::kGeoTranslation);
01099    fSelectedMatrix->RegisterYourself();
01100    ShowSelectMatrix();
01101    DoEditMatrix();
01102    fMatrixName->SetText(TString::Format("matrix%i", fGeometry->GetListOfMatrices()->GetEntries()));
01103 }   
01104 
01105 //______________________________________________________________________________
01106 void TGeoManagerEditor::DoCreateRotation()
01107 {
01108 // Create a new rotation.
01109    const char *name = fMatrixName->GetText();
01110    fSelectedMatrix = new TGeoRotation(name);
01111    fSelectedMatrix->SetBit(TGeoMatrix::kGeoRotation);
01112    fSelectedMatrix->RegisterYourself();
01113    ShowSelectMatrix();
01114    DoEditMatrix();
01115    fMatrixName->SetText(TString::Format("matrix%i", fGeometry->GetListOfMatrices()->GetEntries()));
01116 }   
01117 
01118 //______________________________________________________________________________
01119 void TGeoManagerEditor::DoCreateVolume()
01120 {
01121 // Create a new volume.
01122    const char *name = fVolumeName->GetText();
01123    if (!fSelectedShape2 || !fSelectedMedium2) return;
01124    fSelectedVolume = new TGeoVolume(name, fSelectedShape2, fSelectedMedium2);
01125    fLSelVolume->SetText(name);
01126    ShowSelectVolume();
01127    DoEditVolume();
01128    fVolumeName->SetText(TString::Format("volume%i", fGeometry->GetListOfVolumes()->GetEntries()));
01129 }   
01130 
01131 //______________________________________________________________________________
01132 void TGeoManagerEditor::DoCreateAssembly()
01133 {
01134 // Create a new volume assembly.
01135    const char *name = fVolumeName->GetText();
01136    fSelectedVolume = new TGeoVolumeAssembly(name);
01137    fLSelVolume->SetText(name);
01138    ShowSelectVolume();
01139    DoEditVolume();
01140    fVolumeName->SetText(TString::Format("volume%i", fGeometry->GetListOfVolumes()->GetEntries()));
01141 }   
01142 
01143 //______________________________________________________________________________
01144 void TGeoManagerEditor::DoCreateCombi()
01145 {
01146 // Create a new translation + rotation.
01147    const char *name = fMatrixName->GetText();
01148    fSelectedMatrix = new TGeoCombiTrans(name, 0., 0., 0., new TGeoRotation());
01149    fSelectedMatrix->RegisterYourself();
01150    fSelectedMatrix->SetBit(TGeoMatrix::kGeoTranslation);
01151    fSelectedMatrix->SetBit(TGeoMatrix::kGeoRotation);
01152    ShowSelectMatrix();
01153    DoEditMatrix();
01154    fMatrixName->SetText(TString::Format("matrix%i", fGeometry->GetListOfMatrices()->GetEntries()));
01155 }   
01156 
01157 //______________________________________________________________________________
01158 void TGeoManagerEditor::DoSetTopVolume()
01159 {
01160 // Set top volume for the geometry.
01161    if (!fSelectedVolume) return;
01162    fGeometry->SetTopVolume(fSelectedVolume);
01163    fSetTopVolume->SetEnabled(kFALSE);
01164 }      
01165 
01166 //______________________________________________________________________________
01167 void TGeoManagerEditor::DoEditShape()
01168 {
01169 // Slot for editing selected shape.
01170    if (!fSelectedShape) return;
01171    fTabMgr->GetShapeEditor(fSelectedShape);
01172    fSelectedShape->Draw();
01173    fTabMgr->GetPad()->GetView()->ShowAxis();
01174 }
01175 
01176 //______________________________________________________________________________
01177 void TGeoManagerEditor::DoEditVolume()
01178 {
01179 // Slot for editing selected volume.
01180    if (!fSelectedVolume) {
01181       fTabMgr->SetVolTabEnabled(kFALSE);
01182       return;
01183    }   
01184    fTabMgr->SetVolTabEnabled();
01185    fTabMgr->SetTab();
01186    fTabMgr->GetVolumeEditor(fSelectedVolume);
01187    fSelectedVolume->Draw();
01188 }
01189 
01190 //______________________________________________________________________________
01191 void TGeoManagerEditor::DoEditMedium()
01192 {
01193 // Slot for editing selected medium.
01194    if (!fSelectedMedium) return;
01195    fTabMgr->GetMediumEditor(fSelectedMedium);
01196 }
01197 
01198 //______________________________________________________________________________
01199 void TGeoManagerEditor::DoEditMaterial()
01200 {
01201 // Slot for editing selected material.
01202    if (!fSelectedMaterial) return;
01203    fTabMgr->GetMaterialEditor(fSelectedMaterial);
01204 } 
01205 
01206 //______________________________________________________________________________
01207 void TGeoManagerEditor::DoEditMatrix()
01208 {
01209 // Slot for editing selected matrix.
01210    if (!fSelectedMatrix) return;
01211    fTabMgr->GetMatrixEditor(fSelectedMatrix);
01212 }
01213 
01214 //______________________________________________________________________________
01215 void TGeoManagerEditor::DoSelectMatrix()
01216 {
01217 // Slot for selecting an existing matrix.
01218    TGeoMatrix *matrix = fSelectedMatrix;
01219    new TGeoMatrixDialog(fBSelMatrix, gClient->GetRoot(), 200,300);  
01220    fSelectedMatrix = (TGeoMatrix*)TGeoMatrixDialog::GetSelected();
01221    if (fSelectedMatrix) fLSelMatrix->SetText(fSelectedMatrix->GetName());
01222    else fSelectedMatrix = matrix;
01223 }
01224 
01225 //______________________________________________________________________________
01226 void TGeoManagerEditor::DoSelectShape()
01227 {
01228 // Slot for selecting an existing shape.
01229    TGeoShape *shape = fSelectedShape;
01230    new TGeoShapeDialog(fBSelShape, gClient->GetRoot(), 200,300);  
01231    fSelectedShape = (TGeoShape*)TGeoShapeDialog::GetSelected();
01232    if (fSelectedShape) fLSelShape->SetText(fSelectedShape->GetName());
01233    else fSelectedShape = shape;
01234 }
01235 
01236 //______________________________________________________________________________
01237 void TGeoManagerEditor::DoSelectShape2()
01238 {
01239 // Slot for selecting a shape for making a volume.
01240    TGeoShape *shape = fSelectedShape2;
01241    new TGeoShapeDialog(fBSelShape2, gClient->GetRoot(), 200,300);  
01242    fSelectedShape2 = (TGeoShape*)TGeoShapeDialog::GetSelected();
01243    if (fSelectedShape2) fLSelShape2->SetText(fSelectedShape2->GetName());
01244    else fSelectedShape2 = shape;
01245 }
01246 
01247 //______________________________________________________________________________
01248 void TGeoManagerEditor::DoSelectMaterial()
01249 {
01250 // Slot for selecting an existing material.
01251    TGeoMaterial *mat = fSelectedMaterial;
01252    new TGeoMaterialDialog(fBSelMaterial, gClient->GetRoot(), 200,300);  
01253    fSelectedMaterial = (TGeoMaterial*)TGeoMaterialDialog::GetSelected();
01254    if (fSelectedMaterial) fLSelMaterial->SetText(fSelectedMaterial->GetName());
01255    else fSelectedMaterial = mat;
01256 }
01257 
01258 //______________________________________________________________________________
01259 void TGeoManagerEditor::DoSelectMaterial2()
01260 {
01261 // Slot for selecting an existing material and making a medium.
01262    TGeoMaterial *mat = fSelectedMaterial2;
01263    new TGeoMaterialDialog(fBSelMaterial2, gClient->GetRoot(), 200,300);  
01264    fSelectedMaterial2 = (TGeoMaterial*)TGeoMaterialDialog::GetSelected();
01265    if (fSelectedMaterial2) fLSelMaterial2->SetText(fSelectedMaterial2->GetName());
01266    else fSelectedMaterial2 = mat;
01267 }
01268 
01269 //______________________________________________________________________________
01270 void TGeoManagerEditor::DoSelectMedium()
01271 {
01272 // Slot for selecting an existing medium.
01273    TGeoMedium *med = fSelectedMedium;
01274    new TGeoMediumDialog(fBSelMedium, gClient->GetRoot(), 200,300);  
01275    fSelectedMedium = (TGeoMedium*)TGeoMediumDialog::GetSelected();
01276    if (fSelectedMedium) fLSelMedium->SetText(fSelectedMedium->GetName());
01277    else fSelectedMedium = med;
01278 }
01279 
01280 //______________________________________________________________________________
01281 void TGeoManagerEditor::DoSelectMedium2()
01282 {
01283 // Slot for selecting an existing medium for making a volume.
01284    TGeoMedium *med = fSelectedMedium2;
01285    new TGeoMediumDialog(fBSelMedium2, gClient->GetRoot(), 200,300);  
01286    fSelectedMedium2 = (TGeoMedium*)TGeoMediumDialog::GetSelected();
01287    if (fSelectedMedium2) fLSelMedium2->SetText(fSelectedMedium2->GetName());
01288    else fSelectedMedium2 = med;
01289 }
01290 
01291 //______________________________________________________________________________
01292 void TGeoManagerEditor::DoSelectVolume()
01293 {
01294 // Slot for selecting an existing volume.
01295    TGeoVolume *vol = fSelectedVolume;
01296    new TGeoVolumeDialog(fBSelVolume, gClient->GetRoot(), 200,300);  
01297    fSelectedVolume = (TGeoVolume*)TGeoVolumeDialog::GetSelected();
01298    if (fSelectedVolume) fLSelVolume->SetText(fSelectedVolume->GetName());
01299    else fSelectedVolume = vol;
01300 }
01301 
01302 //______________________________________________________________________________
01303 void TGeoManagerEditor::DoSelectTopVolume()
01304 {
01305 // Slot for seting top geometry volume.
01306    TGeoVolume *vol = fGeometry->GetTopVolume();
01307    new TGeoVolumeDialog(fBSelTop, gClient->GetRoot(), 200,300);  
01308    fSelectedVolume = (TGeoVolume*)TGeoVolumeDialog::GetSelected();
01309    if (fSelectedVolume) fLSelTop->SetText(fSelectedVolume->GetName());
01310    else fSelectedVolume = vol;
01311    if (fSelectedVolume && (fSelectedVolume != vol)) fGeometry->SetTopVolume(fSelectedVolume);
01312 }
01313 
01314 //______________________________________________________________________________
01315 void TGeoManagerEditor::DoCloseGeometry()
01316 {
01317 // Slot for closing the geometry.
01318    if (!fGeometry->IsClosed()) fGeometry->CloseGeometry();
01319    fCloseGeometry->SetEnabled(kFALSE);
01320 }
01321    
01322 //______________________________________________________________________________
01323 void TGeoManagerEditor::ShowSelectShape(Bool_t show)
01324 {
01325 // Show/hide interface for shape selection.
01326    TGCompositeFrame *cont = (TGCompositeFrame*)fCategories->GetItem("Shapes")->GetContainer();
01327    if (show) cont->ShowFrame(f2);
01328    else      cont->HideFrame(f2);
01329 }
01330    
01331 //______________________________________________________________________________
01332 void TGeoManagerEditor::ShowSelectVolume(Bool_t show)
01333 {
01334 // Show/hide interface for volume selection.
01335    TGCompositeFrame *cont = (TGCompositeFrame*)fCategories->GetItem("General")->GetContainer();
01336    if (show) cont->ShowFrame(f7);
01337    else      cont->HideFrame(f7);
01338    cont = (TGCompositeFrame*)fCategories->GetItem("Volumes")->GetContainer();
01339    if (show) cont->ShowFrame(f3);
01340    else      cont->HideFrame(f3);
01341 }
01342    
01343 //______________________________________________________________________________
01344 void TGeoManagerEditor::ShowSelectMaterial(Bool_t show)
01345 {
01346 // Show/hide interface for material selection.
01347    TGCompositeFrame *cont = (TGCompositeFrame*)fCategories->GetItem("Materials")->GetContainer();
01348    if (show) cont->ShowFrame(f4);
01349    else      cont->HideFrame(f4);
01350 }
01351    
01352 //______________________________________________________________________________
01353 void TGeoManagerEditor::ShowSelectMedium(Bool_t show)
01354 {
01355 // Show/hide interface for medium selection.
01356    TGCompositeFrame *cont = (TGCompositeFrame*)fCategories->GetItem("Media")->GetContainer();
01357    if (show) cont->ShowFrame(f5);
01358    else      cont->HideFrame(f5);
01359 }
01360    
01361 //______________________________________________________________________________
01362 void TGeoManagerEditor::ShowSelectMatrix(Bool_t show)
01363 {
01364 // Show/hide interface for matrix selection.
01365    TGCompositeFrame *cont = (TGCompositeFrame*)fCategories->GetItem("Matrices")->GetContainer();
01366    if (show) cont->ShowFrame(f6);
01367    else      cont->HideFrame(f6);
01368 }

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