// @(#):$Id$
// Author: M.Gheata 

/*************************************************************************
 * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

//______________________________________________________________________________
//                                                                      
//  TGeoMaterialEditor, TGeoMixtureEditor
// =======================================
//
//   Editors for materials and mixtures.                                                                      
//______________________________________________________________________________

#include "TGeoMaterialEditor.h"
#include "TGeoTabManager.h"
#include "TGeoMaterial.h"
#include "TGeoManager.h"
#include "TVirtualGeoPainter.h"
#include "TPad.h"
#include "TView.h"
#include "TGTab.h"
#include "TGComboBox.h"
#include "TGButton.h"
#include "TGTextEntry.h"
#include "TGNumberEntry.h"
#include "TGLabel.h"
#include "TGListView.h"

ClassImp(TGeoMaterialEditor)

enum ETGeoMaterialWid {
   kMATERIAL_NAME, kMATERIAL_A, kMATERIAL_Z, kMATERIAL_RHO,
   kMATERIAL_RAD, kMATERIAL_ABS, kMATERIAL_STATE, kMATERIAL_TEMP, kMATERIAL_PRES,
   kMATERIAL_APPLY, kMATERIAL_CANCEL, kMATERIAL_UNDO
};

enum ETGeoMaterialStates {
   kMAT_UNDEFINED, kMAT_SOLID, kMAT_LIQUID, kMAT_GAS
};   

enum ETGeoMixtureWid {
   kMIX_ELEM, kMIX_CHK1, kMIX_FRAC, kMIX_CHK2, kMIX_NATOMS, kMIX_ADDELEM
};

//______________________________________________________________________________
TGeoMaterialEditor::TGeoMaterialEditor(const TGWindow *p, Int_t width,
                                   Int_t height, UInt_t options, Pixel_t back)
   : TGeoGedFrame(p, width, height, options | kVerticalFrame, back)
{
   // Constructor for material editor.
   fMaterial   = 0;
   fAi = fZi = 0;
   fDensityi = 0.0;
   fNamei = "";
   fIsModified = kFALSE;
   fIsMaterialEditable = kTRUE;

   // TextEntry for material name
   MakeTitle("Name");
   fMaterialName = new TGTextEntry(this, new TGTextBuffer(50), kMATERIAL_NAME);
   fMaterialName->SetDefaultSize(135, fMaterialName->GetDefaultHeight());
   fMaterialName->SetToolTipText("Enter the material name");
   fMaterialName->Associate(this);
   AddFrame(fMaterialName, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 2, 5));

   TGTextEntry *nef;
   MakeTitle("Material properties");
   TGCompositeFrame *f1 = new TGCompositeFrame(this, 118, 10, kHorizontalFrame |
                                 kFixedWidth | kOwnBackground);
   f1->AddFrame(new TGLabel(f1, "A"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
   fMatA = new TGNumberEntry(f1, 0., 6, kMATERIAL_A, TGNumberFormat::kNESRealThree);
   nef = (TGTextEntry*)fMatA->GetNumberEntry();
   nef->SetToolTipText("Enter the atomic mass");
   fMatA->Associate(this);
   f1->AddFrame(fMatA, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
   f1->AddFrame(new TGLabel(f1, "Z"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
   fMatZ = new TGNumberEntry(f1, 0., 4, kMATERIAL_Z, TGNumberFormat::kNESInteger);
   nef = (TGTextEntry*)fMatZ->GetNumberEntry();
   nef->SetToolTipText("Enter the atomic charge");
   fMatZ->Associate(this);
   f1->AddFrame(fMatZ, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
   f1->Resize(150,30);
   AddFrame(f1, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
   
   
   TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame | kDoubleBorder);
   // Combo box for material state
   f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame |
                             kLHintsExpandX | kFixedWidth | kOwnBackground);
   f1->AddFrame(new TGLabel(f1, "State"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
   fMatState = new TGComboBox(f1, kMATERIAL_STATE);
   fMatState->AddEntry("Undefined", TGeoMaterial::kMatStateUndefined);
   fMatState->AddEntry("Solid", TGeoMaterial::kMatStateSolid);
   fMatState->AddEntry("Liquid", TGeoMaterial::kMatStateLiquid);
   fMatState->AddEntry("Gas", TGeoMaterial::kMatStateGas);
   fMatState->Resize(90, fMaterialName->GetDefaultHeight());
   f1->AddFrame(fMatState, new TGLayoutHints(kLHintsRight , 2, 2, 1, 1));
   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 1, 1));

   // Number entry for density
   f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame |
                             kLHintsExpandX | kFixedWidth | kOwnBackground);
   f1->AddFrame(new TGLabel(f1, "Density"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
   fMatDensity = new TGNumberEntry(f1, 0., 5, kMATERIAL_RHO, TGNumberFormat::kNESRealThree);
   fMatDensity->Resize(90, fMaterialName->GetDefaultHeight());
   nef = (TGTextEntry*)fMatDensity->GetNumberEntry();
   nef->SetToolTipText("Enter material density in [g/cm3]");
   fMatDensity->Associate(this);
   f1->AddFrame(fMatDensity, new TGLayoutHints(kLHintsRight, 2, 2, 1, 1));
   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 1, 1));
   
   // Number entry for temperature
   f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame |
                             kLHintsExpandX | kFixedWidth | kOwnBackground);
   f1->AddFrame(new TGLabel(f1, "Temperature"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
   fMatTemperature = new TGNumberEntry(f1, 0., 5, kMATERIAL_TEMP, TGNumberFormat::kNESRealTwo);
   fMatTemperature->Resize(90, fMaterialName->GetDefaultHeight());
   nef = (TGTextEntry*)fMatTemperature->GetNumberEntry();
   nef->SetToolTipText("Enter material temperature in [Kelvin]");
   fMatTemperature->Associate(this);
   f1->AddFrame(fMatTemperature, new TGLayoutHints(kLHintsRight, 2, 2, 1, 1));
   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 1, 1));

   // Number entry for pressure
   f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame |
                             kLHintsExpandX | kFixedWidth | kOwnBackground);
   f1->AddFrame(new TGLabel(f1, "Pressure"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
   fMatPressure = new TGNumberEntry(f1, 0., 5, kMATERIAL_PRES, TGNumberFormat::kNESRealThree);
   fMatPressure->Resize(90, fMaterialName->GetDefaultHeight());
   nef = (TGTextEntry*)fMatPressure->GetNumberEntry();
   nef->SetToolTipText("Enter material pressure in [bar]");
   fMatPressure->Associate(this);
   f1->AddFrame(fMatPressure, new TGLayoutHints(kLHintsRight, 2, 2, 1, 1));
   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 1, 1));

   // Number entry for radiation length
   f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame |
                             kLHintsExpandX | kFixedWidth | kOwnBackground);
   f1->AddFrame(new TGLabel(f1, "RadLen"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
   fMatRadLen = new TGNumberEntry(f1, 0., 5, kMATERIAL_RAD);
   fMatRadLen->Resize(90, fMaterialName->GetDefaultHeight());
   nef = (TGTextEntry*)fMatRadLen->GetNumberEntry();
   nef->SetToolTipText("Computed radiation length");
   fMatRadLen->Associate(this);
   f1->AddFrame(fMatRadLen, new TGLayoutHints(kLHintsRight, 2, 2, 1, 1));
   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 1, 1));
   
   // Number entry for absorbtion length
   f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame |
                             kLHintsExpandX | kFixedWidth | kOwnBackground);
   f1->AddFrame(new TGLabel(f1, "AbsLen"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
   fMatAbsLen = new TGNumberEntry(f1, 0., 5, kMATERIAL_ABS);
   fMatAbsLen->Resize(90, fMaterialName->GetDefaultHeight());
   nef = (TGTextEntry*)fMatAbsLen->GetNumberEntry();
   nef->SetToolTipText("Absorbtion length");
   fMatAbsLen->Associate(this);
   f1->AddFrame(fMatAbsLen, new TGLayoutHints(kLHintsRight, 2, 2, 1, 1));
   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 1, 1));
      
   compxyz->Resize(150,30);
   AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 0, 0, 2, 2));

   // Buttons
   f23 = new TGCompositeFrame(this, 118, 20, kHorizontalFrame | kSunkenFrame | kDoubleBorder);
   fApply = new TGTextButton(f23, "Apply");
   f23->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 1, 1));
   fApply->Associate(this);
   fUndo = new TGTextButton(f23, " Undo ");
   f23->AddFrame(fUndo, new TGLayoutHints(kLHintsRight , 2, 2, 1, 1));
   fUndo->Associate(this);
   AddFrame(f23,  new TGLayoutHints(kLHintsLeft, 0, 0, 4, 4));  
   fUndo->SetSize(fApply->GetSize());
}

//______________________________________________________________________________
TGeoMaterialEditor::~TGeoMaterialEditor()
{
// Destructor
   TGFrameElement *el;
   TIter next(GetList());
   while ((el = (TGFrameElement *)next())) {
      if (el->fFrame->IsComposite()) 
         TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame);
   }
   Cleanup();   
}

//______________________________________________________________________________
void TGeoMaterialEditor::ConnectSignals2Slots()
{
   // Connect signals to slots.
   fApply->Connect("Clicked()", "TGeoMaterialEditor", this, "DoApply()");
   fUndo->Connect("Clicked()", "TGeoMaterialEditor", this, "DoUndo()");
   fMaterialName->Connect("TextChanged(const char *)", "TGeoMaterialEditor", this, "DoName()");
   fMatA->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoA()");
   fMatZ->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoZ()");
   fMatState->Connect("Selected(Int_t)", "TGeoMaterialEditor", this, "DoState(Int_t)");
   fMatDensity->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoDensity()");
   fMatTemperature->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoTemperature()");
   fMatPressure->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoPressure()");
   fMatRadLen->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoRadAbs()");
   fMatAbsLen->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoRadAbs()");
   fInit = kFALSE;
}

//______________________________________________________________________________
void TGeoMaterialEditor::SetModel(TObject* obj)
{
   // Connect to the selected material.
   if (obj == 0 || !(obj->InheritsFrom(TGeoMaterial::Class()))) {
      SetActive(kFALSE);
      return;                 
   } 
   fMaterial = (TGeoMaterial*)obj;
   fAi = fMaterial->GetA();
   fZi = (Int_t)fMaterial->GetZ();
   fStatei = (Int_t)fMaterial->GetState();
   fDensityi = fMaterial->GetDensity();
   fTempi = fMaterial->GetTemperature();
   fPresi = fMaterial->GetPressure()/6.2415e+8;
   fNamei = fMaterial->GetName();
   fMaterialName->SetText(fMaterial->GetName());
   fMatA->SetNumber(fAi);
   fMatZ->SetNumber(fZi);
   fMatState->Select(fStatei);
   fMatDensity->SetNumber(fDensityi);
   fMatTemperature->SetNumber(fTempi);
   fMatPressure->SetNumber(fPresi);
   fMatRadLen->SetNumber(fMaterial->GetRadLen());
   fMatAbsLen->SetNumber(fMaterial->GetIntLen());
   fApply->SetEnabled(kFALSE);
   fUndo->SetEnabled(kFALSE);
   
   if (fInit) ConnectSignals2Slots();
   SetActive();
}

//______________________________________________________________________________
void TGeoMaterialEditor::DoName()
{
// Perform name change.
   DoModified();
}

//______________________________________________________________________________
void TGeoMaterialEditor::DoA()
{
// Slot for atomic mass.
   if (fMaterial->IsMixture()) {
      fMatA->SetNumber(fMaterial->GetA());
      return;
   }   
   DoModified();
}

//______________________________________________________________________________
void TGeoMaterialEditor::DoZ()
{
// Slot for charge.
   if (fMaterial->IsMixture()) {
      fMatZ->SetNumber(fMaterial->GetZ());
      return;
   }   
   Int_t z = (Int_t)fMatZ->GetNumber();
   TGeoElementTable *table = gGeoManager->GetElementTable();
   if (z >= table->GetNelements()) {
      z = table->GetNelements()-1;
      fMatZ->SetNumber(z);
   }   
   TGeoElement *elem = table->GetElement(z);
   if (!elem) return;
   Double_t a = elem->A();
   fMatA->SetNumber(a);
   DoModified();
}

//______________________________________________________________________________
void TGeoMaterialEditor::DoState(Int_t /*state*/)
{
// Slot for material state.
   DoModified();
}

