From bcc90bf5cded37265ed0b43022b7624ea014e11c Mon Sep 17 00:00:00 2001
From: Rene Brun <Rene.Brun@cern.ch>
Date: Fri, 14 Jul 2006 20:00:52 +0000
Subject: [PATCH] From Mihaela a tar file with the pictures inside all shapes
 .cxx files. The .diff attached contains the modifications for including a new
 shape editor: TGeoCtubEditor There are also few small fixes in the layout and
 in the undo behavior for tube segment and cone segment.

git-svn-id: http://root.cern.ch/svn/root/trunk@15811 27541ba8-7e3a-0410-8455-c3a389f83636
---
 geombuilder/inc/LinkDef.h             |   3 +-
 geombuilder/inc/TGeoConeEditor.h      |   4 +-
 geombuilder/inc/TGeoPconEditor.h      |   4 +-
 geombuilder/inc/TGeoTabManager.h      |   3 +-
 geombuilder/inc/TGeoTrapEditor.h      |   4 +-
 geombuilder/inc/TGeoTubeEditor.h      |  42 ++-
 geombuilder/inc/TGeoVolumeEditor.h    |   3 +-
 geombuilder/src/TGeoBBoxEditor.cxx    |  20 +-
 geombuilder/src/TGeoConeEditor.cxx    | 115 ++++----
 geombuilder/src/TGeoEltuEditor.cxx    |  20 +-
 geombuilder/src/TGeoHypeEditor.cxx    |  20 +-
 geombuilder/src/TGeoManagerEditor.cxx |   8 +-
 geombuilder/src/TGeoParaEditor.cxx    |  20 +-
 geombuilder/src/TGeoPconEditor.cxx    |  48 ++--
 geombuilder/src/TGeoPgonEditor.cxx    |  32 ++-
 geombuilder/src/TGeoSphereEditor.cxx  |  17 +-
 geombuilder/src/TGeoTabManager.cxx    |  18 +-
 geombuilder/src/TGeoTorusEditor.cxx   |  20 +-
 geombuilder/src/TGeoTrapEditor.cxx    |  66 +++--
 geombuilder/src/TGeoTrd1Editor.cxx    |  17 +-
 geombuilder/src/TGeoTrd2Editor.cxx    |  17 +-
 geombuilder/src/TGeoTubeEditor.cxx    | 376 +++++++++++++++++++++++---
 geombuilder/src/TGeoVolumeEditor.cxx  |  40 +--
 23 files changed, 678 insertions(+), 239 deletions(-)

diff --git a/geombuilder/inc/LinkDef.h b/geombuilder/inc/LinkDef.h
index 9e49fd2f5b1..2a81602a250 100644
--- a/geombuilder/inc/LinkDef.h
+++ b/geombuilder/inc/LinkDef.h
@@ -1,4 +1,4 @@
-// @(#)$Name:  $:$Id: LinkDef.h,v 1.3 2006/06/23 16:00:13 brun Exp $
+// @(#)$Name:  $:$Id: LinkDef.h,v 1.4 2006/07/12 10:25:34 brun Exp $
 /*************************************************************************
  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
  * All rights reserved.                                                  *
@@ -17,6 +17,7 @@
 #pragma link C++ class TGeoBBoxEditor;
 #pragma link C++ class TGeoTubeEditor;
 #pragma link C++ class TGeoTubeSegEditor;
+#pragma link C++ class TGeoCtubEditor;
 #pragma link C++ class TGeoEltuEditor;
 #pragma link C++ class TGeoHypeEditor;
 #pragma link C++ class TGeoConeEditor;
diff --git a/geombuilder/inc/TGeoConeEditor.h b/geombuilder/inc/TGeoConeEditor.h
index 16c69b7d17e..9bdee7e6f5b 100644
--- a/geombuilder/inc/TGeoConeEditor.h
+++ b/geombuilder/inc/TGeoConeEditor.h
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: TGeoConeEditor.h,v 1.1 2006/06/13 15:27:11 brun Exp $
+// @(#):$Name:  $:$Id: TGeoConeEditor.h,v 1.2 2006/06/23 16:00:13 brun Exp $
 // Author: M.Gheata 
 /*************************************************************************
  * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers.               *
@@ -59,7 +59,9 @@ protected:
    TGNumberEntry  *fEDz;               // Number entry for DZ
    TGTextButton   *fApply;             // Apply-Button to accept changes
    TGTextButton   *fUndo;              // Undo-Button
+   TGCompositeFrame *fBFrame;          // Frame containing Apply/Undo
    TGCheckButton  *fDelayed;           // Check button for delayed draw
+   TGCompositeFrame *fDFrame;          // Frame containing Delayed draw
 
    virtual void ConnectSignals2Slots();   // Connect the signals to the slots
    Bool_t       IsDelayed() const;   
diff --git a/geombuilder/inc/TGeoPconEditor.h b/geombuilder/inc/TGeoPconEditor.h
index 83e24515704..09d712f3ffb 100644
--- a/geombuilder/inc/TGeoPconEditor.h
+++ b/geombuilder/inc/TGeoPconEditor.h
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: TGeoPconEditor.h,v 1.2 2006/06/23 16:00:13 brun Exp $
+// @(#):$Name:  $:$Id: TGeoPconEditor.h,v 1.3 2006/07/12 10:25:34 brun Exp $
 // Author: M.Gheata 
 /*************************************************************************
  * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers.               *
@@ -61,7 +61,9 @@ protected:
    TGNumberEntry       *fEDPhi;             // Number entry for dphi  
    TGTextButton        *fApply;             // Apply-Button to accept changes
    TGTextButton        *fUndo;              // Undo-Button
+   TGCompositeFrame    *fBFrame;            // Frame containing Apply/Undo
    TGCheckButton       *fDelayed;           // Check button for delayed draw
+   TGCompositeFrame    *fDFrame;            // Frame containing Delayed draw
 
    virtual void ConnectSignals2Slots();   // Connect the signals to the slots
    Bool_t       CheckSections(Bool_t change=kFALSE);
diff --git a/geombuilder/inc/TGeoTabManager.h b/geombuilder/inc/TGeoTabManager.h
index cb058db9318..1c9637de109 100644
--- a/geombuilder/inc/TGeoTabManager.h
+++ b/geombuilder/inc/TGeoTabManager.h
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: TGeoTabManager.h,v 1.2 2006/06/23 16:00:13 brun Exp $
+// @(#):$Name:  $:$Id: TGeoTabManager.h,v 1.3 2006/06/24 08:26:42 brun Exp $
 // Author: M.Gheata 
 
 /*************************************************************************
@@ -69,6 +69,7 @@ public:
    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                SetTab();
diff --git a/geombuilder/inc/TGeoTrapEditor.h b/geombuilder/inc/TGeoTrapEditor.h
index 10141668517..79733a128d8 100644
--- a/geombuilder/inc/TGeoTrapEditor.h
+++ b/geombuilder/inc/TGeoTrapEditor.h
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: Exp $
+// @(#):$Name:  $:$Id: TGeoTrapEditor.h,v 1.1 2006/07/12 10:25:34 brun Exp $
 // Author: M.Gheata 
 /*************************************************************************
  * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers.               *
@@ -65,7 +65,9 @@ protected:
    TGNumberEntry       *fEPhi  ;            // Number entry for  Theta 
    TGTextButton        *fApply;             // Apply-Button to accept changes
    TGTextButton        *fUndo;              // Undo-Button
+   TGCompositeFrame    *fBFrame;            // Frame containing Apply/Undo
    TGCheckButton       *fDelayed;           // Check button for delayed draw
+   TGCompositeFrame    *fDFrame;            // Frame containing Delayed draw
 
    virtual void ConnectSignals2Slots();   // Connect the signals to the slots
    Bool_t       IsDelayed() const;   
diff --git a/geombuilder/inc/TGeoTubeEditor.h b/geombuilder/inc/TGeoTubeEditor.h
index 606a9dc401a..fd932297f20 100644
--- a/geombuilder/inc/TGeoTubeEditor.h
+++ b/geombuilder/inc/TGeoTubeEditor.h
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: TGeoTubeEditor.h,v 1.1 2006/06/13 15:27:11 brun Exp $
+// @(#):$Name:  $:$Id: TGeoTubeEditor.h,v 1.2 2006/06/23 16:00:13 brun Exp $
 // Author: M.Gheata 
 /*************************************************************************
  * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers.               *
@@ -54,7 +54,9 @@ protected:
    TGNumberEntry  *fEDz;               // Number entry for DZ
    TGTextButton   *fApply;             // Apply-Button to accept changes
    TGTextButton   *fUndo;              // Undo-Button
+   TGCompositeFrame *fBFrame;          // Frame containing Apply/Undo
    TGCheckButton  *fDelayed;           // Check button for delayed draw
+   TGCompositeFrame *fDFrame;          // Frame containing Delayed draw
 
    virtual void ConnectSignals2Slots();   // Connect the signals to the slots
    Bool_t       IsDelayed() const;   
@@ -117,5 +119,43 @@ public:
    
    ClassDef(TGeoTubeSegEditor,0)   // TGeoTubeSeg editor
 };   
+
+//////////////////////////////////////////////////////////////////////////
+//                                                                      //
+//  TGeoCtubEditor                                                      //
+//                                                                      //
+//  Editor for a tube segment cut with 2 planes.                        //
+//                                                                      //
+//////////////////////////////////////////////////////////////////////////
+
+class TGeoCtubEditor : public TGeoTubeSegEditor {
+
+protected:
+   Double_t         fThlo;              // Theta angle of the normal to the lower plane (90, 180)
+   Double_t         fPhlo;              // Phi angle of the normal to lower Z plane
+   Double_t         fThhi;              // Theta angle of the normal to the upper plane (0, 90)
+   Double_t         fPhhi;              // Phi angle of the normal to upper Z plane
+   TGNumberEntry   *fEThlo;             // Number entry for thlo
+   TGNumberEntry   *fEPhlo;             // Number entry for phlo
+   TGNumberEntry   *fEThhi;             // Number entry for thhi
+   TGNumberEntry   *fEPhhi;             // Number entry for phhi
+
+public:
+   TGeoCtubEditor(const TGWindow *p, Int_t id,               
+                   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);
+
+   void           DoThlo();
+   void           DoPhlo();
+   void           DoThhi();
+   void           DoPhhi();
+   virtual void   DoApply();
+   virtual void   DoUndo();
+   
+   ClassDef(TGeoCtubEditor,0)   // TGeoCtub editor
+};
   
 #endif                    
diff --git a/geombuilder/inc/TGeoVolumeEditor.h b/geombuilder/inc/TGeoVolumeEditor.h
index 11dc80bf846..733e6b02dfa 100644
--- a/geombuilder/inc/TGeoVolumeEditor.h
+++ b/geombuilder/inc/TGeoVolumeEditor.h
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: Exp $
+// @(#):$Name:  $:$Id: TGeoVolumeEditor.h,v 1.1 2006/06/13 15:27:11 brun Exp $
 // Author: M.Gheata 
 
 /*************************************************************************
@@ -93,7 +93,6 @@ protected:
    TGNumberEntry       *fEDivN;             // Number entry for division Nslices
 
    virtual void ConnectSignals2Slots();     // Connect the signals to the slots
-   void         UpdatePad();
 
 public:
    TGeoVolumeEditor(const TGWindow *p, Int_t id,               
diff --git a/geombuilder/src/TGeoBBoxEditor.cxx b/geombuilder/src/TGeoBBoxEditor.cxx
index eaf5834e8a6..b49685814cd 100644
--- a/geombuilder/src/TGeoBBoxEditor.cxx
+++ b/geombuilder/src/TGeoBBoxEditor.cxx
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: TGeoBBoxEditor.cxx,v 1.2 2006/06/19 14:58:48 brun Exp $
+// @(#):$Name:  $:$Id: TGeoBBoxEditor.cxx,v 1.3 2006/06/23 16:00:13 brun Exp $
 // Author: M.Gheata 
 
 /*************************************************************************
@@ -14,6 +14,16 @@
 //  TGeoBBoxEditor                                                      //
 //                                                                      //
 //////////////////////////////////////////////////////////////////////////
+//Begin_Html
+/*
+<img src="gif/box_pic.gif">
+*/
+//End_Html
+//Begin_Html
+/*
+<img src="gif/box_ed.jpg">
+*/
+//End_Html
 
 #include "TGeoBBoxEditor.h"
 #include "TGeoTabManager.h"
