Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 "TGButton.h"
26#include "TGTextEntry.h"
27#include "TGNumberEntry.h"
28#include "TGLabel.h"
29#include "TGeoTabManager.h"
30
32
36};
37
38////////////////////////////////////////////////////////////////////////////////
39/// Constructor for node editor
40
42 Int_t height, UInt_t options, Pixel_t back)
43 : TGeoGedFrame(p, width, height, options | kVerticalFrame, back)
44{
45 fNode = 0;
47 Pixel_t color;
48
49 // TextEntry for medium name
50 TGTextEntry *nef;
51 MakeTitle("Name");
55 fNodeName->SetToolTipText("Enter the node name");
56 fNodeName->Associate(this);
57 f1->AddFrame(fNodeName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5));
58 f1->AddFrame(new TGLabel(f1, "ID"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
59 fNodeNumber = new TGNumberEntry(f1, 0., 1, kNODE_ID);
61 nef->SetToolTipText("Enter the node copy number");
63 f1->AddFrame(fNodeNumber, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4));
64 AddFrame(f1, new TGLayoutHints(kLHintsLeft, 3, 3, 2, 5));
65
66
67// Mother volume selection
68 MakeTitle("Mother volume");
69 f1 = new TGCompositeFrame(this, 155, 30, kHorizontalFrame | kFixedWidth);
71 fLSelMother = new TGLabel(f1, "Select mother");
72 gClient->GetColorByName("#0000ff", color);
77 fBSelMother->SetToolTipText("Select one of the existing volumes");
79 f1->AddFrame(fBSelMother, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
80 fEditMother = new TGTextButton(f1, "Edit");
81 f1->AddFrame(fEditMother, new TGLayoutHints(kLHintsRight, 1, 1, 1, 1));
83 AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 2));
84
85// Volume selection
86 MakeTitle("Volume");
87 f1 = new TGCompositeFrame(this, 155, 30, kHorizontalFrame | kFixedWidth);
89 fLSelVolume = new TGLabel(f1, "Select volume");
90 gClient->GetColorByName("#0000ff", color);
95 fBSelVolume->SetToolTipText("Select one of the existing volumes");
97 f1->AddFrame(fBSelVolume, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
98 fEditVolume = new TGTextButton(f1, "Edit");
99 f1->AddFrame(fEditVolume, new TGLayoutHints(kLHintsRight, 1, 1, 1, 1));
100 fEditVolume->Associate(this);
101 AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 2));
102
103// Matrix selection
104 MakeTitle("Matrix");
105 f1 = new TGCompositeFrame(this, 155, 30, kHorizontalFrame | kFixedWidth);
106 fSelectedMatrix = 0;
107 fLSelMatrix = new TGLabel(f1, "Select matrix");
108 gClient->GetColorByName("#0000ff", color);
111 f1->AddFrame(fLSelMatrix, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2));
113 fBSelMatrix->SetToolTipText("Select one of the existing matrices");
114 fBSelMatrix->Associate(this);
115 f1->AddFrame(fBSelMatrix, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
116 fEditMatrix = new TGTextButton(f1, "Edit");
117 f1->AddFrame(fEditMatrix, new TGLayoutHints(kLHintsRight, 1, 1, 1, 1));
118 fEditMatrix->Associate(this);
119 AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 2));
120
121 // Buttons
122 f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
123 fApply = new TGTextButton(f1, "Apply");
124 f1->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
125 fApply->Associate(this);
126 fUndo = new TGTextButton(f1, "Undo");
127 f1->AddFrame(fUndo, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
128 fUndo->Associate(this);
129 AddFrame(f1, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
131}
132
133////////////////////////////////////////////////////////////////////////////////
134/// Destructor
135
137{
138 TGFrameElement *el;
139 TIter next(GetList());
140 while ((el = (TGFrameElement *)next())) {
141 if (el->fFrame->IsComposite())
143 }
144 Cleanup();
145}
146
147////////////////////////////////////////////////////////////////////////////////
148/// Connect signals to slots.
149
151{
152 fBSelMother->Connect("Clicked()", "TGeoNodeEditor", this, "DoSelectMother()");
153 fBSelVolume->Connect("Clicked()", "TGeoNodeEditor", this, "DoSelectVolume()");
154 fBSelMatrix->Connect("Clicked()", "TGeoNodeEditor", this, "DoSelectMatrix()");
155 fApply->Connect("Clicked()", "TGeoNodeEditor", this, "DoApply()");
156 fUndo->Connect("Clicked()", "TGeoNodeEditor", this, "DoUndo()");
157 fEditMother->Connect("Clicked()", "TGeoNodeEditor", this, "DoEditMother()");
158 fEditVolume->Connect("Clicked()", "TGeoNodeEditor", this, "DoEditVolume()");
159 fEditMatrix->Connect("Clicked()", "TGeoNodeEditor", this, "DoEditMatrix()");
160 fNodeName->Connect("TextChanged(const char *)", "TGeoNodeEditor", this, "DoNodeName()");
161 fInit = kFALSE;
162}
163
164
165////////////////////////////////////////////////////////////////////////////////
166/// Connect to a editable object.
167
169{
170 if (obj == 0 || !obj->InheritsFrom(TGeoNode::Class())) {
172 return;
173 }
174 fNode = (TGeoNode*)obj;
175 const char *sname = fNode->GetName();
176 fNodeName->SetText(sname);
177
179
186
189
191 SetActive();
192}
193
194////////////////////////////////////////////////////////////////////////////////
195/// Select the mother volume.
196
198{
200 new TGeoVolumeDialog(fBSelMother, gClient->GetRoot(), 200,300);
203 else fSelectedMother = vol;
204}
205
206////////////////////////////////////////////////////////////////////////////////
207/// Select the volume.
208
210{
212 new TGeoVolumeDialog(fBSelVolume, gClient->GetRoot(), 200,300);
215 else fSelectedVolume = vol;
216}
217
218////////////////////////////////////////////////////////////////////////////////
219/// Select the matrix.
220
222{
223 TGeoMatrix *matrix = fSelectedMatrix;
224 new TGeoMatrixDialog(fBSelMatrix, gClient->GetRoot(), 200,300);
227 else fSelectedMatrix = matrix;
228}
229
230////////////////////////////////////////////////////////////////////////////////
231/// Edit the mother volume.
232
234{
235 if (!fSelectedMother) {
237 return;
238 }
241 fTabMgr->SetTab();
243}
244
245////////////////////////////////////////////////////////////////////////////////
246/// Edit selected volume.
247
249{
250 if (!fSelectedVolume) {
252 return;
253 }
256 fTabMgr->SetTab();
258}
259
260////////////////////////////////////////////////////////////////////////////////
261/// Edit selected material.
262
264{
265 if (!fSelectedMatrix) return;
267}
268
269////////////////////////////////////////////////////////////////////////////////
270/// Change node name.
271
273{
274 const char *name = fNodeName->GetText();
275 if (!name[0] || !strcmp(name, fNode->GetName())) return;
277}
278
279////////////////////////////////////////////////////////////////////////////////
280/// Change node copy number
281
283{
284}
285
286////////////////////////////////////////////////////////////////////////////////
287/// Slot for applying modifications.
288
290{
291}
292
293////////////////////////////////////////////////////////////////////////////////
294/// Slot for undoing last operation.
295
297{
298}
299
@ 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
Pixel value.
Definition GuiTypes.h:40
const Bool_t kFALSE
Definition RtypesCore.h:92
const Bool_t kTRUE
Definition RtypesCore.h:91
#define ClassImp(name)
Definition Rtypes.h:364
include TDocParser_001 C image html pict1_TDocParser_001 png width
#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:110
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:398
virtual void SetEnabled(Bool_t e=kTRUE)
Set enabled or disabled state of button.
Definition TGButton.cxx:412
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition TGClient.cxx:288
virtual TList * GetList() const
Definition TGFrame.h:346
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1102
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition TGFrame.cxx:952
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:306
virtual void SetSize(const TGDimension &s)
Definition TGFrame.h:276
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:215
TGDimension GetSize() const
Definition TGFrame.h:254
virtual Bool_t IsComposite() const
Definition TGFrame.h:236
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition TGFrame.cxx:590
virtual void SetTextColor(Pixel_t color, Bool_t global=kFALSE)
Changes text color.
Definition TGLabel.cxx:361
virtual void SetText(TGString *newText)
Set new text in label.
Definition TGLabel.cxx:179
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
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:82
Bool_t fInit
Definition TGedFrame.h:54
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition TGedFrame.cxx:96
Common base class for geombuilder editors.
virtual void SetActive(Bool_t active=kTRUE)
Set active GUI attribute frames related to the selected object.
TGeoTabManager * fTabMgr
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:49
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:445
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