//______________________________________________________________________________
void TGeoMaterialEditor::DoTemperature()
{
// Slot for material temperature.
   DoModified();
}

//______________________________________________________________________________
void TGeoMaterialEditor::DoPressure()
{
// Slot for material pressure.
   DoModified();
}

//______________________________________________________________________________
void TGeoMaterialEditor::DoDensity()
{
// Slot for density.
//   fMatDensity->SetNumber(fDensityi);
   DoModified();
}

//______________________________________________________________________________
void TGeoMaterialEditor::DoRadAbs()
{
// Slot for radiation/absorbtion length. 
   fMatRadLen->SetNumber(fMaterial->GetRadLen());
   fMatAbsLen->SetNumber(fMaterial->GetIntLen());
   DoModified();
}

//______________________________________________________________________________
void TGeoMaterialEditor::DoApply()
{
// Slot for applying modifications.
   const char *name = fMaterialName->GetText();
   fMaterial->SetName(name);
   
   fMaterial->SetA(fMatA->GetNumber());
   fMaterial->SetZ(fMatZ->GetNumber());
   fMaterial->SetDensity(fMatDensity->GetNumber());
   fMaterial->SetTemperature(fMatTemperature->GetNumber());
   fMaterial->SetPressure(6.2415e+8*fMatPressure->GetNumber());
   fMaterial->SetState((TGeoMaterial::EGeoMaterialState)fMatState->GetSelected());
   fMaterial->SetRadLen(fMatRadLen->GetNumber(), fMatAbsLen->GetNumber());
   fMatRadLen->SetNumber(fMaterial->GetRadLen());
   fMatAbsLen->SetNumber(fMaterial->GetIntLen());
   fUndo->SetEnabled();
   fApply->SetEnabled(kFALSE);
}