@@ -290,13 +300,9 @@ void TGeoBBoxEditor::DoApply()
             const Double_t *orig = fShape->GetOrigin();
             view->SetRange(orig[0]-fShape->GetDX(), orig[1]-fShape->GetDY(), orig[2]-fShape->GetDZ(),
                            orig[0]+fShape->GetDX(), orig[1]+fShape->GetDY(), orig[2]+fShape->GetDZ());
-            fPad->Modified();               
-            fPad->Update();
+            Update();
          }                  
-      } else {   
-         fPad->Modified();
-         fPad->Update();
-      }   
+      } else Update();
    }   
 }
 
diff --git a/geombuilder/src/TGeoConeEditor.cxx b/geombuilder/src/TGeoConeEditor.cxx
index 46dd6c21d36..8d914f34a77 100644
--- a/geombuilder/src/TGeoConeEditor.cxx
+++ b/geombuilder/src/TGeoConeEditor.cxx
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: TGeoConeEditor.cxx,v 1.2 2006/06/19 14:58:48 brun Exp $
+// @(#):$Name:  $:$Id: TGeoConeEditor.cxx,v 1.3 2006/06/23 16:00:13 brun Exp $
 // Author: M.Gheata 
 
 /*************************************************************************
@@ -14,6 +14,16 @@
 //  TGeoConeEditor                                                      //
 //                                                                      //
 //////////////////////////////////////////////////////////////////////////
+//Begin_Html
+/*
+<img src="gif/cone_pic.gif">
+*/
+//End_Html
+//Begin_Html
+/*
+<img src="gif/cone_ed.jpg">
+*/
+//End_Html
 
 #include "TGeoConeEditor.h"
 #include "TGeoTabManager.h"
@@ -64,8 +74,7 @@ TGeoConeEditor::TGeoConeEditor(const TGWindow *p, Int_t id, Int_t width,
    TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame);
    
    // Number entry for Rmin1
-   TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame |
-                                 kLHintsExpandX | kOwnBackground);
+   TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
    f1->AddFrame(new TGLabel(f1, "Rmin1"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
    fERmin1 = new TGNumberEntry(f1, 0., 5, kCONE_RMIN1);
    fERmin1->SetNumAttr(TGNumberFormat::kNEANonNegative);
@@ -73,12 +82,11 @@ TGeoConeEditor::TGeoConeEditor(const TGWindow *p, Int_t id, Int_t width,
    nef->SetToolTipText("Enter the inner radius");
    fERmin1->Associate(this);
    fERmin1->Resize(100, fERmin1->GetDefaultHeight());
-   f1->AddFrame(fERmin1, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
-   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4));
+   f1->AddFrame(fERmin1, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
+   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
    
   // Number entry for Rmax1
-   f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame |
-                                 kLHintsExpandX | kOwnBackground);
+   f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
    f1->AddFrame(new TGLabel(f1, "Rmax1"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
    fERmax1 = new TGNumberEntry(f1, 0., 5, kCONE_RMAX1);
    fERmax1->SetNumAttr(TGNumberFormat::kNEANonNegative);
@@ -86,12 +94,11 @@ TGeoConeEditor::TGeoConeEditor(const TGWindow *p, Int_t id, Int_t width,
    nef->SetToolTipText("Enter the outer radius");
    fERmax1->Associate(this);
    fERmax1->Resize(100, fERmax1->GetDefaultHeight());
-   f1->AddFrame(fERmax1, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
-   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4));
+   f1->AddFrame(fERmax1, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
+   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
     
    // Number entry for Rmin2
-   f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame |
-                                 kLHintsExpandX | kOwnBackground);
+   f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
    f1->AddFrame(new TGLabel(f1, "Rmin2"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
    fERmin2 = new TGNumberEntry(f1, 0., 5, kCONE_RMIN2);
    fERmin2->SetNumAttr(TGNumberFormat::kNEANonNegative);
@@ -99,12 +106,11 @@ TGeoConeEditor::TGeoConeEditor(const TGWindow *p, Int_t id, Int_t width,
    nef->SetToolTipText("Enter the inner radius");
    fERmin2->Associate(this);
    fERmin2->Resize(100, fERmin2->GetDefaultHeight());
-   f1->AddFrame(fERmin2, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
-   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4)); 
+   f1->AddFrame(fERmin2, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
+   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
     
    // Number entry for Rmax2
-   f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame |
-                                 kLHintsExpandX | kOwnBackground);
+   f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
    f1->AddFrame(new TGLabel(f1, "Rmax2"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
    fERmax2 = new TGNumberEntry(f1, 0., 5, kCONE_RMAX2);
    fERmax2->SetNumAttr(TGNumberFormat::kNEANonNegative);
@@ -112,12 +118,11 @@ TGeoConeEditor::TGeoConeEditor(const TGWindow *p, Int_t id, Int_t width,
    nef->SetToolTipText("Enter the outer radius");
    fERmax2->Associate(this);
    fERmax2->Resize(100, fERmax2->GetDefaultHeight());
-   f1->AddFrame(fERmax2, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
-   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4));
+   f1->AddFrame(fERmax2, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
+   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
    
    // Number entry for dz
-   f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame |
-                                 kLHintsExpandX | kOwnBackground);
+   f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
    f1->AddFrame(new TGLabel(f1, "DZ"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
    fEDz = new TGNumberEntry(f1, 0., 5, kCONE_Z);
    fEDz->SetNumAttr(TGNumberFormat::kNEAPositive);
@@ -125,27 +130,27 @@ TGeoConeEditor::TGeoConeEditor(const TGWindow *p, Int_t id, Int_t width,
    nef->SetToolTipText("Enter the cone half-lenth in Z");
    fEDz->Associate(this);
    fEDz->Resize(100, fEDz->GetDefaultHeight());
-   f1->AddFrame(fEDz, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
-   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4));
+   f1->AddFrame(fEDz, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
+   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
    
    compxyz->Resize(150,30);
    AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
       
    // Delayed draw
-   f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth | kSunkenFrame);
-   fDelayed = new TGCheckButton(f1, "Delayed draw");
-   f1->AddFrame(fDelayed, new TGLayoutHints(kLHintsLeft , 2, 2, 4, 4));
-   AddFrame(f1,  new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));  
+   fDFrame = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth | kSunkenFrame);
+   fDelayed = new TGCheckButton(fDFrame, "Delayed draw");
+   fDFrame->AddFrame(fDelayed, new TGLayoutHints(kLHintsLeft , 2, 2, 2, 2));
+   AddFrame(fDFrame,  new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));  
 
    // Buttons
-   f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
-   fApply = new TGTextButton(f1, "Apply");
-   f1->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
+   fBFrame = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
+   fApply = new TGTextButton(fBFrame, "Apply");
+   fBFrame->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
    fApply->Associate(this);
-   fUndo = new TGTextButton(f1, "Undo");
-   f1->AddFrame(fUndo, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
+   fUndo = new TGTextButton(fBFrame, "Undo");
+   fBFrame->AddFrame(fUndo, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
    fUndo->Associate(this);
-   AddFrame(f1,  new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));  
+   AddFrame(fBFrame,  new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));  
    fUndo->SetSize(fApply->GetSize());
 
    // Initialize layout
@@ -272,10 +277,7 @@ void TGeoConeEditor::DoApply()
       if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) {
          fShape->Draw();
          fPad->GetView()->ShowAxis();
-      } else {   
-         fPad->Modified();
-         fPad->Update();
-      }   
+      } else Update();
    }   
 }
 
@@ -382,6 +384,16 @@ void TGeoConeEditor::DoDz()
 //  TGeoConeSegEditor                                                   //
 //                                                                      //
 //////////////////////////////////////////////////////////////////////////
+//Begin_Html
+/*
+<img src="gif/cons_pic.gif">
+*/
+//End_Html
+//Begin_Html
+/*
+<img src="gif/cons_ed.jpg">
+*/
+//End_Html
 
 ClassImp(TGeoConeSegEditor)
 
@@ -398,20 +410,21 @@ TGeoConeSegEditor::TGeoConeSegEditor(const TGWindow *p, Int_t id, Int_t width,
    fLock = kFALSE;
    MakeTitle("Phi range");
    TGTextEntry *nef;
-   TGCompositeFrame *compxyz = new TGCompositeFrame(this, 155, 200, kHorizontalFrame | kRaisedFrame);
+   TGCompositeFrame *compxyz = new TGCompositeFrame(this, 155, 110, kHorizontalFrame | kFixedWidth | kFixedHeight | kRaisedFrame);
    // Vertical slider
-   fSPhi = new TGDoubleVSlider(compxyz,140);
+   fSPhi = new TGDoubleVSlider(compxyz,100);
    fSPhi->SetRange(0.,720.);
-   compxyz->AddFrame(fSPhi, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 2, 2, 4, 4)); 
-   TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 100, 200, kVerticalFrame);
-   f1->AddFrame(new TGLabel(f1, "Phi min."), new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 2, 2));
+   fSPhi->Resize(fSPhi->GetDefaultWidth(), 100);
+   compxyz->AddFrame(fSPhi, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4)); 
+   TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 135, 100, kVerticalFrame | kFixedHeight);
+   f1->AddFrame(new TGLabel(f1, "Phi min."), new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 6, 0));
    fEPhi1 = new TGNumberEntry(f1, 0., 5, kCONESEG_PHI1);
    fEPhi1->Resize(100, fEPhi1->GetDefaultHeight());
    fEPhi1->SetNumAttr(TGNumberFormat::kNEANonNegative);
    nef = (TGTextEntry*)fEPhi1->GetNumberEntry();
    nef->SetToolTipText("Enter the phi1 value");
    fEPhi1->Associate(this);
