Logo ROOT  
Reference Guide
TGeoNodeEditor.cxx
Go to the documentation of this file.
1// @(#):$Id: b94274447e46ae2cf700c562e57c3c38c6612b74 $
2// Author: M.Gheata
3
4/*************************************************************************
5 * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12/** \class TGeoNodeEditor
13\ingroup Geometry_builder
14
15Editor class for TGeoNode objects.
16
17*/
18
19#include "TGeoNodeEditor.h"
20#include "TGedEditor.h"
21#include "TGeoManager.h"
22#include "TGeoMatrix.h"
23#include "TGeoNode.h"
24#include "TGTab.h"
25#include "TGComboBox.h"
26#include "TGButton.h"
27#include "TGTextEntry.h"
28#include "TGNumberEntry.h"
29#include "TGLabel.h"
30#include "TGeoTabManager.h"
31
33
37};
38
39////////////////////////////////////////////////////////////////////////////////
40/// Constructor for node editor
41
43 Int_t height, UInt_t options, Pixel_t back)
44 : TGeoGedFrame(p, width, height, options | kVerticalFrame, back)
45{
46 fNode = 0;
48 Pixel_t color;
49
50 // TextEntry for medium name
51 TGTextEntry *nef;
52 MakeTitle("Name");
56 fNodeName->SetToolTipText("Enter the node name");
57 fNodeName->Associate(this);
58 f1->AddFrame(fNodeName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5));
59 f1->AddFrame(new TGLabel(f1, "ID"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
60 fNodeNumber = new TGNumberEntry(f1, 0., 1, kNODE_ID);
62 nef->SetToolTipText("Enter the node copy number");
64 f1->AddFrame(fNodeNumber, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4));
65 AddFrame(f1, new TGLayoutHints(kLHintsLeft, 3, 3, 2, 5));
66
67
68// Mother volume selection
69 MakeTitle("Mother volume");
70 f1 = new TGCompositeFrame(this, 155, 30, kHorizontalFrame | kFixedWidth);
72 fLSelMother = new TGLabel(f1, "Select mother");
73 gClient->GetColorByName("#0000ff", color);
78 fBSelMother->SetToolTipText("Select one of the existing volumes");
80 f1->AddFrame(fBSelMother, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
81 fEditMother = new TGTextButton(f1, "Edit");
82 f1->AddFrame(fEditMother, new TGLayoutHints(kLHintsRight, 1, 1, 1, 1));
84 AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 2));
85
86// Volume selection
87 MakeTitle("Volume");
88 f1 = new TGCompositeFrame(this, 155, 30, kHorizontalFrame | kFixedWidth);
90 fLSelVolume = new TGLabel(f1, "Select volume");
91 gClient->GetColorByName("#0000ff", color);
96 fBSelVolume->SetToolTipText("Select one of the existing volumes");
98 f1->AddFrame(fBSelVolume, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
99 fEditVolume = new TGTextButton(f1, "Edit");
100 f1->AddFrame(fEditVolume, new TGLayoutHints(kLHintsRight, 1, 1, 1, 1));
101 fEditVolume->Associate(this);
102 AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 2));
103
104// Matrix selection
105 MakeTitle("Matrix");
106 f1 = new TGCompositeFrame(this, 155, 30, kHorizontalFrame | kFixedWidth);
107 fSelectedMatrix = 0;
108 fLSelMatrix = new TGLabel(f1, "Select matrix");
109 gClient->GetColorByName("#0000ff", color);
112 f1->AddFrame(fLSelMatrix, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2));
114 fBSelMatrix->SetToolTipText("Select one of the existing matrices");
115 fBSelMatrix->Associate(this);
116 f1->AddFrame(fBSelMatrix, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
117 fEditMatrix = new TGTextButton(f1, "Edit");
118 f1->AddFrame(fEditMatrix, new TGLayoutHints(kLHintsRight, 1, 1, 1, 1));
119 fEditMatrix->Associate(this);
120 AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 2));
121
122 // Buttons
123 f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
124 fApply = new TGTextButton(f1, "Apply");
125 f1->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
126 fApply->Associate(this);
127 fUndo = new TGTextButton(f1, "Undo");
128 f1->AddFrame(fUndo, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
129 fUndo->Associate(this);
130 AddFrame(f1, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
132}
133
134////////////////////////////////////////////////////////////////////////////////
135/// Destructor
136
138{
139 TGFrameElement *el;
140 TIter next(GetList());
141 while ((el = (TGFrameElement *)next())) {
142 if (el->fFrame->IsComposite())
144 }
145 Cleanup();
146}
147
148////////////////////////////////////////////////////////////////////////////////
149/// Connect signals to slots.
150
152{
153 fBSelMother->Connect("Clicked()", "TGeoNodeEditor", this, "DoSelectMother()");
154 fBSelVolume->Connect("Clicked()", "TGeoNodeEditor", this, "DoSelectVolume()");
155 fBSelMatrix->Connect("Clicked()", "TGeoNodeEditor", this, "DoSelectMatrix()");
156 fApply->Connect("Clicked()", "TGeoNodeEditor", this, "DoApply()");
157 fUndo->Connect("Clicked()", "TGeoNodeEditor", this, "DoUndo()");
158 fEditMother->Connect("Clicked()", "TGeoNodeEditor", this, "DoEditMother()");
159 fEditVolume->Connect("Clicked()", "TGeoNodeEditor", this, "DoEditVolume()");
160 fEditMatrix->Connect("Clicked()", "TGeoNodeEditor", this, "DoEditMatrix()");
161 fNodeName->Connect("TextChanged(const char *)", "TGeoNodeEditor", this, "DoNodeName()");
162 fInit = kFALSE;
163}
164
165
166////////////////////////////////////////////////////////////////////////////////
167/// Connect to a editable object.
168
170{
171 if (obj == 0 || !obj->InheritsFrom(TGeoNode::Class())) {
173 return;
174 }
175 fNode = (TGeoNode*)obj;
176 const char *sname = fNode->GetName();
177 fNodeName->SetText(sname);
178
180
187
190
192 SetActive();
193}
194
195////////////////////////////////////////////////////////////////////////////////
196/// Select the mother volume.
197
199{
201 new TGeoVolumeDialog(fBSelMother, gClient->GetRoot(), 200,300);
204 else fSelectedMother = vol;
205}
206
207////////////////////////////////////////////////////////////////////////////////
208/// Select the volume.
209
211{
213 new TGeoVolumeDialog(fBSelVolume, gClient->GetRoot(), 200,300);
216 else fSelectedVolume = vol;
217}
218
219////////////////////////////////////////////////////////////////////////////////
220/// Select the matrix.
221
223{
224 TGeoMatrix *matrix = fSelectedMatrix;
225 new TGeoMatrixDialog(fBSelMatrix, gClient->GetRoot(), 200,300);
228 else fSelectedMatrix = matrix;
229}
230
231////////////////////////////////////////////////////////////////////////////////
232/// Edit the mother volume.
233
235{
236 if (!fSelectedMother) {
238 return;
239 }
242 fTabMgr->SetTab();
244}
245
246////////////////////////////////////////////////////////////////////////////////
247/// Edit selected volume.
248
250{
251 if (!fSelectedVolume) {
253 return;
254 }
257 fTabMgr->SetTab();
259}
260
261////////////////////////////////////////////////////////////////////////////////
262/// Edit selected material.
263
265{
266 if (!fSelectedMatrix) return;
268}
269
270////////////////////////////////////////////////////////////////////////////////
271/// Change node name.
272
274{
275 const char *name = fNodeName->GetText();
276 if (!name[0] || !strcmp(name, fNode->GetName())) return;
278}
279
280////////////////////////////////////////////////////////////////////////////////
281/// Change node copy number
282
284{
285}
286
287////////////////////////////////////////////////////////////////////////////////
288/// Slot for applying modifications.
289
291{
292}
293
294////////////////////////////////////////////////////////////////////////////////
295/// Slot for undoing last operation.
296
298{
299}
300
void Class()
Definition: Class.C:29
@ kRaisedFrame
Definition: GuiTypes.h:384
@ kSunkenFrame
Definition: GuiTypes.h:383
@ kVerticalFrame
Definition: GuiTypes.h:381
@ kDoubleBorder
Definition: GuiTypes.h:385
@ kFixedWidth
Definition: GuiTypes.h:387
@ kHorizontalFrame
Definition: GuiTypes.h:382
ULong_t Pixel_t
Definition: GuiTypes.h:39
const Bool_t kFALSE
Definition: RtypesCore.h:90
const Bool_t kTRUE
Definition: RtypesCore.h:89
#define ClassImp(name)
Definition: Rtypes.h:361
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
#define gClient
Definition: TGClient.h:166
@ kLHintsRight
Definition: TGLayout.h:33
@ kLHintsExpandY
Definition: TGLayout.h:38
@ kLHintsLeft
Definition: TGLayout.h:31
@ kLHintsExpandX
Definition: TGLayout.h:37
char name[80]
Definition: TGX11.cxx:109
ETGeoNodeWid
@ kNODE_MATRIX
@ kNODE_ID
@ kNODE_MVOLSEL
@ kNODE_VOLSEL
@ kNODE_EDIT_VOL
@ kNODE_EDIT_MATRIX
@ kNODE_NAME
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:397
virtual void SetEnabled(Bool_t e=kTRUE)
Set enabled or disabled state of button.
Definition: TGButton.cxx:411
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition: TGClient.cxx:289
virtual TList * GetList() const
Definition: TGFrame.h:347
TGCompositeFrame(const TGCompositeFrame &)
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1101
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGFrame.cxx:951
TGFrame * fFrame
Definition: TGLayout.h:119
virtual void ChangeOptions(UInt_t options)
Change frame options. Options is an OR of the EFrameTypes.
Definition: TGFrame.cxx:305
virtual void SetSize(const TGDimension &s)
Definition: TGFrame.h:277
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:216
TGDimension GetSize() const
Definition: TGFrame.h:255
virtual Bool_t IsComposite() const
Definition: TGFrame.h:237
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:589
virtual void SetTextColor(Pixel_t color, Bool_t global=kFALSE)
Changes text color.
Definition: TGLabel.cxx:360
virtual void SetText(TGString *newText)
Set new text in label.
Definition: TGLabel.cxx:178
virtual void SetNumber(Double_t val)
TGNumberEntryField * GetNumberEntry() const
virtual void Associate(const TGWindow *w)
Make w the window that will receive the generated messages.
TGClient * fClient
Definition: TGObject.h:37
const char * GetText() const
Definition: TGTextEntry.h:134
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
virtual void SetText(const char *text, Bool_t emit=kTRUE)
Sets text entry to text, clears the selection and moves the cursor to the end of the line.
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:84
Bool_t fInit
Definition: TGedFrame.h:53
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
Common base class for geombuilder editors.
Definition: TGeoGedFrame.h:13
virtual void SetActive(Bool_t active=kTRUE)
Set active GUI attribute frames related to the selected object.
TGeoTabManager * fTabMgr
Definition: TGeoGedFrame.h:17
Geometrical transformation package.
Definition: TGeoMatrix.h:41
Editor class for TGeoNode objects.
void DoNodeNumber()
Change node copy number.
TGeoNode * fNode
TGNumberEntry * fNodeNumber
virtual void SetModel(TObject *obj)
Connect to a editable object.
void DoSelectMatrix()
Select the matrix.
TGLabel * fLSelVolume
void DoEditMother()
Edit the mother volume.
TGTextButton * fEditMatrix
TGeoNodeEditor(const TGWindow *p=0, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor for node editor.
void DoEditMatrix()
Edit selected material.
void DoSelectMother()
Select the mother volume.
TGTextButton * fEditVolume
void DoUndo()
Slot for undoing last operation.
TGTextButton * fApply
TGTextButton * fEditMother
TGLabel * fLSelMother
TGTextEntry * fNodeName
TGPictureButton * fBSelMatrix
virtual ~TGeoNodeEditor()
Destructor.
void DoEditVolume()
Edit selected volume.
virtual void ConnectSignals2Slots()
Connect signals to slots.
TGLabel * fLSelMatrix
TGeoVolume * fSelectedMother
void DoApply()
Slot for applying modifications.
TGeoVolume * fSelectedVolume
TGPictureButton * fBSelMother
void DoSelectVolume()
Select the volume.
TGPictureButton * fBSelVolume
TGTextButton * fUndo
TGeoMatrix * fSelectedMatrix
void DoNodeName()
Change node name.
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition: TGeoNode.h:41
TGeoVolume * GetVolume() const
Definition: TGeoNode.h:97
virtual TGeoMatrix * GetMatrix() const =0
TGeoVolume * GetMotherVolume() const
Definition: TGeoNode.h:92
Int_t GetNumber() const
Definition: TGeoNode.h:95
void GetVolumeEditor(TGeoVolume *vol)
Get editor for a volume.
static void Cleanup(TGCompositeFrame *frame)
Static method to cleanup hierarchically all daughters of a composite frame.
void SetTab()
Set a given tab element as active one.
void SetVolTabEnabled(Bool_t flag=kTRUE)
Enable/disable tabs.
void GetMatrixEditor(TGeoMatrix *matrix)
Get editor for a matrix.
static TObject * GetSelected()
static; return selected object
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:47
virtual void Draw(Option_t *option="")
draw top volume according to option
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Mother of all ROOT objects.
Definition: TObject.h:37
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:443
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition: TQObject.cxx:866
TF1 * f1
Definition: legend1.C:11