//______________________________________________________________________________
void TGeoMaterialEditor::DoUndo()
{
// Slot for cancelling current modifications.
   fMaterialName->SetText(fNamei.Data());
   fMaterial->SetName(fNamei.Data());
   fMatA->SetNumber(fAi);
   fMaterial->SetA(fAi);
   fMatZ->SetNumber(fZi);
   fMaterial->SetZ(fZi);
   fMatState->Select(fStatei);
   fMaterial->SetState((TGeoMaterial::EGeoMaterialState)fStatei);
   fMatDensity->SetNumber(fDensityi);
   fMaterial->SetDensity(fDensityi);
   fMatTemperature->SetNumber(fTempi);
   fMaterial->SetTemperature(fTempi);
   fMatPressure->SetNumber(fPresi);
   fMaterial->SetPressure(fPresi*6.2415e+8);
   fMatRadLen->SetNumber(fMaterial->GetRadLen());
   fMatAbsLen->SetNumber(fMaterial->GetIntLen());
   fApply->SetEnabled(kFALSE);
   fUndo->SetEnabled(kFALSE);
}

//______________________________________________________________________________
void TGeoMaterialEditor::DoModified()
{
// Slot for signaling modifications.
   fApply->SetEnabled();
}

ClassImp(TGeoMixtureEditor)

//______________________________________________________________________________
TGeoMixtureEditor::TGeoMixtureEditor(const TGWindow *p, Int_t width,
                                   Int_t height, UInt_t options, Pixel_t back)
   : TGeoMaterialEditor(p, width, height, options | kVerticalFrame, back)
{
   // Constructor for mixture editor.
   fMixture = 0;
   TGCompositeFrame *compxyz=0, *f1=0;
   TGTextEntry *nef;
   MakeTitle("Mixture settings");
   fNelem = new TGLabel(this, "Number of elements: 0");
   AddFrame(fNelem, new TGLayoutHints(kLHintsLeft , 6, 2, 2, 2));
   compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame | kDoubleBorder);
   // Combo box for selecting elements
   f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame |
                             kLHintsExpandX | kFixedWidth | kOwnBackground);
   fMixElem = new TGComboBox(f1, kMIX_ELEM);
   TGeoElementTable *table = gGeoManager->GetElementTable();
   if (table) {
      TGeoElement *element;
      for (Int_t i=0; i<table->GetNelements(); i++) {
         element = table->GetElement(i);
         if (element) fMixElem->AddEntry(element->GetTitle(),i);
      }
   }      
   fMixElem->Select(0);
   fMixElem->Resize(90, fMaterialName->GetDefaultHeight());
   f1->AddFrame(fMixElem, new TGLayoutHints(kLHintsLeft , 2, 2, 1, 1));
   TGCompositeFrame *comp1 = new TGCompositeFrame(f1, 118, 30, kVerticalFrame);
   fAelem = new TGLabel(comp1, "A = 0");
   comp1->AddFrame(fAelem, new TGLayoutHints(kLHintsRight , 2, 2, 2, 0));
   fZelem = new TGLabel(comp1, "Z = 0");
   comp1->AddFrame(fZelem, new TGLayoutHints(kLHintsRight , 2, 2, 2, 0));
   f1->AddFrame(comp1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX| kLHintsExpandY , 2, 2, 0, 0));
   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 0, 0));

   // Fraction by weight
   f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame |
                             kLHintsExpandX | kFixedWidth | kOwnBackground);
   fChkFraction = new TGCheckButton(f1, "% weight");
   fChkFraction->SetDown(kTRUE);
   f1->AddFrame(fChkFraction, new TGLayoutHints(kLHintsLeft , 2, 2, 6, 1));
   fNEFraction = new TGNumberEntry(f1, 0., 5, kMIX_FRAC, TGNumberFormat::kNESRealThree);
   fNEFraction->SetFormat(TGNumberFormat::kNESRealThree, TGNumberFormat::kNEANonNegative);
   fNEFraction->Resize(65, fMaterialName->GetDefaultHeight());
   nef = (TGTextEntry*)fNEFraction->GetNumberEntry();
   nef->SetToolTipText("Enter fraction by weight of this element");
   fNEFraction->SetNumber(0.);
   fNEFraction->Associate(this);
   f1->AddFrame(fNEFraction, new TGLayoutHints(kLHintsRight, 2, 2, 1, 1));
   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 1, 1));
   
   // Fraction by number of atoms
   f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame |
                             kLHintsExpandX | kFixedWidth | kOwnBackground);
   fChkNatoms = new TGCheckButton(f1, "N. atoms");
   fChkNatoms->SetDown(kFALSE);
   f1->AddFrame(fChkNatoms, new TGLayoutHints(kLHintsLeft, 2, 2, 6, 1));
   fNENatoms = new TGNumberEntry(f1, 0., 5, kMIX_NATOMS);
   fNENatoms->SetFormat(TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
   fNENatoms->Resize(65, fMaterialName->GetDefaultHeight());
   nef = (TGTextEntry*)fNENatoms->GetNumberEntry();
   nef->SetToolTipText("Enter number of atoms for this element");
   fNENatoms->SetNumber(0);
   fNENatoms->Associate(this);
   f1->AddFrame(fNENatoms, new TGLayoutHints(kLHintsRight, 2, 2, 1, 1));
   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 1, 1));

   // Button for adding the element
   fBAddElem = new TGTextButton(compxyz, "Add component");
   fBAddElem->Associate(this);
   compxyz->AddFrame(fBAddElem, new TGLayoutHints(kLHintsRight , 2, 2, 2, 0));

   compxyz->Resize(150,30);
   AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 0, 0, 1, 1));
   
   // List view with all components
   fComps = new TGCompositeFrame(this, 150, 100, kVerticalFrame | kSunkenFrame);
   AddFrame(fComps, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 0, 2, 1, 2));

   TGeoTabManager::MoveFrame(f23, this);
}   
   
//______________________________________________________________________________
void TGeoMixtureEditor::ConnectSignals2Slots()
{
   // Connect signals to slots.
   fApply->Connect("Clicked()", "TGeoMixtureEditor", this, "DoApply1()");
   fUndo->Connect("Clicked()", "TGeoMixtureEditor", this, "DoUndo1()");
   fChkFraction->Connect("Clicked()", "TGeoMixtureEditor", this, "DoChkFraction()");
   fChkNatoms->Connect("Clicked()", "TGeoMixtureEditor", this, "DoChkNatoms()");
   fNEFraction->Connect("ValueSet(Long_t)", "TGeoMixtureEditor", this, "DoFraction()");
   fNENatoms->Connect("ValueSet(Long_t)", "TGeoMixtureEditor", this, "DoNatoms()");
   fMixElem->Connect("Selected(Int_t)", "TGeoMixtureEditor", this, "DoSelectElement(Int_t)");
   fBAddElem->Connect("Clicked()", "TGeoMixtureEditor", this, "DoAddElem()");
   fMaterialName->Connect("TextChanged(const char *)", "TGeoMaterialEditor", this, "DoName()");
   fMatA->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoA()");
   fMatZ->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoZ()");
   fMatState->Connect("Selected(Int_t)", "TGeoMaterialEditor", this, "DoState(Int_t)");
   fMatDensity->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoDensity()");
   fMatTemperature->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoTemperature()");
   fMatPressure->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoPressure()");
   fMatRadLen->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoRadAbs()");
   fMatAbsLen->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoRadAbs()");
   fInit = kFALSE;
}
      