-   f1->AddFrame(fEPhi1, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2));
+   f1->AddFrame(fEPhi1, new TGLayoutHints(kLHintsTop | kLHintsRight, 2, 2, 2, 2));
 
    fEPhi2 = new TGNumberEntry(f1, 0., 5, kCONESEG_PHI2);
    fEPhi2->Resize(100, fEPhi2->GetDefaultHeight());
@@ -419,12 +432,14 @@ TGeoConeSegEditor::TGeoConeSegEditor(const TGWindow *p, Int_t id, Int_t width,
    nef = (TGTextEntry*)fEPhi2->GetNumberEntry();
    nef->SetToolTipText("Enter the phi2 value");
    fEPhi2->Associate(this);
-   f1->AddFrame(fEPhi2, new TGLayoutHints(kLHintsBottom | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2));
-   f1->AddFrame(new TGLabel(f1, "Phi max."), new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2));
-   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2));
+   f1->AddFrame(fEPhi2, new TGLayoutHints(kLHintsBottom | kLHintsRight, 2, 2, 2, 2));
+   f1->AddFrame(new TGLabel(f1, "Phi max."), new TGLayoutHints(kLHintsBottom, 0, 0, 6, 2));
+   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
    
-   compxyz->Resize(150,150);
+//   compxyz->Resize(150,150);
    AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
+   TGeoTabManager::MoveFrame(fDFrame, this);
+   TGeoTabManager::MoveFrame(fBFrame, this);
    
    // Initialize layout
    MapSubwindows();
@@ -603,10 +618,7 @@ void TGeoConeSegEditor::DoApply()
       if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) {
          fShape->Draw();
          fPad->GetView()->ShowAxis();
-      } else {   
-         fPad->Modified();
-         fPad->Update();
-      }   
+      } else Update();
    }   
 }
 
@@ -614,6 +626,11 @@ void TGeoConeSegEditor::DoApply()
 void TGeoConeSegEditor::DoUndo()
 {
    // Slot for undoing last operation.
+   fERmin1->SetNumber(fRmini1);
+   fERmin2->SetNumber(fRmini2);
+   fERmax1->SetNumber(fRmaxi1);
+   fERmax2->SetNumber(fRmaxi2);
+   fEDz->SetNumber(fDzi);
    fEPhi1->SetNumber(fPmini);
    fEPhi2->SetNumber(fPmaxi);
    fSPhi->SetPosition(fPmini,fPmaxi);
diff --git a/geombuilder/src/TGeoEltuEditor.cxx b/geombuilder/src/TGeoEltuEditor.cxx
index eed149ac8dc..cb414682a5c 100644
--- a/geombuilder/src/TGeoEltuEditor.cxx
+++ b/geombuilder/src/TGeoEltuEditor.cxx
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: Exp $
+// @(#):$Name:  $:$Id: TGeoEltuEditor.cxx,v 1.1 2006/06/23 16:00:13 brun Exp $
 // Author: M.Gheata 
 
 /*************************************************************************
@@ -14,6 +14,16 @@
 //  TGeoEltuEditor                                                      //
 //                                                                      //
 //////////////////////////////////////////////////////////////////////////
+//Begin_Html
+/*
+<img src="gif/eltu_pic.gif">
+*/
+//End_Html
+//Begin_Html
+/*
+<img src="gif/eltu_ed.jpg">
+*/
+//End_Html
 
 #include "TGeoEltuEditor.h"
 #include "TGeoTabManager.h"
@@ -235,13 +245,9 @@ void TGeoEltuEditor::DoApply()
          } else {
             view->SetRange(-fShape->GetDX(), -fShape->GetDY(), -fShape->GetDZ(),
                            fShape->GetDX(), fShape->GetDY(), fShape->GetDZ());
-            fPad->Modified();               
-            fPad->Update();
+            Update();
          }                  
-      } else {   
-         fPad->Modified();
-         fPad->Update();
-      }   
+      } else Update();
    }   
 }
 
diff --git a/geombuilder/src/TGeoHypeEditor.cxx b/geombuilder/src/TGeoHypeEditor.cxx
index 57477be3aa3..4ed92e3ce20 100644
--- a/geombuilder/src/TGeoHypeEditor.cxx
+++ b/geombuilder/src/TGeoHypeEditor.cxx
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: Exp $
+// @(#):$Name:  $:$Id: TGeoHypeEditor.cxx,v 1.1 2006/06/23 16:00:13 brun Exp $
 // Author: M.Gheata 
 
 /*************************************************************************
@@ -14,6 +14,16 @@
 //  TGeoHypeEditor                                                      //
 //                                                                      //
 //////////////////////////////////////////////////////////////////////////
+//Begin_Html
+/*
+<img src="gif/hype_pic.gif">
+*/
+//End_Html
+//Begin_Html
+/*
+<img src="gif/hype_ed.jpg">
+*/
+//End_Html
 
 #include "TGeoHypeEditor.h"
 #include "TGeoTabManager.h"
@@ -279,13 +289,9 @@ void TGeoHypeEditor::DoApply()
          } else {
             view->SetRange(-fShape->GetDX(), -fShape->GetDY(), -fShape->GetDZ(),
                            fShape->GetDX(), fShape->GetDY(), fShape->GetDZ());
-            fPad->Modified();               
-            fPad->Update();
+            Update();
          }                  
-      } else {   
-         fPad->Modified();
-         fPad->Update();
-      }   
+      } else Update();
    }   
 }
 
