From 491ae9ac9ceb33f518f166d27ab086c7cc490d3e Mon Sep 17 00:00:00 2001 From: Fons Rademakers <Fons.Rademakers@cern.ch> Date: Mon, 25 Sep 2006 13:45:17 +0000 Subject: [PATCH] From Matevz: Changes required to use new TGedEditor/Frame implementation in geombuilder module. git-svn-id: http://root.cern.ch/svn/root/trunk@16339 27541ba8-7e3a-0410-8455-c3a389f83636 --- geombuilder/inc/TGeoBBoxEditor.h | 15 ++- geombuilder/inc/TGeoConeEditor.h | 17 ++- geombuilder/inc/TGeoEltuEditor.h | 14 +-- geombuilder/inc/TGeoHypeEditor.h | 14 +-- geombuilder/inc/TGeoManagerEditor.h | 18 ++- geombuilder/inc/TGeoMaterialEditor.h | 14 +-- geombuilder/inc/TGeoMatrixEditor.h | 24 ++-- geombuilder/inc/TGeoMediumEditor.h | 14 +-- geombuilder/inc/TGeoNodeEditor.h | 14 +-- geombuilder/inc/TGeoParaEditor.h | 14 +-- geombuilder/inc/TGeoPconEditor.h | 14 +-- geombuilder/inc/TGeoPgonEditor.h | 6 +- geombuilder/inc/TGeoSphereEditor.h | 14 +-- geombuilder/inc/TGeoTabManager.h | 30 +++-- geombuilder/inc/TGeoTorusEditor.h | 14 +-- geombuilder/inc/TGeoTrapEditor.h | 18 +-- geombuilder/inc/TGeoTrd1Editor.h | 14 +-- geombuilder/inc/TGeoTrd2Editor.h | 14 +-- geombuilder/inc/TGeoTubeEditor.h | 22 ++-- geombuilder/inc/TGeoVolumeEditor.h | 14 +-- geombuilder/src/TGeoBBoxEditor.cxx | 49 ++------ geombuilder/src/TGeoConeEditor.cxx | 68 ++-------- geombuilder/src/TGeoEltuEditor.cxx | 36 +----- geombuilder/src/TGeoHypeEditor.cxx | 36 +----- geombuilder/src/TGeoManagerEditor.cxx | 119 ++++++++++++------ geombuilder/src/TGeoMaterialEditor.cxx | 36 +----- geombuilder/src/TGeoMatrixEditor.cxx | 98 ++------------- geombuilder/src/TGeoMediumEditor.cxx | 35 +----- geombuilder/src/TGeoNodeEditor.cxx | 35 +----- geombuilder/src/TGeoParaEditor.cxx | 36 +----- geombuilder/src/TGeoPconEditor.cxx | 38 ++---- geombuilder/src/TGeoPgonEditor.cxx | 36 +----- geombuilder/src/TGeoSphereEditor.cxx | 36 +----- geombuilder/src/TGeoTabManager.cxx | 165 +++++++++---------------- geombuilder/src/TGeoTorusEditor.cxx | 36 +----- geombuilder/src/TGeoTrapEditor.cxx | 69 ++--------- geombuilder/src/TGeoTrd1Editor.cxx | 35 +----- geombuilder/src/TGeoTrd2Editor.cxx | 35 +----- geombuilder/src/TGeoTubeEditor.cxx | 102 +++------------ geombuilder/src/TGeoVolumeEditor.cxx | 68 +++++----- 40 files changed, 455 insertions(+), 1031 deletions(-) diff --git a/geombuilder/inc/TGeoBBoxEditor.h b/geombuilder/inc/TGeoBBoxEditor.h index 4e918f2cae7..01fe196ba4c 100644 --- a/geombuilder/inc/TGeoBBoxEditor.h +++ b/geombuilder/inc/TGeoBBoxEditor.h @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoBBoxEditor.h,v 1.1 2006/06/13 15:27:11 brun Exp $ +// @(#):$Name: $:$Id: TGeoBBoxEditor.h,v 1.2 2006/06/23 16:00:13 brun Exp $ // Author: M.Gheata /************************************************************************* * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. * @@ -22,8 +22,8 @@ #ifndef ROOT_TGButton #include "TGWidget.h" #endif -#ifndef ROOT_TGedFrame -#include "TGedFrame.h" +#ifndef ROOT_TGeoGedFrame +#include "TGeoGedFrame.h" #endif class TGeoBBox; @@ -36,7 +36,7 @@ class TGTextButton; class TGCheckButton; class TString; -class TGeoBBoxEditor : public TGedFrame { +class TGeoBBoxEditor : public TGeoGedFrame { protected: @@ -48,7 +48,6 @@ protected: 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 @@ -60,16 +59,16 @@ protected: TGTextButton *fUndo; // Undo-Button TGCheckButton *fDelayed; // Check button for delayed draw - virtual void ConnectSignals2Slots(); // Connect the signals to the slots + virtual void ConnectSignals2Slots(); // Connect the signals to the slots Bool_t IsDelayed() const; public: - TGeoBBoxEditor(const TGWindow *p, Int_t id, + TGeoBBoxEditor(const TGWindow *p = 0, 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); + virtual void SetModel(TObject *obj); void DoDx(); void DoDy(); diff --git a/geombuilder/inc/TGeoConeEditor.h b/geombuilder/inc/TGeoConeEditor.h index 9bdee7e6f5b..2adb84d4594 100644 --- a/geombuilder/inc/TGeoConeEditor.h +++ b/geombuilder/inc/TGeoConeEditor.h @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoConeEditor.h,v 1.2 2006/06/23 16:00:13 brun Exp $ +// @(#):$Name: $:$Id: TGeoConeEditor.h,v 1.3 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. * @@ -22,8 +22,8 @@ #ifndef ROOT_TGButton #include "TGWidget.h" #endif -#ifndef ROOT_TGedFrame -#include "TGedFrame.h" +#ifndef ROOT_TGeoGedFrame +#include "TGeoGedFrame.h" #endif class TGeoCone; @@ -37,7 +37,7 @@ class TGTextButton; class TGCheckButton; class TString; -class TGeoConeEditor : public TGedFrame { +class TGeoConeEditor : public TGeoGedFrame { protected: @@ -50,7 +50,6 @@ protected: 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 @@ -67,12 +66,12 @@ protected: Bool_t IsDelayed() const; public: - TGeoConeEditor(const TGWindow *p, Int_t id, + TGeoConeEditor(const TGWindow *p = 0, 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); + virtual void SetModel(TObject *obj); void DoRmin1(); void DoRmin2(); @@ -111,12 +110,12 @@ protected: virtual void ConnectSignals2Slots(); // Connect the signals to the slots public: - TGeoConeSegEditor(const TGWindow *p, Int_t id, + TGeoConeSegEditor(const TGWindow *p = 0, 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); + virtual void SetModel(TObject *obj); void DoPhi(); void DoPhi1(); diff --git a/geombuilder/inc/TGeoEltuEditor.h b/geombuilder/inc/TGeoEltuEditor.h index 082e1504f43..6e64d63ec97 100644 --- a/geombuilder/inc/TGeoEltuEditor.h +++ b/geombuilder/inc/TGeoEltuEditor.h @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoEltuEditor.h,v 1.1 2006/06/23 16:00:13 brun Exp $ // Author: M.Gheata /************************************************************************* * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. * @@ -22,8 +22,8 @@ #ifndef ROOT_TGButton #include "TGWidget.h" #endif -#ifndef ROOT_TGedFrame -#include "TGedFrame.h" +#ifndef ROOT_TGeoGedFrame +#include "TGeoGedFrame.h" #endif class TGeoEltu; @@ -36,7 +36,7 @@ class TGTextButton; class TGCheckButton; class TString; -class TGeoEltuEditor : public TGedFrame { +class TGeoEltuEditor : public TGeoGedFrame { protected: @@ -47,7 +47,7 @@ protected: TGeoEltu *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 *fEA; // Number entry for A TGNumberEntry *fEB; // Number entry for B @@ -60,12 +60,12 @@ protected: Bool_t IsDelayed() const; public: - TGeoEltuEditor(const TGWindow *p, Int_t id, + TGeoEltuEditor(const TGWindow *p = 0, Int_t width = 140, Int_t height = 30, UInt_t options = kChildFrame, Pixel_t back = GetDefaultFrameBackground()); virtual ~TGeoEltuEditor(); - virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + virtual void SetModel(TObject *obj); void DoA(); void DoB(); diff --git a/geombuilder/inc/TGeoHypeEditor.h b/geombuilder/inc/TGeoHypeEditor.h index 7646ccfcf40..6aff2312de4 100644 --- a/geombuilder/inc/TGeoHypeEditor.h +++ b/geombuilder/inc/TGeoHypeEditor.h @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoHypeEditor.h,v 1.1 2006/06/23 16:00:13 brun Exp $ // Author: M.Gheata /************************************************************************* * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. * @@ -22,8 +22,8 @@ #ifndef ROOT_TGButton #include "TGWidget.h" #endif -#ifndef ROOT_TGedFrame -#include "TGedFrame.h" +#ifndef ROOT_TGeoGedFrame +#include "TGeoGedFrame.h" #endif class TGeoHype; @@ -36,7 +36,7 @@ class TGTextButton; class TGCheckButton; class TString; -class TGeoHypeEditor : public TGedFrame { +class TGeoHypeEditor : public TGeoGedFrame { protected: @@ -49,7 +49,7 @@ protected: TGeoHype *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 *fERin; // Number entry for Rin TGNumberEntry *fERout; // Number entry for Rout @@ -64,12 +64,12 @@ protected: Bool_t IsDelayed() const; public: - TGeoHypeEditor(const TGWindow *p, Int_t id, + TGeoHypeEditor(const TGWindow *p = 0, Int_t width = 140, Int_t height = 30, UInt_t options = kChildFrame, Pixel_t back = GetDefaultFrameBackground()); virtual ~TGeoHypeEditor(); - virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + virtual void SetModel(TObject *obj); void DoRin(); void DoRout(); diff --git a/geombuilder/inc/TGeoManagerEditor.h b/geombuilder/inc/TGeoManagerEditor.h index 1b8598e760e..5d6a610b8c9 100644 --- a/geombuilder/inc/TGeoManagerEditor.h +++ b/geombuilder/inc/TGeoManagerEditor.h @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoManagerEditor.h,v 1.1 2006/06/13 15:27:11 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -23,8 +23,8 @@ #ifndef ROOT_TGButton #include "TGWidget.h" #endif -#ifndef ROOT_TGedFrame -#include "TGedFrame.h" +#ifndef ROOT_TGeoGedFrame +#include "TGeoGedFrame.h" #endif class TGeoManager; @@ -51,6 +51,8 @@ protected: TGeoManager *fGeometry; // Selected geometry manager TGeoTabManager *fTabMgr; // Tab manager + TGTab *fTab; // TGTab of GedEditor + TGCompositeFrame *fVolumeTab; // Tab of Volume tab Bool_t fIsModified; // Flag that manager was modified TGShutter *fCategories; // Categories shutter TGTextEntry *fManagerName; // Name text entry @@ -108,6 +110,7 @@ protected: TGCompositeFrame *f5; // Parent frame for media editing TGCompositeFrame *f6; // Parent frame for matrices editing TGCompositeFrame *f7; // Parent frame for closing geometry + TCanvas *fConnectedCanvas; // Canvas connected to SelectedSlot() virtual void ConnectSignals2Slots(); // Connect the signals to the slots void ShowSelectShape(Bool_t show=kTRUE); @@ -117,13 +120,18 @@ protected: void ShowSelectMatrix(Bool_t show=kTRUE); public: - TGeoManagerEditor(const TGWindow *p, Int_t id, + TGeoManagerEditor(const TGWindow *p = 0, 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); + virtual void SetGedEditor(TGedEditor* ed); + virtual void SetModel(TObject *obj); + + virtual void SelectedSlot(TVirtualPad* pad, TObject* obj, Int_t event); + void ConnectSelected(TCanvas *c); + void DisconnectSelected(); void DoName(); void DoCreateBox(); diff --git a/geombuilder/inc/TGeoMaterialEditor.h b/geombuilder/inc/TGeoMaterialEditor.h index ae4d4581442..f8cd3e51b6c 100644 --- a/geombuilder/inc/TGeoMaterialEditor.h +++ b/geombuilder/inc/TGeoMaterialEditor.h @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoMaterialEditor.h,v 1.1 2006/06/13 15:27:11 brun Exp $ // Author: M.Gheata /************************************************************************* * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. * @@ -22,8 +22,8 @@ #ifndef ROOT_TGButton #include "TGWidget.h" #endif -#ifndef ROOT_TGedFrame -#include "TGedFrame.h" +#ifndef ROOT_TGeoGedFrame +#include "TGeoGedFrame.h" #endif class TGeoMaterial; @@ -35,7 +35,7 @@ class TGComboBox; class TGTextButton; class TString; -class TGeoMaterialEditor : public TGedFrame { +class TGeoMaterialEditor : public TGeoGedFrame { protected: @@ -46,7 +46,7 @@ protected: 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 @@ -60,12 +60,12 @@ protected: virtual void ConnectSignals2Slots(); // Connect the signals to the slots public: - TGeoMaterialEditor(const TGWindow *p, Int_t id, + TGeoMaterialEditor(const TGWindow *p = 0, 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); + virtual void SetModel(TObject *obj); void DoA(); void DoZ(); diff --git a/geombuilder/inc/TGeoMatrixEditor.h b/geombuilder/inc/TGeoMatrixEditor.h index ebe3bc8487c..f9550ee1f75 100644 --- a/geombuilder/inc/TGeoMatrixEditor.h +++ b/geombuilder/inc/TGeoMatrixEditor.h @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoMatrixEditor.h,v 1.1 2006/06/13 15:27:11 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -23,8 +23,8 @@ #ifndef ROOT_TGButton #include "TGWidget.h" #endif -#ifndef ROOT_TGedFrame -#include "TGedFrame.h" +#ifndef ROOT_TGeoGedFrame +#include "TGeoGedFrame.h" #endif class TGeoTranslation; @@ -38,7 +38,7 @@ class TGTextButton; class TGRadioButton; class TString; -class TGeoTranslationEditor : public TGedFrame { +class TGeoTranslationEditor : public TGeoGedFrame { protected: @@ -60,12 +60,12 @@ protected: virtual void ConnectSignals2Slots(); // Connect the signals to the slots public: - TGeoTranslationEditor(const TGWindow *p, Int_t id, + TGeoTranslationEditor(const TGWindow *p = 0, 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); + virtual void SetModel(TObject *obj); void DoDx(); void DoDy(); @@ -88,7 +88,7 @@ public: // // ////////////////////////////////////////////////////////////////////////// -class TGeoRotationEditor : public TGedFrame { +class TGeoRotationEditor : public TGeoGedFrame { protected: @@ -117,12 +117,12 @@ protected: virtual void ConnectSignals2Slots(); // Connect the signals to the slots public: - TGeoRotationEditor(const TGWindow *p, Int_t id, + TGeoRotationEditor(const TGWindow *p = 0, 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); + virtual void SetModel(TObject *obj); void DoRotPhi(); void DoRotTheta(); @@ -146,7 +146,7 @@ public: // // ////////////////////////////////////////////////////////////////////////// -class TGeoCombiTransEditor : public TGedFrame { +class TGeoCombiTransEditor : public TGeoGedFrame { protected: @@ -181,12 +181,12 @@ protected: virtual void ConnectSignals2Slots(); // Connect the signals to the slots public: - TGeoCombiTransEditor(const TGWindow *p, Int_t id, + TGeoCombiTransEditor(const TGWindow *p = 0, 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); + virtual void SetModel(TObject *obj); void DoDx(); void DoDy(); diff --git a/geombuilder/inc/TGeoMediumEditor.h b/geombuilder/inc/TGeoMediumEditor.h index 9a39dad73c7..3e900358f3f 100644 --- a/geombuilder/inc/TGeoMediumEditor.h +++ b/geombuilder/inc/TGeoMediumEditor.h @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoMediumEditor.h,v 1.1 2006/06/13 15:27:11 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -23,8 +23,8 @@ #ifndef ROOT_TGButton #include "TGWidget.h" #endif -#ifndef ROOT_TGedFrame -#include "TGedFrame.h" +#ifndef ROOT_TGeoGedFrame +#include "TGeoGedFrame.h" #endif class TGeoMedium; @@ -39,12 +39,12 @@ class TGPictureButton; class TGCheckButton; class TGLabel; -class TGeoMediumEditor : public TGedFrame { +class TGeoMediumEditor : public TGeoGedFrame { 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 @@ -68,12 +68,12 @@ protected: virtual void ConnectSignals2Slots(); // Connect the signals to the slots public: - TGeoMediumEditor(const TGWindow *p, Int_t id, + TGeoMediumEditor(const TGWindow *p = 0, 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); + virtual void SetModel(TObject *obj); void DoEditMaterial(); void DoSelectMaterial(); diff --git a/geombuilder/inc/TGeoNodeEditor.h b/geombuilder/inc/TGeoNodeEditor.h index b66a54a9cdc..5346f798db3 100644 --- a/geombuilder/inc/TGeoNodeEditor.h +++ b/geombuilder/inc/TGeoNodeEditor.h @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoNodeEditor.h,v 1.1 2006/06/13 15:27:11 brun Exp $ +// @(#):$Name: $:$Id: TGeoNodeEditor.h,v 1.2 2006/06/23 16:00:13 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -23,8 +23,8 @@ #ifndef ROOT_TGButton #include "TGWidget.h" #endif -#ifndef ROOT_TGedFrame -#include "TGedFrame.h" +#ifndef ROOT_TGeoGedFrame +#include "TGeoGedFrame.h" #endif class TGeoNode; @@ -39,12 +39,12 @@ class TGPictureButton; class TGCheckButton; class TGeoTabManager; -class TGeoNodeEditor : public TGedFrame { +class TGeoNodeEditor : public TGeoGedFrame { 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 @@ -67,12 +67,12 @@ protected: virtual void ConnectSignals2Slots(); // Connect the signals to the slots public: - TGeoNodeEditor(const TGWindow *p, Int_t id, + TGeoNodeEditor(const TGWindow *p = 0, 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); + virtual void SetModel(TObject *obj); void DoEditMother(); void DoEditVolume(); diff --git a/geombuilder/inc/TGeoParaEditor.h b/geombuilder/inc/TGeoParaEditor.h index fe3cead84e2..820152e473d 100644 --- a/geombuilder/inc/TGeoParaEditor.h +++ b/geombuilder/inc/TGeoParaEditor.h @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoParaEditor.h,v 1.1 2006/06/23 16:00:13 brun Exp $ // Author: M.Gheata /************************************************************************* * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. * @@ -22,8 +22,8 @@ #ifndef ROOT_TGButton #include "TGWidget.h" #endif -#ifndef ROOT_TGedFrame -#include "TGedFrame.h" +#ifndef ROOT_TGeoGedFrame +#include "TGeoGedFrame.h" #endif class TGeoPara; @@ -36,7 +36,7 @@ class TGTextButton; class TGCheckButton; class TString; -class TGeoParaEditor : public TGedFrame { +class TGeoParaEditor : public TGeoGedFrame { protected: @@ -50,7 +50,7 @@ protected: TGeoPara *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 *fEDx; // Number entry for DX2 TGNumberEntry *fEDy; // Number entry for DY @@ -66,12 +66,12 @@ protected: Bool_t IsDelayed() const; public: - TGeoParaEditor(const TGWindow *p, Int_t id, + TGeoParaEditor(const TGWindow *p = 0, Int_t width = 140, Int_t height = 30, UInt_t options = kChildFrame, Pixel_t back = GetDefaultFrameBackground()); virtual ~TGeoParaEditor(); - virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + virtual void SetModel(TObject *obj); void DoX(); void DoY(); diff --git a/geombuilder/inc/TGeoPconEditor.h b/geombuilder/inc/TGeoPconEditor.h index 09d712f3ffb..f8864f60296 100644 --- a/geombuilder/inc/TGeoPconEditor.h +++ b/geombuilder/inc/TGeoPconEditor.h @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoPconEditor.h,v 1.3 2006/07/12 10:25:34 brun Exp $ +// @(#):$Name: $:$Id: TGeoPconEditor.h,v 1.4 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. * @@ -22,8 +22,8 @@ #ifndef ROOT_TGButton #include "TGWidget.h" #endif -#ifndef ROOT_TGedFrame -#include "TGedFrame.h" +#ifndef ROOT_TGeoGedFrame +#include "TGeoGedFrame.h" #endif class TGeoPcon; @@ -38,7 +38,7 @@ class TGCheckButton; class TGCanvas; class TString; -class TGeoPconEditor : public TGedFrame { +class TGeoPconEditor : public TGeoGedFrame { protected: Int_t fNsecti; // Initial number of sections @@ -53,7 +53,7 @@ protected: TGeoPcon *fShape; // Shape object Bool_t fIsModified; // Flag that volume was modified Bool_t fIsShapeEditable; // Flag that the shape can be changed - TGeoTabManager *fTabMgr; // Tab manager + TGLayoutHints *fLHsect; // Layout hints for sections TGTextEntry *fShapeName; // Shape name text entry TGNumberEntry *fENz; // Number entry for nsections @@ -72,12 +72,12 @@ protected: void UpdateSections(); virtual void CreateEdges() {;} public: - TGeoPconEditor(const TGWindow *p, Int_t id, + TGeoPconEditor(const TGWindow *p = 0, Int_t width = 140, Int_t height = 30, UInt_t options = kChildFrame, Pixel_t back = GetDefaultFrameBackground()); virtual ~TGeoPconEditor(); - virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + virtual void SetModel(TObject *obj); void DoModified(); void DoName(); diff --git a/geombuilder/inc/TGeoPgonEditor.h b/geombuilder/inc/TGeoPgonEditor.h index fec1106fca6..46576533708 100644 --- a/geombuilder/inc/TGeoPgonEditor.h +++ b/geombuilder/inc/TGeoPgonEditor.h @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoPgonEditor.h,v 1.1 2006/07/12 10:25:34 brun Exp $ // Author: M.Gheata /************************************************************************* * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. * @@ -38,12 +38,12 @@ protected: virtual void CreateEdges(); public: - TGeoPgonEditor(const TGWindow *p, Int_t id, + TGeoPgonEditor(const TGWindow *p = 0, Int_t width = 140, Int_t height = 30, UInt_t options = kChildFrame, Pixel_t back = GetDefaultFrameBackground()); virtual ~TGeoPgonEditor(); - virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + virtual void SetModel(TObject *obj); void DoNedges(); virtual void DoApply(); diff --git a/geombuilder/inc/TGeoSphereEditor.h b/geombuilder/inc/TGeoSphereEditor.h index 60d97948d7a..853ae124342 100644 --- a/geombuilder/inc/TGeoSphereEditor.h +++ b/geombuilder/inc/TGeoSphereEditor.h @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoSphereEditor.h,v 1.1 2006/06/13 15:27:11 brun Exp $ +// @(#):$Name: $:$Id: TGeoSphereEditor.h,v 1.2 2006/06/23 16:00:13 brun Exp $ // Author: M.Gheata /************************************************************************* * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. * @@ -22,8 +22,8 @@ #ifndef ROOT_TGButton #include "TGWidget.h" #endif -#ifndef ROOT_TGedFrame -#include "TGedFrame.h" +#ifndef ROOT_TGeoGedFrame +#include "TGeoGedFrame.h" #endif class TGeoSphere; @@ -37,7 +37,7 @@ class TGTextButton; class TGCheckButton; class TString; -class TGeoSphereEditor : public TGedFrame { +class TGeoSphereEditor : public TGeoGedFrame { protected: @@ -52,7 +52,7 @@ protected: 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 @@ -70,12 +70,12 @@ protected: Bool_t IsDelayed() const; public: - TGeoSphereEditor(const TGWindow *p, Int_t id, + TGeoSphereEditor(const TGWindow *p = 0, 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); + virtual void SetModel(TObject *obj); void DoRmin(); void DoRmax(); diff --git a/geombuilder/inc/TGeoTabManager.h b/geombuilder/inc/TGeoTabManager.h index 1c9637de109..c46fc71b3bb 100644 --- a/geombuilder/inc/TGeoTabManager.h +++ b/geombuilder/inc/TGeoTabManager.h @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoTabManager.h,v 1.3 2006/06/24 08:26:42 brun Exp $ +// @(#):$Name: $:$Id: TGeoTabManager.h,v 1.4 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -24,6 +24,8 @@ #include "TObject.h" #endif +#include "TMap.h" + class TVirtualPad; class TClass; @@ -36,6 +38,8 @@ class TGListTree; class TGListTreeItem; class TGCanvas; +class TGedEditor; + class TGeoShape; class TGeoVolume; class TGeoMedium; @@ -46,8 +50,9 @@ class TGeoTreeDialog; class TGeoTransientPanel; class TGeoTabManager : public TObject { - + friend class TGeoManagerEditor; private: + TGedEditor *fGedEditor; // Parent editor TVirtualPad *fPad; // Pad to which this applies TGTab *fTab; // Parent tab TGeoVolume *fVolume; // Edited volume @@ -56,22 +61,22 @@ private: TGeoTransientPanel *fMaterialPanel; // Panel for editing materials TGeoTransientPanel *fMatrixPanel; // Panel for editing matrices TGCompositeFrame *fVolumeTab; // Volume tab - TGCompositeFrame *fVolumeCont; // Volume tab container - void CreateTabs(); + static TMap fgEditorToMgrMap; // Map from ged-editor to associated tab-manager + void GetEditors(TClass *cl); public: - TGeoTabManager(TVirtualPad *pad, TGTab *tab); + TGeoTabManager(TGedEditor *ged); virtual ~TGeoTabManager(); - static TGeoTabManager *GetMakeTabManager(TVirtualPad *pad, TGTab *tab); + static TGeoTabManager *GetMakeTabManager(TGedEditor *ged); static void Cleanup(TGCompositeFrame *frame); TVirtualPad *GetPad() const {return fPad;} TGTab *GetTab() const {return fTab;} Int_t GetTabIndex() const; static void MoveFrame(TGCompositeFrame *fr, TGCompositeFrame *p); void SetVolTabEnabled(Bool_t flag=kTRUE); - void SetModel(TObject *model, Int_t event=0); + void SetModel(TObject *model); void SetTab(); void GetShapeEditor(TGeoShape *shape); @@ -80,10 +85,8 @@ public: void GetMediumEditor(TGeoMedium *medium); void GetMaterialEditor(TGeoMaterial *material); - - TGCompositeFrame *GetVolumeTab() const {return fVolumeTab;} - TGCompositeFrame *GetVolumeCont() const {return fVolumeCont;} - TGeoVolume *GetVolume() const {return fVolume;} + TGCompositeFrame *GetVolumeTab() const {return fVolumeTab;} + TGeoVolume *GetVolume() const {return fVolume;} ClassDef(TGeoTabManager, 0) // Tab manager for geometry editors }; @@ -199,6 +202,7 @@ public: }; class TGeoTransientPanel : public TGMainFrame { + TGedEditor *fGedEditor; // ged-editor steering this panel TGCanvas *fCan; // TGCanvas containing a TGTab TGTab *fTab; //tab widget holding the editor TGCompositeFrame *fTabContainer; //main tab container @@ -207,7 +211,7 @@ class TGeoTransientPanel : public TGMainFrame { TGTextButton *fClose; //close button public: - TGeoTransientPanel(const char *name, TObject *obj); + TGeoTransientPanel(TGedEditor* ged, const char *name, TObject *obj); virtual ~TGeoTransientPanel(); virtual void CloseWindow(); @@ -220,7 +224,7 @@ public: void GetEditors(TClass *cl); virtual void Hide(); virtual void Show(); - void SetModel(TObject *model, Int_t event=0); + void SetModel(TObject *model); ClassDef(TGeoTransientPanel, 0) // List-Tree based dialog }; diff --git a/geombuilder/inc/TGeoTorusEditor.h b/geombuilder/inc/TGeoTorusEditor.h index 4c535079e62..455f5e0919c 100644 --- a/geombuilder/inc/TGeoTorusEditor.h +++ b/geombuilder/inc/TGeoTorusEditor.h @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: Exp $ +// @(#):$Name: $:$Id: TGeoTorusEditor.h,v 1.1 2006/06/23 16:00:13 brun Exp $ // Author: M.Gheata /************************************************************************* * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. * @@ -22,8 +22,8 @@ #ifndef ROOT_TGButton #include "TGWidget.h" #endif -#ifndef ROOT_TGedFrame -#include "TGedFrame.h" +#ifndef ROOT_TGeoGedFrame +#include "TGeoGedFrame.h" #endif class TGeoTorus; @@ -36,7 +36,7 @@ class TGTextButton; class TGCheckButton; class TString; -class TGeoTorusEditor : public TGedFrame { +class TGeoTorusEditor : public TGeoGedFrame { protected: @@ -49,7 +49,7 @@ protected: TGeoTorus *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 *fER; // Number entry for R TGNumberEntry *fERmin; // Number entry for Rmin @@ -64,12 +64,12 @@ protected: Bool_t IsDelayed() const; public: - TGeoTorusEditor(const TGWindow *p, Int_t id, + TGeoTorusEditor(const TGWindow *p = 0, Int_t width = 140, Int_t height = 30, UInt_t options = kChildFrame, Pixel_t back = GetDefaultFrameBackground()); virtual ~TGeoTorusEditor(); - virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + virtual void SetModel(TObject *obj); void DoR(); void DoRmin(); diff --git a/geombuilder/inc/TGeoTrapEditor.h b/geombuilder/inc/TGeoTrapEditor.h index 79733a128d8..ceff4742511 100644 --- a/geombuilder/inc/TGeoTrapEditor.h +++ b/geombuilder/inc/TGeoTrapEditor.h @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoTrapEditor.h,v 1.1 2006/07/12 10:25:34 brun Exp $ +// @(#):$Name: $:$Id: TGeoTrapEditor.h,v 1.2 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. * @@ -22,8 +22,8 @@ #ifndef ROOT_TGButton #include "TGWidget.h" #endif -#ifndef ROOT_TGedFrame -#include "TGedFrame.h" +#ifndef ROOT_TGeoGedFrame +#include "TGeoGedFrame.h" #endif class TGeoTrap; @@ -36,7 +36,7 @@ class TGTextButton; class TGCheckButton; class TString; -class TGeoTrapEditor : public TGedFrame { +class TGeoTrapEditor : public TGeoGedFrame { protected: @@ -52,7 +52,7 @@ protected: TGeoTrap *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 *fEH1; // Number entry for H1 TGNumberEntry *fEBl1; // Number entry for Bl1 @@ -73,12 +73,12 @@ protected: Bool_t IsDelayed() const; public: - TGeoTrapEditor(const TGWindow *p, Int_t id, + TGeoTrapEditor(const TGWindow *p = 0, Int_t width = 140, Int_t height = 30, UInt_t options = kChildFrame, Pixel_t back = GetDefaultFrameBackground()); virtual ~TGeoTrapEditor(); - virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + virtual void SetModel(TObject *obj); void DoH1(); void DoBl1(); @@ -105,12 +105,12 @@ protected: TGNumberEntry *fETwist; // Number entry for H1 public: - TGeoGtraEditor(const TGWindow *p, Int_t id, + TGeoGtraEditor(const TGWindow *p = 0, Int_t width = 140, Int_t height = 30, UInt_t options = kChildFrame, Pixel_t back = GetDefaultFrameBackground()); virtual ~TGeoGtraEditor(); - virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + virtual void SetModel(TObject *obj); void DoTwist(); virtual void DoApply(); diff --git a/geombuilder/inc/TGeoTrd1Editor.h b/geombuilder/inc/TGeoTrd1Editor.h index 035d01644b1..b8ec525ec58 100644 --- a/geombuilder/inc/TGeoTrd1Editor.h +++ b/geombuilder/inc/TGeoTrd1Editor.h @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoTrd1Editor.h,v 1.1 2006/06/13 15:27:11 brun Exp $ +// @(#):$Name: $:$Id: TGeoTrd1Editor.h,v 1.2 2006/06/23 16:00:13 brun Exp $ // Author: M.Gheata /************************************************************************* * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. * @@ -22,8 +22,8 @@ #ifndef ROOT_TGButton #include "TGWidget.h" #endif -#ifndef ROOT_TGedFrame -#include "TGedFrame.h" +#ifndef ROOT_TGeoGedFrame +#include "TGeoGedFrame.h" #endif class TGeoTrd1; @@ -36,7 +36,7 @@ class TGTextButton; class TGCheckButton; class TString; -class TGeoTrd1Editor : public TGedFrame { +class TGeoTrd1Editor : public TGeoGedFrame { protected: @@ -48,7 +48,7 @@ protected: 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 @@ -62,12 +62,12 @@ protected: Bool_t IsDelayed() const; public: - TGeoTrd1Editor(const TGWindow *p, Int_t id, + TGeoTrd1Editor(const TGWindow *p = 0, 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); + virtual void SetModel(TObject *obj); void DoDx1(); void DoDx2(); diff --git a/geombuilder/inc/TGeoTrd2Editor.h b/geombuilder/inc/TGeoTrd2Editor.h index d18000f28f4..c43f0f230d2 100644 --- a/geombuilder/inc/TGeoTrd2Editor.h +++ b/geombuilder/inc/TGeoTrd2Editor.h @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoTrd2Editor.h,v 1.1 2006/06/13 15:27:11 brun Exp $ +// @(#):$Name: $:$Id: TGeoTrd2Editor.h,v 1.2 2006/06/23 16:00:13 brun Exp $ // Author: M.Gheata /************************************************************************* * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. * @@ -22,8 +22,8 @@ #ifndef ROOT_TGButton #include "TGWidget.h" #endif -#ifndef ROOT_TGedFrame -#include "TGedFrame.h" +#ifndef ROOT_TGeoGedFrame +#include "TGeoGedFrame.h" #endif class TGeoTrd2; @@ -36,7 +36,7 @@ class TGTextButton; class TGCheckButton; class TString; -class TGeoTrd2Editor : public TGedFrame { +class TGeoTrd2Editor : public TGeoGedFrame { protected: @@ -49,7 +49,7 @@ protected: 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 @@ -64,12 +64,12 @@ protected: Bool_t IsDelayed() const; public: - TGeoTrd2Editor(const TGWindow *p, Int_t id, + TGeoTrd2Editor(const TGWindow *p = 0, 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); + virtual void SetModel(TObject *obj); void DoDx1(); void DoDx2(); diff --git a/geombuilder/inc/TGeoTubeEditor.h b/geombuilder/inc/TGeoTubeEditor.h index fd932297f20..19083900e9e 100644 --- a/geombuilder/inc/TGeoTubeEditor.h +++ b/geombuilder/inc/TGeoTubeEditor.h @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoTubeEditor.h,v 1.2 2006/06/23 16:00:13 brun Exp $ +// @(#):$Name: $:$Id: TGeoTubeEditor.h,v 1.3 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. * @@ -22,8 +22,8 @@ #ifndef ROOT_TGButton #include "TGWidget.h" #endif -#ifndef ROOT_TGedFrame -#include "TGedFrame.h" +#ifndef ROOT_TGeoGedFrame +#include "TGeoGedFrame.h" #endif class TGeoTube; @@ -36,7 +36,7 @@ class TGTextButton; class TGCheckButton; class TString; -class TGeoTubeEditor : public TGedFrame { +class TGeoTubeEditor : public TGeoGedFrame { protected: @@ -47,7 +47,7 @@ protected: 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 @@ -62,12 +62,12 @@ protected: Bool_t IsDelayed() const; public: - TGeoTubeEditor(const TGWindow *p, Int_t id, + TGeoTubeEditor(const TGWindow *p = 0, 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); + virtual void SetModel(TObject *obj); void DoRmin(); void DoRmax(); @@ -104,12 +104,12 @@ protected: virtual void ConnectSignals2Slots(); // Connect the signals to the slots public: - TGeoTubeSegEditor(const TGWindow *p, Int_t id, + TGeoTubeSegEditor(const TGWindow *p = 0, 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); + virtual void SetModel(TObject *obj); void DoPhi(); void DoPhi1(); @@ -141,12 +141,12 @@ protected: TGNumberEntry *fEPhhi; // Number entry for phhi public: - TGeoCtubEditor(const TGWindow *p, Int_t id, + TGeoCtubEditor(const TGWindow *p = 0, Int_t width = 140, Int_t height = 30, UInt_t options = kChildFrame, Pixel_t back = GetDefaultFrameBackground()); virtual ~TGeoCtubEditor(); - virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event); + virtual void SetModel(TObject *obj); void DoThlo(); void DoPhlo(); diff --git a/geombuilder/inc/TGeoVolumeEditor.h b/geombuilder/inc/TGeoVolumeEditor.h index 733e6b02dfa..316ed85ae4a 100644 --- a/geombuilder/inc/TGeoVolumeEditor.h +++ b/geombuilder/inc/TGeoVolumeEditor.h @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoVolumeEditor.h,v 1.1 2006/06/13 15:27:11 brun Exp $ +// @(#):$Name: $:$Id: TGeoVolumeEditor.h,v 1.2 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -23,8 +23,8 @@ #ifndef ROOT_TGButton #include "TGWidget.h" #endif -#ifndef ROOT_TGedFrame -#include "TGedFrame.h" +#ifndef ROOT_TGeoGedFrame +#include "TGeoGedFrame.h" #endif class TGeoManager; @@ -45,12 +45,11 @@ class TGShutter; class TGShutterItem; class TGeoTabManager; -class TGeoVolumeEditor : public TGedFrame { +class TGeoVolumeEditor : public TGeoGedFrame { 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 @@ -95,12 +94,13 @@ protected: virtual void ConnectSignals2Slots(); // Connect the signals to the slots public: - TGeoVolumeEditor(const TGWindow *p, Int_t id, + TGeoVolumeEditor(const TGWindow *p = 0, 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); + virtual void SetModel(TObject *obj); + virtual void ActivateBaseClassEditors(TClass* cl); void DoAddNode(); void DoVolumeName(); diff --git a/geombuilder/src/TGeoBBoxEditor.cxx b/geombuilder/src/TGeoBBoxEditor.cxx index b49685814cd..82c2b0d41bc 100644 --- a/geombuilder/src/TGeoBBoxEditor.cxx +++ b/geombuilder/src/TGeoBBoxEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoBBoxEditor.cxx,v 1.3 2006/06/23 16:00:13 brun Exp $ +// @(#):$Name: $:$Id: TGeoBBoxEditor.cxx,v 1.4 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -48,11 +48,12 @@ enum ETGeoBBoxWid { }; //______________________________________________________________________________ -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) +TGeoBBoxEditor::TGeoBBoxEditor(const TGWindow *p, Int_t width, + Int_t height, UInt_t options, Pixel_t back) + : TGeoGedFrame(p, width, height, options | kVerticalFrame, back) { - // Constructor for volume editor + // Constructor for volume editor. + fShape = 0; fDxi = fDyi = fDzi = 0.0; memset(fOrigi, 0, 3*sizeof(Double_t)); @@ -60,8 +61,6 @@ TGeoBBoxEditor::TGeoBBoxEditor(const TGWindow *p, Int_t id, Int_t width, fIsModified = kFALSE; fIsShapeEditable = kFALSE; - fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); - // TextEntry for shape name MakeTitle("Name"); fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kBOX_NAME); @@ -166,23 +165,13 @@ TGeoBBoxEditor::TGeoBBoxEditor(const TGWindow *p, Int_t id, Int_t width, fUndo->Associate(this); AddFrame(f1, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); fUndo->SetSize(fApply->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 + // Destructor. + TGFrameElement *el; TIter next(GetList()); while ((el = (TGFrameElement *)next())) { @@ -190,23 +179,13 @@ TGeoBBoxEditor::~TGeoBBoxEditor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } 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()"); fUndo->Connect("Clicked()", "TGeoBBoxEditor", this, "DoUndo()"); fShapeName->Connect("TextChanged(const char *)", "TGeoBBoxEditor", this, "DoModified()"); @@ -227,16 +206,14 @@ void TGeoBBoxEditor::ConnectSignals2Slots() //______________________________________________________________________________ -void TGeoBBoxEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoBBoxEditor::SetModel(TObject* obj) { // Update editor for a new selected box. if (obj == 0 || (obj->IsA()!=TGeoBBox::Class())) { SetActive(kFALSE); - return; - } - fModel = obj; - fPad = pad; - fShape = (TGeoBBox*)fModel; + return; + } + fShape = (TGeoBBox*)obj; fDxi = fShape->GetDX(); fDyi = fShape->GetDY(); fDzi = fShape->GetDZ(); diff --git a/geombuilder/src/TGeoConeEditor.cxx b/geombuilder/src/TGeoConeEditor.cxx index 8d914f34a77..fa10e2a9ab4 100644 --- a/geombuilder/src/TGeoConeEditor.cxx +++ b/geombuilder/src/TGeoConeEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoConeEditor.cxx,v 1.3 2006/06/23 16:00:13 brun Exp $ +// @(#):$Name: $:$Id: TGeoConeEditor.cxx,v 1.4 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -48,9 +48,9 @@ enum ETGeoConeWid { }; //______________________________________________________________________________ -TGeoConeEditor::TGeoConeEditor(const TGWindow *p, Int_t id, Int_t width, +TGeoConeEditor::TGeoConeEditor(const TGWindow *p, Int_t width, Int_t height, UInt_t options, Pixel_t back) - : TGedFrame(p, id, width, height, options | kVerticalFrame, back) + : TGeoGedFrame(p, width, height, options | kVerticalFrame, back) { // Constructor for volume editor fShape = 0; @@ -59,8 +59,6 @@ TGeoConeEditor::TGeoConeEditor(const TGWindow *p, Int_t id, Int_t width, fIsModified = kFALSE; fIsShapeEditable = kTRUE; - fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); - // TextEntry for shape name MakeTitle("Name"); fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kCONE_NAME); @@ -152,17 +150,6 @@ TGeoConeEditor::TGeoConeEditor(const TGWindow *p, Int_t id, Int_t width, fUndo->Associate(this); AddFrame(fBFrame, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); fUndo->SetSize(fApply->GetSize()); - - // Initialize layout - MapSubwindows(); - Layout(); - MapWindow(); - - TClass *cl = TGeoCone::Class(); - TGedElement *ge = new TGedElement; - ge->fGedFrame = this; - ge->fCanvas = 0; - cl->GetEditorList()->Add(ge); } //______________________________________________________________________________ @@ -176,17 +163,6 @@ TGeoConeEditor::~TGeoConeEditor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } 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(); - } - } } //______________________________________________________________________________ @@ -211,16 +187,14 @@ void TGeoConeEditor::ConnectSignals2Slots() //______________________________________________________________________________ -void TGeoConeEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoConeEditor::SetModel(TObject* obj) { // Connect to the selected object. if (obj == 0 || (obj->IsA()!=TGeoCone::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fShape = (TGeoCone*)fModel; + fShape = (TGeoCone*)obj; fRmini1 = fShape->GetRmin1(); fRmini2 = fShape->GetRmin2(); fRmaxi1 = fShape->GetRmax1(); @@ -402,9 +376,9 @@ enum ETGeoConeSegWid { }; //______________________________________________________________________________ -TGeoConeSegEditor::TGeoConeSegEditor(const TGWindow *p, Int_t id, Int_t width, +TGeoConeSegEditor::TGeoConeSegEditor(const TGWindow *p, Int_t width, Int_t height, UInt_t options, Pixel_t back) - : TGeoConeEditor(p, id, width, height, options | kVerticalFrame, back) + : TGeoConeEditor(p, width, height, options | kVerticalFrame, back) { // Constructor for cone segment editor fLock = kFALSE; @@ -440,17 +414,6 @@ TGeoConeSegEditor::TGeoConeSegEditor(const TGWindow *p, Int_t id, Int_t width, AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); TGeoTabManager::MoveFrame(fDFrame, this); TGeoTabManager::MoveFrame(fBFrame, this); - - // Initialize layout - MapSubwindows(); - Layout(); - MapWindow(); - - TClass *cl = TGeoConeSeg::Class(); - TGedElement *ge = new TGedElement; - ge->fGedFrame = this; - ge->fCanvas = 0; - cl->GetEditorList()->Add(ge); } //______________________________________________________________________________ @@ -464,17 +427,6 @@ TGeoConeSegEditor::~TGeoConeSegEditor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } 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(); - } - } } //______________________________________________________________________________ @@ -494,16 +446,14 @@ void TGeoConeSegEditor::ConnectSignals2Slots() } //______________________________________________________________________________ -void TGeoConeSegEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoConeSegEditor::SetModel(TObject* obj) { // Connect to the selected object. if (obj == 0 || (obj->IsA()!=TGeoConeSeg::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fShape = (TGeoCone*)fModel; + fShape = (TGeoCone*)obj; fRmini1 = fShape->GetRmin1(); fRmaxi1 = fShape->GetRmax1(); fRmini2 = fShape->GetRmin2(); diff --git a/geombuilder/src/TGeoEltuEditor.cxx b/geombuilder/src/TGeoEltuEditor.cxx index cb414682a5c..d04f3a2a502 100644 --- a/geombuilder/src/TGeoEltuEditor.cxx +++ b/geombuilder/src/TGeoEltuEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoEltuEditor.cxx,v 1.1 2006/06/23 16:00:13 brun Exp $ +// @(#):$Name: $:$Id: TGeoEltuEditor.cxx,v 1.2 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -47,9 +47,9 @@ enum ETGeoEltuWid { }; //______________________________________________________________________________ -TGeoEltuEditor::TGeoEltuEditor(const TGWindow *p, Int_t id, Int_t width, +TGeoEltuEditor::TGeoEltuEditor(const TGWindow *p, Int_t width, Int_t height, UInt_t options, Pixel_t back) - : TGedFrame(p, id, width, height, options | kVerticalFrame, back) + : TGeoGedFrame(p, width, height, options | kVerticalFrame, back) { // Constructor for para editor fShape = 0; @@ -58,8 +58,6 @@ TGeoEltuEditor::TGeoEltuEditor(const TGWindow *p, Int_t id, Int_t width, fIsModified = kFALSE; fIsShapeEditable = kTRUE; - fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); - // TextEntry for shape name MakeTitle("Name"); fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kELTU_NAME); @@ -122,17 +120,6 @@ TGeoEltuEditor::TGeoEltuEditor(const TGWindow *p, Int_t id, Int_t width, fUndo->Associate(this); AddFrame(f1, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); fUndo->SetSize(fApply->GetSize()); - - // Initialize layout - MapSubwindows(); - Layout(); - MapWindow(); - - TClass *cl = TGeoEltu::Class(); - TGedElement *ge = new TGedElement; - ge->fGedFrame = this; - ge->fCanvas = 0; - cl->GetEditorList()->Add(ge); } //______________________________________________________________________________ @@ -146,17 +133,6 @@ TGeoEltuEditor::~TGeoEltuEditor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } Cleanup(); - - TClass *cl = TGeoEltu::Class(); - TIter next1(cl->GetEditorList()); - TGedElement *ge; - while ((ge=(TGedElement*)next1())) { - if (ge->fGedFrame==this) { - cl->GetEditorList()->Remove(ge); - delete ge; - next1.Reset(); - } - } } //______________________________________________________________________________ @@ -176,16 +152,14 @@ void TGeoEltuEditor::ConnectSignals2Slots() } //______________________________________________________________________________ -void TGeoEltuEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoEltuEditor::SetModel(TObject* obj) { // Connect to the selected object. if (obj == 0 || (obj->IsA()!=TGeoEltu::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fShape = (TGeoEltu*)fModel; + fShape = (TGeoEltu*)obj; fAi = fShape->GetA(); fBi = fShape->GetB(); fDzi = fShape->GetDz(); diff --git a/geombuilder/src/TGeoHypeEditor.cxx b/geombuilder/src/TGeoHypeEditor.cxx index 4ed92e3ce20..6959961d536 100644 --- a/geombuilder/src/TGeoHypeEditor.cxx +++ b/geombuilder/src/TGeoHypeEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoHypeEditor.cxx,v 1.1 2006/06/23 16:00:13 brun Exp $ +// @(#):$Name: $:$Id: TGeoHypeEditor.cxx,v 1.2 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -47,9 +47,9 @@ enum ETGeoHypeWid { }; //______________________________________________________________________________ -TGeoHypeEditor::TGeoHypeEditor(const TGWindow *p, Int_t id, Int_t width, +TGeoHypeEditor::TGeoHypeEditor(const TGWindow *p, Int_t width, Int_t height, UInt_t options, Pixel_t back) - : TGedFrame(p, id, width, height, options | kVerticalFrame, back) + : TGeoGedFrame(p, width, height, options | kVerticalFrame, back) { // Constructor for Hype editor fShape = 0; @@ -58,8 +58,6 @@ TGeoHypeEditor::TGeoHypeEditor(const TGWindow *p, Int_t id, Int_t width, fIsModified = kFALSE; fIsShapeEditable = kTRUE; - fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); - // TextEntry for shape name MakeTitle("Name"); fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kHYPE_NAME); @@ -145,17 +143,6 @@ TGeoHypeEditor::TGeoHypeEditor(const TGWindow *p, Int_t id, Int_t width, fUndo->Associate(this); AddFrame(f1, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); fUndo->SetSize(fApply->GetSize()); - - // Initialize layout - MapSubwindows(); - Layout(); - MapWindow(); - - TClass *cl = TGeoHype::Class(); - TGedElement *ge = new TGedElement; - ge->fGedFrame = this; - ge->fCanvas = 0; - cl->GetEditorList()->Add(ge); } //______________________________________________________________________________ @@ -169,17 +156,6 @@ TGeoHypeEditor::~TGeoHypeEditor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } Cleanup(); - - TClass *cl = TGeoHype::Class(); - TIter next1(cl->GetEditorList()); - TGedElement *ge; - while ((ge=(TGedElement*)next1())) { - if (ge->fGedFrame==this) { - cl->GetEditorList()->Remove(ge); - delete ge; - next1.Reset(); - } - } } //______________________________________________________________________________ @@ -204,16 +180,14 @@ void TGeoHypeEditor::ConnectSignals2Slots() //______________________________________________________________________________ -void TGeoHypeEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoHypeEditor::SetModel(TObject* obj) { // Connect to the selected object. if (obj == 0 || (obj->IsA()!=TGeoHype::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fShape = (TGeoHype*)fModel; + fShape = (TGeoHype*)obj; fRini = fShape->GetRmin(); fRouti = fShape->GetRmax(); fDzi = fShape->GetDz(); diff --git a/geombuilder/src/TGeoManagerEditor.cxx b/geombuilder/src/TGeoManagerEditor.cxx index f9dcd732f5c..05080bf7f8e 100644 --- a/geombuilder/src/TGeoManagerEditor.cxx +++ b/geombuilder/src/TGeoManagerEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoManagerEditor.cxx,v 1.5 2006/07/12 10:25:34 brun Exp $ +// @(#):$Name: $:$Id: TGeoManagerEditor.cxx,v 1.6 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -48,6 +48,7 @@ */ #include "TVirtualPad.h" +#include "TCanvas.h" #include "TBaseClass.h" #include "TGTab.h" #include "TG3DLine.h" @@ -82,7 +83,7 @@ #include "TView.h" #include "TGeoManagerEditor.h" - +#include "TGedEditor.h" ClassImp(TGeoManagerEditor) @@ -106,14 +107,16 @@ enum ETGeoVolumeWid { }; //______________________________________________________________________________ -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) +TGeoManagerEditor::TGeoManagerEditor(const TGWindow *p, Int_t width, + Int_t height, UInt_t options, Pixel_t back) + : TGedFrame(p, width, height, options | kVerticalFrame, back) { // Constructor for manager editor. fGeometry = gGeoManager; - fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); - + fTabMgr = 0; + fTab = 0; + fConnectedCanvas = 0; + fIsModified = kFALSE; TGCompositeFrame *f1; TGLabel *label; @@ -597,16 +600,9 @@ TGeoManagerEditor::TGeoManagerEditor(const TGWindow *p, Int_t id, Int_t width, 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); + + fVolumeTab = new TGVerticalFrame(); + AddExtraTab(new TGedSubFrame(TString("Volume"), fVolumeTab)); } //______________________________________________________________________________ @@ -616,32 +612,82 @@ TGeoManagerEditor::~TGeoManagerEditor() TGCompositeFrame *cont; cont = (TGCompositeFrame*)fCategories->GetItem("General")->GetContainer(); TGeoTabManager::Cleanup(cont); + fCategories->GetItem("General")->SetCleanup(0); cont = (TGCompositeFrame*)fCategories->GetItem("Shapes")->GetContainer(); TGeoTabManager::Cleanup(cont); + fCategories->GetItem("Shapes")->SetCleanup(0); cont = (TGCompositeFrame*)fCategories->GetItem("Volumes")->GetContainer(); TGeoTabManager::Cleanup(cont); + fCategories->GetItem("Volumes")->SetCleanup(0); cont = (TGCompositeFrame*)fCategories->GetItem("Materials")->GetContainer(); TGeoTabManager::Cleanup(cont); + fCategories->GetItem("Materials")->SetCleanup(0); cont = (TGCompositeFrame*)fCategories->GetItem("Media")->GetContainer(); TGeoTabManager::Cleanup(cont); + fCategories->GetItem("Media")->SetCleanup(0); cont = (TGCompositeFrame*)fCategories->GetItem("Matrices")->GetContainer(); TGeoTabManager::Cleanup(cont); + fCategories->GetItem("Matrices")->SetCleanup(0); + + delete fExportOption[0]; delete fExportOption[1]; + Cleanup(); if (fTabMgr) { fTabMgr->GetVolumeTab()->Cleanup(); delete fTabMgr; } - TClass *cl = TGeoManager::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::SetGedEditor(TGedEditor* ed) +{ + // Set the parent editor, set the tab and dissconnect editor from + // the canvas. + + TGedFrame::SetGedEditor(ed); + fTab = fGedEditor->GetTab(); + TCanvas* edCanvas = ed->GetCanvas(); + fGedEditor->DisconnectFromCanvas(); + if (edCanvas != fConnectedCanvas) { + DisconnectSelected(); + if (edCanvas) + ConnectSelected(edCanvas); + fConnectedCanvas = edCanvas; + } +} + +//______________________________________________________________________________ +void TGeoManagerEditor::SelectedSlot(TVirtualPad* /*pad*/, TObject* obj, Int_t event) +{ + // Connected to TCanvas::Selected. TGeoManagerEditor takes this + // function from TGedEditor and only uses it if obj is a TGeoVolume. + + if (event == kButton1 && obj->InheritsFrom(TGeoVolume::Class())) { + TGeoVolume* v = (TGeoVolume*) obj; + fTabMgr->SetVolTabEnabled(); + fTabMgr->SetTab(); + fTabMgr->GetVolumeEditor(v); + v->Draw(); + } +} + +void TGeoManagerEditor::ConnectSelected(TCanvas *c) +{ + // Connect to TCanvas::Selected. + + c->Connect("Selected(TVirtualPad*,TObject*,Int_t)", "TGeoManagerEditor", + this, "SelectedSlot(TVirtualPad*,TObject*,Int_t)"); +} + +void TGeoManagerEditor::DisconnectSelected() +{ + // Disconnect from TCanvas::Selected. + + if (fConnectedCanvas) + Disconnect(fConnectedCanvas, "Selected(TVirtualPad*,TObject*,Int_t)", + this, "SelectedSlot(TVirtualPad*,TObject*,Int_t)"); + } //______________________________________________________________________________ @@ -700,16 +746,10 @@ void TGeoManagerEditor::ConnectSignals2Slots() } //______________________________________________________________________________ -void TGeoManagerEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t /*event*/) +void TGeoManagerEditor::SetModel(TObject* obj) { // Refresh editor according the selected obj. - if (obj == 0 || !obj->InheritsFrom(TGeoManager::Class())) { - SetActive(kFALSE); - return; - } - fModel = obj; - fPad = pad; - fGeometry = (TGeoManager*)fModel; + fGeometry = (TGeoManager*)obj; fManagerName->SetText(fGeometry->GetName()); fManagerTitle->SetText(fGeometry->GetTitle()); fMatrixName->SetText(Form("matrix%i", fGeometry->GetListOfMatrices()->GetEntries())); @@ -750,9 +790,12 @@ void TGeoManagerEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t /*event*/ fTab->SetTab(0); fCategories->Layout(); - + if (fTabMgr == 0) { + fTabMgr = TGeoTabManager::GetMakeTabManager(fGedEditor); + fTabMgr->fVolumeTab = fVolumeTab; + } if (fInit) ConnectSignals2Slots(); - SetActive(); + // SetActive(); } //______________________________________________________________________________ @@ -1129,7 +1172,7 @@ void TGeoManagerEditor::DoEditShape() if (!fSelectedShape) return; fTabMgr->GetShapeEditor(fSelectedShape); fSelectedShape->Draw(); - fPad->GetView()->ShowAxis(); + fTabMgr->GetPad()->GetView()->ShowAxis(); } //______________________________________________________________________________ diff --git a/geombuilder/src/TGeoMaterialEditor.cxx b/geombuilder/src/TGeoMaterialEditor.cxx index c2aff55e6e2..a3b30737483 100644 --- a/geombuilder/src/TGeoMaterialEditor.cxx +++ b/geombuilder/src/TGeoMaterialEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoMaterialEditor.cxx,v 1.2 2006/06/19 14:58:48 brun Exp $ +// @(#):$Name: $:$Id: TGeoMaterialEditor.cxx,v 1.3 2006/06/23 16:00:13 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -38,9 +38,9 @@ enum ETGeoMaterialWid { }; //______________________________________________________________________________ -TGeoMaterialEditor::TGeoMaterialEditor(const TGWindow *p, Int_t id, Int_t width, +TGeoMaterialEditor::TGeoMaterialEditor(const TGWindow *p, Int_t width, Int_t height, UInt_t options, Pixel_t back) - : TGedFrame(p, id, width, height, options | kVerticalFrame, back) + : TGeoGedFrame(p, width, height, options | kVerticalFrame, back) { // Constructor for material editor. fMaterial = 0; @@ -50,8 +50,6 @@ TGeoMaterialEditor::TGeoMaterialEditor(const TGWindow *p, Int_t id, Int_t width, fIsModified = kFALSE; fIsMaterialEditable = kTRUE; - fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); - // TextEntry for material name MakeTitle("Name"); fMaterialName = new TGTextEntry(this, new TGTextBuffer(50), kMATERIAL_NAME); @@ -131,17 +129,6 @@ TGeoMaterialEditor::TGeoMaterialEditor(const TGWindow *p, Int_t id, Int_t width, 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); } //______________________________________________________________________________ @@ -155,17 +142,6 @@ TGeoMaterialEditor::~TGeoMaterialEditor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } 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(); - } - } } //______________________________________________________________________________ @@ -185,16 +161,14 @@ void TGeoMaterialEditor::ConnectSignals2Slots() } //______________________________________________________________________________ -void TGeoMaterialEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoMaterialEditor::SetModel(TObject* obj) { // Connect to the selected material. if (obj == 0 || !(obj->InheritsFrom(TGeoMaterial::Class()))) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fMaterial = (TGeoMaterial*)fModel; + fMaterial = (TGeoMaterial*)obj; fAi = (Int_t)fMaterial->GetA(); fZi = (Int_t)fMaterial->GetZ(); fDensityi = fMaterial->GetDensity(); diff --git a/geombuilder/src/TGeoMatrixEditor.cxx b/geombuilder/src/TGeoMatrixEditor.cxx index c66b907c3e7..0b55917dda3 100644 --- a/geombuilder/src/TGeoMatrixEditor.cxx +++ b/geombuilder/src/TGeoMatrixEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoMatrixEditor.cxx,v 1.2 2006/06/19 14:58:48 brun Exp $ +// @(#):$Name: $:$Id: TGeoMatrixEditor.cxx,v 1.3 2006/06/23 16:00:13 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -36,9 +36,9 @@ enum ETGeoMatrixWid { }; //______________________________________________________________________________ -TGeoTranslationEditor::TGeoTranslationEditor(const TGWindow *p, Int_t id, Int_t width, +TGeoTranslationEditor::TGeoTranslationEditor(const TGWindow *p, Int_t width, Int_t height, UInt_t options, Pixel_t back) - : TGedFrame(p, id, width, height, options | kVerticalFrame, back) + : TGeoGedFrame(p, width, height, options | kVerticalFrame, back) { // Constructor for translation editor fTranslation = 0; @@ -108,17 +108,6 @@ TGeoTranslationEditor::TGeoTranslationEditor(const TGWindow *p, Int_t id, Int_t 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); } //______________________________________________________________________________ @@ -132,17 +121,6 @@ TGeoTranslationEditor::~TGeoTranslationEditor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } 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(); - } - } } //______________________________________________________________________________ @@ -164,16 +142,14 @@ void TGeoTranslationEditor::ConnectSignals2Slots() //______________________________________________________________________________ -void TGeoTranslationEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoTranslationEditor::SetModel(TObject* obj) { // Connect to the new matrix. if (obj == 0 || (obj->IsA()!=TGeoTranslation::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fTranslation = (TGeoTranslation*)fModel; + fTranslation = (TGeoTranslation*)obj; fDxi = fTranslation->GetTranslation()[0]; fDyi = fTranslation->GetTranslation()[1]; fDzi = fTranslation->GetTranslation()[2]; @@ -301,9 +277,9 @@ void TGeoTranslationEditor::DoDz() ClassImp(TGeoRotationEditor) //______________________________________________________________________________ -TGeoRotationEditor::TGeoRotationEditor(const TGWindow *p, Int_t id, Int_t width, +TGeoRotationEditor::TGeoRotationEditor(const TGWindow *p, Int_t width, Int_t height, UInt_t options, Pixel_t back) - : TGedFrame(p, id, width, height, options | kVerticalFrame, back) + : TGeoGedFrame(p, width, height, options | kVerticalFrame, back) { // Constructor for rotation editor fRotation = 0; @@ -406,17 +382,6 @@ TGeoRotationEditor::TGeoRotationEditor(const TGWindow *p, Int_t id, Int_t width, 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); } //______________________________________________________________________________ @@ -430,17 +395,6 @@ TGeoRotationEditor::~TGeoRotationEditor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } 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(); - } - } } //______________________________________________________________________________ @@ -460,16 +414,14 @@ void TGeoRotationEditor::ConnectSignals2Slots() //______________________________________________________________________________ -void TGeoRotationEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoRotationEditor::SetModel(TObject* obj) { // Connect to the selected rotation. if (obj == 0 || (obj->IsA()!=TGeoRotation::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fRotation = (TGeoRotation*)fModel; + fRotation = (TGeoRotation*)obj; fRotation->GetAngles(fPhii, fThetai, fPsii); const char *sname = fRotation->GetName(); if (!strcmp(sname, fRotation->ClassName())) fRotName->SetText("no_name"); @@ -622,9 +574,9 @@ void TGeoRotationEditor::DoUndo() ClassImp(TGeoCombiTransEditor) //______________________________________________________________________________ -TGeoCombiTransEditor::TGeoCombiTransEditor(const TGWindow *p, Int_t id, Int_t width, +TGeoCombiTransEditor::TGeoCombiTransEditor(const TGWindow *p, Int_t width, Int_t height, UInt_t options, Pixel_t back) - : TGedFrame(p, id, width, height, options | kVerticalFrame, back) + : TGeoGedFrame(p, width, height, options | kVerticalFrame, back) { // Constructor for combi matrix editor fCombi = 0; @@ -767,17 +719,6 @@ TGeoCombiTransEditor::TGeoCombiTransEditor(const TGWindow *p, Int_t id, Int_t wi 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); } //______________________________________________________________________________ @@ -791,17 +732,6 @@ TGeoCombiTransEditor::~TGeoCombiTransEditor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } 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(); - } - } } //______________________________________________________________________________ @@ -827,16 +757,14 @@ void TGeoCombiTransEditor::ConnectSignals2Slots() //______________________________________________________________________________ -void TGeoCombiTransEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoCombiTransEditor::SetModel(TObject* obj) { // Connect to the selected combi matrix. if (obj == 0 || (obj->IsA()!=TGeoCombiTrans::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fCombi = (TGeoCombiTrans*)fModel; + fCombi = (TGeoCombiTrans*)obj; TGeoRotation *rot = fCombi->GetRotation(); if (rot) rot->GetAngles(fPhii, fThetai, fPsii); const char *sname = fCombi->GetName(); diff --git a/geombuilder/src/TGeoMediumEditor.cxx b/geombuilder/src/TGeoMediumEditor.cxx index d48c5f2497b..9999461714c 100644 --- a/geombuilder/src/TGeoMediumEditor.cxx +++ b/geombuilder/src/TGeoMediumEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoMediumEditor.cxx,v 1.2 2006/06/19 14:58:48 brun Exp $ +// @(#):$Name: $:$Id: TGeoMediumEditor.cxx,v 1.3 2006/06/23 16:00:13 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -40,15 +40,14 @@ enum ETGeoMediumWid { }; //______________________________________________________________________________ -TGeoMediumEditor::TGeoMediumEditor(const TGWindow *p, Int_t id, Int_t width, +TGeoMediumEditor::TGeoMediumEditor(const TGWindow *p, Int_t width, Int_t height, UInt_t options, Pixel_t back) - : TGedFrame(p, id, width, height, options | kVerticalFrame, back) + : TGeoGedFrame(p, width, height, options | kVerticalFrame, back) { // Constructor for medium editor fMedium = 0; fIsEditable = kFALSE; fIsModified = kFALSE; - fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); Pixel_t color; TGLabel *label; @@ -204,17 +203,6 @@ TGeoMediumEditor::TGeoMediumEditor(const TGWindow *p, Int_t id, Int_t width, 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); } //______________________________________________________________________________ @@ -230,17 +218,6 @@ TGeoMediumEditor::~TGeoMediumEditor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } 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(); - } - } } //______________________________________________________________________________ @@ -265,16 +242,14 @@ void TGeoMediumEditor::ConnectSignals2Slots() //______________________________________________________________________________ -void TGeoMediumEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoMediumEditor::SetModel(TObject* obj) { // Connect to the selected object. if (obj == 0 || !(obj->IsA()==TGeoMedium::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fMedium = (TGeoMedium*)fModel; + fMedium = (TGeoMedium*)obj; const char *sname = fMedium->GetName(); if (!strcmp(sname, fMedium->ClassName())) fMedName->SetText(""); else fMedName->SetText(sname); diff --git a/geombuilder/src/TGeoNodeEditor.cxx b/geombuilder/src/TGeoNodeEditor.cxx index 5753123e227..399d591fc60 100644 --- a/geombuilder/src/TGeoNodeEditor.cxx +++ b/geombuilder/src/TGeoNodeEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoNodeEditor.cxx,v 1.2 2006/06/19 14:58:48 brun Exp $ +// @(#):$Name: $:$Id: TGeoNodeEditor.cxx,v 1.3 2006/06/23 16:00:13 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -36,14 +36,13 @@ enum ETGeoNodeWid { }; //______________________________________________________________________________ -TGeoNodeEditor::TGeoNodeEditor(const TGWindow *p, Int_t id, Int_t width, +TGeoNodeEditor::TGeoNodeEditor(const TGWindow *p, Int_t width, Int_t height, UInt_t options, Pixel_t back) - : TGedFrame(p, id, width, height, options | kVerticalFrame, back) + : TGeoGedFrame(p, width, height, options | kVerticalFrame, back) { // Constructor for node editor fNode = 0; - fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); fIsEditable = kTRUE; Pixel_t color; @@ -129,17 +128,6 @@ TGeoNodeEditor::TGeoNodeEditor(const TGWindow *p, Int_t id, Int_t width, fUndo->Associate(this); AddFrame(f1, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); fUndo->SetSize(fApply->GetSize()); - - // Initialize layout - MapSubwindows(); - Layout(); - MapWindow(); - - TClass *cl = TGeoNode::Class(); - TGedElement *ge = new TGedElement; - ge->fGedFrame = this; - ge->fCanvas = 0; - cl->GetEditorList()->Add(ge); } //______________________________________________________________________________ @@ -153,17 +141,6 @@ TGeoNodeEditor::~TGeoNodeEditor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } 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(); - } - } } //______________________________________________________________________________ @@ -184,16 +161,14 @@ void TGeoNodeEditor::ConnectSignals2Slots() //______________________________________________________________________________ -void TGeoNodeEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t /*event*/) +void TGeoNodeEditor::SetModel(TObject* obj) { // Connect to a editable object. if (obj == 0 || !obj->InheritsFrom(TGeoNode::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fNode = (TGeoNode*)fModel; + fNode = (TGeoNode*)obj; const char *sname = fNode->GetName(); fNodeName->SetText(sname); diff --git a/geombuilder/src/TGeoParaEditor.cxx b/geombuilder/src/TGeoParaEditor.cxx index a2448063b07..abba9ba938b 100644 --- a/geombuilder/src/TGeoParaEditor.cxx +++ b/geombuilder/src/TGeoParaEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoParaEditor.cxx,v 1.1 2006/06/23 16:00:13 brun Exp $ +// @(#):$Name: $:$Id: TGeoParaEditor.cxx,v 1.2 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -47,9 +47,9 @@ enum ETGeoParaWid { }; //______________________________________________________________________________ -TGeoParaEditor::TGeoParaEditor(const TGWindow *p, Int_t id, Int_t width, +TGeoParaEditor::TGeoParaEditor(const TGWindow *p, Int_t width, Int_t height, UInt_t options, Pixel_t back) - : TGedFrame(p, id, width, height, options | kVerticalFrame, back) + : TGeoGedFrame(p, width, height, options | kVerticalFrame, back) { // Constructor for para editor fShape = 0; @@ -58,8 +58,6 @@ TGeoParaEditor::TGeoParaEditor(const TGWindow *p, Int_t id, Int_t width, fIsModified = kFALSE; fIsShapeEditable = kTRUE; - fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); - // TextEntry for shape name MakeTitle("Name"); fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kPARA_NAME); @@ -157,17 +155,6 @@ TGeoParaEditor::TGeoParaEditor(const TGWindow *p, Int_t id, Int_t width, fUndo->Associate(this); AddFrame(f1, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); fUndo->SetSize(fApply->GetSize()); - - // Initialize layout - MapSubwindows(); - Layout(); - MapWindow(); - - TClass *cl = TGeoPara::Class(); - TGedElement *ge = new TGedElement; - ge->fGedFrame = this; - ge->fCanvas = 0; - cl->GetEditorList()->Add(ge); } //______________________________________________________________________________ @@ -181,17 +168,6 @@ TGeoParaEditor::~TGeoParaEditor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } Cleanup(); - - TClass *cl = TGeoPara::Class(); - TIter next1(cl->GetEditorList()); - TGedElement *ge; - while ((ge=(TGedElement*)next1())) { - if (ge->fGedFrame==this) { - cl->GetEditorList()->Remove(ge); - delete ge; - next1.Reset(); - } - } } //______________________________________________________________________________ @@ -218,16 +194,14 @@ void TGeoParaEditor::ConnectSignals2Slots() //______________________________________________________________________________ -void TGeoParaEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoParaEditor::SetModel(TObject* obj) { // Connect to the selected object. if (obj == 0 || (obj->IsA()!=TGeoPara::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fShape = (TGeoPara*)fModel; + fShape = (TGeoPara*)obj; fXi = fShape->GetX(); fYi = fShape->GetY(); fZi = fShape->GetZ(); diff --git a/geombuilder/src/TGeoPconEditor.cxx b/geombuilder/src/TGeoPconEditor.cxx index 066120c622d..e1f6a48a7ba 100644 --- a/geombuilder/src/TGeoPconEditor.cxx +++ b/geombuilder/src/TGeoPconEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoPconEditor.cxx,v 1.5 2006/07/12 10:25:34 brun Exp $ +// @(#):$Name: $:$Id: TGeoPconEditor.cxx,v 1.6 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -46,9 +46,9 @@ enum ETGeoPconWid { }; //______________________________________________________________________________ -TGeoPconEditor::TGeoPconEditor(const TGWindow *p, Int_t id, Int_t width, +TGeoPconEditor::TGeoPconEditor(const TGWindow *p, Int_t width, Int_t height, UInt_t options, Pixel_t back) - : TGedFrame(p, id, width, height, options | kVerticalFrame, back) + : TGeoGedFrame(p, width, height, options | kVerticalFrame, back) { // Constructor for polycone editor fShape = 0; @@ -63,7 +63,6 @@ TGeoPconEditor::TGeoPconEditor(const TGWindow *p, Int_t id, Int_t width, fIsModified = kFALSE; fIsShapeEditable = kFALSE; - fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); fLHsect = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0,0,2,2); // TextEntry for shape name @@ -144,17 +143,6 @@ TGeoPconEditor::TGeoPconEditor(const TGWindow *p, Int_t id, Int_t width, fUndo->Associate(this); AddFrame(fBFrame, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); fUndo->SetSize(fApply->GetSize()); - - // Initialize layout - MapSubwindows(); - Layout(); - MapWindow(); - - TClass *cl = TGeoPcon::Class(); - TGedElement *ge = new TGedElement; - ge->fGedFrame = this; - ge->fCanvas = 0; - cl->GetEditorList()->Add(ge); } //______________________________________________________________________________ @@ -172,17 +160,6 @@ TGeoPconEditor::~TGeoPconEditor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } Cleanup(); - - TClass *cl = TGeoPcon::Class(); - TIter next1(cl->GetEditorList()); - TGedElement *ge; - while ((ge=(TGedElement*)next1())) { - if (ge->fGedFrame==this) { - cl->GetEditorList()->Remove(ge); - delete ge; - next1.Reset(); - } - } } //______________________________________________________________________________ @@ -200,16 +177,14 @@ void TGeoPconEditor::ConnectSignals2Slots() //______________________________________________________________________________ -void TGeoPconEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoPconEditor::SetModel(TObject* obj) { // Connect to a given pcon. if (obj == 0 || (obj->IsA() != TGeoPcon::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fShape = (TGeoPcon*)fModel; + fShape = (TGeoPcon*)obj; const char *sname = fShape->GetName(); if (!strcmp(sname, fShape->ClassName())) fShapeName->SetText("-no_name"); else fShapeName->SetText(sname); @@ -482,7 +457,8 @@ ClassImp(TGeoPconSection) TGeoPconSection::TGeoPconSection(const TGWindow *p, UInt_t w, UInt_t h, Int_t id) :TGCompositeFrame(p,w,h,kHorizontalFrame | kFixedWidth) { -// Ctor. + // Constructor. + fNumber = id; TGTextEntry *nef; // Label with number diff --git a/geombuilder/src/TGeoPgonEditor.cxx b/geombuilder/src/TGeoPgonEditor.cxx index 7bc146be7cd..963e2c557a5 100644 --- a/geombuilder/src/TGeoPgonEditor.cxx +++ b/geombuilder/src/TGeoPgonEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoPgonEditor.cxx,v 1.1 2006/07/12 10:25:34 brun Exp $ +// @(#):$Name: $:$Id: TGeoPgonEditor.cxx,v 1.2 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -46,26 +46,15 @@ enum ETGeoPgonWid { }; //______________________________________________________________________________ -TGeoPgonEditor::TGeoPgonEditor(const TGWindow *p, Int_t id, Int_t width, - Int_t height, UInt_t options, Pixel_t back) - : TGeoPconEditor(p, id, width, height, options | kVerticalFrame, back) +TGeoPgonEditor::TGeoPgonEditor(const TGWindow *p, Int_t width, + Int_t height, UInt_t options, Pixel_t back) + : TGeoPconEditor(p, width, height, options | kVerticalFrame, back) { // Constructor for polycone editor fNedgesi = 0; CreateEdges(); TGeoTabManager::MoveFrame(fDFrame, this); TGeoTabManager::MoveFrame(fBFrame, this); - - // Initialize layout - MapSubwindows(); - Layout(); - MapWindow(); - - TClass *cl = TGeoPgon::Class(); - TGedElement *ge = new TGedElement; - ge->fGedFrame = this; - ge->fCanvas = 0; - cl->GetEditorList()->Add(ge); fENedges->Connect("ValueSet(Long_t)", "TGeoPgonEditor", this, "DoNedges()"); fENedges->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoPgonEditor", this, "DoModified()"); } @@ -81,30 +70,17 @@ TGeoPgonEditor::~TGeoPgonEditor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } Cleanup(); - - TClass *cl = TGeoPgon::Class(); - TIter next1(cl->GetEditorList()); - TGedElement *ge; - while ((ge=(TGedElement*)next1())) { - if (ge->fGedFrame==this) { - cl->GetEditorList()->Remove(ge); - delete ge; - next1.Reset(); - } - } } //______________________________________________________________________________ -void TGeoPgonEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoPgonEditor::SetModel(TObject* obj) { // Connect to a given pcon. if (obj == 0 || (obj->IsA()!=TGeoPgon::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fShape = (TGeoPcon*)fModel; + fShape = (TGeoPcon*)obj; const char *sname = fShape->GetName(); if (!strcmp(sname, fShape->ClassName())) fShapeName->SetText("-no_name"); else fShapeName->SetText(sname); diff --git a/geombuilder/src/TGeoSphereEditor.cxx b/geombuilder/src/TGeoSphereEditor.cxx index b7f956618fe..20831a2b62f 100644 --- a/geombuilder/src/TGeoSphereEditor.cxx +++ b/geombuilder/src/TGeoSphereEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoSphereEditor.cxx,v 1.5 2006/06/24 08:30:18 brun Exp $ +// @(#):$Name: $:$Id: TGeoSphereEditor.cxx,v 1.6 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -49,9 +49,9 @@ enum ETGeoSphereWid { }; //______________________________________________________________________________ -TGeoSphereEditor::TGeoSphereEditor(const TGWindow *p, Int_t id, Int_t width, +TGeoSphereEditor::TGeoSphereEditor(const TGWindow *p, Int_t width, Int_t height, UInt_t options, Pixel_t back) - : TGedFrame(p, id, width, height, options | kVerticalFrame, back) + : TGeoGedFrame(p, width, height, options | kVerticalFrame, back) { // Constructor for sphere editor fShape = 0; @@ -61,8 +61,6 @@ TGeoSphereEditor::TGeoSphereEditor(const TGWindow *p, Int_t id, Int_t width, fIsShapeEditable = kTRUE; fLock = kFALSE; - fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); - // TextEntry for shape name MakeTitle("Name"); fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kSPHERE_NAME); @@ -178,17 +176,6 @@ TGeoSphereEditor::TGeoSphereEditor(const TGWindow *p, Int_t id, Int_t width, fUndo->Associate(this); AddFrame(f1, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); fUndo->SetSize(fApply->GetSize()); - - // Initialize layout - MapSubwindows(); - Layout(); - MapWindow(); - - TClass *cl = TGeoSphere::Class(); - TGedElement *ge = new TGedElement; - ge->fGedFrame = this; - ge->fCanvas = 0; - cl->GetEditorList()->Add(ge); } //______________________________________________________________________________ @@ -202,17 +189,6 @@ TGeoSphereEditor::~TGeoSphereEditor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } 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(); - } - } } //______________________________________________________________________________ @@ -235,16 +211,14 @@ void TGeoSphereEditor::ConnectSignals2Slots() //______________________________________________________________________________ -void TGeoSphereEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoSphereEditor::SetModel(TObject* obj) { // Connect to a given sphere. if (obj == 0 || (obj->IsA()!=TGeoSphere::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fShape = (TGeoSphere*)fModel; + fShape = (TGeoSphere*)obj; fRmini = fShape->GetRmin(); fRmaxi = fShape->GetRmax(); fPhi1i = fShape->GetPhi1(); diff --git a/geombuilder/src/TGeoTabManager.cxx b/geombuilder/src/TGeoTabManager.cxx index adb752a22ce..728078bacbd 100644 --- a/geombuilder/src/TGeoTabManager.cxx +++ b/geombuilder/src/TGeoTabManager.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoTabManager.cxx,v 1.5 2006/06/24 08:26:42 brun Exp $ +// @(#):$Name: $:$Id: TGeoTabManager.cxx,v 1.6 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -16,7 +16,7 @@ ////////////////////////////////////////////////////////////////////////// #include "TVirtualPad.h" -#include "TGedFrame.h" +#include "TGeoGedFrame.h" #include "TGTab.h" #include "TGLabel.h" #include "TGComboBox.h" @@ -33,38 +33,39 @@ #include "TGeoMaterial.h" #include "TGeoMatrix.h" +#include "TGedEditor.h" #include "TGeoTabManager.h" +TMap TGeoTabManager::fgEditorToMgrMap; + ClassImp(TGeoTabManager) //______________________________________________________________________________ -TGeoTabManager::TGeoTabManager(TVirtualPad *pad, TGTab *tab) +TGeoTabManager::TGeoTabManager(TGedEditor *ged) { // Ctor. - fPad = pad; - fTab = tab; + fGedEditor = ged; + fPad = ged->GetPad(); + fTab = ged->GetTab(); fVolume = 0; fShapePanel = 0; fMediumPanel = 0; fMaterialPanel = 0; fMatrixPanel = 0; - CreateTabs(); - fTab->MapSubwindows(); - fTab->Layout(); - fTab->MapWindow(); - TClass *cl = TGeoTabManager::Class(); - cl->GetEditorList()->Add(this); + fVolumeTab = 0; + fgEditorToMgrMap.Add(ged, this); } //______________________________________________________________________________ TGeoTabManager::~TGeoTabManager() { // Dtor. + fgEditorToMgrMap.Remove(fGedEditor); if (fShapePanel) delete fShapePanel; if (fMaterialPanel) delete fMaterialPanel; if (fMatrixPanel) delete fMatrixPanel; if (fMediumPanel) delete fMediumPanel; -} +} //______________________________________________________________________________ void TGeoTabManager::Cleanup(TGCompositeFrame *frame) @@ -84,22 +85,12 @@ void TGeoTabManager::Cleanup(TGCompositeFrame *frame) frame->Cleanup(); } -//______________________________________________________________________________ -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(),kFALSE); -} - //______________________________________________________________________________ void TGeoTabManager::GetShapeEditor(TGeoShape *shape) { // Get editor for a shape. if (!shape) return; - if (!fShapePanel) fShapePanel = new TGeoTransientPanel("Shape", shape); + if (!fShapePanel) fShapePanel = new TGeoTransientPanel(fGedEditor, "Shape", shape); else { fShapePanel->SetModel(shape); fShapePanel->Show(); @@ -113,7 +104,9 @@ void TGeoTabManager::GetVolumeEditor(TGeoVolume *volume) if (!volume || !fVolumeTab) return; GetEditors(TAttLine::Class()); GetEditors(TGeoVolume::Class()); - SetModel(volume, 0); + fVolumeTab->MapSubwindows(); + fVolumeTab->Layout(); + SetModel(volume); } //______________________________________________________________________________ @@ -121,9 +114,9 @@ void TGeoTabManager::GetMatrixEditor(TGeoMatrix *matrix) { // Get editor for a matrix. if (!matrix) return; - if (!fMatrixPanel) fMatrixPanel = new TGeoTransientPanel("Matrix", matrix); + if (!fMatrixPanel) fMatrixPanel = new TGeoTransientPanel(fGedEditor, "Matrix", matrix); else { - fMatrixPanel->SetModel(matrix); + fMatrixPanel->SetModel(matrix); fMatrixPanel->Show(); } } @@ -133,9 +126,9 @@ void TGeoTabManager::GetMediumEditor(TGeoMedium *medium) { // Get editor for a medium. if (!medium) return; - if (!fMediumPanel) fMediumPanel = new TGeoTransientPanel("Medium", medium); + if (!fMediumPanel) fMediumPanel = new TGeoTransientPanel(fGedEditor, "Medium", medium); else { - fMediumPanel->SetModel(medium); + fMediumPanel->SetModel(medium); fMediumPanel->Show(); } } @@ -145,9 +138,9 @@ void TGeoTabManager::GetMaterialEditor(TGeoMaterial *material) { // Get editor for a material. if (!material) return; - if (!fMaterialPanel) fMaterialPanel = new TGeoTransientPanel("Material", material); + if (!fMaterialPanel) fMaterialPanel = new TGeoTransientPanel(fGedEditor, "Material", material); else { - fMaterialPanel->SetModel(material); + fMaterialPanel->SetModel(material); fMaterialPanel->Show(); } } @@ -156,60 +149,35 @@ void TGeoTabManager::GetMaterialEditor(TGeoMaterial *material) void TGeoTabManager::GetEditors(TClass *cl) { // Get editor for a class. - // Look in TClass::GetEditorList() for any object deriving from TGedFrame, - static Int_t icount = 0; - TGCompositeFrame *style = fVolumeTab; - 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())); + // Look in fVolumeTab for any object deriving from TGedFrame, + + TClass *class2 = gROOT->GetClass(Form("%sEditor",cl->GetName())); if (class2 && class2->InheritsFrom(TGedFrame::Class())) { - list = style->GetList(); TGFrameElement *fr; - TIter next(list); + TIter next(fVolumeTab->GetList()); 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(); - } - } + TGedFrame* gfr = reinterpret_cast<TGedFrame*>(class2->New()); + gfr->ReparentWindow(fVolumeTab); + fVolumeTab->AddFrame(gfr, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 2, 2)); + gfr->SetModelClass(cl); + gfr->SetGedEditor(fGedEditor); + gfr->MapSubwindows(); } } //______________________________________________________________________________ -TGeoTabManager *TGeoTabManager::GetMakeTabManager(TVirtualPad *pad, TGTab *tab) +TGeoTabManager *TGeoTabManager::GetMakeTabManager(TGedEditor *ged) { // 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; + if (!ged) return NULL; + TPair *pair = (TPair*) fgEditorToMgrMap.FindObject(ged); + if (pair) { + return (TGeoTabManager*) pair->Value(); + } else { + TGeoTabManager *tabmgr = new TGeoTabManager(ged); // added to fgEditorToMgrMap in ctor + return tabmgr; } - // tab manager not found -> create one - tabmgr = new TGeoTabManager(pad,tab); - return tabmgr; } //______________________________________________________________________________ @@ -251,7 +219,7 @@ void TGeoTabManager::SetVolTabEnabled(Bool_t flag) } //______________________________________________________________________________ -void TGeoTabManager::SetModel(TObject *model, Int_t event) +void TGeoTabManager::SetModel(TObject *model) { // Send the SetModel signal to all editors in the tab TYPE. TGCompositeFrame *tab = fVolumeTab; @@ -260,10 +228,9 @@ void TGeoTabManager::SetModel(TObject *model, Int_t event) TIter next(tab->GetList()); while ((el = (TGFrameElement *) next())) { if ((el->fFrame)->InheritsFrom(TGedFrame::Class())) { - ((TGedFrame *)(el->fFrame))->SetModel(fPad, model, event); + ((TGedFrame *)(el->fFrame))->SetModel(model); } } - tab->MapSubwindows(); } //______________________________________________________________________________ @@ -723,10 +690,11 @@ void TGeoMatrixDialog::ConnectSignalsToSlots() ClassImp(TGeoTransientPanel) //______________________________________________________________________________ -TGeoTransientPanel::TGeoTransientPanel(const char *name, TObject *obj) +TGeoTransientPanel::TGeoTransientPanel(TGedEditor* ged, const char *name, TObject *obj) :TGMainFrame(gClient->GetRoot(),175,20) { // Transient panel ctor. + fGedEditor = ged; fModel = obj; fCan = new TGCanvas(this, 170, 100); fTab = new TGTab(fCan->GetViewPort(), 10, 10); @@ -774,44 +742,25 @@ void TGeoTransientPanel::CloseWindow() 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())); + // Look in fStyle for any object deriving from TGedFrame, + + TClass *class2 = gROOT->GetClass(Form("%sEditor",cl->GetName())); if (class2 && class2->InheritsFrom(TGedFrame::Class())) { - list = fStyle->GetList(); TGFrameElement *fr; - TIter next(list); + TIter next(fStyle->GetList()); 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(); - } - } + TGedFrame* gfr = reinterpret_cast<TGedFrame*>(class2->New()); + gfr->ReparentWindow(fStyle); + fStyle->AddFrame(gfr, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 2, 2)); + gfr->SetModelClass(cl); + gfr->SetGedEditor(fGedEditor); + gfr->MapSubwindows(); } } //______________________________________________________________________________ -void TGeoTransientPanel::SetModel(TObject *model, Int_t event) +void TGeoTransientPanel::SetModel(TObject *model) { // Update the editors in the main tab to reflect the selected object. if (!model) return; @@ -821,7 +770,7 @@ void TGeoTransientPanel::SetModel(TObject *model, Int_t event) TIter next(fStyle->GetList()); while ((el = (TGFrameElement *) next())) { if ((el->fFrame)->InheritsFrom(TGedFrame::Class())) { - ((TGedFrame *)(el->fFrame))->SetModel(gPad, model, event); + ((TGedFrame *)(el->fFrame))->SetModel(model); } } Resize(fTabContainer->GetDefaultWidth()+30, fTabContainer->GetDefaultHeight()+65); diff --git a/geombuilder/src/TGeoTorusEditor.cxx b/geombuilder/src/TGeoTorusEditor.cxx index c3952d24698..c5dc38bf563 100644 --- a/geombuilder/src/TGeoTorusEditor.cxx +++ b/geombuilder/src/TGeoTorusEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoTorusEditor.cxx,v 1.1 2006/06/23 16:00:13 brun Exp $ +// @(#):$Name: $:$Id: TGeoTorusEditor.cxx,v 1.2 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -47,9 +47,9 @@ enum ETGeoTorusWid { }; //______________________________________________________________________________ -TGeoTorusEditor::TGeoTorusEditor(const TGWindow *p, Int_t id, Int_t width, +TGeoTorusEditor::TGeoTorusEditor(const TGWindow *p, Int_t width, Int_t height, UInt_t options, Pixel_t back) - : TGedFrame(p, id, width, height, options | kVerticalFrame, back) + : TGeoGedFrame(p, width, height, options | kVerticalFrame, back) { // Constructor for torus editor fShape = 0; @@ -58,8 +58,6 @@ TGeoTorusEditor::TGeoTorusEditor(const TGWindow *p, Int_t id, Int_t width, fIsModified = kFALSE; fIsShapeEditable = kTRUE; - fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); - // TextEntry for shape name MakeTitle("Name"); fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kTORUS_NAME); @@ -146,17 +144,6 @@ TGeoTorusEditor::TGeoTorusEditor(const TGWindow *p, Int_t id, Int_t width, fUndo->Associate(this); AddFrame(f1, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); fUndo->SetSize(fApply->GetSize()); - - // Initialize layout - MapSubwindows(); - Layout(); - MapWindow(); - - TClass *cl = TGeoTorus::Class(); - TGedElement *ge = new TGedElement; - ge->fGedFrame = this; - ge->fCanvas = 0; - cl->GetEditorList()->Add(ge); } //______________________________________________________________________________ @@ -170,17 +157,6 @@ TGeoTorusEditor::~TGeoTorusEditor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } Cleanup(); - - TClass *cl = TGeoTorus::Class(); - TIter next1(cl->GetEditorList()); - TGedElement *ge; - while ((ge=(TGedElement*)next1())) { - if (ge->fGedFrame==this) { - cl->GetEditorList()->Remove(ge); - delete ge; - next1.Reset(); - } - } } //______________________________________________________________________________ @@ -205,16 +181,14 @@ void TGeoTorusEditor::ConnectSignals2Slots() //______________________________________________________________________________ -void TGeoTorusEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoTorusEditor::SetModel(TObject* obj) { // Connect to the selected object. if (obj == 0 || (obj->IsA()!=TGeoTorus::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fShape = (TGeoTorus*)fModel; + fShape = (TGeoTorus*)obj; fRi = fShape->GetR(); fRmini = fShape->GetRmin(); fRmaxi = fShape->GetRmax(); diff --git a/geombuilder/src/TGeoTrapEditor.cxx b/geombuilder/src/TGeoTrapEditor.cxx index 7d219959174..61392d2dbf8 100644 --- a/geombuilder/src/TGeoTrapEditor.cxx +++ b/geombuilder/src/TGeoTrapEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoTrapEditor.cxx,v 1.1 2006/07/12 10:25:34 brun Exp $ +// @(#):$Name: $:$Id: TGeoTrapEditor.cxx,v 1.2 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -47,9 +47,9 @@ enum ETGeoTrapWid { }; //______________________________________________________________________________ -TGeoTrapEditor::TGeoTrapEditor(const TGWindow *p, Int_t id, Int_t width, +TGeoTrapEditor::TGeoTrapEditor(const TGWindow *p, Int_t width, Int_t height, UInt_t options, Pixel_t back) - : TGedFrame(p, id, width, height, options | kVerticalFrame, back) + : TGeoGedFrame(p, width, height, options | kVerticalFrame, back) { // Constructor for para editor fShape = 0; @@ -58,8 +58,6 @@ TGeoTrapEditor::TGeoTrapEditor(const TGWindow *p, Int_t id, Int_t width, fIsModified = kFALSE; fIsShapeEditable = kTRUE; - fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); - // TextEntry for shape name MakeTitle("Name"); fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kTRAP_NAME); @@ -193,17 +191,6 @@ TGeoTrapEditor::TGeoTrapEditor(const TGWindow *p, Int_t id, Int_t width, fUndo->Associate(this); AddFrame(fBFrame, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); fUndo->SetSize(fApply->GetSize()); - - // Initialize layout - MapSubwindows(); - Layout(); - MapWindow(); - - TClass *cl = TGeoTrap::Class(); - TGedElement *ge = new TGedElement; - ge->fGedFrame = this; - ge->fCanvas = 0; - cl->GetEditorList()->Add(ge); } //______________________________________________________________________________ @@ -217,17 +204,6 @@ TGeoTrapEditor::~TGeoTrapEditor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } Cleanup(); - - TClass *cl = TGeoTrap::Class(); - TIter next1(cl->GetEditorList()); - TGedElement *ge; - while ((ge=(TGedElement*)next1())) { - if (ge->fGedFrame==this) { - cl->GetEditorList()->Remove(ge); - delete ge; - next1.Reset(); - } - } } //______________________________________________________________________________ @@ -259,16 +235,14 @@ void TGeoTrapEditor::ConnectSignals2Slots() } //______________________________________________________________________________ -void TGeoTrapEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoTrapEditor::SetModel(TObject* obj) { // Connect to the selected object. if (obj == 0 || (obj->IsA()!=TGeoTrap::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fShape = (TGeoTrap*)fModel; + fShape = (TGeoTrap*)obj; fH1i = fShape->GetH1(); fBl1i = fShape->GetBl1(); fTl1i = fShape->GetTl1(); @@ -534,9 +508,9 @@ enum ETGeoGtraWid { //End_Html //______________________________________________________________________________ -TGeoGtraEditor::TGeoGtraEditor(const TGWindow *p, Int_t id, Int_t width, - Int_t height, UInt_t options, Pixel_t back) - : TGeoTrapEditor(p, id, width, height, options, back) +TGeoGtraEditor::TGeoGtraEditor(const TGWindow *p, Int_t width, + Int_t height, UInt_t options, Pixel_t back) + : TGeoTrapEditor(p, width, height, options, back) { // Constructor for gtra editor fTwisti = 0; @@ -553,16 +527,6 @@ TGeoGtraEditor::TGeoGtraEditor(const TGWindow *p, Int_t id, Int_t width, AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4)); TGeoTabManager::MoveFrame(fDFrame, this); TGeoTabManager::MoveFrame(fBFrame, this); - // Initialize layout - MapSubwindows(); - Layout(); - MapWindow(); - - TClass *cl = TGeoGtra::Class(); - TGedElement *ge = new TGedElement; - ge->fGedFrame = this; - ge->fCanvas = 0; - cl->GetEditorList()->Add(ge); fETwist->Connect("ValueSet(Long_t)", "TGeoGtraEditor", this, "DoTwist()"); nef->Connect("TextChanged(const char *)", "TGeoGtraEditor", this, "DoModified()"); } @@ -577,30 +541,17 @@ TGeoGtraEditor::~TGeoGtraEditor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } Cleanup(); - - TClass *cl = TGeoGtra::Class(); - TIter next1(cl->GetEditorList()); - TGedElement *ge; - while ((ge=(TGedElement*)next1())) { - if (ge->fGedFrame==this) { - cl->GetEditorList()->Remove(ge); - delete ge; - next1.Reset(); - } - } } //______________________________________________________________________________ -void TGeoGtraEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoGtraEditor::SetModel(TObject* obj) { // Connect to a given twisted trapezoid. if (obj == 0 || (obj->IsA()!=TGeoGtra::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fShape = (TGeoTrap*)fModel; + fShape = (TGeoTrap*)obj; fH1i = fShape->GetH1(); fBl1i = fShape->GetBl1(); fTl1i = fShape->GetTl1(); diff --git a/geombuilder/src/TGeoTrd1Editor.cxx b/geombuilder/src/TGeoTrd1Editor.cxx index b5e0472da6e..9c17713f27d 100644 --- a/geombuilder/src/TGeoTrd1Editor.cxx +++ b/geombuilder/src/TGeoTrd1Editor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoTrd1Editor.cxx,v 1.3 2006/06/23 16:00:13 brun Exp $ +// @(#):$Name: $:$Id: TGeoTrd1Editor.cxx,v 1.4 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -47,9 +47,9 @@ enum ETGeoTrd1Wid { }; //______________________________________________________________________________ -TGeoTrd1Editor::TGeoTrd1Editor(const TGWindow *p, Int_t id, Int_t width, +TGeoTrd1Editor::TGeoTrd1Editor(const TGWindow *p, Int_t width, Int_t height, UInt_t options, Pixel_t back) - : TGedFrame(p, id, width, height, options | kVerticalFrame, back) + : TGeoGedFrame(p, width, height, options | kVerticalFrame, back) { // Constructor for trd1 editor fShape = 0; @@ -58,8 +58,6 @@ TGeoTrd1Editor::TGeoTrd1Editor(const TGWindow *p, Int_t id, Int_t width, fIsModified = kFALSE; fIsShapeEditable = kFALSE; - fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); - // TextEntry for shape name MakeTitle("Name"); fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kTRD1_NAME); @@ -139,17 +137,6 @@ TGeoTrd1Editor::TGeoTrd1Editor(const TGWindow *p, Int_t id, Int_t width, fUndo->Associate(this); AddFrame(f1, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); fUndo->SetSize(fApply->GetSize()); - - // Initialize layout - MapSubwindows(); - Layout(); - MapWindow(); - - TClass *cl = TGeoTrd1::Class(); - TGedElement *ge = new TGedElement; - ge->fGedFrame = this; - ge->fCanvas = 0; - cl->GetEditorList()->Add(ge); } //______________________________________________________________________________ @@ -163,16 +150,6 @@ TGeoTrd1Editor::~TGeoTrd1Editor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } 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(); - } - } } //______________________________________________________________________________ @@ -195,16 +172,14 @@ void TGeoTrd1Editor::ConnectSignals2Slots() //______________________________________________________________________________ -void TGeoTrd1Editor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoTrd1Editor::SetModel(TObject* obj) { // Connect to the selected object. if (obj == 0 || (obj->IsA()!=TGeoTrd1::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fShape = (TGeoTrd1*)fModel; + fShape = (TGeoTrd1*)obj; fDxi1 = fShape->GetDx1(); fDxi2 = fShape->GetDx2(); fDyi = fShape->GetDy(); diff --git a/geombuilder/src/TGeoTrd2Editor.cxx b/geombuilder/src/TGeoTrd2Editor.cxx index aaf97fec73d..6d1c0d61589 100644 --- a/geombuilder/src/TGeoTrd2Editor.cxx +++ b/geombuilder/src/TGeoTrd2Editor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoTrd2Editor.cxx,v 1.3 2006/06/23 16:00:13 brun Exp $ +// @(#):$Name: $:$Id: TGeoTrd2Editor.cxx,v 1.4 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -47,9 +47,9 @@ enum ETGeoTrd2Wid { }; //______________________________________________________________________________ -TGeoTrd2Editor::TGeoTrd2Editor(const TGWindow *p, Int_t id, Int_t width, +TGeoTrd2Editor::TGeoTrd2Editor(const TGWindow *p, Int_t width, Int_t height, UInt_t options, Pixel_t back) - : TGedFrame(p, id, width, height, options | kVerticalFrame, back) + : TGeoGedFrame(p, width, height, options | kVerticalFrame, back) { // Constructor for trd2 editor fShape = 0; @@ -58,8 +58,6 @@ TGeoTrd2Editor::TGeoTrd2Editor(const TGWindow *p, Int_t id, Int_t width, fIsModified = kFALSE; fIsShapeEditable = kFALSE; - fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); - // TextEntry for shape name MakeTitle("Name"); fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kTRD2_NAME); @@ -151,17 +149,6 @@ TGeoTrd2Editor::TGeoTrd2Editor(const TGWindow *p, Int_t id, Int_t width, fUndo->Associate(this); AddFrame(f1, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); fUndo->SetSize(fApply->GetSize()); - - // Initialize layout - MapSubwindows(); - Layout(); - MapWindow(); - - TClass *cl = TGeoTrd2::Class(); - TGedElement *ge = new TGedElement; - ge->fGedFrame = this; - ge->fCanvas = 0; - cl->GetEditorList()->Add(ge); } //______________________________________________________________________________ @@ -175,16 +162,6 @@ TGeoTrd2Editor::~TGeoTrd2Editor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } 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(); - } - } } //______________________________________________________________________________ @@ -209,16 +186,14 @@ void TGeoTrd2Editor::ConnectSignals2Slots() //______________________________________________________________________________ -void TGeoTrd2Editor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoTrd2Editor::SetModel(TObject* obj) { // Connect to the selected object. if (obj == 0 || (obj->IsA()!=TGeoTrd2::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fShape = (TGeoTrd2*)fModel; + fShape = (TGeoTrd2*)obj; fDxi1 = fShape->GetDx1(); fDxi2 = fShape->GetDx2(); fDyi1 = fShape->GetDy1(); diff --git a/geombuilder/src/TGeoTubeEditor.cxx b/geombuilder/src/TGeoTubeEditor.cxx index 75237ffda07..37c20ce6aaf 100644 --- a/geombuilder/src/TGeoTubeEditor.cxx +++ b/geombuilder/src/TGeoTubeEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoTubeEditor.cxx,v 1.5 2006/06/24 08:30:18 brun Exp $ +// @(#):$Name: $:$Id: TGeoTubeEditor.cxx,v 1.6 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -48,9 +48,9 @@ enum ETGeoTubeWid { }; //______________________________________________________________________________ -TGeoTubeEditor::TGeoTubeEditor(const TGWindow *p, Int_t id, Int_t width, +TGeoTubeEditor::TGeoTubeEditor(const TGWindow *p, Int_t width, Int_t height, UInt_t options, Pixel_t back) - : TGedFrame(p, id, width, height, options | kVerticalFrame, back) + : TGeoGedFrame(p, width, height, options | kVerticalFrame, back) { // Constructor for tube editor fShape = 0; @@ -59,8 +59,6 @@ TGeoTubeEditor::TGeoTubeEditor(const TGWindow *p, Int_t id, Int_t width, fIsModified = kFALSE; fIsShapeEditable = kTRUE; - fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); - // TextEntry for shape name MakeTitle("Name"); fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kTUBE_NAME); @@ -127,17 +125,6 @@ TGeoTubeEditor::TGeoTubeEditor(const TGWindow *p, Int_t id, Int_t width, fUndo->Associate(this); AddFrame(fBFrame, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); fUndo->SetSize(fApply->GetSize()); - - // Initialize layout - MapSubwindows(); - Layout(); - MapWindow(); - - TClass *cl = TGeoTube::Class(); - TGedElement *ge = new TGedElement; - ge->fGedFrame = this; - ge->fCanvas = 0; - cl->GetEditorList()->Add(ge); } //______________________________________________________________________________ @@ -151,17 +138,6 @@ TGeoTubeEditor::~TGeoTubeEditor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } 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(); - } - } } //______________________________________________________________________________ @@ -182,16 +158,14 @@ void TGeoTubeEditor::ConnectSignals2Slots() //______________________________________________________________________________ -void TGeoTubeEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoTubeEditor::SetModel(TObject* obj) { // Connect to the selected object. if (obj == 0 || (obj->IsA()!=TGeoTube::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fShape = (TGeoTube*)fModel; + fShape = (TGeoTube*)obj; fRmini = fShape->GetRmin(); fRmaxi = fShape->GetRmax(); fDzi = fShape->GetDz(); @@ -329,9 +303,9 @@ enum ETGeoTubeSegWid { }; //______________________________________________________________________________ -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) +TGeoTubeSegEditor::TGeoTubeSegEditor(const TGWindow *p, Int_t width, + Int_t height, UInt_t options, Pixel_t back) + : TGeoTubeEditor(p, width, height, options | kVerticalFrame, back) { // Constructor for tube segment editor fLock = kFALSE; @@ -367,17 +341,6 @@ TGeoTubeSegEditor::TGeoTubeSegEditor(const TGWindow *p, Int_t id, Int_t width, AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4)); TGeoTabManager::MoveFrame(fDFrame, this); TGeoTabManager::MoveFrame(fBFrame, this); - - // Initialize layout - MapSubwindows(); - Layout(); - MapWindow(); - - TClass *cl = TGeoTubeSeg::Class(); - TGedElement *ge = new TGedElement; - ge->fGedFrame = this; - ge->fCanvas = 0; - cl->GetEditorList()->Add(ge); } //______________________________________________________________________________ @@ -391,17 +354,6 @@ TGeoTubeSegEditor::~TGeoTubeSegEditor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } 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(); - } - } } //______________________________________________________________________________ @@ -421,16 +373,14 @@ void TGeoTubeSegEditor::ConnectSignals2Slots() } //______________________________________________________________________________ -void TGeoTubeSegEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoTubeSegEditor::SetModel(TObject* obj) { // Connect to the selected object. if (obj == 0 || (obj->IsA()!=TGeoTubeSeg::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fShape = (TGeoTube*)fModel; + fShape = (TGeoTube*)obj; fRmini = fShape->GetRmin(); fRmaxi = fShape->GetRmax(); fDzi = fShape->GetDz(); @@ -580,9 +530,9 @@ enum ETGeoCtubSegWid { }; //______________________________________________________________________________ -TGeoCtubEditor::TGeoCtubEditor(const TGWindow *p, Int_t id, Int_t width, +TGeoCtubEditor::TGeoCtubEditor(const TGWindow *p, Int_t width, Int_t height, UInt_t options, Pixel_t back) - : TGeoTubeSegEditor(p, id, width, height, options, back) + : TGeoTubeSegEditor(p, width, height, options, back) { // Constructor for cut tube editor MakeTitle("Theta/phi low"); @@ -647,17 +597,6 @@ TGeoCtubEditor::TGeoCtubEditor(const TGWindow *p, Int_t id, Int_t width, AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2)); TGeoTabManager::MoveFrame(fDFrame, this); TGeoTabManager::MoveFrame(fBFrame, this); - - // Initialize layout - MapSubwindows(); - Layout(); - MapWindow(); - - TClass *cl = TGeoCtub::Class(); - TGedElement *ge = new TGedElement; - ge->fGedFrame = this; - ge->fCanvas = 0; - cl->GetEditorList()->Add(ge); } //______________________________________________________________________________ @@ -671,30 +610,17 @@ TGeoCtubEditor::~TGeoCtubEditor() TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame); } Cleanup(); - - TClass *cl = TGeoCtub::Class(); - TIter next1(cl->GetEditorList()); - TGedElement *ge; - while ((ge=(TGedElement*)next1())) { - if (ge->fGedFrame==this) { - cl->GetEditorList()->Remove(ge); - delete ge; - next1.Reset(); - } - } } //______________________________________________________________________________ -void TGeoCtubEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t) +void TGeoCtubEditor::SetModel(TObject* obj) { // Connect to the selected object. if (obj == 0 || (obj->IsA()!=TGeoCtub::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fShape = (TGeoTube*)fModel; + fShape = (TGeoTube*)obj; fRmini = fShape->GetRmin(); fRmaxi = fShape->GetRmax(); fDzi = fShape->GetDz(); diff --git a/geombuilder/src/TGeoVolumeEditor.cxx b/geombuilder/src/TGeoVolumeEditor.cxx index c626eb3f5b4..419dfb419ed 100644 --- a/geombuilder/src/TGeoVolumeEditor.cxx +++ b/geombuilder/src/TGeoVolumeEditor.cxx @@ -1,4 +1,4 @@ -// @(#):$Name: $:$Id: TGeoVolumeEditor.cxx,v 1.5 2006/06/25 07:34:59 brun Exp $ +// @(#):$Name: $:$Id: TGeoVolumeEditor.cxx,v 1.6 2006/07/14 20:00:52 brun Exp $ // Author: M.Gheata /************************************************************************* @@ -55,6 +55,7 @@ #include "TGShutter.h" #include "TG3DLine.h" #include "TGeoTabManager.h" +#include "TGedEditor.h" ClassImp(TGeoVolumeEditor) @@ -67,9 +68,9 @@ enum ETGeoVolumeWid { }; //______________________________________________________________________________ -TGeoVolumeEditor::TGeoVolumeEditor(const TGWindow *p, Int_t id, Int_t width, +TGeoVolumeEditor::TGeoVolumeEditor(const TGWindow *p, Int_t width, Int_t height, UInt_t options, Pixel_t back) - : TGedFrame(p, id, width, height, options | kVerticalFrame, back) + : TGeoGedFrame(p, width, height, options | kVerticalFrame, back) { // Constructor for volume editor. fGeometry = 0; @@ -79,7 +80,6 @@ TGeoVolumeEditor::TGeoVolumeEditor(const TGWindow *p, Int_t id, Int_t width, fIsAssembly = kFALSE; fIsDivided = kFALSE; - fTabMgr = TGeoTabManager::GetMakeTabManager(gPad, fTab); // TGShutter for categories fCategories = new TGShutter(this, kSunkenFrame | kFixedHeight); TGCompositeFrame *container, *f1; @@ -365,17 +365,6 @@ TGeoVolumeEditor::TGeoVolumeEditor(const TGWindow *p, Int_t id, Int_t width, 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); } //______________________________________________________________________________ @@ -385,24 +374,20 @@ TGeoVolumeEditor::~TGeoVolumeEditor() TGCompositeFrame *cont; cont = (TGCompositeFrame*)fCategories->GetItem("Properties")->GetContainer(); TGeoTabManager::Cleanup(cont); + fCategories->GetItem("Properties")->SetCleanup(0); cont = (TGCompositeFrame*)fCategories->GetItem("Daughters")->GetContainer(); TGeoTabManager::Cleanup(cont); + fCategories->GetItem("Daughters")->SetCleanup(0); cont = (TGCompositeFrame*)fCategories->GetItem("Visualization")->GetContainer(); TGeoTabManager::Cleanup(cont); + fCategories->GetItem("Visualization")->SetCleanup(0); cont = (TGCompositeFrame*)fCategories->GetItem("Division")->GetContainer(); TGeoTabManager::Cleanup(cont); - 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(); - } - } + fCategories->GetItem("Division")->SetCleanup(0); + + delete fBView[0]; delete fBView[1]; delete fBView[2]; + delete fBDiv [0]; delete fBDiv [1]; delete fBDiv [2]; + Cleanup(); } //______________________________________________________________________________ @@ -438,16 +423,14 @@ void TGeoVolumeEditor::ConnectSignals2Slots() } //______________________________________________________________________________ -void TGeoVolumeEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t /*event*/) +void TGeoVolumeEditor::SetModel(TObject* obj) { // Connect to the picked volume. if (obj == 0 || !obj->InheritsFrom(TGeoVolume::Class())) { SetActive(kFALSE); return; } - fModel = obj; - fPad = pad; - fVolume = (TGeoVolume*)fModel; + fVolume = (TGeoVolume*)obj; fGeometry = fVolume->GetGeoManager(); const char *vname = fVolume->GetName(); fVolumeName->SetText(vname); @@ -467,7 +450,10 @@ void TGeoVolumeEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t /*event*/) if (!fVolume->GetNdaughters() || fVolume->GetFinder()) { fEditMatrix->SetEnabled(kFALSE); fRemoveNode->SetEnabled(kFALSE); - } + } else { + fEditMatrix->SetEnabled(kTRUE); + fRemoveNode->SetEnabled(kTRUE); + } if (!fSelectedVolume) fAddNode->SetEnabled(kFALSE); if (fVolume->IsAssembly()) { fBSelShape->SetEnabled(kFALSE); @@ -516,6 +502,15 @@ void TGeoVolumeEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t /*event*/) if (GetParent()==fTabMgr->GetVolumeTab()) fTab->Layout(); } +//______________________________________________________________________________ +void TGeoVolumeEditor::ActivateBaseClassEditors(TClass* cl) +{ + // Add editors to fGedFrame and exclude TLineEditor. + + fGedEditor->ExcludeClassEditor(TAttFill::Class()); + TGedFrame::ActivateBaseClassEditors(cl); +} + //______________________________________________________________________________ void TGeoVolumeEditor::DoVolumeName() { @@ -565,6 +560,8 @@ void TGeoVolumeEditor::DoSelectVolume() fSelectedVolume = (TGeoVolume*)TGeoVolumeDialog::GetSelected(); if (fSelectedVolume) fLSelVolume->SetText(fSelectedVolume->GetName()); else fSelectedVolume = vol; + if (fSelectedVolume) + fAddNode->SetEnabled(kTRUE); } @@ -605,12 +602,9 @@ void TGeoVolumeEditor::DoAddNode() 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(); + fEditMatrix->SetEnabled(kTRUE); + fRemoveNode->SetEnabled(kTRUE); Update(); } -- GitLab