//______________________________________________________________________________
void TGeoMixtureEditor::SetModel(TObject* obj)
{
   // Connect to the selected mixture.
   if (obj == 0 || !(obj->InheritsFrom(TGeoMixture::Class()))) {
      SetActive(kFALSE);
      return;                 
   } 
   TGeoMaterialEditor::SetModel(obj);
   fMixture = (TGeoMixture*)fMaterial;
   UpdateElements();
}

//______________________________________________________________________________
void TGeoMixtureEditor::DoChkFraction()
{
// Check button state changed for fraction.
   if (fMixture->GetNelements() && fMixture->GetNmixt()) {
      fChkFraction->SetDown(kFALSE);
      fChkNatoms->SetDown(kTRUE);
      return;
   }   
   Bool_t isDown = fChkFraction->IsDown();
   fChkNatoms->SetDown(!isDown);
}   

//______________________________________________________________________________
void TGeoMixtureEditor::DoChkNatoms()
{
// Check button state changed for natoms.
   if (fMixture->GetNelements() && !fMixture->GetNmixt()) {
      fChkFraction->SetDown(kTRUE);
      fChkNatoms->SetDown(kFALSE);
      return;
   }   
   Bool_t isDown = fChkNatoms->IsDown();
   fChkFraction->SetDown(!isDown);
}   

//______________________________________________________________________________
void TGeoMixtureEditor::DoFraction()
{
// Fraction changed.
   if (fMixture->GetNelements() && fMixture->GetNmixt()) return;
   fChkFraction->SetDown(kTRUE);
   fChkNatoms->SetDown(kFALSE);
}   

//______________________________________________________________________________
void TGeoMixtureEditor::DoNatoms()
{
// Natoms changed.
   if (fMixture->GetNelements() && !fMixture->GetNmixt()) return;
   fChkFraction->SetDown(kFALSE);
   fChkNatoms->SetDown(kTRUE);
}   

//______________________________________________________________________________
void TGeoMixtureEditor::DoSelectElement(Int_t ielem)
{
// Slot for selecting an element.
   TGeoElement *el = gGeoManager->GetElementTable()->GetElement(ielem);
   if (!el) {
      Error("DoSelectElement", "No element at index %d", ielem);
      return;
   }   
   TString z = TString::Format("Z=%d",el->Z());
   TString a = TString::Format("A=%d",(Int_t)el->A());
   fAelem->SetText(a.Data());
   fZelem->SetText(z.Data());
}   

//______________________________________________________________________________
void TGeoMixtureEditor::DoAddElem()
{
// Slot for adding an element. No undo.
   Bool_t byfraction = fChkFraction->IsDown();   
   Int_t natoms = (Int_t)fNENatoms->GetNumber();
   if (!byfraction && natoms<=0) return;
   Double_t frac = fNEFraction->GetNumber();
   if (byfraction && frac<=0) return;
   TGeoElement *el = gGeoManager->GetElementTable()->GetElement(fMixElem->GetSelected());
   if (!el) return;
   if (byfraction) fMixture->AddElement(el, frac);
   else            fMixture->AddElement(el, natoms);   
   fTabMgr->GetMaterialEditor(fMixture);
}

//______________________________________________________________________________
void TGeoMixtureEditor::DoApply1()
{
// Slot for applying modifications.
   const char *name = fMaterialName->GetText();
   fMaterial->SetName(name);
   
   fMaterial->SetDensity(fMatDensity->GetNumber());
   fMaterial->SetTemperature(fMatTemperature->GetNumber());
   fMaterial->SetPressure(6.2415e+8*fMatPressure->GetNumber());
   fMaterial->SetState((TGeoMaterial::EGeoMaterialState)fMatState->GetSelected());
//   fMaterial->SetRadLen(fMatRadLen->GetNumber(), fMatAbsLen->GetNumber());
   fMatRadLen->SetNumber(fMaterial->GetRadLen());
   fMatAbsLen->SetNumber(fMaterial->GetIntLen());
   fUndo->SetEnabled();
   fApply->SetEnabled(kFALSE);
}   

//______________________________________________________________________________
void TGeoMixtureEditor::DoUndo1()
{
// Slot for undoing all changes.
   fMaterialName->SetText(fNamei.Data());
   fMaterial->SetName(fNamei.Data());
   fMatState->Select(fStatei);
   fMaterial->SetState((TGeoMaterial::EGeoMaterialState)fStatei);
   fMatDensity->SetNumber(fDensityi);
   fMaterial->SetDensity(fDensityi);
   fMatTemperature->SetNumber(fTempi);
   fMaterial->SetTemperature(fTempi);
   fMatPressure->SetNumber(fPresi);
   fMaterial->SetPressure(fPresi*6.2415e+8);
   fMatRadLen->SetNumber(fMaterial->GetRadLen());
   fMatAbsLen->SetNumber(fMaterial->GetIntLen());
   fApply->SetEnabled(kFALSE);
   fUndo->SetEnabled(kFALSE);
}   