diff --git a/geombuilder/src/TGeoManagerEditor.cxx b/geombuilder/src/TGeoManagerEditor.cxx
index 9ffc55a0fa8..f9dcd732f5c 100644
--- a/geombuilder/src/TGeoManagerEditor.cxx
+++ b/geombuilder/src/TGeoManagerEditor.cxx
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: TGeoManagerEditor.cxx,v 1.4 2006/06/24 08:26:42 brun Exp $
+// @(#):$Name:  $:$Id: TGeoManagerEditor.cxx,v 1.5 2006/07/12 10:25:34 brun Exp $
 // Author: M.Gheata 
 
 /*************************************************************************
@@ -927,6 +927,12 @@ void TGeoManagerEditor::DoCreateSphe()
 void TGeoManagerEditor::DoCreateCtub()
 {
 // Create a cut tube.
+   Int_t id = gGeoManager->GetListOfShapes()->GetEntries();
+   fSelectedShape = new TGeoCtub(Form("ctub_%i",id), 0.5, 1., 1.,0.,45.,0.,0.,-1,0.,0.,1);
+   ShowSelectShape();
+   if (fGeometry->GetListOfMedia()->GetSize())
+      fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
+   DoEditShape();
 }
 
 //______________________________________________________________________________
diff --git a/geombuilder/src/TGeoParaEditor.cxx b/geombuilder/src/TGeoParaEditor.cxx
index 51c241b0eb8..a2448063b07 100644
--- a/geombuilder/src/TGeoParaEditor.cxx
+++ b/geombuilder/src/TGeoParaEditor.cxx
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: Exp $
+// @(#):$Name:  $:$Id: TGeoParaEditor.cxx,v 1.1 2006/06/23 16:00:13 brun Exp $
 // Author: M.Gheata 
 
 /*************************************************************************
@@ -14,6 +14,16 @@
 //  TGeoParaEditor                                                      //
 //                                                                      //
 //////////////////////////////////////////////////////////////////////////
+//Begin_Html
+/*
+<img src="gif/para_pic.gif">
+*/
+//End_Html
+//Begin_Html
+/*
+<img src="gif/para_ed.jpg">
+*/
+//End_Html
 
 #include "TGeoParaEditor.h"
 #include "TGeoTabManager.h"
@@ -289,13 +299,9 @@ void TGeoParaEditor::DoApply()
          } else {
             view->SetRange(-fShape->GetDX(), -fShape->GetDY(), -fShape->GetDZ(),
                            fShape->GetDX(), fShape->GetDY(), fShape->GetDZ());
-            fPad->Modified();               
-            fPad->Update();
+            Update();
          }                  
-      } else {   
-         fPad->Modified();
-         fPad->Update();
-      }   
+      } else Update();
    }   
 }
 
diff --git a/geombuilder/src/TGeoPconEditor.cxx b/geombuilder/src/TGeoPconEditor.cxx
index e08e80893c1..066120c622d 100644
--- a/geombuilder/src/TGeoPconEditor.cxx
+++ b/geombuilder/src/TGeoPconEditor.cxx
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: TGeoPconEditor.cxx,v 1.4 2006/06/24 08:30:18 brun Exp $
+// @(#):$Name:  $:$Id: TGeoPconEditor.cxx,v 1.5 2006/07/12 10:25:34 brun Exp $
 // Author: M.Gheata 
 
 /*************************************************************************
@@ -14,6 +14,16 @@
 //  TGeoPconEditor                                                      //
 //                                                                      //
 //////////////////////////////////////////////////////////////////////////
+//Begin_Html
+/*
+<img src="gif/pcon_pic.gif">
+*/
+//End_Html
+//Begin_Html
+/*
+<img src="gif/pcon_ed.jpg">
+*/
+//End_Html
 
 #include "TGeoPconEditor.h"
 #include "TGeoTabManager.h"
@@ -119,20 +129,20 @@ TGeoPconEditor::TGeoPconEditor(const TGWindow *p, Int_t id, Int_t width,
    AddFrame(fCan, new TGLayoutHints(kLHintsLeft, 0, 0, 4, 4));
       
    // Delayed draw
-   f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth | kSunkenFrame);
-   fDelayed = new TGCheckButton(f1, "Delayed draw");
-   f1->AddFrame(fDelayed, new TGLayoutHints(kLHintsLeft , 2, 2, 4, 4));
-   AddFrame(f1,  new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));  
+   fDFrame = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth | kSunkenFrame);
+   fDelayed = new TGCheckButton(fDFrame, "Delayed draw");
+   fDFrame->AddFrame(fDelayed, new TGLayoutHints(kLHintsLeft , 2, 2, 4, 4));
+   AddFrame(fDFrame,  new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));  
 
    // Buttons
-   f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
-   fApply = new TGTextButton(f1, "Apply");
-   f1->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
+   fBFrame = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
+   fApply = new TGTextButton(fBFrame, "Apply");
+   fBFrame->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
    fApply->Associate(this);
-   fUndo = new TGTextButton(f1, "Undo");
-   f1->AddFrame(fUndo, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
+   fUndo = new TGTextButton(fBFrame, "Undo");
+   fBFrame->AddFrame(fUndo, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
    fUndo->Associate(this);
-   AddFrame(f1,  new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));  
+   AddFrame(fBFrame,  new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));  
    fUndo->SetSize(fApply->GetSize());
 
    // Initialize layout
@@ -359,13 +369,9 @@ void TGeoPconEditor::DoApply()
                const Double_t *orig = fShape->GetOrigin();
                view->SetRange(orig[0]-fShape->GetDX(), orig[1]-fShape->GetDY(), orig[2]-fShape->GetDZ(),
                               orig[0]+fShape->GetDX(), orig[1]+fShape->GetDY(), orig[2]+fShape->GetDZ());
-               fPad->Modified();               
-               fPad->Update();
+               Update();
             }                  
-         } else {   
-            fPad->Modified();
-            fPad->Update();
-         }   
+         } else Update();
       }   
       return;
    }           
@@ -389,13 +395,9 @@ void TGeoPconEditor::DoApply()
             const Double_t *orig = fShape->GetOrigin();
             view->SetRange(orig[0]-fShape->GetDX(), orig[1]-fShape->GetDY(), orig[2]-fShape->GetDZ(),
                            orig[0]+fShape->GetDX(), orig[1]+fShape->GetDY(), orig[2]+fShape->GetDZ());
-            fPad->Modified();               
-            fPad->Update();
+            Update();
          }                  
-      } else {   
-         fPad->Modified();
-         fPad->Update();
-      }   
+      } else Update();
    }   
 }
 
diff --git a/geombuilder/src/TGeoPgonEditor.cxx b/geombuilder/src/TGeoPgonEditor.cxx
index 8c21e9f102b..7bc146be7cd 100644
--- a/geombuilder/src/TGeoPgonEditor.cxx
+++ b/geombuilder/src/TGeoPgonEditor.cxx
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: Exp $
+// @(#):$Name:  $:$Id: TGeoPgonEditor.cxx,v 1.1 2006/07/12 10:25:34 brun Exp $
 // Author: M.Gheata 
 
 /*************************************************************************
@@ -14,6 +14,16 @@
 //  TGeoPgonEditor                                                      //
 //                                                                      //
 //////////////////////////////////////////////////////////////////////////
+//Begin_Html
+/*
+<img src="gif/pgon_pic.gif">
+*/
+//End_Html
+//Begin_Html
+/*
+<img src="gif/pgon_ed.jpg">
+*/
+//End_Html
 
 #include "TGeoPgonEditor.h"
 #include "TGeoTabManager.h"
@@ -43,7 +53,9 @@ TGeoPgonEditor::TGeoPgonEditor(const TGWindow *p, Int_t id, Int_t width,
    // Constructor for polycone editor
    fNedgesi = 0;
    CreateEdges();
-
+   TGeoTabManager::MoveFrame(fDFrame, this);
+   TGeoTabManager::MoveFrame(fBFrame, this);
+   
    // Initialize layout
    MapSubwindows();
    Layout();
@@ -159,13 +171,9 @@ void TGeoPgonEditor::DoApply()
                const Double_t *orig = fShape->GetOrigin();
                view->SetRange(orig[0]-fShape->GetDX(), orig[1]-fShape->GetDY(), orig[2]-fShape->GetDZ(),
                               orig[0]+fShape->GetDX(), orig[1]+fShape->GetDY(), orig[2]+fShape->GetDZ());
-               fPad->Modified();               
-               fPad->Update();
+               Update();
             }                  
-         } else {   
-            fPad->Modified();
-            fPad->Update();
-         }   
+         } else Update();
       }
       return;
    }           
@@ -190,13 +198,9 @@ void TGeoPgonEditor::DoApply()
             const Double_t *orig = fShape->GetOrigin();
             view->SetRange(orig[0]-fShape->GetDX(), orig[1]-fShape->GetDY(), orig[2]-fShape->GetDZ(),
                            orig[0]+fShape->GetDX(), orig[1]+fShape->GetDY(), orig[2]+fShape->GetDZ());
-            fPad->Modified();               
-            fPad->Update();
+            Update();
          }                  
-      } else {   
-         fPad->Modified();
-         fPad->Update();
-      }   
+      } else Update();
    }   
 }
 
