From 94ba0525315e21993903b369ab1e97f9a3a9f52a Mon Sep 17 00:00:00 2001 From: Rene Brun <Rene.Brun@cern.ch> Date: Mon, 19 Jun 2006 14:58:48 +0000 Subject: [PATCH] From Mihaela Gheata: I added comments for all methods. there is also a patch to TGeoPcon class in the diff for being able to change the number of Z sections(Nz). git-svn-id: http://root.cern.ch/svn/root/trunk@15473 27541ba8-7e3a-0410-8455-c3a389f83636 --- geom/src/TGeoPcon.cxx | 15 +- geombuilder/Module.mk | 2 +- geombuilder/inc/LinkDef.h | 4 +- geombuilder/inc/TGeoPconEditor.h | 117 +++++ geombuilder/src/TGeoBBoxEditor.cxx | 13 +- geombuilder/src/TGeoConeEditor.cxx | 23 +- geombuilder/src/TGeoManagerEditor.cxx | 166 ++++--- geombuilder/src/TGeoMaterialEditor.cxx | 18 +- geombuilder/src/TGeoMatrixEditor.cxx | 48 ++- geombuilder/src/TGeoMediumEditor.cxx | 19 +- geombuilder/src/TGeoNodeEditor.cxx | 12 +- geombuilder/src/TGeoPconEditor.cxx | 574 +++++++++++++++++++++++++ geombuilder/src/TGeoSphereEditor.cxx | 23 +- geombuilder/src/TGeoTabManager.cxx | 38 +- geombuilder/src/TGeoTrd1Editor.cxx | 15 +- geombuilder/src/TGeoTrd2Editor.cxx | 18 +- geombuilder/src/TGeoTubeEditor.cxx | 25 +- geombuilder/src/TGeoVolumeEditor.cxx | 48 ++- 18 files changed, 1065 insertions(+), 113 deletions(-) create mode 100644 geombuilder/inc/TGeoPconEditor.h create mode 100644 geombuilder/src/TGeoPconEditor.cxx diff --git a/geom/src/TGeoPcon.cxx b/geom/src/TGeoPcon.cxx index 0a8142ea0c6..1918c413c5d 100644 --- a/geom/src/TGeoPcon.cxx +++ b/geom/src/TGeoPcon.cxx @@ -1,4 +1,4 @@ -// @(#)root/geom:$Name: $:$Id: TGeoPcon.cxx,v 1.54 2006/05/23 04:47:37 brun Exp $ +// @(#)root/geom:$Name: $:$Id: TGeoPcon.cxx,v 1.55 2006/05/24 17:11:54 brun Exp $ // Author: Andrei Gheata 24/10/01 // TGeoPcon::Contains() implemented by Mihaela Gheata @@ -1100,9 +1100,16 @@ void TGeoPcon::SetDimensions(Double_t *param) fPhi1 = param[0]; fDphi = param[1]; fNz = (Int_t)param[2]; - if (!fRmin) fRmin = new Double_t [fNz]; - if (!fRmax) fRmax = new Double_t [fNz]; - if (!fZ) fZ = new Double_t [fNz]; + if (fNz<2) { + Error("SetDimensions","Pcon %s: Number of Z sections must be > 2", GetName()); + return; + } + if (fRmin) delete [] fRmin; + if (fRmax) delete [] fRmax; + if (fZ) delete [] fZ; + fRmin = new Double_t [fNz]; + fRmax = new Double_t [fNz]; + fZ = new Double_t [fNz]; memset(fRmin, 0, fNz*sizeof(Double_t)); memset(fRmax, 0, fNz*sizeof(Double_t)); memset(fZ, 0, fNz*sizeof(Double_t)); diff --git a/geombuilder/Module.mk b/geombuilder/Module.mk index ad8264e968b..d870523923b 100644 --- a/geombuilder/Module.mk +++ b/geombuilder/Module.mk @@ -21,7 +21,7 @@ GEOMBUILDERH := TGeoVolumeEditor.h TGeoBBoxEditor.h TGeoMediumEditor.h \ TGeoNodeEditor.h TGeoMatrixEditor.h TGeoManagerEditor.h \ TGeoTubeEditor.h TGeoConeEditor.h TGeoTrd1Editor.h \ TGeoTrd2Editor.h TGeoMaterialEditor.h TGeoTabManager.h \ - TGeoSphereEditor.h + TGeoSphereEditor.h TGeoPconEditor.h GEOMBUILDERH := $(patsubst %,$(MODDIRI)/%,$(GEOMBUILDERH)) GEOMBUILDERS := $(filter-out $(MODDIRS)/G__%,$(wildcard $(MODDIRS)/*.cxx)) GEOMBUILDERO := $(GEOMBUILDERS:.cxx=.o) diff --git a/geombuilder/inc/LinkDef.h b/geombuilder/inc/LinkDef.h index a4351cd1b97..1542b081ee0 100644 --- a/geombuilder/inc/LinkDef.h +++ b/geombuilder/inc/LinkDef.h @@ -1,4 +1,4 @@ -// @(#)$Name: $:$Id: Exp $ +// @(#)$Name: $:$Id: LinkDef.h,v 1.1 2006/06/13 15:27:11 brun Exp $ /************************************************************************* * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * * All rights reserved. * @@ -20,6 +20,8 @@ #pragma link C++ class TGeoConeEditor; #pragma link C++ class TGeoConeSegEditor; #pragma link C++ class TGeoTrd1Editor; +#pragma link C++ class TGeoPconEditor; +#pragma link C++ class TGeoPconSection; #pragma link C++ class TGeoTrd2Editor; #pragma link C++ class TGeoSphereEditor; #pragma link C++ class TGeoMediumEditor; diff --git a/geombuilder/inc/TGeoPconEditor.h b/geombuilder/inc/TGeoPconEditor.h new file mode 100644 index 00000000000..740c32a3bf6 --- /dev/null +++ b/geombuilder/inc/TGeoPconEditor.h @@ -0,0 +1,117 @@ +// @(#):$Name: $:$Id: TGeoPconEditor.h,v 1.1 2006/06/13 15:27:11 brun Exp $ +// 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. * + *************************************************************************/ + +#ifndef ROOT_TGeoPconEditor +#define ROOT_TGeoPconEditor + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoPconEditor // +// // +// Editor for a TGeoPcon. // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TGButton +#include "TGWidget.h" +#endif +#ifndef ROOT_TGedFrame +#include "TGedFrame.h" +#endif + +class TGeoPcon; +class TGeoPconSection; +class TGeoTabManager; +class TGTextEntry; +class TGNumberEntry; +class TGTab; +class TGComboBox; +class TGTextButton; +class TGCanvas; +class TString; + +class TGeoPconEditor : public TGedFrame { + +protected: + Int_t fNsecti; // Initial number of sections + Double_t fPhi1i; // Initial Phi1 + Double_t fDPhii; // Initial Dphi + Double_t *fZi; // Initial Z positions + Double_t *fRmini; // Initial Rmin values + Double_t *fRmaxi; // Initial Rmax values + Int_t fNsections; // Number of Z sections + TObjArray *fSections; // List of section frames + TGCanvas *fCan; // sections container + TGeoPcon *fShape; // Shape object + Bool_t fIsModified; // Flag that volume was modified + Bool_t fIsShapeEditable; // Flag that the shape can be changed + TGeoTabManager *fTabMgr; // Tab manager + TGLayoutHints *fLHsect; // Layout hints for sections + TGTextEntry *fShapeName; // Shape name text entry + TGNumberEntry *fENz; // Number entry for nsections + TGNumberEntry *fEPhi1; // Number entry for phi1 + TGNumberEntry *fEDPhi; // Number entry for dphi + TGTextButton *fApply; // Apply-Button to accept changes + TGTextButton *fUndo; // Undo-Button + + virtual void ConnectSignals2Slots(); // Connect the signals to the slots + Bool_t CheckSections(); + void CreateSections(Int_t inew); + void UpdateSections(); + +public: + TGeoPconEditor(const TGWindow *p, Int_t id, + Int_t width = 140, Int_t height = 30, + UInt_t options = kChildFrame, + Pixel_t back = GetDefaultFrameBackground()); + virtual ~TGeoPconEditor(); + virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + + void DoModified(); + void DoName(); + void DoNz(); + void DoPhi(); + void DoSectionChange(Int_t i); + void DoApply(); + void DoUndo(); + + ClassDef(TGeoPconEditor,0) // TGeoPcon editor +}; + +class TGeoPconSection : public TGCompositeFrame, public TGWidget { + +protected: + Int_t fNumber; // Id for the section + TGNumberEntry *fEZ; // Number entry for Z position + TGNumberEntry *fERmin; // Number entry for Rmin position + TGNumberEntry *fERmax; // Number entry for Rmax position + + virtual void ConnectSignals2Slots(); + +public: + TGeoPconSection(const TGWindow *p, UInt_t w, UInt_t h, Int_t id); + virtual ~TGeoPconSection(); + void HideDaughters(); + Double_t GetZ() const; + Double_t GetRmin() const; + Double_t GetRmax() const; + void SetZ(Double_t z); + void SetRmin(Double_t rmin); + void SetRmax(Double_t rmax); + + void DoZ(); + void DoRmin(); + void DoRmax(); + + virtual void Changed(Int_t i); // *SIGNAL* + + ClassDef(TGeoPconSection,0) // TGeoPcon section +}; +#endif diff --git a/geombuilder/src/TGeoBBoxEditor.cxx b/geombuilder/src/TGeoBBoxEditor.cxx index 41bdc628701..f323a8e5bfe 100644 --- a/geombuilder/src/TGeoBBoxEditor.cxx +++ b/geombuilder/src/TGeoBBoxEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoBBoxEditor.cxx,v 1.1 2006/06/13 15:27:11 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -215,7 +215,7 @@ void TGeoBBoxEditor::ConnectSignals2Slots() //______________________________________________________________________________ void TGeoBBoxEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) { - // Connect to the picked volume. + // Update editor for a new selected box. if (obj == 0 || (obj->IsA()!=TGeoBBox::Class())) { SetActive(kFALSE); return; @@ -250,6 +250,7 @@ void TGeoBBoxEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) //______________________________________________________________________________ void TGeoBBoxEditor::DoName() { + //Slot for name. const char *name = fShapeName->GetText(); if (!strcmp(name, "-no_name") || !strcmp(name, fShape->GetName())) return; fShape->SetName(name); @@ -263,6 +264,7 @@ void TGeoBBoxEditor::DoName() //______________________________________________________________________________ Bool_t TGeoBBoxEditor::DoBoxParameters() { + //Check current box parameters. Double_t dx = fBoxDx->GetNumber(); Double_t dy = fBoxDy->GetNumber(); Double_t dz = fBoxDz->GetNumber(); @@ -295,6 +297,7 @@ Bool_t TGeoBBoxEditor::DoBoxParameters() //______________________________________________________________________________ void TGeoBBoxEditor::DoApply() { + //Slot for applying current parameters. DoName(); if (DoBoxParameters()) { fUndo->SetEnabled(); @@ -306,6 +309,7 @@ void TGeoBBoxEditor::DoApply() //______________________________________________________________________________ void TGeoBBoxEditor::DoCancel() { + // Slot for canceling current parameters. if (!fNamei.Length()) fShapeName->SetText("-no_name"); else fShapeName->SetText(fNamei.Data()); fBoxDx->SetNumber(fDxi); @@ -322,6 +326,7 @@ void TGeoBBoxEditor::DoCancel() //______________________________________________________________________________ void TGeoBBoxEditor::DoModified() { + //Slot for modifying current parameters. fApply->SetEnabled(); if (fUndo->GetState()==kButtonDisabled) fCancel->SetEnabled(); } @@ -329,6 +334,7 @@ void TGeoBBoxEditor::DoModified() //______________________________________________________________________________ void TGeoBBoxEditor::DoUndo() { + // Slot for undoing last operation. DoCancel(); DoBoxParameters(); fCancel->SetEnabled(kFALSE); @@ -339,18 +345,21 @@ void TGeoBBoxEditor::DoUndo() //______________________________________________________________________________ void TGeoBBoxEditor::DoDx() { + //Slot for Dx modification. DoModified(); } //______________________________________________________________________________ void TGeoBBoxEditor::DoDy() { + //Slot for Dy modification. DoModified(); } //______________________________________________________________________________ void TGeoBBoxEditor::DoDz() { + //Slot for Dz modification. DoModified(); } diff --git a/geombuilder/src/TGeoConeEditor.cxx b/geombuilder/src/TGeoConeEditor.cxx index 5513a2d0d3f..44facf36fac 100644 --- a/geombuilder/src/TGeoConeEditor.cxx +++ b/geombuilder/src/TGeoConeEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoConeEditor.cxx,v 1.1 2006/06/13 15:27:11 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -207,7 +207,7 @@ void TGeoConeEditor::ConnectSignals2Slots() //______________________________________________________________________________ void TGeoConeEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) { - // Connect to the picked volume. + // Connect to the selected object. if (obj == 0 || (obj->IsA()!=TGeoCone::Class())) { SetActive(kFALSE); return; @@ -238,12 +238,14 @@ void TGeoConeEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) //______________________________________________________________________________ void TGeoConeEditor::DoName() { + // Slot for name. DoModified(); } //______________________________________________________________________________ void TGeoConeEditor::DoApply() { + //Slot for applying current parameters. const char *name = fShapeName->GetText(); if (strcmp(name,fShape->GetName())) { fShape->SetName(name); @@ -274,6 +276,7 @@ void TGeoConeEditor::DoApply() //______________________________________________________________________________ void TGeoConeEditor::DoCancel() { + //Slot for changing current parameters. fShapeName->SetText(fNamei.Data()); fERmin1->SetNumber(fRmini1); fERmin2->SetNumber(fRmini2); @@ -288,6 +291,7 @@ void TGeoConeEditor::DoCancel() //______________________________________________________________________________ void TGeoConeEditor::DoModified() { + //Slot for modifing current parameters. fApply->SetEnabled(); if (fUndo->GetState()==kButtonDisabled) fCancel->SetEnabled(); } @@ -295,6 +299,7 @@ void TGeoConeEditor::DoModified() //______________________________________________________________________________ void TGeoConeEditor::DoUndo() { + // Slot for undoing current operation. DoCancel(); DoApply(); fCancel->SetEnabled(kFALSE); @@ -305,6 +310,7 @@ void TGeoConeEditor::DoUndo() //______________________________________________________________________________ void TGeoConeEditor::DoRmin1() { + // Slot for Rmin1 Double_t rmin1 = fERmin1->GetNumber(); Double_t rmax1 = fERmax1->GetNumber(); if (rmax1<rmin1+1.e-10) { @@ -317,6 +323,7 @@ void TGeoConeEditor::DoRmin1() //______________________________________________________________________________ void TGeoConeEditor::DoRmax1() { + // Slot for Rmax1 Double_t rmin1 = fERmin1->GetNumber(); Double_t rmax1 = fERmax1->GetNumber(); if (rmax1<rmin1+1.e-10) { @@ -330,6 +337,7 @@ void TGeoConeEditor::DoRmax1() //______________________________________________________________________________ void TGeoConeEditor::DoRmin2() { + // Slot for Rmin2 Double_t rmin2 = fERmin2->GetNumber(); Double_t rmax2 = fERmax2->GetNumber(); if (rmax2<rmin2+1.e-10) { @@ -342,6 +350,7 @@ void TGeoConeEditor::DoRmin2() //______________________________________________________________________________ void TGeoConeEditor::DoRmax2() { + // Slot for Rmax2 Double_t rmin2 = fERmin2->GetNumber(); Double_t rmax2 = fERmax2->GetNumber(); if (rmax2<rmin2+1.e-10) { @@ -355,6 +364,7 @@ void TGeoConeEditor::DoRmax2() //______________________________________________________________________________ void TGeoConeEditor::DoDz() { + // Slot for Dz DoModified(); } @@ -446,6 +456,7 @@ TGeoConeSegEditor::~TGeoConeSegEditor() //______________________________________________________________________________ void TGeoConeSegEditor::ConnectSignals2Slots() { + // Connect signals to slots. TGeoConeEditor::ConnectSignals2Slots(); Disconnect(fApply, "Clicked()",(TGeoConeEditor*)this, "DoApply()"); Disconnect(fUndo, "Clicked()",(TGeoConeEditor*)this, "DoUndo()"); @@ -463,7 +474,7 @@ void TGeoConeSegEditor::ConnectSignals2Slots() //______________________________________________________________________________ void TGeoConeSegEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) { - // Connect to the picked volume. + // Connect to the selected object. if (obj == 0 || (obj->IsA()!=TGeoConeSeg::Class())) { SetActive(kFALSE); return; @@ -499,6 +510,7 @@ void TGeoConeSegEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) //______________________________________________________________________________ void TGeoConeSegEditor::DoPhi1() { + //Slot for Phi1 Double_t phi1 = fEPhi1->GetNumber(); Double_t phi2 = fEPhi2->GetNumber(); if (phi1 > 360-1.e-10) { @@ -519,6 +531,7 @@ void TGeoConeSegEditor::DoPhi1() //______________________________________________________________________________ void TGeoConeSegEditor::DoPhi2() { + // Slot for Phi2 Double_t phi1 = fEPhi1->GetNumber(); Double_t phi2 = fEPhi2->GetNumber(); if (phi2-phi1 > 360.) { @@ -539,6 +552,7 @@ void TGeoConeSegEditor::DoPhi2() //______________________________________________________________________________ void TGeoConeSegEditor::DoPhi() { + // Slot for Phi if (!fLock) { DoModified(); fLock = kTRUE; @@ -551,6 +565,7 @@ void TGeoConeSegEditor::DoPhi() //______________________________________________________________________________ void TGeoConeSegEditor::DoApply() { + // Slot for applying current parameters. const char *name = fShapeName->GetText(); if (strcmp(name,fShape->GetName())) { fShape->SetName(name); @@ -592,6 +607,7 @@ void TGeoConeSegEditor::DoApply() //______________________________________________________________________________ void TGeoConeSegEditor::DoUndo() { + // Slot for undoing last operation. DoCancel(); DoApply(); fCancel->SetEnabled(kFALSE); @@ -602,6 +618,7 @@ void TGeoConeSegEditor::DoUndo() //______________________________________________________________________________ void TGeoConeSegEditor::DoCancel() { + // Slot for cancel last operation. fEPhi1->SetNumber(fPmini); fEPhi2->SetNumber(fPmaxi); fSPhi->SetPosition(fPmini,fPmaxi); diff --git a/geombuilder/src/TGeoManagerEditor.cxx b/geombuilder/src/TGeoManagerEditor.cxx index f1c7876be9e..6d17349a789 100644 --- a/geombuilder/src/TGeoManagerEditor.cxx +++ b/geombuilder/src/TGeoManagerEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoManagerEditor.cxx,v 1.1 2006/06/13 15:27:11 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -14,6 +14,38 @@ // TGeoManagerEditor // // ////////////////////////////////////////////////////////////////////////// +/* + Editor for TGeoManager class. Provides also builder functionality for the + main TGeo objects: TGeoVolume, TGeoShape - derived classes, TGeoMaterial, + TGeoMatrix - derived transformations and TGeoMedium. + The GUI represents the main entry point for editing geometry classes. It + can be started either by: + 1. TGeoManager::Edit(). The method must be used when starting from a new + geometry. + 2. Left-click on the 40x40 pixels top-right corner of a pad containing a + drawn volume. The region is always accesible when drawing geometry elements + and allows also restoring the manager editor in the "Style" tab of the GED + editor anytime. + + The TGeoManager editor is vertically split by a TGShutter widget into the + following categories: + + - General. This allows changing the name/title of the geometry, setting the + top volume, closing the geometry and saving the geometry in a file. The name + of the geometry file is formed by geometry_name.C/.root depending if the geometry + need to be saved as a C macro or a .root file. + - Shapes. The category provide buttons for creation of all supported shapes. The + new shape name is chosen by the interface, but can be changed from the shape + editor GUI. Existing shapes can be browsed and edited from the same category. + - Volumes. The category allows the creation of a new volume having a given name, + shape and medium. For creating a volume assembly only the name is relevant. + Existing volumes can be browsed or edited from this category. + - Materials. Allows creation of new materials/mixtures or editing existing ones. + - Media. The same for creation/editing of tracking media (materials having a set + of properties related to tracking) + - Matrices. Allows creation of translations, rotations or combined transformations. + Existing matrices can also be browser/edited. +*/ #include "TVirtualPad.h" #include "TBaseClass.h" @@ -38,6 +70,7 @@ #include "TGeoTrd2.h" #include "TGeoCone.h" #include "TGeoSphere.h" +#include "TGeoPcon.h" #include "TGeoElement.h" #include "TGeoMaterial.h" #include "TView.h" @@ -71,7 +104,7 @@ TGeoManagerEditor::TGeoManagerEditor(const TGWindow *p, Int_t id, Int_t width, Int_t height, UInt_t options, Pixel_t back) : TGedFrame(p, id, width, height, options | kVerticalFrame, back) { - // Constructor for volume editor + // Constructor for manager editor. fGeometry = gGeoManager; fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); @@ -573,14 +606,15 @@ TGeoManagerEditor::TGeoManagerEditor(const TGWindow *p, Int_t id, Int_t width, //______________________________________________________________________________ TGeoManagerEditor::~TGeoManagerEditor() { -// Destructor +// Destructor. TGFrameElement *el; TIter next(GetList()); while ((el = (TGFrameElement *)next())) { if (!strcmp(el->fFrame->ClassName(), "TGCompositeFrame")) ((TGCompositeFrame *)el->fFrame)->Cleanup(); } - Cleanup(); + Cleanup(); + if (fTabMgr) delete fTabMgr; TClass *cl = TGeoVolume::Class(); TIter next1(cl->GetEditorList()); TGedElement *ge; @@ -651,7 +685,7 @@ void TGeoManagerEditor::ConnectSignals2Slots() //______________________________________________________________________________ void TGeoManagerEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t /*event*/) { - // Connect to the picked volume. + // Refresh editor according the selected obj. if (obj == 0 || !obj->InheritsFrom(TGeoManager::Class())) { SetActive(kFALSE); return; @@ -743,7 +777,7 @@ void TGeoManagerEditor::DoCreateBox() //______________________________________________________________________________ void TGeoManagerEditor::DoCreatePara() { - +// Create a parallelipiped. } //______________________________________________________________________________ @@ -775,25 +809,26 @@ void TGeoManagerEditor::DoCreateTrd2() //______________________________________________________________________________ void TGeoManagerEditor::DoCreateTrap() { - +// Create a general trapezoid. } //______________________________________________________________________________ void TGeoManagerEditor::DoCreateGtra() { - +// Create a twisted trapezoid. } //______________________________________________________________________________ void TGeoManagerEditor::DoCreateXtru() { - +// Create an extruded polygone. } //______________________________________________________________________________ void TGeoManagerEditor::DoCreateArb8() { - +// Create an arbitrary polygone with maximum 8 vertices sitting on 2 parallel +// planes } //______________________________________________________________________________ @@ -851,7 +886,7 @@ void TGeoManagerEditor::DoCreateCons() //______________________________________________________________________________ void TGeoManagerEditor::DoCreateSphe() { -// Create a sphere +// Create a sphere. Int_t id = gGeoManager->GetListOfShapes()->GetEntries(); fSelectedShape = new TGeoSphere(Form("sphere_%i",id), 0.5, 1., 0., 180., 0.,360.); fTabMgr->AddShape(fSelectedShape->GetName(), id); @@ -864,55 +899,64 @@ void TGeoManagerEditor::DoCreateSphe() //______________________________________________________________________________ void TGeoManagerEditor::DoCreateCtub() { - +// Create a cut tube. } //______________________________________________________________________________ void TGeoManagerEditor::DoCreateEltu() { - +// Create an eliptical tube. } //______________________________________________________________________________ void TGeoManagerEditor::DoCreateTorus() { - +// Create a torus phi segment with rmin and rmax. } //______________________________________________________________________________ void TGeoManagerEditor::DoCreatePcon() { - +// Create a polycone shape. + Int_t id = gGeoManager->GetListOfShapes()->GetEntries(); + fSelectedShape = new TGeoPcon(Form("pcon_%i",id), 0., 360., 2); + ((TGeoPcon*)fSelectedShape)->DefineSection(0, -1, 0.5, 1.); + ((TGeoPcon*)fSelectedShape)->DefineSection(1, 1, 0.2, 0.5); + fTabMgr->AddShape(fSelectedShape->GetName(), id); + ShowSelectShape(); + if (fGeometry->GetListOfMedia()->GetSize()) + fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE); + DoEditShape(); } //______________________________________________________________________________ void TGeoManagerEditor::DoCreatePgon() { - +// Create a polygone shape. } //______________________________________________________________________________ void TGeoManagerEditor::DoCreateHype() { - +// Create a hyperboloid. } //______________________________________________________________________________ void TGeoManagerEditor::DoCreateParab() { - +// Create a paraboloid. } //______________________________________________________________________________ void TGeoManagerEditor::DoCreateComposite() { - +// Create a composite shape. } //______________________________________________________________________________ void TGeoManagerEditor::DoCreateMaterial() { -// Create a new material +// Create a new material. TGeoElement *el = fGeometry->GetElementTable()->GetElement(fElementList->GetSelected()); Double_t density = fEntryDensity->GetNumber(); const char *name = fMaterialName->GetText(); @@ -926,14 +970,14 @@ void TGeoManagerEditor::DoCreateMaterial() //______________________________________________________________________________ void TGeoManagerEditor::DoCreateMixture() { -// Create a new mixture +// Create a new mixture. } //______________________________________________________________________________ void TGeoManagerEditor::DoCreateMedium() { -// Create a new medium +// Create a new medium. Int_t id = fMediumId->GetIntNumber(); if (!fSelectedMaterial2) return; const char *name = fMediumName->GetText(); @@ -948,7 +992,7 @@ void TGeoManagerEditor::DoCreateMedium() //______________________________________________________________________________ void TGeoManagerEditor::DoCreateTranslation() { -// Create a new translation +// Create a new translation. const char *name = fMatrixName->GetText(); fSelectedMatrix = new TGeoTranslation(name, 0., 0., 0.); fSelectedMatrix->SetBit(TGeoMatrix::kGeoTranslation); @@ -961,7 +1005,7 @@ void TGeoManagerEditor::DoCreateTranslation() //______________________________________________________________________________ void TGeoManagerEditor::DoCreateRotation() { -// Create a new translation +// Create a new rotation. const char *name = fMatrixName->GetText(); fSelectedMatrix = new TGeoRotation(name); fSelectedMatrix->SetBit(TGeoMatrix::kGeoRotation); @@ -974,7 +1018,7 @@ void TGeoManagerEditor::DoCreateRotation() //______________________________________________________________________________ void TGeoManagerEditor::DoCreateVolume() { -// Create a new volume +// Create a new volume. const char *name = fVolumeName->GetText(); if (!fSelectedShape2 || !fSelectedMedium2) return; fSelectedVolume = new TGeoVolume(name, fSelectedShape2, fSelectedMedium2); @@ -987,7 +1031,7 @@ void TGeoManagerEditor::DoCreateVolume() //______________________________________________________________________________ void TGeoManagerEditor::DoCreateAssembly() { -// Create a new volume assembly +// Create a new volume assembly. const char *name = fVolumeName->GetText(); fSelectedVolume = new TGeoVolumeAssembly(name); fLSelVolume->SetText(name); @@ -999,7 +1043,7 @@ void TGeoManagerEditor::DoCreateAssembly() //______________________________________________________________________________ void TGeoManagerEditor::DoCreateCombi() { -// Create a new translation +// Create a new translation + rotation. const char *name = fMatrixName->GetText(); fSelectedMatrix = new TGeoCombiTrans(name, 0., 0., 0., new TGeoRotation()); fSelectedMatrix->RegisterYourself(); @@ -1022,6 +1066,7 @@ void TGeoManagerEditor::DoSetTopVolume() //______________________________________________________________________________ void TGeoManagerEditor::DoEditShape() { +// Slot for editing selected shape. if (!fSelectedShape) return; fTabMgr->GetShapeEditor(fSelectedShape); fSelectedShape->Draw(); @@ -1031,6 +1076,7 @@ void TGeoManagerEditor::DoEditShape() //______________________________________________________________________________ void TGeoManagerEditor::DoEditVolume() { +// Slot for editing selected volume. if (!fSelectedVolume) { fTabMgr->SetEnabled(TGeoTabManager::kTabVolume, kFALSE); return; @@ -1045,9 +1091,34 @@ void TGeoManagerEditor::DoEditVolume() fSelectedVolume->Draw(); } +//______________________________________________________________________________ +void TGeoManagerEditor::DoEditMedium() +{ +// Slot for editing selected medium. + if (!fSelectedMedium) return; + fTabMgr->GetMediumEditor(fSelectedMedium); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoEditMaterial() +{ +// Slot for editing selected material. + if (!fSelectedMaterial) return; + fTabMgr->GetMaterialEditor(fSelectedMaterial); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoEditMatrix() +{ +// Slot for editing selected matrix. + if (!fSelectedMatrix) return; + fTabMgr->GetMatrixEditor(fSelectedMatrix); +} + //______________________________________________________________________________ void TGeoManagerEditor::DoSelectMatrix() { +// Slot for selecting an existing matrix. TGeoMatrix *matrix = fSelectedMatrix; new TGeoMatrixDialog(fBSelMatrix, gClient->GetRoot(), 200,300); fSelectedMatrix = (TGeoMatrix*)TGeoMatrixDialog::GetSelected(); @@ -1058,6 +1129,7 @@ void TGeoManagerEditor::DoSelectMatrix() //______________________________________________________________________________ void TGeoManagerEditor::DoSelectShape() { +// Slot for selecting an existing shape. TGeoShape *shape = fSelectedShape; new TGeoShapeDialog(fBSelShape, gClient->GetRoot(), 200,300); fSelectedShape = (TGeoShape*)TGeoShapeDialog::GetSelected(); @@ -1068,6 +1140,7 @@ void TGeoManagerEditor::DoSelectShape() //______________________________________________________________________________ void TGeoManagerEditor::DoSelectShape2() { +// Slot for selecting a shape for making a volume. TGeoShape *shape = fSelectedShape2; new TGeoShapeDialog(fBSelShape2, gClient->GetRoot(), 200,300); fSelectedShape2 = (TGeoShape*)TGeoShapeDialog::GetSelected(); @@ -1078,6 +1151,7 @@ void TGeoManagerEditor::DoSelectShape2() //______________________________________________________________________________ void TGeoManagerEditor::DoSelectMaterial() { +// Slot for selecting an existing material. TGeoMaterial *mat = fSelectedMaterial; new TGeoMaterialDialog(fBSelMaterial, gClient->GetRoot(), 200,300); fSelectedMaterial = (TGeoMaterial*)TGeoMaterialDialog::GetSelected(); @@ -1088,6 +1162,7 @@ void TGeoManagerEditor::DoSelectMaterial() //______________________________________________________________________________ void TGeoManagerEditor::DoSelectMaterial2() { +// Slot for selecting an existing material and making a medium. TGeoMaterial *mat = fSelectedMaterial2; new TGeoMaterialDialog(fBSelMaterial2, gClient->GetRoot(), 200,300); fSelectedMaterial2 = (TGeoMaterial*)TGeoMaterialDialog::GetSelected(); @@ -1098,6 +1173,7 @@ void TGeoManagerEditor::DoSelectMaterial2() //______________________________________________________________________________ void TGeoManagerEditor::DoSelectMedium() { +// Slot for selecting an existing medium. TGeoMedium *med = fSelectedMedium; new TGeoMediumDialog(fBSelMedium, gClient->GetRoot(), 200,300); fSelectedMedium = (TGeoMedium*)TGeoMediumDialog::GetSelected(); @@ -1108,6 +1184,7 @@ void TGeoManagerEditor::DoSelectMedium() //______________________________________________________________________________ void TGeoManagerEditor::DoSelectMedium2() { +// Slot for selecting an existing medium for making a volume. TGeoMedium *med = fSelectedMedium2; new TGeoMediumDialog(fBSelMedium2, gClient->GetRoot(), 200,300); fSelectedMedium2 = (TGeoMedium*)TGeoMediumDialog::GetSelected(); @@ -1118,6 +1195,7 @@ void TGeoManagerEditor::DoSelectMedium2() //______________________________________________________________________________ void TGeoManagerEditor::DoSelectVolume() { +// Slot for selecting an existing volume. TGeoVolume *vol = fSelectedVolume; new TGeoVolumeDialog(fBSelVolume, gClient->GetRoot(), 200,300); fSelectedVolume = (TGeoVolume*)TGeoVolumeDialog::GetSelected(); @@ -1128,6 +1206,7 @@ void TGeoManagerEditor::DoSelectVolume() //______________________________________________________________________________ void TGeoManagerEditor::DoSelectTopVolume() { +// Slot for seting top geometry volume. TGeoVolume *vol = fGeometry->GetTopVolume(); new TGeoVolumeDialog(fBSelTop, gClient->GetRoot(), 200,300); fSelectedVolume = (TGeoVolume*)TGeoVolumeDialog::GetSelected(); @@ -1139,36 +1218,15 @@ void TGeoManagerEditor::DoSelectTopVolume() //______________________________________________________________________________ void TGeoManagerEditor::DoCloseGeometry() { -// Close the geometry +// Slot for closing the geometry. if (!fGeometry->IsClosed()) fGeometry->CloseGeometry(); fCloseGeometry->SetEnabled(kFALSE); } -//______________________________________________________________________________ -void TGeoManagerEditor::DoEditMedium() -{ - if (!fSelectedMedium) return; - fTabMgr->GetMediumEditor(fSelectedMedium); -} - -//______________________________________________________________________________ -void TGeoManagerEditor::DoEditMaterial() -{ - if (!fSelectedMaterial) return; - fTabMgr->GetMaterialEditor(fSelectedMaterial); -} - -//______________________________________________________________________________ -void TGeoManagerEditor::DoEditMatrix() -{ - if (!fSelectedMatrix) return; - fTabMgr->GetMatrixEditor(fSelectedMatrix); -} - //______________________________________________________________________________ void TGeoManagerEditor::ShowSelectShape(Bool_t show) { -// Show/hide interface for shape selection +// Show/hide interface for shape selection. TGCompositeFrame *cont = (TGCompositeFrame*)fCategories->GetItem("Shapes")->GetContainer(); if (show) cont->ShowFrame(f2); else cont->HideFrame(f2); @@ -1177,7 +1235,7 @@ void TGeoManagerEditor::ShowSelectShape(Bool_t show) //______________________________________________________________________________ void TGeoManagerEditor::ShowSelectVolume(Bool_t show) { -// Show/hide interface for shape selection +// Show/hide interface for volume selection. TGCompositeFrame *cont = (TGCompositeFrame*)fCategories->GetItem("General")->GetContainer(); if (show) cont->ShowFrame(f7); else cont->HideFrame(f7); @@ -1189,7 +1247,7 @@ void TGeoManagerEditor::ShowSelectVolume(Bool_t show) //______________________________________________________________________________ void TGeoManagerEditor::ShowSelectMaterial(Bool_t show) { -// Show/hide interface for shape selection +// Show/hide interface for material selection. TGCompositeFrame *cont = (TGCompositeFrame*)fCategories->GetItem("Materials")->GetContainer(); if (show) cont->ShowFrame(f4); else cont->HideFrame(f4); @@ -1198,7 +1256,7 @@ void TGeoManagerEditor::ShowSelectMaterial(Bool_t show) //______________________________________________________________________________ void TGeoManagerEditor::ShowSelectMedium(Bool_t show) { -// Show/hide interface for shape selection +// Show/hide interface for medium selection. TGCompositeFrame *cont = (TGCompositeFrame*)fCategories->GetItem("Media")->GetContainer(); if (show) cont->ShowFrame(f5); else cont->HideFrame(f5); @@ -1207,7 +1265,7 @@ void TGeoManagerEditor::ShowSelectMedium(Bool_t show) //______________________________________________________________________________ void TGeoManagerEditor::ShowSelectMatrix(Bool_t show) { -// Show/hide interface for shape selection +// Show/hide interface for matrix selection. TGCompositeFrame *cont = (TGCompositeFrame*)fCategories->GetItem("Matrices")->GetContainer(); if (show) cont->ShowFrame(f6); else cont->HideFrame(f6); diff --git a/geombuilder/src/TGeoMaterialEditor.cxx b/geombuilder/src/TGeoMaterialEditor.cxx index 588d026bd49..c5337fca98f 100644 --- a/geombuilder/src/TGeoMaterialEditor.cxx +++ b/geombuilder/src/TGeoMaterialEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoMaterialEditor.cxx,v 1.1 2006/06/13 15:27:11 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -42,7 +42,7 @@ TGeoMaterialEditor::TGeoMaterialEditor(const TGWindow *p, Int_t id, Int_t width, Int_t height, UInt_t options, Pixel_t back) : TGedFrame(p, id, width, height, options | kVerticalFrame, back) { - // Constructor for volume editor + // Constructor for material editor. fMaterial = 0; fAi = fZi = 0; fDensityi = 0.0; @@ -52,7 +52,7 @@ TGeoMaterialEditor::TGeoMaterialEditor(const TGWindow *p, Int_t id, Int_t width, fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); - // TextEntry for shape name + // TextEntry for material name MakeTitle("Name"); fMaterialName = new TGTextEntry(this, new TGTextBuffer(50), kMATERIAL_NAME); fMaterialName->Resize(135, fMaterialName->GetDefaultHeight()); @@ -187,7 +187,7 @@ void TGeoMaterialEditor::ConnectSignals2Slots() //______________________________________________________________________________ void TGeoMaterialEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) { - // Connect to the picked volume. + // Connect to the selected material. if (obj == 0 || !(obj->InheritsFrom(TGeoMaterial::Class()))) { SetActive(kFALSE); return; @@ -216,7 +216,7 @@ void TGeoMaterialEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) //______________________________________________________________________________ void TGeoMaterialEditor::DoName() { -// Perform name change +// Perform name change. fUndo->SetEnabled(); fCancel->SetEnabled(kFALSE); fApply->SetEnabled(kTRUE); @@ -225,6 +225,7 @@ void TGeoMaterialEditor::DoName() //______________________________________________________________________________ void TGeoMaterialEditor::DoA() { +// Slot for atomic mass. fMatA->SetNumber(fAi); DoModified(); } @@ -232,6 +233,7 @@ void TGeoMaterialEditor::DoA() //______________________________________________________________________________ void TGeoMaterialEditor::DoZ() { +// Slot for charge. fMatZ->SetNumber(fZi); DoModified(); } @@ -239,6 +241,7 @@ void TGeoMaterialEditor::DoZ() //______________________________________________________________________________ void TGeoMaterialEditor::DoDensity() { +// Slot for density. fMatDensity->SetNumber(fDensityi); DoModified(); } @@ -246,6 +249,7 @@ void TGeoMaterialEditor::DoDensity() //______________________________________________________________________________ void TGeoMaterialEditor::DoRadAbs() { +// Slot for radiation/absorbtion length. fMatRadLen->SetNumber(fMaterial->GetRadLen()); fMatAbsLen->SetNumber(fMaterial->GetIntLen()); DoModified(); @@ -254,6 +258,7 @@ void TGeoMaterialEditor::DoRadAbs() //______________________________________________________________________________ void TGeoMaterialEditor::DoApply() { +// Slot for applying modifications. const char *name = fMaterialName->GetText(); fMaterial->SetName(name); Int_t id = gGeoManager->GetListOfMaterials()->IndexOf(fMaterial); @@ -271,6 +276,7 @@ void TGeoMaterialEditor::DoApply() //______________________________________________________________________________ void TGeoMaterialEditor::DoCancel() { +// Slot for cancelling current modifications. fMaterialName->SetText(fNamei.Data()); fMatA->SetNumber(fAi); fMatZ->SetNumber(fZi); @@ -285,6 +291,7 @@ void TGeoMaterialEditor::DoCancel() //______________________________________________________________________________ void TGeoMaterialEditor::DoModified() { +// Slot for signaling modifications. fApply->SetEnabled(); if (fUndo->GetState()==kButtonDisabled) fCancel->SetEnabled(); } @@ -292,6 +299,7 @@ void TGeoMaterialEditor::DoModified() //______________________________________________________________________________ void TGeoMaterialEditor::DoUndo() { +// Slot for undoing last operation. DoCancel(); fCancel->SetEnabled(kFALSE); fUndo->SetEnabled(kFALSE); diff --git a/geombuilder/src/TGeoMatrixEditor.cxx b/geombuilder/src/TGeoMatrixEditor.cxx index e2cced88186..95813ad412e 100644 --- a/geombuilder/src/TGeoMatrixEditor.cxx +++ b/geombuilder/src/TGeoMatrixEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoMatrixEditor.cxx,v 1.1 2006/06/13 15:27:11 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -40,7 +40,7 @@ TGeoTranslationEditor::TGeoTranslationEditor(const TGWindow *p, Int_t id, Int_t Int_t height, UInt_t options, Pixel_t back) : TGedFrame(p, id, width, height, options | kVerticalFrame, back) { - // Constructor for volume editor + // Constructor for translation editor fTranslation = 0; fDxi = fDyi = fDzi = 0.0; fNamei = ""; @@ -124,7 +124,7 @@ TGeoTranslationEditor::TGeoTranslationEditor(const TGWindow *p, Int_t id, Int_t //______________________________________________________________________________ TGeoTranslationEditor::~TGeoTranslationEditor() { -// Destructor +// Destructor. TGFrameElement *el; TIter next(GetList()); @@ -166,7 +166,7 @@ void TGeoTranslationEditor::ConnectSignals2Slots() //______________________________________________________________________________ void TGeoTranslationEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) { - // Connect to the picked volume. + // Connect to the new matrix. if (obj == 0 || (obj->IsA()!=TGeoTranslation::Class())) { SetActive(kFALSE); return; @@ -197,6 +197,7 @@ void TGeoTranslationEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) //______________________________________________________________________________ void TGeoTranslationEditor::DoName() { +// Slot for name. const char *name = fTransName->GetText(); if (!strcmp(name, "no_name") || !strcmp(name, fTranslation->GetName())) return; fTranslation->SetName(name); @@ -205,6 +206,7 @@ void TGeoTranslationEditor::DoName() //______________________________________________________________________________ Bool_t TGeoTranslationEditor::DoParameters() { +// Slot for checking parameters. Double_t dx = fTransDx->GetNumber(); Double_t dy = fTransDy->GetNumber(); Double_t dz = fTransDz->GetNumber(); @@ -225,6 +227,7 @@ Bool_t TGeoTranslationEditor::DoParameters() //______________________________________________________________________________ void TGeoTranslationEditor::DoApply() { +// Slot for applying changes. DoName(); if (DoParameters()) { fUndo->SetEnabled(); @@ -236,6 +239,7 @@ void TGeoTranslationEditor::DoApply() //______________________________________________________________________________ void TGeoTranslationEditor::DoCancel() { +// Slot for cancelling last modifications non-applied. if (!fNamei.Length()) fTransName->SetText("no_name"); else fTransName->SetText(fNamei.Data()); fTransDx->SetNumber(fDxi); @@ -249,6 +253,7 @@ void TGeoTranslationEditor::DoCancel() //______________________________________________________________________________ void TGeoTranslationEditor::DoModified() { +// Slot for notifying changes. fApply->SetEnabled(); if (fUndo->GetState()==kButtonDisabled) fCancel->SetEnabled(); } @@ -256,6 +261,7 @@ void TGeoTranslationEditor::DoModified() //______________________________________________________________________________ void TGeoTranslationEditor::DoUndo() { +// Slot for undoing last operation. DoCancel(); DoParameters(); fCancel->SetEnabled(kFALSE); @@ -266,18 +272,21 @@ void TGeoTranslationEditor::DoUndo() //______________________________________________________________________________ void TGeoTranslationEditor::DoDx() { +// Slot for dx. DoModified(); } //______________________________________________________________________________ void TGeoTranslationEditor::DoDy() { +// Slot for dx. DoModified(); } //______________________________________________________________________________ void TGeoTranslationEditor::DoDz() { +// Slot for dx. DoModified(); } @@ -296,7 +305,7 @@ TGeoRotationEditor::TGeoRotationEditor(const TGWindow *p, Int_t id, Int_t width, Int_t height, UInt_t options, Pixel_t back) : TGedFrame(p, id, width, height, options | kVerticalFrame, back) { - // Constructor for volume editor + // Constructor for rotation editor fRotation = 0; fPhii = fThetai = fPsii = 0.0; fAngleX = fAngleY = fAngleZ = 0.0; @@ -453,7 +462,7 @@ void TGeoRotationEditor::ConnectSignals2Slots() //______________________________________________________________________________ void TGeoRotationEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) { - // Connect to the picked volume. + // Connect to the selected rotation. if (obj == 0 || (obj->IsA()!=TGeoRotation::Class())) { SetActive(kFALSE); return; @@ -484,6 +493,7 @@ void TGeoRotationEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) //______________________________________________________________________________ void TGeoRotationEditor::DoName() { +// Slot for name. const char *name = fRotName->GetText(); if (!strcmp(name, "no_name") || !strcmp(name, fRotation->GetName())) return; fRotation->SetName(name); @@ -492,6 +502,7 @@ void TGeoRotationEditor::DoName() //______________________________________________________________________________ void TGeoRotationEditor::DoRotPhi() { +// Slot for phi (Euler X convention) if (fRotPhi->GetNumber() < 0.) fRotPhi->SetNumber(fRotPhi->GetNumber()+360.); if (fRotPhi->GetNumber() >= 360.) fRotPhi->SetNumber(fRotPhi->GetNumber()-360.); DoModified(); @@ -500,6 +511,7 @@ void TGeoRotationEditor::DoRotPhi() //______________________________________________________________________________ void TGeoRotationEditor::DoRotTheta() { +// Slot for theta (Euler X convention) if (fRotTheta->GetNumber() < 0.) fRotTheta->SetNumber(fRotTheta->GetNumber()+360.); if (fRotTheta->GetNumber() >= 360.) fRotTheta->SetNumber(fRotTheta->GetNumber()-360.); DoModified(); @@ -508,6 +520,7 @@ void TGeoRotationEditor::DoRotTheta() //______________________________________________________________________________ void TGeoRotationEditor::DoRotPsi() { +// Slot for psi (Euler X convention) if (fRotPsi->GetNumber() < 0.) fRotPsi->SetNumber(fRotPsi->GetNumber()+360.); if (fRotPsi->GetNumber() >= 360.) fRotPsi->SetNumber(fRotPsi->GetNumber()-360.); DoModified(); @@ -516,6 +529,7 @@ void TGeoRotationEditor::DoRotPsi() //______________________________________________________________________________ void TGeoRotationEditor::DoRotAngle() { +// Slot for additional rotation about one axis. if (fRotAxis->GetNumber() < 0.) fRotAxis->SetNumber(fRotAxis->GetNumber()+360.); if (fRotAxis->GetNumber() >= 360.) fRotAxis->SetNumber(fRotAxis->GetNumber()-360.); DoModified(); @@ -524,6 +538,7 @@ void TGeoRotationEditor::DoRotAngle() //______________________________________________________________________________ Bool_t TGeoRotationEditor::DoParameters() { +// Slot for checking parameters. Double_t phi = fRotPhi->GetNumber(); Double_t theta = fRotTheta->GetNumber(); Double_t psi = fRotPsi->GetNumber(); @@ -552,6 +567,7 @@ Bool_t TGeoRotationEditor::DoParameters() //______________________________________________________________________________ void TGeoRotationEditor::DoApply() { +// Slot for applying modifications. DoName(); if (DoParameters()) { fUndo->SetEnabled(); @@ -563,6 +579,7 @@ void TGeoRotationEditor::DoApply() //______________________________________________________________________________ void TGeoRotationEditor::DoCancel() { +// Slot for cancelling last un-applied operations. if (!fNamei.Length()) fRotName->SetText("no_name"); else fRotName->SetText(fNamei.Data()); fRotPhi->SetNumber(fPhii); @@ -577,6 +594,7 @@ void TGeoRotationEditor::DoCancel() //______________________________________________________________________________ void TGeoRotationEditor::DoModified() { +// Slot for notifying changes. fApply->SetEnabled(); if (fUndo->GetState()==kButtonDisabled) fCancel->SetEnabled(); } @@ -584,6 +602,7 @@ void TGeoRotationEditor::DoModified() //______________________________________________________________________________ void TGeoRotationEditor::DoUndo() { +// Slot for undoing last changes. DoCancel(); DoParameters(); fCancel->SetEnabled(kFALSE); @@ -607,7 +626,7 @@ TGeoCombiTransEditor::TGeoCombiTransEditor(const TGWindow *p, Int_t id, Int_t wi Int_t height, UInt_t options, Pixel_t back) : TGedFrame(p, id, width, height, options | kVerticalFrame, back) { - // Constructor for volume editor + // Constructor for combi matrix editor fCombi = 0; fPhii = fThetai = fPsii = 0.0; fDxi = fDyi = fDzi = 0.0; @@ -810,7 +829,7 @@ void TGeoCombiTransEditor::ConnectSignals2Slots() //______________________________________________________________________________ void TGeoCombiTransEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) { - // Connect to the picked volume. + // Connect to the selected combi matrix. if (obj == 0 || (obj->IsA()!=TGeoCombiTrans::Class())) { SetActive(kFALSE); return; @@ -850,6 +869,7 @@ void TGeoCombiTransEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) //______________________________________________________________________________ void TGeoCombiTransEditor::DoName() { +// Slot for name. const char *name = fRotName->GetText(); if (!strcmp(name, "no_name") || !strcmp(name, fCombi->GetName())) return; fCombi->SetName(name); @@ -858,6 +878,7 @@ void TGeoCombiTransEditor::DoName() //______________________________________________________________________________ void TGeoCombiTransEditor::DoRotPhi() { +// Slot for phi (Euler X convention) if (fRotPhi->GetNumber() < 0.) fRotPhi->SetNumber(fRotPhi->GetNumber()+360.); if (fRotPhi->GetNumber() >= 360.) fRotPhi->SetNumber(fRotPhi->GetNumber()-360.); DoModified(); @@ -866,6 +887,7 @@ void TGeoCombiTransEditor::DoRotPhi() //______________________________________________________________________________ void TGeoCombiTransEditor::DoRotTheta() { +// Slot for theta (Euler X convention) if (fRotTheta->GetNumber() < 0.) fRotTheta->SetNumber(fRotTheta->GetNumber()+360.); if (fRotTheta->GetNumber() >= 360.) fRotTheta->SetNumber(fRotTheta->GetNumber()-360.); DoModified(); @@ -874,6 +896,7 @@ void TGeoCombiTransEditor::DoRotTheta() //______________________________________________________________________________ void TGeoCombiTransEditor::DoRotPsi() { +// Slot for psi (Euler X convention) if (fRotPsi->GetNumber() < 0.) fRotPsi->SetNumber(fRotPsi->GetNumber()+360.); if (fRotPsi->GetNumber() >= 360.) fRotPsi->SetNumber(fRotPsi->GetNumber()-360.); DoModified(); @@ -882,6 +905,7 @@ void TGeoCombiTransEditor::DoRotPsi() //______________________________________________________________________________ void TGeoCombiTransEditor::DoRotAngle() { +// Slot for additional rotation about one axis. if (fRotAxis->GetNumber() < 0.) fRotAxis->SetNumber(fRotAxis->GetNumber()+360.); if (fRotAxis->GetNumber() >= 360.) fRotAxis->SetNumber(fRotAxis->GetNumber()-360.); DoModified(); @@ -890,6 +914,7 @@ void TGeoCombiTransEditor::DoRotAngle() //______________________________________________________________________________ Bool_t TGeoCombiTransEditor::DoParameters() { +// Slot for checking parameters. Double_t dx = fTransDx->GetNumber(); Double_t dy = fTransDy->GetNumber(); Double_t dz = fTransDz->GetNumber(); @@ -936,6 +961,7 @@ Bool_t TGeoCombiTransEditor::DoParameters() //______________________________________________________________________________ void TGeoCombiTransEditor::DoApply() { +// Slot for applying modifications. DoName(); if (DoParameters()) { fUndo->SetEnabled(); @@ -947,6 +973,7 @@ void TGeoCombiTransEditor::DoApply() //______________________________________________________________________________ void TGeoCombiTransEditor::DoCancel() { +// Slot for cancelling last un-applied operations. if (!fNamei.Length()) fRotName->SetText("no_name"); else fRotName->SetText(fNamei.Data()); fTransDx->SetNumber(fDxi); @@ -964,6 +991,7 @@ void TGeoCombiTransEditor::DoCancel() //______________________________________________________________________________ void TGeoCombiTransEditor::DoModified() { +// Slot for notifying changes. fApply->SetEnabled(); if (fUndo->GetState()==kButtonDisabled) fCancel->SetEnabled(); } @@ -971,6 +999,7 @@ void TGeoCombiTransEditor::DoModified() //______________________________________________________________________________ void TGeoCombiTransEditor::DoUndo() { +// Slot for undoing last changes. DoCancel(); DoParameters(); fCancel->SetEnabled(kFALSE); @@ -981,18 +1010,21 @@ void TGeoCombiTransEditor::DoUndo() //______________________________________________________________________________ void TGeoCombiTransEditor::DoDx() { +// Slot for X. DoModified(); } //______________________________________________________________________________ void TGeoCombiTransEditor::DoDy() { +// Slot for Y. DoModified(); } //______________________________________________________________________________ void TGeoCombiTransEditor::DoDz() { +// Slot for Z. DoModified(); } diff --git a/geombuilder/src/TGeoMediumEditor.cxx b/geombuilder/src/TGeoMediumEditor.cxx index 40f002f04ab..f0966078081 100644 --- a/geombuilder/src/TGeoMediumEditor.cxx +++ b/geombuilder/src/TGeoMediumEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoMediumEditor.cxx,v 1.1 2006/06/13 15:27:11 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -44,7 +44,7 @@ TGeoMediumEditor::TGeoMediumEditor(const TGWindow *p, Int_t id, Int_t width, Int_t height, UInt_t options, Pixel_t back) : TGedFrame(p, id, width, height, options | kVerticalFrame, back) { - // Constructor for volume editor + // Constructor for medium editor fMedium = 0; fIsEditable = kFALSE; fIsModified = kFALSE; @@ -265,7 +265,7 @@ void TGeoMediumEditor::ConnectSignals2Slots() //______________________________________________________________________________ void TGeoMediumEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) { - // Connect to the picked volume. + // Connect to the selected object. if (obj == 0 || !(obj->IsA()==TGeoMedium::Class())) { SetActive(kFALSE); return; @@ -339,6 +339,7 @@ void TGeoMediumEditor::DoEditMaterial() //______________________________________________________________________________ void TGeoMediumEditor::DoMedName() { +// Slot for medium name. const char *name = fMedName->GetText(); if (!strlen(name) || !strcmp(name, fMedium->GetName())) return; fMedium->SetName(name); @@ -347,11 +348,13 @@ void TGeoMediumEditor::DoMedName() //______________________________________________________________________________ void TGeoMediumEditor::DoMedId() { +// Slot for medium id. } //______________________________________________________________________________ void TGeoMediumEditor::DoSelectMaterial() { +// Select the material component. TGeoMaterial *material = fSelectedMaterial; new TGeoMaterialDialog(fBSelMaterial, gClient->GetRoot(), 200,300); fSelectedMaterial = (TGeoMaterial*)TGeoMaterialDialog::GetSelected(); @@ -362,54 +365,63 @@ void TGeoMediumEditor::DoSelectMaterial() //______________________________________________________________________________ void TGeoMediumEditor::DoToggleSensitive() { +// Slot for sensitivity. fIsModified = kTRUE; } //______________________________________________________________________________ void TGeoMediumEditor::DoMagfldSelect(Int_t) { +// Slot for mag. field. fIsModified = kTRUE; } //______________________________________________________________________________ void TGeoMediumEditor::DoFieldm() { +// Slot for max field. fIsModified = kTRUE; } //______________________________________________________________________________ void TGeoMediumEditor::DoTmaxfd() { +// Slot for tmaxfd. fIsModified = kTRUE; } //______________________________________________________________________________ void TGeoMediumEditor::DoStemax() { +// Slot for the max allowed step. fIsModified = kTRUE; } //______________________________________________________________________________ void TGeoMediumEditor::DoDeemax() { +// Slot for the maximum allowed dedx. fIsModified = kTRUE; } //______________________________________________________________________________ void TGeoMediumEditor::DoEpsil() { +// Slot for tracking precision. fIsModified = kTRUE; } //______________________________________________________________________________ void TGeoMediumEditor::DoStmin() { +// Slot for min. step. fIsModified = kTRUE; } //______________________________________________________________________________ void TGeoMediumEditor::DoApply() { +// Slot for applying modifications. if (!fIsModified) return; Double_t isvol = (fMedSensitive->IsOn())?1:0; Double_t ifield = fMagfldOption->GetSelected(); @@ -439,5 +451,6 @@ void TGeoMediumEditor::DoApply() //______________________________________________________________________________ void TGeoMediumEditor::DoUndo() { +// Slot for undoing last operation. } diff --git a/geombuilder/src/TGeoNodeEditor.cxx b/geombuilder/src/TGeoNodeEditor.cxx index 050cfa67d3a..fab220bd2d6 100644 --- a/geombuilder/src/TGeoNodeEditor.cxx +++ b/geombuilder/src/TGeoNodeEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoNodeEditor.cxx,v 1.1 2006/06/13 15:27:11 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -41,7 +41,7 @@ TGeoNodeEditor::TGeoNodeEditor(const TGWindow *p, Int_t id, Int_t width, Int_t height, UInt_t options, Pixel_t back) : TGedFrame(p, id, width, height, options | kVerticalFrame, back) { - // Constructor for volume editor + // Constructor for node editor fNode = 0; fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); @@ -173,7 +173,7 @@ void TGeoNodeEditor::ConnectSignals2Slots() //______________________________________________________________________________ void TGeoNodeEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t /*event*/) { - // Connect to the picked volume. + // Connect to a editable object. if (obj == 0 || !obj->InheritsFrom(TGeoNode::Class())) { SetActive(kFALSE); return; @@ -262,30 +262,36 @@ void TGeoNodeEditor::DoNodeNumber() //______________________________________________________________________________ void TGeoNodeEditor::DoVolumeSelect() { +// Select the volume for the node. } //______________________________________________________________________________ void TGeoNodeEditor::DoMotherVolumeSelect() { +// Select the mother volume for the node. } //______________________________________________________________________________ void TGeoNodeEditor::DoMatrixSelect() { +// Select the matrix for the node. } //______________________________________________________________________________ void TGeoNodeEditor::DoApply() { +// Slot for applying modifications. } //______________________________________________________________________________ void TGeoNodeEditor::DoCancel() { +// Slot for cancelling current modifications. } //______________________________________________________________________________ void TGeoNodeEditor::DoUndo() { +// Slot for undoing last operation. } diff --git a/geombuilder/src/TGeoPconEditor.cxx b/geombuilder/src/TGeoPconEditor.cxx new file mode 100644 index 00000000000..979c0384243 --- /dev/null +++ b/geombuilder/src/TGeoPconEditor.cxx @@ -0,0 +1,574 @@ +// @(#):$Name: $:$Id: TGeoPconEditor.cxx,v 1.1 2006/06/13 15:27:11 brun Exp $ +// 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. * + *************************************************************************/ + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoPconEditor // +// // +////////////////////////////////////////////////////////////////////////// + +#include "TGeoPconEditor.h" +#include "TGeoTabManager.h" +#include "TGeoPcon.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" + +ClassImp(TGeoPconEditor) + +enum ETGeoPconWid { + kPCON_NAME, kPCON_NZ, kPCON_PHI1, kPCON_DPHI, kPCON_APPLY, kPCON_UNDO +}; + +//______________________________________________________________________________ +TGeoPconEditor::TGeoPconEditor(const TGWindow *p, Int_t id, Int_t width, + Int_t height, UInt_t options, Pixel_t back) + : TGedFrame(p, id, width, height, options | kVerticalFrame, back) +{ + // Constructor for polycone editor + fShape = 0; + fNsections = 0; + fNsecti = 0; + fPhi1i = 0; + fDPhii = 0; + fZi = 0; + fRmini = 0; + fRmaxi = 0; + fIsModified = kFALSE; + fIsShapeEditable = kFALSE; + + fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); + fLHsect = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0,0,2,2); + + // TextEntry for shape name + MakeTitle("Name"); + fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kPCON_NAME); + fShapeName->Resize(135, fShapeName->GetDefaultHeight()); + fShapeName->SetToolTipText("Enter the polycone name"); + fShapeName->Associate(this); + AddFrame(fShapeName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5)); + + MakeTitle("Parameters"); + // Number entry for Nsections + TGTextEntry *nef; + TGCompositeFrame *f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(new TGLabel(f1, "Nz"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fENz = new TGNumberEntry(f1, 0., 5, kPCON_NZ); + fENz->SetNumAttr(TGNumberFormat::kNEAPositive); + fENz->SetNumStyle(TGNumberFormat::kNESInteger); + fENz->Resize(100,fENz->GetDefaultHeight()); + nef = (TGTextEntry*)fENz->GetNumberEntry(); + nef->SetToolTipText("Enter the number of Z sections"); + fENz->Associate(this); + f1->AddFrame(fENz, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2)); + AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4)); + + // Number entry for Phi1 + f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(new TGLabel(f1, "Phi1"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fEPhi1 = new TGNumberEntry(f1, 0., 5, kPCON_PHI1); + fEPhi1->Resize(100,fEPhi1->GetDefaultHeight()); + nef = (TGTextEntry*)fEPhi1->GetNumberEntry(); + nef->SetToolTipText("Enter the starting phi angle [deg]"); + fEPhi1->Associate(this); + f1->AddFrame(fEPhi1, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2)); + AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4)); + + // Number entry for Dphi + f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(new TGLabel(f1, "Dphi"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fEDPhi = new TGNumberEntry(f1, 0., 5, kPCON_DPHI); + fEDPhi->SetNumAttr(TGNumberFormat::kNEAPositive); + fEDPhi->Resize(100,fEDPhi->GetDefaultHeight()); + nef = (TGTextEntry*)fEDPhi->GetNumberEntry(); + nef->SetToolTipText("Enter the phi range [deg]"); + fEDPhi->Associate(this); + f1->AddFrame(fEDPhi, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2)); + AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4)); + + // TGCanvas containing sections + MakeTitle("Pcon sections"); + fCan = new TGCanvas(this, 160, 200, kSunkenFrame | kDoubleBorder); + TGCompositeFrame *cont = new TGCompositeFrame(fCan->GetViewPort(), 155, 20, kVerticalFrame | kFixedWidth); + fCan->SetContainer(cont); + // labels for #i, Z, Rmin, Rmax + f1 = new TGCompositeFrame(cont, 160, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(new TGLabel(f1, "#"), new TGLayoutHints(kLHintsLeft, 2, 20, 6, 0)); + f1->AddFrame(new TGLabel(f1, "Z"), new TGLayoutHints(kLHintsLeft, 2, 20, 6, 0)); + f1->AddFrame(new TGLabel(f1, "Rmin"), new TGLayoutHints(kLHintsLeft, 2, 20, 6, 0)); + f1->AddFrame(new TGLabel(f1, "Rmax"), new TGLayoutHints(kLHintsLeft, 2, 10, 6, 0)); + cont->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 0,0,0,0)); + CreateSections(2); + + AddFrame(fCan, new TGLayoutHints(kLHintsLeft, 0, 0, 4, 4)); + + // Buttons + TGCompositeFrame *f23 = new TGCompositeFrame(this, 118, 20, kHorizontalFrame | kSunkenFrame | kDoubleBorder); + fApply = new TGTextButton(f23, "Apply"); + f23->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4)); + fApply->Associate(this); + fUndo = new TGTextButton(f23, " Undo "); + f23->AddFrame(fUndo, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4)); + fUndo->Associate(this); + AddFrame(f23, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); +// fUndo->SetSize(fCancel->GetSize()); +// fApply->SetSize(fCancel->GetSize()); + + // Initialize layout + MapSubwindows(); + Layout(); + MapWindow(); + + TClass *cl = TGeoPcon::Class(); + TGedElement *ge = new TGedElement; + ge->fGedFrame = this; + ge->fCanvas = 0; + cl->GetEditorList()->Add(ge); +} + +//______________________________________________________________________________ +TGeoPconEditor::~TGeoPconEditor() +{ +// Destructor + if (fSections) delete fSections; + if (fZi) delete [] fZi; + if (fRmini) delete [] fRmini; + if (fRmaxi) delete [] fRmaxi; + TGFrameElement *el; + TIter next(GetList()); + + while ((el = (TGFrameElement *)next())) { + if (!strcmp(el->fFrame->ClassName(), "TGCompositeFrame")) + ((TGCompositeFrame *)el->fFrame)->Cleanup(); + } + Cleanup(); + TClass *cl = TGeoPcon::Class(); + TIter next1(cl->GetEditorList()); + TGedElement *ge; + while ((ge=(TGedElement*)next1())) { + if (ge->fGedFrame==this) { + cl->GetEditorList()->Remove(ge); + delete ge; + next1.Reset(); + } + } +} + +//______________________________________________________________________________ +void TGeoPconEditor::ConnectSignals2Slots() +{ + // Connect signals to slots. + fENz->Connect("ValueSet(Long_t)", "TGeoPconEditor", this, "DoNz()"); + fEPhi1->Connect("ValueSet(Long_t)", "TGeoPconEditor", this, "DoPhi()"); + fEDPhi->Connect("ValueSet(Long_t)", "TGeoPconEditor", this, "DoPhi()"); + fApply->Connect("Clicked()", "TGeoPconEditor", this, "DoApply()"); + fUndo->Connect("Clicked()", "TGeoPconEditor", this, "DoUndo()"); + fShapeName->Connect("TextChanged(const char *)", "TGeoPconEditor", this, "DoModified()"); + fInit = kFALSE; +} + + +//______________________________________________________________________________ +void TGeoPconEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +{ + // Connect to a given pcon. + if (obj == 0 || (obj->IsA()!=TGeoPcon::Class())) { + SetActive(kFALSE); + return; + } + fModel = obj; + fPad = pad; + fShape = (TGeoPcon*)fModel; + const char *sname = fShape->GetName(); + if (!strcmp(sname, fShape->ClassName())) fShapeName->SetText("-no_name"); + else fShapeName->SetText(sname); + + Int_t nsections = fShape->GetNz(); + fNsecti = nsections; + fENz->SetNumber(nsections); + fEPhi1->SetNumber(fShape->GetPhi1()); + fPhi1i = fShape->GetPhi1(); + fEDPhi->SetNumber(fShape->GetDphi()); + fDPhii = fShape->GetDphi(); + CreateSections(nsections); + UpdateSections(); + + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + + if (fInit) ConnectSignals2Slots(); + SetActive(); +} + +//______________________________________________________________________________ +void TGeoPconEditor::CreateSections(Int_t inew) +{ +// Change dynamically the number of sections. + if (inew == fNsections) return; + if (!fSections) fSections = new TObjArray(8); + TGCompositeFrame *cont = (TGCompositeFrame*)fCan->GetContainer(); + TGeoPconSection *sect; + Int_t isect; + // new sections requested + if (inew>fNsections) { + for (isect=fNsections; isect<inew; isect++) { + sect = new TGeoPconSection(cont, 150, 10, isect); + fSections->AddAt(sect, isect); + cont->AddFrame(sect, fLHsect); + sect->Connect("Changed(Int_t)", "TGeoPconEditor", this, "DoSectionChange(Int_t)"); + } + } else { + // some sections need to be removed + for (isect=inew; isect<fNsections; isect++) { + sect = (TGeoPconSection*)fSections->At(isect); + sect->HideDaughters(); + cont->HideFrame(sect); + cont->RemoveFrame(sect); +// sect->Disconnect("Changed(Int_t)", "TGeoPconEditor", this, "DoSectionChange(Int_t)"); + fSections->RemoveAt(isect); + delete sect; + } + } + fNsections = inew; + fCan->MapSubwindows(); + cont->Layout(); + cont->MapWindow(); + fCan->Layout(); +} + +//______________________________________________________________________________ +Bool_t TGeoPconEditor::CheckSections() +{ +// Check validity of sections + TGeoPconSection *sect; + Double_t zmin = 0; + for (Int_t isect=0; isect<fNsections; isect++) { + sect = (TGeoPconSection*)fSections->At(isect); + if (isect && (sect->GetZ()<zmin)) return kFALSE; + zmin = sect->GetZ(); + if (sect->GetRmin()<0 || sect->GetRmin()>sect->GetRmax()) return kFALSE; + } + return kTRUE; +} + +//______________________________________________________________________________ +void TGeoPconEditor::UpdateSections() +{ +// Update sections according fShape. + if (fZi) delete [] fZi; + if (fRmini) delete [] fRmini; + if (fRmaxi) delete [] fRmaxi; + fZi = new Double_t[fNsections]; + fRmini = new Double_t[fNsections]; + fRmaxi = new Double_t[fNsections]; + TGeoPconSection *sect; + for (Int_t isect=0; isect<fNsections; isect++) { + sect = (TGeoPconSection*)fSections->At(isect); + sect->SetZ(fShape->GetZ(isect)); + fZi[isect] = fShape->GetZ(isect); + sect->SetRmin(fShape->GetRmin(isect)); + fRmini[isect] = fShape->GetRmin(isect); + sect->SetRmax(fShape->GetRmax(isect)); + fRmaxi[isect] = fShape->GetRmax(isect); + } +} + +//______________________________________________________________________________ +void TGeoPconEditor::DoName() +{ + // Perform name change + DoModified(); +} + +//______________________________________________________________________________ +void TGeoPconEditor::DoApply() +{ +// Slot for applying modifications. + const char *name = fShapeName->GetText(); + if (strcmp(name,fShape->GetName())) { + fShape->SetName(name); + Int_t id = gGeoManager->GetListOfShapes()->IndexOf(fShape); + fTabMgr->UpdateShape(id); + } + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(); + if (!CheckSections()) return; + // check if number of sections changed + Bool_t recreate = kFALSE; + Int_t nz = fENz->GetIntNumber(); + Double_t phi1 = fEPhi1->GetNumber(); + Double_t dphi = fEDPhi->GetNumber(); + if (nz != fShape->GetNz()) recreate = kTRUE; + TGeoPconSection *sect; + Int_t isect; + if (recreate) { + Double_t *array = new Double_t[3*(nz+1)]; + array[0] = phi1; + array[1] = dphi; + array[2] = nz; + for (isect=0; isect<nz; isect++) { + sect = (TGeoPconSection*)fSections->At(isect); + array[3+3*isect] = sect->GetZ(); + array[4+3*isect] = sect->GetRmin(); + array[5+3*isect] = sect->GetRmax(); + } + fShape->SetDimensions(array); + if (fPad) { + if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) { + fShape->Draw(); + fPad->GetView()->ShowAxis(); + } else { + fPad->Modified(); + fPad->Update(); + } + } + return; + } + // No need to call SetDimensions + if (TMath::Abs(phi1-fShape->GetPhi1())>1.e-6) fShape->Phi1() = phi1; + if (TMath::Abs(dphi-fShape->GetDphi())>1.e-6) fShape->Dphi() = dphi; + for (isect=0; isect<fNsections; isect++) { + sect = (TGeoPconSection*)fSections->At(isect); + fShape->Z(isect) = sect->GetZ(); + fShape->Rmin(isect) = sect->GetRmin(); + fShape->Rmax(isect) = sect->GetRmax(); + } + fShape->ComputeBBox(); + if (fPad) { + if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) { + fShape->Draw(); + fPad->GetView()->ShowAxis(); + } else { + fPad->Modified(); + fPad->Update(); + } + } +} + +//______________________________________________________________________________ +void TGeoPconEditor::DoSectionChange(Int_t isect) +{ +// Change parameters of section isect; + TGeoPconSection *sect, *sectlo=0, *secthi=0; + sect = (TGeoPconSection*)fSections->At(isect); + if (isect) sectlo = (TGeoPconSection*)fSections->At(isect-1); + if (isect<fNsections-1) secthi = (TGeoPconSection*)fSections->At(isect+1); + Double_t z = sect->GetZ(); + if (sectlo && z<sectlo->GetZ()) { + z = sectlo->GetZ(); + sect->SetZ(z); + } + if (secthi && z>secthi->GetZ()) { + z = secthi->GetZ(); + sect->SetZ(z); + } + DoModified(); +} + +//______________________________________________________________________________ +void TGeoPconEditor::DoNz() +{ +// Change number of sections. + Int_t nz = fENz->GetIntNumber(); + if (nz < 2) { + nz = 2; + fENz->SetNumber(nz); + } + CreateSections(nz); + if (CheckSections()) DoModified(); +} + +//______________________________________________________________________________ +void TGeoPconEditor::DoPhi() +{ +// Change phi range. + Double_t phi1 = fEPhi1->GetNumber(); + Double_t dphi = fEDPhi->GetNumber(); + if (TMath::Abs(phi1)>360) fEPhi1->SetNumber(0); + if (dphi>360) fEDPhi->SetNumber(360); + DoModified(); +} + +//______________________________________________________________________________ +void TGeoPconEditor::DoModified() +{ +// Slot for signaling modifications. + fApply->SetEnabled(); +} + +//______________________________________________________________________________ +void TGeoPconEditor::DoUndo() +{ +// Slot for undoing last operation. + fENz->SetNumber(fNsecti); + CreateSections(fNsecti); + fEPhi1->SetNumber(fPhi1i); + fEDPhi->SetNumber(fDPhii); + TGeoPconSection *sect; + for (Int_t isect=0; isect<fNsections; isect++) { + sect = (TGeoPconSection*)fSections->At(isect); + sect->SetZ(fZi[isect]); + sect->SetRmin(fRmini[isect]); + sect->SetRmax(fRmaxi[isect]); + } + DoApply(); + fUndo->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); +} + +ClassImp(TGeoPconSection) + +//______________________________________________________________________________ +TGeoPconSection::TGeoPconSection(const TGWindow *p, UInt_t w, UInt_t h, Int_t id) + :TGCompositeFrame(p,w,h,kHorizontalFrame | kFixedWidth) +{ +// Ctor. + fNumber = id; + TGTextEntry *nef; + // Label with number + AddFrame(new TGLabel(this, Form("#%i",id)), new TGLayoutHints(kLHintsLeft, 2, 4, 6, 0)); + + // Z entry + fEZ = new TGNumberEntry(this, 0., 5); + fEZ->Resize(40,fEZ->GetDefaultHeight()); + nef = (TGTextEntry*)fEZ->GetNumberEntry(); + nef->SetToolTipText("Enter the Z position"); + fEZ->Associate(this); + AddFrame(fEZ, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2)); + // Rmin entry + fERmin = new TGNumberEntry(this, 0., 5); + fERmin->SetNumAttr(TGNumberFormat::kNEAPositive); + fERmin->Resize(40,fERmin->GetDefaultHeight()); + nef = (TGTextEntry*)fERmin->GetNumberEntry(); + nef->SetToolTipText("Enter the minimum radius"); + fERmin->Associate(this); + AddFrame(fERmin, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2)); + // Rmax entry + fERmax = new TGNumberEntry(this, 0., 5); + fERmax->SetNumAttr(TGNumberFormat::kNEAPositive); + fERmax->Resize(40,fERmax->GetDefaultHeight()); + nef = (TGTextEntry*)fERmax->GetNumberEntry(); + nef->SetToolTipText("Enter the maximum radius"); + fERmax->Associate(this); + AddFrame(fERmax, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2)); + + ConnectSignals2Slots(); + MapSubwindows(); + Layout(); +} + +//______________________________________________________________________________ +TGeoPconSection::~TGeoPconSection() +{ +// Destructor + Cleanup(); +} + +//______________________________________________________________________________ +void TGeoPconSection::HideDaughters() +{ +// Hide daughter frames + fEZ->UnmapWindow(); + fERmin->UnmapWindow(); + fERmax->UnmapWindow(); +} + +//______________________________________________________________________________ +void TGeoPconSection::Changed(Int_t i) +{ +// Emit Changed(Int_t) signal. + Emit("Changed(Int_t)", i); +} + +//______________________________________________________________________________ +void TGeoPconSection::ConnectSignals2Slots() +{ +// Connect signals to slots. + fEZ->Connect("ValueSet(Long_t)", "TGeoPconSection", this, "DoZ()"); + fERmin->Connect("ValueSet(Long_t)", "TGeoPconSection", this, "DoRmin()"); + fERmax->Connect("ValueSet(Long_t)", "TGeoPconSection", this, "DoRmax()"); +} + +//______________________________________________________________________________ +Double_t TGeoPconSection::GetZ() const +{ +// Z value getter + return fEZ->GetNumber(); +} + +//______________________________________________________________________________ +Double_t TGeoPconSection::GetRmin() const +{ +// Rmin value getter + return fERmin->GetNumber(); +} + +//______________________________________________________________________________ +Double_t TGeoPconSection::GetRmax() const +{ +// Rmax value getter + return fERmax->GetNumber(); +} + +//______________________________________________________________________________ +void TGeoPconSection::SetZ(Double_t z) +{ +// Z value setter + fEZ->SetNumber(z); +} + +//______________________________________________________________________________ +void TGeoPconSection::SetRmin(Double_t rmin) +{ +// Rmin value setter + fERmin->SetNumber(rmin); +} + +//______________________________________________________________________________ +void TGeoPconSection::SetRmax(Double_t rmax) +{ +// Rmax value setter + fERmax->SetNumber(rmax); +} + +//______________________________________________________________________________ +void TGeoPconSection::DoZ() +{ +// Z slot. + Changed(fNumber); +} + +//______________________________________________________________________________ +void TGeoPconSection::DoRmin() +{ +// Rmin slot. + Double_t rmin = fERmin->GetNumber(); + Double_t rmax = fERmax->GetNumber(); + if (rmin>rmax) fERmax->SetNumber(rmin); + Changed(fNumber); +} + +//______________________________________________________________________________ +void TGeoPconSection::DoRmax() +{ +// Rmax slot. + Double_t rmin = fERmin->GetNumber(); + Double_t rmax = fERmax->GetNumber(); + if (rmax<rmin) fERmin->SetNumber(rmax); + Changed(fNumber); +} diff --git a/geombuilder/src/TGeoSphereEditor.cxx b/geombuilder/src/TGeoSphereEditor.cxx index 389571e99eb..d14d544f264 100644 --- a/geombuilder/src/TGeoSphereEditor.cxx +++ b/geombuilder/src/TGeoSphereEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoSphereEditor.cxx,v 1.1 2006/06/13 15:27:11 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -43,7 +43,7 @@ TGeoSphereEditor::TGeoSphereEditor(const TGWindow *p, Int_t id, Int_t width, Int_t height, UInt_t options, Pixel_t back) : TGedFrame(p, id, width, height, options | kVerticalFrame, back) { - // Constructor for volume editor + // Constructor for sphere editor fShape = 0; fRmini = fRmaxi = fTheta1i = fTheta2i = fPhi1i = fPhi2i = 0.0; fNamei = ""; @@ -182,7 +182,7 @@ TGeoSphereEditor::TGeoSphereEditor(const TGWindow *p, Int_t id, Int_t width, //______________________________________________________________________________ TGeoSphereEditor::~TGeoSphereEditor() { -// Destructor +// Destructor. TGFrameElement *el; TIter next(GetList()); @@ -226,7 +226,7 @@ void TGeoSphereEditor::ConnectSignals2Slots() //______________________________________________________________________________ void TGeoSphereEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) { - // Connect to the picked volume. + // Connect to a given sphere. if (obj == 0 || (obj->IsA()!=TGeoSphere::Class())) { SetActive(kFALSE); return; @@ -262,12 +262,14 @@ void TGeoSphereEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) //______________________________________________________________________________ void TGeoSphereEditor::DoName() { +// Slot for name. DoModified(); } //______________________________________________________________________________ void TGeoSphereEditor::DoApply() { +// Slot for applying modifications. const char *name = fShapeName->GetText(); if (strcmp(name,fShape->GetName())) { fShape->SetName(name); @@ -308,6 +310,7 @@ void TGeoSphereEditor::DoApply() //______________________________________________________________________________ void TGeoSphereEditor::DoCancel() { +// Slot for cancelling current modifications. fShapeName->SetText(fNamei.Data()); fERmin->SetNumber(fRmini); fERmax->SetNumber(fRmaxi); @@ -325,6 +328,7 @@ void TGeoSphereEditor::DoCancel() //______________________________________________________________________________ void TGeoSphereEditor::DoModified() { +// Slot for signaling modifications. fApply->SetEnabled(); if (fUndo->GetState()==kButtonDisabled) fCancel->SetEnabled(); } @@ -332,6 +336,7 @@ void TGeoSphereEditor::DoModified() //______________________________________________________________________________ void TGeoSphereEditor::DoUndo() { +// Slot for undoing last operation. DoCancel(); DoApply(); fCancel->SetEnabled(kFALSE); @@ -342,6 +347,7 @@ void TGeoSphereEditor::DoUndo() //______________________________________________________________________________ void TGeoSphereEditor::DoRmin() { +// Slot for Rmin. Double_t rmin = fERmin->GetNumber(); Double_t rmax = fERmax->GetNumber(); if (rmax<rmin+1.e-10) { @@ -354,6 +360,7 @@ void TGeoSphereEditor::DoRmin() //______________________________________________________________________________ void TGeoSphereEditor::DoRmax() { +// Slot for Rmax. Double_t rmin = fERmin->GetNumber(); Double_t rmax = fERmax->GetNumber(); if (rmax<rmin+1.e-10) { @@ -367,6 +374,7 @@ void TGeoSphereEditor::DoRmax() //______________________________________________________________________________ void TGeoSphereEditor::DoPhi1() { +// Slot for phi1. Double_t phi1 = fEPhi1->GetNumber(); Double_t phi2 = fEPhi2->GetNumber(); if (phi1 > 360-1.e-10) { @@ -387,6 +395,7 @@ void TGeoSphereEditor::DoPhi1() //______________________________________________________________________________ void TGeoSphereEditor::DoPhi2() { +// Slot for phi2. Double_t phi1 = fEPhi1->GetNumber(); Double_t phi2 = fEPhi2->GetNumber(); if (phi2-phi1 > 360.) { @@ -407,6 +416,7 @@ void TGeoSphereEditor::DoPhi2() //______________________________________________________________________________ void TGeoSphereEditor::DoPhi() { +// Slot for phi slider. if (!fLock) { DoModified(); fLock = kTRUE; @@ -419,6 +429,7 @@ void TGeoSphereEditor::DoPhi() //______________________________________________________________________________ void TGeoSphereEditor::DoTheta1() { +// Slot for theta1. Double_t theta1 = fETheta1->GetNumber(); Double_t theta2 = fETheta2->GetNumber(); if (theta2<theta1+1.e-10) { @@ -435,6 +446,7 @@ void TGeoSphereEditor::DoTheta1() //______________________________________________________________________________ void TGeoSphereEditor::DoTheta2() { +// Slot for theta2. Double_t theta1 = fETheta1->GetNumber(); Double_t theta2 = fETheta2->GetNumber(); if (theta2<theta1+1.e-10) { @@ -451,7 +463,8 @@ void TGeoSphereEditor::DoTheta2() //______________________________________________________________________________ void TGeoSphereEditor::DoTheta() { - if (!fLock) { + // Slot for theta slider. + if (!fLock) { DoModified(); fLock = kTRUE; fETheta1->SetNumber(fSTheta->GetMinPosition()); diff --git a/geombuilder/src/TGeoTabManager.cxx b/geombuilder/src/TGeoTabManager.cxx index 0c933ff0990..53c48a23f30 100644 --- a/geombuilder/src/TGeoTabManager.cxx +++ b/geombuilder/src/TGeoTabManager.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoTabManager.cxx,v 1.1 2006/06/13 15:27:11 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -70,6 +70,7 @@ TGeoTabManager::TGeoTabManager(TVirtualPad *pad, TGTab *tab) TGeoTabManager::~TGeoTabManager() { // Dtor. + printf("deleting TGeoTabManager\n"); if (fShapePanel) delete fShapePanel; if (fMaterialPanel) delete fMaterialPanel; if (fMatrixPanel) delete fMatrixPanel; @@ -418,6 +419,7 @@ TGeoTreeDialog::TGeoTreeDialog(TGFrame *caller, const TGWindow *main, UInt_t w, fObjLabel->ChangeOptions(kSunkenFrame | kDoubleBorder); f1->AddFrame(fObjLabel, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 2,2,2,2)); fClose = new TGTextButton(f1, "&Close"); + fClose->Associate(this); f1->AddFrame(fClose, new TGLayoutHints(kLHintsRight, 2,2,2,2)); AddFrame(f1, new TGLayoutHints(kLHintsBottom | kLHintsExpandX, 2,2,2,2)); @@ -428,9 +430,6 @@ TGeoTreeDialog::TGeoTreeDialog(TGFrame *caller, const TGWindow *main, UInt_t w, Move(ax + ww, ay); SetWMPosition(ax, ay); - MapSubwindows(); - Layout(); - MapWindow(); } //______________________________________________________________________________ @@ -467,7 +466,11 @@ TGeoVolumeDialog::TGeoVolumeDialog(TGFrame *caller, const TGWindow *main, UInt_t SetCleanup(kDeepCleanup); BuildListTree(); ConnectSignalsToSlots(); - gClient->WaitFor(this); + MapSubwindows(); + Layout(); + SetWindowName("Volume dialog"); + MapWindow(); + gClient->WaitForUnmap(this); } //______________________________________________________________________________ @@ -572,7 +575,11 @@ TGeoShapeDialog::TGeoShapeDialog(TGFrame *caller, const TGWindow *main, UInt_t w SetCleanup(kDeepCleanup); BuildListTree(); ConnectSignalsToSlots(); - gClient->WaitFor(this); + MapSubwindows(); + Layout(); + SetWindowName("Shape dialog"); + MapWindow(); + gClient->WaitForUnmap(this); } //______________________________________________________________________________ @@ -642,7 +649,11 @@ TGeoMediumDialog::TGeoMediumDialog(TGFrame *caller, const TGWindow *main, UInt_t SetCleanup(kDeepCleanup); BuildListTree(); ConnectSignalsToSlots(); - gClient->WaitFor(this); + MapSubwindows(); + Layout(); + SetWindowName("Medium dialog"); + MapWindow(); + gClient->WaitForUnmap(this); } //______________________________________________________________________________ @@ -697,7 +708,11 @@ TGeoMaterialDialog::TGeoMaterialDialog(TGFrame *caller, const TGWindow *main, UI SetCleanup(kDeepCleanup); BuildListTree(); ConnectSignalsToSlots(); - gClient->WaitFor(this); + MapSubwindows(); + Layout(); + SetWindowName("Material dialog"); + MapWindow(); + gClient->WaitForUnmap(this); } //______________________________________________________________________________ @@ -752,7 +767,11 @@ TGeoMatrixDialog::TGeoMatrixDialog(TGFrame *caller, const TGWindow *main, UInt_t SetCleanup(kDeepCleanup); BuildListTree(); ConnectSignalsToSlots(); - gClient->WaitFor(this); + MapSubwindows(); + Layout(); + SetWindowName("Matrix dialog"); + MapWindow(); + gClient->WaitForUnmap(this); } //______________________________________________________________________________ @@ -947,6 +966,7 @@ void TGeoTransientPanel::Show() //______________________________________________________________________________ void TGeoTransientPanel::DeleteEditors() { +// Delete editors. } diff --git a/geombuilder/src/TGeoTrd1Editor.cxx b/geombuilder/src/TGeoTrd1Editor.cxx index 9bfee77a90f..8ab14732d5b 100644 --- a/geombuilder/src/TGeoTrd1Editor.cxx +++ b/geombuilder/src/TGeoTrd1Editor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoTrd1Editor.cxx,v 1.1 2006/06/13 15:27:11 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -41,7 +41,7 @@ TGeoTrd1Editor::TGeoTrd1Editor(const TGWindow *p, Int_t id, Int_t width, Int_t height, UInt_t options, Pixel_t back) : TGedFrame(p, id, width, height, options | kVerticalFrame, back) { - // Constructor for volume editor + // Constructor for trd1 editor fShape = 0; fDxi1 = fDxi2 = fDyi = fDzi = 0.0; fNamei = ""; @@ -187,7 +187,7 @@ void TGeoTrd1Editor::ConnectSignals2Slots() //______________________________________________________________________________ void TGeoTrd1Editor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) { - // Connect to the picked volume. + // Connect to the selected object. if (obj == 0 || (obj->IsA()!=TGeoTrd1::Class())) { SetActive(kFALSE); return; @@ -220,12 +220,14 @@ void TGeoTrd1Editor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) //______________________________________________________________________________ void TGeoTrd1Editor::DoName() { +// Perform name change. DoModified(); } //______________________________________________________________________________ void TGeoTrd1Editor::DoApply() { +// Slot for applying modifications. const char *name = fShapeName->GetText(); if (strcmp(name,fShape->GetName())) { fShape->SetName(name); @@ -260,6 +262,7 @@ void TGeoTrd1Editor::DoApply() //______________________________________________________________________________ void TGeoTrd1Editor::DoCancel() { +// Slot for cancelling current modifications. fShapeName->SetText(fNamei.Data()); fEDx1->SetNumber(fDxi1); fEDx2->SetNumber(fDxi2); @@ -273,6 +276,7 @@ void TGeoTrd1Editor::DoCancel() //______________________________________________________________________________ void TGeoTrd1Editor::DoModified() { +// Slot for signaling modifications. fApply->SetEnabled(); if (fUndo->GetState()==kButtonDisabled) fCancel->SetEnabled(); } @@ -280,6 +284,7 @@ void TGeoTrd1Editor::DoModified() //______________________________________________________________________________ void TGeoTrd1Editor::DoUndo() { +// Slot for undoing last operation. DoCancel(); DoApply(); fCancel->SetEnabled(kFALSE); @@ -290,24 +295,28 @@ void TGeoTrd1Editor::DoUndo() //______________________________________________________________________________ void TGeoTrd1Editor::DoDx1() { +// Slot for dx1. DoModified(); } //______________________________________________________________________________ void TGeoTrd1Editor::DoDx2() { +// Slot for dx2. DoModified(); } //______________________________________________________________________________ void TGeoTrd1Editor::DoDy() { +// Slot for dy. DoModified(); } //______________________________________________________________________________ void TGeoTrd1Editor::DoDz() { +// Slot for dz. DoModified(); } diff --git a/geombuilder/src/TGeoTrd2Editor.cxx b/geombuilder/src/TGeoTrd2Editor.cxx index cf5951e763f..e12aa11e894 100644 --- a/geombuilder/src/TGeoTrd2Editor.cxx +++ b/geombuilder/src/TGeoTrd2Editor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoTrd2Editor.cxx,v 1.1 2006/06/13 15:27:11 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -41,7 +41,7 @@ TGeoTrd2Editor::TGeoTrd2Editor(const TGWindow *p, Int_t id, Int_t width, Int_t height, UInt_t options, Pixel_t back) : TGedFrame(p, id, width, height, options | kVerticalFrame, back) { - // Constructor for volume editor + // Constructor for trd2 editor fShape = 0; fDxi1 = fDxi2 = fDyi1 = fDyi2 = fDzi = 0.0; fNamei = ""; @@ -155,7 +155,7 @@ TGeoTrd2Editor::TGeoTrd2Editor(const TGWindow *p, Int_t id, Int_t width, //______________________________________________________________________________ TGeoTrd2Editor::~TGeoTrd2Editor() { -// Destructor +// Destructor. TGFrameElement *el; TIter next(GetList()); @@ -201,7 +201,7 @@ void TGeoTrd2Editor::ConnectSignals2Slots() //______________________________________________________________________________ void TGeoTrd2Editor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) { - // Connect to the picked volume. + // Connect to the selected object. if (obj == 0 || (obj->IsA()!=TGeoTrd2::Class())) { SetActive(kFALSE); return; @@ -236,12 +236,14 @@ void TGeoTrd2Editor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) //______________________________________________________________________________ void TGeoTrd2Editor::DoName() { +// Perform name change. DoModified(); } //______________________________________________________________________________ void TGeoTrd2Editor::DoApply() { +// Slot for applying modifications. const char *name = fShapeName->GetText(); if (strcmp(name,fShape->GetName())) { fShape->SetName(name); @@ -278,6 +280,7 @@ void TGeoTrd2Editor::DoApply() //______________________________________________________________________________ void TGeoTrd2Editor::DoCancel() { +// Slot for cancelling current modifications. fShapeName->SetText(fNamei.Data()); fEDx1->SetNumber(fDxi1); fEDx2->SetNumber(fDxi2); @@ -292,6 +295,7 @@ void TGeoTrd2Editor::DoCancel() //______________________________________________________________________________ void TGeoTrd2Editor::DoModified() { +// Slot for signaling modifications. fApply->SetEnabled(); if (fUndo->GetState()==kButtonDisabled) fCancel->SetEnabled(); } @@ -299,6 +303,7 @@ void TGeoTrd2Editor::DoModified() //______________________________________________________________________________ void TGeoTrd2Editor::DoUndo() { +// Slot for undoing last operation. DoCancel(); DoApply(); fCancel->SetEnabled(kFALSE); @@ -309,30 +314,35 @@ void TGeoTrd2Editor::DoUndo() //______________________________________________________________________________ void TGeoTrd2Editor::DoDx1() { +// Slot for dx1. DoModified(); } //______________________________________________________________________________ void TGeoTrd2Editor::DoDx2() { +// Slot for dx2. DoModified(); } //______________________________________________________________________________ void TGeoTrd2Editor::DoDy1() { +// Slot for dy1. DoModified(); } //______________________________________________________________________________ void TGeoTrd2Editor::DoDy2() { +// Slot for dy2. DoModified(); } //______________________________________________________________________________ void TGeoTrd2Editor::DoDz() { +// Slot for dz. DoModified(); } diff --git a/geombuilder/src/TGeoTubeEditor.cxx b/geombuilder/src/TGeoTubeEditor.cxx index 163ca810d8f..fee70f28dcd 100644 --- a/geombuilder/src/TGeoTubeEditor.cxx +++ b/geombuilder/src/TGeoTubeEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoTubeEditor.cxx,v 1.1 2006/06/13 15:27:11 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -42,7 +42,7 @@ TGeoTubeEditor::TGeoTubeEditor(const TGWindow *p, Int_t id, Int_t width, Int_t height, UInt_t options, Pixel_t back) : TGedFrame(p, id, width, height, options | kVerticalFrame, back) { - // Constructor for volume editor + // Constructor for tube editor fShape = 0; fRmini = fRmaxi = fDzi = 0.0; fNamei = ""; @@ -176,7 +176,7 @@ void TGeoTubeEditor::ConnectSignals2Slots() //______________________________________________________________________________ void TGeoTubeEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) { - // Connect to the picked volume. + // Connect to the selected object. if (obj == 0 || (obj->IsA()!=TGeoTube::Class())) { SetActive(kFALSE); return; @@ -203,12 +203,14 @@ void TGeoTubeEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) //______________________________________________________________________________ void TGeoTubeEditor::DoName() { +// Perform name change. DoModified(); } //______________________________________________________________________________ void TGeoTubeEditor::DoApply() { +// Slot for applying modifications. const char *name = fShapeName->GetText(); if (strcmp(name,fShape->GetName())) { fShape->SetName(name); @@ -237,6 +239,7 @@ void TGeoTubeEditor::DoApply() //______________________________________________________________________________ void TGeoTubeEditor::DoCancel() { +// Slot for cancelling current modifications. fShapeName->SetText(fNamei.Data()); fERmin->SetNumber(fRmini); fERmax->SetNumber(fRmaxi); @@ -249,6 +252,7 @@ void TGeoTubeEditor::DoCancel() //______________________________________________________________________________ void TGeoTubeEditor::DoModified() { +// Slot for signaling modifications. fApply->SetEnabled(); if (fUndo->GetState()==kButtonDisabled) fCancel->SetEnabled(); } @@ -256,6 +260,7 @@ void TGeoTubeEditor::DoModified() //______________________________________________________________________________ void TGeoTubeEditor::DoUndo() { +// Slot for undoing last operation. DoCancel(); DoApply(); fCancel->SetEnabled(kFALSE); @@ -266,6 +271,7 @@ void TGeoTubeEditor::DoUndo() //______________________________________________________________________________ void TGeoTubeEditor::DoRmin() { +// Slot for rmin. Double_t rmin = fERmin->GetNumber(); Double_t rmax = fERmax->GetNumber(); if (rmax<rmin+1.e-10) { @@ -278,6 +284,7 @@ void TGeoTubeEditor::DoRmin() //______________________________________________________________________________ void TGeoTubeEditor::DoRmax() { +// Slot for rmax. Double_t rmin = fERmin->GetNumber(); Double_t rmax = fERmax->GetNumber(); if (rmax<rmin+1.e-10) { @@ -291,6 +298,7 @@ void TGeoTubeEditor::DoRmax() //______________________________________________________________________________ void TGeoTubeEditor::DoDz() { +// Slot for dz. DoModified(); } @@ -382,6 +390,7 @@ TGeoTubeSegEditor::~TGeoTubeSegEditor() //______________________________________________________________________________ void TGeoTubeSegEditor::ConnectSignals2Slots() { + // Connect signals to slots. TGeoTubeEditor::ConnectSignals2Slots(); Disconnect(fApply, "Clicked()",(TGeoTubeEditor*)this, "DoApply()"); Disconnect(fUndo, "Clicked()",(TGeoTubeEditor*)this, "DoUndo()"); @@ -399,7 +408,7 @@ void TGeoTubeSegEditor::ConnectSignals2Slots() //______________________________________________________________________________ void TGeoTubeSegEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) { - // Connect to the picked volume. + // Connect to the selected object. if (obj == 0 || (obj->IsA()!=TGeoTubeSeg::Class())) { SetActive(kFALSE); return; @@ -431,7 +440,8 @@ void TGeoTubeSegEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) //______________________________________________________________________________ void TGeoTubeSegEditor::DoPhi1() { - Double_t phi1 = fEPhi1->GetNumber(); +// Slot for phi1. + Double_t phi1 = fEPhi1->GetNumber(); Double_t phi2 = fEPhi2->GetNumber(); if (phi1 > 360-1.e-10) { phi1 = 0.; @@ -451,6 +461,7 @@ void TGeoTubeSegEditor::DoPhi1() //______________________________________________________________________________ void TGeoTubeSegEditor::DoPhi2() { +// Slot for phi2. Double_t phi1 = fEPhi1->GetNumber(); Double_t phi2 = fEPhi2->GetNumber(); if (phi2-phi1 > 360.) { @@ -471,6 +482,7 @@ void TGeoTubeSegEditor::DoPhi2() //______________________________________________________________________________ void TGeoTubeSegEditor::DoPhi() { +// Slot for phi slider. if (!fLock) { DoModified(); fLock = kTRUE; @@ -483,6 +495,7 @@ void TGeoTubeSegEditor::DoPhi() //______________________________________________________________________________ void TGeoTubeSegEditor::DoApply() { +// Slot for applying modifications. const char *name = fShapeName->GetText(); if (strcmp(name,fShape->GetName())) { fShape->SetName(name); @@ -522,6 +535,7 @@ void TGeoTubeSegEditor::DoApply() //______________________________________________________________________________ void TGeoTubeSegEditor::DoUndo() { +// Slot for undoing last operation. DoCancel(); DoApply(); fCancel->SetEnabled(kFALSE); @@ -532,6 +546,7 @@ void TGeoTubeSegEditor::DoUndo() //______________________________________________________________________________ void TGeoTubeSegEditor::DoCancel() { +// Slot for cancelling current modifications. fEPhi1->SetNumber(fPmini); fEPhi2->SetNumber(fPmaxi); fSPhi->SetPosition(fPmini,fPmaxi); diff --git a/geombuilder/src/TGeoVolumeEditor.cxx b/geombuilder/src/TGeoVolumeEditor.cxx index 1aeb17c9cd0..7967571562c 100644 --- a/geombuilder/src/TGeoVolumeEditor.cxx +++ b/geombuilder/src/TGeoVolumeEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoVolumeEditor.cxx,v 1.1 2006/06/13 15:27:12 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -14,6 +14,30 @@ // TGeoVolumeEditor // // ////////////////////////////////////////////////////////////////////////// +/* Editor for geometry volumes and assemblies of volumes. Besides the volume + name and line attributes, a TGeoVolume has the following editable categories + splitted vertically by a shutter: + - Properties: one can edit the shape and medium components from here. It is + also possible to change the existing ones. + - Daughters: the main category allowing defining, editing, removing or + positioning daughter volumes inside the current edited volume. To add a + daughter, one needs to select first a volume and a matrix. Currently no check + is performed if the daughter volume creates an extrusion (illegal for tracking). + To remove or change the position of an existing daughter, one should simply + select the desired daughter from the combo box with the existing ones, then + simply click the appropriate button. + - Visualization: One can set the visibility of the volume and of its daughters, + set the visibility depth and the view type. Selecting "All" will draw the + volume and all visible daughters down to the selected level starting from the + edited volume. Selecting "Leaves" will draw just the deepest daughters within + the selected visibility level, without displaying the containers, while "Only" + will just draw the edited volume. + - Division: The category becomes active only if there are no daughters of the + edited volume added by normal positioning (e.g. from <Daughters> category). The + minimum allowed starting value for the selected division axis is automatically + selected, while the dslicing step is set to 0 - meaning that only the number + of slices matter. +*/ #include "TGeoVolumeEditor.h" #include "TGeoVolume.h" @@ -47,7 +71,7 @@ TGeoVolumeEditor::TGeoVolumeEditor(const TGWindow *p, Int_t id, Int_t width, Int_t height, UInt_t options, Pixel_t back) : TGedFrame(p, id, width, height, options | kVerticalFrame, back) { - // Constructor for volume editor + // Constructor for volume editor. fGeometry = 0; fVolume = 0; @@ -497,6 +521,7 @@ void TGeoVolumeEditor::DoVolumeName() //______________________________________________________________________________ void TGeoVolumeEditor::DoSelectShape() { +// Select a new shape. TGeoShape *shape = fSelectedShape; new TGeoShapeDialog(fBSelShape, gClient->GetRoot(), 200,300); fSelectedShape = (TGeoShape*)TGeoShapeDialog::GetSelected(); @@ -507,6 +532,7 @@ void TGeoVolumeEditor::DoSelectShape() //______________________________________________________________________________ void TGeoVolumeEditor::DoSelectMedium() { +// Select a new medium. TGeoMedium *med = fSelectedMedium; new TGeoMediumDialog(fBSelMedium, gClient->GetRoot(), 200,300); fSelectedMedium = (TGeoMedium*)TGeoMediumDialog::GetSelected(); @@ -517,6 +543,7 @@ void TGeoVolumeEditor::DoSelectMedium() //______________________________________________________________________________ void TGeoVolumeEditor::DoSelectMatrix() { +// Select a matrix for positioning. TGeoMatrix *matrix = fSelectedMatrix; new TGeoMatrixDialog(fBSelMatrix, gClient->GetRoot(), 200,300); fSelectedMatrix = (TGeoMatrix*)TGeoMatrixDialog::GetSelected(); @@ -527,6 +554,7 @@ void TGeoVolumeEditor::DoSelectMatrix() //______________________________________________________________________________ void TGeoVolumeEditor::DoSelectVolume() { +// Select a daughter volume. TGeoVolume *vol = fSelectedVolume; new TGeoVolumeDialog(fBSelVolume, gClient->GetRoot(), 200,300); fSelectedVolume = (TGeoVolume*)TGeoVolumeDialog::GetSelected(); @@ -538,18 +566,21 @@ void TGeoVolumeEditor::DoSelectVolume() //______________________________________________________________________________ void TGeoVolumeEditor::DoEditShape() { +// Edit the shape of the volume. fTabMgr->GetShapeEditor(fVolume->GetShape()); } //______________________________________________________________________________ void TGeoVolumeEditor::DoEditMedium() { +// Edit the medium of the volume. fTabMgr->GetMediumEditor(fVolume->GetMedium()); } //______________________________________________________________________________ void TGeoVolumeEditor::DoEditMatrix() { +// Edit the position of the selected node. if (!fVolume->GetNdaughters()) return; Int_t i = fNodeList->GetSelected(); if (i<0) return; @@ -559,6 +590,7 @@ void TGeoVolumeEditor::DoEditMatrix() //______________________________________________________________________________ void TGeoVolumeEditor::DoAddNode() { +// Add a daughter. if (!fSelectedVolume || fVolume->GetFinder()) return; Int_t icopy = fCopyNumber->GetIntNumber(); fVolume->AddNode(fSelectedVolume, icopy, fSelectedMatrix); @@ -583,6 +615,7 @@ void TGeoVolumeEditor::DoAddNode() //______________________________________________________________________________ void TGeoVolumeEditor::DoRemoveNode() { +// Remove a daughter. if (!fVolume->GetNdaughters() || fVolume->GetFinder()) { fRemoveNode->SetEnabled(kFALSE); fEditMatrix->SetEnabled(kFALSE); @@ -621,6 +654,7 @@ void TGeoVolumeEditor::DoRemoveNode() //______________________________________________________________________________ void TGeoVolumeEditor::DoVisVolume() { +// Slot for setting volume visible/invisible. Bool_t on = (fBVis[0]->GetState()==kButtonDown)?kTRUE:kFALSE; if (fVolume->IsVisible() == on) return; fVolume->SetVisibility(on); @@ -630,6 +664,7 @@ void TGeoVolumeEditor::DoVisVolume() //______________________________________________________________________________ void TGeoVolumeEditor::DoVisDaughters() { +// Slot for setting daughters visible/invisible. Bool_t on = (fBVis[1]->GetState()==kButtonDown)?kTRUE:kFALSE; if (fVolume->IsVisibleDaughters() == on) return; fVolume->VisibleDaughters(on); @@ -639,6 +674,7 @@ void TGeoVolumeEditor::DoVisDaughters() //______________________________________________________________________________ void TGeoVolumeEditor::DoVisAuto() { +// Slot for setting visibility depth auto. Bool_t on = (fBAuto->GetState()==kButtonDown)?kTRUE:kFALSE; if ((fGeometry->GetVisLevel()==0) == on) return; if (on) fGeometry->SetVisLevel(0); @@ -649,6 +685,7 @@ void TGeoVolumeEditor::DoVisAuto() //______________________________________________________________________________ void TGeoVolumeEditor::DoVisLevel() { +// Slot for visibility level. fBAuto->SetState(kButtonUp); fGeometry->SetVisLevel(fEVisLevel->GetIntNumber()); UpdatePad(); @@ -657,6 +694,7 @@ void TGeoVolumeEditor::DoVisLevel() //______________________________________________________________________________ void TGeoVolumeEditor::DoViewAll() { +// Slot for viewing volume and containers. Bool_t on = (fBView[0]->GetState()==kButtonDown)?kTRUE:kFALSE; if (!on) return; if (fVolume->IsVisContainers() == on) return; @@ -671,6 +709,7 @@ void TGeoVolumeEditor::DoViewAll() //______________________________________________________________________________ void TGeoVolumeEditor::DoViewLeaves() { +// Slot for viewing last leaves only. Bool_t on = (fBView[1]->GetState()==kButtonDown)?kTRUE:kFALSE; if (!on) return; if (fVolume->IsVisLeaves() == on) return; @@ -685,6 +724,7 @@ void TGeoVolumeEditor::DoViewLeaves() //______________________________________________________________________________ void TGeoVolumeEditor::DoViewOnly() { +// Slot for viewing volume only. Bool_t on = (fBView[2]->GetState()==kButtonDown)?kTRUE:kFALSE; if (!on) return; if (fVolume->IsVisOnly() == on) return; @@ -699,6 +739,7 @@ void TGeoVolumeEditor::DoViewOnly() //______________________________________________________________________________ void TGeoVolumeEditor::DoRaytrace() { +// Slot for raytracing. Bool_t on = (fBRaytrace->GetState()==kButtonDown)?kTRUE:kFALSE; if (fVolume->IsRaytracing() == on) return; fVolume->Raytrace(on); @@ -708,7 +749,7 @@ void TGeoVolumeEditor::DoRaytrace() //______________________________________________________________________________ void TGeoVolumeEditor::DoDivName() { -// Modify volume name. +// Modify division name. fApplyDiv->SetEnabled(kTRUE); } @@ -907,6 +948,7 @@ void TGeoVolumeEditor::DoApplyDiv() //______________________________________________________________________________ void TGeoVolumeEditor::UpdatePad() { +// Update pad. if (fPad) { fPad->Modified(); fPad->Update(); -- GitLab