diff --git a/Makefile b/Makefile index d26757e189e9c2237b3fc385caac2bcb58a25482..974aa45fd47528b3981cb5fb7603c97b72a0dc73 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ MODULES = build cint metautils pcre utils base cont meta net auth zip \ clib matrix newdelete hist tree freetype graf g3d gpad gui \ minuit histpainter treeplayer treeviewer physics postscript \ rint html eg geom geompainter vmc fumili mlp gedold ged quadp \ - guibuilder xml foam splot smatrix sql tmva + guibuilder xml foam splot smatrix sql tmva geombuilder ifeq ($(ARCH),win32) MODULES += winnt win32gdk diff --git a/config/mimes.unix.in b/config/mimes.unix.in index 550c0eb99e5c7e0fd08b85e0fbc052bd452aa710..12c25e82463a3de9e9e3d3bb81eefd54797d0222 100644 --- a/config/mimes.unix.in +++ b/config/mimes.unix.in @@ -366,10 +366,10 @@ pattern = TGeoGtra icon = geogtra_s.xpm geogtra_t.xpm action = ->Browse() -#[root/tgeocompositeshape] -#pattern = TGeoCompositeShape -#icon = geocomposite_s.xpm geocomposite_t.xpm -#action = ->Browse() +[root/tgeocompositeshape] +pattern = TGeoCompositeShape +icon = geocomposite_s.xpm geocomposite_t.xpm +action = ->Browse() #[root/tgeohalfspace] #pattern = TGeoHalfSpace diff --git a/config/mimes.win32.in b/config/mimes.win32.in index 550c0eb99e5c7e0fd08b85e0fbc052bd452aa710..12c25e82463a3de9e9e3d3bb81eefd54797d0222 100644 --- a/config/mimes.win32.in +++ b/config/mimes.win32.in @@ -366,10 +366,10 @@ pattern = TGeoGtra icon = geogtra_s.xpm geogtra_t.xpm action = ->Browse() -#[root/tgeocompositeshape] -#pattern = TGeoCompositeShape -#icon = geocomposite_s.xpm geocomposite_t.xpm -#action = ->Browse() +[root/tgeocompositeshape] +pattern = TGeoCompositeShape +icon = geocomposite_s.xpm geocomposite_t.xpm +action = ->Browse() #[root/tgeohalfspace] #pattern = TGeoHalfSpace diff --git a/config/rootrc.in b/config/rootrc.in index 99559ff52b280965d470d687a7e64af8faca1bde..1be49a0f63abe3a68e2368d4bd3de9c790e4843e 100644 --- a/config/rootrc.in +++ b/config/rootrc.in @@ -1,4 +1,4 @@ -# @(#)root/config:$Name: $:$Id: rootrc.in,v 1.141 2006/06/09 01:21:43 rdm Exp $ +# @(#)root/config:$Name: $:$Id: rootrc.in,v 1.142 2006/06/09 08:07:25 rdm Exp $ # Author: Fons Rademakers 22/09/95 # ROOT Environment settings are handled via the class TEnv. To see @@ -455,6 +455,7 @@ Plugin.TVirtualTreePlayer: * TTreePlayer TreePlayer "TTreePlayer()" Plugin.TVirtualTreeViewer: * TTreeViewer TreeViewer "TTreeViewer(const TTree*)" Plugin.TSessionViewer: * TSessionViewer TreeViewer "TSessionViewer()" Plugin.TVirtualGeoPainter: * TGeoPainter GeomPainter "TGeoPainter(TGeoManager*)" +Plugin.TGeoManagerEditor: * TGeoManagerEditor GeomBuilder "LoadLib()" Plugin.TVirtualUtil3D: * TUtil3D Graf3d "TUtil3D()" Plugin.TVirtualUtilHist: * TUtilHist Hist "TUtilHist()" Plugin.TVirtualUtilPad: * TUtilPad Gpad "TUtilPad()" diff --git a/geombuilder/Module.mk b/geombuilder/Module.mk new file mode 100644 index 0000000000000000000000000000000000000000..f5a8b8001fef7334bd0be95605b6b27af045b855 --- /dev/null +++ b/geombuilder/Module.mk @@ -0,0 +1,71 @@ +# Module.mk for geom module +# Copyright (c) 2000 Rene Brun and Fons Rademakers +# +# Author: Fons Rademakers, 29/2/2000 + +MODDIR := geombuilder +MODDIRS := $(MODDIR)/src +MODDIRI := $(MODDIR)/inc + +GEOMBUILDERDIR := $(MODDIR) +GEOMBUILDERDIRS := $(GEOMBUILDERDIR)/src +GEOMBUILDERDIRI := $(GEOMBUILDERDIR)/inc + +##### libGeomBuilder ##### +GEOMBUILDERL := $(MODDIRI)/LinkDef.h +GEOMBUILDERDS := $(MODDIRS)/G__GeomBuilder.cxx +GEOMBUILDERDO := $(GEOMBUILDERDS:.cxx=.o) +GEOMBUILDERDH := $(GEOMBUILDERDS:.cxx=.h) + +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 +GEOMBUILDERH := $(patsubst %,$(MODDIRI)/%,$(GEOMBUILDERH)) +GEOMBUILDERS := $(filter-out $(MODDIRS)/G__%,$(wildcard $(MODDIRS)/*.cxx)) +GEOMBUILDERO := $(GEOMBUILDERS:.cxx=.o) + +GEOMBUILDERDEP := $(GEOMBUILDERO:.o=.d) $(GEOMBUILDERDO:.o=.d) + +GEOMBUILDERLIB := $(LPATH)/libGeomBuilder.$(SOEXT) + +# used in the main Makefile +ALLHDRS += $(patsubst $(MODDIRI)/%.h,include/%.h,$(GEOMBUILDERH)) +ALLLIBS += $(GEOMBUILDERLIB) + +# include all dependency files +INCLUDEFILES += $(GEOMBUILDERDEP) + +##### local rules ##### +include/%.h: $(GEOMBUILDERDIRI)/%.h + cp $< $@ + +$(GEOMBUILDERLIB): $(GEOMBUILDERO) $(GEOMBUILDERDO) $(ORDER_) $(MAINLIBS) $(GEOMBUILDERLIBDEP) + @$(MAKELIB) $(PLATFORM) $(LD) "$(LDFLAGS)" \ + "$(SOFLAGS)" libGeomBuilder.$(SOEXT) $@ "$(GEOMBUILDERO) $(GEOMBUILDERDO)" \ + "$(GEOMBUILDERLIBEXTRA)" + +$(GEOMBUILDERDS): $(GEOMBUILDERH) $(GEOMBUILDERL) $(ROOTCINTTMPEXE) + @echo "Generating dictionary $@..." + $(ROOTCINTTMP) -f $@ -c $(GEOMBUILDERH) $(GEOMBUILDERL) + +$(GEOMBUILDERDO): $(GEOMBUILDERDS) + $(CXX) $(NOOPT) $(CXXFLAGS) -I. -o $@ -c $< + +all-geombuilder: $(GEOMBUILDERLIB) + +map-geombuilder: $(RLIBMAP) + $(RLIBMAP) -r $(ROOTMAP) -l $(GEOMBUILDERLIB) \ + -d $(GEOMBUILDERLIBDEP) -c $(GEOMBUILDERL) + +map:: map-geom + +clean-geombuilder: + @rm -f $(GEOMBUILDERO) $(GEOMBUILDERDO) + +clean:: clean-geombuilder + +distclean-geombuilder: clean-geombuilder + @rm -f $(GEOMBUILDERDEP) $(GEOMBUILDERDS) $(GEOMBUILDERDH) $(GEOMBUILDERLIB) + +distclean:: distclean-geombuilder diff --git a/geombuilder/inc/LinkDef.h b/geombuilder/inc/LinkDef.h new file mode 100644 index 0000000000000000000000000000000000000000..a4351cd1b97b728286ff19ca72f6bf9a7bf18558 --- /dev/null +++ b/geombuilder/inc/LinkDef.h @@ -0,0 +1,41 @@ +// @(#)$Name: $:$Id: Exp $ +/************************************************************************* + * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + +#ifdef __CINT__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class TGeoVolumeEditor; +#pragma link C++ class TGeoBBoxEditor; +#pragma link C++ class TGeoTubeEditor; +#pragma link C++ class TGeoTubeSegEditor; +#pragma link C++ class TGeoConeEditor; +#pragma link C++ class TGeoConeSegEditor; +#pragma link C++ class TGeoTrd1Editor; +#pragma link C++ class TGeoTrd2Editor; +#pragma link C++ class TGeoSphereEditor; +#pragma link C++ class TGeoMediumEditor; +#pragma link C++ class TGeoMaterialEditor; +#pragma link C++ class TGeoNodeEditor; +#pragma link C++ class TGeoTranslationEditor; +#pragma link C++ class TGeoRotationEditor; +#pragma link C++ class TGeoCombiTransEditor; +#pragma link C++ class TGeoManagerEditor; +#pragma link C++ class TGeoTabManager; +#pragma link C++ class TGeoTransientPanel; +#pragma link C++ class TGeoTreeDialog; +#pragma link C++ class TGeoVolumeDialog; +#pragma link C++ class TGeoShapeDialog; +#pragma link C++ class TGeoMatrixDialog; +#pragma link C++ class TGeoMediumDialog; +#pragma link C++ class TGeoMaterialDialog; + +#endif diff --git a/geombuilder/inc/TGeoBBoxEditor.h b/geombuilder/inc/TGeoBBoxEditor.h new file mode 100644 index 0000000000000000000000000000000000000000..27a29ade6b3e5724893fdbc4b117d109ce617606 --- /dev/null +++ b/geombuilder/inc/TGeoBBoxEditor.h @@ -0,0 +1,85 @@ +// @(#):$Name: $:$Id: 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_TGeoBBoxEditor +#define ROOT_TGeoBBoxEditor + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoBBoxEditor // +// // +// Editor for a TGeoBBox. // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TGButton +#include "TGWidget.h" +#endif +#ifndef ROOT_TGedFrame +#include "TGedFrame.h" +#endif + +class TGeoBBox; +class TGeoTabManager; +class TGTextEntry; +class TGNumberEntry; +class TGTab; +class TGComboBox; +class TGTextButton; +class TString; + +class TGeoBBoxEditor : public TGedFrame { + +protected: + + Double_t fDxi; // Initial box dx + Double_t fDyi; // Initial box dy + Double_t fDzi; // Initial box dz + Double_t fOrigi[3]; // Initial origin + TString fNamei; // Initial name + TGeoBBox *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 + TGTextEntry *fShapeName; // Shape name text entry + TGNumberEntry *fBoxDx; // Number entry for box DX + TGNumberEntry *fBoxDy; // Number entry for box DY + TGNumberEntry *fBoxDz; // Number entry for box DZ + TGNumberEntry *fBoxOx; // Number entry for box OX + TGNumberEntry *fBoxOy; // Number entry for box OY + TGNumberEntry *fBoxOz; // Number entry for box OZ + TGTextButton *fApply; // Apply-Button to accept changes + TGTextButton *fCancel; // Cancel-Button + TGTextButton *fUndo; // Undo-Button + + virtual void ConnectSignals2Slots(); // Connect the signals to the slots + +public: + TGeoBBoxEditor(const TGWindow *p, Int_t id, + Int_t width = 140, Int_t height = 30, + UInt_t options = kChildFrame, + Pixel_t back = GetDefaultFrameBackground()); + virtual ~TGeoBBoxEditor(); + virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + + void DoDx(); + void DoDy(); + void DoDz(); + void DoModified(); + void DoName(); + Bool_t DoBoxParameters(); + void DoApply(); + void DoCancel(); + void DoUndo(); + + ClassDef(TGeoBBoxEditor,0) // TGeoBBox editor +}; + +#endif diff --git a/geombuilder/inc/TGeoConeEditor.h b/geombuilder/inc/TGeoConeEditor.h new file mode 100644 index 0000000000000000000000000000000000000000..4f304f043b356bda02c57664cc5d36b9cf869c50 --- /dev/null +++ b/geombuilder/inc/TGeoConeEditor.h @@ -0,0 +1,128 @@ +// @(#):$Name: $:$Id: 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_TGeoConeEditor +#define ROOT_TGeoConeEditor + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoConeEditor // +// // +// Editor for a TGeoCone. // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TGButton +#include "TGWidget.h" +#endif +#ifndef ROOT_TGedFrame +#include "TGedFrame.h" +#endif + +class TGeoCone; +class TGeoConeSeg; +class TGeoTabManager; +class TGTextEntry; +class TGNumberEntry; +class TGTab; +class TGComboBox; +class TGTextButton; +class TString; + +class TGeoConeEditor : public TGedFrame { + +protected: + + Double_t fRmini1; // Initial inner radius at -dz + Double_t fRmaxi1; // Initial outer radius at -dz + Double_t fRmini2; // Initial inner radius at +dz + Double_t fRmaxi2; // Initial outer radius at +dz + Double_t fDzi; // Initial box dz + TString fNamei; // Initial name + TGeoCone *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 + TGTextEntry *fShapeName; // Shape name text entry + TGNumberEntry *fERmin1; // Number entry for rmin1 + TGNumberEntry *fERmin2; // Number entry for rmin2 + TGNumberEntry *fERmax1; // Number entry for rmax1 + TGNumberEntry *fERmax2; // Number entry for rmax2 + TGNumberEntry *fEDz; // Number entry for DZ + TGTextButton *fApply; // Apply-Button to accept changes + TGTextButton *fCancel; // Cancel-Button + TGTextButton *fUndo; // Undo-Button + + virtual void ConnectSignals2Slots(); // Connect the signals to the slots + +public: + TGeoConeEditor(const TGWindow *p, Int_t id, + Int_t width = 140, Int_t height = 30, + UInt_t options = kChildFrame, + Pixel_t back = GetDefaultFrameBackground()); + virtual ~TGeoConeEditor(); + virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + + void DoRmin1(); + void DoRmin2(); + void DoRmax1(); + void DoRmax2(); + void DoDz(); + void DoModified(); + void DoName(); + virtual void DoApply(); + virtual void DoCancel(); + virtual void DoUndo(); + + ClassDef(TGeoConeEditor,0) // TGeoCone editor +}; + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoConeSegEditor // +// // +// Editor for a cone segment. // +// // +////////////////////////////////////////////////////////////////////////// + +class TGDoubleVSlider; + +class TGeoConeSegEditor : public TGeoConeEditor { + +protected: + + Bool_t fLock; // Phi lock + Double_t fPmini; // Initial phi min + Double_t fPmaxi; // Initial phi max + TGDoubleVSlider *fSPhi; // Phi slider + TGNumberEntry *fEPhi1; // Number entry for phi1 + TGNumberEntry *fEPhi2; // Number entry for phi2 + + virtual void ConnectSignals2Slots(); // Connect the signals to the slots + +public: + TGeoConeSegEditor(const TGWindow *p, Int_t id, + Int_t width = 140, Int_t height = 30, + UInt_t options = kChildFrame, + Pixel_t back = GetDefaultFrameBackground()); + virtual ~TGeoConeSegEditor(); + virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + + void DoPhi(); + void DoPhi1(); + void DoPhi2(); + virtual void DoApply(); + virtual void DoUndo(); + virtual void DoCancel(); + + ClassDef(TGeoConeSegEditor,0) // TGeoConeSeg editor +}; + +#endif diff --git a/geombuilder/inc/TGeoManagerEditor.h b/geombuilder/inc/TGeoManagerEditor.h new file mode 100644 index 0000000000000000000000000000000000000000..1b8598e760e672d76e6d0ad80c988dabb43c0964 --- /dev/null +++ b/geombuilder/inc/TGeoManagerEditor.h @@ -0,0 +1,179 @@ +// @(#):$Name: $:$Id: 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_TGeoManagerEditor +#define ROOT_TGeoManagerEditor + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoManagerEditor // +// // +// Editor for a TGeoManager. // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TGButton +#include "TGWidget.h" +#endif +#ifndef ROOT_TGedFrame +#include "TGedFrame.h" +#endif + +class TGeoManager; +class TGeoVolume; +class TGeoShape; +class TGeoMedium; +class TGeoMaterial; +class TGeoMatrix; +class TGShutter; +class TGShutterItem; +class TGTextEntry; +class TGTab; +class TGComboBox; +class TGNumberEntry; +class TGTextButton; +class TGPictureButton; +class TGCheckButton; +class TGRadioButton; +class TGeoTabManager; + +class TGeoManagerEditor : public TGedFrame { + +protected: + + TGeoManager *fGeometry; // Selected geometry manager + TGeoTabManager *fTabMgr; // Tab manager + Bool_t fIsModified; // Flag that manager was modified + TGShutter *fCategories; // Categories shutter + TGTextEntry *fManagerName; // Name text entry + TGTextEntry *fManagerTitle; // Title text entry + TGTextEntry *fMediumName; // Medium name text entry + TGTextEntry *fMatrixName; // Matrix name text entry + TGTextEntry *fMaterialName; // Material name text entry + TGTextEntry *fVolumeName; // Volume name text entry + TGeoMaterial *fSelectedMaterial; // Selected material + TGeoMaterial *fSelectedMaterial2; // Selected material for medium creation + TGLabel *fLSelMaterial; // Selected material label + TGLabel *fLSelMaterial2; // Selected material label + TGPictureButton *fBSelMaterial; // Button for selecting a material + TGPictureButton *fBSelMaterial2; // Button for selecting a material + TGeoVolume *fSelectedVolume; // Selected volume + TGLabel *fLSelVolume; // Selected volume label + TGPictureButton *fBSelVolume; // Button for selecting a volume + TGeoShape *fSelectedShape; // Selected shape + TGeoShape *fSelectedShape2; // Selected shape for volume creation + TGLabel *fLSelShape; // Selected shape label + TGLabel *fLSelShape2; // Selected shape label + TGPictureButton *fBSelShape; // Button for selecting a shape + TGPictureButton *fBSelShape2; // Button for selecting a shape + TGeoMatrix *fSelectedMatrix; // Selected matrix + TGLabel *fLSelMatrix; // Selected matrix label + TGPictureButton *fBSelMatrix; // Button for selecting a matrix + TGeoMedium *fSelectedMedium; // Selected medium + TGeoMedium *fSelectedMedium2; // Selected medium for volume creation + TGLabel *fLSelMedium; // Selected medium label + TGLabel *fLSelMedium2; // Selected medium label + TGPictureButton *fBSelMedium; // Button for selecting a medium + TGPictureButton *fBSelMedium2; // Button for selecting a medium + TGPictureButton *fShapeButton[21]; // List of shape buttons + TGPictureButton *fMatrixButton[3]; // List of matrix buttons + TGPictureButton *fVolumeButton[2]; // List of volume buttons + TGPictureButton *fMaterialButton[2]; // List of material buttons + TGRadioButton *fExportOption[2]; // Export option buttons + TGTextButton *fExportButton; // Button to export geometry + TGComboBox *fElementList; // Combo box for elements + TGNumberEntry *fEntryDensity; // Number entry for material density + TGPictureButton *fMediumButton; // Button to create a medium + TGNumberEntry *fMediumId; // Medium ID number entry + TGTextButton *fEditShape; // Button for editing selected shape + TGTextButton *fEditMedium; // Button for editing a medium + TGTextButton *fEditMaterial; // Button for editing a material + TGTextButton *fEditMatrix; // Button for editing a matrix + TGTextButton *fEditVolume; // Button for editing a volume + TGTextButton *fSetTopVolume; // Button for setting top volume + TGLabel *fLSelTop; // Selected top volume + TGPictureButton *fBSelTop; // Button for selecting top volume + TGTextButton *fCloseGeometry; // Button for closing the geometry + TGCompositeFrame *f2; // Parent frame for shape editing + TGCompositeFrame *f3; // Parent frame for volume editing + TGCompositeFrame *f4; // Parent frame for materials editing + TGCompositeFrame *f5; // Parent frame for media editing + TGCompositeFrame *f6; // Parent frame for matrices editing + TGCompositeFrame *f7; // Parent frame for closing geometry + + virtual void ConnectSignals2Slots(); // Connect the signals to the slots + void ShowSelectShape(Bool_t show=kTRUE); + void ShowSelectVolume(Bool_t show=kTRUE); + void ShowSelectMaterial(Bool_t show=kTRUE); + void ShowSelectMedium(Bool_t show=kTRUE); + void ShowSelectMatrix(Bool_t show=kTRUE); + +public: + TGeoManagerEditor(const TGWindow *p, Int_t id, + Int_t width = 140, Int_t height = 30, + UInt_t options = kChildFrame, + Pixel_t back = GetDefaultFrameBackground()); + virtual ~TGeoManagerEditor(); + static void LoadLib() {;} + virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + + void DoName(); + void DoCreateBox(); + void DoCreatePara(); + void DoCreateTrd1(); + void DoCreateTrd2(); + void DoCreateTrap(); + void DoCreateGtra(); + void DoCreateXtru(); + void DoCreateArb8(); + void DoCreateTube(); + void DoCreateTubs(); + void DoCreateCone(); + void DoCreateCons(); + void DoCreateSphe(); + void DoCreateCtub(); + void DoCreateEltu(); + void DoCreateTorus(); + void DoCreatePcon(); + void DoCreatePgon(); + void DoCreateHype(); + void DoCreateParab(); + void DoCreateComposite(); + void DoCreateMaterial(); + void DoCreateMixture(); + void DoCreateMedium(); + void DoCreateTranslation(); + void DoCreateRotation(); + void DoCreateCombi(); + void DoCreateVolume(); + void DoCreateAssembly(); + void DoEditShape(); + void DoEditVolume(); + void DoEditMedium(); + void DoEditMaterial(); + void DoEditMatrix(); + void DoSelectShape(); + void DoSelectShape2(); + void DoSelectVolume(); + void DoSelectMatrix(); + void DoSelectMaterial(); + void DoSelectMaterial2(); + void DoSelectMedium(); + void DoSelectMedium2(); + void DoSetTopVolume(); + void DoSelectTopVolume(); + void DoExportGeometry(); + void DoCloseGeometry(); + + ClassDef(TGeoManagerEditor,0) // TGeoManager editor +}; + +#endif diff --git a/geombuilder/inc/TGeoMaterialEditor.h b/geombuilder/inc/TGeoMaterialEditor.h new file mode 100644 index 0000000000000000000000000000000000000000..ae4d4581442f3a4485a994463b70640837e740e6 --- /dev/null +++ b/geombuilder/inc/TGeoMaterialEditor.h @@ -0,0 +1,83 @@ +// @(#):$Name: $:$Id: 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_TGeoMaterialEditor +#define ROOT_TGeoMaterialEditor + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoMaterialEditor // +// // +// Editor for a TGeoMaterial. // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TGButton +#include "TGWidget.h" +#endif +#ifndef ROOT_TGedFrame +#include "TGedFrame.h" +#endif + +class TGeoMaterial; +class TGeoTabManager; +class TGTextEntry; +class TGNumberEntry; +class TGTab; +class TGComboBox; +class TGTextButton; +class TString; + +class TGeoMaterialEditor : public TGedFrame { + +protected: + + Int_t fAi; // Initial atomic mass + Int_t fZi; // Initial Z + Double_t fDensityi; // Initial density + TString fNamei; // Initial name + TGeoMaterial *fMaterial; // Material object + Bool_t fIsModified; // Flag that material was modified + Bool_t fIsMaterialEditable; // Flag that the material can be changed + TGeoTabManager *fTabMgr; // Tab manager + TGTextEntry *fMaterialName; // Material name text entry + TGNumberEntry *fMatA; // Number entry for A + TGNumberEntry *fMatZ; // Number entry for Z + TGNumberEntry *fMatDensity; // Number entry for density + TGNumberEntry *fMatRadLen; // Number entry for radiation length + TGNumberEntry *fMatAbsLen; // Number entry for absorbtion length + TGTextButton *fApply; // Apply-Button to accept changes + TGTextButton *fCancel; // Cancel-Button + TGTextButton *fUndo; // Undo-Button + + virtual void ConnectSignals2Slots(); // Connect the signals to the slots + +public: + TGeoMaterialEditor(const TGWindow *p, Int_t id, + Int_t width = 140, Int_t height = 30, + UInt_t options = kChildFrame, + Pixel_t back = GetDefaultFrameBackground()); + virtual ~TGeoMaterialEditor(); + virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + + void DoA(); + void DoZ(); + void DoDensity(); + void DoModified(); + void DoName(); + void DoRadAbs(); + void DoApply(); + void DoCancel(); + void DoUndo(); + + ClassDef(TGeoMaterialEditor,0) // TGeoMaterial editor +}; + +#endif diff --git a/geombuilder/inc/TGeoMatrixEditor.h b/geombuilder/inc/TGeoMatrixEditor.h new file mode 100644 index 0000000000000000000000000000000000000000..ebe3bc8487cd43179dbeb91e28b7737d9e297783 --- /dev/null +++ b/geombuilder/inc/TGeoMatrixEditor.h @@ -0,0 +1,208 @@ +// @(#):$Name: $:$Id: 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_TGeoTranslationEditor +#define ROOT_TGeoTranslationEditor + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoTranslationEditor // +// // +// Editor for a TGeoTranslation. // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TGButton +#include "TGWidget.h" +#endif +#ifndef ROOT_TGedFrame +#include "TGedFrame.h" +#endif + +class TGeoTranslation; +class TGeoRotation; +class TGeoCombiTrans; +class TGTextEntry; +class TGNumberEntry; +class TGTab; +class TGComboBox; +class TGTextButton; +class TGRadioButton; +class TString; + +class TGeoTranslationEditor : public TGedFrame { + +protected: + + Double_t fDxi; // Initial dx + Double_t fDyi; // Initial dy + Double_t fDzi; // Initial dz + TString fNamei; // Initial name + TGeoTranslation *fTranslation; // Translation object + Bool_t fIsModified; // Flag that this was modified + Bool_t fIsEditable; // Flag that this can be changed + TGTextEntry *fTransName; // Translation name text entry + TGNumberEntry *fTransDx; // Number entry for box DX + TGNumberEntry *fTransDy; // Number entry for box DY + TGNumberEntry *fTransDz; // Number entry for box DZ + TGTextButton *fApply; // Apply-Button to accept changes + TGTextButton *fCancel; // Cancel-Button + TGTextButton *fUndo; // Undo-Button + + virtual void ConnectSignals2Slots(); // Connect the signals to the slots + +public: + TGeoTranslationEditor(const TGWindow *p, Int_t id, + Int_t width = 140, Int_t height = 30, + UInt_t options = kChildFrame, + Pixel_t back = GetDefaultFrameBackground()); + virtual ~TGeoTranslationEditor(); + virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + + void DoDx(); + void DoDy(); + void DoDz(); + void DoModified(); + void DoName(); + Bool_t DoParameters(); + void DoApply(); + void DoCancel(); + void DoUndo(); + + ClassDef(TGeoTranslationEditor,0) // TGeoTranslation editor +}; + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoRotationEditor // +// // +// Editor for a TGeoRotation. // +// // +////////////////////////////////////////////////////////////////////////// + +class TGeoRotationEditor : public TGedFrame { + +protected: + + Double_t fPhii; // Initial phi (Euler rotation angle about Z) + Double_t fThetai; // Initial theta (Euler rotation angle about new X) + Double_t fPsii; // Initial dz (Euler rotation angle about new Z) + Double_t fAngleX; // New rotation angle about X + Double_t fAngleY; // New rotation angle about Y + Double_t fAngleZ; // New rotation angle about Z + TString fNamei; // Initial name + TGeoRotation *fRotation; // Rotation object + Bool_t fIsModified; // Flag that this was modified + Bool_t fIsEditable; // Flag that this can be changed + TGTextEntry *fRotName; // Translation name text entry + TGNumberEntry *fRotPhi; // Number entry for phi angle + TGNumberEntry *fRotTheta; // Number entry for theta angle + TGNumberEntry *fRotPsi; // Number entry for psi angle + TGNumberEntry *fRotAxis; // Number entry for rotation angle about one axis + TGRadioButton *fRotX; // Rotation about X selected + TGRadioButton *fRotY; // Rotation about Y selected + TGRadioButton *fRotZ; // Rotation about Z selected + TGTextButton *fApply; // Apply-Button to accept changes + TGTextButton *fCancel; // Cancel-Button + TGTextButton *fUndo; // Undo-Button + + virtual void ConnectSignals2Slots(); // Connect the signals to the slots + +public: + TGeoRotationEditor(const TGWindow *p, Int_t id, + Int_t width = 140, Int_t height = 30, + UInt_t options = kChildFrame, + Pixel_t back = GetDefaultFrameBackground()); + virtual ~TGeoRotationEditor(); + virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + + void DoRotPhi(); + void DoRotTheta(); + void DoRotPsi(); + void DoRotAngle(); + void DoModified(); + void DoName(); + Bool_t DoParameters(); + void DoApply(); + void DoCancel(); + void DoUndo(); + + ClassDef(TGeoRotationEditor,0) // TGeoRotation editor +}; + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoCombiTransEditor // +// // +// Editor for a TGeoCombiTrans. // +// // +////////////////////////////////////////////////////////////////////////// + +class TGeoCombiTransEditor : public TGedFrame { + +protected: + + Double_t fDxi; // Initial dx + Double_t fDyi; // Initial dy + Double_t fDzi; // Initial dz + Double_t fPhii; // Initial phi (Euler rotation angle about Z) + Double_t fThetai; // Initial theta (Euler rotation angle about new X) + Double_t fPsii; // Initial dz (Euler rotation angle about new Z) + Double_t fAngleX; // New rotation angle about X + Double_t fAngleY; // New rotation angle about Y + Double_t fAngleZ; // New rotation angle about Z + TString fNamei; // Initial name + TGeoCombiTrans *fCombi; // Combi object + Bool_t fIsModified; // Flag that this was modified + Bool_t fIsEditable; // Flag that this can be changed + TGTextEntry *fRotName; // Translation name text entry + TGNumberEntry *fTransDx; // Number entry for box DX + TGNumberEntry *fTransDy; // Number entry for box DY + TGNumberEntry *fTransDz; // Number entry for box DZ + TGNumberEntry *fRotPhi; // Number entry for phi angle + TGNumberEntry *fRotTheta; // Number entry for theta angle + TGNumberEntry *fRotPsi; // Number entry for psi angle + TGNumberEntry *fRotAxis; // Number entry for rotation angle about one axis + TGRadioButton *fRotX; // Rotation about X selected + TGRadioButton *fRotY; // Rotation about Y selected + TGRadioButton *fRotZ; // Rotation about Z selected + TGTextButton *fApply; // Apply-Button to accept changes + TGTextButton *fCancel; // Cancel-Button + TGTextButton *fUndo; // Undo-Button + + virtual void ConnectSignals2Slots(); // Connect the signals to the slots + +public: + TGeoCombiTransEditor(const TGWindow *p, Int_t id, + Int_t width = 140, Int_t height = 30, + UInt_t options = kChildFrame, + Pixel_t back = GetDefaultFrameBackground()); + virtual ~TGeoCombiTransEditor(); + virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + + void DoDx(); + void DoDy(); + void DoDz(); + void DoRotPhi(); + void DoRotTheta(); + void DoRotPsi(); + void DoRotAngle(); + void DoModified(); + void DoName(); + Bool_t DoParameters(); + void DoApply(); + void DoCancel(); + void DoUndo(); + + ClassDef(TGeoCombiTransEditor,0) // TGeoCombiTrans editor +}; + +#endif diff --git a/geombuilder/inc/TGeoMediumEditor.h b/geombuilder/inc/TGeoMediumEditor.h new file mode 100644 index 0000000000000000000000000000000000000000..9a39dad73c72e9d348837a2dabf4e778066b1346 --- /dev/null +++ b/geombuilder/inc/TGeoMediumEditor.h @@ -0,0 +1,96 @@ +// @(#):$Name: $:$Id: 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_TGeoMediumEditor +#define ROOT_TGeoMediumEditor + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoMediumEditor // +// // +// Editor for a TGeoMedium. // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TGButton +#include "TGWidget.h" +#endif +#ifndef ROOT_TGedFrame +#include "TGedFrame.h" +#endif + +class TGeoMedium; +class TGeoMaterial; +class TGeoTabManager; +class TGTextEntry; +class TGNumberEntry; +class TGTab; +class TGComboBox; +class TGTextButton; +class TGPictureButton; +class TGCheckButton; +class TGLabel; + +class TGeoMediumEditor : public TGedFrame { + +protected: + + TGeoMedium *fMedium; // Medium object + TGeoTabManager *fTabMgr; // Tab manager + Bool_t fIsEditable; // Flag that the medium can be changed + Bool_t fIsModified; // Modified flag + TGTextEntry *fMedName; // Medium name text entry + TGNumberEntry *fMedId; // Number entry for medium id +// TGComboBox *fMatList; // Combo box for all materials + TGeoMaterial *fSelectedMaterial; // Selected material + TGLabel *fLSelMaterial; // Selected material label + TGPictureButton *fBSelMaterial; // Button for selecting a material + TGTextButton *fEditMaterial; // Check button for material editing + TGCheckButton *fMedSensitive; // Check button for sensitivity + TGComboBox *fMagfldOption; // Combo box with magnetic field options + TGNumberEntry *fMedFieldm; // Number entry for fieldm + TGNumberEntry *fMedTmaxfd; // Number entry for tmaxfd + TGNumberEntry *fMedStemax; // Number entry for stemax + TGNumberEntry *fMedDeemax; // Number entry for deemax + TGNumberEntry *fMedEpsil; // Number entry for epsil + TGNumberEntry *fMedStmin; // Number entry for stmin + TGTextButton *fApply; // Apply-Button to accept changes + TGTextButton *fUndo; // Undo-Button + + virtual void ConnectSignals2Slots(); // Connect the signals to the slots + +public: + TGeoMediumEditor(const TGWindow *p, Int_t id, + Int_t width = 140, Int_t height = 30, + UInt_t options = kChildFrame, + Pixel_t back = GetDefaultFrameBackground()); + virtual ~TGeoMediumEditor(); + virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + + void DoEditMaterial(); + void DoSelectMaterial(); + void DoMedName(); + void DoMedId(); + void DoToggleSensitive(); + void DoMagfldSelect(Int_t ientry); + void DoFieldm(); + void DoTmaxfd(); + void DoStemax(); + void DoDeemax(); + void DoEpsil(); + void DoStmin(); + void DoApply(); + void DoUndo(); + + ClassDef(TGeoMediumEditor,0) // TGeoMedium editor +}; + +#endif diff --git a/geombuilder/inc/TGeoNodeEditor.h b/geombuilder/inc/TGeoNodeEditor.h new file mode 100644 index 0000000000000000000000000000000000000000..16b0bad945c831601a9619fbcf6a226634dd88f5 --- /dev/null +++ b/geombuilder/inc/TGeoNodeEditor.h @@ -0,0 +1,83 @@ +// @(#):$Name: $:$Id: 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_TGeoNodeEditor +#define ROOT_TGeoNodeEditor + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoNodeEditor // +// // +// Editor for a TGeoNode. // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TGButton +#include "TGWidget.h" +#endif +#ifndef ROOT_TGedFrame +#include "TGedFrame.h" +#endif + +class TGeoNode; +class TGTextEntry; +class TGNumberEntry; +class TGTab; +class TGComboBox; +class TGTextButton; +class TGCheckButton; +class TGeoTabManager; + +class TGeoNodeEditor : public TGedFrame { + +protected: + + TGeoNode *fNode; // Node object + TGeoTabManager *fTabMgr; // Tab manager + Bool_t fIsEditable; // Flag that the medium can be changed + TGTextEntry *fNodeName; // Node name text entry + TGNumberEntry *fNodeNumber; // Copy number + TGComboBox *fVolList; // Combo box for all volumes + TGComboBox *fMotherVolList; // Combo box for all volumes + TGComboBox *fMatrixList; // Combo box for all matrices + TGTextButton *fEditMother; // Check button for editing mother volume + TGTextButton *fEditVolume; // Check button for volume editing + TGTextButton *fEditMatrix; // Check button for matrix editing + TGTextButton *fApply; // Apply-Button to accept changes + TGTextButton *fCancel; // Cancel-Button + TGTextButton *fUndo; // Undo-Button + + virtual void ConnectSignals2Slots(); // Connect the signals to the slots + +public: + TGeoNodeEditor(const TGWindow *p, Int_t id, + Int_t width = 140, Int_t height = 30, + UInt_t options = kChildFrame, + Pixel_t back = GetDefaultFrameBackground()); + virtual ~TGeoNodeEditor(); + virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + + void DoEditMother(); + void DoEditVolume(); + void DoEditMatrix(); + void DoVolumeSelect(); + void DoMotherVolumeSelect(); + void DoMatrixSelect(); + void DoNodeName(); + void DoNodeNumber(); + void DoApply(); + void DoCancel(); + void DoUndo(); + + ClassDef(TGeoNodeEditor,0) // TGeoNode editor +}; + +#endif diff --git a/geombuilder/inc/TGeoSphereEditor.h b/geombuilder/inc/TGeoSphereEditor.h new file mode 100644 index 0000000000000000000000000000000000000000..b1e56f2b28d4c63230fc7346e455cb9d3d17e207 --- /dev/null +++ b/geombuilder/inc/TGeoSphereEditor.h @@ -0,0 +1,95 @@ +// @(#):$Name: $:$Id: 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_TGeoSphereEditor +#define ROOT_TGeoSphereEditor + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoSphereEditor // +// // +// Editor for a TGeoSphere. // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TGButton +#include "TGWidget.h" +#endif +#ifndef ROOT_TGedFrame +#include "TGedFrame.h" +#endif + +class TGeoSphere; +class TGeoTabManager; +class TGTextEntry; +class TGNumberEntry; +class TGTab; +class TGComboBox; +class TGDoubleVSlider; +class TGTextButton; +class TString; + +class TGeoSphereEditor : public TGedFrame { + +protected: + + Double_t fRmini; // Initial inner radius + Double_t fRmaxi; // Initial outer radius + Double_t fTheta1i; // Initial lower theta limit + Double_t fTheta2i; // Initial higher theta limit + Double_t fPhi1i; // Initial lower phi limit + Double_t fPhi2i; // Initial higher phi limit + TString fNamei; // Initial name + TGeoSphere *fShape; // Shape object + Bool_t fIsModified; // Flag that volume was modified + Bool_t fIsShapeEditable; // Flag that the shape can be changed + Bool_t fLock; // Lock + TGeoTabManager *fTabMgr; // Tab manager + TGTextEntry *fShapeName; // Shape name text entry + TGNumberEntry *fERmin; // Number entry for rmin + TGNumberEntry *fERmax; // Number entry for rmax + TGNumberEntry *fETheta1; // Number entry for Theta1 + TGNumberEntry *fETheta2; // Number entry for Theta2 + TGNumberEntry *fEPhi1; // Number entry for phi1 + TGNumberEntry *fEPhi2; // Number entry for phi2 + TGDoubleVSlider *fSPhi; // Phi slider + TGDoubleVSlider *fSTheta; // Theta slider + TGTextButton *fApply; // Apply-Button to accept changes + TGTextButton *fCancel; // Cancel-Button + TGTextButton *fUndo; // Undo-Button + + virtual void ConnectSignals2Slots(); // Connect the signals to the slots + +public: + TGeoSphereEditor(const TGWindow *p, Int_t id, + Int_t width = 140, Int_t height = 30, + UInt_t options = kChildFrame, + Pixel_t back = GetDefaultFrameBackground()); + virtual ~TGeoSphereEditor(); + virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + + void DoRmin(); + void DoRmax(); + void DoPhi(); + void DoTheta(); + void DoTheta1(); + void DoTheta2(); + void DoPhi1(); + void DoPhi2(); + void DoModified(); + void DoName(); + virtual void DoApply(); + virtual void DoCancel(); + virtual void DoUndo(); + + ClassDef(TGeoSphereEditor,0) // TGeoSphere editor +}; + +#endif diff --git a/geombuilder/inc/TGeoTabManager.h b/geombuilder/inc/TGeoTabManager.h new file mode 100644 index 0000000000000000000000000000000000000000..5ea95ba7bc31d99cf3dfeba15c691fdc9e2dda84 --- /dev/null +++ b/geombuilder/inc/TGeoTabManager.h @@ -0,0 +1,274 @@ +// @(#):$Name: $:$Id: 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_TGeoTabManager +#define ROOT_TGeoTabManager + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoTabManager // +// // +// Manager for editor tabs // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TObject +#include "TObject.h" +#endif + +class TVirtualPad; +class TClass; + +class TList; +class TGCompositeFrame; +class TGLabel; +class TGTab; +class TGComboBox; +class TGListTree; +class TGListTreeItem; + +class TGeoShape; +class TGeoVolume; +class TGeoMedium; +class TGeoMaterial; +class TGeoMatrix; + +class TGeoTreeDialog; +class TGeoTransientPanel; + +class TGeoTabManager : public TObject { +public: + enum EGeoTabType { +// kTabShape, + kTabVolume +// kTabMatrix, +// kTabMedium, +// kTabMaterial + }; +private: + TVirtualPad *fPad; // Pad to which this applies + TGTab *fTab; // Parent tab +// TGeoShape *fShape; // Edited shape + TGeoVolume *fVolume; // Edited volume +// TGeoMedium *fMedium; // Edited medium +// TGeoMaterial *fMaterial; // Edited material +// TGeoMatrix *fMatrix; // Edited matrix +// TGCompositeFrame *fShapeTab; // Shape tab +// TGCompositeFrame *fShapeCont; // Shape tab container + TGeoTransientPanel *fShapePanel; // Panel for editing shapes + TGeoTransientPanel *fMediumPanel; // Panel for editing media + TGeoTransientPanel *fMaterialPanel; // Panel for editing materials + TGeoTransientPanel *fMatrixPanel; // Panel for editing matrices + TGCompositeFrame *fVolumeTab; // Volume tab + TGCompositeFrame *fVolumeCont; // Volume tab container +// TGCompositeFrame *fMatrixTab; // Matrix tab +// TGCompositeFrame *fMatrixCont; // Matrix tab container +// TGCompositeFrame *fMediumTab; // Medium tab +// TGCompositeFrame *fMediumCont; // Medium tab container +// TGCompositeFrame *fMaterialTab; // Material tab +// TGCompositeFrame *fMaterialCont; // Material tab container + TList *fShapeCombos; // List of combo boxes refering to shapes +// TList *fVolumeCombos; // List of combo boxes refering to volumes + TList *fMatrixCombos; // List of combo boxes refering to matrices + TList *fMediumCombos; // List of combo boxes refering to media + TList *fMaterialCombos; // List of combo boxes refering to materials + + void CreateTabs(); + void GetEditors(TClass *cl, TGCompositeFrame *style); +public: + TGeoTabManager(TVirtualPad *pad, TGTab *tab); + virtual ~TGeoTabManager(); + + static TGeoTabManager *GetMakeTabManager(TVirtualPad *pad, TGTab *tab); + TVirtualPad *GetPad() const {return fPad;} + TGTab *GetTab() const {return fTab;} + Int_t GetTabIndex(EGeoTabType type) const; + void SetEnabled(EGeoTabType type, Bool_t flag=kTRUE); + void SetModel(EGeoTabType type, TObject *model, Int_t event=0); + void SetTab(EGeoTabType type); + + void AddComboShape(TGComboBox *combo); + void AddShape(const char *name, Int_t id); + void UpdateShape(Int_t id); +// void AddComboVolume(TGComboBox *combo); +// void AddVolume(const char *name, Int_t id); +// void UpdateVolume(Int_t id); + void AddComboMatrix(TGComboBox *combo); + void AddMatrix(const char *name, Int_t id); + void UpdateMatrix(Int_t id); + void AddComboMedium(TGComboBox *combo); + void AddMedium(const char *name, Int_t id); + void UpdateMedium(Int_t id); + void AddComboMaterial(TGComboBox *combo); + void AddMaterial(const char *name, Int_t id); + void UpdateMaterial(Int_t id); + + void GetShapeEditor(TGeoShape *shape); + void GetVolumeEditor(TGeoVolume *vol); + void GetMatrixEditor(TGeoMatrix *matrix); + void GetMediumEditor(TGeoMedium *medium); + void GetMaterialEditor(TGeoMaterial *material); + + +// TGCompositeFrame *GetShapeTab() const {return fShapeTab;} +// TGCompositeFrame *GetShapeCont() const {return fShapeCont;} + TGCompositeFrame *GetVolumeTab() const {return fVolumeTab;} + TGCompositeFrame *GetVolumeCont() const {return fVolumeCont;} +// TGCompositeFrame *GetMatrixTab() const {return fMatrixTab;} +// TGCompositeFrame *GetMatrixCont() const {return fMatrixCont;} +// TGCompositeFrame *GetMediumTab() const {return fMediumTab;} +// TGCompositeFrame *GetMediumCont() const {return fMediumCont;} +// TGCompositeFrame *GetMaterialTab() const {return fMaterialTab;} +// TGCompositeFrame *GetMaterialCont() const {return fMaterialCont;} +// TGeoShape *GetShape() const {return fShape;} + TGeoVolume *GetVolume() const {return fVolume;} +// TGeoMedium *GetMedium() const {return fMedium;} +// TGeoMaterial *GetMaterial() const {return fMaterial;} +// TGeoMatrix *GetMatrix() const {return fMatrix;} + + ClassDef(TGeoTabManager, 0) // Tab manager for geometry editors +}; + +class TGeoTreeDialog : public TGTransientFrame { + +protected: + static TObject *fgSelectedObj; // Selected object + TGLabel *fObjLabel; // Label for selected object + TGListTree *fLT; // List tree for selecting + TGTextButton *fClose; // Close button + + virtual void BuildListTree() = 0; + virtual void ConnectSignalsToSlots() = 0; +public: + TGeoTreeDialog(TGFrame *caller, const TGWindow *main, UInt_t w = 1, UInt_t h = 1); + virtual ~TGeoTreeDialog(); + + static TObject *GetSelected() {return fgSelectedObj;} + // Slots + virtual void DoClose() = 0; + virtual void DoItemClick(TGListTreeItem *item, Int_t btn) = 0; + void DoSelect(TGListTreeItem *item); + + ClassDef(TGeoTreeDialog, 0) // List-Tree based dialog +}; + +class TGeoVolumeDialog : public TGeoTreeDialog { + +protected: + virtual void BuildListTree(); + virtual void ConnectSignalsToSlots(); + +public: + TGeoVolumeDialog(TGFrame *caller, const TGWindow *main, UInt_t w = 1, UInt_t h = 1); + virtual ~TGeoVolumeDialog() {;} + + // Slots + virtual void DoClose(); + virtual void DoItemClick(TGListTreeItem *item, Int_t btn); + + ClassDef(TGeoVolumeDialog, 0) // List-Tree based volume dialog +}; + +class TGeoShapeDialog : public TGeoTreeDialog { + +protected: + virtual void BuildListTree(); + virtual void ConnectSignalsToSlots(); + +public: + TGeoShapeDialog(TGFrame *caller, const TGWindow *main, UInt_t w = 1, UInt_t h = 1); + virtual ~TGeoShapeDialog() {;} + + // Slots + virtual void DoClose(); + virtual void DoItemClick(TGListTreeItem *item, Int_t btn); + + ClassDef(TGeoShapeDialog, 0) // List-Tree based shape dialog +}; + +class TGeoMediumDialog : public TGeoTreeDialog { + +protected: + virtual void BuildListTree(); + virtual void ConnectSignalsToSlots(); + +public: + TGeoMediumDialog(TGFrame *caller, const TGWindow *main, UInt_t w = 1, UInt_t h = 1); + virtual ~TGeoMediumDialog() {;} + + // Slots + virtual void DoClose(); + virtual void DoItemClick(TGListTreeItem *item, Int_t btn); + + ClassDef(TGeoMediumDialog, 0) // List-Tree based medium dialog +}; + +class TGeoMaterialDialog : public TGeoTreeDialog { + +protected: + virtual void BuildListTree(); + virtual void ConnectSignalsToSlots(); + +public: + TGeoMaterialDialog(TGFrame *caller, const TGWindow *main, UInt_t w = 1, UInt_t h = 1); + virtual ~TGeoMaterialDialog() {;} + + // Slots + virtual void DoClose(); + virtual void DoItemClick(TGListTreeItem *item, Int_t btn); + + ClassDef(TGeoMaterialDialog, 0) // List-Tree based material dialog +}; + +class TGeoMatrixDialog : public TGeoTreeDialog { + +protected: + virtual void BuildListTree(); + virtual void ConnectSignalsToSlots(); + +public: + TGeoMatrixDialog(TGFrame *caller, const TGWindow *main, UInt_t w = 1, UInt_t h = 1); + virtual ~TGeoMatrixDialog() {;} + + // Slots + virtual void DoClose(); + virtual void DoItemClick(TGListTreeItem *item, Int_t btn); + + ClassDef(TGeoMatrixDialog, 0) // List-Tree based matrix dialog +}; + +class TGeoTransientPanel : public TGMainFrame { + TGTab *fTab; //tab widget holding the editor + TGCompositeFrame *fTabContainer; //main tab container + TGCompositeFrame *fStyle; //style tab container frame + TObject *fModel; //selected object + TGTextButton *fClose; //close button + +public: + TGeoTransientPanel(const char *name, TObject *obj); + virtual ~TGeoTransientPanel(); + + virtual void CloseWindow(); + virtual void DeleteEditors(); + + TGTab *GetTab() const {return fTab;} + TGCompositeFrame *GetStyle() const {return fStyle;} + TObject *GetModel() const {return fModel;} + + void GetEditors(TClass *cl); + virtual void Hide(); + virtual void Show(); + void SetModel(TObject *model, Int_t event=0); + + ClassDef(TGeoTransientPanel, 0) // List-Tree based dialog +}; + +#endif diff --git a/geombuilder/inc/TGeoTrd1Editor.h b/geombuilder/inc/TGeoTrd1Editor.h new file mode 100644 index 0000000000000000000000000000000000000000..8d833701f47a73ea1a8a292abcde07ca33ed0075 --- /dev/null +++ b/geombuilder/inc/TGeoTrd1Editor.h @@ -0,0 +1,83 @@ +// @(#):$Name: $:$Id: 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_TGeoTrd1Editor +#define ROOT_TGeoTrd1Editor + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoTrd1Editor // +// // +// Editor for a TGeoTrd1. // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TGButton +#include "TGWidget.h" +#endif +#ifndef ROOT_TGedFrame +#include "TGedFrame.h" +#endif + +class TGeoTrd1; +class TGeoTabManager; +class TGTextEntry; +class TGNumberEntry; +class TGTab; +class TGComboBox; +class TGTextButton; +class TString; + +class TGeoTrd1Editor : public TGedFrame { + +protected: + + Double_t fDxi1; // Initial dx1 + Double_t fDxi2; // Initial dx2 + Double_t fDyi; // Initial dy + Double_t fDzi; // Initial dz + TString fNamei; // Initial name + TGeoTrd1 *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 + TGTextEntry *fShapeName; // Shape name text entry + TGNumberEntry *fEDx1; // Number entry for DX1 + TGNumberEntry *fEDx2; // Number entry for DX2 + TGNumberEntry *fEDy; // Number entry for DY + TGNumberEntry *fEDz; // Number entry for DZ + TGTextButton *fApply; // Apply-Button to accept changes + TGTextButton *fCancel; // Cancel-Button + TGTextButton *fUndo; // Undo-Button + + virtual void ConnectSignals2Slots(); // Connect the signals to the slots + +public: + TGeoTrd1Editor(const TGWindow *p, Int_t id, + Int_t width = 140, Int_t height = 30, + UInt_t options = kChildFrame, + Pixel_t back = GetDefaultFrameBackground()); + virtual ~TGeoTrd1Editor(); + virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + + void DoDx1(); + void DoDx2(); + void DoDy(); + void DoDz(); + void DoModified(); + void DoName(); + void DoApply(); + void DoCancel(); + void DoUndo(); + + ClassDef(TGeoTrd1Editor,0) // TGeoTrd1 editor +}; + +#endif diff --git a/geombuilder/inc/TGeoTrd2Editor.h b/geombuilder/inc/TGeoTrd2Editor.h new file mode 100644 index 0000000000000000000000000000000000000000..9ca1036f090fc264eb0ffc64c36638ae50fd0b79 --- /dev/null +++ b/geombuilder/inc/TGeoTrd2Editor.h @@ -0,0 +1,86 @@ +// @(#):$Name: $:$Id: 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_TGeoTrd2Editor +#define ROOT_TGeoTrd2Editor + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoTrd2Editor // +// // +// Editor for a TGeoTrd2. // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TGButton +#include "TGWidget.h" +#endif +#ifndef ROOT_TGedFrame +#include "TGedFrame.h" +#endif + +class TGeoTrd2; +class TGeoTabManager; +class TGTextEntry; +class TGNumberEntry; +class TGTab; +class TGComboBox; +class TGTextButton; +class TString; + +class TGeoTrd2Editor : public TGedFrame { + +protected: + + Double_t fDxi1; // Initial dx1 + Double_t fDxi2; // Initial dx2 + Double_t fDyi1; // Initial dy1 + Double_t fDyi2; // Initial dy2 + Double_t fDzi; // Initial dz + TString fNamei; // Initial name + TGeoTrd2 *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 + TGTextEntry *fShapeName; // Shape name text entry + TGNumberEntry *fEDx1; // Number entry for DX1 + TGNumberEntry *fEDx2; // Number entry for DX2 + TGNumberEntry *fEDy1; // Number entry for DY1 + TGNumberEntry *fEDy2; // Number entry for DY1 + TGNumberEntry *fEDz; // Number entry for DZ + TGTextButton *fApply; // Apply-Button to accept changes + TGTextButton *fCancel; // Cancel-Button + TGTextButton *fUndo; // Undo-Button + + virtual void ConnectSignals2Slots(); // Connect the signals to the slots + +public: + TGeoTrd2Editor(const TGWindow *p, Int_t id, + Int_t width = 140, Int_t height = 30, + UInt_t options = kChildFrame, + Pixel_t back = GetDefaultFrameBackground()); + virtual ~TGeoTrd2Editor(); + virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + + void DoDx1(); + void DoDx2(); + void DoDy1(); + void DoDy2(); + void DoDz(); + void DoModified(); + void DoName(); + void DoApply(); + void DoCancel(); + void DoUndo(); + + ClassDef(TGeoTrd2Editor,0) // TGeoTrd2 editor +}; + +#endif diff --git a/geombuilder/inc/TGeoTubeEditor.h b/geombuilder/inc/TGeoTubeEditor.h new file mode 100644 index 0000000000000000000000000000000000000000..390ef99a3e649da9539928bba88b86498880c69a --- /dev/null +++ b/geombuilder/inc/TGeoTubeEditor.h @@ -0,0 +1,121 @@ +// @(#):$Name: $:$Id: 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_TGeoTubeEditor +#define ROOT_TGeoTubeEditor + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoTubeEditor // +// // +// Editor for a TGeoTube. // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TGButton +#include "TGWidget.h" +#endif +#ifndef ROOT_TGedFrame +#include "TGedFrame.h" +#endif + +class TGeoTube; +class TGeoTabManager; +class TGTextEntry; +class TGNumberEntry; +class TGTab; +class TGComboBox; +class TGTextButton; +class TString; + +class TGeoTubeEditor : public TGedFrame { + +protected: + + Double_t fRmini; // Initial inner radius + Double_t fRmaxi; // Initial outer radius + Double_t fDzi; // Initial box dz + TString fNamei; // Initial name + TGeoTube *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 + TGTextEntry *fShapeName; // Shape name text entry + TGNumberEntry *fERmin; // Number entry for rmin + TGNumberEntry *fERmax; // Number entry for rmax + TGNumberEntry *fEDz; // Number entry for DZ + TGTextButton *fApply; // Apply-Button to accept changes + TGTextButton *fCancel; // Cancel-Button + TGTextButton *fUndo; // Undo-Button + + virtual void ConnectSignals2Slots(); // Connect the signals to the slots + +public: + TGeoTubeEditor(const TGWindow *p, Int_t id, + Int_t width = 140, Int_t height = 30, + UInt_t options = kChildFrame, + Pixel_t back = GetDefaultFrameBackground()); + virtual ~TGeoTubeEditor(); + virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + + void DoRmin(); + void DoRmax(); + void DoDz(); + void DoModified(); + void DoName(); + virtual void DoApply(); + virtual void DoCancel(); + virtual void DoUndo(); + + ClassDef(TGeoTubeEditor,0) // TGeoTube editor +}; + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoTubeSegEditor // +// // +// Editor for a tube segment. // +// // +////////////////////////////////////////////////////////////////////////// + +class TGDoubleVSlider; + +class TGeoTubeSegEditor : public TGeoTubeEditor { + +protected: + + Bool_t fLock; // Phi lock + Double_t fPmini; // Initial phi min + Double_t fPmaxi; // Initial phi max + TGDoubleVSlider *fSPhi; // Phi slider + TGNumberEntry *fEPhi1; // Number entry for phi1 + TGNumberEntry *fEPhi2; // Number entry for phi2 + + virtual void ConnectSignals2Slots(); // Connect the signals to the slots + +public: + TGeoTubeSegEditor(const TGWindow *p, Int_t id, + Int_t width = 140, Int_t height = 30, + UInt_t options = kChildFrame, + Pixel_t back = GetDefaultFrameBackground()); + virtual ~TGeoTubeSegEditor(); + virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + + void DoPhi(); + void DoPhi1(); + void DoPhi2(); + virtual void DoApply(); + virtual void DoUndo(); + virtual void DoCancel(); + + ClassDef(TGeoTubeSegEditor,0) // TGeoTubeSeg editor +}; + +#endif diff --git a/geombuilder/inc/TGeoVolumeEditor.h b/geombuilder/inc/TGeoVolumeEditor.h new file mode 100644 index 0000000000000000000000000000000000000000..11dc80bf8465728dacde57edce5a020bb39e53c2 --- /dev/null +++ b/geombuilder/inc/TGeoVolumeEditor.h @@ -0,0 +1,134 @@ +// @(#):$Name: $:$Id: 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_TGeoVolumeEditor +#define ROOT_TGeoVolumeEditor + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoVolumeEditor // +// // +// Editor for a TGeoVolume. // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TGButton +#include "TGWidget.h" +#endif +#ifndef ROOT_TGedFrame +#include "TGedFrame.h" +#endif + +class TGeoManager; +class TGeoVolume; +class TGeoShape; +class TGeoMedium; +class TGeoMaterial; +class TGeoMatrix; +class TGTextEntry; +class TGNumberEntry; +class TGTab; +class TGComboBox; +class TGTextButton; +class TGPictureButton; +class TGCheckButton; +class TGRadioButton; +class TGShutter; +class TGShutterItem; +class TGeoTabManager; + +class TGeoVolumeEditor : public TGedFrame { + +protected: + + TGeoManager *fGeometry; // Selected geometry manager + TGeoTabManager *fTabMgr; // Tab manager + TGeoVolume *fVolume; // Volume object + Bool_t fIsModified; // Flag that volume was modified + Bool_t fIsAssembly; // Flag that the volume is an assembly + Bool_t fIsDivided; // Flag that the volume is divided + TGShutter *fCategories; // Categories shutter + TGTextEntry *fVolumeName; // Volume name text entry +// TGComboBox *fShapeList; // All-shapes combo box + TGeoShape *fSelectedShape; // Selected shape + TGLabel *fLSelShape; // Selected shape label + TGPictureButton *fBSelShape; // Button for selecting a shape +// TGComboBox *fMediaList; // All-media combo box + TGeoMedium *fSelectedMedium; // Selected medium + TGLabel *fLSelMedium; // Selected medium label + TGPictureButton *fBSelMedium; // Button for selecting a medium +// TGComboBox *fVolumeList; // All-volume combo box + TGeoVolume *fSelectedVolume; // Selected volume + TGLabel *fLSelVolume; // Selected volume label + TGPictureButton *fBSelVolume; // Button for selecting a volume +// TGComboBox *fMatrixList; // All-matrix combo box + TGeoMatrix *fSelectedMatrix; // Selected matrix + TGLabel *fLSelMatrix; // Selected matrix label + TGPictureButton *fBSelMatrix; // Button for selecting a matrix + TGNumberEntry *fCopyNumber; // Node copy number + TGTextButton *fAddNode; // Button for adding a node + TGTextButton *fEditShape; // Check button for shape editing + TGTextButton *fEditMedium; // Check button for medium editing + TGComboBox *fNodeList; // Daughters combo box + TGTextButton *fEditMatrix; // Button for editing the position of a daughter + TGTextButton *fRemoveNode; // Button for removing a daughter + TGCheckButton *fBVis[2]; // Buttons for setting vis. on/off + TGRadioButton *fBView[3]; // Radio for selecting view options + TGCheckButton *fBRaytrace; // Raytracing on/off + TGCheckButton *fBAuto; // Check button for auto vis level + TGNumberEntry *fEVisLevel; // Number entry for visibility level + TGTextButton *fApplyDiv; // Button for applying division settings + TGTextEntry *fDivName; // Division volume name text entry + TGRadioButton *fBDiv[3]; // Radio for selecting division type + TGNumberEntry *fEDivFrom; // Number entry for division start + TGNumberEntry *fEDivStep; // Number entry for division step + TGNumberEntry *fEDivN; // Number entry for division Nslices + + virtual void ConnectSignals2Slots(); // Connect the signals to the slots + void UpdatePad(); + +public: + TGeoVolumeEditor(const TGWindow *p, Int_t id, + Int_t width = 140, Int_t height = 30, + UInt_t options = kChildFrame, + Pixel_t back = GetDefaultFrameBackground()); + virtual ~TGeoVolumeEditor(); + virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + + void DoAddNode(); + void DoVolumeName(); + void DoSelectShape(); + void DoSelectMedium(); + void DoSelectMatrix(); + void DoSelectVolume(); + void DoEditShape(); + void DoEditMedium(); + void DoEditMatrix(); + void DoRemoveNode(); + void DoVisVolume(); + void DoVisDaughters(); + void DoVisAuto(); + void DoVisLevel(); + void DoViewAll(); + void DoViewLeaves(); + void DoViewOnly(); + void DoDivSelAxis(); + void DoDivFromTo(); + void DoDivStep(); + void DoDivN(); + void DoDivName(); + void DoApplyDiv(); + void DoRaytrace(); + + ClassDef(TGeoVolumeEditor,0) // TGeoVolume editor +}; + +#endif diff --git a/geombuilder/src/TGeoBBoxEditor.cxx b/geombuilder/src/TGeoBBoxEditor.cxx new file mode 100644 index 0000000000000000000000000000000000000000..41bdc628701ffe3e4b207869f538e14509f4417c --- /dev/null +++ b/geombuilder/src/TGeoBBoxEditor.cxx @@ -0,0 +1,357 @@ +// @(#):$Name: $:$Id: 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. * + *************************************************************************/ + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoBBoxEditor // +// // +////////////////////////////////////////////////////////////////////////// + +#include "TGeoBBoxEditor.h" +#include "TGeoTabManager.h" +#include "TGeoBBox.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(TGeoBBoxEditor) + +enum ETGeoBBoxWid { + kBOX_NAME, kBOX_X, kBOX_Y, kBOX_Z, + kBOX_OX, kBOX_OY, kBOX_OZ, + kBOX_APPLY, kBOX_CANCEL, kBOX_UNDO +}; + +//______________________________________________________________________________ +TGeoBBoxEditor::TGeoBBoxEditor(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 + fShape = 0; + fDxi = fDyi = fDzi = 0.0; + memset(fOrigi, 0, 3*sizeof(Double_t)); + fNamei = ""; + fIsModified = kFALSE; + fIsShapeEditable = kFALSE; + + fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); + + // TextEntry for shape name + MakeTitle("Name"); + fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kBOX_NAME); + fShapeName->Resize(135, fShapeName->GetDefaultHeight()); + fShapeName->SetToolTipText("Enter the box name"); + fShapeName->Associate(this); + AddFrame(fShapeName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5)); + + TGTextEntry *nef; + MakeTitle("Box half-lengths"); + TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame | kDoubleBorder); + // Number entry for dx + TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "DX"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fBoxDx = new TGNumberEntry(f1, 0., 5, kBOX_X); + fBoxDx->SetNumAttr(TGNumberFormat::kNEAPositive); + nef = (TGTextEntry*)fBoxDx->GetNumberEntry(); + nef->SetToolTipText("Enter the box half-lenth in X"); + fBoxDx->Associate(this); + f1->AddFrame(fBoxDx, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + // Number entry for dy + TGCompositeFrame *f2 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f2->AddFrame(new TGLabel(f2, "DY"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fBoxDy = new TGNumberEntry(f2, 0., 5, kBOX_Y); + fBoxDy->SetNumAttr(TGNumberFormat::kNEAPositive); + nef = (TGTextEntry*)fBoxDy->GetNumberEntry(); + nef->SetToolTipText("Enter the box half-lenth in Y"); + fBoxDy->Associate(this); + f2->AddFrame(fBoxDy, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + compxyz->AddFrame(f2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + // Number entry for dx + TGCompositeFrame *f3 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f3->AddFrame(new TGLabel(f3, "DZ"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fBoxDz = new TGNumberEntry(f3, 0., 5, kBOX_Z); + fBoxDz->SetNumAttr(TGNumberFormat::kNEAPositive); + nef = (TGTextEntry*)fBoxDz->GetNumberEntry(); + nef->SetToolTipText("Enter the box half-lenth in Z"); + fBoxDz->Associate(this); + f3->AddFrame(fBoxDz, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + compxyz->AddFrame(f3, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + compxyz->Resize(150,30); + AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); + + MakeTitle("Box origin"); + compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame | kDoubleBorder); + // Number entry for dx + f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "OX"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fBoxOx = new TGNumberEntry(f1, 0., 5, kBOX_OX); + nef = (TGTextEntry*)fBoxOx->GetNumberEntry(); + nef->SetToolTipText("Enter the box origin X coordinate"); + fBoxOx->Associate(this); + f1->AddFrame(fBoxOx, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + // Number entry for dy + f2 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f2->AddFrame(new TGLabel(f2, "OY"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fBoxOy = new TGNumberEntry(f2, 0., 5, kBOX_OY); + nef = (TGTextEntry*)fBoxOy->GetNumberEntry(); + nef->SetToolTipText("Enter the box origin Y coordinate"); + fBoxOy->Associate(this); + f2->AddFrame(fBoxOy, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + compxyz->AddFrame(f2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + // Number entry for dx + f3 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f3->AddFrame(new TGLabel(f3, "OZ"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fBoxOz = new TGNumberEntry(f3, 0., 5, kBOX_OZ); + nef = (TGTextEntry*)fBoxOz->GetNumberEntry(); + nef->SetToolTipText("Enter the box origin Z coordinate"); + fBoxOz->Associate(this); + f3->AddFrame(fBoxOz, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + compxyz->AddFrame(f3, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + compxyz->Resize(150,30); + AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 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); + fCancel = new TGTextButton(f23, "&Cancel"); + f23->AddFrame(fCancel, new TGLayoutHints(kLHintsCenterX, 2, 2, 4, 4)); + fCancel->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 = TGeoBBox::Class(); + TGedElement *ge = new TGedElement; + ge->fGedFrame = this; + ge->fCanvas = 0; + cl->GetEditorList()->Add(ge); +} + +//______________________________________________________________________________ +TGeoBBoxEditor::~TGeoBBoxEditor() +{ +// Destructor + TGFrameElement *el; + TIter next(GetList()); + + while ((el = (TGFrameElement *)next())) { + if (!strcmp(el->fFrame->ClassName(), "TGCompositeFrame")) + ((TGCompositeFrame *)el->fFrame)->Cleanup(); + } + Cleanup(); + TClass *cl = TGeoBBox::Class(); + TIter next1(cl->GetEditorList()); + TGedElement *ge; + while ((ge=(TGedElement*)next1())) { + if (ge->fGedFrame==this) { + cl->GetEditorList()->Remove(ge); + delete ge; + next1.Reset(); + } + } +} + +//______________________________________________________________________________ +void TGeoBBoxEditor::ConnectSignals2Slots() +{ + // Connect signals to slots. + fApply->Connect("Clicked()", "TGeoBBoxEditor", this, "DoApply()"); + fCancel->Connect("Clicked()", "TGeoBBoxEditor", this, "DoCancel()"); + fUndo->Connect("Clicked()", "TGeoBBoxEditor", this, "DoUndo()"); + fShapeName->Connect("TextChanged(const char *)", "TGeoBBoxEditor", this, "DoModified()"); + fBoxDx->Connect("ValueSet(Long_t)", "TGeoBBoxEditor", this, "DoDx()"); + fBoxDy->Connect("ValueSet(Long_t)", "TGeoBBoxEditor", this, "DoDy()"); + fBoxDz->Connect("ValueSet(Long_t)", "TGeoBBoxEditor", this, "DoDz()"); + fBoxDx->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoBBoxEditor", this, "DoModified()"); + fBoxDy->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoBBoxEditor", this, "DoModified()"); + fBoxDz->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoBBoxEditor", this, "DoModified()"); + fBoxOx->Connect("ValueSet(Long_t)", "TGeoBBoxEditor", this, "DoModified()"); + fBoxOy->Connect("ValueSet(Long_t)", "TGeoBBoxEditor", this, "DoModified()"); + fBoxOz->Connect("ValueSet(Long_t)", "TGeoBBoxEditor", this, "DoModified()"); + fInit = kFALSE; +} + + +//______________________________________________________________________________ +void TGeoBBoxEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +{ + // Connect to the picked volume. + if (obj == 0 || (obj->IsA()!=TGeoBBox::Class())) { + SetActive(kFALSE); + return; + } + fModel = obj; + fPad = pad; + fShape = (TGeoBBox*)fModel; + fDxi = fShape->GetDX(); + fDyi = fShape->GetDY(); + fDzi = fShape->GetDZ(); + memcpy(fOrigi, fShape->GetOrigin(), 3*sizeof(Double_t)); + const char *sname = fShape->GetName(); + if (!strcmp(sname, fShape->ClassName())) fShapeName->SetText("-no_name"); + else { + fShapeName->SetText(sname); + fNamei = sname; + } + fBoxDx->SetNumber(fDxi); + fBoxDy->SetNumber(fDyi); + fBoxDz->SetNumber(fDzi); + fBoxOx->SetNumber(fOrigi[0]); + fBoxOy->SetNumber(fOrigi[1]); + fBoxOz->SetNumber(fOrigi[2]); + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); + + if (fInit) ConnectSignals2Slots(); + SetActive(); +} + +//______________________________________________________________________________ +void TGeoBBoxEditor::DoName() +{ + const char *name = fShapeName->GetText(); + if (!strcmp(name, "-no_name") || !strcmp(name, fShape->GetName())) return; + fShape->SetName(name); + Int_t id = gGeoManager->GetListOfShapes()->IndexOf(fShape); + fTabMgr->UpdateShape(id); + fUndo->SetEnabled(); + fCancel->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +Bool_t TGeoBBoxEditor::DoBoxParameters() +{ + Double_t dx = fBoxDx->GetNumber(); + Double_t dy = fBoxDy->GetNumber(); + Double_t dz = fBoxDz->GetNumber(); + Double_t orig[3]; + orig[0] = fBoxOx->GetNumber(); + orig[1] = fBoxOy->GetNumber(); + orig[2] = fBoxOz->GetNumber(); + Bool_t changed = kFALSE; + if (dx != fShape->GetDX() || dy != fShape->GetDY() || dz != fShape->GetDZ()) changed = kTRUE; + if (!changed) { + if (orig[0] != fShape->GetOrigin()[0] || + orig[1] != fShape->GetOrigin()[1] || + orig[2] != fShape->GetOrigin()[2]) changed = kTRUE; + } + if (!changed) return kFALSE; + fUndo->SetEnabled(); + fShape->SetBoxDimensions(dx, dy, dz, orig); + if (fPad) { + if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) { + fShape->Draw(); + fPad->GetView()->ShowAxis(); + } else { + fPad->Modified(); + fPad->Update(); + } + } + return kTRUE; +} + +//______________________________________________________________________________ +void TGeoBBoxEditor::DoApply() +{ + DoName(); + if (DoBoxParameters()) { + fUndo->SetEnabled(); + fCancel->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); + } +} + +//______________________________________________________________________________ +void TGeoBBoxEditor::DoCancel() +{ + if (!fNamei.Length()) fShapeName->SetText("-no_name"); + else fShapeName->SetText(fNamei.Data()); + fBoxDx->SetNumber(fDxi); + fBoxDy->SetNumber(fDyi); + fBoxDz->SetNumber(fDzi); + fBoxOx->SetNumber(fOrigi[0]); + fBoxOy->SetNumber(fOrigi[1]); + fBoxOz->SetNumber(fOrigi[2]); + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoBBoxEditor::DoModified() +{ + fApply->SetEnabled(); + if (fUndo->GetState()==kButtonDisabled) fCancel->SetEnabled(); +} + +//______________________________________________________________________________ +void TGeoBBoxEditor::DoUndo() +{ + DoCancel(); + DoBoxParameters(); + fCancel->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoBBoxEditor::DoDx() +{ + DoModified(); +} + +//______________________________________________________________________________ +void TGeoBBoxEditor::DoDy() +{ + DoModified(); +} + +//______________________________________________________________________________ +void TGeoBBoxEditor::DoDz() +{ + DoModified(); +} + + diff --git a/geombuilder/src/TGeoConeEditor.cxx b/geombuilder/src/TGeoConeEditor.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5513a2d0d3f35e8c0fa600fd6e721eedd24cbcf3 --- /dev/null +++ b/geombuilder/src/TGeoConeEditor.cxx @@ -0,0 +1,612 @@ +// @(#):$Name: $:$Id: 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. * + *************************************************************************/ + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoConeEditor // +// // +////////////////////////////////////////////////////////////////////////// + +#include "TGeoConeEditor.h" +#include "TGeoTabManager.h" +#include "TGeoCone.h" +#include "TGeoManager.h" +#include "TVirtualGeoPainter.h" +#include "TPad.h" +#include "TView.h" +#include "TGTab.h" +#include "TGComboBox.h" +#include "TGButton.h" +#include "TGTextEntry.h" +#include "TGNumberEntry.h" +#include "TGLabel.h" +#include "TGDoubleSlider.h" + +ClassImp(TGeoConeEditor) + +enum ETGeoConeWid { + kCONE_NAME, kCONE_RMIN1, kCONE_RMIN2, kCONE_RMAX1, kCONE_RMAX2, kCONE_Z, + kCONE_APPLY, kCONE_CANCEL, kCONE_UNDO +}; + +//______________________________________________________________________________ +TGeoConeEditor::TGeoConeEditor(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 + fShape = 0; + fRmini1 = fRmaxi1 = fRmini2 = fRmaxi2 = fDzi = 0.0; + fNamei = ""; + fIsModified = kFALSE; + fIsShapeEditable = kTRUE; + + fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); + + // TextEntry for shape name + MakeTitle("Name"); + fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kCONE_NAME); + fShapeName->Resize(135, fShapeName->GetDefaultHeight()); + fShapeName->SetToolTipText("Enter the cone name"); + fShapeName->Associate(this); + AddFrame(fShapeName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5)); + + TGTextEntry *nef; + MakeTitle("Cone dimensions"); + TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame); + + // Number entry for Rmin1 + TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "Rmin1"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fERmin1 = new TGNumberEntry(f1, 0., 5, kCONE_RMIN1); + fERmin1->SetNumAttr(TGNumberFormat::kNEANonNegative); + nef = (TGTextEntry*)fERmin1->GetNumberEntry(); + nef->SetToolTipText("Enter the inner radius"); + fERmin1->Associate(this); + fERmin1->Resize(100, fERmin1->GetDefaultHeight()); + f1->AddFrame(fERmin1, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + // Number entry for Rmax1 + f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "Rmax1"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fERmax1 = new TGNumberEntry(f1, 0., 5, kCONE_RMAX1); + fERmax1->SetNumAttr(TGNumberFormat::kNEANonNegative); + nef = (TGTextEntry*)fERmax1->GetNumberEntry(); + nef->SetToolTipText("Enter the outer radius"); + fERmax1->Associate(this); + fERmax1->Resize(100, fERmax1->GetDefaultHeight()); + f1->AddFrame(fERmax1, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + // Number entry for Rmin2 + f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "Rmin2"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fERmin2 = new TGNumberEntry(f1, 0., 5, kCONE_RMIN2); + fERmin2->SetNumAttr(TGNumberFormat::kNEANonNegative); + nef = (TGTextEntry*)fERmin2->GetNumberEntry(); + nef->SetToolTipText("Enter the inner radius"); + fERmin2->Associate(this); + fERmin2->Resize(100, fERmin2->GetDefaultHeight()); + f1->AddFrame(fERmin2, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + // Number entry for Rmax2 + f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "Rmax2"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fERmax2 = new TGNumberEntry(f1, 0., 5, kCONE_RMAX2); + fERmax2->SetNumAttr(TGNumberFormat::kNEANonNegative); + nef = (TGTextEntry*)fERmax1->GetNumberEntry(); + nef->SetToolTipText("Enter the outer radius"); + fERmax2->Associate(this); + fERmax2->Resize(100, fERmax2->GetDefaultHeight()); + f1->AddFrame(fERmax2, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + // Number entry for dz + f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "DZ"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fEDz = new TGNumberEntry(f1, 0., 5, kCONE_Z); + fEDz->SetNumAttr(TGNumberFormat::kNEAPositive); + nef = (TGTextEntry*)fEDz->GetNumberEntry(); + nef->SetToolTipText("Enter the cone half-lenth in Z"); + fEDz->Associate(this); + fEDz->Resize(100, fEDz->GetDefaultHeight()); + f1->AddFrame(fEDz, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + compxyz->Resize(150,30); + AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); + + // Buttons + TGCompositeFrame *f23 = new TGCompositeFrame(this, 118, 20, kHorizontalFrame | kSunkenFrame); + fApply = new TGTextButton(f23, "Apply"); + f23->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4)); + fApply->Associate(this); + fCancel = new TGTextButton(f23, "Cancel"); + f23->AddFrame(fCancel, new TGLayoutHints(kLHintsCenterX, 2, 2, 4, 4)); + fCancel->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 = TGeoCone::Class(); + TGedElement *ge = new TGedElement; + ge->fGedFrame = this; + ge->fCanvas = 0; + cl->GetEditorList()->Add(ge); +} + +//______________________________________________________________________________ +TGeoConeEditor::~TGeoConeEditor() +{ +// Destructor + TGFrameElement *el; + TIter next(GetList()); + + while ((el = (TGFrameElement *)next())) { + if (!strcmp(el->fFrame->ClassName(), "TGCompositeFrame")) + ((TGCompositeFrame *)el->fFrame)->Cleanup(); + } + Cleanup(); + TClass *cl = TGeoCone::Class(); + TIter next1(cl->GetEditorList()); + TGedElement *ge; + while ((ge=(TGedElement*)next1())) { + if (ge->fGedFrame==this) { + cl->GetEditorList()->Remove(ge); + delete ge; + next1.Reset(); + } + } +} + +//______________________________________________________________________________ +void TGeoConeEditor::ConnectSignals2Slots() +{ + // Connect signals to slots. + fApply->Connect("Clicked()", "TGeoConeEditor", this, "DoApply()"); + fCancel->Connect("Clicked()", "TGeoConeEditor", this, "DoCancel()"); + fUndo->Connect("Clicked()", "TGeoConeEditor", this, "DoUndo()"); + fShapeName->Connect("TextChanged(const char *)", "TGeoConeEditor", this, "DoModified()"); + fERmin1->Connect("ValueSet(Long_t)", "TGeoConeEditor", this, "DoRmin1()"); + fERmin2->Connect("ValueSet(Long_t)", "TGeoConeEditor", this, "DoRmin2()"); + fERmax1->Connect("ValueSet(Long_t)", "TGeoConeEditor", this, "DoRmax1()"); + fERmax2->Connect("ValueSet(Long_t)", "TGeoConeEditor", this, "DoRmax2()"); + fEDz->Connect("ValueSet(Long_t)", "TGeoConeEditor", this, "DoDz()"); + fERmin1->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoConeEditor", this, "DoRmin1()"); + fERmin2->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoConeEditor", this, "DoRmin2()"); + fERmax1->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoConeEditor", this, "DoRmax1()"); + fERmax2->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoConeEditor", this, "DoRmax2()"); + fEDz->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoConeEditor", this, "DoDz()"); + fInit = kFALSE; +} + + +//______________________________________________________________________________ +void TGeoConeEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +{ + // Connect to the picked volume. + if (obj == 0 || (obj->IsA()!=TGeoCone::Class())) { + SetActive(kFALSE); + return; + } + fModel = obj; + fPad = pad; + fShape = (TGeoCone*)fModel; + fRmini1 = fShape->GetRmin1(); + fRmini2 = fShape->GetRmin2(); + fRmaxi1 = fShape->GetRmax1(); + fRmaxi2 = fShape->GetRmax2(); + fDzi = fShape->GetDz(); + fNamei = fShape->GetName(); + fShapeName->SetText(fShape->GetName()); + fERmin1->SetNumber(fRmini1); + fERmin2->SetNumber(fRmini2); + fERmax1->SetNumber(fRmaxi1); + fERmax2->SetNumber(fRmaxi2); + fEDz->SetNumber(fDzi); + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); + + if (fInit) ConnectSignals2Slots(); + SetActive(); +} + +//______________________________________________________________________________ +void TGeoConeEditor::DoName() +{ + DoModified(); +} + +//______________________________________________________________________________ +void TGeoConeEditor::DoApply() +{ + const char *name = fShapeName->GetText(); + if (strcmp(name,fShape->GetName())) { + fShape->SetName(name); + Int_t id = gGeoManager->GetListOfShapes()->IndexOf(fShape); + fTabMgr->UpdateShape(id); + } + Double_t rmin1 = fERmin1->GetNumber(); + Double_t rmin2 = fERmin2->GetNumber(); + Double_t rmax1 = fERmax1->GetNumber(); + Double_t rmax2 = fERmax2->GetNumber(); + Double_t dz = fEDz->GetNumber(); + fShape->SetConeDimensions(dz, rmin1, rmax1, rmin2, rmax2); + fShape->ComputeBBox(); + fUndo->SetEnabled(); + fCancel->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); + if (fPad) { + if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) { + fShape->Draw(); + fPad->GetView()->ShowAxis(); + } else { + fPad->Modified(); + fPad->Update(); + } + } +} + +//______________________________________________________________________________ +void TGeoConeEditor::DoCancel() +{ + fShapeName->SetText(fNamei.Data()); + fERmin1->SetNumber(fRmini1); + fERmin2->SetNumber(fRmini2); + fERmax1->SetNumber(fRmaxi1); + fERmax2->SetNumber(fRmaxi2); + fEDz->SetNumber(fDzi); + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoConeEditor::DoModified() +{ + fApply->SetEnabled(); + if (fUndo->GetState()==kButtonDisabled) fCancel->SetEnabled(); +} + +//______________________________________________________________________________ +void TGeoConeEditor::DoUndo() +{ + DoCancel(); + DoApply(); + fCancel->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoConeEditor::DoRmin1() +{ + Double_t rmin1 = fERmin1->GetNumber(); + Double_t rmax1 = fERmax1->GetNumber(); + if (rmax1<rmin1+1.e-10) { + rmax1 = rmin1 + 0.1; + fERmax1->SetNumber(rmax1); + } + DoModified(); +} + +//______________________________________________________________________________ +void TGeoConeEditor::DoRmax1() +{ + Double_t rmin1 = fERmin1->GetNumber(); + Double_t rmax1 = fERmax1->GetNumber(); + if (rmax1<rmin1+1.e-10) { + rmin1 = rmax1 - 0.1; + if (rmin1 < 0.) rmin1 = 0.; + fERmin1->SetNumber(rmin1); + } + DoModified(); +} + +//______________________________________________________________________________ +void TGeoConeEditor::DoRmin2() +{ + Double_t rmin2 = fERmin2->GetNumber(); + Double_t rmax2 = fERmax2->GetNumber(); + if (rmax2<rmin2+1.e-10) { + rmax2 = rmin2 + 0.1; + fERmax2->SetNumber(rmax2); + } + DoModified(); +} + +//______________________________________________________________________________ +void TGeoConeEditor::DoRmax2() +{ + Double_t rmin2 = fERmin2->GetNumber(); + Double_t rmax2 = fERmax2->GetNumber(); + if (rmax2<rmin2+1.e-10) { + rmin2 = rmax2 - 0.1; + if (rmin2 < 0.) rmin2 = 0.; + fERmin2->SetNumber(rmin2); + } + DoModified(); +} + +//______________________________________________________________________________ +void TGeoConeEditor::DoDz() +{ + DoModified(); +} + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoConeSegEditor // +// // +////////////////////////////////////////////////////////////////////////// + +ClassImp(TGeoConeSegEditor) + +enum ETGeoConeSegWid { + kCONESEG_PHI1, kCONESEG_PHI2, kCONESEG_PHI +}; + +//______________________________________________________________________________ +TGeoConeSegEditor::TGeoConeSegEditor(const TGWindow *p, Int_t id, Int_t width, + Int_t height, UInt_t options, Pixel_t back) + : TGeoConeEditor(p, id, width, height, options | kVerticalFrame, back) +{ + // Constructor for cone segment editor + fLock = kFALSE; + MakeTitle("Phi range"); + TGTextEntry *nef; + TGCompositeFrame *compxyz = new TGCompositeFrame(this, 155, 200, kHorizontalFrame | kRaisedFrame); + // Vertical slider + fSPhi = new TGDoubleVSlider(compxyz,140); + fSPhi->SetRange(0.,720.); + compxyz->AddFrame(fSPhi, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 2, 2, 4, 4)); + TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 100, 200, kVerticalFrame); + f1->AddFrame(new TGLabel(f1, "Phi min."), new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 2, 2)); + fEPhi1 = new TGNumberEntry(f1, 0., 5, kCONESEG_PHI1); + fEPhi1->Resize(100, fEPhi1->GetDefaultHeight()); + fEPhi1->SetNumAttr(TGNumberFormat::kNEANonNegative); + nef = (TGTextEntry*)fEPhi1->GetNumberEntry(); + nef->SetToolTipText("Enter the phi1 value"); + fEPhi1->Associate(this); + f1->AddFrame(fEPhi1, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2)); + + fEPhi2 = new TGNumberEntry(f1, 0., 5, kCONESEG_PHI2); + fEPhi2->Resize(100, fEPhi2->GetDefaultHeight()); + fEPhi2->SetNumAttr(TGNumberFormat::kNEANonNegative); + nef = (TGTextEntry*)fEPhi2->GetNumberEntry(); + nef->SetToolTipText("Enter the phi2 value"); + fEPhi2->Associate(this); + f1->AddFrame(fEPhi2, new TGLayoutHints(kLHintsBottom | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2)); + f1->AddFrame(new TGLabel(f1, "Phi max."), new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2)); + + compxyz->Resize(150,150); + AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); + + // Initialize layout + MapSubwindows(); + Layout(); + MapWindow(); + + TClass *cl = TGeoConeSeg::Class(); + TGedElement *ge = new TGedElement; + ge->fGedFrame = this; + ge->fCanvas = 0; + cl->GetEditorList()->Add(ge); +} + +//______________________________________________________________________________ +TGeoConeSegEditor::~TGeoConeSegEditor() +{ +// Destructor + TGFrameElement *el; + TIter next(GetList()); + + while ((el = (TGFrameElement *)next())) { + if (!strcmp(el->fFrame->ClassName(), "TGCompositeFrame")) + ((TGCompositeFrame *)el->fFrame)->Cleanup(); + } + Cleanup(); + TClass *cl = TGeoConeSeg::Class(); + TIter next1(cl->GetEditorList()); + TGedElement *ge; + while ((ge=(TGedElement*)next1())) { + if (ge->fGedFrame==this) { + cl->GetEditorList()->Remove(ge); + delete ge; + next1.Reset(); + } + } +} + +//______________________________________________________________________________ +void TGeoConeSegEditor::ConnectSignals2Slots() +{ + TGeoConeEditor::ConnectSignals2Slots(); + Disconnect(fApply, "Clicked()",(TGeoConeEditor*)this, "DoApply()"); + Disconnect(fUndo, "Clicked()",(TGeoConeEditor*)this, "DoUndo()"); + Disconnect(fCancel, "Clicked()",(TGeoConeEditor*)this, "DoCancel()"); + fApply->Connect("Clicked()", "TGeoConeSegEditor", this, "DoApply()"); + fUndo->Connect("Clicked()", "TGeoConeSegEditor", this, "DoUndo()"); + fCancel->Connect("Clicked()", "TGeoConeSegEditor", this, "DoCancel()"); + fEPhi1->Connect("ValueSet(Long_t)", "TGeoConeSegEditor", this, "DoPhi1()"); + fEPhi2->Connect("ValueSet(Long_t)", "TGeoConeSegEditor", this, "DoPhi2()"); +// fEPhi1->GetNumberEntry()->Connect("TextChanged(const char *)","TGeoConeSegEditor", this, "DoPhi1()"); +// fEPhi2->GetNumberEntry()->Connect("TextChanged(const char *)","TGeoConeSegEditor", this, "DoPhi2()"); + fSPhi->Connect("PositionChanged()","TGeoConeSegEditor", this, "DoPhi()"); +} + +//______________________________________________________________________________ +void TGeoConeSegEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +{ + // Connect to the picked volume. + if (obj == 0 || (obj->IsA()!=TGeoConeSeg::Class())) { + SetActive(kFALSE); + return; + } + fModel = obj; + fPad = pad; + fShape = (TGeoCone*)fModel; + fRmini1 = fShape->GetRmin1(); + fRmaxi1 = fShape->GetRmax1(); + fRmini2 = fShape->GetRmin2(); + fRmaxi2 = fShape->GetRmax2(); + fDzi = fShape->GetDz(); + fNamei = fShape->GetName(); + fPmini = ((TGeoConeSeg*)fShape)->GetPhi1(); + fPmaxi = ((TGeoConeSeg*)fShape)->GetPhi2(); + fShapeName->SetText(fShape->GetName()); + fEPhi1->SetNumber(fPmini); + fEPhi2->SetNumber(fPmaxi); + fSPhi->SetPosition(fPmini,fPmaxi); + fERmin1->SetNumber(fRmini1); + fERmax1->SetNumber(fRmaxi1); + fERmin2->SetNumber(fRmini2); + fERmax2->SetNumber(fRmaxi2); + fEDz->SetNumber(fDzi); + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); + + if (fInit) ConnectSignals2Slots(); + SetActive(); +} + +//______________________________________________________________________________ +void TGeoConeSegEditor::DoPhi1() +{ + Double_t phi1 = fEPhi1->GetNumber(); + Double_t phi2 = fEPhi2->GetNumber(); + if (phi1 > 360-1.e-10) { + phi1 = 0.; + fEPhi1->SetNumber(phi1); + } + if (phi2<phi1+1.e-10) { + phi1 = phi2 - 0.1; + fEPhi1->SetNumber(phi1); + } + if (!fLock) { + DoModified(); + fLock = kTRUE; + fSPhi->SetPosition(phi1,phi2); + } else fLock = kFALSE; +} + +//______________________________________________________________________________ +void TGeoConeSegEditor::DoPhi2() +{ + Double_t phi1 = fEPhi1->GetNumber(); + Double_t phi2 = fEPhi2->GetNumber(); + if (phi2-phi1 > 360.) { + phi2 -= 360.; + fEPhi2->SetNumber(phi2); + } + if (phi2<phi1+1.e-10) { + phi2 = phi1 + 0.1; + fEPhi2->SetNumber(phi2); + } + if (!fLock) { + DoModified(); + fLock = kTRUE; + fSPhi->SetPosition(phi1,phi2); + } else fLock = kFALSE; +} + +//______________________________________________________________________________ +void TGeoConeSegEditor::DoPhi() +{ + if (!fLock) { + DoModified(); + fLock = kTRUE; + fEPhi1->SetNumber(fSPhi->GetMinPosition()); + fLock = kTRUE; + fEPhi2->SetNumber(fSPhi->GetMaxPosition()); + } else fLock = kFALSE; +} + +//______________________________________________________________________________ +void TGeoConeSegEditor::DoApply() +{ + const char *name = fShapeName->GetText(); + if (strcmp(name,fShape->GetName())) { + fShape->SetName(name); + Int_t id = gGeoManager->GetListOfShapes()->IndexOf(fShape); + fTabMgr->UpdateShape(id); + } + Double_t rmin1 = fERmin1->GetNumber(); + Double_t rmax1 = fERmax1->GetNumber(); + Double_t rmin2 = fERmin2->GetNumber(); + Double_t rmax2 = fERmax2->GetNumber(); + Double_t dz = fEDz->GetNumber(); + Double_t phi1 = fEPhi1->GetNumber(); + Double_t phi2 = fEPhi2->GetNumber(); + if ((phi2-phi1) > 360.) { + phi1 = 0.; + phi2 = 360.; + fEPhi1->SetNumber(phi1); + fEPhi2->SetNumber(phi2); + fLock = kTRUE; + fSPhi->SetPosition(phi1,phi2); + fLock = kFALSE; + } + ((TGeoConeSeg*)fShape)->SetConsDimensions(dz, rmin1, rmax1, rmin2,rmax2, phi1, phi2); + fShape->ComputeBBox(); + fUndo->SetEnabled(); + fCancel->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); + if (fPad) { + if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) { + fShape->Draw(); + fPad->GetView()->ShowAxis(); + } else { + fPad->Modified(); + fPad->Update(); + } + } +} + +//______________________________________________________________________________ +void TGeoConeSegEditor::DoUndo() +{ + DoCancel(); + DoApply(); + fCancel->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoConeSegEditor::DoCancel() +{ + fEPhi1->SetNumber(fPmini); + fEPhi2->SetNumber(fPmaxi); + fSPhi->SetPosition(fPmini,fPmaxi); + TGeoConeEditor::DoCancel(); +} + + + diff --git a/geombuilder/src/TGeoManagerEditor.cxx b/geombuilder/src/TGeoManagerEditor.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f1c7876be9ecc7ea33056326af8f9ce1f725a88c --- /dev/null +++ b/geombuilder/src/TGeoManagerEditor.cxx @@ -0,0 +1,1214 @@ +// @(#):$Name: $:$Id: 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. * + *************************************************************************/ + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoManagerEditor // +// +////////////////////////////////////////////////////////////////////////// + +#include "TVirtualPad.h" +#include "TBaseClass.h" +#include "TGTab.h" +#include "TG3DLine.h" +#include "TGComboBox.h" +#include "TGButton.h" +#include "TGButtonGroup.h" +#include "TGTextEntry.h" +#include "TGNumberEntry.h" +#include "TGLabel.h" +#include "TGShutter.h" + +#include "TGeoVolumeEditor.h" +#include "TGeoNodeEditor.h" +#include "TGeoTabManager.h" +#include "TGeoVolume.h" +#include "TGeoManager.h" +#include "TGeoBBox.h" +#include "TGeoTube.h" +#include "TGeoTrd1.h" +#include "TGeoTrd2.h" +#include "TGeoCone.h" +#include "TGeoSphere.h" +#include "TGeoElement.h" +#include "TGeoMaterial.h" +#include "TView.h" + +#include "TGeoManagerEditor.h" + + +ClassImp(TGeoManagerEditor) + +enum ETGeoVolumeWid { + kMANAGER_NAME, kMANAGER_TITLE, + kMANAGER_SHAPE_SELECT, kMANAGER_MEDIA_SELECT,kMANAGER_MATERIAL_SELECT, kMANAGER_ELEMENT_SELECT, + kMANAGER_SHAPE_SELECT2, kMANAGER_MEDIUM_SELECT2, kMANAGER_VOLUME_SELECT, + kMANAGER_EDIT_SHAPE, kMANAGER_EDIT_MEDIUM, kMANAGER_DENSITY_SELECT, kMANAGER_NELEM_SELECT, + kMANAGER_MATERIAL_SELECT2, kMANAGER_MEDIUM_SELECT, kMANAGER_MATRIX_SELECT, kMANAGER_TOP_SELECT, + kEXPORT_ROOT, kEXPORT_C, kEXPORT_GEOMETRY, + kCAT_GENERAL, kCAT_SHAPES, kCAT_VOLUMES, kCAT_MEDIA, kCAT_MATERIALS, kCAT_MATRICES, + kCREATE_BOX, kCREATE_PARA, kCREATE_TRD1, kCREATE_TRD2, + kCREATE_TRAP, kCREATE_GTRA, kCREATE_XTRU, kCREATE_ARB8, + kCREATE_TUBE, kCREATE_TUBS, kCREATE_CONE, kCREATE_CONS, + kCREATE_SPHE, kCREATE_CTUB, kCREATE_ELTU, kCREATE_TORUS, + kCREATE_PCON, kCREATE_PGON, kCREATE_HYPE, kCREATE_PARAB, kCREATE_COMP, + kCREATE_MATERIAL, kCREATE_MIXTURE, kCREATE_MEDIUM, kCREATE_VOLUME, kCREATE_ASSEMBLY, + kCREATE_TRANSLATION, kCREATE_ROTATION, kCREATE_COMBI, + kMEDIUM_NAME, kMEDIUM_ID, kMATRIX_NAME, kMATERIAL_NAME, kVOLUME_NAME, + kMANAGER_APPLY, kMANAGER_CANCEL, kMANAGER_UNDO +}; + +//______________________________________________________________________________ +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 + fGeometry = gGeoManager; + fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); + + fIsModified = kFALSE; + TGCompositeFrame *f1; + TGLabel *label; + + // TGShutter for categories + fCategories = new TGShutter(this, kSunkenFrame | kFixedHeight); + + TGCompositeFrame *container; + Pixel_t color; + // General settings + TGShutterItem *si = new TGShutterItem(fCategories, new TGHotString("General"),kCAT_GENERAL); + container = (TGCompositeFrame*)si->GetContainer(); + container->SetBackgroundColor(GetDefaultFrameBackground()); + // TextEntry for manager name + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Name/Title"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); + gClient->GetColorByName("#ff0000", color); + label->SetTextColor(color); + container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0)); + fManagerName = new TGTextEntry(container, new TGTextBuffer(50), kMANAGER_NAME); + fManagerName->Resize(135, fManagerName->GetDefaultHeight()); + fManagerName->SetToolTipText("Enter the geometry name"); + container->AddFrame(fManagerName, new TGLayoutHints(kLHintsLeft, 3, 1, 0, 0)); + fManagerTitle = new TGTextEntry(container, new TGTextBuffer(50), kMANAGER_TITLE); + fManagerTitle->Resize(135, fManagerTitle->GetDefaultHeight()); + fManagerTitle->SetToolTipText("Enter the geometry name"); + container->AddFrame(fManagerTitle, new TGLayoutHints(kLHintsLeft, 3, 1, 0, 0)); + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Export geometry"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); + gClient->GetColorByName("#ff0000", color); + label->SetTextColor(color); + container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 6, 0)); + TString stitle = "Options"; + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth); + TGButtonGroup *bg = new TGVButtonGroup(f1, stitle); + fExportOption[0] = new TGRadioButton(bg, ".root", kEXPORT_ROOT); + fExportOption[1] = new TGRadioButton(bg, ".C", kEXPORT_C); + fExportButton = new TGTextButton(f1, "Export", kEXPORT_GEOMETRY); + bg->Insert(fExportOption[0], kEXPORT_ROOT); + bg->Insert(fExportOption[1], kEXPORT_C); + bg->SetRadioButtonExclusive(); + bg->SetButton(kEXPORT_ROOT); + f1->AddFrame(bg, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(fExportButton, new TGLayoutHints(kLHintsLeft, 20, 2, 22, 0)); + container->AddFrame(f1, new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 2, 2)); + // Close geometry + f7 = new TGCompositeFrame(container, 155, 10, kVerticalFrame | kFixedWidth); + f1 = new TGCompositeFrame(f7, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Close geometry"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); + gClient->GetColorByName("#ff0000", color); + label->SetTextColor(color); + f7->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0)); + f1 = new TGCompositeFrame(f7, 155, 30, kHorizontalFrame | kFixedWidth); + fLSelTop = new TGLabel(f1, "Select top"); + gClient->GetColorByName("#0000ff", color); + fLSelTop->SetTextColor(color); + fLSelTop->ChangeOptions(kSunkenFrame | kDoubleBorder); + f1->AddFrame(fLSelTop, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2)); + fBSelTop = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kMANAGER_TOP_SELECT); + fBSelTop->SetToolTipText("Select the top volume"); + fBSelTop->Associate(this); + f1->AddFrame(fBSelTop, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2)); + fCloseGeometry = new TGTextButton(f1, "Close"); + f1->AddFrame(fCloseGeometry, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2)); + fCloseGeometry->SetToolTipText("Close geometry to make it ready for tracking"); + fCloseGeometry->Associate(this); + f7->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0)); + container->AddFrame(f7, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0)); + + fCategories->AddItem(si); + + si = new TGShutterItem(fCategories, new TGHotString("Shapes"),kCAT_SHAPES); + container = (TGCompositeFrame*)si->GetContainer(); + container->SetBackgroundColor(GetDefaultFrameBackground()); + fCategories->AddItem(si); + + // Shape creators + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Create new shape"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); + gClient->GetColorByName("#ff0000", color); + label->SetTextColor(color); + container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0)); + TGLayoutHints *lhb = new TGLayoutHints(kLHintsLeft, 0, 4, 0, 0); + TGLayoutHints *lhf1 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 2, 2); + Int_t ipict; + f1 = new TGCompositeFrame(container, 118, 30, kHorizontalFrame); + fShapeButton[0] = new TGPictureButton(f1, fClient->GetPicture("geobbox_t.xpm"), kCREATE_BOX); + fShapeButton[0]->SetToolTipText("Create a box"); + fShapeButton[1] = new TGPictureButton(f1, fClient->GetPicture("geopara_t.xpm"), kCREATE_PARA); + fShapeButton[1]->SetToolTipText("Create a parallelipiped"); + fShapeButton[2] = new TGPictureButton(f1, fClient->GetPicture("geotrd1_t.xpm"), kCREATE_TRD1); + fShapeButton[2]->SetToolTipText("Create a TRD1 trapezoid"); + fShapeButton[3] = new TGPictureButton(f1, fClient->GetPicture("geotrd2_t.xpm"), kCREATE_TRD2); + fShapeButton[3]->SetToolTipText("Create a TRD2 trapezoid"); + fShapeButton[4] = new TGPictureButton(f1, fClient->GetPicture("geotrap_t.xpm"), kCREATE_TRAP); + fShapeButton[4]->SetToolTipText("Create a general trapezoid"); + fShapeButton[5] = new TGPictureButton(f1, fClient->GetPicture("geogtra_t.xpm"), kCREATE_GTRA); + fShapeButton[5]->SetToolTipText("Create a general twisted trapezoid"); + for (ipict=0; ipict<6; ipict++) f1->AddFrame(fShapeButton[ipict],lhb); + container->AddFrame(f1, lhf1); + f1 = new TGCompositeFrame(container, 118, 30, kHorizontalFrame); + fShapeButton[6] = new TGPictureButton(f1, fClient->GetPicture("geoxtru_t.xpm"), kCREATE_XTRU); + fShapeButton[6]->SetToolTipText("Create a extruded polygone"); + fShapeButton[7] = new TGPictureButton(f1, fClient->GetPicture("geoarb8_t.xpm"), kCREATE_ARB8); + fShapeButton[7]->SetToolTipText("Create an arbitrary trapezoid with 8 vertices"); + fShapeButton[8] = new TGPictureButton(f1, fClient->GetPicture("geotube_t.xpm"), kCREATE_TUBE); + fShapeButton[8]->SetToolTipText("Create a cylindrical pipe"); + fShapeButton[9] = new TGPictureButton(f1, fClient->GetPicture("geotubeseg_t.xpm"), kCREATE_TUBS); + fShapeButton[9]->SetToolTipText("Create a cylindrical pipe within a phi range"); + fShapeButton[10] = new TGPictureButton(f1, fClient->GetPicture("geocone_t.xpm"), kCREATE_CONE); + fShapeButton[10]->SetToolTipText("Create a conical pipe"); + fShapeButton[11] = new TGPictureButton(f1, fClient->GetPicture("geoconeseg_t.xpm"), kCREATE_CONS); + fShapeButton[11]->SetToolTipText("Create a conical pipe within a phi range"); + for (ipict=0; ipict<6; ipict++) f1->AddFrame(fShapeButton[ipict+6],lhb); + container->AddFrame(f1, lhf1); + f1 = new TGCompositeFrame(container, 118, 30, kHorizontalFrame); + fShapeButton[12] = new TGPictureButton(f1, fClient->GetPicture("geosphere_t.xpm"), kCREATE_SPHE); + fShapeButton[12]->SetToolTipText("Create a spherical sector"); + fShapeButton[13] = new TGPictureButton(f1, fClient->GetPicture("geoctub_t.xpm"), kCREATE_CTUB); + fShapeButton[13]->SetToolTipText("Create a cut tube"); + fShapeButton[14] = new TGPictureButton(f1, fClient->GetPicture("geoeltu_t.xpm"), kCREATE_ELTU); + fShapeButton[14]->SetToolTipText("Create an eliptical tube"); + fShapeButton[15] = new TGPictureButton(f1, fClient->GetPicture("geotorus_t.xpm"), kCREATE_TORUS); + fShapeButton[15]->SetToolTipText("Create a toroidal tube with a phi range"); + fShapeButton[16] = new TGPictureButton(f1, fClient->GetPicture("geopcon_t.xpm"), kCREATE_PCON); + fShapeButton[16]->SetToolTipText("Create a polycone shape"); + fShapeButton[17] = new TGPictureButton(f1, fClient->GetPicture("geopgon_t.xpm"), kCREATE_PGON); + fShapeButton[17]->SetToolTipText("Create a polygon shape"); + for (ipict=0; ipict<6; ipict++) f1->AddFrame(fShapeButton[ipict+12],lhb); + container->AddFrame(f1, lhf1); + f1 = new TGCompositeFrame(container, 118, 30, kHorizontalFrame); + fShapeButton[18] = new TGPictureButton(f1, fClient->GetPicture("geohype_t.xpm"), kCREATE_HYPE); + fShapeButton[18]->SetToolTipText("Create a hyperboloid"); + fShapeButton[19] = new TGPictureButton(f1, fClient->GetPicture("geoparab_t.xpm"), kCREATE_PARAB); + fShapeButton[19]->SetToolTipText("Create a paraboloid"); + fShapeButton[20] = new TGPictureButton(f1, fClient->GetPicture("geocomposite_t.xpm"), kCREATE_COMP); + fShapeButton[20]->SetToolTipText("Create a composite shape"); + for (ipict=0; ipict<3; ipict++) f1->AddFrame(fShapeButton[ipict+18],lhb); + container->AddFrame(f1, lhf1); + + // List of shapes + f2 = new TGCompositeFrame(container, 155, 10, kVerticalFrame | kFixedWidth); + f1 = new TGCompositeFrame(f2, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Existing shapes"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); + gClient->GetColorByName("#ff0000", color); + label->SetTextColor(color); + f2->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0)); + f1 = new TGCompositeFrame(f2, 155, 30, kHorizontalFrame | kFixedWidth); + fSelectedShape = 0; + fLSelShape = new TGLabel(f1, "Select shape"); + gClient->GetColorByName("#0000ff", color); + fLSelShape->SetTextColor(color); + fLSelShape->ChangeOptions(kSunkenFrame | kDoubleBorder); + f1->AddFrame(fLSelShape, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2)); + fBSelShape = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kMANAGER_SHAPE_SELECT); + fBSelShape->SetToolTipText("Select one of the existing shapes"); + fBSelShape->Associate(this); + f1->AddFrame(fBSelShape, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2)); + fEditShape = new TGTextButton(f1, "Edit"); + f1->AddFrame(fEditShape, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2)); + fEditShape->SetToolTipText("Edit selected shape"); + fEditShape->Associate(this); + f2->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0)); + container->AddFrame(f2, new TGLayoutHints(kLHintsLeft, 0, 0, 6, 0)); + + // Volumes category + si = new TGShutterItem(fCategories, new TGHotString("Volumes"),kCAT_VOLUMES); + container = (TGCompositeFrame*)si->GetContainer(); + container->SetBackgroundColor(GetDefaultFrameBackground()); + fCategories->AddItem(si); + + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Create new volume"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); + gClient->GetColorByName("#ff0000", color); + label->SetTextColor(color); + container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0)); + + f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth); + f1->AddFrame(new TGLabel(f1, "Name"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fVolumeName = new TGTextEntry(f1, new TGTextBuffer(50), kVOLUME_NAME); + fVolumeName->Resize(100, fVolumeName->GetDefaultHeight()); + fVolumeName->SetToolTipText("Enter the name for the new volume"); + f1->AddFrame(fVolumeName, new TGLayoutHints(kLHintsRight, 3, 1, 2, 5)); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0)); + + // ComboBox for shape component + f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth); + fSelectedShape2 = 0; + fLSelShape2 = new TGLabel(f1, "Select shape"); + gClient->GetColorByName("#0000ff", color); + fLSelShape2->SetTextColor(color); + fLSelShape2->ChangeOptions(kSunkenFrame | kDoubleBorder); + f1->AddFrame(fLSelShape2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2)); + fBSelShape2 = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kMANAGER_SHAPE_SELECT2); + fBSelShape2->SetToolTipText("Select one of the existing shapes"); + fBSelShape2->Associate(this); + f1->AddFrame(fBSelShape2, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1)); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0)); + + // ComboBox for medium component + f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth); + fSelectedMedium2 = 0; + fLSelMedium2 = new TGLabel(f1, "Select medium"); + gClient->GetColorByName("#0000ff", color); + fLSelMedium2->SetTextColor(color); + fLSelMedium2->ChangeOptions(kSunkenFrame | kDoubleBorder); + f1->AddFrame(fLSelMedium2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2)); + fBSelMedium2 = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kMANAGER_MEDIUM_SELECT2); + fBSelMedium2->SetToolTipText("Select one of the existing media"); + fBSelMedium2->Associate(this); + f1->AddFrame(fBSelMedium2, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1)); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0)); + // Picture buttons for different volumes + f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth); + f1->AddFrame(new TGLabel(f1, "Create..."), new TGLayoutHints(kLHintsLeft, 1, 5, 6, 0)); + fVolumeButton[0] = new TGPictureButton(f1, fClient->GetPicture("geovolume_t.xpm"), kCREATE_VOLUME); + fVolumeButton[0]->SetToolTipText("Create a new volume from shape and medium"); + fVolumeButton[1] = new TGPictureButton(f1, fClient->GetPicture("geoassembly_t.xpm"), kCREATE_ASSEMBLY); + fVolumeButton[1]->SetToolTipText("Create a new volume assemby having the selected name"); + for (ipict=0; ipict<2; ipict++) f1->AddFrame(fVolumeButton[ipict],lhb); + container->AddFrame(f1, lhf1); + // List of volumes + f3 = new TGCompositeFrame(container, 155, 10, kVerticalFrame | kFixedWidth); + f1 = new TGCompositeFrame(f3, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Existing volumes"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); + gClient->GetColorByName("#ff0000", color); + label->SetTextColor(color); + f3->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0)); + f1 = new TGCompositeFrame(f3, 155, 30, kHorizontalFrame | kFixedWidth); + fSelectedVolume = 0; + fLSelVolume = new TGLabel(f1, "Select volume"); + gClient->GetColorByName("#0000ff", color); + fLSelVolume->SetTextColor(color); + fLSelVolume->ChangeOptions(kSunkenFrame | kDoubleBorder); + f1->AddFrame(fLSelVolume, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2)); + fBSelVolume = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kMANAGER_VOLUME_SELECT); + fBSelVolume->SetToolTipText("Select one of the existing volumes"); + fBSelVolume->Associate(this); + f1->AddFrame(fBSelVolume, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2)); + f3->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0)); + f1 = new TGCompositeFrame(f3, 155, 30, kHorizontalFrame | kFixedWidth); + fEditVolume = new TGTextButton(f1, " Edit "); + f1->AddFrame(fEditVolume, new TGLayoutHints(kLHintsLeft, 20, 1, 2, 2)); + fEditVolume->SetToolTipText("Edit selected volume"); + fEditVolume->Associate(this); + fSetTopVolume = new TGTextButton(f1, "Set top"); + f1->AddFrame(fSetTopVolume, new TGLayoutHints(kLHintsRight, 1, 20, 2, 2)); + fSetTopVolume->SetToolTipText("Set top volume for geometry"); + fSetTopVolume->Associate(this); + f3->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0)); + container->AddFrame(f3, new TGLayoutHints(kLHintsLeft, 0, 0, 6, 0)); + + // Materials category + si = new TGShutterItem(fCategories, new TGHotString("Materials"),kCAT_MATERIALS); + container = (TGCompositeFrame*)si->GetContainer(); + container->SetBackgroundColor(GetDefaultFrameBackground()); + fCategories->AddItem(si); + + // Material creators + gGeoManager->BuildDefaultMaterials(); + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Create material/mixt."), new TGLayoutHints(kLHintsLeft, 2, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); + gClient->GetColorByName("#ff0000", color); + label->SetTextColor(color); + container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0)); + f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth); + f1->AddFrame(new TGLabel(f1, "Name"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fMaterialName = new TGTextEntry(f1, new TGTextBuffer(50), kMATERIAL_NAME); + fMaterialName->Resize(100, fMaterialName->GetDefaultHeight()); + fMaterialName->SetToolTipText("Enter the new material name"); + f1->AddFrame(fMaterialName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5)); + container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0)); + + f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth); + f1->AddFrame(new TGLabel(f1, "Element"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fElementList = new TGComboBox(f1, kMANAGER_ELEMENT_SELECT); + fElementList->Resize(100, fManagerName->GetDefaultHeight()); + TGeoElementTable *table = gGeoManager->GetElementTable(); + if (table) { + TGeoElement *element; + for (Int_t i=0; i<table->GetNelements(); i++) { + element = table->GetElement(i); + fElementList->AddEntry(element->GetTitle(),i); + } + } + fElementList->Select(0); + f1->AddFrame(fElementList, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4)); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2)); + // Number entry for density + f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth); + f1->AddFrame(new TGLabel(f1, "Density"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fEntryDensity = new TGNumberEntry(f1, 0., 5, kMANAGER_DENSITY_SELECT); + fEntryDensity->SetNumStyle(TGNumberFormat::kNESReal); + fEntryDensity->SetNumAttr(TGNumberFormat::kNEANonNegative); + fEntryDensity->Resize(100,fEntryDensity->GetDefaultHeight()); + TGTextEntry *nef = (TGTextEntry*)fEntryDensity->GetNumberEntry(); + nef->SetToolTipText("Enter material/mixture density"); + fEntryDensity->SetNumber(0); + fEntryDensity->Associate(this); + f1->AddFrame(fEntryDensity, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2)); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2)); + // Buttons for creating materials/mixtures + // Picture buttons for different volumes + f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth); + f1->AddFrame(new TGLabel(f1, "Create..."), new TGLayoutHints(kLHintsLeft, 1, 5, 6, 0)); + fMaterialButton[0] = new TGPictureButton(f1, fClient->GetPicture("geomaterial_t.xpm"), kCREATE_MATERIAL); + fMaterialButton[0]->SetToolTipText("Create a new material from element and density"); + fMaterialButton[1] = new TGPictureButton(f1, fClient->GetPicture("geomixture_t.xpm"), kCREATE_MIXTURE); + fMaterialButton[1]->SetToolTipText("Create a new mixture with selected density"); + for (ipict=0; ipict<2; ipict++) f1->AddFrame(fMaterialButton[ipict],lhb); + container->AddFrame(f1, lhf1); + + // List of materials + f4 = new TGCompositeFrame(container, 155, 10, kVerticalFrame | kFixedWidth); + f1 = new TGCompositeFrame(f4, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Existing materials"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); + gClient->GetColorByName("#ff0000", color); + label->SetTextColor(color); + f4->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0)); + f1 = new TGCompositeFrame(f4, 155, 30, kHorizontalFrame | kFixedWidth); + fSelectedMaterial = 0; + fLSelMaterial = new TGLabel(f1, "Select material"); + gClient->GetColorByName("#0000ff", color); + fLSelMaterial->SetTextColor(color); + fLSelMaterial->ChangeOptions(kSunkenFrame | kDoubleBorder); + f1->AddFrame(fLSelMaterial, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2)); + fBSelMaterial = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kMANAGER_MATERIAL_SELECT); + fBSelMaterial->SetToolTipText("Select one of the existing materials"); + fBSelMaterial->Associate(this); + f1->AddFrame(fBSelMaterial, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2)); + fEditMaterial = new TGTextButton(f1, "Edit"); + f1->AddFrame(fEditMaterial, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2)); + fEditMaterial->SetToolTipText("Edit selected material"); + fEditMaterial->Associate(this); + f4->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0)); + container->AddFrame(f4, new TGLayoutHints(kLHintsLeft, 0, 0, 6, 0)); + + si = new TGShutterItem(fCategories, new TGHotString("Media"),kCAT_MEDIA); + container = (TGCompositeFrame*)si->GetContainer(); + container->SetBackgroundColor(GetDefaultFrameBackground()); + fCategories->AddItem(si); + + // Media category + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Create new medium"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); + gClient->GetColorByName("#ff0000", color); + label->SetTextColor(color); + container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0)); + + f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth); + f1->AddFrame(new TGLabel(f1, "Name"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fMediumName = new TGTextEntry(f1, new TGTextBuffer(50), kMEDIUM_NAME); + fMediumName->Resize(60, fMediumName->GetDefaultHeight()); + fMediumName->SetToolTipText("Enter the new medium name"); + f1->AddFrame(fMediumName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5)); + + fMediumId = new TGNumberEntry(f1, 0., 5, kMEDIUM_ID); + fMediumId->SetNumStyle(TGNumberFormat::kNESInteger); + fMediumId->SetNumAttr(TGNumberFormat::kNEAPositive); + fMediumId->Resize(35,fMediumId->GetDefaultHeight()); + nef = (TGTextEntry*)fMediumId->GetNumberEntry(); + nef->SetToolTipText("Enter medium ID"); + fMediumId->SetNumber(fGeometry->GetListOfMedia()->GetSize()); + fMediumId->Associate(this); + f1->AddFrame(fMediumId, new TGLayoutHints(kLHintsRight, 2, 2, 2 ,2)); + f1->AddFrame(new TGLabel(f1, "ID"), new TGLayoutHints(kLHintsRight, 1, 1, 6, 0)); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 0)); + // ComboBox for materials + f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth); + fSelectedMaterial2 = 0; + fLSelMaterial2 = new TGLabel(f1, "Select material"); + gClient->GetColorByName("#0000ff", color); + fLSelMaterial2->SetTextColor(color); + fLSelMaterial2->ChangeOptions(kSunkenFrame | kDoubleBorder); + f1->AddFrame(fLSelMaterial2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2)); + fBSelMaterial2 = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kMANAGER_MATERIAL_SELECT2); + fBSelMaterial2->SetToolTipText("Select one of the existing materials"); + fBSelMaterial2->Associate(this); + f1->AddFrame(fBSelMaterial2, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2)); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0)); + f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth); + f1->AddFrame(new TGLabel(f1, "Create..."), new TGLayoutHints(kLHintsLeft, 1, 5, 6, 0)); + fMediumButton = new TGPictureButton(f1, fClient->GetPicture("geomedium_t.xpm"), kCREATE_MEDIUM); + fMediumButton->SetToolTipText("Create a new medium from selected material"); + fMediumButton->Associate(this); + f1->AddFrame(fMediumButton, new TGLayoutHints(kLHintsLeft, 5, 2, 2, 2)); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2)); + + // List of media + f5 = new TGCompositeFrame(container, 155, 10, kVerticalFrame | kFixedWidth); + f1 = new TGCompositeFrame(f5, 145, 10, kHorizontalFrame | kLHintsExpandX | kFixedWidth | kOwnBackground); + f1->AddFrame(label = new TGLabel(f1, "Existing media"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); + gClient->GetColorByName("#ff0000", color); + label->SetTextColor(color); + f5->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0)); + f1 = new TGCompositeFrame(f5, 155, 30, kHorizontalFrame | kFixedWidth); + fSelectedMedium = 0; + fLSelMedium = new TGLabel(f1, "Select medium"); + gClient->GetColorByName("#0000ff", color); + fLSelMedium->SetTextColor(color); + fLSelMedium->ChangeOptions(kSunkenFrame | kDoubleBorder); + f1->AddFrame(fLSelMedium, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2)); + fBSelMedium = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kMANAGER_MEDIA_SELECT); + fBSelMedium->SetToolTipText("Select one of the existing media"); + fBSelMedium->Associate(this); + f1->AddFrame(fBSelMedium, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2)); + fEditMedium = new TGTextButton(f1, "Edit"); + f1->AddFrame(fEditMedium, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2)); + fEditMedium->SetToolTipText("Edit selected medium"); + fEditMedium->Associate(this); + f5->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0)); + container->AddFrame(f5, new TGLayoutHints(kLHintsLeft, 0, 0, 6, 0)); + + // Matrix category + si = new TGShutterItem(fCategories, new TGHotString("Matrices"),kCAT_MATRICES); + container = (TGCompositeFrame*)si->GetContainer(); + container->SetBackgroundColor(GetDefaultFrameBackground()); + fCategories->AddItem(si); + // Name entry + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Create new matrix"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); + gClient->GetColorByName("#ff0000", color); + label->SetTextColor(color); + container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0)); + + f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth); + f1->AddFrame(new TGLabel(f1, "Name"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fMatrixName = new TGTextEntry(f1, new TGTextBuffer(50), kMATRIX_NAME); + fMatrixName->Resize(100, fMatrixName->GetDefaultHeight()); + fMatrixName->SetToolTipText("Enter the new matrix name"); + f1->AddFrame(fMatrixName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5)); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 0)); + // Picture buttons for different matrices + f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth); + f1->AddFrame(new TGLabel(f1, "Create..."), new TGLayoutHints(kLHintsLeft, 1, 5, 6, 0)); + fMatrixButton[0] = new TGPictureButton(f1, fClient->GetPicture("geotranslation_t.xpm"), kCREATE_TRANSLATION); + fMatrixButton[0]->SetToolTipText("Create a translation"); + fMatrixButton[1] = new TGPictureButton(f1, fClient->GetPicture("georotation_t.xpm"), kCREATE_ROTATION); + fMatrixButton[1]->SetToolTipText("Create a rotation"); + fMatrixButton[2] = new TGPictureButton(f1, fClient->GetPicture("geocombi_t.xpm"), kCREATE_COMBI); + fMatrixButton[2]->SetToolTipText("Create a rotation + translation"); + for (ipict=0; ipict<3; ipict++) f1->AddFrame(fMatrixButton[ipict],lhb); + container->AddFrame(f1, lhf1); + // List of matrices + f6 = new TGCompositeFrame(container, 155, 10, kVerticalFrame | kFixedWidth); + f1 = new TGCompositeFrame(f6, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Existing matrices"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); + gClient->GetColorByName("#ff0000", color); + label->SetTextColor(color); + f6->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0)); + f1 = new TGCompositeFrame(f6, 155, 30, kHorizontalFrame | kFixedWidth); + fSelectedMatrix = 0; + fLSelMatrix = new TGLabel(f1, "Select matrix"); + gClient->GetColorByName("#0000ff", color); + fLSelMatrix->SetTextColor(color); + fLSelMatrix->ChangeOptions(kSunkenFrame | kDoubleBorder); + f1->AddFrame(fLSelMatrix, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2)); + fBSelMatrix = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kMANAGER_MATRIX_SELECT); + fBSelMatrix->SetToolTipText("Select one of the existing matrices"); + fBSelMatrix->Associate(this); + f1->AddFrame(fBSelMatrix, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2)); + fEditMatrix = new TGTextButton(f1, "Edit"); + f1->AddFrame(fEditMatrix, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2)); + fEditMatrix->SetToolTipText("Edit selected matrix"); + fEditMatrix->Associate(this); + f6->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0)); + container->AddFrame(f6, new TGLayoutHints(kLHintsLeft, 0, 0, 6, 0)); + + fCategories->Resize(163,370); + AddFrame(fCategories, new TGLayoutHints(kLHintsLeft, 0, 0, 4, 4)); + // Initialize layout + MapSubwindows(); + Layout(); + MapWindow(); + + TClass *cl = TGeoVolume::Class(); + TGedElement *ge = new TGedElement; + ge->fGedFrame = this; + ge->fCanvas = 0; + cl->GetEditorList()->Add(ge); +} + +//______________________________________________________________________________ +TGeoManagerEditor::~TGeoManagerEditor() +{ +// Destructor + TGFrameElement *el; + TIter next(GetList()); + while ((el = (TGFrameElement *)next())) { + if (!strcmp(el->fFrame->ClassName(), "TGCompositeFrame")) + ((TGCompositeFrame *)el->fFrame)->Cleanup(); + } + Cleanup(); + TClass *cl = TGeoVolume::Class(); + TIter next1(cl->GetEditorList()); + TGedElement *ge; + while ((ge=(TGedElement*)next1())) { + if (ge->fGedFrame==this) { + cl->GetEditorList()->Remove(ge); + delete ge; + next1.Reset(); + } + } +} + +//______________________________________________________________________________ +void TGeoManagerEditor::ConnectSignals2Slots() +{ + // Connect signals to slots. + fManagerName->Connect("TextChanged(const char *)", "TGeoManagerEditor", this, "DoName()"); + fManagerTitle->Connect("TextChanged(const char *)", "TGeoManagerEditor", this, "DoName()"); + fExportButton->Connect("Clicked()", "TGeoManagerEditor", this, "DoExportGeometry()"); + fCloseGeometry->Connect("Clicked()", "TGeoManagerEditor", this, "DoCloseGeometry()"); + fShapeButton[0]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateBox()"); + fShapeButton[1]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreatePara()"); + fShapeButton[2]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateTrd1()"); + fShapeButton[3]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateTrd2()"); + fShapeButton[4]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateTrap()"); + fShapeButton[5]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateGtra()"); + fShapeButton[6]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateXtru()"); + fShapeButton[7]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateArb8()"); + fShapeButton[8]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateTube()"); + fShapeButton[9]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateTubs()"); + fShapeButton[10]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateCone()"); + fShapeButton[11]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateCons()"); + fShapeButton[12]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateSphe()"); + fShapeButton[13]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateCtub()"); + fShapeButton[14]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateEltu()"); + fShapeButton[15]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateTorus()"); + fShapeButton[16]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreatePcon()"); + fShapeButton[17]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreatePgon()"); + fShapeButton[18]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateHype()"); + fShapeButton[19]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateParab()"); + fShapeButton[20]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateComposite()"); + fMatrixButton[0]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateTranslation()"); + fMatrixButton[1]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateRotation()"); + fMatrixButton[2]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateCombi()"); + fVolumeButton[0]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateVolume()"); + fVolumeButton[1]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateAssembly()"); + fBSelTop->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectTopVolume()"); + fBSelVolume->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectVolume()"); + fBSelShape->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectShape()"); + fBSelShape2->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectShape2()"); + fBSelMatrix->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectMatrix()"); + fBSelMaterial->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectMaterial()"); + fBSelMaterial2->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectMaterial2()"); + fBSelMedium->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectMedium()"); + fBSelMedium2->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectMedium2()"); + fSetTopVolume->Connect("Clicked()", "TGeoManagerEditor", this, "DoSetTopVolume()"); + fEditShape->Connect("Clicked()", "TGeoManagerEditor", this, "DoEditShape()"); + fEditMedium->Connect("Clicked()", "TGeoManagerEditor", this, "DoEditMedium()"); + fEditMaterial->Connect("Clicked()", "TGeoManagerEditor", this, "DoEditMaterial()"); + fEditMatrix->Connect("Clicked()", "TGeoManagerEditor", this, "DoEditMatrix()"); + fEditVolume->Connect("Clicked()", "TGeoManagerEditor", this, "DoEditVolume()"); + + fMaterialButton[0]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateMaterial()"); + fMaterialButton[1]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateMixture()"); + fMediumButton->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateMedium()"); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t /*event*/) +{ + // Connect to the picked volume. + if (obj == 0 || !obj->InheritsFrom(TGeoManager::Class())) { + SetActive(kFALSE); + return; + } + fModel = obj; + fPad = pad; + fGeometry = (TGeoManager*)fModel; + fManagerName->SetText(fGeometry->GetName()); + fManagerTitle->SetText(fGeometry->GetTitle()); + fMatrixName->SetText(Form("matrix%i", fGeometry->GetListOfMatrices()->GetEntries())); + fMaterialName->SetText(Form("material%i", fGeometry->GetListOfMaterials()->GetSize())); + fMediumName->SetText(Form("medium%i", fGeometry->GetListOfMedia()->GetSize())); + fVolumeName->SetText(Form("volume%i", fGeometry->GetListOfVolumes()->GetEntries())); + // Check if master volume can be set + if (fGeometry->GetMasterVolume()) fSetTopVolume->SetEnabled(kFALSE); + else fSetTopVolume->SetEnabled(kTRUE); + // Check if geometry is already closed + if (!fGeometry->IsClosed()) fCloseGeometry->SetEnabled(kTRUE); + else { + fCloseGeometry->SetEnabled(kFALSE); + fBSelTop->SetEnabled(kFALSE); + } + // Check if volumes category can be activated + if (!fGeometry->GetListOfShapes()->GetEntries() || !fGeometry->GetListOfMedia()->GetSize()) + fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kFALSE); + else + fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE); + if (!fGeometry->GetListOfShapes()->GetEntries()) ShowSelectShape(kFALSE); + else ShowSelectShape(); + if (!fGeometry->GetListOfVolumes()->GetEntries()) ShowSelectVolume(kFALSE); + else ShowSelectVolume(); + if (!fGeometry->GetListOfMedia()->GetSize()) ShowSelectMedium(kFALSE); + else ShowSelectMedium(); + if (!fGeometry->GetListOfMatrices()->GetEntries()) ShowSelectMatrix(kFALSE); + else ShowSelectMatrix(); + + // Check if media category can be activated + if (!fGeometry->GetListOfMaterials()->GetSize()) { + fCategories->GetItem("Media")->GetButton()->SetEnabled(kFALSE); + ShowSelectMaterial(kFALSE); + } else { + fCategories->GetItem("Media")->GetButton()->SetEnabled(kTRUE); + ShowSelectMaterial(); + } + + fTab->SetTab(0); + fCategories->Layout(); + + if (fInit) ConnectSignals2Slots(); + SetActive(); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoName() +{ +// Change name/title of the geometry + fGeometry->SetName(fManagerName->GetText()); + fGeometry->SetTitle(fManagerTitle->GetText()); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoExportGeometry() +{ +// Export geometry as .root or .C file + Bool_t asroot = fExportOption[0]->IsDown(); + TString s = fGeometry->GetName(); + s = s.Strip(); + s.Remove(20); + const char *name; + if (asroot) name = Form("%s.root", s.Data()); + else name = Form("%s.C", s.Data()); + fGeometry->Export(name); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateBox() +{ +// Create a box. + Int_t id = gGeoManager->GetListOfShapes()->GetEntries(); + fSelectedShape = new TGeoBBox(Form("box_%i",id), 1., 1., 1.); + fTabMgr->AddShape(fSelectedShape->GetName(), id); + ShowSelectShape(); + // Check if volumes category can be activated + if (fGeometry->GetListOfMedia()->GetSize()) + fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE); + DoEditShape(); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreatePara() +{ + +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateTrd1() +{ +// Create a Trd1. + Int_t id = gGeoManager->GetListOfShapes()->GetEntries(); + fSelectedShape = new TGeoTrd1(Form("trd1_%i",id), 0.5, 1., 1., 1.); + fTabMgr->AddShape(fSelectedShape->GetName(), id); + ShowSelectShape(); + if (fGeometry->GetListOfMedia()->GetSize()) + fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE); + DoEditShape(); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateTrd2() +{ +// Create a Trd2. + Int_t id = gGeoManager->GetListOfShapes()->GetEntries(); + fSelectedShape = new TGeoTrd2(Form("trd2_%i",id), 0.5, 1., 0.5, 1., 1.); + fTabMgr->AddShape(fSelectedShape->GetName(), id); + ShowSelectShape(); + if (fGeometry->GetListOfMedia()->GetSize()) + fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE); + DoEditShape(); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateTrap() +{ + +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateGtra() +{ + +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateXtru() +{ + +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateArb8() +{ + +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateTube() +{ +// Create a tube. + Int_t id = gGeoManager->GetListOfShapes()->GetEntries(); + fSelectedShape = new TGeoTube(Form("tube_%i",id), 0.5, 1., 1.); + fTabMgr->AddShape(fSelectedShape->GetName(), id); + ShowSelectShape(); + if (fGeometry->GetListOfMedia()->GetSize()) + fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE); + DoEditShape(); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateTubs() +{ +// Create a tube segment. + Int_t id = gGeoManager->GetListOfShapes()->GetEntries(); + fSelectedShape = new TGeoTubeSeg(Form("tubs_%i",id), 0.5, 1., 1.,0.,45.); + fTabMgr->AddShape(fSelectedShape->GetName(), id); + ShowSelectShape(); + if (fGeometry->GetListOfMedia()->GetSize()) + fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE); + DoEditShape(); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateCone() +{ +// Create a cone. + Int_t id = gGeoManager->GetListOfShapes()->GetEntries(); + fSelectedShape = new TGeoCone(Form("cone_%i",id), 0.5, 0.5, 1., 1.5, 2.); + fTabMgr->AddShape(fSelectedShape->GetName(), id); + ShowSelectShape(); + if (fGeometry->GetListOfMedia()->GetSize()) + fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE); + DoEditShape(); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateCons() +{ +// Create a cone segment. + Int_t id = gGeoManager->GetListOfShapes()->GetEntries(); + fSelectedShape = new TGeoConeSeg(Form("cons_%i",id), 0.5, 0.5, 1., 1.5, 2.,0.,45.); + fTabMgr->AddShape(fSelectedShape->GetName(), id); + ShowSelectShape(); + if (fGeometry->GetListOfMedia()->GetSize()) + fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE); + DoEditShape(); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateSphe() +{ +// 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); + ShowSelectShape(); + if (fGeometry->GetListOfMedia()->GetSize()) + fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE); + DoEditShape(); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateCtub() +{ + +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateEltu() +{ + +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateTorus() +{ + +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreatePcon() +{ + +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreatePgon() +{ + +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateHype() +{ + +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateParab() +{ + +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateComposite() +{ + +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateMaterial() +{ +// Create a new material + TGeoElement *el = fGeometry->GetElementTable()->GetElement(fElementList->GetSelected()); + Double_t density = fEntryDensity->GetNumber(); + const char *name = fMaterialName->GetText(); + fSelectedMaterial = new TGeoMaterial(name, el, density); + ShowSelectMaterial(); + fCategories->GetItem("Media")->GetButton()->SetEnabled(kTRUE); + DoEditMaterial(); + fMaterialName->SetText(Form("material%i", fGeometry->GetListOfMaterials()->GetSize())); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateMixture() +{ +// Create a new mixture + +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateMedium() +{ +// Create a new medium + Int_t id = fMediumId->GetIntNumber(); + if (!fSelectedMaterial2) return; + const char *name = fMediumName->GetText(); + fSelectedMedium = new TGeoMedium(name, id, fSelectedMaterial2); + ShowSelectMedium(); + if (fGeometry->GetListOfShapes()->GetEntries()) + fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE); + DoEditMedium(); + fMediumName->SetText(Form("medium%i", fGeometry->GetListOfMedia()->GetSize())); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateTranslation() +{ +// Create a new translation + const char *name = fMatrixName->GetText(); + fSelectedMatrix = new TGeoTranslation(name, 0., 0., 0.); + fSelectedMatrix->SetBit(TGeoMatrix::kGeoTranslation); + fSelectedMatrix->RegisterYourself(); + ShowSelectMatrix(); + DoEditMatrix(); + fMatrixName->SetText(Form("matrix%i", fGeometry->GetListOfMatrices()->GetEntries())); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateRotation() +{ +// Create a new translation + const char *name = fMatrixName->GetText(); + fSelectedMatrix = new TGeoRotation(name); + fSelectedMatrix->SetBit(TGeoMatrix::kGeoRotation); + fSelectedMatrix->RegisterYourself(); + ShowSelectMatrix(); + DoEditMatrix(); + fMatrixName->SetText(Form("matrix%i", fGeometry->GetListOfMatrices()->GetEntries())); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateVolume() +{ +// Create a new volume + const char *name = fVolumeName->GetText(); + if (!fSelectedShape2 || !fSelectedMedium2) return; + fSelectedVolume = new TGeoVolume(name, fSelectedShape2, fSelectedMedium2); + fLSelVolume->SetText(name); + ShowSelectVolume(); + DoEditVolume(); + fVolumeName->SetText(Form("volume%i", fGeometry->GetListOfVolumes()->GetEntries())); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateAssembly() +{ +// Create a new volume assembly + const char *name = fVolumeName->GetText(); + fSelectedVolume = new TGeoVolumeAssembly(name); + fLSelVolume->SetText(name); + ShowSelectVolume(); + DoEditVolume(); + fVolumeName->SetText(Form("volume%i", fGeometry->GetListOfVolumes()->GetEntries())); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCreateCombi() +{ +// Create a new translation + const char *name = fMatrixName->GetText(); + fSelectedMatrix = new TGeoCombiTrans(name, 0., 0., 0., new TGeoRotation()); + fSelectedMatrix->RegisterYourself(); + fSelectedMatrix->SetBit(TGeoMatrix::kGeoTranslation); + fSelectedMatrix->SetBit(TGeoMatrix::kGeoRotation); + ShowSelectMatrix(); + DoEditMatrix(); + fMatrixName->SetText(Form("matrix%i", fGeometry->GetListOfMatrices()->GetEntries())); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoSetTopVolume() +{ +// Set top volume for the geometry. + if (!fSelectedVolume) return; + fGeometry->SetTopVolume(fSelectedVolume); + fSetTopVolume->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoEditShape() +{ + if (!fSelectedShape) return; + fTabMgr->GetShapeEditor(fSelectedShape); + fSelectedShape->Draw(); + fPad->GetView()->ShowAxis(); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoEditVolume() +{ + if (!fSelectedVolume) { + fTabMgr->SetEnabled(TGeoTabManager::kTabVolume, kFALSE); + return; + } + fTabMgr->SetEnabled(TGeoTabManager::kTabVolume); + fTabMgr->GetVolumeEditor(fSelectedVolume); + fTabMgr->SetTab(TGeoTabManager::kTabVolume); +// fGeometry->SetTopVisible(); +// fGeometry->SetVisLevel(1); +// volume->SetVisContainers(); +// volume->SetVisibility(kTRUE); + fSelectedVolume->Draw(); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoSelectMatrix() +{ + TGeoMatrix *matrix = fSelectedMatrix; + new TGeoMatrixDialog(fBSelMatrix, gClient->GetRoot(), 200,300); + fSelectedMatrix = (TGeoMatrix*)TGeoMatrixDialog::GetSelected(); + if (fSelectedMatrix) fLSelMatrix->SetText(fSelectedMatrix->GetName()); + else fSelectedMatrix = matrix; +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoSelectShape() +{ + TGeoShape *shape = fSelectedShape; + new TGeoShapeDialog(fBSelShape, gClient->GetRoot(), 200,300); + fSelectedShape = (TGeoShape*)TGeoShapeDialog::GetSelected(); + if (fSelectedShape) fLSelShape->SetText(fSelectedShape->GetName()); + else fSelectedShape = shape; +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoSelectShape2() +{ + TGeoShape *shape = fSelectedShape2; + new TGeoShapeDialog(fBSelShape2, gClient->GetRoot(), 200,300); + fSelectedShape2 = (TGeoShape*)TGeoShapeDialog::GetSelected(); + if (fSelectedShape2) fLSelShape2->SetText(fSelectedShape2->GetName()); + else fSelectedShape2 = shape; +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoSelectMaterial() +{ + TGeoMaterial *mat = fSelectedMaterial; + new TGeoMaterialDialog(fBSelMaterial, gClient->GetRoot(), 200,300); + fSelectedMaterial = (TGeoMaterial*)TGeoMaterialDialog::GetSelected(); + if (fSelectedMaterial) fLSelMaterial->SetText(fSelectedMaterial->GetName()); + else fSelectedMaterial = mat; +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoSelectMaterial2() +{ + TGeoMaterial *mat = fSelectedMaterial2; + new TGeoMaterialDialog(fBSelMaterial2, gClient->GetRoot(), 200,300); + fSelectedMaterial2 = (TGeoMaterial*)TGeoMaterialDialog::GetSelected(); + if (fSelectedMaterial2) fLSelMaterial2->SetText(fSelectedMaterial2->GetName()); + else fSelectedMaterial2 = mat; +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoSelectMedium() +{ + TGeoMedium *med = fSelectedMedium; + new TGeoMediumDialog(fBSelMedium, gClient->GetRoot(), 200,300); + fSelectedMedium = (TGeoMedium*)TGeoMediumDialog::GetSelected(); + if (fSelectedMedium) fLSelMedium->SetText(fSelectedMedium->GetName()); + else fSelectedMedium = med; +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoSelectMedium2() +{ + TGeoMedium *med = fSelectedMedium2; + new TGeoMediumDialog(fBSelMedium2, gClient->GetRoot(), 200,300); + fSelectedMedium2 = (TGeoMedium*)TGeoMediumDialog::GetSelected(); + if (fSelectedMedium2) fLSelMedium2->SetText(fSelectedMedium2->GetName()); + else fSelectedMedium2 = med; +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoSelectVolume() +{ + TGeoVolume *vol = fSelectedVolume; + new TGeoVolumeDialog(fBSelVolume, gClient->GetRoot(), 200,300); + fSelectedVolume = (TGeoVolume*)TGeoVolumeDialog::GetSelected(); + if (fSelectedVolume) fLSelVolume->SetText(fSelectedVolume->GetName()); + else fSelectedVolume = vol; +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoSelectTopVolume() +{ + TGeoVolume *vol = fGeometry->GetTopVolume(); + new TGeoVolumeDialog(fBSelTop, gClient->GetRoot(), 200,300); + fSelectedVolume = (TGeoVolume*)TGeoVolumeDialog::GetSelected(); + if (fSelectedVolume) fLSelTop->SetText(fSelectedVolume->GetName()); + else fSelectedVolume = vol; + if (fSelectedVolume && (fSelectedVolume != vol)) fGeometry->SetTopVolume(fSelectedVolume); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::DoCloseGeometry() +{ +// Close 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 + TGCompositeFrame *cont = (TGCompositeFrame*)fCategories->GetItem("Shapes")->GetContainer(); + if (show) cont->ShowFrame(f2); + else cont->HideFrame(f2); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::ShowSelectVolume(Bool_t show) +{ +// Show/hide interface for shape selection + TGCompositeFrame *cont = (TGCompositeFrame*)fCategories->GetItem("General")->GetContainer(); + if (show) cont->ShowFrame(f7); + else cont->HideFrame(f7); + cont = (TGCompositeFrame*)fCategories->GetItem("Volumes")->GetContainer(); + if (show) cont->ShowFrame(f3); + else cont->HideFrame(f3); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::ShowSelectMaterial(Bool_t show) +{ +// Show/hide interface for shape selection + TGCompositeFrame *cont = (TGCompositeFrame*)fCategories->GetItem("Materials")->GetContainer(); + if (show) cont->ShowFrame(f4); + else cont->HideFrame(f4); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::ShowSelectMedium(Bool_t show) +{ +// Show/hide interface for shape selection + TGCompositeFrame *cont = (TGCompositeFrame*)fCategories->GetItem("Media")->GetContainer(); + if (show) cont->ShowFrame(f5); + else cont->HideFrame(f5); +} + +//______________________________________________________________________________ +void TGeoManagerEditor::ShowSelectMatrix(Bool_t show) +{ +// Show/hide interface for shape 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 new file mode 100644 index 0000000000000000000000000000000000000000..588d026bd49c60a9f3b2628c1b9889698a7a92d6 --- /dev/null +++ b/geombuilder/src/TGeoMaterialEditor.cxx @@ -0,0 +1,299 @@ +// @(#):$Name: $:$Id: 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. * + *************************************************************************/ + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoMaterialEditor // +// // +////////////////////////////////////////////////////////////////////////// + +#include "TGeoMaterialEditor.h" +#include "TGeoTabManager.h" +#include "TGeoMaterial.h" +#include "TGeoManager.h" +#include "TVirtualGeoPainter.h" +#include "TPad.h" +#include "TView.h" +#include "TGTab.h" +#include "TGComboBox.h" +#include "TGButton.h" +#include "TGTextEntry.h" +#include "TGNumberEntry.h" +#include "TGLabel.h" + +ClassImp(TGeoMaterialEditor) + +enum ETGeoMaterialWid { + kMATERIAL_NAME, kMATERIAL_A, kMATERIAL_Z, kMATERIAL_RHO, + kMATERIAL_RAD, kMATERIAL_ABS, + kMATERIAL_APPLY, kMATERIAL_CANCEL, kMATERIAL_UNDO +}; + +//______________________________________________________________________________ +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 + fMaterial = 0; + fAi = fZi = 0; + fDensityi = 0.0; + fNamei = ""; + fIsModified = kFALSE; + fIsMaterialEditable = kTRUE; + + fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); + + // TextEntry for shape name + MakeTitle("Name"); + fMaterialName = new TGTextEntry(this, new TGTextBuffer(50), kMATERIAL_NAME); + fMaterialName->Resize(135, fMaterialName->GetDefaultHeight()); + fMaterialName->SetToolTipText("Enter the material name"); + fMaterialName->Associate(this); + AddFrame(fMaterialName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5)); + + TGTextEntry *nef; + MakeTitle("Material properties"); + TGCompositeFrame *f1 = new TGCompositeFrame(this, 118, 10, kHorizontalFrame | + kFixedWidth | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "A"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fMatA = new TGNumberEntry(f1, 0., 5, kMATERIAL_A); + nef = (TGTextEntry*)fMatA->GetNumberEntry(); + nef->SetToolTipText("Enter the atomic mass"); + fMatA->Associate(this); + f1->AddFrame(fMatA, new TGLayoutHints(kLHintsLeft , 2, 2, 4, 4)); + f1->AddFrame(new TGLabel(f1, "Z"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fMatZ = new TGNumberEntry(f1, 0., 5, kMATERIAL_Z); + nef = (TGTextEntry*)fMatZ->GetNumberEntry(); + nef->SetToolTipText("Enter the atomic charge"); + fMatZ->Associate(this); + f1->AddFrame(fMatZ, new TGLayoutHints(kLHintsLeft , 2, 2, 4, 4)); + f1->Resize(150,30); + AddFrame(f1, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); + + + TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame | kDoubleBorder); + // Number entry for density + f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "Density"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fMatDensity = new TGNumberEntry(f1, 0., 5, kMATERIAL_RHO); + nef = (TGTextEntry*)fMatDensity->GetNumberEntry(); + nef->SetToolTipText("Enter material density"); + fMatDensity->Associate(this); + f1->AddFrame(fMatDensity, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + // Number entry for radiation length + f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "RadLen"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fMatRadLen = new TGNumberEntry(f1, 0., 5, kMATERIAL_RAD); + nef = (TGTextEntry*)fMatRadLen->GetNumberEntry(); + nef->SetToolTipText("Computed radiation length"); + fMatRadLen->Associate(this); + f1->AddFrame(fMatRadLen, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + // Number entry for absorbtion length + f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "AbsLen"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fMatAbsLen = new TGNumberEntry(f1, 0., 5, kMATERIAL_ABS); + nef = (TGTextEntry*)fMatAbsLen->GetNumberEntry(); + nef->SetToolTipText("Absorbtion length"); + fMatAbsLen->Associate(this); + f1->AddFrame(fMatAbsLen, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + compxyz->Resize(150,30); + AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 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); + fCancel = new TGTextButton(f23, "Cancel"); + f23->AddFrame(fCancel, new TGLayoutHints(kLHintsCenterX, 2, 2, 4, 4)); + fCancel->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 = TGeoMaterial::Class(); + TGedElement *ge = new TGedElement; + ge->fGedFrame = this; + ge->fCanvas = 0; + cl->GetEditorList()->Add(ge); +} + +//______________________________________________________________________________ +TGeoMaterialEditor::~TGeoMaterialEditor() +{ +// Destructor + TGFrameElement *el; + TIter next(GetList()); + + while ((el = (TGFrameElement *)next())) { + if (!strcmp(el->fFrame->ClassName(), "TGCompositeFrame")) + ((TGCompositeFrame *)el->fFrame)->Cleanup(); + } + Cleanup(); + TClass *cl = TGeoMaterial::Class(); + TIter next1(cl->GetEditorList()); + TGedElement *ge; + while ((ge=(TGedElement*)next1())) { + if (ge->fGedFrame==this) { + cl->GetEditorList()->Remove(ge); + delete ge; + next1.Reset(); + } + } +} + +//______________________________________________________________________________ +void TGeoMaterialEditor::ConnectSignals2Slots() +{ + // Connect signals to slots. + fApply->Connect("Clicked()", "TGeoMaterialEditor", this, "DoApply()"); + fCancel->Connect("Clicked()", "TGeoMaterialEditor", this, "DoCancel()"); + fUndo->Connect("Clicked()", "TGeoMaterialEditor", this, "DoUndo()"); + fMaterialName->Connect("TextChanged(const char *)", "TGeoMaterialEditor", this, "DoName()"); + fMatA->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoA()"); + fMatZ->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoZ()"); + fMatDensity->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoDensity()"); + fMatRadLen->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoRadAbs()"); + fMatAbsLen->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoRadAbs()"); + fInit = kFALSE; +} + +//______________________________________________________________________________ +void TGeoMaterialEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +{ + // Connect to the picked volume. + if (obj == 0 || !(obj->InheritsFrom(TGeoMaterial::Class()))) { + SetActive(kFALSE); + return; + } + fModel = obj; + fPad = pad; + fMaterial = (TGeoMaterial*)fModel; + fAi = (Int_t)fMaterial->GetA(); + fZi = (Int_t)fMaterial->GetZ(); + fDensityi = fMaterial->GetDensity(); + fNamei = fMaterial->GetName(); + fMaterialName->SetText(fMaterial->GetName()); + fMatA->SetNumber(fAi); + fMatZ->SetNumber(fZi); + fMatDensity->SetNumber(fDensityi); + fMatRadLen->SetNumber(fMaterial->GetRadLen()); + fMatAbsLen->SetNumber(fMaterial->GetIntLen()); + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); + + if (fInit) ConnectSignals2Slots(); + SetActive(); +} + +//______________________________________________________________________________ +void TGeoMaterialEditor::DoName() +{ +// Perform name change + fUndo->SetEnabled(); + fCancel->SetEnabled(kFALSE); + fApply->SetEnabled(kTRUE); +} + +//______________________________________________________________________________ +void TGeoMaterialEditor::DoA() +{ + fMatA->SetNumber(fAi); + DoModified(); +} + +//______________________________________________________________________________ +void TGeoMaterialEditor::DoZ() +{ + fMatZ->SetNumber(fZi); + DoModified(); +} + +//______________________________________________________________________________ +void TGeoMaterialEditor::DoDensity() +{ + fMatDensity->SetNumber(fDensityi); + DoModified(); +} + +//______________________________________________________________________________ +void TGeoMaterialEditor::DoRadAbs() +{ + fMatRadLen->SetNumber(fMaterial->GetRadLen()); + fMatAbsLen->SetNumber(fMaterial->GetIntLen()); + DoModified(); +} + +//______________________________________________________________________________ +void TGeoMaterialEditor::DoApply() +{ + const char *name = fMaterialName->GetText(); + fMaterial->SetName(name); + Int_t id = gGeoManager->GetListOfMaterials()->IndexOf(fMaterial); + fTabMgr->UpdateMaterial(id); + fMatA->SetNumber(fAi); + fMatZ->SetNumber(fZi); + fMatDensity->SetNumber(fDensityi); + fMatRadLen->SetNumber(fMaterial->GetRadLen()); + fMatAbsLen->SetNumber(fMaterial->GetIntLen()); + fUndo->SetEnabled(); + fCancel->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoMaterialEditor::DoCancel() +{ + fMaterialName->SetText(fNamei.Data()); + fMatA->SetNumber(fAi); + fMatZ->SetNumber(fZi); + fMatDensity->SetNumber(fDensityi); + fMatRadLen->SetNumber(fMaterial->GetRadLen()); + fMatAbsLen->SetNumber(fMaterial->GetIntLen()); + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoMaterialEditor::DoModified() +{ + fApply->SetEnabled(); + if (fUndo->GetState()==kButtonDisabled) fCancel->SetEnabled(); +} + +//______________________________________________________________________________ +void TGeoMaterialEditor::DoUndo() +{ + DoCancel(); + fCancel->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); +} diff --git a/geombuilder/src/TGeoMatrixEditor.cxx b/geombuilder/src/TGeoMatrixEditor.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e2cced881860ef96caff6c598018b4502a6859e3 --- /dev/null +++ b/geombuilder/src/TGeoMatrixEditor.cxx @@ -0,0 +1,998 @@ +// @(#):$Name: $:$Id: 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. * + *************************************************************************/ + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoTranslationEditor // +// // +////////////////////////////////////////////////////////////////////////// + +#include "TGeoMatrixEditor.h" +#include "TGeoNodeEditor.h" +#include "TGeoMatrix.h" +#include "TPad.h" +#include "TGTab.h" +#include "TGComboBox.h" +#include "TGButton.h" +#include "TGButtonGroup.h" +#include "TGTextEntry.h" +#include "TGNumberEntry.h" +#include "TGLabel.h" + +ClassImp(TGeoTranslationEditor) + +enum ETGeoMatrixWid { + kMATRIX_NAME, kMATRIX_DX, kMATRIX_DY, kMATRIX_DZ, + kMATRIX_PHI, kMATRIX_THETA, kMATRIX_PSI, + kMATRIX_APPLY, kMATRIX_CANCEL, kMATRIX_UNDO +}; + +//______________________________________________________________________________ +TGeoTranslationEditor::TGeoTranslationEditor(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 + fTranslation = 0; + fDxi = fDyi = fDzi = 0.0; + fNamei = ""; + fIsModified = kFALSE; + fIsEditable = kFALSE; + + // TextEntry for name + MakeTitle("Name"); + fTransName = new TGTextEntry(this, new TGTextBuffer(50), kMATRIX_NAME); + fTransName->Resize(135, fTransName->GetDefaultHeight()); + fTransName->SetToolTipText("Enter the translation name"); + fTransName->Associate(this); + AddFrame(fTransName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5)); + + TGTextEntry *nef; + MakeTitle("Translations on axes"); + TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame | kDoubleBorder); + // Number entry for dx + TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "DX"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fTransDx = new TGNumberEntry(f1, 0., 5, kMATRIX_DX); + nef = (TGTextEntry*)fTransDx->GetNumberEntry(); + nef->SetToolTipText("Enter the translation on X"); + fTransDx->Associate(this); + f1->AddFrame(fTransDx, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + + // Number entry for dy + TGCompositeFrame *f2 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f2->AddFrame(new TGLabel(f2, "DY"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fTransDy = new TGNumberEntry(f2, 0., 5, kMATRIX_DY); + nef = (TGTextEntry*)fTransDy->GetNumberEntry(); + nef->SetToolTipText("Enter the translation on Y"); + fTransDy->Associate(this); + f2->AddFrame(fTransDy, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + compxyz->AddFrame(f2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + + // Number entry for dx + TGCompositeFrame *f3 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f3->AddFrame(new TGLabel(f3, "DZ"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fTransDz = new TGNumberEntry(f3, 0., 5, kMATRIX_DZ); + nef = (TGTextEntry*)fTransDz->GetNumberEntry(); + nef->SetToolTipText("Enter the translation on Z"); + fTransDz->Associate(this); + f3->AddFrame(fTransDz, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + compxyz->AddFrame(f3, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + + compxyz->Resize(150,30); + AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 2, 2)); + + // 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); + fCancel = new TGTextButton(f23, "&Cancel"); + f23->AddFrame(fCancel, new TGLayoutHints(kLHintsCenterX, 2, 2, 4, 4)); + fCancel->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, 2, 2)); + fUndo->SetSize(fCancel->GetSize()); + fApply->SetSize(fCancel->GetSize()); + + // Initialize layout + MapSubwindows(); + Layout(); + MapWindow(); + + TClass *cl = TGeoTranslation::Class(); + TGedElement *ge = new TGedElement; + ge->fGedFrame = this; + ge->fCanvas = 0; + cl->GetEditorList()->Add(ge); +} + +//______________________________________________________________________________ +TGeoTranslationEditor::~TGeoTranslationEditor() +{ +// Destructor + TGFrameElement *el; + TIter next(GetList()); + + while ((el = (TGFrameElement *)next())) { + if (!strcmp(el->fFrame->ClassName(), "TGCompositeFrame")) + ((TGCompositeFrame *)el->fFrame)->Cleanup(); + } + Cleanup(); + TClass *cl = TGeoTranslation::Class(); + TIter next1(cl->GetEditorList()); + TGedElement *ge; + while ((ge=(TGedElement*)next1())) { + if (ge->fGedFrame==this) { + cl->GetEditorList()->Remove(ge); + delete ge; + next1.Reset(); + } + } +} + +//______________________________________________________________________________ +void TGeoTranslationEditor::ConnectSignals2Slots() +{ + // Connect signals to slots. + fApply->Connect("Clicked()", "TGeoTranslationEditor", this, "DoApply()"); + fCancel->Connect("Clicked()", "TGeoTranslationEditor", this, "DoCancel()"); + fUndo->Connect("Clicked()", "TGeoTranslationEditor", this, "DoUndo()"); + fTransName->Connect("TextChanged(const char *)", "TGeoTranslationEditor", this, "DoModified()"); + fTransDx->Connect("ValueSet(Long_t)", "TGeoTranslationEditor", this, "DoDx()"); + fTransDy->Connect("ValueSet(Long_t)", "TGeoTranslationEditor", this, "DoDy()"); + fTransDz->Connect("ValueSet(Long_t)", "TGeoTranslationEditor", this, "DoDz()"); + fTransDx->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTranslationEditor", this, "DoDx()"); + fTransDy->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTranslationEditor", this, "DoDy()"); + fTransDz->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTranslationEditor", this, "DoDz()"); + fInit = kFALSE; +} + + +//______________________________________________________________________________ +void TGeoTranslationEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +{ + // Connect to the picked volume. + if (obj == 0 || (obj->IsA()!=TGeoTranslation::Class())) { + SetActive(kFALSE); + return; + } + fModel = obj; + fPad = pad; + fTranslation = (TGeoTranslation*)fModel; + fDxi = fTranslation->GetTranslation()[0]; + fDyi = fTranslation->GetTranslation()[1]; + fDzi = fTranslation->GetTranslation()[2]; + const char *sname = fTranslation->GetName(); + if (!strcmp(sname, fTranslation->ClassName())) fTransName->SetText("no_name"); + else { + fTransName->SetText(sname); + fNamei = sname; + } + fTransDx->SetNumber(fDxi); + fTransDy->SetNumber(fDyi); + fTransDz->SetNumber(fDzi); + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); + + if (fInit) ConnectSignals2Slots(); + SetActive(); +} + +//______________________________________________________________________________ +void TGeoTranslationEditor::DoName() +{ + const char *name = fTransName->GetText(); + if (!strcmp(name, "no_name") || !strcmp(name, fTranslation->GetName())) return; + fTranslation->SetName(name); +} + +//______________________________________________________________________________ +Bool_t TGeoTranslationEditor::DoParameters() +{ + Double_t dx = fTransDx->GetNumber(); + Double_t dy = fTransDy->GetNumber(); + Double_t dz = fTransDz->GetNumber(); + Bool_t changed = kFALSE; + if (dx != fTranslation->GetTranslation()[0] || + dy != fTranslation->GetTranslation()[1] || + dz != fTranslation->GetTranslation()[2]) changed = kTRUE; + if (!changed) return kFALSE; + fUndo->SetEnabled(); + fTranslation->SetTranslation(dx, dy, dz); + if (fPad) { + fPad->Modified(); + fPad->Update(); + } + return kTRUE; +} + +//______________________________________________________________________________ +void TGeoTranslationEditor::DoApply() +{ + DoName(); + if (DoParameters()) { + fUndo->SetEnabled(); + fCancel->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); + } +} + +//______________________________________________________________________________ +void TGeoTranslationEditor::DoCancel() +{ + if (!fNamei.Length()) fTransName->SetText("no_name"); + else fTransName->SetText(fNamei.Data()); + fTransDx->SetNumber(fDxi); + fTransDy->SetNumber(fDyi); + fTransDz->SetNumber(fDzi); + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoTranslationEditor::DoModified() +{ + fApply->SetEnabled(); + if (fUndo->GetState()==kButtonDisabled) fCancel->SetEnabled(); +} + +//______________________________________________________________________________ +void TGeoTranslationEditor::DoUndo() +{ + DoCancel(); + DoParameters(); + fCancel->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoTranslationEditor::DoDx() +{ + DoModified(); +} + +//______________________________________________________________________________ +void TGeoTranslationEditor::DoDy() +{ + DoModified(); +} + +//______________________________________________________________________________ +void TGeoTranslationEditor::DoDz() +{ + DoModified(); +} + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoRotationEditor // +// // +// Editor for a TGeoRotation. // +// // +////////////////////////////////////////////////////////////////////////// + +ClassImp(TGeoRotationEditor) + +//______________________________________________________________________________ +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 + fRotation = 0; + fPhii = fThetai = fPsii = 0.0; + fAngleX = fAngleY = fAngleZ = 0.0; + fNamei = ""; + fIsModified = kFALSE; + fIsEditable = kFALSE; + + // TextEntry for name + MakeTitle("Name"); + fRotName = new TGTextEntry(this, new TGTextBuffer(50), kMATRIX_NAME); + fRotName->Resize(135, fRotName->GetDefaultHeight()); + fRotName->SetToolTipText("Enter the rotation name"); + fRotName->Associate(this); + AddFrame(fRotName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5)); + + TGTextEntry *nef; + MakeTitle("Euler angles"); + TGCompositeFrame *compxyz = new TGCompositeFrame(this, 140, 30, kVerticalFrame | kRaisedFrame | kDoubleBorder); + // Number entry for phi angle + TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f1->AddFrame(new TGLabel(f1, " PHI "), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fRotPhi = new TGNumberEntry(f1, 0., 5, kMATRIX_PHI); + nef = (TGTextEntry*)fRotPhi->GetNumberEntry(); + nef->SetToolTipText("Modify the first rotation angle about Z"); + fRotPhi->Associate(this); + fRotPhi->Resize(90, fRotPhi->GetDefaultHeight()); + f1->AddFrame(fRotPhi, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + + // Number entry for theta angle + TGCompositeFrame *f2 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f2->AddFrame(new TGLabel(f2, "THETA"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fRotTheta = new TGNumberEntry(f2, 0., 5, kMATRIX_THETA); + nef = (TGTextEntry*)fRotTheta->GetNumberEntry(); + nef->SetToolTipText("Modify the second rotation angle about the new X"); + fRotTheta->Associate(this); + fRotTheta->Resize(90, fRotTheta->GetDefaultHeight()); + f2->AddFrame(fRotTheta, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2)); + compxyz->AddFrame(f2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + + // Number entry for psi angle + TGCompositeFrame *f3 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f3->AddFrame(new TGLabel(f3, " PSI "), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fRotPsi = new TGNumberEntry(f3, 0., 5, kMATRIX_PSI); + nef = (TGTextEntry*)fRotPsi->GetNumberEntry(); + nef->SetToolTipText("Modify the third rotation angle about Z"); + fRotPsi->Associate(this); + fRotPsi->Resize(90, fRotPsi->GetDefaultHeight()); + f3->AddFrame(fRotPsi, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2)); + compxyz->AddFrame(f3, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + + compxyz->Resize(150,compxyz->GetDefaultHeight()); + AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 2, 2)); + + MakeTitle("Rotate about axis"); + compxyz = new TGCompositeFrame(this, 140, 30, kVerticalFrame | kRaisedFrame | kDoubleBorder); + // Number entry for rotation angle about one axis + f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "ANGLE"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fRotAxis = new TGNumberEntry(f1, 0., 5, kMATRIX_DX); + nef = (TGTextEntry*)fRotAxis->GetNumberEntry(); + nef->SetToolTipText("Enter the new rotation angle about the selected axis"); + fRotAxis->Associate(this); + fRotAxis->Resize(90, fRotAxis->GetDefaultHeight()); + f1->AddFrame(fRotAxis, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + + // Radio buttons group for axis selection + TGHButtonGroup *bg1 = new TGHButtonGroup(compxyz, " Axis "); + fRotX = new TGRadioButton(bg1, " &X "); + fRotY = new TGRadioButton(bg1, " &Y "); + fRotZ = new TGRadioButton(bg1, " &Z "); + bg1->Insert(fRotX, kMATRIX_DX); + bg1->Insert(fRotY, kMATRIX_DY); + bg1->Insert(fRotZ, kMATRIX_DZ); + bg1->SetRadioButtonExclusive(); + compxyz->AddFrame(bg1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + + compxyz->Resize(150,compxyz->GetDefaultHeight()); + AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 2, 2)); + + + // 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); + fCancel = new TGTextButton(f23, "Cancel"); + f23->AddFrame(fCancel, new TGLayoutHints(kLHintsCenterX, 2, 2, 4, 4)); + fCancel->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, 2, 2)); + fUndo->SetSize(fCancel->GetSize()); + fApply->SetSize(fCancel->GetSize()); + + // Initialize layout + MapSubwindows(); + Layout(); + MapWindow(); + + TClass *cl = TGeoRotation::Class(); + TGedElement *ge = new TGedElement; + ge->fGedFrame = this; + ge->fCanvas = 0; + cl->GetEditorList()->Add(ge); +} + +//______________________________________________________________________________ +TGeoRotationEditor::~TGeoRotationEditor() +{ +// Destructor + TGFrameElement *el; + TIter next(GetList()); + + while ((el = (TGFrameElement *)next())) { + if (!strcmp(el->fFrame->ClassName(), "TGCompositeFrame")) + ((TGCompositeFrame *)el->fFrame)->Cleanup(); + } + Cleanup(); + TClass *cl = TGeoRotation::Class(); + TIter next1(cl->GetEditorList()); + TGedElement *ge; + while ((ge=(TGedElement*)next1())) { + if (ge->fGedFrame==this) { + cl->GetEditorList()->Remove(ge); + delete ge; + next1.Reset(); + } + } +} + +//______________________________________________________________________________ +void TGeoRotationEditor::ConnectSignals2Slots() +{ + // Connect signals to slots. + fApply->Connect("Clicked()", "TGeoRotationEditor", this, "DoApply()"); + fCancel->Connect("Clicked()", "TGeoRotationEditor", this, "DoCancel()"); + fUndo->Connect("Clicked()", "TGeoRotationEditor", this, "DoUndo()"); + fRotName->Connect("TextChanged(const char *)", "TGeoRotationEditor", this, "DoModified()"); + fRotPhi->Connect("ValueSet(Long_t)", "TGeoRotationEditor", this, "DoRotPhi()"); + fRotTheta->Connect("ValueSet(Long_t)", "TGeoRotationEditor", this, "DoRotTheta()"); + fRotPsi->Connect("ValueSet(Long_t)", "TGeoRotationEditor", this, "DoRotPsi()"); + fRotAxis->Connect("ValueSet(Long_t)", "TGeoRotationEditor", this, "DoRotAngle()"); + fInit = kFALSE; +} + + +//______________________________________________________________________________ +void TGeoRotationEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +{ + // Connect to the picked volume. + if (obj == 0 || (obj->IsA()!=TGeoRotation::Class())) { + SetActive(kFALSE); + return; + } + fModel = obj; + fPad = pad; + fRotation = (TGeoRotation*)fModel; + fRotation->GetAngles(fPhii, fThetai, fPsii); + const char *sname = fRotation->GetName(); + if (!strcmp(sname, fRotation->ClassName())) fRotName->SetText("no_name"); + else { + fRotName->SetText(sname); + fNamei = sname; + } + fRotPhi->SetNumber(fPhii); + fRotTheta->SetNumber(fThetai); + fRotPsi->SetNumber(fPsii); + fRotAxis->SetNumber(0.0); + + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); + + if (fInit) ConnectSignals2Slots(); + SetActive(); +} + +//______________________________________________________________________________ +void TGeoRotationEditor::DoName() +{ + const char *name = fRotName->GetText(); + if (!strcmp(name, "no_name") || !strcmp(name, fRotation->GetName())) return; + fRotation->SetName(name); +} + +//______________________________________________________________________________ +void TGeoRotationEditor::DoRotPhi() +{ + if (fRotPhi->GetNumber() < 0.) fRotPhi->SetNumber(fRotPhi->GetNumber()+360.); + if (fRotPhi->GetNumber() >= 360.) fRotPhi->SetNumber(fRotPhi->GetNumber()-360.); + DoModified(); +} + +//______________________________________________________________________________ +void TGeoRotationEditor::DoRotTheta() +{ + if (fRotTheta->GetNumber() < 0.) fRotTheta->SetNumber(fRotTheta->GetNumber()+360.); + if (fRotTheta->GetNumber() >= 360.) fRotTheta->SetNumber(fRotTheta->GetNumber()-360.); + DoModified(); +} + +//______________________________________________________________________________ +void TGeoRotationEditor::DoRotPsi() +{ + if (fRotPsi->GetNumber() < 0.) fRotPsi->SetNumber(fRotPsi->GetNumber()+360.); + if (fRotPsi->GetNumber() >= 360.) fRotPsi->SetNumber(fRotPsi->GetNumber()-360.); + DoModified(); +} + +//______________________________________________________________________________ +void TGeoRotationEditor::DoRotAngle() +{ + if (fRotAxis->GetNumber() < 0.) fRotAxis->SetNumber(fRotAxis->GetNumber()+360.); + if (fRotAxis->GetNumber() >= 360.) fRotAxis->SetNumber(fRotAxis->GetNumber()-360.); + DoModified(); +} + +//______________________________________________________________________________ +Bool_t TGeoRotationEditor::DoParameters() +{ + Double_t phi = fRotPhi->GetNumber(); + Double_t theta = fRotTheta->GetNumber(); + Double_t psi = fRotPsi->GetNumber(); + Double_t angle = fRotAxis->GetNumber(); + Double_t phi0 = 0., theta0 = 0., psi0 = 0.; + fRotation->GetAngles(phi0,theta0,psi0); + Bool_t changed = kFALSE; + if (phi != psi0 || theta != theta0 || psi != psi0) changed = kTRUE; + if (changed) fRotation->SetAngles(phi, theta, psi); + // Check if we have to rotate about one axis + if (angle != 0.0) { + if (fRotX->IsOn()) {fRotation->RotateX(angle); changed = kTRUE;} + if (fRotY->IsOn()) {fRotation->RotateY(angle); changed = kTRUE;} + if (fRotZ->IsOn()) {fRotation->RotateZ(angle); changed = kTRUE;} + } + if (!changed) return kFALSE; + fRotAxis->SetNumber(0.0); + fUndo->SetEnabled(); + if (fPad) { + fPad->Modified(); + fPad->Update(); + } + return kTRUE; +} + +//______________________________________________________________________________ +void TGeoRotationEditor::DoApply() +{ + DoName(); + if (DoParameters()) { + fUndo->SetEnabled(); + fCancel->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); + } +} + +//______________________________________________________________________________ +void TGeoRotationEditor::DoCancel() +{ + if (!fNamei.Length()) fRotName->SetText("no_name"); + else fRotName->SetText(fNamei.Data()); + fRotPhi->SetNumber(fPhii); + fRotTheta->SetNumber(fThetai); + fRotPsi->SetNumber(fPsii); + fRotAxis->SetNumber(0.0); + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoRotationEditor::DoModified() +{ + fApply->SetEnabled(); + if (fUndo->GetState()==kButtonDisabled) fCancel->SetEnabled(); +} + +//______________________________________________________________________________ +void TGeoRotationEditor::DoUndo() +{ + DoCancel(); + DoParameters(); + fCancel->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); +} + + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoCombiTransEditor // +// // +// Editor for a TGeoCombiTrans. // +// // +////////////////////////////////////////////////////////////////////////// + +ClassImp(TGeoCombiTransEditor) + +//______________________________________________________________________________ +TGeoCombiTransEditor::TGeoCombiTransEditor(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 + fCombi = 0; + fPhii = fThetai = fPsii = 0.0; + fDxi = fDyi = fDzi = 0.0; + fAngleX = fAngleY = fAngleZ = 0.0; + fNamei = ""; + fIsModified = kFALSE; + fIsEditable = kFALSE; + + // TextEntry for name + MakeTitle("Name"); + fRotName = new TGTextEntry(this, new TGTextBuffer(50), kMATRIX_NAME); + fRotName->Resize(135, fRotName->GetDefaultHeight()); + fRotName->SetToolTipText("Enter the rotation name"); + fRotName->Associate(this); + AddFrame(fRotName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5)); + + TGTextEntry *nef; + MakeTitle("Translations on axes"); + TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame | kDoubleBorder); + // Number entry for dx + TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "DX"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fTransDx = new TGNumberEntry(f1, 0., 5, kMATRIX_DX); + nef = (TGTextEntry*)fTransDx->GetNumberEntry(); + nef->SetToolTipText("Enter the translation on X"); + fTransDx->Associate(this); + f1->AddFrame(fTransDx, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + + // Number entry for dy + TGCompositeFrame *f2 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f2->AddFrame(new TGLabel(f2, "DY"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fTransDy = new TGNumberEntry(f2, 0., 5, kMATRIX_DY); + nef = (TGTextEntry*)fTransDy->GetNumberEntry(); + nef->SetToolTipText("Enter the translation on Y"); + fTransDy->Associate(this); + f2->AddFrame(fTransDy, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + compxyz->AddFrame(f2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + + // Number entry for dx + TGCompositeFrame *f3 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f3->AddFrame(new TGLabel(f3, "DZ"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fTransDz = new TGNumberEntry(f3, 0., 5, kMATRIX_DZ); + nef = (TGTextEntry*)fTransDz->GetNumberEntry(); + nef->SetToolTipText("Enter the translation on Z"); + fTransDz->Associate(this); + f3->AddFrame(fTransDz, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + compxyz->AddFrame(f3, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + + compxyz->Resize(150,30); + AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 2, 2)); + + + MakeTitle("Euler angles"); + compxyz = new TGCompositeFrame(this, 140, 30, kVerticalFrame | kRaisedFrame | kDoubleBorder); + // Number entry for phi angle + f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f1->AddFrame(new TGLabel(f1, " PHI "), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fRotPhi = new TGNumberEntry(f1, 0., 5, kMATRIX_PHI); + nef = (TGTextEntry*)fRotPhi->GetNumberEntry(); + nef->SetToolTipText("Modify the first rotation angle about Z"); + fRotPhi->Associate(this); + fRotPhi->Resize(90, fRotPhi->GetDefaultHeight()); + f1->AddFrame(fRotPhi, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + + // Number entry for theta angle + f2 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f2->AddFrame(new TGLabel(f2, "THETA"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fRotTheta = new TGNumberEntry(f2, 0., 5, kMATRIX_THETA); + nef = (TGTextEntry*)fRotTheta->GetNumberEntry(); + nef->SetToolTipText("Modify the second rotation angle about the new X"); + fRotTheta->Associate(this); + fRotTheta->Resize(90, fRotTheta->GetDefaultHeight()); + f2->AddFrame(fRotTheta, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2)); + compxyz->AddFrame(f2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + + // Number entry for psi angle + f3 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f3->AddFrame(new TGLabel(f3, " PSI "), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fRotPsi = new TGNumberEntry(f3, 0., 5, kMATRIX_PSI); + nef = (TGTextEntry*)fRotPsi->GetNumberEntry(); + nef->SetToolTipText("Modify the third rotation angle about Z"); + fRotPsi->Associate(this); + fRotPsi->Resize(90, fRotPsi->GetDefaultHeight()); + f3->AddFrame(fRotPsi, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2)); + compxyz->AddFrame(f3, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + + compxyz->Resize(150,compxyz->GetDefaultHeight()); + AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 2, 2)); + + MakeTitle("Rotate about axis"); + compxyz = new TGCompositeFrame(this, 140, 30, kVerticalFrame | kRaisedFrame | kDoubleBorder); + // Number entry for rotation angle about one axis + f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "ANGLE"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fRotAxis = new TGNumberEntry(f1, 0., 5, kMATRIX_DX); + nef = (TGTextEntry*)fRotAxis->GetNumberEntry(); + nef->SetToolTipText("Enter the new rotation angle about the selected axis"); + fRotAxis->Associate(this); + fRotAxis->Resize(90, fRotAxis->GetDefaultHeight()); + f1->AddFrame(fRotAxis, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + + // Radio buttons group for axis selection + TGHButtonGroup *bg1 = new TGHButtonGroup(compxyz, " Axis "); + fRotX = new TGRadioButton(bg1, " &X "); + fRotY = new TGRadioButton(bg1, " &Y "); + fRotZ = new TGRadioButton(bg1, " &Z "); + bg1->Insert(fRotX, kMATRIX_DX); + bg1->Insert(fRotY, kMATRIX_DY); + bg1->Insert(fRotZ, kMATRIX_DZ); + bg1->SetRadioButtonExclusive(); + compxyz->AddFrame(bg1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 2, 2)); + + compxyz->Resize(150,compxyz->GetDefaultHeight()); + AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 2, 2)); + + + // 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); + fCancel = new TGTextButton(f23, "&Cancel"); + f23->AddFrame(fCancel, new TGLayoutHints(kLHintsCenterX, 2, 2, 4, 4)); + fCancel->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, 2, 2)); + fUndo->SetSize(fCancel->GetSize()); + fApply->SetSize(fCancel->GetSize()); + + // Initialize layout + MapSubwindows(); + Layout(); + MapWindow(); + + TClass *cl = TGeoCombiTrans::Class(); + TGedElement *ge = new TGedElement; + ge->fGedFrame = this; + ge->fCanvas = 0; + cl->GetEditorList()->Add(ge); +} + +//______________________________________________________________________________ +TGeoCombiTransEditor::~TGeoCombiTransEditor() +{ +// Destructor + TGFrameElement *el; + TIter next(GetList()); + + while ((el = (TGFrameElement *)next())) { + if (!strcmp(el->fFrame->ClassName(), "TGCompositeFrame")) + ((TGCompositeFrame *)el->fFrame)->Cleanup(); + } + Cleanup(); + TClass *cl = TGeoCombiTrans::Class(); + TIter next1(cl->GetEditorList()); + TGedElement *ge; + while ((ge=(TGedElement*)next1())) { + if (ge->fGedFrame==this) { + cl->GetEditorList()->Remove(ge); + delete ge; + next1.Reset(); + } + } +} + +//______________________________________________________________________________ +void TGeoCombiTransEditor::ConnectSignals2Slots() +{ + // Connect signals to slots. + fApply->Connect("Clicked()", "TGeoCombiTransEditor", this, "DoApply()"); + fCancel->Connect("Clicked()", "TGeoCombiTransEditor", this, "DoCancel()"); + fUndo->Connect("Clicked()", "TGeoCombiTransEditor", this, "DoUndo()"); + fRotName->Connect("TextChanged(const char *)", "TGeoCombiTransEditor", this, "DoModified()"); + fRotPhi->Connect("ValueSet(Long_t)", "TGeoCombiTransEditor", this, "DoRotPhi()"); + fRotTheta->Connect("ValueSet(Long_t)", "TGeoCombiTransEditor", this, "DoRotTheta()"); + fRotPsi->Connect("ValueSet(Long_t)", "TGeoCombiTransEditor", this, "DoRotPsi()"); + fRotAxis->Connect("ValueSet(Long_t)", "TGeoCombiTransEditor", this, "DoRotAngle()"); + fTransDx->Connect("ValueSet(Long_t)", "TGeoCombiTransEditor", this, "DoDx()"); + fTransDy->Connect("ValueSet(Long_t)", "TGeoCombiTransEditor", this, "DoDy()"); + fTransDz->Connect("ValueSet(Long_t)", "TGeoCombiTransEditor", this, "DoDz()"); + fTransDx->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoCombiTransEditor", this, "DoDx()"); + fTransDy->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoCombiTransEditor", this, "DoDy()"); + fTransDz->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoCombiTransEditor", this, "DoDz()"); + fInit = kFALSE; +} + + +//______________________________________________________________________________ +void TGeoCombiTransEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +{ + // Connect to the picked volume. + if (obj == 0 || (obj->IsA()!=TGeoCombiTrans::Class())) { + SetActive(kFALSE); + return; + } + fModel = obj; + fPad = pad; + fCombi = (TGeoCombiTrans*)fModel; + TGeoRotation *rot = fCombi->GetRotation(); + if (rot) rot->GetAngles(fPhii, fThetai, fPsii); + const char *sname = fCombi->GetName(); + if (!strcmp(sname, fCombi->ClassName())) fRotName->SetText("no_name"); + else { + fRotName->SetText(sname); + fNamei = sname; + } + + fDxi = fCombi->GetTranslation()[0]; + fDyi = fCombi->GetTranslation()[1]; + fDzi = fCombi->GetTranslation()[2]; + fTransDx->SetNumber(fDxi); + fTransDy->SetNumber(fDyi); + fTransDz->SetNumber(fDzi); + + fRotPhi->SetNumber(fPhii); + fRotTheta->SetNumber(fThetai); + fRotPsi->SetNumber(fPsii); + fRotAxis->SetNumber(0.0); + + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); + + if (fInit) ConnectSignals2Slots(); + SetActive(); +} + +//______________________________________________________________________________ +void TGeoCombiTransEditor::DoName() +{ + const char *name = fRotName->GetText(); + if (!strcmp(name, "no_name") || !strcmp(name, fCombi->GetName())) return; + fCombi->SetName(name); +} + +//______________________________________________________________________________ +void TGeoCombiTransEditor::DoRotPhi() +{ + if (fRotPhi->GetNumber() < 0.) fRotPhi->SetNumber(fRotPhi->GetNumber()+360.); + if (fRotPhi->GetNumber() >= 360.) fRotPhi->SetNumber(fRotPhi->GetNumber()-360.); + DoModified(); +} + +//______________________________________________________________________________ +void TGeoCombiTransEditor::DoRotTheta() +{ + if (fRotTheta->GetNumber() < 0.) fRotTheta->SetNumber(fRotTheta->GetNumber()+360.); + if (fRotTheta->GetNumber() >= 360.) fRotTheta->SetNumber(fRotTheta->GetNumber()-360.); + DoModified(); +} + +//______________________________________________________________________________ +void TGeoCombiTransEditor::DoRotPsi() +{ + if (fRotPsi->GetNumber() < 0.) fRotPsi->SetNumber(fRotPsi->GetNumber()+360.); + if (fRotPsi->GetNumber() >= 360.) fRotPsi->SetNumber(fRotPsi->GetNumber()-360.); + DoModified(); +} + +//______________________________________________________________________________ +void TGeoCombiTransEditor::DoRotAngle() +{ + if (fRotAxis->GetNumber() < 0.) fRotAxis->SetNumber(fRotAxis->GetNumber()+360.); + if (fRotAxis->GetNumber() >= 360.) fRotAxis->SetNumber(fRotAxis->GetNumber()-360.); + DoModified(); +} + +//______________________________________________________________________________ +Bool_t TGeoCombiTransEditor::DoParameters() +{ + Double_t dx = fTransDx->GetNumber(); + Double_t dy = fTransDy->GetNumber(); + Double_t dz = fTransDz->GetNumber(); + Bool_t changedtr = kFALSE; + if (dx != fCombi->GetTranslation()[0] || + dy != fCombi->GetTranslation()[1] || + dz != fCombi->GetTranslation()[2]) changedtr = kTRUE; + if (changedtr) fCombi->SetTranslation(dx, dy, dz); + Double_t phi = fRotPhi->GetNumber(); + Double_t theta = fRotTheta->GetNumber(); + Double_t psi = fRotPsi->GetNumber(); + Double_t angle = fRotAxis->GetNumber(); + Double_t phi0 = 0., theta0 = 0., psi0 = 0.; + TGeoRotation *rot = fCombi->GetRotation(); + if (rot) rot->GetAngles(phi0,theta0,psi0); + else { + if (phi!=fPhii || theta!=fThetai || psi!=fPsii) { + TGeoRotation r("rot",10.,0.,0.); + fCombi->SetRotation(r); + rot = fCombi->GetRotation(); + rot->SetAngles(0.,0.,0.); + } + } + Bool_t changed = kFALSE; + if (phi != psi0 || theta != theta0 || psi != psi0) changed = kTRUE; + if (changed && rot) rot->SetAngles(phi, theta, psi); + // Check if we have to rotate about one axis + if (angle != 0.0) { + if (fRotX->IsOn()) {fCombi->RotateX(angle); changed = kTRUE;} + if (fRotY->IsOn()) {fCombi->RotateY(angle); changed = kTRUE;} + if (fRotZ->IsOn()) {fCombi->RotateZ(angle); changed = kTRUE;} + } + if (changedtr) changed = kTRUE; + if (!changed) return kFALSE; + fRotAxis->SetNumber(0.0); + fUndo->SetEnabled(); + if (fPad) { + fPad->Modified(); + fPad->Update(); + } + return kTRUE; +} + +//______________________________________________________________________________ +void TGeoCombiTransEditor::DoApply() +{ + DoName(); + if (DoParameters()) { + fUndo->SetEnabled(); + fCancel->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); + } +} + +//______________________________________________________________________________ +void TGeoCombiTransEditor::DoCancel() +{ + if (!fNamei.Length()) fRotName->SetText("no_name"); + else fRotName->SetText(fNamei.Data()); + fTransDx->SetNumber(fDxi); + fTransDy->SetNumber(fDyi); + fTransDz->SetNumber(fDzi); + fRotPhi->SetNumber(fPhii); + fRotTheta->SetNumber(fThetai); + fRotPsi->SetNumber(fPsii); + fRotAxis->SetNumber(0.0); + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoCombiTransEditor::DoModified() +{ + fApply->SetEnabled(); + if (fUndo->GetState()==kButtonDisabled) fCancel->SetEnabled(); +} + +//______________________________________________________________________________ +void TGeoCombiTransEditor::DoUndo() +{ + DoCancel(); + DoParameters(); + fCancel->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoCombiTransEditor::DoDx() +{ + DoModified(); +} + +//______________________________________________________________________________ +void TGeoCombiTransEditor::DoDy() +{ + DoModified(); +} + +//______________________________________________________________________________ +void TGeoCombiTransEditor::DoDz() +{ + DoModified(); +} + diff --git a/geombuilder/src/TGeoMediumEditor.cxx b/geombuilder/src/TGeoMediumEditor.cxx new file mode 100644 index 0000000000000000000000000000000000000000..40f002f04abe11dcf0bfe7b1a3c3b59abbf60490 --- /dev/null +++ b/geombuilder/src/TGeoMediumEditor.cxx @@ -0,0 +1,443 @@ +// @(#):$Name: $:$Id: 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. * + *************************************************************************/ + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoMediumEditor // +// // +////////////////////////////////////////////////////////////////////////// + +#include "TGeoMediumEditor.h" +#include "TGeoTabManager.h" +#include "TGeoManager.h" +#include "TGeoMedium.h" +#include "TGeoMaterial.h" +#include "TPad.h" +#include "TGTab.h" +#include "TGComboBox.h" +#include "TGButton.h" +#include "TGTextEntry.h" +#include "TGNumberEntry.h" +#include "TGLabel.h" +#include "TG3DLine.h" + +ClassImp(TGeoMediumEditor) + +enum ETGeoMediumWid { + kMED_NAME, kMED_ID, kMED_MATSEL, + kMED_SENS, kMED_FLDOPT, kMED_EDIT_MAT, + kMED_FIELDM, kMED_TMAX, kMED_STEMAX, + kMED_DEEMAX, kMED_EPSIL, kMED_STMIN, + kMED_APPLY, kMED_CANCEL, kMED_UNDO +}; + +//______________________________________________________________________________ +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 + fMedium = 0; + fIsEditable = kFALSE; + fIsModified = kFALSE; + fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); + Pixel_t color; + TGLabel *label; + + // TextEntry for medium name + MakeTitle("Name"); + fMedName = new TGTextEntry(this, new TGTextBuffer(50), kMED_NAME); + fMedName->Resize(135, fMedName->GetDefaultHeight()); + fMedName->SetToolTipText("Enter the medium name"); + fMedName->Associate(this); + AddFrame(fMedName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 2)); + + TGTextEntry *nef; + +// Composite frame for medium ID and sensitivity + TGCompositeFrame *f1 = new TGCompositeFrame(this, 120, 30, kHorizontalFrame | kRaisedFrame); + f1->AddFrame(new TGLabel(f1, "ID"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fMedId = new TGNumberEntry(f1, 0., 1, kMED_ID); + nef = (TGTextEntry*)fMedId->GetNumberEntry(); + nef->SetToolTipText("Enter the medium ID"); + fMedId->Associate(this); + f1->AddFrame(fMedId, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + fMedSensitive = new TGCheckButton(f1, "&Sens", kMED_SENS); + fMedSensitive->Associate(this); + f1->AddFrame(fMedSensitive, new TGLayoutHints(kLHintsRight | kLHintsExpandX , 2, 2, 4, 4)); + AddFrame(f1, new TGLayoutHints(kLHintsLeft, 3, 3, 2, 2)); + + // Current material + f1 = new TGCompositeFrame(this, 145, 10, kHorizontalFrame | kLHintsExpandX | kFixedWidth | kOwnBackground); + f1->AddFrame(label = new TGLabel(f1, "Current material"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); + gClient->GetColorByName("#ff0000", color); + label->SetTextColor(color); + AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0)); + f1 = new TGCompositeFrame(this, 155, 30, kHorizontalFrame | kFixedWidth); + fSelectedMaterial = 0; + fLSelMaterial = new TGLabel(f1, "Select material"); + gClient->GetColorByName("#0000ff", color); + fLSelMaterial->SetTextColor(color); + fLSelMaterial->ChangeOptions(kSunkenFrame | kDoubleBorder); + f1->AddFrame(fLSelMaterial, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2)); + fBSelMaterial = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kMED_MATSEL); + fBSelMaterial->SetToolTipText("Replace with one of the existing materials"); + fBSelMaterial->Associate(this); + f1->AddFrame(fBSelMaterial, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2)); + fEditMaterial = new TGTextButton(f1, "Edit"); + f1->AddFrame(fEditMaterial, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2)); + fEditMaterial->SetToolTipText("Edit selected material"); + fEditMaterial->Associate(this); + AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0)); + +// Combo box for magnetic field option + f1 = new TGCompositeFrame(this, 145, 10, kHorizontalFrame | kLHintsExpandX | kFixedWidth | kOwnBackground); + f1->AddFrame(label = new TGLabel(f1, "Mag. field option"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); + gClient->GetColorByName("#ff0000", color); + label->SetTextColor(color); + AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0)); + fMagfldOption = new TGComboBox(this, kMED_FLDOPT); + fMagfldOption->Resize(135, fMedName->GetDefaultHeight()); + AddFrame(fMagfldOption, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 2)); + + +// Number entries for other settings + f1 = new TGCompositeFrame(this, 145, 10, kHorizontalFrame | kLHintsExpandX | kFixedWidth | kOwnBackground); + f1->AddFrame(label = new TGLabel(f1, "Medium cuts"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); + gClient->GetColorByName("#ff0000", color); + label->SetTextColor(color); + AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0)); + TGCompositeFrame *compxyz = new TGCompositeFrame(this, 130, 30, kVerticalFrame | kRaisedFrame | kDoubleBorder); + + // Number entry for fieldm + f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "FIELDM"), new TGLayoutHints(kLHintsLeft, 1, 1, 4, 0)); + fMedFieldm = new TGNumberEntry(f1, 0., 5, kMED_FIELDM); + nef = (TGTextEntry*)fMedFieldm->GetNumberEntry(); + nef->SetToolTipText("Maximum magnetic field [kilogauss]"); + fMedFieldm->Associate(this); + fMedFieldm->Resize(90, fMedFieldm->GetDefaultHeight()); + f1->AddFrame(fMedFieldm, new TGLayoutHints(kLHintsRight | kFixedWidth , 2, 2, 2, 2)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 1, 1)); + + // Number entry for tmaxfd + TGCompositeFrame *f2 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f2->AddFrame(new TGLabel(f2, "TMAXFD"), new TGLayoutHints(kLHintsLeft, 1, 1, 4, 0)); + fMedTmaxfd = new TGNumberEntry(f2, 0., 5, kMED_TMAX); + nef = (TGTextEntry*)fMedTmaxfd->GetNumberEntry(); + nef->SetToolTipText("Maximum angle per step due to field [deg]"); + fMedTmaxfd->Associate(this); + fMedTmaxfd->Resize(90, fMedTmaxfd->GetDefaultHeight()); + f2->AddFrame(fMedTmaxfd, new TGLayoutHints(kLHintsRight | kFixedWidth , 2, 2, 2, 2)); + compxyz->AddFrame(f2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 1, 1)); + + // Number entry for stemax + TGCompositeFrame *f3 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f3->AddFrame(new TGLabel(f3, "STEMAX"), new TGLayoutHints(kLHintsLeft, 1, 1, 4, 0)); + fMedStemax = new TGNumberEntry(f3, 0., 5, kMED_STEMAX); + nef = (TGTextEntry*)fMedStemax->GetNumberEntry(); + nef->SetToolTipText("Maximum step allowed [cm]"); + fMedStemax->Associate(this); + fMedStemax->Resize(90, fMedStemax->GetDefaultHeight()); + f3->AddFrame(fMedStemax, new TGLayoutHints(kLHintsRight | kFixedWidth , 2, 2, 2, 2)); + compxyz->AddFrame(f3, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 1, 1)); + + // Number entry for deemax + TGCompositeFrame *f4 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f4->AddFrame(new TGLabel(f4, "DEEMAX"), new TGLayoutHints(kLHintsLeft, 1, 1, 4, 0)); + fMedDeemax = new TGNumberEntry(f4, 0., 5, kMED_DEEMAX); + nef = (TGTextEntry*)fMedDeemax->GetNumberEntry(); + nef->SetToolTipText("Maximum fraction of energy lost in a step"); + fMedDeemax->Associate(this); + fMedDeemax->Resize(90, fMedDeemax->GetDefaultHeight()); + f4->AddFrame(fMedDeemax, new TGLayoutHints(kLHintsRight | kFixedWidth , 2, 2, 2, 2)); + compxyz->AddFrame(f4, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 1, 1)); + + // Number entry for epsil + TGCompositeFrame *f5 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f5->AddFrame(new TGLabel(f5, "EPSIL"), new TGLayoutHints(kLHintsLeft, 1, 1, 4, 0)); + fMedEpsil = new TGNumberEntry(f5, 0., 5, kMED_EPSIL); + nef = (TGTextEntry*)fMedEpsil->GetNumberEntry(); + nef->SetToolTipText("Tracking precision [cm]"); + fMedEpsil->Associate(this); + fMedEpsil->Resize(90, fMedEpsil->GetDefaultHeight()); + f5->AddFrame(fMedEpsil, new TGLayoutHints(kLHintsRight | kFixedWidth , 2, 2, 2, 2)); + compxyz->AddFrame(f5, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 1, 1)); + + // Number entry for stmin + TGCompositeFrame *f6 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f6->AddFrame(new TGLabel(f6, "STMIN"), new TGLayoutHints(kLHintsLeft, 1, 1, 4, 0)); + fMedStmin = new TGNumberEntry(f6, 0., 5, kMED_STMIN); + nef = (TGTextEntry*)fMedStmin->GetNumberEntry(); + nef->SetToolTipText("Minimum step due to continuous processes [cm]"); + fMedStmin->Associate(this); + fMedStmin->Resize(90, fMedStmin->GetDefaultHeight()); + f6->AddFrame(fMedStmin, new TGLayoutHints(kLHintsRight | kFixedWidth , 2, 2, 2, 2)); + compxyz->AddFrame(f6, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 1, 1)); + + compxyz->Resize(160,50); + AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2)); + + // 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, 2, 2, 4, 4)); + + // Initialize layout + MapSubwindows(); + Layout(); + MapWindow(); + + TClass *cl = TGeoMedium::Class(); + TGedElement *ge = new TGedElement; + ge->fGedFrame = this; + ge->fCanvas = 0; + cl->GetEditorList()->Add(ge); +} + +//______________________________________________________________________________ +TGeoMediumEditor::~TGeoMediumEditor() +{ +// Destructor + TGFrameElement *el; + TIter next(GetList()); + + while ((el = (TGFrameElement *)next())) { + if (!strcmp(el->fFrame->ClassName(), "TGCompositeFrame")) + ((TGCompositeFrame *)el->fFrame)->Cleanup(); + } + Cleanup(); + TClass *cl = TGeoMedium::Class(); + TIter next1(cl->GetEditorList()); + TGedElement *ge; + while ((ge=(TGedElement*)next1())) { + if (ge->fGedFrame==this) { + cl->GetEditorList()->Remove(ge); + delete ge; + next1.Reset(); + } + } +} + +//______________________________________________________________________________ +void TGeoMediumEditor::ConnectSignals2Slots() +{ + // Connect signals to slots. + fApply->Connect("Clicked()", "TGeoMediumEditor", this, "DoApply()"); + fUndo->Connect("Clicked()", "TGeoMediumEditor", this, "DoUndo()"); + fMedName->Connect("TextChanged(const char *)", "TGeoMediumEditor", this, "DoMedName()"); + fBSelMaterial->Connect("Clicked()", "TGeoMediumEditor", this, "DoSelectMaterial()"); + fEditMaterial->Connect("Clicked()", "TGeoMediumEditor", this, "DoEditMaterial()"); + fMedId->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoMediumEditor", this, "DoMedId()"); + fMedTmaxfd->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoMediumEditor", this, "DoTmaxfd()"); + fMedStemax->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoMediumEditor", this, "DoStemax()"); + fMedDeemax->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoMediumEditor", this, "DoDeemax()"); + fMedEpsil->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoMediumEditor", this, "DoEpsil()"); + fMedStmin->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoMediumEditor", this, "DoStmin()"); + fMedSensitive->Connect("Clicked()", "TGeoMediumEditor", this, "DoToggleSensitive()"); + fMagfldOption->Connect("Selected(Int_t)", "TGeoMediumEditor", this, "DoMagfldSelect(Int_t)"); + fInit = kFALSE; +} + + +//______________________________________________________________________________ +void TGeoMediumEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +{ + // Connect to the picked volume. + if (obj == 0 || !(obj->IsA()==TGeoMedium::Class())) { + SetActive(kFALSE); + return; + } + fModel = obj; + fPad = pad; + fMedium = (TGeoMedium*)fModel; + const char *sname = fMedium->GetName(); + if (!strcmp(sname, fMedium->ClassName())) fMedName->SetText(""); + else fMedName->SetText(sname); + + fMedId->SetNumber(fMedium->GetId()); + Int_t isvol = (Int_t)fMedium->GetParam(0); + fMedSensitive->SetState((isvol==0)?kButtonUp:kButtonDown); + + fSelectedMaterial = fMedium->GetMaterial(); + if (fSelectedMaterial) fLSelMaterial->SetText(fSelectedMaterial->GetName()); + + if (!fMagfldOption->GetNumberOfEntries()) { + fMagfldOption->AddEntry("No field", 0); + fMagfldOption->AddEntry("User decision", 1); + fMagfldOption->AddEntry("Runge-Kutta", 2); + fMagfldOption->AddEntry("Helix", 3); + fMagfldOption->AddEntry("Helix3", 4); + fMagfldOption->AddEntry("Unknown option", 5); + } + Int_t ifld = (Int_t)fMedium->GetParam(1); + switch (ifld) { + case 0: + fMagfldOption->Select(0); + break; + case -1: + fMagfldOption->Select(1); + break; + case 1: + fMagfldOption->Select(2); + break; + case 2: + fMagfldOption->Select(3); + break; + case 3: + fMagfldOption->Select(4); + break; + default: + fMagfldOption->Select(5); + break; + } + + fMedFieldm->SetNumber(fMedium->GetParam(2)); + fMedTmaxfd->SetNumber(fMedium->GetParam(3)); + fMedStemax->SetNumber(fMedium->GetParam(4)); + fMedDeemax->SetNumber(fMedium->GetParam(5)); + fMedEpsil->SetNumber(fMedium->GetParam(6)); + fMedStmin->SetNumber(fMedium->GetParam(7)); + + fUndo->SetEnabled(kFALSE); + fIsModified = kFALSE; + + + if (fInit) ConnectSignals2Slots(); + SetActive(); +} + +//______________________________________________________________________________ +void TGeoMediumEditor::DoEditMaterial() +{ +// Edit selected material. + fTabMgr->GetMaterialEditor(fMedium->GetMaterial()); +} + +//______________________________________________________________________________ +void TGeoMediumEditor::DoMedName() +{ + const char *name = fMedName->GetText(); + if (!strlen(name) || !strcmp(name, fMedium->GetName())) return; + fMedium->SetName(name); +} + +//______________________________________________________________________________ +void TGeoMediumEditor::DoMedId() +{ +} + +//______________________________________________________________________________ +void TGeoMediumEditor::DoSelectMaterial() +{ + TGeoMaterial *material = fSelectedMaterial; + new TGeoMaterialDialog(fBSelMaterial, gClient->GetRoot(), 200,300); + fSelectedMaterial = (TGeoMaterial*)TGeoMaterialDialog::GetSelected(); + if (fSelectedMaterial) fLSelMaterial->SetText(fSelectedMaterial->GetName()); + else fSelectedMaterial = material; +} + +//______________________________________________________________________________ +void TGeoMediumEditor::DoToggleSensitive() +{ + fIsModified = kTRUE; +} + +//______________________________________________________________________________ +void TGeoMediumEditor::DoMagfldSelect(Int_t) +{ + fIsModified = kTRUE; +} + +//______________________________________________________________________________ +void TGeoMediumEditor::DoFieldm() +{ + fIsModified = kTRUE; +} + +//______________________________________________________________________________ +void TGeoMediumEditor::DoTmaxfd() +{ + fIsModified = kTRUE; +} + +//______________________________________________________________________________ +void TGeoMediumEditor::DoStemax() +{ + fIsModified = kTRUE; +} + +//______________________________________________________________________________ +void TGeoMediumEditor::DoDeemax() +{ + fIsModified = kTRUE; +} + +//______________________________________________________________________________ +void TGeoMediumEditor::DoEpsil() +{ + fIsModified = kTRUE; +} + +//______________________________________________________________________________ +void TGeoMediumEditor::DoStmin() +{ + fIsModified = kTRUE; +} + +//______________________________________________________________________________ +void TGeoMediumEditor::DoApply() +{ + if (!fIsModified) return; + Double_t isvol = (fMedSensitive->IsOn())?1:0; + Double_t ifield = fMagfldOption->GetSelected(); + if (ifield>0) { + ifield -= 1.; + if (ifield < 1.) ifield -= 1.; + } + Double_t fieldm = fMedFieldm->GetNumber(); + Double_t tmaxfd = fMedTmaxfd->GetNumber(); + Double_t stemax = fMedStemax->GetNumber(); + Double_t deemax = fMedDeemax->GetNumber(); + Double_t epsil = fMedEpsil->GetNumber(); + Double_t stmin = fMedStmin->GetNumber(); + + fMedium->SetParam(0,isvol); + fMedium->SetParam(1,ifield); + fMedium->SetParam(2,fieldm); + fMedium->SetParam(3,tmaxfd); + fMedium->SetParam(4,stemax); + fMedium->SetParam(5,deemax); + fMedium->SetParam(6,epsil); + fMedium->SetParam(7,stmin); + if (strcmp(fMedium->GetName(), fMedName->GetText())) fMedium->SetName(fMedName->GetText()); + if (fMedium->GetId() != fMedId->GetIntNumber()) fMedium->SetId(fMedId->GetIntNumber()); +} + +//______________________________________________________________________________ +void TGeoMediumEditor::DoUndo() +{ +} + diff --git a/geombuilder/src/TGeoNodeEditor.cxx b/geombuilder/src/TGeoNodeEditor.cxx new file mode 100644 index 0000000000000000000000000000000000000000..050cfa67d3accf172d6f0a15346632ba8362fdef --- /dev/null +++ b/geombuilder/src/TGeoNodeEditor.cxx @@ -0,0 +1,291 @@ +// @(#):$Name: $:$Id: 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. * + *************************************************************************/ + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoNodeEditor // +// // +////////////////////////////////////////////////////////////////////////// + +#include "TGeoNodeEditor.h" +#include "TGedEditor.h" +#include "TGeoManager.h" +#include "TGeoNode.h" +#include "TPad.h" +#include "TGTab.h" +#include "TGComboBox.h" +#include "TGButton.h" +#include "TGTextEntry.h" +#include "TGNumberEntry.h" +#include "TGLabel.h" +#include "TGeoTabManager.h" + +ClassImp(TGeoNodeEditor) + +enum ETGeoNodeWid { + kNODE_NAME, kNODE_ID, kNODE_VOLSEL, kNODE_MVOLSEL, + kNODE_MATRIX, kNODE_EDIT_VOL, kNODE_EDIT_MATRIX, + kNODE_APPLY, kNODE_CANCEL, kNODE_UNDO +}; + +//______________________________________________________________________________ +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 + + fNode = 0; + fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); + fIsEditable = kTRUE; + + // TextEntry for medium name + TGTextEntry *nef; + MakeTitle("Name"); + TGCompositeFrame *f1 = new TGCompositeFrame(this, 140, 30, kHorizontalFrame | kRaisedFrame); + fNodeName = new TGTextEntry(f1, new TGTextBuffer(50), kNODE_NAME); + fNodeName->Resize(100, fNodeName->GetDefaultHeight()); + fNodeName->SetToolTipText("Enter the node name"); + fNodeName->Associate(this); + f1->AddFrame(fNodeName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5)); + f1->AddFrame(new TGLabel(f1, "ID"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fNodeNumber = new TGNumberEntry(f1, 0., 1, kNODE_ID); + nef = (TGTextEntry*)fNodeNumber->GetNumberEntry(); + nef->SetToolTipText("Enter the node copy number"); + fNodeNumber->Associate(this); + f1->AddFrame(fNodeNumber, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + AddFrame(f1, new TGLayoutHints(kLHintsLeft, 3, 3, 2, 5)); + + +// Combo box for mother volume selection + MakeTitle("Mother volume"); + f1 = new TGCompositeFrame(this, 140, 30, kHorizontalFrame | kRaisedFrame); + fMotherVolList = new TGComboBox(f1, kNODE_MVOLSEL); +// fTabMgr->AddComboVolume(fMotherVolList); + fMotherVolList->Resize(100, fNodeName->GetDefaultHeight()); + fMotherVolList->Associate(this); + f1->AddFrame(fMotherVolList, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 5)); + fEditMother = new TGTextButton(f1, "Edit"); + fEditMother->Associate(this); + f1->AddFrame(fEditMother, new TGLayoutHints(kLHintsRight, 2, 2, 2, 5)); + AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 5)); + +// Combo box for volume selection + MakeTitle("Volume"); + f1 = new TGCompositeFrame(this, 140, 30, kHorizontalFrame | kRaisedFrame); + fVolList = new TGComboBox(f1, kNODE_VOLSEL); +// fTabMgr->AddComboVolume(fVolList); + fVolList->Resize(100, fNodeName->GetDefaultHeight()); + fVolList->Associate(this); + f1->AddFrame(fVolList, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5)); + fEditVolume = new TGTextButton(f1, "Edit"); + fEditVolume->Associate(this); + f1->AddFrame(fEditVolume, new TGLayoutHints(kLHintsRight, 2, 2, 2, 5)); + AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 5)); + +// Combo box for matrix selection + MakeTitle("Matrix"); + f1 = new TGCompositeFrame(this, 140, 30, kHorizontalFrame | kRaisedFrame); + fMatrixList = new TGComboBox(f1, kNODE_MATRIX); + fTabMgr->AddComboMatrix(fMatrixList); + fMatrixList->Resize(100, fNodeName->GetDefaultHeight()); + fMatrixList->Associate(this); + f1->AddFrame(fMatrixList, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5)); + fEditMatrix = new TGTextButton(f1, "Edit"); + fEditMatrix->Associate(this); + f1->AddFrame(fEditMatrix, new TGLayoutHints(kLHintsRight, 2, 2, 2, 5)); + AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 5)); + + // 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); + fCancel = new TGTextButton(f23, "&Cancel"); + f23->AddFrame(fCancel, new TGLayoutHints(kLHintsCenterX, 2, 2, 4, 4)); + fCancel->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, 2, 2, 6, 6)); + fUndo->SetSize(fCancel->GetSize()); + fApply->SetSize(fCancel->GetSize()); + + // Initialize layout + MapSubwindows(); + Layout(); + MapWindow(); + + TClass *cl = TGeoNode::Class(); + TGedElement *ge = new TGedElement; + ge->fGedFrame = this; + ge->fCanvas = 0; + cl->GetEditorList()->Add(ge); +} + +//______________________________________________________________________________ +TGeoNodeEditor::~TGeoNodeEditor() +{ +// Destructor + TGFrameElement *el; + TIter next(GetList()); + + while ((el = (TGFrameElement *)next())) { + if (!strcmp(el->fFrame->ClassName(), "TGCompositeFrame")) + ((TGCompositeFrame *)el->fFrame)->Cleanup(); + } + Cleanup(); + TClass *cl = TGeoNode::Class(); + TIter next1(cl->GetEditorList()); + TGedElement *ge; + while ((ge=(TGedElement*)next1())) { + if (ge->fGedFrame==this) { + cl->GetEditorList()->Remove(ge); + delete ge; + next1.Reset(); + } + } +} + +//______________________________________________________________________________ +void TGeoNodeEditor::ConnectSignals2Slots() +{ + // Connect signals to slots. + fApply->Connect("Clicked()", "TGeoNodeEditor", this, "DoApply()"); + fCancel->Connect("Clicked()", "TGeoNodeEditor", this, "DoCancel()"); + fUndo->Connect("Clicked()", "TGeoNodeEditor", this, "DoUndo()"); + fEditMother->Connect("Clicked()", "TGeoNodeEditor", this, "DoEditMother()"); + fEditVolume->Connect("Clicked()", "TGeoNodeEditor", this, "DoEditVolume()"); + fEditMatrix->Connect("Clicked()", "TGeoNodeEditor", this, "DoEditMatrix()"); + fNodeName->Connect("TextChanged(const char *)", "TGeoNodeEditor", this, "DoNodeName()"); + fInit = kFALSE; +} + + +//______________________________________________________________________________ +void TGeoNodeEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t /*event*/) +{ + // Connect to the picked volume. + if (obj == 0 || !obj->InheritsFrom(TGeoNode::Class())) { + SetActive(kFALSE); + return; + } + fModel = obj; + fPad = pad; + fNode = (TGeoNode*)fModel; + const char *sname = fNode->GetName(); + fNodeName->SetText(sname); + + fNodeNumber->SetNumber(fNode->GetNumber()); + + TGeoVolume *vol; + TObjArray *list = gGeoManager->GetListOfVolumes(); + Int_t nobj = list->GetEntriesFast(); + Int_t i, icrt1=0, icrt2=0; + for (i=0; i<nobj; i++) { + vol = (TGeoVolume*)list->At(i); + if (fNode->GetMotherVolume() == vol) icrt1 = i; + if (fNode->GetVolume() == vol) icrt2 = i; + } + fMotherVolList->Select(icrt1); + fVolList->Select(icrt2); + + list = gGeoManager->GetListOfMatrices(); + nobj = list->GetEntriesFast(); + TGeoMatrix *matrix; + icrt1 = 1; + for (i=0; i<nobj; i++) { + matrix = (TGeoMatrix*)list->At(i); + if (fNode->GetMatrix() == matrix) icrt1 = i; + } + fMatrixList->Select(icrt1); + + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); + + if (fInit) ConnectSignals2Slots(); + SetActive(); +} + +//______________________________________________________________________________ +void TGeoNodeEditor::DoEditMother() +{ +// Edit the mother volume. + fTabMgr->SetEnabled(TGeoTabManager::kTabVolume); + fTabMgr->GetVolumeEditor(fNode->GetMotherVolume()); + fTabMgr->SetTab(TGeoTabManager::kTabVolume); +} + +//______________________________________________________________________________ +void TGeoNodeEditor::DoEditVolume() +{ +// Edit selected volume. + fTabMgr->SetEnabled(TGeoTabManager::kTabVolume); + fTabMgr->GetVolumeEditor(fNode->GetVolume()); + fTabMgr->SetTab(TGeoTabManager::kTabVolume); +} + +//______________________________________________________________________________ +void TGeoNodeEditor::DoEditMatrix() +{ +// Edit selected material. +// fTabMgr->SetEnabled(TGeoTabManager::kTabMatrix); + fTabMgr->GetMatrixEditor(fNode->GetMatrix()); +// fTabMgr->SetTab(TGeoTabManager::kTabMatrix); +} + +//______________________________________________________________________________ +void TGeoNodeEditor::DoNodeName() +{ +// Change node name. + const char *name = fNodeName->GetText(); + if (!strlen(name) || !strcmp(name, fNode->GetName())) return; + fNode->SetName(name); +} + +//______________________________________________________________________________ +void TGeoNodeEditor::DoNodeNumber() +{ +// Change node copy number + +} + +//______________________________________________________________________________ +void TGeoNodeEditor::DoVolumeSelect() +{ +} + +//______________________________________________________________________________ +void TGeoNodeEditor::DoMotherVolumeSelect() +{ +} + +//______________________________________________________________________________ +void TGeoNodeEditor::DoMatrixSelect() +{ +} + +//______________________________________________________________________________ +void TGeoNodeEditor::DoApply() +{ +} + +//______________________________________________________________________________ +void TGeoNodeEditor::DoCancel() +{ +} + +//______________________________________________________________________________ +void TGeoNodeEditor::DoUndo() +{ +} + diff --git a/geombuilder/src/TGeoSphereEditor.cxx b/geombuilder/src/TGeoSphereEditor.cxx new file mode 100644 index 0000000000000000000000000000000000000000..389571e99eb1d5c95afc9f03a5280df3feea7693 --- /dev/null +++ b/geombuilder/src/TGeoSphereEditor.cxx @@ -0,0 +1,461 @@ +// @(#):$Name: $:$Id: 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. * + *************************************************************************/ + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoSphereEditor // +// // +////////////////////////////////////////////////////////////////////////// + +#include "TGeoSphereEditor.h" +#include "TGeoTabManager.h" +#include "TGeoSphere.h" +#include "TGeoManager.h" +#include "TVirtualGeoPainter.h" +#include "TPad.h" +#include "TView.h" +#include "TGTab.h" +#include "TGComboBox.h" +#include "TGButton.h" +#include "TGTextEntry.h" +#include "TGNumberEntry.h" +#include "TGLabel.h" +#include "TGDoubleSlider.h" + +ClassImp(TGeoSphereEditor) + +enum ETGeoSphereWid { + kSPHERE_NAME, kSPHERE_RMIN, kSPHERE_RMAX, kSPHERE_THETA1, + kSPHERE_THETA2, kSPHERE_PHI1, kSPHERE_PHI2, kSPHERE_PHI, kSPHERE_THETA, + kSPHERE_APPLY, kSPHERE_CANCEL, kSPHERE_UNDO +}; + +//______________________________________________________________________________ +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 + fShape = 0; + fRmini = fRmaxi = fTheta1i = fTheta2i = fPhi1i = fPhi2i = 0.0; + fNamei = ""; + fIsModified = kFALSE; + fIsShapeEditable = kTRUE; + fLock = kFALSE; + + fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); + + // TextEntry for shape name + MakeTitle("Name"); + fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kSPHERE_NAME); + fShapeName->Resize(135, fShapeName->GetDefaultHeight()); + fShapeName->SetToolTipText("Enter the sphere name"); + fShapeName->Associate(this); + AddFrame(fShapeName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5)); + + TGTextEntry *nef; + MakeTitle("Sphere dimensions"); + TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame); + // Number entry for rmin + TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "Rmin"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fERmin = new TGNumberEntry(f1, 0., 5, kSPHERE_RMIN); + fERmin->SetNumAttr(TGNumberFormat::kNEANonNegative); + nef = (TGTextEntry*)fERmin->GetNumberEntry(); + nef->SetToolTipText("Enter the inner radius"); + fERmin->Associate(this); + fERmin->Resize(100, fERmin->GetDefaultHeight()); + f1->AddFrame(fERmin, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + // Number entry for Rmax + f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "Rmax"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fERmax = new TGNumberEntry(f1, 0., 5, kSPHERE_RMAX); + fERmax->SetNumAttr(TGNumberFormat::kNEANonNegative); + nef = (TGTextEntry*)fERmax->GetNumberEntry(); + nef->SetToolTipText("Enter the outer radius"); + fERmax->Associate(this); + fERmax->Resize(100, fERmax->GetDefaultHeight()); + f1->AddFrame(fERmax, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2)); + + MakeTitle("Phi/theta range"); + TGCompositeFrame *f11 = new TGCompositeFrame(this, 150,200, kHorizontalFrame); + compxyz = new TGCompositeFrame(f11, 75, 200, kHorizontalFrame | kRaisedFrame); + // Vertical slider + fSPhi = new TGDoubleVSlider(compxyz,140); + fSPhi->SetRange(0.,720.); + compxyz->AddFrame(fSPhi, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 2, 2, 4, 4)); + f1 = new TGCompositeFrame(compxyz, 50, 200, kVerticalFrame); + f1->AddFrame(new TGLabel(f1, "Phi min."), new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 2, 2)); + fEPhi1 = new TGNumberEntry(f1, 0., 5, kSPHERE_PHI1); + fEPhi1->Resize(30, fEPhi1->GetDefaultHeight()); + fEPhi1->SetNumAttr(TGNumberFormat::kNEANonNegative); + nef = (TGTextEntry*)fEPhi1->GetNumberEntry(); + nef->SetToolTipText("Enter the phi1 value"); + fEPhi1->Associate(this); + f1->AddFrame(fEPhi1, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2)); + + fEPhi2 = new TGNumberEntry(f1, 0., 5, kSPHERE_PHI2); + fEPhi2->Resize(30, fEPhi2->GetDefaultHeight()); + fEPhi2->SetNumAttr(TGNumberFormat::kNEANonNegative); + nef = (TGTextEntry*)fEPhi2->GetNumberEntry(); + nef->SetToolTipText("Enter the phi2 value"); + fEPhi2->Associate(this); + fEPhi2->Resize(30, fEPhi2->GetDefaultHeight()); + f1->AddFrame(fEPhi2, new TGLayoutHints(kLHintsBottom | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2)); + f1->AddFrame(new TGLabel(f1, "Phi max."), new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2)); + + compxyz->Resize(75,150); + f11->AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 0,0,0,0)); + + compxyz = new TGCompositeFrame(f11, 75, 200, kHorizontalFrame | kRaisedFrame); + // Vertical slider + fSTheta = new TGDoubleVSlider(compxyz,140); + fSTheta->SetRange(0.,180.); + compxyz->AddFrame(fSTheta, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 2, 2, 4, 4)); + f1 = new TGCompositeFrame(compxyz, 50, 200, kVerticalFrame); + f1->AddFrame(new TGLabel(f1, "Theta min."), new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 2, 2)); + fETheta1 = new TGNumberEntry(f1, 0., 5, kSPHERE_THETA1); + fETheta1->Resize(30, fETheta1->GetDefaultHeight()); + fETheta1->SetNumAttr(TGNumberFormat::kNEANonNegative); + nef = (TGTextEntry*)fETheta1->GetNumberEntry(); + nef->SetToolTipText("Enter the theta1 value"); + fETheta1->Associate(this); + f1->AddFrame(fETheta1, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2)); + + fETheta2 = new TGNumberEntry(f1, 0., 5, kSPHERE_THETA2); + fETheta2->Resize(30, fETheta2->GetDefaultHeight()); + fETheta2->SetNumAttr(TGNumberFormat::kNEANonNegative); + nef = (TGTextEntry*)fETheta2->GetNumberEntry(); + nef->SetToolTipText("Enter the theta2 value"); + fETheta2->Associate(this); + f1->AddFrame(fETheta2, new TGLayoutHints(kLHintsBottom | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2)); + f1->AddFrame(new TGLabel(f1, "Theta max."), new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2)); + + compxyz->Resize(75,150); + f11->AddFrame(compxyz, new TGLayoutHints(kLHintsRight, 0, 0, 0, 0)); + + AddFrame(f11, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0)); + + // Buttons + TGCompositeFrame *f23 = new TGCompositeFrame(this, 118, 20, kHorizontalFrame | kSunkenFrame); + fApply = new TGTextButton(f23, "Apply"); + f23->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4)); + fApply->Associate(this); + fCancel = new TGTextButton(f23, "Cancel"); + f23->AddFrame(fCancel, new TGLayoutHints(kLHintsCenterX, 2, 2, 4, 4)); + fCancel->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 = TGeoSphere::Class(); + TGedElement *ge = new TGedElement; + ge->fGedFrame = this; + ge->fCanvas = 0; + cl->GetEditorList()->Add(ge); +} + +//______________________________________________________________________________ +TGeoSphereEditor::~TGeoSphereEditor() +{ +// Destructor + TGFrameElement *el; + TIter next(GetList()); + + while ((el = (TGFrameElement *)next())) { + if (!strcmp(el->fFrame->ClassName(), "TGCompositeFrame")) + ((TGCompositeFrame *)el->fFrame)->Cleanup(); + } + Cleanup(); + TClass *cl = TGeoSphere::Class(); + TIter next1(cl->GetEditorList()); + TGedElement *ge; + while ((ge=(TGedElement*)next1())) { + if (ge->fGedFrame==this) { + cl->GetEditorList()->Remove(ge); + delete ge; + next1.Reset(); + } + } +} + +//______________________________________________________________________________ +void TGeoSphereEditor::ConnectSignals2Slots() +{ + // Connect signals to slots. + fApply->Connect("Clicked()", "TGeoSphereEditor", this, "DoApply()"); + fCancel->Connect("Clicked()", "TGeoSphereEditor", this, "DoCancel()"); + fUndo->Connect("Clicked()", "TGeoSphereEditor", this, "DoUndo()"); + fShapeName->Connect("TextChanged(const char *)", "TGeoSphereEditor", this, "DoModified()"); + fERmin->Connect("ValueSet(Long_t)", "TGeoSphereEditor", this, "DoRmin()"); + fERmax->Connect("ValueSet(Long_t)", "TGeoSphereEditor", this, "DoRmax()"); + fEPhi1->Connect("ValueSet(Long_t)", "TGeoSphereEditor", this, "DoPhi1()"); + fEPhi2->Connect("ValueSet(Long_t)", "TGeoSphereEditor", this, "DoPhi2()"); + fETheta1->Connect("ValueSet(Long_t)", "TGeoSphereEditor", this, "DoTheta1()"); + fETheta2->Connect("ValueSet(Long_t)", "TGeoSphereEditor", this, "DoTheta2()"); + fSPhi->Connect("PositionChanged()", "TGeoSphereEditor", this, "DoPhi()"); + fSTheta->Connect("PositionChanged()", "TGeoSphereEditor", this, "DoTheta()"); + fInit = kFALSE; +} + + +//______________________________________________________________________________ +void TGeoSphereEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +{ + // Connect to the picked volume. + if (obj == 0 || (obj->IsA()!=TGeoSphere::Class())) { + SetActive(kFALSE); + return; + } + fModel = obj; + fPad = pad; + fShape = (TGeoSphere*)fModel; + fRmini = fShape->GetRmin(); + fRmaxi = fShape->GetRmax(); + fPhi1i = fShape->GetPhi1(); + fPhi2i = fShape->GetPhi2(); + fTheta1i = fShape->GetTheta1(); + fTheta2i = fShape->GetTheta2(); + fNamei = fShape->GetName(); + fShapeName->SetText(fShape->GetName()); + fERmin->SetNumber(fRmini); + fERmax->SetNumber(fRmaxi); + fEPhi1->SetNumber(fPhi1i); + fEPhi2->SetNumber(fPhi2i); + fETheta1->SetNumber(fTheta1i); + fETheta2->SetNumber(fTheta2i); + fSPhi->SetPosition(fPhi1i, fPhi2i); + fSTheta->SetPosition(fTheta1i, fTheta2i); + + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); + + if (fInit) ConnectSignals2Slots(); + SetActive(); +} + +//______________________________________________________________________________ +void TGeoSphereEditor::DoName() +{ + DoModified(); +} + +//______________________________________________________________________________ +void TGeoSphereEditor::DoApply() +{ + const char *name = fShapeName->GetText(); + if (strcmp(name,fShape->GetName())) { + fShape->SetName(name); +// Int_t id = gGeoManager->GetListOfShapes()->IndexOf(fShape); +// fTabMgr->UpdateShape(id); + } + Double_t rmin = fERmin->GetNumber(); + Double_t rmax = fERmax->GetNumber(); + Double_t phi1 = fEPhi1->GetNumber(); + Double_t phi2 = fEPhi2->GetNumber(); + if ((phi2-phi1) > 360.) { + phi1 = 0.; + phi2 = 360.; + fEPhi1->SetNumber(phi1); + fEPhi2->SetNumber(phi2); + fLock = kTRUE; + fSPhi->SetPosition(phi1,phi2); + fLock = kFALSE; + } + Double_t theta1 = fETheta1->GetNumber(); + Double_t theta2 = fETheta2->GetNumber(); + fShape->SetSphDimensions(rmin, rmax, theta1,theta2,phi1,phi2); + fShape->ComputeBBox(); + fUndo->SetEnabled(); + fCancel->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); + if (fPad) { + if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) { + fShape->Draw(); + fPad->GetView()->ShowAxis(); + } else { + fPad->Modified(); + fPad->Update(); + } + } +} + +//______________________________________________________________________________ +void TGeoSphereEditor::DoCancel() +{ + fShapeName->SetText(fNamei.Data()); + fERmin->SetNumber(fRmini); + fERmax->SetNumber(fRmaxi); + fEPhi1->SetNumber(fPhi1i); + fEPhi2->SetNumber(fPhi2i); + fSPhi->SetPosition(fPhi1i,fPhi2i); + fETheta1->SetNumber(fTheta1i); + fETheta2->SetNumber(fTheta2i); + fSTheta->SetPosition(fTheta1i,fTheta2i); + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoSphereEditor::DoModified() +{ + fApply->SetEnabled(); + if (fUndo->GetState()==kButtonDisabled) fCancel->SetEnabled(); +} + +//______________________________________________________________________________ +void TGeoSphereEditor::DoUndo() +{ + DoCancel(); + DoApply(); + fCancel->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoSphereEditor::DoRmin() +{ + Double_t rmin = fERmin->GetNumber(); + Double_t rmax = fERmax->GetNumber(); + if (rmax<rmin+1.e-10) { + rmax = rmin + 0.1; + fERmax->SetNumber(rmax); + } + DoModified(); +} + +//______________________________________________________________________________ +void TGeoSphereEditor::DoRmax() +{ + Double_t rmin = fERmin->GetNumber(); + Double_t rmax = fERmax->GetNumber(); + if (rmax<rmin+1.e-10) { + rmin = rmax - 0.1; + if (rmin < 0.) rmin = 0.; + fERmin->SetNumber(rmin); + } + DoModified(); +} + +//______________________________________________________________________________ +void TGeoSphereEditor::DoPhi1() +{ + Double_t phi1 = fEPhi1->GetNumber(); + Double_t phi2 = fEPhi2->GetNumber(); + if (phi1 > 360-1.e-10) { + phi1 = 0.; + fEPhi1->SetNumber(phi1); + } + if (phi2<phi1+1.e-10) { + phi1 = phi2 - 0.1; + fEPhi1->SetNumber(phi1); + } + if (!fLock) { + DoModified(); + fLock = kTRUE; + fSPhi->SetPosition(phi1,phi2); + } else fLock = kFALSE; +} + +//______________________________________________________________________________ +void TGeoSphereEditor::DoPhi2() +{ + Double_t phi1 = fEPhi1->GetNumber(); + Double_t phi2 = fEPhi2->GetNumber(); + if (phi2-phi1 > 360.) { + phi2 -= 360.; + fEPhi2->SetNumber(phi2); + } + if (phi2<phi1+1.e-10) { + phi2 = phi1 + 0.1; + fEPhi2->SetNumber(phi2); + } + if (!fLock) { + DoModified(); + fLock = kTRUE; + fSPhi->SetPosition(phi1,phi2); + } else fLock = kFALSE; +} + +//______________________________________________________________________________ +void TGeoSphereEditor::DoPhi() +{ + if (!fLock) { + DoModified(); + fLock = kTRUE; + fEPhi1->SetNumber(fSPhi->GetMinPosition()); + fLock = kTRUE; + fEPhi2->SetNumber(fSPhi->GetMaxPosition()); + } else fLock = kFALSE; +} + +//______________________________________________________________________________ +void TGeoSphereEditor::DoTheta1() +{ + Double_t theta1 = fETheta1->GetNumber(); + Double_t theta2 = fETheta2->GetNumber(); + if (theta2<theta1+1.e-10) { + theta2 = theta1 + 0.1; + fETheta2->SetNumber(theta2); + } + if (!fLock) { + DoModified(); + fLock = kTRUE; + fSTheta->SetPosition(theta1,theta2); + } else fLock = kFALSE; +} + +//______________________________________________________________________________ +void TGeoSphereEditor::DoTheta2() +{ + Double_t theta1 = fETheta1->GetNumber(); + Double_t theta2 = fETheta2->GetNumber(); + if (theta2<theta1+1.e-10) { + theta1 = theta2 - 0.1; + fETheta1->SetNumber(theta1); + } + if (!fLock) { + DoModified(); + fLock = kTRUE; + fSTheta->SetPosition(theta1,theta2); + } else fLock = kFALSE; +} + +//______________________________________________________________________________ +void TGeoSphereEditor::DoTheta() +{ + if (!fLock) { + DoModified(); + fLock = kTRUE; + fETheta1->SetNumber(fSTheta->GetMinPosition()); + fLock = kTRUE; + fETheta2->SetNumber(fSTheta->GetMaxPosition()); + } else fLock = kFALSE; +} diff --git a/geombuilder/src/TGeoTabManager.cxx b/geombuilder/src/TGeoTabManager.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0c933ff099021bf3d6e6a944f136078378f63968 --- /dev/null +++ b/geombuilder/src/TGeoTabManager.cxx @@ -0,0 +1,952 @@ +// @(#):$Name: $:$Id: 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. * + *************************************************************************/ + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoTabManager // +// // +////////////////////////////////////////////////////////////////////////// + +#include "TVirtualPad.h" +#include "TGedFrame.h" +#include "TGTab.h" +#include "TGLabel.h" +#include "TGComboBox.h" +#include "TGListBox.h" +#include "TGListTree.h" +#include "TGTextEntry.h" +#include "TGCanvas.h" +#include "TGMimeTypes.h" + +#include "TGeoManager.h" +#include "TGeoShape.h" +#include "TGeoVolume.h" +#include "TGeoMedium.h" +#include "TGeoMaterial.h" +#include "TGeoMatrix.h" + +#include "TGeoTabManager.h" + +ClassImp(TGeoTabManager) + +//______________________________________________________________________________ +TGeoTabManager::TGeoTabManager(TVirtualPad *pad, TGTab *tab) +{ +// Ctor. + fPad = pad; + fTab = tab; +// fShape = 0; + fVolume = 0; +// fMedium = 0; +// fMaterial = 0; +// fMatrix = 0; + fShapeCombos = new TList(); + fShapePanel = 0; + fMediumPanel = 0; + fMaterialPanel = 0; + fMatrixPanel = 0; +// fVolumeCombos = new TList(); + fMatrixCombos = new TList(); + fMediumCombos = new TList(); + fMaterialCombos = new TList(); + CreateTabs(); + fTab->MapSubwindows(); + fTab->Layout(); + fTab->MapWindow(); +// AppendPad(); + TClass *cl = TGeoTabManager::Class(); + cl->GetEditorList()->Add(this); +} + +//______________________________________________________________________________ +TGeoTabManager::~TGeoTabManager() +{ +// Dtor. + if (fShapePanel) delete fShapePanel; + if (fMaterialPanel) delete fMaterialPanel; + if (fMatrixPanel) delete fMatrixPanel; + if (fMediumPanel) delete fMediumPanel; + delete fShapeCombos; +// delete fVolumeCombos; + delete fMatrixCombos; + delete fMediumCombos; + delete fMaterialCombos; +} + +//______________________________________________________________________________ +void TGeoTabManager::AddComboShape(TGComboBox *combo) +{ +// Add an element to the list. + fShapeCombos->Add(combo); + TIter next(gGeoManager->GetListOfShapes()); + TNamed *obj; + Int_t id = 0; + while ((obj=(TNamed*)next())) combo->AddEntry(obj->GetName(), id++); +} + +//______________________________________________________________________________ +void TGeoTabManager::AddShape(const char *name, Int_t id) +{ +// Add an element to the list. + TIter next(fShapeCombos); + TGComboBox *combo; + while ((combo=(TGComboBox*)next())) combo->AddEntry(name, id); +} + +//______________________________________________________________________________ +void TGeoTabManager::UpdateShape(Int_t id) +{ +// Update an element from the list. + TIter next(fShapeCombos); + TGComboBox *combo; + TNamed *obj = (TNamed*)gGeoManager->GetListOfShapes()->At(id); + while ((combo=(TGComboBox*)next())) { + ((TGTextLBEntry*)combo->GetListBox()->GetEntry(id))->SetText(new TGString(obj->GetName())); + } +} + +//______________________________________________________________________________ +void TGeoTabManager::AddComboMatrix(TGComboBox *combo) +{ +// Add an element to the list. + fMatrixCombos->Add(combo); + TIter next(gGeoManager->GetListOfMatrices()); + TNamed *obj; + Int_t id = 0; + while ((obj=(TNamed*)next())) combo->AddEntry(obj->GetName(), id++); +} + +//______________________________________________________________________________ +void TGeoTabManager::AddMatrix(const char *name, Int_t id) +{ +// Add an element to the list. + TIter next(fMatrixCombos); + TGComboBox *combo; + while ((combo=(TGComboBox*)next())) combo->AddEntry(name, id); +} + +//______________________________________________________________________________ +void TGeoTabManager::UpdateMatrix(Int_t id) +{ +// Update an element from the list. + TIter next(fMatrixCombos); + TGComboBox *combo; + TNamed *obj = (TNamed*)gGeoManager->GetListOfMatrices()->At(id); + while ((combo=(TGComboBox*)next())) { + ((TGTextLBEntry*)combo->GetListBox()->GetEntry(id))->SetText(new TGString(obj->GetName())); + } +} + +//______________________________________________________________________________ +void TGeoTabManager::AddComboMedium(TGComboBox *combo) +{ +// Add an element to the list. + fMediumCombos->Add(combo); + TIter next(gGeoManager->GetListOfMedia()); + TNamed *obj; + Int_t id = 0; + while ((obj=(TNamed*)next())) combo->AddEntry(obj->GetName(), id++); +} + +//______________________________________________________________________________ +void TGeoTabManager::AddMedium(const char *name, Int_t id) +{ +// Add an element to the list. + TIter next(fMediumCombos); + TGComboBox *combo; + while ((combo=(TGComboBox*)next())) combo->AddEntry(name, id); +} + +//______________________________________________________________________________ +void TGeoTabManager::UpdateMedium(Int_t id) +{ +// Update an element from the list. + TIter next(fMediumCombos); + TGComboBox *combo; + TNamed *obj = (TNamed*)gGeoManager->GetListOfMedia()->At(id); + while ((combo=(TGComboBox*)next())) { + ((TGTextLBEntry*)combo->GetListBox()->GetEntry(id))->SetText(new TGString(obj->GetName())); + } +} + +//______________________________________________________________________________ +void TGeoTabManager::AddComboMaterial(TGComboBox *combo) +{ +// Add an element to the list. + fMaterialCombos->Add(combo); + TIter next(gGeoManager->GetListOfMaterials()); + TNamed *obj; + Int_t id = 0; + while ((obj=(TNamed*)next())) combo->AddEntry(obj->GetName(), id++); +} + +//______________________________________________________________________________ +void TGeoTabManager::AddMaterial(const char *name, Int_t id) +{ +// Add an element to the list. + TIter next(fMaterialCombos); + TGComboBox *combo; + while ((combo=(TGComboBox*)next())) combo->AddEntry(name, id); +} + +//______________________________________________________________________________ +void TGeoTabManager::UpdateMaterial(Int_t id) +{ +// Update an element from the list. + TIter next(fMaterialCombos); + TGComboBox *combo; + TNamed *obj = (TNamed*)gGeoManager->GetListOfMaterials()->At(id); + while ((combo=(TGComboBox*)next())) { + ((TGTextLBEntry*)combo->GetListBox()->GetEntry(id))->SetText(new TGString(obj->GetName())); + } +} + +//______________________________________________________________________________ +void TGeoTabManager::CreateTabs() +{ +// Create all needed tab elements. + fVolumeCont = fTab->AddTab("Volume"); + fVolumeTab = new TGCompositeFrame(fVolumeCont, 110, 30, kVerticalFrame); + fVolumeCont->AddFrame(fVolumeTab, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 2, 2)); + fTab->SetEnabled(GetTabIndex(kTabVolume), kFALSE); +} + +//______________________________________________________________________________ +void TGeoTabManager::GetShapeEditor(TGeoShape *shape) +{ +// Get editor for a shape. + if (!shape) return; + if (!fShapePanel) fShapePanel = new TGeoTransientPanel("Shape", shape); + else { + fShapePanel->SetModel(shape); + fShapePanel->Show(); + } +} + +//______________________________________________________________________________ +void TGeoTabManager::GetVolumeEditor(TGeoVolume *volume) +{ +// Get editor for a volume. + if (!volume || !fVolumeTab) return; + GetEditors(TAttLine::Class(), fVolumeTab); + GetEditors(TGeoVolume::Class(), fVolumeTab); + SetModel(kTabVolume, volume, 0); +} + +//______________________________________________________________________________ +void TGeoTabManager::GetMatrixEditor(TGeoMatrix *matrix) +{ +// Get editor for a matrix. + if (!matrix) return; + if (!fMatrixPanel) fMatrixPanel = new TGeoTransientPanel("Matrix", matrix); + else { + fMatrixPanel->SetModel(matrix); + fMatrixPanel->Show(); + } +} + +//______________________________________________________________________________ +void TGeoTabManager::GetMediumEditor(TGeoMedium *medium) +{ +// Get editor for a medium. + if (!medium) return; + if (!fMediumPanel) fMediumPanel = new TGeoTransientPanel("Medium", medium); + else { + fMediumPanel->SetModel(medium); + fMediumPanel->Show(); + } +} + +//______________________________________________________________________________ +void TGeoTabManager::GetMaterialEditor(TGeoMaterial *material) +{ +// Get editor for a material. + if (!material) return; + if (!fMaterialPanel) fMaterialPanel = new TGeoTransientPanel("Material", material); + else { + fMaterialPanel->SetModel(material); + fMaterialPanel->Show(); + } +} + +//______________________________________________________________________________ +void TGeoTabManager::GetEditors(TClass *cl, TGCompositeFrame *style) +{ +// Get editor for a class. + // Look in TClass::GetEditorList() for any object deriving from TGedFrame, + static Int_t icount = 0; + TGedElement *ge; + TList *list = cl->GetEditorList(); + TIter next1(list); + // Iterate existing editors for class "cl" + while ((ge = (TGedElement *) next1())) { + // check if the editor ge->fGedframe is already in the list of style + if (ge->fCanvas != (TObject*)fPad->GetCanvas()) continue; + TGedFrame *f = ge->fGedFrame; + TList *l = style->GetList(); + TGFrameElement *fr; + TIter next(l); + // Iterate all ged frames in style + while ((fr = (TGFrameElement *) next())) + if (fr->fFrame->InheritsFrom(f->ClassName())) return; + } + TClass *class2, *class3; + class2 = gROOT->GetClass(Form("%sEditor",cl->GetName())); + if (class2 && class2->InheritsFrom(TGedFrame::Class())) { + list = style->GetList(); + TGFrameElement *fr; + TIter next(list); + while ((fr = (TGFrameElement *) next())) if (fr->fFrame->IsA() == class2) return; + gROOT->ProcessLine(Form("((TGCompositeFrame *)0x%lx)->AddFrame(new %s((TGWindow *)0x%lx, %d),\ + new TGLayoutHints(kLHintsTop | kLHintsExpandX,0, 0, 2, 2))",\ + (Long_t)style, class2->GetName(), (Long_t)style, 3000+icount)); + class3 = (TClass*)gROOT->GetListOfClasses()->FindObject(cl->GetName()); + TIter next3(class3->GetEditorList()); + while ((ge = (TGedElement *)next3())) { + if (!strcmp(ge->fGedFrame->ClassName(), class2->GetName()) && (ge->fCanvas == 0)) { + ge->fCanvas = (TObject*)fPad->GetCanvas(); + } + } + } +} + +//______________________________________________________________________________ +TGeoTabManager *TGeoTabManager::GetMakeTabManager(TVirtualPad *pad, TGTab *tab) +{ +// Static method to return the tab manager currently appended to the pad or create one +// if not existing. + if (!pad) return NULL; + // search for a tab manager in the list of primitives appended to ther pad + TClass *cl = TGeoTabManager::Class(); + TIter next(cl->GetEditorList()); + TGeoTabManager *tabmgr; + while ((tabmgr=(TGeoTabManager*)next())) { + if (tabmgr->GetPad()==pad /*&& tabmgr->GetTab()==tab*/) return tabmgr; + } + // tab manager not found -> create one + tabmgr = new TGeoTabManager(pad,tab); + return tabmgr; +} + +//______________________________________________________________________________ +Int_t TGeoTabManager::GetTabIndex(EGeoTabType type) const +{ +// Get index for a given tab element. + Int_t ntabs = fTab->GetNumberOfTabs(); + TString tabname; + switch (type) { + case kTabVolume: + tabname = "Volume"; + break; + default: + return 0; + } + + TGTabElement *tel; + for (Int_t i=0; i<ntabs; i++) { + tel = fTab->GetTabTab(i); + if (tel && !strcmp(tel->GetString(),tabname.Data())) return i; + } + return 0; +} + +//______________________________________________________________________________ +void TGeoTabManager::SetEnabled(EGeoTabType type, Bool_t flag) +{ +// Enable/disable tabs + fTab->SetEnabled(GetTabIndex(type), flag); +} + +//______________________________________________________________________________ +void TGeoTabManager::SetModel(EGeoTabType type, TObject *model, Int_t event) +{ +// Send the SetModel signal to all editors in the tab TYPE. + TGCompositeFrame *tab; + switch (type) { + case kTabVolume: + tab = fVolumeTab; + fVolume = (TGeoVolume*)model; + break; + default: + tab = (TGCompositeFrame*)((TGFrameElement*)fTab->GetTabContainer(0)->GetList()->At(0))->fFrame; + } + TGFrameElement *el; + TIter next(tab->GetList()); + while ((el = (TGFrameElement *) next())) { + if ((el->fFrame)->InheritsFrom(TGedFrame::Class())) { + ((TGedFrame *)(el->fFrame))->SetModel(fPad, model, event); + } + } + tab->MapSubwindows(); +} + +//______________________________________________________________________________ +void TGeoTabManager::SetTab(EGeoTabType type) +{ +// Set a given tab element as active one. + fTab->SetTab(GetTabIndex(type)); +} + +ClassImp(TGeoTreeDialog) + +TObject *TGeoTreeDialog::fgSelectedObj = 0; + +//______________________________________________________________________________ +TGeoTreeDialog::TGeoTreeDialog(TGFrame *caller, const TGWindow *main, UInt_t w, UInt_t h) + :TGTransientFrame(main, main, w, h) +{ +// Ctor + fgSelectedObj = 0; + TGCanvas *tgcv = new TGCanvas(this, 100, 200, kSunkenFrame | kDoubleBorder); + fLT = new TGListTree(tgcv->GetViewPort(), 100, 200); + fLT->Associate(this); + tgcv->SetContainer(fLT); + AddFrame(tgcv, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 2,2,2,2)); + TGCompositeFrame *f1 = new TGCompositeFrame(this, 100, 10, kHorizontalFrame | kLHintsExpandX); + fObjLabel = new TGLabel(f1, "Selected: -none-"); + Pixel_t color; + gClient->GetColorByName("#0000ff", color); + fObjLabel->SetTextColor(color); + fObjLabel->ChangeOptions(kSunkenFrame | kDoubleBorder); + f1->AddFrame(fObjLabel, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 2,2,2,2)); + fClose = new TGTextButton(f1, "&Close"); + f1->AddFrame(fClose, new TGLayoutHints(kLHintsRight, 2,2,2,2)); + AddFrame(f1, new TGLayoutHints(kLHintsBottom | kLHintsExpandX, 2,2,2,2)); + + Int_t ww = caller->GetWidth(); + Window_t wdum; + Int_t ax, ay; + gVirtualX->TranslateCoordinates(caller->GetId(), main->GetId(), 0,0,ax,ay,wdum); + Move(ax + ww, ay); + SetWMPosition(ax, ay); + + MapSubwindows(); + Layout(); + MapWindow(); +} + +//______________________________________________________________________________ +TGeoTreeDialog::~TGeoTreeDialog() +{ +// Dtor +} + +//______________________________________________________________________________ +void TGeoTreeDialog::DoSelect(TGListTreeItem *item) +{ +// Update dialog to reflect current clicked object. + static char name[256]; + if (!item || !item->GetUserData()) { + fgSelectedObj = 0; + if (!strcmp(name, "Selected: -none-")) return; + sprintf(name,"Selected: -none-"); + fObjLabel->SetText(name); + } + fgSelectedObj = (TObject *)item->GetUserData(); + if (fgSelectedObj) { + sprintf(name, "Selected %s", fgSelectedObj->GetName()); + fObjLabel->SetText(name); + } +} + +ClassImp(TGeoVolumeDialog) + +//______________________________________________________________________________ +TGeoVolumeDialog::TGeoVolumeDialog(TGFrame *caller, const TGWindow *main, UInt_t w, UInt_t h) + :TGeoTreeDialog(caller, main, w, h) +{ +// Ctor. + SetCleanup(kDeepCleanup); + BuildListTree(); + ConnectSignalsToSlots(); + gClient->WaitFor(this); +} + +//______________________________________________________________________________ +void TGeoVolumeDialog::BuildListTree() +{ +// Build volume specific list tree. + const TGPicture *pic_fld = gClient->GetPicture("folder_t.xpm"); + const TGPicture *pic_fldo = gClient->GetPicture("ofolder_t.xpm"); + const TGPicture *pic_file = gClient->GetPicture("mdi_default.xpm"); + const TGPicture *pic_fileo = gClient->GetPicture("fileopen.xpm"); + TGListTreeItem *parent_item=0; + TGeoVolume *parent_vol = gGeoManager->GetMasterVolume(); + TGeoVolume *vol; + // Existing volume hierarchy + parent_item = fLT->AddItem(parent_item, "Volume hierarchy", pic_fldo, pic_fld); + parent_item->SetTipText("Select a volume from the existing hierarchy"); + fLT->OpenItem(parent_item); + if (parent_vol) { + if (!parent_vol->GetNdaughters()) { + parent_item = fLT->AddItem(parent_item, parent_vol->GetName(), parent_vol, pic_fileo, pic_file); + parent_item->SetTipText("Master volume"); + fLT->SetSelected(parent_item); + } else { + parent_item = fLT->AddItem(parent_item, parent_vol->GetName(), parent_vol, pic_fldo, pic_fld); + parent_item->SetTipText("Master volume"); + fLT->SetSelected(parent_item); + } + } + parent_item = fLT->AddItem(NULL, "Other volumes", pic_fldo, pic_fld); + parent_item->SetTipText("Select a volume from the list of unconnected volumes"); + TIter next1(gGeoManager->GetListOfVolumes()); + Bool_t found = kFALSE; + while ((vol=(TGeoVolume*)next1())) { + if (vol->IsAdded()) continue; + fLT->AddItem(parent_item, vol->GetName(), vol, pic_fileo, pic_file); + found = kTRUE; + } + if (found) { +// fLT->OpenItem(parent_item); + if (!parent_vol) fLT->SetSelected(parent_item->GetFirstChild()); + } +} + +//______________________________________________________________________________ +void TGeoVolumeDialog::DoClose() +{ +// Handle close button. + DeleteWindow(); +} + +//______________________________________________________________________________ +void TGeoVolumeDialog::DoItemClick(TGListTreeItem *item, Int_t btn) +{ +// Handle item click. + // Iterate daughters + if (btn!=kButton1) return; + DoSelect(item); + if (!item || !item->GetUserData()) return; + const TGPicture *pic_fld = gClient->GetPicture("folder_t.xpm"); + const TGPicture *pic_fldo = gClient->GetPicture("ofolder_t.xpm"); + const TGPicture *pic_file = gClient->GetPicture("mdi_default.xpm"); + const TGPicture *pic_fileo = gClient->GetPicture("fileopen.xpm"); + TGeoVolume *parent_vol = (TGeoVolume*)item->GetUserData(); + TGeoVolume *vol; + TGeoNode *crtnode; + TGListTreeItem *daughter_item; + Int_t i,j,ind,icopy; + Int_t nd = parent_vol->GetNdaughters(); + for (i=0; i<nd; i++) { + icopy = 0; + crtnode = parent_vol->GetNode(i); + vol = crtnode->GetVolume(); + // check if the volume is replicated in the parent + ind = parent_vol->GetIndex(crtnode); + for (j=0; j<ind; j++) if (parent_vol->GetNode(j)->GetVolume() == vol) break; + if (i<ind) continue; + icopy++; + for (j=ind+1; j<nd; j++) if (parent_vol->GetNode(j)->GetVolume() == vol) icopy++; + daughter_item = fLT->AddItem(item, ((icopy>1)?Form("%s (%i)",vol->GetName(),icopy):vol->GetName()), + vol,((vol->GetNdaughters())?pic_fldo:pic_fileo), ((vol->GetNdaughters())?pic_fld:pic_file)); + if (strlen(vol->GetTitle())) daughter_item->SetTipText(vol->GetTitle()); + } + if (nd) gClient->NeedRedraw(fLT); +} + +//______________________________________________________________________________ +void TGeoVolumeDialog::ConnectSignalsToSlots() +{ +// Connect signals to slots. + fClose->Connect("Clicked()", "TGeoVolumeDialog", this, "DoClose()"); + fLT->Connect("Clicked(TGListTreeItem *, Int_t)", "TGeoVolumeDialog", this, + "DoItemClick(TGListTreeItem *, Int_t)"); +} + +ClassImp(TGeoShapeDialog) + +//______________________________________________________________________________ +TGeoShapeDialog::TGeoShapeDialog(TGFrame *caller, const TGWindow *main, UInt_t w, UInt_t h) + :TGeoTreeDialog(caller, main, w, h) +{ +// Ctor. + SetCleanup(kDeepCleanup); + BuildListTree(); + ConnectSignalsToSlots(); + gClient->WaitFor(this); +} + +//______________________________________________________________________________ +void TGeoShapeDialog::BuildListTree() +{ +// Build shape specific list tree. + const TGPicture *pic_fld = gClient->GetPicture("folder_t.xpm"); + const TGPicture *pic_fldo = gClient->GetPicture("ofolder_t.xpm"); + const TGPicture *pic_shape; + TGListTreeItem *parent_item=0; + TGeoShape *shape; + const char *shapename; + TString fld_name; + Int_t nshapes = gGeoManager->GetListOfShapes()->GetEntriesFast(); + if (!nshapes) return; + // Existing shapes + for (Int_t i=0; i<nshapes; i++) { + shape = (TGeoShape*)gGeoManager->GetListOfShapes()->At(i); + shapename = shape->IsA()->GetName(); + pic_shape = fClient->GetMimeTypeList()->GetIcon(shapename, kTRUE); + fld_name = shapename; // e.g. "TGeoBBox" + fld_name.Remove(0,4); // remove "TGeo" part -> "BBox" + fld_name += " Shapes"; + parent_item = fLT->FindChildByName(NULL, fld_name.Data()); + if (!parent_item) { + parent_item = fLT->AddItem(NULL, fld_name.Data(), pic_fldo, pic_fld); + parent_item->SetTipText(Form("List of %s shapes",fld_name.Data())); + } + fLT->AddItem(parent_item, shape->GetName(), shape, pic_shape, pic_shape); + } +} + +//______________________________________________________________________________ +void TGeoShapeDialog::DoClose() +{ +// Handle close button. + DeleteWindow(); +} + +//______________________________________________________________________________ +void TGeoShapeDialog::DoItemClick(TGListTreeItem *item, Int_t btn) +{ +// Handle item click. + // Iterate daughters + if (btn!=kButton1) return; + DoSelect(item); + if (!item || !item->GetUserData()) return; + //gClient->NeedRedraw(fLT); +} + +//______________________________________________________________________________ +void TGeoShapeDialog::ConnectSignalsToSlots() +{ +// Connect signals to slots. + fClose->Connect("Clicked()", "TGeoShapeDialog", this, "DoClose()"); + fLT->Connect("Clicked(TGListTreeItem *, Int_t)", "TGeoShapeDialog", this, + "DoItemClick(TGListTreeItem *, Int_t)"); +} + +ClassImp(TGeoMediumDialog) + +//______________________________________________________________________________ +TGeoMediumDialog::TGeoMediumDialog(TGFrame *caller, const TGWindow *main, UInt_t w, UInt_t h) + :TGeoTreeDialog(caller, main, w, h) +{ +// Ctor. + SetCleanup(kDeepCleanup); + BuildListTree(); + ConnectSignalsToSlots(); + gClient->WaitFor(this); +} + +//______________________________________________________________________________ +void TGeoMediumDialog::BuildListTree() +{ +// Build volume specific list tree. + const TGPicture *pic_med = gClient->GetPicture("geomedium_t.xpm");; + TGeoMedium *med; + Int_t nmed = gGeoManager->GetListOfMedia()->GetSize(); + if (!nmed) return; + // Existing media + for (Int_t i=0; i<nmed; i++) { + med = (TGeoMedium*)gGeoManager->GetListOfMedia()->At(i); + fLT->AddItem(NULL, med->GetName(), med, pic_med, pic_med); + } +} + +//______________________________________________________________________________ +void TGeoMediumDialog::DoClose() +{ +// Handle close button. + DeleteWindow(); +} + +//______________________________________________________________________________ +void TGeoMediumDialog::DoItemClick(TGListTreeItem *item, Int_t btn) +{ +// Handle item click. + // Iterate daughters + if (btn!=kButton1) return; + DoSelect(item); + if (!item || !item->GetUserData()) return; + //gClient->NeedRedraw(fLT); +} + +//______________________________________________________________________________ +void TGeoMediumDialog::ConnectSignalsToSlots() +{ +// Connect signals to slots. + fClose->Connect("Clicked()", "TGeoMediumDialog", this, "DoClose()"); + fLT->Connect("Clicked(TGListTreeItem *, Int_t)", "TGeoMediumDialog", this, + "DoItemClick(TGListTreeItem *, Int_t)"); +} + +ClassImp(TGeoMaterialDialog) + +//______________________________________________________________________________ +TGeoMaterialDialog::TGeoMaterialDialog(TGFrame *caller, const TGWindow *main, UInt_t w, UInt_t h) + :TGeoTreeDialog(caller, main, w, h) +{ +// Ctor. + SetCleanup(kDeepCleanup); + BuildListTree(); + ConnectSignalsToSlots(); + gClient->WaitFor(this); +} + +//______________________________________________________________________________ +void TGeoMaterialDialog::BuildListTree() +{ +// Build volume specific list tree. + const TGPicture *pic_mat = gClient->GetPicture("geomaterial_t.xpm");; + TGeoMaterial *mat; + Int_t nmat = gGeoManager->GetListOfMaterials()->GetSize(); + if (!nmat) return; + // Existing materials + for (Int_t i=0; i<nmat; i++) { + mat = (TGeoMaterial*)gGeoManager->GetListOfMaterials()->At(i); + fLT->AddItem(NULL, mat->GetName(), mat, pic_mat, pic_mat); + } +} + +//______________________________________________________________________________ +void TGeoMaterialDialog::DoClose() +{ +// Handle close button. + DeleteWindow(); +} + +//______________________________________________________________________________ +void TGeoMaterialDialog::DoItemClick(TGListTreeItem *item, Int_t btn) +{ +// Handle item click. + // Iterate daughters + if (btn!=kButton1) return; + DoSelect(item); + if (!item || !item->GetUserData()) return; + //gClient->NeedRedraw(fLT); +} + +//______________________________________________________________________________ +void TGeoMaterialDialog::ConnectSignalsToSlots() +{ +// Connect signals to slots. + fClose->Connect("Clicked()", "TGeoMaterialDialog", this, "DoClose()"); + fLT->Connect("Clicked(TGListTreeItem *, Int_t)", "TGeoMaterialDialog", this, + "DoItemClick(TGListTreeItem *, Int_t)"); +} + +ClassImp(TGeoMatrixDialog) + +//______________________________________________________________________________ +TGeoMatrixDialog::TGeoMatrixDialog(TGFrame *caller, const TGWindow *main, UInt_t w, UInt_t h) + :TGeoTreeDialog(caller, main, w, h) +{ +// Ctor. + SetCleanup(kDeepCleanup); + BuildListTree(); + ConnectSignalsToSlots(); + gClient->WaitFor(this); +} + +//______________________________________________________________________________ +void TGeoMatrixDialog::BuildListTree() +{ +// Build matrix specific list tree. + const TGPicture *pic_tr = gClient->GetPicture("geotranslation_t.xpm"); + const TGPicture *pic_rot = gClient->GetPicture("georotation_t.xpm"); + const TGPicture *pic_combi = gClient->GetPicture("geocombi_t.xpm"); + const TGPicture *pic; + TGListTreeItem *parent_item=0; + TGeoMatrix *matrix; + Int_t nmat = gGeoManager->GetListOfMatrices()->GetEntriesFast(); + if (!nmat) return; + // Existing matrices + for (Int_t i=0; i<nmat; i++) { + matrix = (TGeoMatrix*)gGeoManager->GetListOfMatrices()->At(i); + if (matrix->IsIdentity()) continue; + if (!strcmp(matrix->IsA()->GetName(),"TGeoTranslation")) { + pic = pic_tr; + parent_item = fLT->FindChildByName(NULL, "Translations"); + if (!parent_item) { + parent_item = fLT->AddItem(NULL, "Translations", pic, pic); + parent_item->SetTipText("List of translations"); + } + } else if (!strcmp(matrix->IsA()->GetName(),"TGeoRotation")) { + pic = pic_rot; + parent_item = fLT->FindChildByName(NULL, "Rotations"); + if (!parent_item) { + parent_item = fLT->AddItem(NULL, "Rotations", pic, pic); + parent_item->SetTipText("List of rotations"); + } + } else if (!strcmp(matrix->IsA()->GetName(),"TGeoCombiTrans") || + !strcmp(matrix->IsA()->GetName(),"TGeoHMatrix")) { + pic = pic_combi; + parent_item = fLT->FindChildByName(NULL, "Combined"); + if (!parent_item) { + parent_item = fLT->AddItem(NULL, "Combined", pic, pic); + parent_item->SetTipText("List of combined transformations"); + } + } else continue; + fLT->AddItem(parent_item, matrix->GetName(), matrix, pic, pic); + } +} + +//______________________________________________________________________________ +void TGeoMatrixDialog::DoClose() +{ +// Handle close button. + DeleteWindow(); +} + +//______________________________________________________________________________ +void TGeoMatrixDialog::DoItemClick(TGListTreeItem *item, Int_t btn) +{ +// Handle item click. + // Iterate daughters + if (btn!=kButton1) return; + DoSelect(item); + if (!item || !item->GetUserData()) return; + //gClient->NeedRedraw(fLT); +} + +//______________________________________________________________________________ +void TGeoMatrixDialog::ConnectSignalsToSlots() +{ +// Connect signals to slots. + fClose->Connect("Clicked()", "TGeoMatrixDialog", this, "DoClose()"); + fLT->Connect("Clicked(TGListTreeItem *, Int_t)", "TGeoMatrixDialog", this, + "DoItemClick(TGListTreeItem *, Int_t)"); +} + +ClassImp(TGeoTransientPanel) + +//______________________________________________________________________________ +TGeoTransientPanel::TGeoTransientPanel(const char *name, TObject *obj) + :TGMainFrame(gClient->GetRoot(),175,20) +{ +// Transient panel ctor. + fModel = obj; + TGCanvas *can = new TGCanvas(this, 170, 100); + fTab = new TGTab(can->GetViewPort(), 10, 10); + can->SetContainer(fTab); + AddFrame(can, new TGLayoutHints(kLHintsExpandY | kLHintsExpandX)); + fTab->Associate(can); + fTabContainer = fTab->AddTab(name); + fStyle = new TGCompositeFrame(fTabContainer, 110, 30, kVerticalFrame); + fTabContainer->AddFrame(fStyle, new TGLayoutHints(kLHintsTop | kLHintsExpandX,\ + 5, 0, 2, 2)); + TString wname = name; + wname += " Editor"; + SetWindowName(wname.Data()); + SetModel(fModel); + fClose = new TGTextButton(this, "Close"); + AddFrame(fClose, new TGLayoutHints(kLHintsBottom | kLHintsRight, 0,10,5,5)); + MapSubwindows(); + Layout(); + Resize(fTabContainer->GetDefaultWidth()+30, fTabContainer->GetDefaultHeight()+65); + MapWindow(); + gROOT->GetListOfCleanups()->Add(this); + fClose->Connect("Clicked()", "TGeoTransientPanel", this, "Hide()"); +} + +//______________________________________________________________________________ +TGeoTransientPanel::~TGeoTransientPanel() +{ +// Destructor. + gROOT->GetListOfCleanups()->Remove(this); + Cleanup(); +} + +//______________________________________________________________________________ +void TGeoTransientPanel::CloseWindow() +{ + // When closed via WM close button, just unmap (i.e. hide) editor + // for later use. + UnmapWindow(); + gROOT->GetListOfCleanups()->Remove(this); +} + +//______________________________________________________________________________ +void TGeoTransientPanel::GetEditors(TClass *cl) +{ +// Get editor for a class. + // Look in TClass::GetEditorList() for any object deriving from TGedFrame, + static Int_t icount = 0; + TGedElement *ge; + TList *list = cl->GetEditorList(); + TIter next1(list); + while ((ge = (TGedElement *) next1())) { + // check if the editor ge->fGedframe is already in the list of style + if (ge->fCanvas != (TObject*)gPad->GetCanvas()) continue; + TGedFrame *f = ge->fGedFrame; + TList *l = fStyle->GetList(); + TGFrameElement *fr; + TIter next(l); + while ((fr = (TGFrameElement *) next())) + if (fr->fFrame->InheritsFrom(f->ClassName())) return; + } + TClass *class2, *class3; + class2 = gROOT->GetClass(Form("%sEditor",cl->GetName())); + if (class2 && class2->InheritsFrom(TGedFrame::Class())) { + list = fStyle->GetList(); + TGFrameElement *fr; + TIter next(list); + while ((fr = (TGFrameElement *) next())) + if (fr->fFrame->IsA() == class2) return; + gROOT->ProcessLine(Form("((TGCompositeFrame *)0x%lx)->AddFrame(new %s((TGWindow *)0x%lx, %d),\ + new TGLayoutHints(kLHintsTop | kLHintsExpandX,0, 0, 2, 2))",\ + (Long_t)fStyle, class2->GetName(), (Long_t)fStyle, 3000+icount)); + class3 = (TClass*)gROOT->GetListOfClasses()->FindObject(cl->GetName()); + TIter next3(class3->GetEditorList()); + while ((ge = (TGedElement *)next3())) { + if (!strcmp(ge->fGedFrame->ClassName(), class2->GetName()) && (ge->fCanvas == 0)) { + ge->fCanvas = (TObject*)gPad->GetCanvas(); + } + } + } +} + +//______________________________________________________________________________ +void TGeoTransientPanel::SetModel(TObject *model, Int_t event) +{ +// Update the editors in the main tab to reflect the selected object. + if (!model) return; + fModel = model; + GetEditors(model->IsA()); + TGFrameElement *el; + TIter next(fStyle->GetList()); + while ((el = (TGFrameElement *) next())) { + if ((el->fFrame)->InheritsFrom(TGedFrame::Class())) { + ((TGedFrame *)(el->fFrame))->SetModel(gPad, model, event); + } + } + Resize(fTabContainer->GetDefaultWidth()+30, fTabContainer->GetDefaultHeight()+65); +} + +//______________________________________________________________________________ +void TGeoTransientPanel::Hide() +{ +// Hide the transient frame + UnmapWindow(); +} + +//______________________________________________________________________________ +void TGeoTransientPanel::Show() +{ +// Hide the transient frame + MapWindow(); +} + +//______________________________________________________________________________ +void TGeoTransientPanel::DeleteEditors() +{ +} + + diff --git a/geombuilder/src/TGeoTrd1Editor.cxx b/geombuilder/src/TGeoTrd1Editor.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9bfee77a90fe290a75a90055e49754b2e9078bd8 --- /dev/null +++ b/geombuilder/src/TGeoTrd1Editor.cxx @@ -0,0 +1,314 @@ +// @(#):$Name: $:$Id: 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. * + *************************************************************************/ + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoTrd1Editor // +// // +////////////////////////////////////////////////////////////////////////// + +#include "TGeoTrd1Editor.h" +#include "TGeoTabManager.h" +#include "TGeoTrd1.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(TGeoTrd1Editor) + +enum ETGeoTrd1Wid { + kTRD1_NAME, kTRD1_X1, kTRD1_X2, kTRD1_Y, kTRD1_Z, + kTRD1_APPLY, kTRD1_CANCEL, kTRD1_UNDO +}; + +//______________________________________________________________________________ +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 + fShape = 0; + fDxi1 = fDxi2 = fDyi = fDzi = 0.0; + fNamei = ""; + fIsModified = kFALSE; + fIsShapeEditable = kFALSE; + + fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); + + // TextEntry for shape name + MakeTitle("Name"); + fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kTRD1_NAME); + fShapeName->Resize(135, fShapeName->GetDefaultHeight()); + fShapeName->SetToolTipText("Enter the box name"); + fShapeName->Associate(this); + AddFrame(fShapeName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5)); + + TGTextEntry *nef; + MakeTitle("Trd1 dimensions"); + TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame | kDoubleBorder); + + // Number entry for dx1 + TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "DX1"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fEDx1 = new TGNumberEntry(f1, 0., 5, kTRD1_X1); + fEDx1->SetNumAttr(TGNumberFormat::kNEAPositive); + nef = (TGTextEntry*)fEDx1->GetNumberEntry(); + nef->SetToolTipText("Enter the half-lenth in X1"); + fEDx1->Associate(this); + f1->AddFrame(fEDx1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + // Number entry for dx2 + f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "DX2"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fEDx2 = new TGNumberEntry(f1, 0., 5, kTRD1_X2); + fEDx2->SetNumAttr(TGNumberFormat::kNEAPositive); + nef = (TGTextEntry*)fEDx2->GetNumberEntry(); + nef->SetToolTipText("Enter the half-lenth in X2"); + fEDx2->Associate(this); + f1->AddFrame(fEDx2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + // Number entry for dy + TGCompositeFrame *f2 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f2->AddFrame(new TGLabel(f2, "DY"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fEDy = new TGNumberEntry(f2, 0., 5, kTRD1_Y); + fEDy->SetNumAttr(TGNumberFormat::kNEAPositive); + nef = (TGTextEntry*)fEDy->GetNumberEntry(); + nef->SetToolTipText("Enter the half-lenth in Y"); + fEDy->Associate(this); + f2->AddFrame(fEDy, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + compxyz->AddFrame(f2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + // Number entry for dz + TGCompositeFrame *f3 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f3->AddFrame(new TGLabel(f3, "DZ"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fEDz = new TGNumberEntry(f3, 0., 5, kTRD1_Z); + fEDz->SetNumAttr(TGNumberFormat::kNEAPositive); + nef = (TGTextEntry*)fEDz->GetNumberEntry(); + nef->SetToolTipText("Enter the half-lenth in Z"); + fEDz->Associate(this); + f3->AddFrame(fEDz, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + compxyz->AddFrame(f3, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + compxyz->Resize(150,30); + AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 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); + fCancel = new TGTextButton(f23, "&Cancel"); + f23->AddFrame(fCancel, new TGLayoutHints(kLHintsCenterX, 2, 2, 4, 4)); + fCancel->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 = TGeoTrd1::Class(); + TGedElement *ge = new TGedElement; + ge->fGedFrame = this; + ge->fCanvas = 0; + cl->GetEditorList()->Add(ge); +} + +//______________________________________________________________________________ +TGeoTrd1Editor::~TGeoTrd1Editor() +{ +// Destructor + TGFrameElement *el; + TIter next(GetList()); + + while ((el = (TGFrameElement *)next())) { + if (!strcmp(el->fFrame->ClassName(), "TGCompositeFrame")) + ((TGCompositeFrame *)el->fFrame)->Cleanup(); + } + Cleanup(); + TClass *cl = TGeoTrd1::Class(); + TIter next1(cl->GetEditorList()); + TGedElement *ge; + while ((ge=(TGedElement*)next1())) { + if (ge->fGedFrame==this) { + cl->GetEditorList()->Remove(ge); + delete ge; + next1.Reset(); + } + } +} + +//______________________________________________________________________________ +void TGeoTrd1Editor::ConnectSignals2Slots() +{ + // Connect signals to slots. + fApply->Connect("Clicked()", "TGeoTrd1Editor", this, "DoApply()"); + fCancel->Connect("Clicked()", "TGeoTrd1Editor", this, "DoCancel()"); + fUndo->Connect("Clicked()", "TGeoTrd1Editor", this, "DoUndo()"); + fShapeName->Connect("TextChanged(const char *)", "TGeoTrd1Editor", this, "DoModified()"); + fEDx1->Connect("ValueSet(Long_t)", "TGeoTrd1Editor", this, "DoDx1()"); + fEDx2->Connect("ValueSet(Long_t)", "TGeoTrd1Editor", this, "DoDx2()"); + fEDy->Connect("ValueSet(Long_t)", "TGeoTrd1Editor", this, "DoDy()"); + fEDz->Connect("ValueSet(Long_t)", "TGeoTrd1Editor", this, "DoDz()"); + fEDx1->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrd1Editor", this, "DoModified()"); + fEDx2->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrd1Editor", this, "DoModified()"); + fEDy->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrd1Editor", this, "DoModified()"); + fEDz->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrd1Editor", this, "DoModified()"); + fInit = kFALSE; +} + + +//______________________________________________________________________________ +void TGeoTrd1Editor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +{ + // Connect to the picked volume. + if (obj == 0 || (obj->IsA()!=TGeoTrd1::Class())) { + SetActive(kFALSE); + return; + } + fModel = obj; + fPad = pad; + fShape = (TGeoTrd1*)fModel; + fDxi1 = fShape->GetDx1(); + fDxi2 = fShape->GetDx2(); + fDyi = fShape->GetDy(); + fDzi = fShape->GetDz(); + const char *sname = fShape->GetName(); + if (!strcmp(sname, fShape->ClassName())) fShapeName->SetText("-no_name"); + else { + fShapeName->SetText(sname); + fNamei = sname; + } + fEDx1->SetNumber(fDxi1); + fEDx2->SetNumber(fDxi2); + fEDy->SetNumber(fDyi); + fEDz->SetNumber(fDzi); + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); + + if (fInit) ConnectSignals2Slots(); + SetActive(); +} + +//______________________________________________________________________________ +void TGeoTrd1Editor::DoName() +{ + DoModified(); +} + +//______________________________________________________________________________ +void TGeoTrd1Editor::DoApply() +{ + const char *name = fShapeName->GetText(); + if (strcmp(name,fShape->GetName())) { + fShape->SetName(name); + Int_t id = gGeoManager->GetListOfShapes()->IndexOf(fShape); + fTabMgr->UpdateShape(id); + } + Double_t dx1 = fEDx1->GetNumber(); + Double_t dx2 = fEDx2->GetNumber(); + Double_t dy = fEDy->GetNumber(); + Double_t dz = fEDz->GetNumber(); + Double_t param[4]; + param[0] = dx1; + param[1] = dx2; + param[2] = dy; + param[3] = dz; + fShape->SetDimensions(param); + fShape->ComputeBBox(); + fUndo->SetEnabled(); + fCancel->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); + if (fPad) { + if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) { + fShape->Draw(); + fPad->GetView()->ShowAxis(); + } else { + fPad->Modified(); + fPad->Update(); + } + } +} + +//______________________________________________________________________________ +void TGeoTrd1Editor::DoCancel() +{ + fShapeName->SetText(fNamei.Data()); + fEDx1->SetNumber(fDxi1); + fEDx2->SetNumber(fDxi2); + fEDy->SetNumber(fDyi); + fEDz->SetNumber(fDzi); + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoTrd1Editor::DoModified() +{ + fApply->SetEnabled(); + if (fUndo->GetState()==kButtonDisabled) fCancel->SetEnabled(); +} + +//______________________________________________________________________________ +void TGeoTrd1Editor::DoUndo() +{ + DoCancel(); + DoApply(); + fCancel->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoTrd1Editor::DoDx1() +{ + DoModified(); +} + +//______________________________________________________________________________ +void TGeoTrd1Editor::DoDx2() +{ + DoModified(); +} + +//______________________________________________________________________________ +void TGeoTrd1Editor::DoDy() +{ + DoModified(); +} + +//______________________________________________________________________________ +void TGeoTrd1Editor::DoDz() +{ + DoModified(); +} + + diff --git a/geombuilder/src/TGeoTrd2Editor.cxx b/geombuilder/src/TGeoTrd2Editor.cxx new file mode 100644 index 0000000000000000000000000000000000000000..cf5951e763fa98570c56250a827e00441fbdb82e --- /dev/null +++ b/geombuilder/src/TGeoTrd2Editor.cxx @@ -0,0 +1,339 @@ +// @(#):$Name: $:$Id: 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. * + *************************************************************************/ + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoTrd2Editor // +// // +////////////////////////////////////////////////////////////////////////// + +#include "TGeoTrd2Editor.h" +#include "TGeoTabManager.h" +#include "TGeoTrd2.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(TGeoTrd2Editor) + +enum ETGeoTrd2Wid { + kTRD2_NAME, kTRD2_X1, kTRD2_X2, kTRD2_Y1, kTRD2_Y2, kTRD2_Z, + kTRD2_APPLY, kTRD2_CANCEL, kTRD2_UNDO +}; + +//______________________________________________________________________________ +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 + fShape = 0; + fDxi1 = fDxi2 = fDyi1 = fDyi2 = fDzi = 0.0; + fNamei = ""; + fIsModified = kFALSE; + fIsShapeEditable = kFALSE; + + fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); + + // TextEntry for shape name + MakeTitle("Name"); + fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kTRD2_NAME); + fShapeName->Resize(135, fShapeName->GetDefaultHeight()); + fShapeName->SetToolTipText("Enter the box name"); + fShapeName->Associate(this); + AddFrame(fShapeName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5)); + + TGTextEntry *nef; + MakeTitle("Trd2 dimensions"); + TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame | kDoubleBorder); + + // Number entry for dx1 + TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "DX1"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fEDx1 = new TGNumberEntry(f1, 0., 5, kTRD2_X1); + fEDx1->SetNumAttr(TGNumberFormat::kNEAPositive); + nef = (TGTextEntry*)fEDx1->GetNumberEntry(); + nef->SetToolTipText("Enter the half-lenth in X1"); + fEDx1->Associate(this); + f1->AddFrame(fEDx1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + // Number entry for dx2 + f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "DX2"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fEDx2 = new TGNumberEntry(f1, 0., 5, kTRD2_X2); + fEDx2->SetNumAttr(TGNumberFormat::kNEAPositive); + nef = (TGTextEntry*)fEDx2->GetNumberEntry(); + nef->SetToolTipText("Enter the half-lenth in X2"); + fEDx2->Associate(this); + f1->AddFrame(fEDx2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + // Number entry for dy1 + TGCompositeFrame *f2 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f2->AddFrame(new TGLabel(f2, "DY1"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fEDy1 = new TGNumberEntry(f2, 0., 5, kTRD2_Y1); + fEDy1->SetNumAttr(TGNumberFormat::kNEAPositive); + nef = (TGTextEntry*)fEDy1->GetNumberEntry(); + nef->SetToolTipText("Enter the half-lenth in Y1"); + fEDy1->Associate(this); + f2->AddFrame(fEDy1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + compxyz->AddFrame(f2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + // Number entry for dy2 + f2 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f2->AddFrame(new TGLabel(f2, "DY2"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fEDy2 = new TGNumberEntry(f2, 0., 5, kTRD2_Y2); + fEDy2->SetNumAttr(TGNumberFormat::kNEAPositive); + nef = (TGTextEntry*)fEDy2->GetNumberEntry(); + nef->SetToolTipText("Enter the half-lenth in Y2"); + fEDy2->Associate(this); + f2->AddFrame(fEDy2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + compxyz->AddFrame(f2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + // Number entry for dz + TGCompositeFrame *f3 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kFixedWidth | kOwnBackground); + f3->AddFrame(new TGLabel(f3, "DZ"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fEDz = new TGNumberEntry(f3, 0., 5, kTRD2_Z); + fEDz->SetNumAttr(TGNumberFormat::kNEAPositive); + nef = (TGTextEntry*)fEDz->GetNumberEntry(); + nef->SetToolTipText("Enter the half-lenth in Z"); + fEDz->Associate(this); + f3->AddFrame(fEDz, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + compxyz->AddFrame(f3, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + compxyz->Resize(150,30); + AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 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); + fCancel = new TGTextButton(f23, "&Cancel"); + f23->AddFrame(fCancel, new TGLayoutHints(kLHintsCenterX, 2, 2, 4, 4)); + fCancel->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 = TGeoTrd2::Class(); + TGedElement *ge = new TGedElement; + ge->fGedFrame = this; + ge->fCanvas = 0; + cl->GetEditorList()->Add(ge); +} + +//______________________________________________________________________________ +TGeoTrd2Editor::~TGeoTrd2Editor() +{ +// Destructor + TGFrameElement *el; + TIter next(GetList()); + + while ((el = (TGFrameElement *)next())) { + if (!strcmp(el->fFrame->ClassName(), "TGCompositeFrame")) + ((TGCompositeFrame *)el->fFrame)->Cleanup(); + } + Cleanup(); + TClass *cl = TGeoTrd2::Class(); + TIter next1(cl->GetEditorList()); + TGedElement *ge; + while ((ge=(TGedElement*)next1())) { + if (ge->fGedFrame==this) { + cl->GetEditorList()->Remove(ge); + delete ge; + next1.Reset(); + } + } +} + +//______________________________________________________________________________ +void TGeoTrd2Editor::ConnectSignals2Slots() +{ + // Connect signals to slots. + fApply->Connect("Clicked()", "TGeoTrd2Editor", this, "DoApply()"); + fCancel->Connect("Clicked()", "TGeoTrd2Editor", this, "DoCancel()"); + fUndo->Connect("Clicked()", "TGeoTrd2Editor", this, "DoUndo()"); + fShapeName->Connect("TextChanged(const char *)", "TGeoTrd2Editor", this, "DoModified()"); + fEDx1->Connect("ValueSet(Long_t)", "TGeoTrd2Editor", this, "DoDx1()"); + fEDx2->Connect("ValueSet(Long_t)", "TGeoTrd2Editor", this, "DoDx2()"); + fEDy1->Connect("ValueSet(Long_t)", "TGeoTrd2Editor", this, "DoDy1()"); + fEDy2->Connect("ValueSet(Long_t)", "TGeoTrd2Editor", this, "DoDy2()"); + fEDz->Connect("ValueSet(Long_t)", "TGeoTrd2Editor", this, "DoDz()"); + fEDx1->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrd2Editor", this, "DoModified()"); + fEDx2->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrd2Editor", this, "DoModified()"); + fEDy1->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrd2Editor", this, "DoModified()"); + fEDy2->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrd2Editor", this, "DoModified()"); + fEDz->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrd2Editor", this, "DoModified()"); + fInit = kFALSE; +} + + +//______________________________________________________________________________ +void TGeoTrd2Editor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +{ + // Connect to the picked volume. + if (obj == 0 || (obj->IsA()!=TGeoTrd2::Class())) { + SetActive(kFALSE); + return; + } + fModel = obj; + fPad = pad; + fShape = (TGeoTrd2*)fModel; + fDxi1 = fShape->GetDx1(); + fDxi2 = fShape->GetDx2(); + fDyi1 = fShape->GetDy1(); + fDyi2 = fShape->GetDy2(); + fDzi = fShape->GetDz(); + const char *sname = fShape->GetName(); + if (!strcmp(sname, fShape->ClassName())) fShapeName->SetText("-no_name"); + else { + fShapeName->SetText(sname); + fNamei = sname; + } + fEDx1->SetNumber(fDxi1); + fEDx2->SetNumber(fDxi2); + fEDy1->SetNumber(fDyi1); + fEDy2->SetNumber(fDyi2); + fEDz->SetNumber(fDzi); + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); + + if (fInit) ConnectSignals2Slots(); + SetActive(); +} + +//______________________________________________________________________________ +void TGeoTrd2Editor::DoName() +{ + DoModified(); +} + +//______________________________________________________________________________ +void TGeoTrd2Editor::DoApply() +{ + const char *name = fShapeName->GetText(); + if (strcmp(name,fShape->GetName())) { + fShape->SetName(name); + Int_t id = gGeoManager->GetListOfShapes()->IndexOf(fShape); + fTabMgr->UpdateShape(id); + } + Double_t dx1 = fEDx1->GetNumber(); + Double_t dx2 = fEDx2->GetNumber(); + Double_t dy1 = fEDy1->GetNumber(); + Double_t dy2 = fEDy2->GetNumber(); + Double_t dz = fEDz->GetNumber(); + Double_t param[5]; + param[0] = dx1; + param[1] = dx2; + param[2] = dy1; + param[3] = dy2; + param[4] = dz; + fShape->SetDimensions(param); + fShape->ComputeBBox(); + fUndo->SetEnabled(); + fCancel->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); + if (fPad) { + if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) { + fShape->Draw(); + fPad->GetView()->ShowAxis(); + } else { + fPad->Modified(); + fPad->Update(); + } + } +} + +//______________________________________________________________________________ +void TGeoTrd2Editor::DoCancel() +{ + fShapeName->SetText(fNamei.Data()); + fEDx1->SetNumber(fDxi1); + fEDx2->SetNumber(fDxi2); + fEDy1->SetNumber(fDyi1); + fEDy2->SetNumber(fDyi2); + fEDz->SetNumber(fDzi); + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoTrd2Editor::DoModified() +{ + fApply->SetEnabled(); + if (fUndo->GetState()==kButtonDisabled) fCancel->SetEnabled(); +} + +//______________________________________________________________________________ +void TGeoTrd2Editor::DoUndo() +{ + DoCancel(); + DoApply(); + fCancel->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoTrd2Editor::DoDx1() +{ + DoModified(); +} + +//______________________________________________________________________________ +void TGeoTrd2Editor::DoDx2() +{ + DoModified(); +} + +//______________________________________________________________________________ +void TGeoTrd2Editor::DoDy1() +{ + DoModified(); +} + +//______________________________________________________________________________ +void TGeoTrd2Editor::DoDy2() +{ + DoModified(); +} + +//______________________________________________________________________________ +void TGeoTrd2Editor::DoDz() +{ + DoModified(); +} + + diff --git a/geombuilder/src/TGeoTubeEditor.cxx b/geombuilder/src/TGeoTubeEditor.cxx new file mode 100644 index 0000000000000000000000000000000000000000..163ca810d8f8ae4ec1a6ae1b886bf6d68e08bc52 --- /dev/null +++ b/geombuilder/src/TGeoTubeEditor.cxx @@ -0,0 +1,542 @@ +// @(#):$Name: $:$Id: 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. * + *************************************************************************/ + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoTubeEditor // +// // +////////////////////////////////////////////////////////////////////////// + +#include "TGeoTubeEditor.h" +#include "TGeoTabManager.h" +#include "TGeoTube.h" +#include "TGeoManager.h" +#include "TVirtualGeoPainter.h" +#include "TPad.h" +#include "TView.h" +#include "TGTab.h" +#include "TGComboBox.h" +#include "TGButton.h" +#include "TGTextEntry.h" +#include "TGNumberEntry.h" +#include "TGLabel.h" +#include "TGDoubleSlider.h" + +ClassImp(TGeoTubeEditor) + +enum ETGeoTubeWid { + kTUBE_NAME, kTUBE_RMIN, kTUBE_RMAX, kTUBE_Z, + kTUBE_APPLY, kTUBE_CANCEL, kTUBE_UNDO +}; + +//______________________________________________________________________________ +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 + fShape = 0; + fRmini = fRmaxi = fDzi = 0.0; + fNamei = ""; + fIsModified = kFALSE; + fIsShapeEditable = kTRUE; + + fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); + + // TextEntry for shape name + MakeTitle("Name"); + fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kTUBE_NAME); + fShapeName->Resize(135, fShapeName->GetDefaultHeight()); + fShapeName->SetToolTipText("Enter the box name"); + fShapeName->Associate(this); + AddFrame(fShapeName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5)); + + TGTextEntry *nef; + MakeTitle("Tube dimensions"); + TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame); + // Number entry for rmin + TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "Rmin"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fERmin = new TGNumberEntry(f1, 0., 5, kTUBE_RMIN); + fERmin->SetNumAttr(TGNumberFormat::kNEANonNegative); + nef = (TGTextEntry*)fERmin->GetNumberEntry(); + nef->SetToolTipText("Enter the inner radius"); + fERmin->Associate(this); + fERmin->Resize(100,fERmin->GetDefaultHeight()); + f1->AddFrame(fERmin, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + // Number entry for Rmax + f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "Rmax"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fERmax = new TGNumberEntry(f1, 0., 5, kTUBE_RMAX); + fERmax->SetNumAttr(TGNumberFormat::kNEANonNegative); + nef = (TGTextEntry*)fERmax->GetNumberEntry(); + nef->SetToolTipText("Enter the outer radius"); + fERmax->Associate(this); + fERmax->Resize(100,fERmax->GetDefaultHeight()); + f1->AddFrame(fERmax, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + // Number entry for dz + f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame | + kLHintsExpandX | kOwnBackground); + f1->AddFrame(new TGLabel(f1, "DZ"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fEDz = new TGNumberEntry(f1, 0., 5, kTUBE_Z); + fEDz->SetNumAttr(TGNumberFormat::kNEAPositive); + nef = (TGTextEntry*)fEDz->GetNumberEntry(); + nef->SetToolTipText("Enter the tube half-lenth in Z"); + fEDz->Associate(this); + fEDz->Resize(100,fEDz->GetDefaultHeight()); + f1->AddFrame(fEDz, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); + + compxyz->Resize(150,30); + AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); + + // Buttons + TGCompositeFrame *f23 = new TGCompositeFrame(this, 118, 20, kHorizontalFrame | kSunkenFrame); + fApply = new TGTextButton(f23, "Apply"); + f23->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4)); + fApply->Associate(this); + fCancel = new TGTextButton(f23, "Cancel"); + f23->AddFrame(fCancel, new TGLayoutHints(kLHintsCenterX, 2, 2, 4, 4)); + fCancel->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 = TGeoTube::Class(); + TGedElement *ge = new TGedElement; + ge->fGedFrame = this; + ge->fCanvas = 0; + cl->GetEditorList()->Add(ge); +} + +//______________________________________________________________________________ +TGeoTubeEditor::~TGeoTubeEditor() +{ +// Destructor + TGFrameElement *el; + TIter next(GetList()); + + while ((el = (TGFrameElement *)next())) { + if (!strcmp(el->fFrame->ClassName(), "TGCompositeFrame")) + ((TGCompositeFrame *)el->fFrame)->Cleanup(); + } + Cleanup(); + TClass *cl = TGeoTube::Class(); + TIter next1(cl->GetEditorList()); + TGedElement *ge; + while ((ge=(TGedElement*)next1())) { + if (ge->fGedFrame==this) { + cl->GetEditorList()->Remove(ge); + delete ge; + next1.Reset(); + } + } +} + +//______________________________________________________________________________ +void TGeoTubeEditor::ConnectSignals2Slots() +{ + // Connect signals to slots. + fApply->Connect("Clicked()", "TGeoTubeEditor", this, "DoApply()"); + fCancel->Connect("Clicked()", "TGeoTubeEditor", this, "DoCancel()"); + fUndo->Connect("Clicked()", "TGeoTubeEditor", this, "DoUndo()"); + fShapeName->Connect("TextChanged(const char *)", "TGeoTubeEditor", this, "DoModified()"); + fERmin->Connect("ValueSet(Long_t)", "TGeoTubeEditor", this, "DoRmin()"); + fERmax->Connect("ValueSet(Long_t)", "TGeoTubeEditor", this, "DoRmax()"); + fEDz->Connect("ValueSet(Long_t)", "TGeoTubeEditor", this, "DoDz()"); + fERmin->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTubeEditor", this, "DoRmin()"); + fERmax->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTubeEditor", this, "DoRmax()"); + fEDz->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTubeEditor", this, "DoDz()"); + fInit = kFALSE; +} + + +//______________________________________________________________________________ +void TGeoTubeEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +{ + // Connect to the picked volume. + if (obj == 0 || (obj->IsA()!=TGeoTube::Class())) { + SetActive(kFALSE); + return; + } + fModel = obj; + fPad = pad; + fShape = (TGeoTube*)fModel; + fRmini = fShape->GetRmin(); + fRmaxi = fShape->GetRmax(); + fDzi = fShape->GetDz(); + fNamei = fShape->GetName(); + fShapeName->SetText(fShape->GetName()); + fERmin->SetNumber(fRmini); + fERmax->SetNumber(fRmaxi); + fEDz->SetNumber(fDzi); + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); + + if (fInit) ConnectSignals2Slots(); + SetActive(); +} + +//______________________________________________________________________________ +void TGeoTubeEditor::DoName() +{ + DoModified(); +} + +//______________________________________________________________________________ +void TGeoTubeEditor::DoApply() +{ + const char *name = fShapeName->GetText(); + if (strcmp(name,fShape->GetName())) { + fShape->SetName(name); + Int_t id = gGeoManager->GetListOfShapes()->IndexOf(fShape); + fTabMgr->UpdateShape(id); + } + Double_t rmin = fERmin->GetNumber(); + Double_t rmax = fERmax->GetNumber(); + Double_t dz = fEDz->GetNumber(); + fShape->SetTubeDimensions(rmin, rmax, dz); + fShape->ComputeBBox(); + fUndo->SetEnabled(); + fCancel->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); + if (fPad) { + if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) { + fShape->Draw(); + fPad->GetView()->ShowAxis(); + } else { + fPad->Modified(); + fPad->Update(); + } + } +} + +//______________________________________________________________________________ +void TGeoTubeEditor::DoCancel() +{ + fShapeName->SetText(fNamei.Data()); + fERmin->SetNumber(fRmini); + fERmax->SetNumber(fRmaxi); + fEDz->SetNumber(fDzi); + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoTubeEditor::DoModified() +{ + fApply->SetEnabled(); + if (fUndo->GetState()==kButtonDisabled) fCancel->SetEnabled(); +} + +//______________________________________________________________________________ +void TGeoTubeEditor::DoUndo() +{ + DoCancel(); + DoApply(); + fCancel->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoTubeEditor::DoRmin() +{ + Double_t rmin = fERmin->GetNumber(); + Double_t rmax = fERmax->GetNumber(); + if (rmax<rmin+1.e-10) { + rmax = rmin + 0.1; + fERmax->SetNumber(rmax); + } + DoModified(); +} + +//______________________________________________________________________________ +void TGeoTubeEditor::DoRmax() +{ + Double_t rmin = fERmin->GetNumber(); + Double_t rmax = fERmax->GetNumber(); + if (rmax<rmin+1.e-10) { + rmin = rmax - 0.1; + if (rmin < 0.) rmin = 0.; + fERmin->SetNumber(rmin); + } + DoModified(); +} + +//______________________________________________________________________________ +void TGeoTubeEditor::DoDz() +{ + DoModified(); +} + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoTubeSegEditor // +// // +////////////////////////////////////////////////////////////////////////// + +ClassImp(TGeoTubeSegEditor) + +enum ETGeoTubeSegWid { + kTUBESEG_PHI1, kTUBESEG_PHI2, kTUBESEG_PHI +}; + +//______________________________________________________________________________ +TGeoTubeSegEditor::TGeoTubeSegEditor(const TGWindow *p, Int_t id, Int_t width, + Int_t height, UInt_t options, Pixel_t back) + : TGeoTubeEditor(p, id, width, height, options | kVerticalFrame, back) +{ + // Constructor for tube segment editor + fLock = kFALSE; + MakeTitle("Phi range"); + TGTextEntry *nef; + TGCompositeFrame *compxyz = new TGCompositeFrame(this, 155, 200, kHorizontalFrame | kRaisedFrame); + // Vertical slider + fSPhi = new TGDoubleVSlider(compxyz,140); + fSPhi->SetRange(0.,720.); + compxyz->AddFrame(fSPhi, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 2, 2, 4, 4)); + TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 100, 200, kVerticalFrame); + f1->AddFrame(new TGLabel(f1, "Phi min."), new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 2, 2)); + fEPhi1 = new TGNumberEntry(f1, 0., 5, kTUBESEG_PHI1); + fEPhi1->Resize(100, fEPhi1->GetDefaultHeight()); + fEPhi1->SetNumAttr(TGNumberFormat::kNEANonNegative); + nef = (TGTextEntry*)fEPhi1->GetNumberEntry(); + nef->SetToolTipText("Enter the phi1 value"); + fEPhi1->Associate(this); + f1->AddFrame(fEPhi1, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2)); + + fEPhi2 = new TGNumberEntry(f1, 0., 5, kTUBESEG_PHI2); + fEPhi2->Resize(100, fEPhi2->GetDefaultHeight()); + fEPhi2->SetNumAttr(TGNumberFormat::kNEANonNegative); + nef = (TGTextEntry*)fEPhi2->GetNumberEntry(); + nef->SetToolTipText("Enter the phi2 value"); + fEPhi2->Associate(this); + f1->AddFrame(fEPhi2, new TGLayoutHints(kLHintsBottom | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2)); + f1->AddFrame(new TGLabel(f1, "Phi max."), new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2)); + compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2)); + + compxyz->Resize(150,150); + AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); + + // Initialize layout + MapSubwindows(); + Layout(); + MapWindow(); + + TClass *cl = TGeoTubeSeg::Class(); + TGedElement *ge = new TGedElement; + ge->fGedFrame = this; + ge->fCanvas = 0; + cl->GetEditorList()->Add(ge); +} + +//______________________________________________________________________________ +TGeoTubeSegEditor::~TGeoTubeSegEditor() +{ +// Destructor + TGFrameElement *el; + TIter next(GetList()); + + while ((el = (TGFrameElement *)next())) { + if (!strcmp(el->fFrame->ClassName(), "TGCompositeFrame")) + ((TGCompositeFrame *)el->fFrame)->Cleanup(); + } + Cleanup(); + TClass *cl = TGeoTubeSeg::Class(); + TIter next1(cl->GetEditorList()); + TGedElement *ge; + while ((ge=(TGedElement*)next1())) { + if (ge->fGedFrame==this) { + cl->GetEditorList()->Remove(ge); + delete ge; + next1.Reset(); + } + } +} + +//______________________________________________________________________________ +void TGeoTubeSegEditor::ConnectSignals2Slots() +{ + TGeoTubeEditor::ConnectSignals2Slots(); + Disconnect(fApply, "Clicked()",(TGeoTubeEditor*)this, "DoApply()"); + Disconnect(fUndo, "Clicked()",(TGeoTubeEditor*)this, "DoUndo()"); + Disconnect(fCancel, "Clicked()",(TGeoTubeEditor*)this, "DoCancel()"); + fApply->Connect("Clicked()", "TGeoTubeSegEditor", this, "DoApply()"); + fUndo->Connect("Clicked()", "TGeoTubeSegEditor", this, "DoUndo()"); + fCancel->Connect("Clicked()", "TGeoTubeSegEditor", this, "DoCancel()"); + fEPhi1->Connect("ValueSet(Long_t)", "TGeoTubeSegEditor", this, "DoPhi1()"); + fEPhi2->Connect("ValueSet(Long_t)", "TGeoTubeSegEditor", this, "DoPhi2()"); +// fEPhi1->GetNumberEntry()->Connect("TextChanged(const char *)","TGeoTubeSegEditor", this, "DoPhi1()"); +// fEPhi2->GetNumberEntry()->Connect("TextChanged(const char *)","TGeoTubeSegEditor", this, "DoPhi2()"); + fSPhi->Connect("PositionChanged()","TGeoTubeSegEditor", this, "DoPhi()"); +} + +//______________________________________________________________________________ +void TGeoTubeSegEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +{ + // Connect to the picked volume. + if (obj == 0 || (obj->IsA()!=TGeoTubeSeg::Class())) { + SetActive(kFALSE); + return; + } + fModel = obj; + fPad = pad; + fShape = (TGeoTube*)fModel; + fRmini = fShape->GetRmin(); + fRmaxi = fShape->GetRmax(); + fDzi = fShape->GetDz(); + fNamei = fShape->GetName(); + fPmini = ((TGeoTubeSeg*)fShape)->GetPhi1(); + fPmaxi = ((TGeoTubeSeg*)fShape)->GetPhi2(); + fShapeName->SetText(fShape->GetName()); + fEPhi1->SetNumber(fPmini); + fEPhi2->SetNumber(fPmaxi); + fSPhi->SetPosition(fPmini,fPmaxi); + fERmin->SetNumber(fRmini); + fERmax->SetNumber(fRmaxi); + fEDz->SetNumber(fDzi); + fApply->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fCancel->SetEnabled(kFALSE); + + if (fInit) ConnectSignals2Slots(); + SetActive(); +} + +//______________________________________________________________________________ +void TGeoTubeSegEditor::DoPhi1() +{ + Double_t phi1 = fEPhi1->GetNumber(); + Double_t phi2 = fEPhi2->GetNumber(); + if (phi1 > 360-1.e-10) { + phi1 = 0.; + fEPhi1->SetNumber(phi1); + } + if (phi2<phi1+1.e-10) { + phi1 = phi2 - 0.1; + fEPhi1->SetNumber(phi1); + } + if (!fLock) { + DoModified(); + fLock = kTRUE; + fSPhi->SetPosition(phi1,phi2); + } else fLock = kFALSE; +} + +//______________________________________________________________________________ +void TGeoTubeSegEditor::DoPhi2() +{ + Double_t phi1 = fEPhi1->GetNumber(); + Double_t phi2 = fEPhi2->GetNumber(); + if (phi2-phi1 > 360.) { + phi2 -= 360.; + fEPhi2->SetNumber(phi2); + } + if (phi2<phi1+1.e-10) { + phi2 = phi1 + 0.1; + fEPhi2->SetNumber(phi2); + } + if (!fLock) { + DoModified(); + fLock = kTRUE; + fSPhi->SetPosition(phi1,phi2); + } else fLock = kFALSE; +} + +//______________________________________________________________________________ +void TGeoTubeSegEditor::DoPhi() +{ + if (!fLock) { + DoModified(); + fLock = kTRUE; + fEPhi1->SetNumber(fSPhi->GetMinPosition()); + fLock = kTRUE; + fEPhi2->SetNumber(fSPhi->GetMaxPosition()); + } else fLock = kFALSE; +} + +//______________________________________________________________________________ +void TGeoTubeSegEditor::DoApply() +{ + const char *name = fShapeName->GetText(); + if (strcmp(name,fShape->GetName())) { + fShape->SetName(name); + Int_t id = gGeoManager->GetListOfShapes()->IndexOf(fShape); + fTabMgr->UpdateShape(id); + } + Double_t rmin = fERmin->GetNumber(); + Double_t rmax = fERmax->GetNumber(); + Double_t dz = fEDz->GetNumber(); + Double_t phi1 = fEPhi1->GetNumber(); + Double_t phi2 = fEPhi2->GetNumber(); + if ((phi2-phi1) > 360.) { + phi1 = 0.; + phi2 = 360.; + fEPhi1->SetNumber(phi1); + fEPhi2->SetNumber(phi2); + fLock = kTRUE; + fSPhi->SetPosition(phi1,phi2); + fLock = kFALSE; + } + ((TGeoTubeSeg*)fShape)->SetTubsDimensions(rmin, rmax, dz, phi1, phi2); + fShape->ComputeBBox(); + fUndo->SetEnabled(); + fCancel->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); + if (fPad) { + if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) { + fShape->Draw(); + fPad->GetView()->ShowAxis(); + } else { + fPad->Modified(); + fPad->Update(); + } + } +} + +//______________________________________________________________________________ +void TGeoTubeSegEditor::DoUndo() +{ + DoCancel(); + DoApply(); + fCancel->SetEnabled(kFALSE); + fUndo->SetEnabled(kFALSE); + fApply->SetEnabled(kFALSE); +} + +//______________________________________________________________________________ +void TGeoTubeSegEditor::DoCancel() +{ + fEPhi1->SetNumber(fPmini); + fEPhi2->SetNumber(fPmaxi); + fSPhi->SetPosition(fPmini,fPmaxi); + TGeoTubeEditor::DoCancel(); +} + + + diff --git a/geombuilder/src/TGeoVolumeEditor.cxx b/geombuilder/src/TGeoVolumeEditor.cxx new file mode 100644 index 0000000000000000000000000000000000000000..1aeb17c9cd0867342c5f158021131d614b46222a --- /dev/null +++ b/geombuilder/src/TGeoVolumeEditor.cxx @@ -0,0 +1,914 @@ +// @(#):$Name: $:$Id: 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. * + *************************************************************************/ + +////////////////////////////////////////////////////////////////////////// +// // +// TGeoVolumeEditor // +// +////////////////////////////////////////////////////////////////////////// + +#include "TGeoVolumeEditor.h" +#include "TGeoVolume.h" +#include "TGeoPatternFinder.h" +#include "TGeoManager.h" +#include "TVirtualPad.h" +#include "TBaseClass.h" +#include "TGTab.h" +#include "TGComboBox.h" +#include "TGButton.h" +#include "TGButtonGroup.h" +#include "TGTextEntry.h" +#include "TGNumberEntry.h" +#include "TGLabel.h" +#include "TGShutter.h" +#include "TG3DLine.h" +#include "TGeoTabManager.h" + +ClassImp(TGeoVolumeEditor) + +enum ETGeoVolumeWid { + kVOL_NAME, kVOL_TITLE, kVOL_SHAPE_SELECT, kVOL_MEDIA_SELECT, kVOL_NODE_SELECT, + kVOL_VOL_SELECT, kVOL_MATRIX_SELECT, kVOL_EDIT_SHAPE, kVOL_EDIT_MEDIUM, kVOL_NODEID, + kVOL_APPLY, kVOL_CANCEL, kVOL_UNDO, kVOL_VISLEVEL, kVOL_DIVSTART, kVOL_DIVEND, + kVOL_DIVSTEP, kVOL_DIVN, kCAT_GENERAL, kCAT_DAUGHTERS, kCAT_DIVISION, kCAT_VIS, + kDIV_NAME +}; + +//______________________________________________________________________________ +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 + fGeometry = 0; + fVolume = 0; + + fIsModified = kFALSE; + fIsAssembly = kFALSE; + fIsDivided = kFALSE; + + fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); + // TGShutter for categories + fCategories = new TGShutter(this, kSunkenFrame | kFixedHeight); + TGCompositeFrame *container, *f1; + Pixel_t color; + TGLabel *label; + + // General settings + TGShutterItem *si = new TGShutterItem(fCategories, new TGHotString("Properties"),kCAT_GENERAL); + container = (TGCompositeFrame*)si->GetContainer(); + container->SetBackgroundColor(GetDefaultFrameBackground()); + fCategories->AddItem(si); + + // TextEntry for volume name + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Volume name"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); + gClient->GetColorByName("#ff0000", color); + label->SetTextColor(color); + container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0)); + fVolumeName = new TGTextEntry(container, new TGTextBuffer(50), kVOL_NAME); + fVolumeName->Resize(135, fVolumeName->GetDefaultHeight()); + fVolumeName->SetToolTipText("Enter the volume name"); + container->AddFrame(fVolumeName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5)); + + // Current shape + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Shape and medium"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); + gClient->GetColorByName("#ff0000", color); + label->SetTextColor(color); + container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 10, 0)); + f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth); + fSelectedShape = 0; + fLSelShape = new TGLabel(f1, "Select shape"); + gClient->GetColorByName("#0000ff", color); + fLSelShape->SetTextColor(color); + fLSelShape->ChangeOptions(kSunkenFrame | kDoubleBorder); + f1->AddFrame(fLSelShape, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2)); + fBSelShape = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kVOL_SHAPE_SELECT); + fBSelShape->SetToolTipText("Replace with one of the existing shapes"); + fBSelShape->Associate(this); + f1->AddFrame(fBSelShape, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2)); + fEditShape = new TGTextButton(f1, "Edit"); + f1->AddFrame(fEditShape, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2)); + fEditShape->SetToolTipText("Edit selected shape"); + fEditShape->Associate(this); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0)); + + // Current medium + f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth); + fSelectedMedium = 0; + fLSelMedium = new TGLabel(f1, "Select medium"); + gClient->GetColorByName("#0000ff", color); + fLSelMedium->SetTextColor(color); + fLSelMedium->ChangeOptions(kSunkenFrame | kDoubleBorder); + f1->AddFrame(fLSelMedium, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2)); + fBSelMedium = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kVOL_MEDIA_SELECT); + fBSelMedium->SetToolTipText("Replace with one of the existing media"); + fBSelMedium->Associate(this); + f1->AddFrame(fBSelMedium, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2)); + fEditMedium = new TGTextButton(f1, "Edit"); + f1->AddFrame(fEditMedium, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2)); + fEditMedium->SetToolTipText("Edit selected medium"); + fEditMedium->Associate(this); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0)); + + // List of daughters + si = new TGShutterItem(fCategories, new TGHotString("Daughters"),kCAT_DAUGHTERS); + container = (TGCompositeFrame*)si->GetContainer(); + container->SetBackgroundColor(GetDefaultFrameBackground()); + fCategories->AddItem(si); + + // Existing daughters + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Existing daughters"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); + gClient->GetColorByName("#ff0000", color); + label->SetTextColor(color); + container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0)); + + f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kRaisedFrame); + fNodeList = new TGComboBox(f1, kVOL_NODE_SELECT); + fNodeList->Resize(100, fVolumeName->GetDefaultHeight()); + fNodeList->Associate(this); + f1->AddFrame(fNodeList, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5)); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 2)); + // Buttons for editing matrix and removing node + f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kSunkenFrame | kFixedWidth); + fEditMatrix = new TGTextButton(f1, "Position"); + f1->AddFrame(fEditMatrix, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2)); + fEditMatrix->SetToolTipText("Edit the position of selected node"); + fEditMatrix->Associate(this); + fRemoveNode = new TGTextButton(f1, "Remove"); + f1->AddFrame(fRemoveNode, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2)); + fRemoveNode->SetToolTipText("Remove the selected node. Cannot undo !)"); + fRemoveNode->Associate(this); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 2)); + + // Adding daughters + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Add daughter"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); + gClient->GetColorByName("#ff0000", color); + label->SetTextColor(color); + container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 10, 0)); + + // Select from existing volumes + f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth); + fSelectedVolume = 0; + fLSelVolume = new TGLabel(f1, "Select volume"); + gClient->GetColorByName("#0000ff", color); + fLSelVolume->SetTextColor(color); + fLSelVolume->ChangeOptions(kSunkenFrame | kDoubleBorder); + f1->AddFrame(fLSelVolume, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2)); + fBSelVolume = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kVOL_VOL_SELECT); + fBSelVolume->SetToolTipText("Select one of the existing volumes"); + fBSelVolume->Associate(this); + f1->AddFrame(fBSelVolume, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2)); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 2)); + + // Matrix selection for nodes + f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth); + fSelectedMatrix = 0; + fLSelMatrix = new TGLabel(f1, "Select matrix"); + gClient->GetColorByName("#0000ff", color); + fLSelMatrix->SetTextColor(color); + fLSelMatrix->ChangeOptions(kSunkenFrame | kDoubleBorder); + f1->AddFrame(fLSelMatrix, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2)); + fBSelMatrix = new TGPictureButton(f1, fClient->GetPicture("rootdb_t.xpm"), kVOL_MATRIX_SELECT); + fBSelMatrix->SetToolTipText("Select one of the existing matrices"); + fBSelMatrix->Associate(this); + f1->AddFrame(fBSelMatrix, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2)); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 2)); + + // Copy number + f1 = new TGCompositeFrame(container, 155, 30, kHorizontalFrame | kFixedWidth); + f1->AddFrame(new TGLabel(f1, "Node id"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0)); + fCopyNumber = new TGNumberEntry(f1, 0., 5, kVOL_NODEID); + fCopyNumber->SetNumStyle(TGNumberFormat::kNESInteger); + fCopyNumber->SetNumAttr(TGNumberFormat::kNEANonNegative); + fCopyNumber->Resize(20,fCopyNumber->GetDefaultHeight()); + TGTextEntry *nef = (TGTextEntry*)fCopyNumber->GetNumberEntry(); + nef->SetToolTipText("Enter node copy number"); + fCopyNumber->Associate(this); + f1->AddFrame(fCopyNumber, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2)); + fAddNode = new TGTextButton(f1, "Add"); + f1->AddFrame(fAddNode, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2)); + fAddNode->Associate(this); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 2)); + + // Visualization + si = new TGShutterItem(fCategories, new TGHotString("Visualization"),kCAT_VIS); + container = (TGCompositeFrame*)si->GetContainer(); + container->SetBackgroundColor(GetDefaultFrameBackground()); + fCategories->AddItem(si); + + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Visibility"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); +// gClient->GetColorByName("#ff0000", color); +// label->SetTextColor(color); + container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0)); + + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth | kSunkenFrame | kDoubleBorder); + fBVis[0] = new TGCheckButton(f1, "Volume"); + fBVis[1] = new TGCheckButton(f1, "Nodes"); + f1->AddFrame(fBVis[0], new TGLayoutHints(kLHintsLeft, 2, 2, 0 ,0)); + f1->AddFrame(fBVis[1], new TGLayoutHints(kLHintsRight, 2, 2, 0 ,0)); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0)); + + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Depth"), new TGLayoutHints(kLHintsLeft, 2, 2, 4, 0)); +// gClient->GetColorByName("#0000ff", color); +// label->SetTextColor(color); + fEVisLevel = new TGNumberEntry(f1, 0, 5, kVOL_VISLEVEL); + fEVisLevel->SetNumStyle(TGNumberFormat::kNESInteger); + fEVisLevel->SetNumAttr(TGNumberFormat::kNEAPositive); + fEVisLevel->Resize(40,fEVisLevel->GetDefaultHeight()); + nef = (TGTextEntry*)fEVisLevel->GetNumberEntry(); + nef->SetToolTipText("Set visibility level here"); + fEVisLevel->SetNumber(3); + fEVisLevel->Associate(this); + f1->AddFrame(fEVisLevel, new TGLayoutHints(kLHintsLeft, 2, 2, 0 ,0)); + fBAuto = new TGCheckButton(f1,"Auto"); + f1->AddFrame(fBAuto, new TGLayoutHints(kLHintsRight, 0, 0, 2, 0)); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4)); + + TString stitle = "View"; + TGButtonGroup *bg = new TGVButtonGroup(container, stitle); + fBView[0] = new TGRadioButton(bg, "All"); + fBView[1] = new TGRadioButton(bg, "Leaves"); + fBView[2] = new TGRadioButton(bg, "Only"); + bg->Insert(fBView[0]); + bg->Insert(fBView[1]); + bg->Insert(fBView[2]); + container->AddFrame(bg, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0)); + + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth | kSunkenFrame | kDoubleBorder); + fBRaytrace = new TGCheckButton(f1,"Raytrace"); + f1->AddFrame(fBRaytrace, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2)); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4)); + + // Division + si = new TGShutterItem(fCategories, new TGHotString("Division"),kCAT_DIVISION); + container = (TGCompositeFrame*)si->GetContainer(); + container->SetBackgroundColor(GetDefaultFrameBackground()); + fCategories->AddItem(si); + // TextEntry for division name + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Division name"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); + gClient->GetColorByName("#ff0000", color); + label->SetTextColor(color); + container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0)); + fDivName = new TGTextEntry(container, new TGTextBuffer(50), kDIV_NAME); + fDivName->Resize(135, fVolumeName->GetDefaultHeight()); + fDivName->SetToolTipText("Enter the volume name"); + container->AddFrame(fDivName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5)); + // Axis selection + stitle = "Axis"; + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth); + bg = new TGVButtonGroup(f1, stitle); + fBDiv[0] = new TGRadioButton(bg, "Axis 1"); + fBDiv[1] = new TGRadioButton(bg, "Axis 2"); + fBDiv[2] = new TGRadioButton(bg, "Axis 3"); + bg->Insert(fBDiv[0]); + bg->Insert(fBDiv[1]); + bg->Insert(fBDiv[2]); + f1->AddFrame(bg, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0)); + fApplyDiv = new TGTextButton(f1, "Apply"); + fApplyDiv->SetToolTipText("Apply new division settings"); + f1->AddFrame(fApplyDiv, new TGLayoutHints(kLHintsRight, 0, 2, 30, 0)); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0)); + // Division range + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Division parameters"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0)); + f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7)); +// gClient->GetColorByName("#ff0000", color); +// label->SetTextColor(color); + container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0)); + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "From"), new TGLayoutHints(kLHintsLeft, 2, 2, 4, 0)); +// gClient->GetColorByName("#0000ff", color); +// label->SetTextColor(color); + fEDivFrom = new TGNumberEntry(f1, 0, 5, kVOL_DIVSTART); +// fEDivFrom->SetNumStyle(TGNumberFormat::kNESInteger); +// fEDivFrom->SetNumAttr(TGNumberFormat::kNEAPositive); + fEDivFrom->Resize(100,fEDivFrom->GetDefaultHeight()); + nef = (TGTextEntry*)fEDivFrom->GetNumberEntry(); + nef->SetToolTipText("Set start value"); + fEDivFrom->Associate(this); + f1->AddFrame(fEDivFrom, new TGLayoutHints(kLHintsRight, 2, 2, 0 ,0)); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4)); + + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame | kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Step"), new TGLayoutHints(kLHintsLeft, 2, 2, 4, 0)); +// gClient->GetColorByName("#0000ff", color); +// label->SetTextColor(color); + fEDivStep = new TGNumberEntry(f1, 0, 5, kVOL_DIVSTEP); +// fEDivFrom->SetNumStyle(TGNumberFormat::kNESInteger); + fEDivStep->SetNumAttr(TGNumberFormat::kNEANonNegative); + fEDivStep->Resize(100,fEDivStep->GetDefaultHeight()); + nef = (TGTextEntry*)fEDivStep->GetNumberEntry(); + nef->SetToolTipText("Set division step"); + fEDivStep->Associate(this); + f1->AddFrame(fEDivStep, new TGLayoutHints(kLHintsRight, 2, 2, 0 ,0)); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4)); + + f1 = new TGCompositeFrame(container, 155, 10, kHorizontalFrame |kFixedWidth); + f1->AddFrame(label = new TGLabel(f1, "Nslices"), new TGLayoutHints(kLHintsLeft, 2, 2, 4, 0)); +// gClient->GetColorByName("#0000ff", color); +// label->SetTextColor(color); + fEDivN = new TGNumberEntry(f1, 0, 5, kVOL_DIVN); + fEDivN->SetNumStyle(TGNumberFormat::kNESInteger); + fEDivN->SetNumAttr(TGNumberFormat::kNEAPositive); + fEDivN->Resize(100,fEDivN->GetDefaultHeight()); + nef = (TGTextEntry*)fEDivN->GetNumberEntry(); + nef->SetToolTipText("Set number of slices"); + fEDivN->Associate(this); + f1->AddFrame(fEDivN, new TGLayoutHints(kLHintsRight, 2, 2, 0 ,0)); + container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4)); + + + fCategories->Resize(163,340); + AddFrame(fCategories, new TGLayoutHints(kLHintsLeft, 0, 0, 4, 4)); + + // Initialize layout + MapSubwindows(); + Layout(); + MapWindow(); + + TClass *cl = TGeoVolume::Class(); + TGedElement *ge = new TGedElement; + ge->fGedFrame = this; + ge->fCanvas = 0; + cl->GetEditorList()->Add(ge); +} + +//______________________________________________________________________________ +TGeoVolumeEditor::~TGeoVolumeEditor() +{ +// Destructor + TGFrameElement *el; + TIter next(GetList()); + while ((el = (TGFrameElement *)next())) { + if (!strcmp(el->fFrame->ClassName(), "TGCompositeFrame")) + ((TGCompositeFrame *)el->fFrame)->Cleanup(); + } + Cleanup(); + TClass *cl = TGeoVolume::Class(); + TIter next1(cl->GetEditorList()); + TGedElement *ge; + while ((ge=(TGedElement*)next1())) { + if (ge->fGedFrame==this) { + cl->GetEditorList()->Remove(ge); + delete ge; + next1.Reset(); + } + } +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::ConnectSignals2Slots() +{ + // Connect signals to slots. + fVolumeName->Connect("TextChanged(const char *)", "TGeoVolumeEditor", this, "DoVolumeName()"); + fDivName->Connect("TextChanged(const char *)", "TGeoVolumeEditor", this, "DoDivName()"); + fEditMedium->Connect("Clicked()", "TGeoVolumeEditor", this, "DoEditMedium()"); + fEditShape->Connect("Clicked()", "TGeoVolumeEditor", this, "DoEditShape()"); + fEditMatrix->Connect("Clicked()", "TGeoVolumeEditor", this, "DoEditMatrix()"); + fAddNode->Connect("Clicked()", "TGeoVolumeEditor", this, "DoAddNode()"); + fRemoveNode->Connect("Clicked()", "TGeoVolumeEditor", this, "DoRemoveNode()"); + fBSelShape->Connect("Clicked()", "TGeoVolumeEditor", this, "DoSelectShape()"); + fBSelMedium->Connect("Clicked()", "TGeoVolumeEditor", this, "DoSelectMedium()"); + fBSelVolume->Connect("Clicked()", "TGeoVolumeEditor", this, "DoSelectVolume()"); + fBSelMatrix->Connect("Clicked()", "TGeoVolumeEditor", this, "DoSelectMatrix()"); + fBVis[0]->Connect("Clicked()", "TGeoVolumeEditor", this, "DoVisVolume()"); + fBVis[1]->Connect("Clicked()", "TGeoVolumeEditor", this, "DoVisDaughters()"); + fBAuto->Connect("Clicked()", "TGeoVolumeEditor", this, "DoVisAuto()"); + fEVisLevel->Connect("ValueSet(Long_t)", "TGeoVolumeEditor", this, "DoVisLevel()"); + fBView[0]->Connect("Clicked()", "TGeoVolumeEditor", this, "DoViewAll()"); + fBView[1]->Connect("Clicked()", "TGeoVolumeEditor", this, "DoViewLeaves()"); + fBView[2]->Connect("Clicked()", "TGeoVolumeEditor", this, "DoViewOnly()"); + fBDiv[0]->Connect("Clicked()", "TGeoVolumeEditor", this, "DoDivSelAxis()"); + fBDiv[1]->Connect("Clicked()", "TGeoVolumeEditor", this, "DoDivSelAxis()"); + fBDiv[2]->Connect("Clicked()", "TGeoVolumeEditor", this, "DoDivSelAxis()"); + fEDivFrom->Connect("ValueSet(Long_t)", "TGeoVolumeEditor", this, "DoDivFromTo()"); + fEDivStep->Connect("ValueSet(Long_t)", "TGeoVolumeEditor", this, "DoDivStep()"); + fEDivN->Connect("ValueSet(Long_t)", "TGeoVolumeEditor", this, "DoDivN()"); + fBRaytrace->Connect("Clicked()", "TGeoVolumeEditor", this, "DoRaytrace()"); + fApplyDiv->Connect("Clicked()", "TGeoVolumeEditor", this, "DoApplyDiv()"); +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t /*event*/) +{ + // Connect to the picked volume. + if (obj == 0 || !obj->InheritsFrom(TGeoVolume::Class())) { + SetActive(kFALSE); + return; + } + fModel = obj; + fPad = pad; + fVolume = (TGeoVolume*)fModel; + fGeometry = fVolume->GetGeoManager(); + const char *vname = fVolume->GetName(); + fVolumeName->SetText(vname); + fSelectedShape = fVolume->GetShape(); + if (fSelectedShape) fLSelShape->SetText(fSelectedShape->GetName()); + fSelectedMedium = fVolume->GetMedium(); + if (fSelectedMedium) fLSelMedium->SetText(fSelectedMedium->GetName()); + + fNodeList->RemoveEntries(0, fNodeList->GetNumberOfEntries()+1); + TIter next2(fVolume->GetNodes()); + TGeoNode *node; + Int_t icrt = 0; + while ((node=(TGeoNode*)next2())) + fNodeList->AddEntry(node->GetName(), icrt++); + fNodeList->Select(0); + fCopyNumber->SetNumber(fVolume->GetNdaughters()+1); + if (!fVolume->GetNdaughters() || fVolume->GetFinder()) { + fEditMatrix->SetEnabled(kFALSE); + fRemoveNode->SetEnabled(kFALSE); + } + if (!fSelectedVolume) fAddNode->SetEnabled(kFALSE); + if (fVolume->IsAssembly()) { + fBSelShape->SetEnabled(kFALSE); + fBSelMedium->SetEnabled(kFALSE); + } + fBVis[0]->SetState((fVolume->IsVisible())?kButtonDown:kButtonUp); + fBVis[1]->SetState((fVolume->IsVisibleDaughters())?kButtonDown:kButtonUp); + fBView[0]->SetState((fVolume->IsVisContainers())?kButtonDown:kButtonUp); + fBView[1]->SetState((fVolume->IsVisLeaves())?kButtonDown:kButtonUp); + fBView[2]->SetState((fVolume->IsVisOnly())?kButtonDown:kButtonUp); + fBRaytrace->SetState((fVolume->IsRaytracing())?kButtonDown:kButtonUp); + fBAuto->SetState((fGeometry->GetVisLevel())?kButtonUp:kButtonDown); + fEVisLevel->SetNumber(fGeometry->GetVisLevel()); + fApplyDiv->SetEnabled(kFALSE); + if ((!fVolume->GetFinder() && fVolume->GetNdaughters()) || fVolume->IsAssembly()) { + fCategories->GetItem("Division")->GetButton()->SetEnabled(kFALSE); + } else { + fCategories->GetItem("Division")->GetButton()->SetEnabled(kTRUE); + Double_t start=0., step=0., end = 0.; + Int_t ndiv = 2, iaxis = 1; + TString axis_name; + for (Int_t i=0; i<3; i++) { + axis_name = fVolume->GetShape()->GetAxisName(i+1); + fBDiv[i]->SetText(axis_name); + } + + if (fVolume->GetFinder()) { + fDivName->SetText(fVolume->GetNode(0)->GetVolume()->GetName()); + iaxis = fVolume->GetFinder()->GetDivAxis(); + start = fVolume->GetFinder()->GetStart(); + step = fVolume->GetFinder()->GetStep(); + ndiv = fVolume->GetFinder()->GetNdiv(); + } else { + fDivName->SetText("Enter name"); + fSelectedShape->GetAxisRange(iaxis,start,end); + step = 0; + } + fBDiv[iaxis-1]->SetState(kButtonDown); + fEDivFrom->SetNumber(start); + fEDivStep->SetNumber(step); + fEDivN->SetNumber(ndiv); + } + + if (fInit) ConnectSignals2Slots(); + SetActive(); +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoVolumeName() +{ +// Modify volume name. + fVolume->SetName(fVolumeName->GetText()); +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoSelectShape() +{ + TGeoShape *shape = fSelectedShape; + new TGeoShapeDialog(fBSelShape, gClient->GetRoot(), 200,300); + fSelectedShape = (TGeoShape*)TGeoShapeDialog::GetSelected(); + if (fSelectedShape) fLSelShape->SetText(fSelectedShape->GetName()); + else fSelectedShape = shape; +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoSelectMedium() +{ + TGeoMedium *med = fSelectedMedium; + new TGeoMediumDialog(fBSelMedium, gClient->GetRoot(), 200,300); + fSelectedMedium = (TGeoMedium*)TGeoMediumDialog::GetSelected(); + if (fSelectedMedium) fLSelMedium->SetText(fSelectedMedium->GetName()); + else fSelectedMedium = med; +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoSelectMatrix() +{ + TGeoMatrix *matrix = fSelectedMatrix; + new TGeoMatrixDialog(fBSelMatrix, gClient->GetRoot(), 200,300); + fSelectedMatrix = (TGeoMatrix*)TGeoMatrixDialog::GetSelected(); + if (fSelectedMatrix) fLSelMatrix->SetText(fSelectedMatrix->GetName()); + else fSelectedMatrix = matrix; +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoSelectVolume() +{ + TGeoVolume *vol = fSelectedVolume; + new TGeoVolumeDialog(fBSelVolume, gClient->GetRoot(), 200,300); + fSelectedVolume = (TGeoVolume*)TGeoVolumeDialog::GetSelected(); + if (fSelectedVolume) fLSelVolume->SetText(fSelectedVolume->GetName()); + else fSelectedVolume = vol; +} + + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoEditShape() +{ + fTabMgr->GetShapeEditor(fVolume->GetShape()); +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoEditMedium() +{ + fTabMgr->GetMediumEditor(fVolume->GetMedium()); +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoEditMatrix() +{ + if (!fVolume->GetNdaughters()) return; + Int_t i = fNodeList->GetSelected(); + if (i<0) return; + fTabMgr->GetMatrixEditor(fVolume->GetNode(i)->GetMatrix()); +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoAddNode() +{ + if (!fSelectedVolume || fVolume->GetFinder()) return; + Int_t icopy = fCopyNumber->GetIntNumber(); + fVolume->AddNode(fSelectedVolume, icopy, fSelectedMatrix); + Int_t nd = fVolume->GetNdaughters(); + fNodeList->AddEntry(fVolume->GetNode(nd-1)->GetName(), nd-1); + fNodeList->Select(nd-1); + fCopyNumber->SetNumber(nd+1); + if (fSelectedMatrix) fEditMatrix->SetEnabled(kTRUE); + fRemoveNode->SetEnabled(kTRUE); + fSelectedVolume = 0; + fSelectedMatrix = 0; + fLSelVolume->SetText("Select volume"); + fLSelMatrix->SetText("Select matrix"); + fAddNode->SetEnabled(kFALSE); + fGeometry->SetTopVisible(); + if (fPad) { + fPad->Modified(); + fPad->Update(); + } +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoRemoveNode() +{ + if (!fVolume->GetNdaughters() || fVolume->GetFinder()) { + fRemoveNode->SetEnabled(kFALSE); + fEditMatrix->SetEnabled(kFALSE); + return; + } + Int_t i = fNodeList->GetSelected(); + if (i<0) return; + fVolume->RemoveNode(fVolume->GetNode(i)); + fNodeList->RemoveEntries(0, fNodeList->GetNumberOfEntries()+1); + TIter next(fVolume->GetNodes()); + TGeoNode *node; + i = 0; + while ((node=(TGeoNode*)next())) + fNodeList->AddEntry(node->GetName(), i++); + fNodeList->Select(0); + fCopyNumber->SetNumber(fVolume->GetNdaughters()+1); + if (!fVolume->GetNdaughters()) { + fRemoveNode->SetEnabled(kFALSE); + fEditMatrix->SetEnabled(kFALSE); + fCategories->GetItem("Division")->GetButton()->SetEnabled(kTRUE); + Double_t start=0., step=0., end=0.; + Int_t ndiv = 2, iaxis = 1; + fSelectedShape->GetAxisRange(iaxis,start,end); + step = end-start; + fBDiv[iaxis-1]->SetState(kButtonDown); + fEDivFrom->SetNumber(start); + fEDivStep->SetNumber(step); + fEDivN->SetNumber(ndiv); + } + if (fPad) { + fPad->Modified(); + fPad->Update(); + } +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoVisVolume() +{ + Bool_t on = (fBVis[0]->GetState()==kButtonDown)?kTRUE:kFALSE; + if (fVolume->IsVisible() == on) return; + fVolume->SetVisibility(on); + UpdatePad(); +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoVisDaughters() +{ + Bool_t on = (fBVis[1]->GetState()==kButtonDown)?kTRUE:kFALSE; + if (fVolume->IsVisibleDaughters() == on) return; + fVolume->VisibleDaughters(on); + UpdatePad(); +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoVisAuto() +{ + Bool_t on = (fBAuto->GetState()==kButtonDown)?kTRUE:kFALSE; + if ((fGeometry->GetVisLevel()==0) == on) return; + if (on) fGeometry->SetVisLevel(0); + else fGeometry->SetVisLevel(fEVisLevel->GetIntNumber()); + UpdatePad(); +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoVisLevel() +{ + fBAuto->SetState(kButtonUp); + fGeometry->SetVisLevel(fEVisLevel->GetIntNumber()); + UpdatePad(); +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoViewAll() +{ + Bool_t on = (fBView[0]->GetState()==kButtonDown)?kTRUE:kFALSE; + if (!on) return; + if (fVolume->IsVisContainers() == on) return; + if (fVolume->IsRaytracing()) { + fVolume->Raytrace(kFALSE); + fBRaytrace->SetState(kButtonUp); + } + fVolume->SetVisContainers(on); + UpdatePad(); +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoViewLeaves() +{ + Bool_t on = (fBView[1]->GetState()==kButtonDown)?kTRUE:kFALSE; + if (!on) return; + if (fVolume->IsVisLeaves() == on) return; + if (fVolume->IsRaytracing()) { + fVolume->Raytrace(kFALSE); + fBRaytrace->SetState(kButtonUp); + } + fVolume->SetVisLeaves(on); + UpdatePad(); +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoViewOnly() +{ + Bool_t on = (fBView[2]->GetState()==kButtonDown)?kTRUE:kFALSE; + if (!on) return; + if (fVolume->IsVisOnly() == on) return; + if (fVolume->IsRaytracing()) { + fVolume->Raytrace(kFALSE); + fBRaytrace->SetState(kButtonUp); + } + fVolume->SetVisOnly(on); + UpdatePad(); +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoRaytrace() +{ + Bool_t on = (fBRaytrace->GetState()==kButtonDown)?kTRUE:kFALSE; + if (fVolume->IsRaytracing() == on) return; + fVolume->Raytrace(on); + UpdatePad(); +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoDivName() +{ +// Modify volume name. + fApplyDiv->SetEnabled(kTRUE); +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoDivSelAxis() +{ +// Change division axis and preserve number of slices. + Int_t iaxis = 1; + for (Int_t i=0; i<3; i++) { + if (fBDiv[i]->GetState()!=kButtonDown) continue; + iaxis = i+1; + break; + } + TGeoShape *shape = fVolume->GetShape(); + if (!shape) { + fApplyDiv->SetEnabled(kFALSE); + return; + } + Double_t xlo, xhi; + shape->GetAxisRange(iaxis, xlo, xhi); + if (xhi <= xlo) { + fApplyDiv->SetEnabled(kFALSE); + return; + } + fEDivFrom->SetNumber(xlo); + fEDivStep->SetNumber(0); + fApplyDiv->SetEnabled(kTRUE); +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoDivFromTo() +{ +// Handle division range modification. + Double_t min, max, xlo, xhi, step; + Int_t iaxis = 1; + Int_t ndiv; + for (Int_t i=0; i<3; i++) { + if (fBDiv[i]->GetState()!=kButtonDown) continue; + iaxis = i+1; + break; + } + TGeoShape *shape = fVolume->GetShape(); + if (!shape) { + fApplyDiv->SetEnabled(kFALSE); + return; + } + shape->GetAxisRange(iaxis, xlo, xhi); + if (xhi-xlo <= 0) { + fApplyDiv->SetEnabled(kFALSE); + return; + } + min = fEDivFrom->GetNumber(); + step = fEDivStep->GetNumber(); + ndiv = fEDivN->GetIntNumber(); + if (min<xlo) { + min = xlo; + fEDivFrom->SetNumber(xlo); + } + max = min + ndiv*step; + if (max>xhi) { + max = xhi; + step = (max-min)/ndiv; + fEDivStep->SetNumber(step); + } + if (min>=max) { + fApplyDiv->SetEnabled(kFALSE); + return; + } + fApplyDiv->SetEnabled(kTRUE); +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoDivStep() +{ +// Handle division step modification. + Double_t min, max, xlo, xhi; + Int_t iaxis = 1; + for (Int_t i=0; i<3; i++) { + if (fBDiv[i]->GetState()!=kButtonDown) continue; + iaxis = i+1; + break; + } + TGeoShape *shape = fVolume->GetShape(); + if (!shape) { + fApplyDiv->SetEnabled(kFALSE); + return; + } + shape->GetAxisRange(iaxis, xlo, xhi); + if (xhi-xlo <= 0) { + fApplyDiv->SetEnabled(kFALSE); + return; + } + min = fEDivFrom->GetNumber(); + Double_t step = fEDivStep->GetNumber(); + Int_t ndiv = fEDivN->GetIntNumber(); + max = min + ndiv*step; + + // Check if ndiv*step < max-min + if (max <= xhi) { + fApplyDiv->SetEnabled(kTRUE); + return; + } + // Step too big - set value to fit range + max = xhi; + step = (max-min)/ndiv; + fEDivStep->SetNumber(step); + if (step < 0) { + fApplyDiv->SetEnabled(kFALSE); + return; + } + fApplyDiv->SetEnabled(kTRUE); +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoDivN() +{ +// Handle division N modification. + Double_t min, max, xlo, xhi; + Int_t iaxis = 1; + for (Int_t i=0; i<3; i++) { + if (fBDiv[i]->GetState()!=kButtonDown) continue; + iaxis = i+1; + break; + } + TGeoShape *shape = fVolume->GetShape(); + if (!shape) { + fApplyDiv->SetEnabled(kFALSE); + return; + } + shape->GetAxisRange(iaxis, xlo, xhi); + if (xhi-xlo <= 0) { + fApplyDiv->SetEnabled(kFALSE); + return; + } + Double_t step = fEDivStep->GetNumber(); + // If step=0 it is discounted + if (step==0) { + fApplyDiv->SetEnabled(kTRUE); + return; + } + Int_t ndiv = fEDivN->GetIntNumber(); + min = fEDivFrom->GetNumber(); + max = min + ndiv*step; + // Check if ndiv*step < max-min + if (max <= xhi) { + fApplyDiv->SetEnabled(kTRUE); + return; + } + max = xhi; + ndiv = (Int_t)((max-min)/step); + fEDivN->SetNumber(ndiv); + fApplyDiv->SetEnabled(kTRUE); +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::DoApplyDiv() +{ +// Apply current division settings + Double_t xlo, xhi, step; + Int_t iaxis = 1; + Int_t ndiv; + for (Int_t i=0; i<3; i++) { + if (fBDiv[i]->GetState()!=kButtonDown) continue; + iaxis = i+1; + break; + } + TGeoShape *shape = fVolume->GetShape(); + if (!shape) { + fApplyDiv->SetEnabled(kFALSE); + return; + } + shape->GetAxisRange(iaxis, xlo, xhi); + if (xhi-xlo <= 0) { + fApplyDiv->SetEnabled(kFALSE); + return; + } + xlo = fEDivFrom->GetNumber(); + step = fEDivStep->GetNumber(); + ndiv = fEDivN->GetIntNumber(); + TGeoPatternFinder *finder = fVolume->GetFinder(); + if (finder) { + // we have to remove first the existing division + TObjArray *nodes = fVolume->GetNodes(); + nodes->Delete(); + nodes->Clear(); + delete finder; + fVolume->SetFinder(0); + } + fVolume->Divide(fDivName->GetText(), iaxis, ndiv, xlo, step); + fApplyDiv->SetEnabled(kFALSE); + fGeometry->SetTopVisible(); + UpdatePad(); +// fVolume->Draw(); +} + +//______________________________________________________________________________ +void TGeoVolumeEditor::UpdatePad() +{ + if (fPad) { + fPad->Modified(); + fPad->Update(); + } +} diff --git a/icons/geoassembly_s.xpm b/icons/geoassembly_s.xpm new file mode 100644 index 0000000000000000000000000000000000000000..7304df3c5da0f6845d99409c467dafb0270b3d14 --- /dev/null +++ b/icons/geoassembly_s.xpm @@ -0,0 +1,39 @@ +/* XPM */ +static char *geoassembly[]={ +"32 32 4 1", +". c None", +"b c #0000ff", +"# c #303030", +"a c #ff0000", +"................................", +"................................", +"..##...###..###.###.#...#.###...", +".#..#.#....#....#...##.##.#..#..", +".#..#..##...##..##..#.#.#.###...", +".####....#....#.#...#...#.#..#..", +".#..#.###..###..###.#...#.###...", +"................................", +"................................", +"................................", +"................................", +"................................", +"................................", +"................................", +"................................", +"...##..aaaaa........aaaaa..##...", +"...##..aaaaa........aaaaa..##...", +"...##......................##...", +"...##......................##...", +"...##......................##...", +"...##......bbbbbbbbbb......##...", +"...##......bbbbbbbbbb......##...", +"...##......................##...", +"...##......................##...", +"...##......................##...", +"...##..aaaaa........aaaaa..##...", +"...##..aaaaa........aaaaa..##...", +"................................", +"................................", +"................................", +"................................", +"................................"}; diff --git a/icons/geoassembly_t.xpm b/icons/geoassembly_t.xpm new file mode 100644 index 0000000000000000000000000000000000000000..09da87d658d2001427e3e932f93a2382e7f48014 --- /dev/null +++ b/icons/geoassembly_t.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * geoassembly_t_xpm[] = { +"16 16 4 1", +" c None", +". c #303030", +"+ c #FF0000", +"@ c #0000FF", +" ", +" . .. . . . ... ", +"... . . . . ... ", +" . . . . ", +" ", +" ", +" ", +" ++ ++ ", +" .. ++ ++ .. ", +" .. .. ", +" .. @@@@@@ .. ", +" .. .. ", +" .. ++ ++ .. ", +" ++ ++ ", +" ", +" "}; diff --git a/icons/geocombi_s.xpm b/icons/geocombi_s.xpm new file mode 100644 index 0000000000000000000000000000000000000000..e32c4dc5d7e5ea27b62a93f3c4753734eb268b4e --- /dev/null +++ b/icons/geocombi_s.xpm @@ -0,0 +1,42 @@ +/* XPM */ +static char *geocombi_s[]={ +"32 32 7 1", +"a c None", +". c None", +"e c #000000", +"# c #303030", +"b c #a0a0a0", +"c c #c3c3c3", +"d c #dcdcdc", +"................................", +".###a###a#aa#a###.#.............", +".#aaa#a#a####a#a#.#.........#...", +".#aaa#a#a#aa#a##aa#aaaaa....#...", +".#aaa#a#a#aa#a#a#.#........###..", +".###a###a#aa#.###.#.......#####.", +".aaaaaaaaaaaaaa.bbbbbbbbb...#...", +".a.............bbbbbbbbbb...#...", +"..............bbbbbbbbbbb...#...", +".............bbbbbbbbbbbb...#...", +"............#c#c#c#c#bbbb...#...", +"............c#c#c#c#cbbbb...#...", +"........#...#c#c#c#c#bbbb...#...", +".......d##..c#c#c#c#cbbbb...#...", +".......#eee.#c#c#c#c#beee.......", +"......ed##..c#c#c#c#cbbbbee.....", +".....e..#...#c#c#c#c#bbbb..e....", +"....e.......c#c#c#c#cbbbb...e...", +"...e........#c#c#c#c#bbbb....e..", +"...e........c#c#c#c#cbbbb....e..", +"...e........#c#c#c#c#bbbb....e..", +"....e.......c#c#c#c#cbbbb...e...", +".....e......#c#c#c#c#bbbe..e....", +"......ee....c#c#c#c#cbbeede.....", +"........eee.#c#c#c#c#beee#......", +"............c#c#c#c#cbbee.......", +"............#c#c#c#c#b..e.......", +"............c#c#c#c#c...........", +"................................", +"................................", +"................................", +"................................"}; diff --git a/icons/geocombi_t.xpm b/icons/geocombi_t.xpm new file mode 100644 index 0000000000000000000000000000000000000000..bbdb0b075ce1dd73ef12e03eb040f40bc45cd77d --- /dev/null +++ b/icons/geocombi_t.xpm @@ -0,0 +1,34 @@ +/* XPM */ +static char * geocombi_t_xpm[] = { +"16 16 15 1", +" c None", +". c #303030", +"+ c #A0A0A0", +"@ c #7A7A7A", +"# c #8D8D8D", +"$ c #595959", +"% c #181818", +"& c #505050", +"* c #353535", +"= c #000000", +"- c #787878", +"; c #494949", +"> c #282828", +", c #101010", +"' c #868686", +" . . . ", +". ...... . . ", +"..... .... .. ", +" +++++ . ", +" ++++++ . ", +" @@@@#++ . ", +" . @@@@#++ . ", +" $% @@@@#&* ", +" = @@@@#++ ", +" = @@@@#++ = ", +" @@@@#++ = ", +" = @@@@#-;= ", +" = @@@@#>, ", +" @@@@' ", +" ", +" "}; diff --git a/icons/geocomposite_s.xpm b/icons/geocomposite_s.xpm new file mode 100644 index 0000000000000000000000000000000000000000..b532f0485309fd6e271bc22449d26067ac1c1413 --- /dev/null +++ b/icons/geocomposite_s.xpm @@ -0,0 +1,106 @@ +/* XPM */ +static char *geocomposite_s[]={ +"32 32 71 2", +"Qt c None", +"#. c #414141", +".5 c #474747", +".7 c #4b4b4b", +".Z c #595959", +".Q c #5d5d5d", +".b c #646464", +".G c #656565", +".9 c #666666", +"#e c #686868", +"#b c #696969", +".J c #6a6a6a", +".a c #6d6d6d", +".U c #6e6e6e", +".# c #717171", +".H c #727272", +".I c #737373", +".1 c #757575", +"#d c #787878", +"#a c #7a7a7a", +".8 c #7b7b7b", +"## c #7c7c7c", +".C c #7e7e7e", +".3 c #7f7f7f", +".h c #808080", +".B c #818181", +".6 c #838383", +".Y c #848484", +".c c #858585", +".T c #878787", +".s c #898989", +".N c #8a8a8a", +".t c #8c8c8c", +".g c #8d8d8d", +".M c #909090", +".L c #919191", +"#c c #929292", +".i c #949494", +".d c #959595", +".X c #969696", +".2 c #979797", +".R c #999999", +".f c #9a9a9a", +".u c #9b9b9b", +".4 c #9d9d9d", +".e c #9e9e9e", +".j c #9f9f9f", +".0 c #a0a0a0", +".A c #a2a2a2", +".S c #a3a3a3", +".r c #a4a4a4", +".v c #a6a6a6", +".k c #a7a7a7", +".W c #a8a8a8", +".z c #aaaaaa", +".q c #ababab", +".l c #acacac", +".V c #adadad", +".p c #afafaf", +".m c #b0b0b0", +".n c #b1b1b1", +".o c #b3b3b3", +".y c #b4b4b4", +".w c #b5b5b5", +".x c #b6b6b6", +".F c #b8b8b8", +".D c #b9b9b9", +".E c #bababa", +".P c #bcbcbc", +".K c #bdbdbd", +".O c #bebebe", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQt.#.#.#.#.#.#.#.#QtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQt.a.#.#.#.#.#.#.#.#.#.#.#QtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQt.b.c.d.e.#.#.#.#.#.#.#.f.g.#QtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQt.h.i.j.k.l.m.n.o.n.p.q.r.f.sQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQt.a.t.u.v.l.n.w.x.x.x.y.m.z.A.d.BQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQt.C.j.j.j.j.w.D.E.E.E.F.y.p.k.B.BQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQt.G.H.I.J.j.j.j.E.K.K.K.E.x.n.B.B.BQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQt.h.t.L.M.N.h.J.j.j.O.O.O.P.D.y.B.B.BQtQtQtQtQtQt", +"QtQtQtQtQtQt.Q.N.R.j.S.A.e.d.T.U.j.j.O.O.K.D.B.B.B.BQtQtQtQtQtQt", +"QtQtQtQtQtQt.T.u.v.q.V.l.W.A.X.Y.Z.j.O.O.P.D.B.B.B.BQtQtQtQtQtQt", +"QtQtQtQtQt.#.X.v.p.y.w.w.n.q.0.L.1.j.K.K.E.x.B.B.B.BQtQtQtQtQtQt", +"QtQtQtQtQt.Y.j.l.w.D.E.D.x.m.v.2.3.j.j.E.F.y.B.B.B.BQtQtQtQtQtQt", +"QtQtQtQtQt.t.S.m.F.K.O.K.D.o.z.4.c.5.j.x.y.m.B.B.B.BQtQtQtQtQtQt", +"QtQtQtQtQt.t.6.n.D.K.O.O.E.y.q.4.T.7.j.n.p.q.B.B.BQtQtQtQtQtQtQt", +"QtQtQtQtQt.T.8.9#..K.O.K.D.o.z.u.6.j.j.q.W.r.B.B.BQtQtQtQtQtQtQt", +"QtQtQtQtQt##.H.Z#..D.E.E.x.m.v.X#a.j.S.A.j.R.B.BQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQt#b.9.a.y.w.y.m.z.e.g.9.j.R.X#c.N.BQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQt#d.6.s.q.l.l.k.j#c.8.B.c.c.6###eQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQt###c.4.j.j.f.M##QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQt.3.T.T.C#eQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt"}; diff --git a/icons/geocomposite_t.xpm b/icons/geocomposite_t.xpm new file mode 100644 index 0000000000000000000000000000000000000000..f82427817b1d0129581dc426eee48036905b17e0 --- /dev/null +++ b/icons/geocomposite_t.xpm @@ -0,0 +1,75 @@ +/* XPM */ +static char *geocomposite_t[]={ +"16 16 56 1", +". c None", +"0 c #7d7d7d", +"W c #818181", +"# c #6f6f6f", +"b c #717171", +"c c #727272", +"E c #7a7a7a", +"j c #7d7d7d", +"Q c #818181", +"J c #8c8c8c", +"s c #7b7b7b", +"P c #818181", +"1 c #8f8f8f", +"M c #676767", +"R c #6a6a6a", +"a c #717171", +"X c #727272", +"S c #7e7e7e", +"Z c #808080", +"t c #818181", +"x c #828282", +"A c #838383", +"u c #848484", +"k c #858585", +"r c #868686", +"I c #8c8c8c", +"B c #8d8d8d", +"V c #8e8e8e", +"h c #8f8f8f", +"f c #909090", +"g c #919191", +"d c #939393", +"Y c #959595", +"e c #989898", +"i c #999999", +"H c #9b9b9b", +"l c #9f9f9f", +"U c #a0a0a0", +"F c #a1a1a1", +"y c #a2a2a2", +"L c #a3a3a3", +"z c #a7a7a7", +"q c #a8a8a8", +"N c #a9a9a9", +"m c #acacac", +"O c #afafaf", +"G c #b0b0b0", +"p c #b4b4b4", +"K c #b6b6b6", +"n c #b7b7b7", +"o c #b8b8b8", +"w c #b9b9b9", +"D c #bababa", +"T c #bbbbbb", +"v c #bdbdbd", +"C c #bebebe", +"................", +"................", +"................", +"......#aaaab....", +".....cdefghij...", +".....klmnopqr...", +"....stugpvwit...", +"...xyzlABCDtt...", +"..EFpnGHIpntt...", +"..JFDvKLMNOtP...", +"..QRSTpUVLUtW...", +"...XYGzVxBZW....", +"...01du0........", +"................", +"................", +"................"}; diff --git a/icons/geomaterial_s.xpm b/icons/geomaterial_s.xpm new file mode 100644 index 0000000000000000000000000000000000000000..7f2d1c2d460ed0ea2da865f848002e83c592f8a1 --- /dev/null +++ b/icons/geomaterial_s.xpm @@ -0,0 +1,38 @@ +/* XPM */ +static char *geomaterial_s[]={ +"32 32 3 1", +". c None", +"# c #000000", +"a c #808080", +"................................", +"................................", +"................................", +"................................", +"....########################....", +"....#......a.......a....a..#....", +"....#.............aaa......#....", +"....#...a..........a.......#....", +"....#..aaa....a.........a..#....", +"....#...a....aaa...a...aaa.#....", +"....#.a.......a...aaa...a..#....", +"....#aaa...........a.......#....", +"....#.a....a...............#....", +"....#.....aaa....a...a.....#....", +"....#......a....aaa.aaa.a..#....", +"....#..a.........a...a.aaa.#....", +"....#.aaa...............a..#....", +"....#..a.....a.........a...#....", +"....#.......aaa....a..aaa..#....", +"....#........a....aaa..a...#....", +"....#...a..........a.......#....", +"....#..aaa....a............#....", +"....#...a....aaa.......a...#....", +"....#........aa...a...aaa..#....", +"....#.......aaa..aaa...a...#....", +"....#a..a....a....a........#....", +"....#......................#....", +"....########################....", +"................................", +"................................", +"................................", +"................................"}; diff --git a/icons/geomaterial_t.xpm b/icons/geomaterial_t.xpm new file mode 100644 index 0000000000000000000000000000000000000000..d726bac7b2489a483e72731e7d62f1c4d81203b2 --- /dev/null +++ b/icons/geomaterial_t.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static char *geomaterial_t[]={ +"16 16 7 1", +". c None", +"c c #808080", +"a c #000000", +"e c #808080", +"# c #000000", +"b c #2b2b2b", +"d c #808080", +"................", +"................", +"..#aabaaabaab#..", +"..a.c....dc..a..", +"..acd.cd.c.cda..", +"..bd...c.dc.ca..", +"..ac.dc.c.c..a..", +"..ac.c..dcdeda..", +"..adc.c....cca..", +"..a...dc.dcdca..", +"..acd..c.c...a..", +"..a.c.ed.c.dca..", +"..b.c.dccd.c.a..", +"..#aaaaaaaaaa#..", +"................", +"................"}; diff --git a/icons/geomedium_s.xpm b/icons/geomedium_s.xpm new file mode 100644 index 0000000000000000000000000000000000000000..32cffdf302afdadee46ebe18c045d3530d855043 --- /dev/null +++ b/icons/geomedium_s.xpm @@ -0,0 +1,42 @@ +/* XPM */ +static char *geomedium_s[]={ +"32 32 7 1", +". c None", +"# c #000000", +"a c #303030", +"c c #58a8ff", +"e c #808080", +"b c #c3c3c3", +"d c #ffffff", +"..##......##..######..####......", +"..##......##..######..####......", +"..####..####..##......##..##....", +"..####..####..##......##..##....", +"..##..##..##..####....##..##....", +"..##..##..##..####....##..##....", +"..##......##..######..####......", +"..##......##..######..####......", +"................................", +"................................", +"......####################......", +"......####################......", +"....##aaaabbccbbaaaaccbbbb##....", +"....##aaaabbccbbaaaaccbbbb##....", +"..##ccddddeecceeddddcceeeeee##..", +"..##ccddddeecceeddddcceeeeee##..", +"..##bbaaccaabbbbccaaaaaaccbb##..", +"..##bbaaccaabbbbccaaaaaaccbb##..", +"..##ddddcceeeeddccddeeeeccdd##..", +"..##ddddcceeeeddccddeeeeccdd##..", +"..##bbbbccaaaabbccbbaaaaccbb##..", +"..##bbbbccaaaabbccbbaaaaccbb##..", +"..##cceeeeeeccddddeecceedddd##..", +"..##cceeeeeeccddddeecceedddd##..", +"..##ccbbbbaaccaabbbbccaaaaaa##..", +"..##ccbbbbaaccaabbbbccaaaaaa##..", +"....##eeeeddccddeeeeccdddd##....", +"....##eeeeddccddeeeeccdddd##....", +"......####################......", +"......####################......", +"................................", +"................................"}; diff --git a/icons/geomedium_t.xpm b/icons/geomedium_t.xpm new file mode 100644 index 0000000000000000000000000000000000000000..f26b0fff900fcda0369257da6a9e1a5d32ff791b --- /dev/null +++ b/icons/geomedium_t.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static char *geomedium_t[]={ +"16 16 7 1", +". c None", +"# c #000000", +"a c #303030", +"c c #58a8ff", +"e c #808080", +"b c #c3c3c3", +"d c #ffffff", +".#...#.###.##...", +".##.##.#...#.#..", +".#.#.#.##..#.#..", +".#...#.###.##...", +"................", +"...##########...", +"..#aabcbaacbb#..", +".#cddeceddceee#.", +".#bacabbcaaacb#.", +".#ddceedcdeecd#.", +".#bbcaabcbaacb#.", +".#ceeecddecedd#.", +".#cbbacabbcaaa#.", +"..#eedcdeecdd#..", +"...##########...", +"................"}; diff --git a/icons/geomixture_s.xpm b/icons/geomixture_s.xpm new file mode 100644 index 0000000000000000000000000000000000000000..e83d43ae429b820c864d3d25003464c87f972cf8 --- /dev/null +++ b/icons/geomixture_s.xpm @@ -0,0 +1,39 @@ +/* XPM */ +static char *geomixture_s[]={ +"32 32 4 1", +". c None", +"# c #000000", +"a c #808080", +"b c #ffff00", +"................................", +"................................", +"................................", +"................................", +"....########################....", +"....#......a...b...a....b..#....", +"....#.........bbb.aaa..bbb.#....", +"....#...b......b...a....b..#....", +"....#..bbb....a.........a..#....", +"....#...b....aaa...a...aaa.#....", +"....#.a.......a...aaa...a..#....", +"....#aaa...........a.......#....", +"....#.a....a...............#....", +"....#.....aaa....b...a..b..#....", +"....#......a....bbb.aaabbb.#....", +"....#..b.........b...a.aba.#....", +"....#.bbb...............a..#....", +"....#..b.....a.........a...#....", +"....#.......aaa....a..aaa..#....", +"....#........a....aaa..a...#....", +"....#...a..........a.......#....", +"....#..aaa....b............#....", +"....#...a....bbb.......b...#....", +"....#........ab...a...bbb..#....", +"....#..b....aaa..aaa...b...#....", +"....#a..a....a....a........#....", +"....#......................#....", +"....########################....", +"................................", +"................................", +"................................", +"................................"}; diff --git a/icons/geomixture_t.xpm b/icons/geomixture_t.xpm new file mode 100644 index 0000000000000000000000000000000000000000..c2beadcc14f03e8c5f5e2b70d8e2e563c7914269 --- /dev/null +++ b/icons/geomixture_t.xpm @@ -0,0 +1,31 @@ +/* XPM */ +static char *geomixture_t[]={ +"16 16 12 1", +". c None", +"g c #808080", +"d c #ffff01", +"a c #000000", +"j c #bfbf40", +"# c #000000", +"b c #2b2b2b", +"c c #555500", +"f c #808080", +"h c #aaaa55", +"e c #ffff00", +"i c #dfdf20", +"................", +"................", +"..#aabacabaac#..", +"..a.d..edfgdea..", +"..ade.gf.g.gfa..", +"..bf...g.fg.ga..", +"..ag.fg.d.g.da..", +"..ad.g..edfhia..", +"..aed.g....gga..", +"..a...fg.fgfga..", +"..agf..d.g...a..", +"..a.g.je.g.eda..", +"..bdg.fggf.d.a..", +"..#aaaaaaaaaa#..", +"................", +"................"}; diff --git a/icons/georotation_s.xpm b/icons/georotation_s.xpm new file mode 100644 index 0000000000000000000000000000000000000000..c8c8890628a6856d3912a5b8fb5871a8d2674b4b --- /dev/null +++ b/icons/georotation_s.xpm @@ -0,0 +1,42 @@ +/* XPM */ +static char *georotation_s[]={ +"32 32 7 1", +"# c None", +". c None", +"e c #000000", +"a c #303030", +"b c #a0a0a0", +"c c #c3c3c3", +"d c #dcdcdc", +"......##........................", +".aa###aa##aaa#..................", +".a#a.a##a##a##..................", +".a#a.a.#a##a#...................", +".aa##a.#a.#a....................", +".a#a#a##a.#a....................", +".a#a.#aa...a....bbbbbbbbb.......", +"..#............bbbbbbbbbb.......", +"..............bbbbbbbbbbb.......", +".............bbbbbbbbbbbb.......", +"............acacacacabbbb.......", +"............cacacacacbbbb.......", +"........a...acacacacabbbb.......", +".......daa..cacacacacbbbb.......", +".......aeee.acacacacabeee.......", +"......edaa..cacacacacbbbbee.....", +".....e..a...acacacacabbbb..e....", +"....e.......cacacacacbbbb...e...", +"...e........acacacacabbbb....e..", +"...e........cacacacacbbbb....e..", +"...e........acacacacabbbb....e..", +"....e.......cacacacacbbbb...e...", +".....e......acacacacabbbe..e....", +"......ee....cacacacacbbeede.....", +"........eee.acacacacabeeea......", +"............cacacacacbbee.......", +"............acacacacab..e.......", +"............cacacacac...........", +"................................", +"................................", +"................................", +"................................"}; diff --git a/icons/georotation_t.xpm b/icons/georotation_t.xpm new file mode 100644 index 0000000000000000000000000000000000000000..d90947c023994715827016cf8af7b2545cba36be --- /dev/null +++ b/icons/georotation_t.xpm @@ -0,0 +1,34 @@ +/* XPM */ +static char * georotation_t_xpm[] = { +"16 16 15 1", +" c None", +". c #303030", +"+ c #A0A0A0", +"@ c #7A7A7A", +"# c #8D8D8D", +"$ c #595959", +"% c #181818", +"& c #505050", +"* c #353535", +"= c #000000", +"- c #787878", +"; c #494949", +"> c #282828", +", c #101010", +"' c #868686", +" . . ", +"... .. ", +"... .. ", +" . +++++ ", +" ++++++ ", +" @@@@#++ ", +" . @@@@#++ ", +" $% @@@@#&* ", +" = @@@@#++ ", +" = @@@@#++ = ", +" @@@@#++ = ", +" = @@@@#-;= ", +" = @@@@#>, ", +" @@@@' ", +" ", +" "}; diff --git a/icons/geotranslation_s.xpm b/icons/geotranslation_s.xpm new file mode 100644 index 0000000000000000000000000000000000000000..a2e88b36d0225c8ddcf39c03db77fb8bb12f5a75 --- /dev/null +++ b/icons/geotranslation_s.xpm @@ -0,0 +1,40 @@ +/* XPM */ +static char *geotranslation_s[]={ +"32 32 5 1", +"# c None", +". c None", +"a c #303030", +"b c #a0a0a0", +"c c #c3c3c3", +"...#..##........................", +".aaa#aa###aa##a..a..............", +".#a##a#a#a##a#aa.a..............", +".#a##a#a#a##a.a.aa..............", +".#a##aa##aaaa#a..a..............", +"##a##a#a#a##a.a..a..............", +"##a#.a#a#a.#a.a.babbbbbbb.......", +".##...##.#.....bbbbbbbbbb.......", +"..#......#....bbbbbbbbbbb.......", +"........##...bbbbbbbbbbbb.......", +"........#...acacacacabbbb.......", +".......##...cacacacacbbbb.......", +".....#.##...acacacacabbbbaaaaa..", +"...#.######.cacacacacbbbb.aaa...", +"...########.acacacacabbbaa#a....", +"...########.cacacacacbaab##a....", +"...#######..acacacacabbbb###....", +"...####.##..cacacacacbbbb#####..", +"...#######..acacacacabbbb#####..", +"...#######..cacacacacbbbb##.##..", +"...#######.aacacacacabbbb#####..", +"...######aa.cacacacacbbbb#####..", +"...####aa#..acacacacabbbb#####..", +"...##aa###..cacacacacbbbb####...", +"...aa######.acacacacabbb#####...", +"........##..cacacacacbb#####....", +"............acacacacab..##......", +"............cacacacac...##......", +"................................", +"................................", +"................................", +"................................"}; diff --git a/icons/geotranslation_t.xpm b/icons/geotranslation_t.xpm new file mode 100644 index 0000000000000000000000000000000000000000..49d6e496cfa34c2dae18ddc995ed13a60db80223 --- /dev/null +++ b/icons/geotranslation_t.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * geotranslation_t_xpm[] = { +"16 16 10 1", +" c None", +". c #303030", +"+ c #686868", +"@ c #848484", +"# c #A0A0A0", +"$ c #7A7A7A", +"% c #8D8D8D", +"& c #7B7B7B", +"* c #555555", +"= c #868686", +" . . ", +" .... ... ", +" ........ ", +" +@#### ", +" ###### ", +" $$$$%## ", +" $$$$%#&.. ", +" $$$$%+*. ", +" $$$$%## ", +" $$$$%## ", +" .$$$$%## ", +" . $$$$%## ", +" $$$$%# ", +" $$$$= ", +" ", +" "}; diff --git a/icons/geovolume_s.xpm b/icons/geovolume_s.xpm new file mode 100644 index 0000000000000000000000000000000000000000..3f504e4267b01ce93bbf31c712f8379d446fd322 --- /dev/null +++ b/icons/geovolume_s.xpm @@ -0,0 +1,40 @@ +/* XPM */ +static char *geovolume_s[]={ +"32 32 5 1", +". c None", +"c c #0000ff", +"# c #303030", +"b c #ff0000", +"a c #ffffc0", +"................................", +"................................", +".#...#..##..#...#..#.#...#.###..", +".#...#.#..#.#...#..#.##.##.#....", +".#...#.#..#.#...#..#.#.#.#.##...", +"..#.#..#..#.#...#..#.#...#.#....", +"...#....##..###..##..#...#.###..", +"................................", +"................................", +"................................", +"................................", +"................................", +"................................", +"..aaaaaaaaaaaaaaaaaaaaaaaaaaaa..", +"..aaaaaaaaaaaaaaaaaaaaaaaaaaaa..", +"..a##aabbbbbaaaaaaaabbbbbaa##a..", +"..a##aabbbbbaaaaaaaabbbbbaa##a..", +"..a##aaaaaaaaaaaaaaaaaaaaaa##a..", +"..a##aaaaaaaaaaaaaaaaaaaaaa##a..", +"..a##aaaaaaaaaaaaaaaaaaaaaa##a..", +"..a##aaaaaaccccccccccaaaaaa##a..", +"..a##aaaaaaccccccccccaaaaaa##a..", +"..a##aaaaaaaaaaaaaaaaaaaaaa##a..", +"..a##aaaaaaaaaaaaaaaaaaaaaa##a..", +"..a##aaaaaaaaaaaaaaaaaaaaaa##a..", +"..a##aabbbbbaaaaaaaabbbbbaa##a..", +"..a##aabbbbbaaaaaaaabbbbbaa##a..", +"..aaaaaaaaaaaaaaaaaaaaaaaaaaaa..", +"..aaaaaaaaaaaaaaaaaaaaaaaaaaaa..", +"................................", +"................................", +"................................"}; diff --git a/icons/geovolume_t.xpm b/icons/geovolume_t.xpm new file mode 100644 index 0000000000000000000000000000000000000000..f16d5398874f9c1a751c153caa969d6df3b01d9a --- /dev/null +++ b/icons/geovolume_t.xpm @@ -0,0 +1,28 @@ +/* XPM */ +static char * geovolume_t_xpm[] = { +"16 16 9 1", +" c None", +". c #303030", +"+ c #FFFFC0", +"@ c #CBCB9C", +"# c #FFBF90", +"$ c #FF8060", +"% c #989878", +"& c #8080E0", +"* c #0000FF", +" ", +". . . . ... ... ", +" .. .. ... .. ", +" . . . ", +" ", +" ", +" ++++++++++++++ ", +" @@#$$++++$$#@@ ", +" %%#$$++++$$#%% ", +" %%++++++++++%% ", +" %%++&****&++%% ", +" %%++++++++++%% ", +" %%#$$++++$$#%% ", +" @@#$$++++$$#@@ ", +" ++++++++++++++ ", +" "}; diff --git a/icons/geoxtru_s.xpm b/icons/geoxtru_s.xpm new file mode 100644 index 0000000000000000000000000000000000000000..3e44b77a83b18d9aa7c61afad7ff04714e7a8706 --- /dev/null +++ b/icons/geoxtru_s.xpm @@ -0,0 +1,44 @@ +/* XPM */ +static char *geoxtru_s[]={ +"32 32 9 1", +". c None", +"d c #606060", +"e c #6f6f6f", +"# c #717171", +"c c #767676", +"g c #979797", +"b c #afafaf", +"a c #b5b5b5", +"f c #b6b6b6", +"................................", +"................................", +"................................", +"................................", +".............####aaabccccaa.....", +".............####aaabccccaa.....", +".............####aaabccccaa.....", +"..............###aaabccccaa.....", +"..............###aaabcccaaa.....", +"..............###aaabcccaa......", +"..............###aaadcccaa......", +"..............cc#aaaeeecaa......", +".............cccccfeeeef........", +"............cccccffeeeeff.......", +"..........ccccccffgeeeeff.......", +".........cccccccffeeeeeff.......", +"........cccccccfffeeeeefff......", +".......cccccccfffgeeeeefff......", +".....cccccccccfffeeeeeefff......", +".....ccccccccfff..eeeeeffff.....", +".....ccccccccfff...eeeeffff.....", +"......ccccccffff....eeeffff.....", +"......cccccffff......eeffff.....", +"......cccccffff.......efffff....", +"......ccccffff.........f........", +".......ccfffff..................", +".......ccfffff..................", +".......cffff....................", +"................................", +"................................", +"................................", +"................................"}; diff --git a/icons/geoxtru_t.xpm b/icons/geoxtru_t.xpm new file mode 100644 index 0000000000000000000000000000000000000000..c7339a1336eb5649eea2a9ba9a88c67bed84de63 --- /dev/null +++ b/icons/geoxtru_t.xpm @@ -0,0 +1,48 @@ +/* XPM */ +static char *geoxtru_t[]={ +"16 16 29 1", +". c None", +"y c #707070", +"h c #727272", +"q c #777777", +"i c #b5b5b5", +"p c #b6b6b6", +"# c #717171", +"w c #767676", +"x c #929292", +"g c #b5b5b5", +"t c #b6b6b6", +"m c #767676", +"A c #b6b6b6", +"k c #6c6c6c", +"o c #6f6f6f", +"a c #717171", +"j c #737373", +"l c #747474", +"e c #767676", +"s c #797979", +"n c #868686", +"d c #929292", +"b c #939393", +"f c #959595", +"z c #969696", +"u c #a6a6a6", +"v c #aeaeae", +"c c #b5b5b5", +"r c #b6b6b6", +"................", +"................", +"......#abcdefg..", +"......habcdefg..", +".......abcdeci..", +".......jbcklc...", +"......mendodp...", +"....qeeersodt...", +"...qeeeuvoodr...", +"..weeenrxoodrp..", +"..qeeeur.yodrt..", +"...eezrt..ydrA..", +"...mnrr....p....", +"...wurt.........", +"................", +"................"};