diff --git a/geombuilder/src/TGeoSphereEditor.cxx b/geombuilder/src/TGeoSphereEditor.cxx
index ea6b1649d4c..b7f956618fe 100644
--- a/geombuilder/src/TGeoSphereEditor.cxx
+++ b/geombuilder/src/TGeoSphereEditor.cxx
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: TGeoSphereEditor.cxx,v 1.4 2006/06/23 16:00:13 brun Exp $
+// @(#):$Name:  $:$Id: TGeoSphereEditor.cxx,v 1.5 2006/06/24 08:30:18 brun Exp $
 // Author: M.Gheata 
 
 /*************************************************************************
@@ -14,6 +14,16 @@
 //  TGeoSphereEditor                                                      //
 //                                                                      //
 //////////////////////////////////////////////////////////////////////////
+//Begin_Html
+/*
+<img src="gif/sphe_pic.gif">
+*/
+//End_Html
+//Begin_Html
+/*
+<img src="gif/sphe_ed.jpg">
+*/
+//End_Html
 
 #include "TGeoSphereEditor.h"
 #include "TGeoTabManager.h"
@@ -302,10 +312,7 @@ void TGeoSphereEditor::DoApply()
       if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) {
          fShape->Draw();
          fPad->GetView()->ShowAxis();
-      } else {   
-         fPad->Modified();
-         fPad->Update();
-      }   
+      } else Update();
    }   
 }
 
diff --git a/geombuilder/src/TGeoTabManager.cxx b/geombuilder/src/TGeoTabManager.cxx
index 9d733b90382..adb752a22ce 100644
--- a/geombuilder/src/TGeoTabManager.cxx
+++ b/geombuilder/src/TGeoTabManager.cxx
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: TGeoTabManager.cxx,v 1.4 2006/06/23 16:00:13 brun Exp $
+// @(#):$Name:  $:$Id: TGeoTabManager.cxx,v 1.5 2006/06/24 08:26:42 brun Exp $
 // Author: M.Gheata 
 
 /*************************************************************************
@@ -227,6 +227,22 @@ Int_t TGeoTabManager::GetTabIndex() const
    return 0;
 }
 
+//______________________________________________________________________________
+void TGeoTabManager::MoveFrame(TGCompositeFrame *fr, TGCompositeFrame *p)
+{
+// Move frame fr at the end of the list of parent p.
+   TList *list = p->GetList();
+   TIter next(list);
+   TGFrameElement *el = 0;
+   while ((el=(TGFrameElement*)next())) {
+      if (el->fFrame == fr) break;
+   }  
+   if (el) { 
+      list->Remove(el);
+      list->Add(el);
+   }   
+}
+
 //______________________________________________________________________________
 void TGeoTabManager::SetVolTabEnabled(Bool_t flag)
 {
diff --git a/geombuilder/src/TGeoTorusEditor.cxx b/geombuilder/src/TGeoTorusEditor.cxx
index 93d37ab1795..c3952d24698 100644
--- a/geombuilder/src/TGeoTorusEditor.cxx
+++ b/geombuilder/src/TGeoTorusEditor.cxx
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: Exp $
+// @(#):$Name:  $:$Id: TGeoTorusEditor.cxx,v 1.1 2006/06/23 16:00:13 brun Exp $
 // Author: M.Gheata 
 
 /*************************************************************************
@@ -14,6 +14,16 @@
 //  TGeoTorusEditor                                                      //
 //                                                                      //
 //////////////////////////////////////////////////////////////////////////
+//Begin_Html
+/*
+<img src="gif/torus_pic.gif">
+*/
+//End_Html
+//Begin_Html
+/*
+<img src="gif/torus_ed.jpg">
+*/
+//End_Html
 
 #include "TGeoTorusEditor.h"
 #include "TGeoTabManager.h"
@@ -272,13 +282,9 @@ void TGeoTorusEditor::DoApply()
          } else {
             view->SetRange(-fShape->GetDX(), -fShape->GetDY(), -fShape->GetDZ(),
                            fShape->GetDX(), fShape->GetDY(), fShape->GetDZ());
-            fPad->Modified();               
-            fPad->Update();
+            Update();
          }                  
-      } else {   
-         fPad->Modified();
-         fPad->Update();
-      }   
+      } else Update();
    }   
 }
 
diff --git a/geombuilder/src/TGeoTrapEditor.cxx b/geombuilder/src/TGeoTrapEditor.cxx
index a3f95ad6f18..7d219959174 100644
--- a/geombuilder/src/TGeoTrapEditor.cxx
+++ b/geombuilder/src/TGeoTrapEditor.cxx
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: Exp $
+// @(#):$Name:  $:$Id: TGeoTrapEditor.cxx,v 1.1 2006/07/12 10:25:34 brun Exp $
 // Author: M.Gheata 
 
 /*************************************************************************
@@ -14,6 +14,16 @@
 //  TGeoTrapEditor                                                      //
 //                                                                      //
 //////////////////////////////////////////////////////////////////////////
+//Begin_Html
+/*
+<img src="gif/trap_pic.gif">
+*/
+//End_Html
+//Begin_Html
+/*
+<img src="gif/trap_ed.jpg">
+*/
+//End_Html
 
 #include "TGeoTrapEditor.h"
 #include "TGeoTabManager.h"
@@ -168,20 +178,20 @@ TGeoTrapEditor::TGeoTrapEditor(const TGWindow *p, Int_t id, Int_t width,
    AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
      
    // Delayed draw
-   f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth | kSunkenFrame);
-   fDelayed = new TGCheckButton(f1, "Delayed draw");
-   f1->AddFrame(fDelayed, new TGLayoutHints(kLHintsLeft , 2, 2, 4, 4));
-   AddFrame(f1,  new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));  
+   fDFrame = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth | kSunkenFrame);
+   fDelayed = new TGCheckButton(fDFrame, "Delayed draw");
+   fDFrame->AddFrame(fDelayed, new TGLayoutHints(kLHintsLeft , 2, 2, 4, 4));
+   AddFrame(fDFrame,  new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));  
 
    // Buttons
-   f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
-   fApply = new TGTextButton(f1, "Apply");
-   f1->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
+   fBFrame = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
+   fApply = new TGTextButton(fBFrame, "Apply");
+   fBFrame->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
    fApply->Associate(this);
-   fUndo = new TGTextButton(f1, "Undo");
-   f1->AddFrame(fUndo, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
+   fUndo = new TGTextButton(fBFrame, "Undo");
+   fBFrame->AddFrame(fUndo, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
    fUndo->Associate(this);
-   AddFrame(f1,  new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));  
+   AddFrame(fBFrame,  new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));  
    fUndo->SetSize(fApply->GetSize());
 
    // Initialize layout
@@ -349,13 +359,9 @@ void TGeoTrapEditor::DoApply()
          } else {
             view->SetRange(-fShape->GetDX(), -fShape->GetDY(), -fShape->GetDZ(),
                            fShape->GetDX(), fShape->GetDY(), fShape->GetDZ());
-            fPad->Modified();               
-            fPad->Update();
+            Update();
          }                  
-      } else {   
-         fPad->Modified();
-         fPad->Update();
-      }   
+      } else Update();
    }   
 }
 
@@ -511,6 +517,22 @@ enum ETGeoGtraWid {
    kGTRA_TWIST
 };
 
+//////////////////////////////////////////////////////////////////////////
+//                                                                      //
+//  TGeoGtraEditor                                                      //
+//                                                                      //
+//////////////////////////////////////////////////////////////////////////
+//Begin_Html
+/*
+<img src="gif/gtra_pic.gif">
+*/
+//End_Html
+//Begin_Html
+/*
+<img src="gif/gtra_ed.jpg">
+*/
+//End_Html
+
 //______________________________________________________________________________
 TGeoGtraEditor::TGeoGtraEditor(const TGWindow *p, Int_t id, Int_t width,
                                    Int_t height, UInt_t options, Pixel_t back)
@@ -529,6 +551,8 @@ TGeoGtraEditor::TGeoGtraEditor(const TGWindow *p, Int_t id, Int_t width,
    fETwist->Associate(this);
    f1->AddFrame(fETwist, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
    AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
+   TGeoTabManager::MoveFrame(fDFrame, this);
+   TGeoTabManager::MoveFrame(fBFrame, this);
    // Initialize layout
    MapSubwindows();
    Layout();
@@ -658,13 +682,9 @@ void TGeoGtraEditor::DoApply()
          } else {
             view->SetRange(-fShape->GetDX(), -fShape->GetDY(), -fShape->GetDZ(),
                            fShape->GetDX(), fShape->GetDY(), fShape->GetDZ());
-            fPad->Modified();               
-            fPad->Update();
+            Update();
          }                  
-      } else {   
-         fPad->Modified();
-         fPad->Update();
-      }   
+      } else Update();
    }   
 }
 
diff --git a/geombuilder/src/TGeoTrd1Editor.cxx b/geombuilder/src/TGeoTrd1Editor.cxx
index fbb3f1c7745..b5e0472da6e 100644
--- a/geombuilder/src/TGeoTrd1Editor.cxx
+++ b/geombuilder/src/TGeoTrd1Editor.cxx
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: TGeoTrd1Editor.cxx,v 1.2 2006/06/19 14:58:48 brun Exp $
+// @(#):$Name:  $:$Id: TGeoTrd1Editor.cxx,v 1.3 2006/06/23 16:00:13 brun Exp $
 // Author: M.Gheata 
 
 /*************************************************************************
@@ -14,6 +14,16 @@
 //  TGeoTrd1Editor                                                      //
 //                                                                      //
 //////////////////////////////////////////////////////////////////////////
+//Begin_Html
+/*
+<img src="gif/trd1_pic.gif">
+*/
+//End_Html
+//Begin_Html
+/*
+<img src="gif/trd1_ed.jpg">
+*/
+//End_Html
 
 #include "TGeoTrd1Editor.h"
 #include "TGeoTabManager.h"