//______________________________________________________________________________
void TGeoMixtureEditor::UpdateElements()
{
// Update the list of elements in the TGCanvas.
   fComps->RemoveAll();
   Int_t nelem = fMixture->GetNelements();
   for (Int_t i=0; i<nelem; i++) {
      TString s;
      Bool_t byfrac = (fMixture->GetNmixt())?kFALSE:kTRUE;
      if (byfrac) 
         s.TString::Format("%d-%s-%d: Wmass = %g %%", (Int_t)fMixture->GetZmixt()[i], fMixture->GetElement(i)->GetName(), 
                (Int_t)fMixture->GetAmixt()[i],fMixture->GetWmixt()[i]);
      else
         s.TString::Format("%d-%s-%d: Natoms = %d", (Int_t)fMixture->GetZmixt()[i], fMixture->GetElement(i)->GetName(), 
                (Int_t)fMixture->GetAmixt()[i],fMixture->GetNmixt()[i]);
                     
      TGLabel *label = new TGLabel(fComps, s);
      label->SetTextJustify(kTextLeft | kTextCenterY);
      fComps->AddFrame(label, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 0, 0));
   }   
   fComps->MapSubwindows();
}
 TGeoMaterialEditor.cxx:1
 TGeoMaterialEditor.cxx:2
 TGeoMaterialEditor.cxx:3
 TGeoMaterialEditor.cxx:4
 TGeoMaterialEditor.cxx:5
 TGeoMaterialEditor.cxx:6
 TGeoMaterialEditor.cxx:7
 TGeoMaterialEditor.cxx:8
 TGeoMaterialEditor.cxx:9
 TGeoMaterialEditor.cxx:10
 TGeoMaterialEditor.cxx:11
 TGeoMaterialEditor.cxx:12
 TGeoMaterialEditor.cxx:13
 TGeoMaterialEditor.cxx:14
 TGeoMaterialEditor.cxx:15
 TGeoMaterialEditor.cxx:16
 TGeoMaterialEditor.cxx:17
 TGeoMaterialEditor.cxx:18
 TGeoMaterialEditor.cxx:19
 TGeoMaterialEditor.cxx:20
 TGeoMaterialEditor.cxx:21
 TGeoMaterialEditor.cxx:22
 TGeoMaterialEditor.cxx:23
 TGeoMaterialEditor.cxx:24
 TGeoMaterialEditor.cxx:25
 TGeoMaterialEditor.cxx:26
 TGeoMaterialEditor.cxx:27
 TGeoMaterialEditor.cxx:28
 TGeoMaterialEditor.cxx:29
 TGeoMaterialEditor.cxx:30
 TGeoMaterialEditor.cxx:31
 TGeoMaterialEditor.cxx:32
 TGeoMaterialEditor.cxx:33
 TGeoMaterialEditor.cxx:34
 TGeoMaterialEditor.cxx:35
 TGeoMaterialEditor.cxx:36
 TGeoMaterialEditor.cxx:37
 TGeoMaterialEditor.cxx:38
 TGeoMaterialEditor.cxx:39
 TGeoMaterialEditor.cxx:40
 TGeoMaterialEditor.cxx:41
 TGeoMaterialEditor.cxx:42
 TGeoMaterialEditor.cxx:43
 TGeoMaterialEditor.cxx:44
 TGeoMaterialEditor.cxx:45
 TGeoMaterialEditor.cxx:46
 TGeoMaterialEditor.cxx:47
 TGeoMaterialEditor.cxx:48
 TGeoMaterialEditor.cxx:49
 TGeoMaterialEditor.cxx:50
 TGeoMaterialEditor.cxx:51
 TGeoMaterialEditor.cxx:52
 TGeoMaterialEditor.cxx:53
 TGeoMaterialEditor.cxx:54
 TGeoMaterialEditor.cxx:55
 TGeoMaterialEditor.cxx:56
 TGeoMaterialEditor.cxx:57
 TGeoMaterialEditor.cxx:58
 TGeoMaterialEditor.cxx:59
 TGeoMaterialEditor.cxx:60
 TGeoMaterialEditor.cxx:61
 TGeoMaterialEditor.cxx:62
 TGeoMaterialEditor.cxx:63
 TGeoMaterialEditor.cxx:64
 TGeoMaterialEditor.cxx:65
 TGeoMaterialEditor.cxx:66
 TGeoMaterialEditor.cxx:67
 TGeoMaterialEditor.cxx:68
 TGeoMaterialEditor.cxx:69
 TGeoMaterialEditor.cxx:70
 TGeoMaterialEditor.cxx:71
 TGeoMaterialEditor.cxx:72
 TGeoMaterialEditor.cxx:73
 TGeoMaterialEditor.cxx:74
 TGeoMaterialEditor.cxx:75
 TGeoMaterialEditor.cxx:76
 TGeoMaterialEditor.cxx:77
 TGeoMaterialEditor.cxx:78
 TGeoMaterialEditor.cxx:79
 TGeoMaterialEditor.cxx:80
 TGeoMaterialEditor.cxx:81
 TGeoMaterialEditor.cxx:82
 TGeoMaterialEditor.cxx:83
 TGeoMaterialEditor.cxx:84
 TGeoMaterialEditor.cxx:85
 TGeoMaterialEditor.cxx:86
 TGeoMaterialEditor.cxx:87
 TGeoMaterialEditor.cxx:88
 TGeoMaterialEditor.cxx:89
 TGeoMaterialEditor.cxx:90
 TGeoMaterialEditor.cxx:91
 TGeoMaterialEditor.cxx:92
 TGeoMaterialEditor.cxx:93
 TGeoMaterialEditor.cxx:94
 TGeoMaterialEditor.cxx:95
 TGeoMaterialEditor.cxx:96
 TGeoMaterialEditor.cxx:97
 TGeoMaterialEditor.cxx:98
 TGeoMaterialEditor.cxx:99
 TGeoMaterialEditor.cxx:100
 TGeoMaterialEditor.cxx:101
 TGeoMaterialEditor.cxx:102
 TGeoMaterialEditor.cxx:103
 TGeoMaterialEditor.cxx:104
 TGeoMaterialEditor.cxx:105
 TGeoMaterialEditor.cxx:106
 TGeoMaterialEditor.cxx:107
 TGeoMaterialEditor.cxx:108
 TGeoMaterialEditor.cxx:109
 TGeoMaterialEditor.cxx:110
 TGeoMaterialEditor.cxx:111
 TGeoMaterialEditor.cxx:112
 TGeoMaterialEditor.cxx:113
 TGeoMaterialEditor.cxx:114
 TGeoMaterialEditor.cxx:115
 TGeoMaterialEditor.cxx:116
 TGeoMaterialEditor.cxx:117
 TGeoMaterialEditor.cxx:118
 TGeoMaterialEditor.cxx:119
 TGeoMaterialEditor.cxx:120
 TGeoMaterialEditor.cxx:121
 TGeoMaterialEditor.cxx:122
 TGeoMaterialEditor.cxx:123
 TGeoMaterialEditor.cxx:124
 TGeoMaterialEditor.cxx:125
 TGeoMaterialEditor.cxx:126
 TGeoMaterialEditor.cxx:127
 TGeoMaterialEditor.cxx:128
 TGeoMaterialEditor.cxx:129
 TGeoMaterialEditor.cxx:130
 TGeoMaterialEditor.cxx:131
 TGeoMaterialEditor.cxx:132
 TGeoMaterialEditor.cxx:133
 TGeoMaterialEditor.cxx:134
 TGeoMaterialEditor.cxx:135
 TGeoMaterialEditor.cxx:136
 TGeoMaterialEditor.cxx:137
 TGeoMaterialEditor.cxx:138
 TGeoMaterialEditor.cxx:139
 TGeoMaterialEditor.cxx:140
 TGeoMaterialEditor.cxx:141
 TGeoMaterialEditor.cxx:142
 TGeoMaterialEditor.cxx:143
 TGeoMaterialEditor.cxx:144
 TGeoMaterialEditor.cxx:145
 TGeoMaterialEditor.cxx:146
 TGeoMaterialEditor.cxx:147
 TGeoMaterialEditor.cxx:148
 TGeoMaterialEditor.cxx:149
 TGeoMaterialEditor.cxx:150
 TGeoMaterialEditor.cxx:151
 TGeoMaterialEditor.cxx:152
 TGeoMaterialEditor.cxx:153
 TGeoMaterialEditor.cxx:154
 TGeoMaterialEditor.cxx:155
 TGeoMaterialEditor.cxx:156
 TGeoMaterialEditor.cxx:157
 TGeoMaterialEditor.cxx:158
 TGeoMaterialEditor.cxx:159
 TGeoMaterialEditor.cxx:160
 TGeoMaterialEditor.cxx:161
 TGeoMaterialEditor.cxx:162
 TGeoMaterialEditor.cxx:163
 TGeoMaterialEditor.cxx:164
 TGeoMaterialEditor.cxx:165
 TGeoMaterialEditor.cxx:166
 TGeoMaterialEditor.cxx:167
 TGeoMaterialEditor.cxx:168
 TGeoMaterialEditor.cxx:169
 TGeoMaterialEditor.cxx:170
 TGeoMaterialEditor.cxx:171
 TGeoMaterialEditor.cxx:172
 TGeoMaterialEditor.cxx:173
 TGeoMaterialEditor.cxx:174
 TGeoMaterialEditor.cxx:175
 TGeoMaterialEditor.cxx:176
 TGeoMaterialEditor.cxx:177
 TGeoMaterialEditor.cxx:178
 TGeoMaterialEditor.cxx:179
 TGeoMaterialEditor.cxx:180
 TGeoMaterialEditor.cxx:181
 TGeoMaterialEditor.cxx:182
 TGeoMaterialEditor.cxx:183
 TGeoMaterialEditor.cxx:184
 TGeoMaterialEditor.cxx:185
 TGeoMaterialEditor.cxx:186
 TGeoMaterialEditor.cxx:187
 TGeoMaterialEditor.cxx:188
 TGeoMaterialEditor.cxx:189
 TGeoMaterialEditor.cxx:190
 TGeoMaterialEditor.cxx:191
 TGeoMaterialEditor.cxx:192
 TGeoMaterialEditor.cxx:193
 TGeoMaterialEditor.cxx:194
 TGeoMaterialEditor.cxx:195
 TGeoMaterialEditor.cxx:196
 TGeoMaterialEditor.cxx:197
 TGeoMaterialEditor.cxx:198
 TGeoMaterialEditor.cxx:199
 TGeoMaterialEditor.cxx:200
 TGeoMaterialEditor.cxx:201
 TGeoMaterialEditor.cxx:202
 TGeoMaterialEditor.cxx:203
 TGeoMaterialEditor.cxx:204
 TGeoMaterialEditor.cxx:205
 TGeoMaterialEditor.cxx:206
 TGeoMaterialEditor.cxx:207
 TGeoMaterialEditor.cxx:208
 TGeoMaterialEditor.cxx:209
 TGeoMaterialEditor.cxx:210
 TGeoMaterialEditor.cxx:211
 TGeoMaterialEditor.cxx:212
 TGeoMaterialEditor.cxx:213
 TGeoMaterialEditor.cxx:214
 TGeoMaterialEditor.cxx:215
 TGeoMaterialEditor.cxx:216
 TGeoMaterialEditor.cxx:217
 TGeoMaterialEditor.cxx:218
 TGeoMaterialEditor.cxx:219
 TGeoMaterialEditor.cxx:220
 TGeoMaterialEditor.cxx:221
 TGeoMaterialEditor.cxx:222
 TGeoMaterialEditor.cxx:223
 TGeoMaterialEditor.cxx:224
 TGeoMaterialEditor.cxx:225
 TGeoMaterialEditor.cxx:226
 TGeoMaterialEditor.cxx:227
 TGeoMaterialEditor.cxx:228
 TGeoMaterialEditor.cxx:229
 TGeoMaterialEditor.cxx:230
 TGeoMaterialEditor.cxx:231
 TGeoMaterialEditor.cxx:232
 TGeoMaterialEditor.cxx:233
 TGeoMaterialEditor.cxx:234
 TGeoMaterialEditor.cxx:235
 TGeoMaterialEditor.cxx:236
 TGeoMaterialEditor.cxx:237
 TGeoMaterialEditor.cxx:238
 TGeoMaterialEditor.cxx:239
 TGeoMaterialEditor.cxx:240
 TGeoMaterialEditor.cxx:241
 TGeoMaterialEditor.cxx:242
 TGeoMaterialEditor.cxx:243
 TGeoMaterialEditor.cxx:244
 TGeoMaterialEditor.cxx:245
 TGeoMaterialEditor.cxx:246
 TGeoMaterialEditor.cxx:247
 TGeoMaterialEditor.cxx:248
 TGeoMaterialEditor.cxx:249
 TGeoMaterialEditor.cxx:250
 TGeoMaterialEditor.cxx:251
 TGeoMaterialEditor.cxx:252
 TGeoMaterialEditor.cxx:253
 TGeoMaterialEditor.cxx:254
 TGeoMaterialEditor.cxx:255
 TGeoMaterialEditor.cxx:256
 TGeoMaterialEditor.cxx:257
 TGeoMaterialEditor.cxx:258
 TGeoMaterialEditor.cxx:259
 TGeoMaterialEditor.cxx:260
 TGeoMaterialEditor.cxx:261
 TGeoMaterialEditor.cxx:262
 TGeoMaterialEditor.cxx:263
 TGeoMaterialEditor.cxx:264
 TGeoMaterialEditor.cxx:265
 TGeoMaterialEditor.cxx:266
 TGeoMaterialEditor.cxx:267
 TGeoMaterialEditor.cxx:268
 TGeoMaterialEditor.cxx:269
 TGeoMaterialEditor.cxx:270
 TGeoMaterialEditor.cxx:271
 TGeoMaterialEditor.cxx:272
 TGeoMaterialEditor.cxx:273
 TGeoMaterialEditor.cxx:274
 TGeoMaterialEditor.cxx:275
 TGeoMaterialEditor.cxx:276
 TGeoMaterialEditor.cxx:277
 TGeoMaterialEditor.cxx:278
 TGeoMaterialEditor.cxx:279
 TGeoMaterialEditor.cxx:280
 TGeoMaterialEditor.cxx:281
 TGeoMaterialEditor.cxx:282
 TGeoMaterialEditor.cxx:283
 TGeoMaterialEditor.cxx:284
 TGeoMaterialEditor.cxx:285
 TGeoMaterialEditor.cxx:286
 TGeoMaterialEditor.cxx:287
 TGeoMaterialEditor.cxx:288
 TGeoMaterialEditor.cxx:289
 TGeoMaterialEditor.cxx:290
 TGeoMaterialEditor.cxx:291
 TGeoMaterialEditor.cxx:292
 TGeoMaterialEditor.cxx:293
 TGeoMaterialEditor.cxx:294
 TGeoMaterialEditor.cxx:295
 TGeoMaterialEditor.cxx:296
 TGeoMaterialEditor.cxx:297
 TGeoMaterialEditor.cxx:298
 TGeoMaterialEditor.cxx:299
 TGeoMaterialEditor.cxx:300
 TGeoMaterialEditor.cxx:301
 TGeoMaterialEditor.cxx:302
 TGeoMaterialEditor.cxx:303
 TGeoMaterialEditor.cxx:304
 TGeoMaterialEditor.cxx:305
 TGeoMaterialEditor.cxx:306
 TGeoMaterialEditor.cxx:307
 TGeoMaterialEditor.cxx:308
 TGeoMaterialEditor.cxx:309
 TGeoMaterialEditor.cxx:310
 TGeoMaterialEditor.cxx:311
 TGeoMaterialEditor.cxx:312
 TGeoMaterialEditor.cxx:313
 TGeoMaterialEditor.cxx:314
 TGeoMaterialEditor.cxx:315
 TGeoMaterialEditor.cxx:316
 TGeoMaterialEditor.cxx:317
 TGeoMaterialEditor.cxx:318
 TGeoMaterialEditor.cxx:319
 TGeoMaterialEditor.cxx:320
 TGeoMaterialEditor.cxx:321
 TGeoMaterialEditor.cxx:322
 TGeoMaterialEditor.cxx:323
 TGeoMaterialEditor.cxx:324
 TGeoMaterialEditor.cxx:325
 TGeoMaterialEditor.cxx:326
 TGeoMaterialEditor.cxx:327
 TGeoMaterialEditor.cxx:328
 TGeoMaterialEditor.cxx:329
 TGeoMaterialEditor.cxx:330
 TGeoMaterialEditor.cxx:331
 TGeoMaterialEditor.cxx:332
 TGeoMaterialEditor.cxx:333
 TGeoMaterialEditor.cxx:334
 TGeoMaterialEditor.cxx:335
 TGeoMaterialEditor.cxx:336
 TGeoMaterialEditor.cxx:337
 TGeoMaterialEditor.cxx:338
 TGeoMaterialEditor.cxx:339
 TGeoMaterialEditor.cxx:340
 TGeoMaterialEditor.cxx:341
 TGeoMaterialEditor.cxx:342
 TGeoMaterialEditor.cxx:343
 TGeoMaterialEditor.cxx:344
 TGeoMaterialEditor.cxx:345
 TGeoMaterialEditor.cxx:346
 TGeoMaterialEditor.cxx:347
 TGeoMaterialEditor.cxx:348
 TGeoMaterialEditor.cxx:349
 TGeoMaterialEditor.cxx:350
 TGeoMaterialEditor.cxx:351
 TGeoMaterialEditor.cxx:352
 TGeoMaterialEditor.cxx:353
 TGeoMaterialEditor.cxx:354
 TGeoMaterialEditor.cxx:355
 TGeoMaterialEditor.cxx:356
 TGeoMaterialEditor.cxx:357
 TGeoMaterialEditor.cxx:358
 TGeoMaterialEditor.cxx:359
 TGeoMaterialEditor.cxx:360
 TGeoMaterialEditor.cxx:361
 TGeoMaterialEditor.cxx:362
 TGeoMaterialEditor.cxx:363
 TGeoMaterialEditor.cxx:364
 TGeoMaterialEditor.cxx:365
 TGeoMaterialEditor.cxx:366
 TGeoMaterialEditor.cxx:367
 TGeoMaterialEditor.cxx:368
 TGeoMaterialEditor.cxx:369
 TGeoMaterialEditor.cxx:370
 TGeoMaterialEditor.cxx:371
 TGeoMaterialEditor.cxx:372
 TGeoMaterialEditor.cxx:373
 TGeoMaterialEditor.cxx:374
 TGeoMaterialEditor.cxx:375
 TGeoMaterialEditor.cxx:376
 TGeoMaterialEditor.cxx:377
 TGeoMaterialEditor.cxx:378
 TGeoMaterialEditor.cxx:379
 TGeoMaterialEditor.cxx:380
 TGeoMaterialEditor.cxx:381
 TGeoMaterialEditor.cxx:382
 TGeoMaterialEditor.cxx:383
 TGeoMaterialEditor.cxx:384
 TGeoMaterialEditor.cxx:385
 TGeoMaterialEditor.cxx:386
 TGeoMaterialEditor.cxx:387
 TGeoMaterialEditor.cxx:388
 TGeoMaterialEditor.cxx:389
 TGeoMaterialEditor.cxx:390
 TGeoMaterialEditor.cxx:391
 TGeoMaterialEditor.cxx:392
 TGeoMaterialEditor.cxx:393
 TGeoMaterialEditor.cxx:394
 TGeoMaterialEditor.cxx:395
 TGeoMaterialEditor.cxx:396
 TGeoMaterialEditor.cxx:397
 TGeoMaterialEditor.cxx:398
 TGeoMaterialEditor.cxx:399
 TGeoMaterialEditor.cxx:400
 TGeoMaterialEditor.cxx:401
 TGeoMaterialEditor.cxx:402
 TGeoMaterialEditor.cxx:403
 TGeoMaterialEditor.cxx:404
 TGeoMaterialEditor.cxx:405
 TGeoMaterialEditor.cxx:406
 TGeoMaterialEditor.cxx:407
 TGeoMaterialEditor.cxx:408
 TGeoMaterialEditor.cxx:409
 TGeoMaterialEditor.cxx:410
 TGeoMaterialEditor.cxx:411
 TGeoMaterialEditor.cxx:412
 TGeoMaterialEditor.cxx:413
 TGeoMaterialEditor.cxx:414
 TGeoMaterialEditor.cxx:415
 TGeoMaterialEditor.cxx:416
 TGeoMaterialEditor.cxx:417
 TGeoMaterialEditor.cxx:418
 TGeoMaterialEditor.cxx:419
 TGeoMaterialEditor.cxx:420
 TGeoMaterialEditor.cxx:421
 TGeoMaterialEditor.cxx:422
 TGeoMaterialEditor.cxx:423
 TGeoMaterialEditor.cxx:424
 TGeoMaterialEditor.cxx:425
 TGeoMaterialEditor.cxx:426
 TGeoMaterialEditor.cxx:427
 TGeoMaterialEditor.cxx:428
 TGeoMaterialEditor.cxx:429
 TGeoMaterialEditor.cxx:430
 TGeoMaterialEditor.cxx:431
 TGeoMaterialEditor.cxx:432
 TGeoMaterialEditor.cxx:433
 TGeoMaterialEditor.cxx:434
 TGeoMaterialEditor.cxx:435
 TGeoMaterialEditor.cxx:436
 TGeoMaterialEditor.cxx:437
 TGeoMaterialEditor.cxx:438
 TGeoMaterialEditor.cxx:439
 TGeoMaterialEditor.cxx:440
 TGeoMaterialEditor.cxx:441
 TGeoMaterialEditor.cxx:442
 TGeoMaterialEditor.cxx:443
 TGeoMaterialEditor.cxx:444
 TGeoMaterialEditor.cxx:445
 TGeoMaterialEditor.cxx:446
 TGeoMaterialEditor.cxx:447
 TGeoMaterialEditor.cxx:448
 TGeoMaterialEditor.cxx:449
 TGeoMaterialEditor.cxx:450
 TGeoMaterialEditor.cxx:451
 TGeoMaterialEditor.cxx:452
 TGeoMaterialEditor.cxx:453
 TGeoMaterialEditor.cxx:454
 TGeoMaterialEditor.cxx:455
 TGeoMaterialEditor.cxx:456
 TGeoMaterialEditor.cxx:457
 TGeoMaterialEditor.cxx:458
 TGeoMaterialEditor.cxx:459
 TGeoMaterialEditor.cxx:460
 TGeoMaterialEditor.cxx:461
 TGeoMaterialEditor.cxx:462
 TGeoMaterialEditor.cxx:463
 TGeoMaterialEditor.cxx:464
 TGeoMaterialEditor.cxx:465
 TGeoMaterialEditor.cxx:466
 TGeoMaterialEditor.cxx:467
 TGeoMaterialEditor.cxx:468
 TGeoMaterialEditor.cxx:469
 TGeoMaterialEditor.cxx:470
 TGeoMaterialEditor.cxx:471
 TGeoMaterialEditor.cxx:472
 TGeoMaterialEditor.cxx:473
 TGeoMaterialEditor.cxx:474
 TGeoMaterialEditor.cxx:475
 TGeoMaterialEditor.cxx:476
 TGeoMaterialEditor.cxx:477
 TGeoMaterialEditor.cxx:478
 TGeoMaterialEditor.cxx:479
 TGeoMaterialEditor.cxx:480
 TGeoMaterialEditor.cxx:481
 TGeoMaterialEditor.cxx:482
 TGeoMaterialEditor.cxx:483
 TGeoMaterialEditor.cxx:484
 TGeoMaterialEditor.cxx:485
 TGeoMaterialEditor.cxx:486
 TGeoMaterialEditor.cxx:487
 TGeoMaterialEditor.cxx:488
 TGeoMaterialEditor.cxx:489
 TGeoMaterialEditor.cxx:490
 TGeoMaterialEditor.cxx:491
 TGeoMaterialEditor.cxx:492
 TGeoMaterialEditor.cxx:493
 TGeoMaterialEditor.cxx:494
 TGeoMaterialEditor.cxx:495
 TGeoMaterialEditor.cxx:496
 TGeoMaterialEditor.cxx:497
 TGeoMaterialEditor.cxx:498
 TGeoMaterialEditor.cxx:499
 TGeoMaterialEditor.cxx:500
 TGeoMaterialEditor.cxx:501
 TGeoMaterialEditor.cxx:502
 TGeoMaterialEditor.cxx:503
 TGeoMaterialEditor.cxx:504
 TGeoMaterialEditor.cxx:505
 TGeoMaterialEditor.cxx:506
 TGeoMaterialEditor.cxx:507
 TGeoMaterialEditor.cxx:508
 TGeoMaterialEditor.cxx:509
 TGeoMaterialEditor.cxx:510
 TGeoMaterialEditor.cxx:511
 TGeoMaterialEditor.cxx:512
 TGeoMaterialEditor.cxx:513
 TGeoMaterialEditor.cxx:514
 TGeoMaterialEditor.cxx:515
 TGeoMaterialEditor.cxx:516
 TGeoMaterialEditor.cxx:517
 TGeoMaterialEditor.cxx:518
 TGeoMaterialEditor.cxx:519
 TGeoMaterialEditor.cxx:520
 TGeoMaterialEditor.cxx:521
 TGeoMaterialEditor.cxx:522
 TGeoMaterialEditor.cxx:523
 TGeoMaterialEditor.cxx:524
 TGeoMaterialEditor.cxx:525
 TGeoMaterialEditor.cxx:526
 TGeoMaterialEditor.cxx:527
 TGeoMaterialEditor.cxx:528
 TGeoMaterialEditor.cxx:529
 TGeoMaterialEditor.cxx:530
 TGeoMaterialEditor.cxx:531
 TGeoMaterialEditor.cxx:532
 TGeoMaterialEditor.cxx:533
 TGeoMaterialEditor.cxx:534
 TGeoMaterialEditor.cxx:535
 TGeoMaterialEditor.cxx:536
 TGeoMaterialEditor.cxx:537
 TGeoMaterialEditor.cxx:538
 TGeoMaterialEditor.cxx:539
 TGeoMaterialEditor.cxx:540
 TGeoMaterialEditor.cxx:541
 TGeoMaterialEditor.cxx:542
 TGeoMaterialEditor.cxx:543
 TGeoMaterialEditor.cxx:544
 TGeoMaterialEditor.cxx:545
 TGeoMaterialEditor.cxx:546
 TGeoMaterialEditor.cxx:547
 TGeoMaterialEditor.cxx:548
 TGeoMaterialEditor.cxx:549
 TGeoMaterialEditor.cxx:550
 TGeoMaterialEditor.cxx:551
 TGeoMaterialEditor.cxx:552
 TGeoMaterialEditor.cxx:553
 TGeoMaterialEditor.cxx:554
 TGeoMaterialEditor.cxx:555
 TGeoMaterialEditor.cxx:556
 TGeoMaterialEditor.cxx:557
 TGeoMaterialEditor.cxx:558
 TGeoMaterialEditor.cxx:559
 TGeoMaterialEditor.cxx:560
 TGeoMaterialEditor.cxx:561
 TGeoMaterialEditor.cxx:562
 TGeoMaterialEditor.cxx:563
 TGeoMaterialEditor.cxx:564
 TGeoMaterialEditor.cxx:565
 TGeoMaterialEditor.cxx:566
 TGeoMaterialEditor.cxx:567
 TGeoMaterialEditor.cxx:568
 TGeoMaterialEditor.cxx:569
 TGeoMaterialEditor.cxx:570
 TGeoMaterialEditor.cxx:571
 TGeoMaterialEditor.cxx:572
 TGeoMaterialEditor.cxx:573
 TGeoMaterialEditor.cxx:574
 TGeoMaterialEditor.cxx:575
 TGeoMaterialEditor.cxx:576
 TGeoMaterialEditor.cxx:577
 TGeoMaterialEditor.cxx:578
 TGeoMaterialEditor.cxx:579
 TGeoMaterialEditor.cxx:580
 TGeoMaterialEditor.cxx:581
 TGeoMaterialEditor.cxx:582
 TGeoMaterialEditor.cxx:583
 TGeoMaterialEditor.cxx:584
 TGeoMaterialEditor.cxx:585
 TGeoMaterialEditor.cxx:586
 TGeoMaterialEditor.cxx:587
 TGeoMaterialEditor.cxx:588
 TGeoMaterialEditor.cxx:589
 TGeoMaterialEditor.cxx:590
 TGeoMaterialEditor.cxx:591
 TGeoMaterialEditor.cxx:592
 TGeoMaterialEditor.cxx:593
 TGeoMaterialEditor.cxx:594
 TGeoMaterialEditor.cxx:595
 TGeoMaterialEditor.cxx:596
 TGeoMaterialEditor.cxx:597
 TGeoMaterialEditor.cxx:598
 TGeoMaterialEditor.cxx:599
 TGeoMaterialEditor.cxx:600
 TGeoMaterialEditor.cxx:601
 TGeoMaterialEditor.cxx:602
 TGeoMaterialEditor.cxx:603
 TGeoMaterialEditor.cxx:604
 TGeoMaterialEditor.cxx:605
 TGeoMaterialEditor.cxx:606
 TGeoMaterialEditor.cxx:607
 TGeoMaterialEditor.cxx:608
 TGeoMaterialEditor.cxx:609
 TGeoMaterialEditor.cxx:610
 TGeoMaterialEditor.cxx:611
 TGeoMaterialEditor.cxx:612
 TGeoMaterialEditor.cxx:613
 TGeoMaterialEditor.cxx:614
 TGeoMaterialEditor.cxx:615
 TGeoMaterialEditor.cxx:616
 TGeoMaterialEditor.cxx:617
 TGeoMaterialEditor.cxx:618
 TGeoMaterialEditor.cxx:619
 TGeoMaterialEditor.cxx:620
 TGeoMaterialEditor.cxx:621
 TGeoMaterialEditor.cxx:622
 TGeoMaterialEditor.cxx:623
 TGeoMaterialEditor.cxx:624
 TGeoMaterialEditor.cxx:625
 TGeoMaterialEditor.cxx:626
 TGeoMaterialEditor.cxx:627
 TGeoMaterialEditor.cxx:628