@@ -254,10 +264,7 @@ void TGeoTrd1Editor::DoApply()
       if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) {
          fShape->Draw();
          fPad->GetView()->ShowAxis();
-      } else {   
-         fPad->Modified();
-         fPad->Update();
-      }   
+      } else Update();
    }   
 }
 
diff --git a/geombuilder/src/TGeoTrd2Editor.cxx b/geombuilder/src/TGeoTrd2Editor.cxx
index dc10ad23df3..aaf97fec73d 100644
--- a/geombuilder/src/TGeoTrd2Editor.cxx
+++ b/geombuilder/src/TGeoTrd2Editor.cxx
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: TGeoTrd2Editor.cxx,v 1.2 2006/06/19 14:58:48 brun Exp $
+// @(#):$Name:  $:$Id: TGeoTrd2Editor.cxx,v 1.3 2006/06/23 16:00:13 brun Exp $
 // Author: M.Gheata 
 
 /*************************************************************************
@@ -14,6 +14,16 @@
 //  TGeoTrd2Editor                                                      //
 //                                                                      //
 //////////////////////////////////////////////////////////////////////////
+//Begin_Html
+/*
+<img src="gif/trd2_pic.gif">
+*/
+//End_Html
+//Begin_Html
+/*
+<img src="gif/trd2_ed.jpg">
+*/
+//End_Html
 
 #include "TGeoTrd2Editor.h"
 #include "TGeoTabManager.h"
@@ -271,10 +281,7 @@ void TGeoTrd2Editor::DoApply()
       if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) {
          fShape->Draw();
          fPad->GetView()->ShowAxis();
-      } else {   
-         fPad->Modified();
-         fPad->Update();
-      }   
+      } else Update();
    }   
 }
 
diff --git a/geombuilder/src/TGeoTubeEditor.cxx b/geombuilder/src/TGeoTubeEditor.cxx
index e219ebb1767..75237ffda07 100644
--- a/geombuilder/src/TGeoTubeEditor.cxx
+++ b/geombuilder/src/TGeoTubeEditor.cxx
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: TGeoTubeEditor.cxx,v 1.4 2006/06/23 16:00:13 brun Exp $
+// @(#):$Name:  $:$Id: TGeoTubeEditor.cxx,v 1.5 2006/06/24 08:30:18 brun Exp $
 // Author: M.Gheata 
 
 /*************************************************************************
@@ -14,6 +14,16 @@
 //  TGeoTubeEditor                                                      //
 //                                                                      //
 //////////////////////////////////////////////////////////////////////////
+//Begin_Html
+/*
+<img src="gif/tube_pic.gif">
+*/
+//End_Html
+//Begin_Html
+/*
+<img src="gif/tube_ed.jpg">
+*/
+//End_Html
 
 #include "TGeoTubeEditor.h"
 #include "TGeoTabManager.h"
@@ -63,8 +73,7 @@ TGeoTubeEditor::TGeoTubeEditor(const TGWindow *p, Int_t id, Int_t width,
    MakeTitle("Tube dimensions");
    TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame);
    // Number entry for rmin
-   TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame |
-                                 kLHintsExpandX | kOwnBackground);
+   TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
    f1->AddFrame(new TGLabel(f1, "Rmin"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
    fERmin = new TGNumberEntry(f1, 0., 5, kTUBE_RMIN);
    fERmin->SetNumAttr(TGNumberFormat::kNEANonNegative);
@@ -72,12 +81,11 @@ TGeoTubeEditor::TGeoTubeEditor(const TGWindow *p, Int_t id, Int_t width,
    nef->SetToolTipText("Enter the inner radius");
    fERmin->Associate(this);
    fERmin->Resize(100,fERmin->GetDefaultHeight());
-   f1->AddFrame(fERmin, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
-   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4));
+   f1->AddFrame(fERmin, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
+   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
    
    // Number entry for Rmax
-   f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame |
-                                 kLHintsExpandX | kOwnBackground);
+   f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
    f1->AddFrame(new TGLabel(f1, "Rmax"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
    fERmax = new TGNumberEntry(f1, 0., 5, kTUBE_RMAX);
    fERmax->SetNumAttr(TGNumberFormat::kNEANonNegative);
@@ -85,12 +93,11 @@ TGeoTubeEditor::TGeoTubeEditor(const TGWindow *p, Int_t id, Int_t width,
    nef->SetToolTipText("Enter the outer radius");
    fERmax->Associate(this);
    fERmax->Resize(100,fERmax->GetDefaultHeight());
-   f1->AddFrame(fERmax, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
-   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4));
+   f1->AddFrame(fERmax, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
+   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
    
    // Number entry for dz
-   f1 = new TGCompositeFrame(compxyz, 118, 10, kHorizontalFrame |
-                                 kLHintsExpandX | kOwnBackground);
+   f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
    f1->AddFrame(new TGLabel(f1, "DZ"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
    fEDz = new TGNumberEntry(f1, 0., 5, kTUBE_Z);
    fEDz->SetNumAttr(TGNumberFormat::kNEAPositive);
@@ -98,27 +105,27 @@ TGeoTubeEditor::TGeoTubeEditor(const TGWindow *p, Int_t id, Int_t width,
    nef->SetToolTipText("Enter the tube half-lenth in Z");
    fEDz->Associate(this);
    fEDz->Resize(100,fEDz->GetDefaultHeight());
-   f1->AddFrame(fEDz, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
-   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4));
+   f1->AddFrame(fEDz, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
+   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
    
-   compxyz->Resize(150,30);
+//   compxyz->Resize(150,30);
    AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
       
    // Delayed draw
-   f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth | kSunkenFrame);
-   fDelayed = new TGCheckButton(f1, "Delayed draw");
-   f1->AddFrame(fDelayed, new TGLayoutHints(kLHintsLeft , 2, 2, 4, 4));
-   AddFrame(f1,  new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));  
+   fDFrame = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth | kSunkenFrame);
+   fDelayed = new TGCheckButton(fDFrame, "Delayed draw");
+   fDFrame->AddFrame(fDelayed, new TGLayoutHints(kLHintsLeft , 2, 2, 4, 4));
+   AddFrame(fDFrame,  new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));  
 
    // Buttons
-   f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
-   fApply = new TGTextButton(f1, "Apply");
-   f1->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
+   fBFrame = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
+   fApply = new TGTextButton(fBFrame, "Apply");
+   fBFrame->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
    fApply->Associate(this);
-   fUndo = new TGTextButton(f1, "Undo");
-   f1->AddFrame(fUndo, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
+   fUndo = new TGTextButton(fBFrame, "Undo");
+   fBFrame->AddFrame(fUndo, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
    fUndo->Associate(this);
-   AddFrame(f1,  new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));  
+   AddFrame(fBFrame,  new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));  
    fUndo->SetSize(fApply->GetSize());
    
    // Initialize layout
@@ -231,10 +238,7 @@ void TGeoTubeEditor::DoApply()
       if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) {
          fShape->Draw();
          fPad->GetView()->ShowAxis();
-      } else {   
-         fPad->Modified();
-         fPad->Update();
-      }   
+      } else Update();
    }   
 }
 
@@ -307,6 +311,16 @@ void TGeoTubeEditor::DoDz()
 //  TGeoTubeSegEditor                                                   //
 //                                                                      //
 //////////////////////////////////////////////////////////////////////////
+//Begin_Html
+/*
+<img src="gif/tubs_pic.gif">
+*/
+//End_Html
+//Begin_Html
+/*
+<img src="gif/tubs_ed.jpg">
+*/
+//End_Html
 
 ClassImp(TGeoTubeSegEditor)
 
@@ -323,20 +337,21 @@ TGeoTubeSegEditor::TGeoTubeSegEditor(const TGWindow *p, Int_t id, Int_t width,
    fLock = kFALSE;
    MakeTitle("Phi range");
    TGTextEntry *nef;
-   TGCompositeFrame *compxyz = new TGCompositeFrame(this, 155, 200, kHorizontalFrame | kRaisedFrame);
+   TGCompositeFrame *compxyz = new TGCompositeFrame(this, 155, 110, kHorizontalFrame | kFixedWidth | kFixedHeight | kRaisedFrame);
    // Vertical slider
-   fSPhi = new TGDoubleVSlider(compxyz,140);
+   fSPhi = new TGDoubleVSlider(compxyz,100);
    fSPhi->SetRange(0.,720.);
-   compxyz->AddFrame(fSPhi, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 2, 2, 4, 4)); 
-   TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 100, 200, kVerticalFrame);
-   f1->AddFrame(new TGLabel(f1, "Phi min."), new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 2, 2));
+   fSPhi->Resize(fSPhi->GetDefaultWidth(), 100);
+   compxyz->AddFrame(fSPhi, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4)); 
+   TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 135, 100, kVerticalFrame | kFixedHeight);
+   f1->AddFrame(new TGLabel(f1, "Phi min."), new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 6, 0));
    fEPhi1 = new TGNumberEntry(f1, 0., 5, kTUBESEG_PHI1);
    fEPhi1->Resize(100, fEPhi1->GetDefaultHeight());
    fEPhi1->SetNumAttr(TGNumberFormat::kNEANonNegative);
    nef = (TGTextEntry*)fEPhi1->GetNumberEntry();
    nef->SetToolTipText("Enter the phi1 value");
    fEPhi1->Associate(this);
-   f1->AddFrame(fEPhi1, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2));
+   f1->AddFrame(fEPhi1, new TGLayoutHints(kLHintsTop | kLHintsRight, 2, 2, 2, 2));
 
    fEPhi2 = new TGNumberEntry(f1, 0., 5, kTUBESEG_PHI2);
    fEPhi2->Resize(100, fEPhi2->GetDefaultHeight());
@@ -344,12 +359,14 @@ TGeoTubeSegEditor::TGeoTubeSegEditor(const TGWindow *p, Int_t id, Int_t width,
    nef = (TGTextEntry*)fEPhi2->GetNumberEntry();
    nef->SetToolTipText("Enter the phi2 value");
    fEPhi2->Associate(this);
-   f1->AddFrame(fEPhi2, new TGLayoutHints(kLHintsBottom | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2));
-   f1->AddFrame(new TGLabel(f1, "Phi max."), new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2));
-   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2));
+   f1->AddFrame(fEPhi2, new TGLayoutHints(kLHintsBottom | kLHintsRight, 2, 2, 2, 2));
+   f1->AddFrame(new TGLabel(f1, "Phi max."), new TGLayoutHints(kLHintsBottom, 0, 0, 6, 2));
+   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
    
-   compxyz->Resize(150,150);
+//   compxyz->Resize(150,150);
    AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
+   TGeoTabManager::MoveFrame(fDFrame, this);
+   TGeoTabManager::MoveFrame(fBFrame, this);
    
    // Initialize layout
    MapSubwindows();
@@ -521,10 +538,7 @@ void TGeoTubeSegEditor::DoApply()
       if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) {
          fShape->Draw();
          fPad->GetView()->ShowAxis();
-      } else {   
-         fPad->Modified();
-         fPad->Update();
-      }   
+      } else Update();
    }   
 }
 
@@ -532,6 +546,9 @@ void TGeoTubeSegEditor::DoApply()
 void TGeoTubeSegEditor::DoUndo()
 {
 // Slot for undoing last operation.
+   fERmin->SetNumber(fRmini);
+   fERmax->SetNumber(fRmaxi);
+   fEDz->SetNumber(fDzi);
    fEPhi1->SetNumber(fPmini);
    fEPhi2->SetNumber(fPmaxi);
    fSPhi->SetPosition(fPmini,fPmaxi);
@@ -540,6 +557,281 @@ void TGeoTubeSegEditor::DoUndo()
    fApply->SetEnabled(kFALSE);
 }
 
+//////////////////////////////////////////////////////////////////////////
+//                                                                      //
+//  TGeoCtubEditor                                                   //
+//                                                                      //
+//////////////////////////////////////////////////////////////////////////
+//Begin_Html
+/*
+<img src="gif/ctub_pic.gif">
+*/
+//End_Html
+//Begin_Html
+/*
+<img src="gif/ctub_ed.jpg">
+*/
+//End_Html
+
+ClassImp(TGeoCtubEditor)
+
+enum ETGeoCtubSegWid {
+   kCTUB_THLO, kCTUB_PHLO, kCTUB_THHI, kCTUB_PHHI
+};
+
+//______________________________________________________________________________
+TGeoCtubEditor::TGeoCtubEditor(const TGWindow *p, Int_t id, Int_t width,
+                               Int_t height, UInt_t options, Pixel_t back)
+               : TGeoTubeSegEditor(p, id, width, height, options, back)
+{
+   // Constructor for cut tube editor
+   MakeTitle("Theta/phi low");
+   TGTextEntry *nef;
+   // Number entry for theta/phi of the lower normal
+   TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame);
+   TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
+   f1->AddFrame(new TGLabel(f1, "TH_LO"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
+   fEThlo = new TGNumberEntry(f1, 0., 5, kCTUB_THLO);
+   fEThlo->SetNumAttr(TGNumberFormat::kNEANonNegative);
+   nef = (TGTextEntry*)fEThlo->GetNumberEntry();
+   nef->SetToolTipText("Enter the theta angle of the lower plane normal");
+   fEThlo->Associate(this);
+   fEThlo->Connect("ValueSet(Long_t)", "TGeoCtubEditor", this, "DoThlo()");
+   nef->Connect("TextChanged(const char *)","TGeoCtubEditor", this, "DoModified()");
+   fEThlo->Resize(100,fEThlo->GetDefaultHeight());
+   f1->AddFrame(fEThlo, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
+   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
+
+   f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
+   f1->AddFrame(new TGLabel(f1, "PH_LO"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
+   fEPhlo = new TGNumberEntry(f1, 0., 5, kCTUB_PHLO);
+   fEPhlo->SetNumAttr(TGNumberFormat::kNEANonNegative);
+   nef = (TGTextEntry*)fEPhlo->GetNumberEntry();
+   nef->SetToolTipText("Enter the phi angle of the lower plane normal");
+   fEPhlo->Associate(this);
+   fEPhlo->Connect("ValueSet(Long_t)", "TGeoCtubEditor", this, "DoPhlo()");
+   nef->Connect("TextChanged(const char *)","TGeoCtubEditor", this, "DoModified()");
+   fEPhlo->Resize(100,fEPhlo->GetDefaultHeight());
+   f1->AddFrame(fEPhlo, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
+   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
+   AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
+
+   // Number entry for theta/phi of the lower normal
+   MakeTitle("Theta/phi high");
+   compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame);
+   f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
+   f1->AddFrame(new TGLabel(f1, "TH_HI"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
+   fEThhi = new TGNumberEntry(f1, 0., 5, kCTUB_THHI);
+   fEThhi->SetNumAttr(TGNumberFormat::kNEANonNegative);
+   nef = (TGTextEntry*)fEThhi->GetNumberEntry();
+   nef->SetToolTipText("Enter the theta angle of the upper plane normal");
+   fEThhi->Associate(this);
+   fEThhi->Connect("ValueSet(Long_t)", "TGeoCtubEditor", this, "DoThhi()");
+   nef->Connect("TextChanged(const char *)","TGeoCtubEditor", this, "DoModified()");
+   fEThhi->Resize(100,fEThhi->GetDefaultHeight());
+   f1->AddFrame(fEThhi, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
+   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
+
+   f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
+   f1->AddFrame(new TGLabel(f1, "PH_HI"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
+   fEPhhi = new TGNumberEntry(f1, 0., 5, kCTUB_PHHI);
+   fEPhhi->SetNumAttr(TGNumberFormat::kNEANonNegative);
+   nef = (TGTextEntry*)fEPhhi->GetNumberEntry();
+   nef->SetToolTipText("Enter the phi angle of the upper plane normal");
+   fEPhhi->Associate(this);
+   fEPhhi->Connect("ValueSet(Long_t)", "TGeoCtubEditor", this, "DoPhhi()");
+   nef->Connect("TextChanged(const char *)","TGeoCtubEditor", this, "DoModified()");
+   fEPhhi->Resize(100,fEPhhi->GetDefaultHeight());
+   f1->AddFrame(fEPhhi, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
+   compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4));
+   AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
+   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);
+}
+
+//______________________________________________________________________________
+TGeoCtubEditor::~TGeoCtubEditor()
+{
+// Destructor
+   TGFrameElement *el;
+   TIter next(GetList());
+   while ((el = (TGFrameElement *)next())) {
+      if (el->fFrame->IsComposite()) 
+         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)
+{
+   // Connect to the selected object.
+   if (obj == 0 || (obj->IsA()!=TGeoCtub::Class())) {
+      SetActive(kFALSE);
+      return;                 
+   } 
+   fModel = obj;
+   fPad = pad;
+   fShape = (TGeoTube*)fModel;
+   fRmini = fShape->GetRmin();
+   fRmaxi = fShape->GetRmax();
+   fDzi = fShape->GetDz();
+   fNamei = fShape->GetName();
+   fPmini = ((TGeoTubeSeg*)fShape)->GetPhi1();
+   fPmaxi = ((TGeoTubeSeg*)fShape)->GetPhi2();
+   const Double_t *nlo = ((TGeoCtub*)fShape)->GetNlow();
+   const Double_t *nhi = ((TGeoCtub*)fShape)->GetNhigh();
+   fThlo = TMath::RadToDeg() * TMath::ACos(nlo[2]);
+   fPhlo = TMath::RadToDeg() * TMath::ATan2(nlo[1], nlo[0]);
+   fThhi = TMath::RadToDeg() * TMath::ACos(nhi[2]);
+   fPhhi = TMath::RadToDeg() * TMath::ATan2(nhi[1], nhi[0]);
+   
+   fShapeName->SetText(fShape->GetName());
+   fEPhi1->SetNumber(fPmini);
+   fEPhi2->SetNumber(fPmaxi);
+   fSPhi->SetPosition(fPmini,fPmaxi);
+   fERmin->SetNumber(fRmini);
+   fERmax->SetNumber(fRmaxi);
+   fEDz->SetNumber(fDzi);
+   fEThlo->SetNumber(fThlo);
+   fEPhlo->SetNumber(fPhlo);
+   fEThhi->SetNumber(fThhi);
+   fEPhhi->SetNumber(fPhhi);
+   fApply->SetEnabled(kFALSE);
+   fUndo->SetEnabled(kFALSE);
+   
+   if (fInit) ConnectSignals2Slots();
+   SetActive();
+}
+
+//______________________________________________________________________________
+void TGeoCtubEditor::DoThlo()
+{
+// Slot for phi1.
+   Double_t thlo = fEThlo->GetNumber();
+   if (thlo <= 90.) {thlo = 91.; fEThlo->SetNumber(thlo);}
+   if (thlo > 180.) {thlo = 180.; fEThlo->SetNumber(thlo);}
+   DoModified();
+   if (!IsDelayed()) DoApply();
+}
+
+//______________________________________________________________________________
+void TGeoCtubEditor::DoPhlo()
+{
+// Slot for phi1.
+   Double_t phlo = fEPhlo->GetNumber();
+   if (phlo >= 360.) {
+      phlo = 0.; 
+      fEPhlo->SetNumber(phlo);
+   }
+   DoModified();
+   if (!IsDelayed()) DoApply();
+}
+   
+//______________________________________________________________________________
+void TGeoCtubEditor::DoThhi()
+{
+// Slot for phi1.
+   Double_t thhi = fEThhi->GetNumber();
+   if (thhi >= 90.) {thhi = 89.; fEThhi->SetNumber(thhi);}
+   DoModified();
+   if (!IsDelayed()) DoApply();
+}
+
+//______________________________________________________________________________
+void TGeoCtubEditor::DoPhhi()
+{
+// Slot for phi1.
+   Double_t phhi = fEPhhi->GetNumber();
+   if (phhi >= 360.) {
+      phhi = 0.; 
+      fEPhhi->SetNumber(phhi);
+   }
+   DoModified();
+   if (!IsDelayed()) DoApply();
+}
 
+//______________________________________________________________________________
+void TGeoCtubEditor::DoApply()
+{
+// Slot for applying modifications.
+   fApply->SetEnabled(kFALSE);
+   const char *name = fShapeName->GetText();
+   if (strcmp(name,fShape->GetName())) fShape->SetName(name);
+   Double_t rmin = fERmin->GetNumber();
+   Double_t rmax = fERmax->GetNumber();
+   if (rmin<0 || rmax<rmin) return;
+   Double_t dz = fEDz->GetNumber();
+   Double_t phi1 = fEPhi1->GetNumber();
+   Double_t phi2 = fEPhi2->GetNumber();
+   if ((phi2-phi1) > 360.001) {
+      phi1 = 0.;
+      phi2 = 360.;
+      fEPhi1->SetNumber(phi1);
+      fEPhi2->SetNumber(phi2);
+      fLock = kTRUE;
+      fSPhi->SetPosition(phi1,phi2);
+      fLock = kFALSE;
+   } 
+   Double_t thlo = TMath::DegToRad()*fEThlo->GetNumber();
+   Double_t phlo = TMath::DegToRad()*fEPhlo->GetNumber();
+   Double_t thhi = TMath::DegToRad()*fEThhi->GetNumber();  
+   Double_t phhi = TMath::DegToRad()*fEPhhi->GetNumber();
+   Double_t lx = TMath::Sin(thlo)*TMath::Cos(phlo);  
+   Double_t ly = TMath::Sin(thlo)*TMath::Sin(phlo);  
+   Double_t lz = TMath::Cos(thlo);
+   Double_t tx = TMath::Sin(thhi)*TMath::Cos(phhi);  
+   Double_t ty = TMath::Sin(thhi)*TMath::Sin(phhi);  
+   Double_t tz = TMath::Cos(thhi);
+   ((TGeoCtub*)fShape)->SetCtubDimensions(rmin, rmax, dz, phi1, phi2, lx,ly,lz,tx,ty,tz);
+   fShape->ComputeBBox();
+   fUndo->SetEnabled();
+   if (fPad) {
+      if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) {
+         fShape->Draw();
+         fPad->GetView()->ShowAxis();
+      } else Update();
+   }   
+}
 
+//______________________________________________________________________________
+void TGeoCtubEditor::DoUndo()
+{
+// Slot for undoing last operation.
+   fERmin->SetNumber(fRmini);
+   fERmax->SetNumber(fRmaxi);
+   fEDz->SetNumber(fDzi);
+   fEPhi1->SetNumber(fPmini);
+   fEPhi2->SetNumber(fPmaxi);
+   fSPhi->SetPosition(fPmini,fPmaxi);
+   fEThlo->SetNumber(fThlo);
+   fEPhlo->SetNumber(fPhlo);
+   fEThhi->SetNumber(fThhi);
+   fEPhhi->SetNumber(fPhhi);
    
+   DoApply();
+   fUndo->SetEnabled(kFALSE);
+   fApply->SetEnabled(kFALSE);
+}
diff --git a/geombuilder/src/TGeoVolumeEditor.cxx b/geombuilder/src/TGeoVolumeEditor.cxx
index 3523a2db228..c626eb3f5b4 100644
--- a/geombuilder/src/TGeoVolumeEditor.cxx
+++ b/geombuilder/src/TGeoVolumeEditor.cxx
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: TGeoVolumeEditor.cxx,v 1.4 2006/06/24 08:26:42 brun Exp $
+// @(#):$Name:  $:$Id: TGeoVolumeEditor.cxx,v 1.5 2006/06/25 07:34:59 brun Exp $
 // Author: M.Gheata 
 
 /*************************************************************************
@@ -611,10 +611,7 @@ void TGeoVolumeEditor::DoAddNode()
    fLSelMatrix->SetText("Select matrix");
    fAddNode->SetEnabled(kFALSE);   
    fGeometry->SetTopVisible();
-   if (fPad) {
-      fPad->Modified();
-      fPad->Update();
-   }      
+   Update();
 }
 
 //______________________________________________________________________________
@@ -650,10 +647,7 @@ void TGeoVolumeEditor::DoRemoveNode()
       fEDivStep->SetNumber(step);
       fEDivN->SetNumber(ndiv);      
    }
-   if (fPad) {
-      fPad->Modified();
-      fPad->Update();
-   }      
+   Update();
 }
 
 //______________________________________________________________________________
@@ -663,7 +657,7 @@ void TGeoVolumeEditor::DoVisVolume()
    Bool_t on = (fBVis[0]->GetState()==kButtonDown)?kTRUE:kFALSE;
    if (fVolume->IsVisible() == on) return;
    fVolume->SetVisibility(on);
-   UpdatePad();
+   Update();
 }
 
 //______________________________________________________________________________
@@ -673,7 +667,7 @@ void TGeoVolumeEditor::DoVisDaughters()
    Bool_t on = (fBVis[1]->GetState()==kButtonDown)?kTRUE:kFALSE;
    if (fVolume->IsVisibleDaughters() == on) return;
    fVolume->VisibleDaughters(on);
-   UpdatePad();
+   Update();
 }
 
 //______________________________________________________________________________
@@ -684,7 +678,7 @@ void TGeoVolumeEditor::DoVisAuto()
    if ((fGeometry->GetVisLevel()==0) == on) return;
    if (on) fGeometry->SetVisLevel(0);
    else    fGeometry->SetVisLevel(fEVisLevel->GetIntNumber());
-   UpdatePad();
+   Update();
 }
 
 //______________________________________________________________________________
@@ -693,7 +687,7 @@ void TGeoVolumeEditor::DoVisLevel()
 // Slot for visibility level.
    fBAuto->SetState(kButtonUp);
    fGeometry->SetVisLevel(fEVisLevel->GetIntNumber());
-   UpdatePad();
+   Update();
 }
 
 //______________________________________________________________________________
@@ -708,7 +702,7 @@ void TGeoVolumeEditor::DoViewAll()
       fBRaytrace->SetState(kButtonUp);
    }   
    fVolume->SetVisContainers(on);
-   UpdatePad();
+   Update();
 }
 
 //______________________________________________________________________________
@@ -723,7 +717,7 @@ void TGeoVolumeEditor::DoViewLeaves()
       fBRaytrace->SetState(kButtonUp);
    }   
    fVolume->SetVisLeaves(on);
-   UpdatePad();
+   Update();
 }
 
 //______________________________________________________________________________
@@ -738,7 +732,7 @@ void TGeoVolumeEditor::DoViewOnly()
       fBRaytrace->SetState(kButtonUp);
    }   
    fVolume->SetVisOnly(on);
-   UpdatePad();
+   Update();
 }
 
 //______________________________________________________________________________
@@ -748,7 +742,7 @@ void TGeoVolumeEditor::DoRaytrace()
    Bool_t on = (fBRaytrace->GetState()==kButtonDown)?kTRUE:kFALSE;
    if (fVolume->IsRaytracing() == on) return;
    fVolume->Raytrace(on);
-   UpdatePad();
+   Update();
 }
 
 //______________________________________________________________________________
@@ -946,16 +940,6 @@ void TGeoVolumeEditor::DoApplyDiv()
    fVolume->Divide(fDivName->GetText(), iaxis, ndiv, xlo, step);
    fApplyDiv->SetEnabled(kFALSE);   
    fGeometry->SetTopVisible();
-   UpdatePad();
+   Update();
 //   fVolume->Draw();  
 }
-
-//______________________________________________________________________________
-void TGeoVolumeEditor::UpdatePad()
-{
-// Update pad.
-   if (fPad) {
-      fPad->Modified();
-      fPad->Update();
-   }
-}      
-- 
GitLab