Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGLPShapeObjEditor.cxx
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Matevz Tadel 25/09/2006
3
4#include <cstring>
5
7#include "TGLPShapeObj.h"
8#include "TGedEditor.h"
9
10#include "TG3DLine.h"
11#include "TGButton.h"
12#include "TGButtonGroup.h"
13#include "TString.h"
14#include "TGLabel.h"
15#include "TGSlider.h"
16#include "TGNumberEntry.h"
17#include "TROOT.h"
18#include "TVirtualMutex.h"
19
20#include "TVirtualX.h"
21#include "TGLViewer.h"
22#include "TGLUtil.h"
23#include "TGLPhysicalShape.h"
24#include "TGLWidget.h"
25#include "TGLIncludes.h"
26
27#include "Buttons.h"
28
29/** \class TGLPShapeObjEditor
30\ingroup opengl
31GUI editor for TGLPShapeObj.
32*/
33
35
45
54
65
66////////////////////////////////////////////////////////////////////////////////
67/// Constructor of TGLPhysicalShape editor GUI.
68
70 : TGedFrame(p, width, height, options | kVerticalFrame, back),
71 fLb(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 2, 2, 3, 3), //button
72 fLe(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 0, 0, 3, 3), //entries
73 fLl(kLHintsLeft, 0, 8, 6, 0), // labels
74 fLs(kLHintsTop | kLHintsCenterX, 2, 2, 0, 0), ///sliders
75 fGeoFrame(nullptr),fGeoApplyButton(nullptr),
76 fColorFrame(nullptr),
77 fRedSlider(nullptr), fGreenSlider(nullptr), fBlueSlider(nullptr), fAlphaSlider(nullptr), fShineSlider(nullptr),
78 fColorApplyButton(nullptr), fColorApplyFamily(nullptr),
79 fRGBA(),
80 fPShapeObj(nullptr)
81{
82 fRGBA[12] = fRGBA[13] = fRGBA[14] = 0.0f;
83 fRGBA[15] = 1.0f;
84 fRGBA[16] = 60.0f;
85
88}
89
90////////////////////////////////////////////////////////////////////////////////
91/// Destroy color editor GUI component.
92/// Done automatically.
93
97
98////////////////////////////////////////////////////////////////////////////////
99/// Shape has changed.
100/// Check if set to zero and make sure we're no longer in editor.
101
103{
105 if (shape == nullptr && fGedEditor->GetModel() == fPShapeObj)
106 fGedEditor->SetModel(fGedEditor->GetPad(), fPShapeObj->fViewer, kButton1Down);
107}
108
109////////////////////////////////////////////////////////////////////////////////
110/// Shape has been modified.
111/// Update editor if we're still shown. Otherwise unref.
112
114{
115 if (fGedEditor->GetModel() == fPShapeObj)
116 fGedEditor->SetModel(fGedEditor->GetPad(), fPShapeObj, kButton1Down);
117 else
118 SetPShape(nullptr);
119}
120
121////////////////////////////////////////////////////////////////////////////////
122/// Sets model or disables/hides viewer.
123
125{
126 fPShapeObj = nullptr;
127
128 fPShapeObj = static_cast<TGLPShapeObj *>(obj);
129 SetPShape(fPShapeObj->fPShape);
130
131 SetRGBA(fPShapeObj->fPShape->Color());
132 SetCenter(fPShapeObj->fPShape->GetTranslation().CArr());
133 SetScale(fPShapeObj->fPShape->GetScale().CArr());
135}
136
137////////////////////////////////////////////////////////////////////////////////
138/// Set internal center data from 3 component 'c'.
139
141{
142 fGeomData[kCenterX]->SetNumber(c[0]);
143 fGeomData[kCenterY]->SetNumber(c[1]);
144 fGeomData[kCenterZ]->SetNumber(c[2]);
145}
146
147////////////////////////////////////////////////////////////////////////////////
148/// Set internal scale data from 3 component 'c'.
149
151{
152 fGeomData[kScaleX]->SetNumber(s[0]);
153 fGeomData[kScaleY]->SetNumber(s[1]);
154 fGeomData[kScaleZ]->SetNumber(s[2]);
155}
156
157////////////////////////////////////////////////////////////////////////////////
158/// Process 'Apply' - update the viewer object from GUI.
159
161{
162 TGLVertex3 trans;
163 TGLVector3 scale;
164 GetObjectData(trans.Arr(), scale.Arr());
165 if (fPShape) {
166 fPShape->SetTranslation(trans);
167 fPShape->Scale(scale);
168 }
169 fPShapeObj->fViewer->RequestDraw();
171}
172
173////////////////////////////////////////////////////////////////////////////////
174/// Extract the GUI object data, return center in 3 component 'center'
175/// scale in 3 component 'scale'.
176
178{
179 center[0] = fGeomData[kCenterX]->GetNumber();
180 center[1] = fGeomData[kCenterY]->GetNumber();
181 center[2] = fGeomData[kCenterZ]->GetNumber();
182 scale[0] = fGeomData[kScaleX]->GetNumber();
183 scale[1] = fGeomData[kScaleY]->GetNumber();
184 scale[2] = fGeomData[kScaleZ]->GetNumber();
185}
186
187////////////////////////////////////////////////////////////////////////////////
188/// Process setting of value in edit box - activate 'Apply' button.
189
191{
192 if (fGeoApplyButton->GetState() != kButtonUp)
193 fGeoApplyButton->SetState(kButtonUp);
194}
195
196////////////////////////////////////////////////////////////////////////////////
197/// Create GUI for setting scale and position.
198
200{
202
203 TGLabel *label=nullptr;
204
205 // Postion container
206 TGGroupFrame* container = new TGGroupFrame(fGeoFrame, "Object position:");
208 fGeoFrame->AddFrame(container, new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 8, 8, 3, 3));//-
210
212
213 hf = new TGHorizontalFrame(container);
214 label = new TGLabel(hf, "X:");
215 hf->AddFrame(label, new TGLayoutHints(fLl));
216 fGeomData[kCenterX] = new TGNumberEntry(hf, 0.0, 8, kNExc);
218 fGeomData[kCenterX]->Connect("ValueSet(Long_t)", "TGLPShapeObjEditor",
219 this, "GeoValueSet(Long_t)");
220 container->AddFrame(hf, new TGLayoutHints(lh));
221
222 hf = new TGHorizontalFrame(container);
223 label = new TGLabel(hf, "Y:");
224 hf->AddFrame(label, new TGLayoutHints(fLl));
225 fGeomData[kCenterY] = new TGNumberEntry(hf, 0.0, 8, kNEyc);
227 fGeomData[kCenterY]->Connect("ValueSet(Long_t)", "TGLPShapeObjEditor",
228 this, "GeoValueSet(Long_t)");
229 container->AddFrame(hf, new TGLayoutHints(lh));
230
231 hf = new TGHorizontalFrame(container);
232 hf->AddFrame(new TGLabel(hf, "Z:"), new TGLayoutHints(fLl));
233 fGeomData[kCenterZ] = new TGNumberEntry(hf, 1.0, 8, kNEzc);
235 fGeomData[kCenterZ]->Connect("ValueSet(Long_t)", "TGLPShapeObjEditor",
236 this, "GeoValueSet(Long_t)");
237 container->AddFrame(hf, new TGLayoutHints(lh));
238
239 // Scale container
240 TGGroupFrame* osf = new TGGroupFrame(fGeoFrame, "Object scale:", kLHintsTop | kLHintsCenterX);
242 fGeoFrame->AddFrame(osf, new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 8, 8, 3, 3));
243
244 hf = new TGHorizontalFrame(osf);
245 hf->AddFrame(new TGLabel(hf, "X:"),new TGLayoutHints(fLl));
246 fGeomData[kScaleX] = new TGNumberEntry(hf, 1.0, 5, kNExs);
248 fGeomData[kScaleX]->Connect("ValueSet(Long_t)", "TGLPShapeObjEditor",
249 this, "GeoValueSet(Long_t)");
250 osf->AddFrame(hf, new TGLayoutHints(lh));
251
252 hf = new TGHorizontalFrame(osf);
253 hf->AddFrame(new TGLabel(hf, "Y:"),new TGLayoutHints(fLl));
254 fGeomData[kScaleY] = new TGNumberEntry(hf, 1.0, 5, kNEys);
256 fGeomData[kScaleY]->Connect("ValueSet(Long_t)", "TGLPShapeObjEditor",
257 this, "GeoValueSet(Long_t)");
258 osf->AddFrame(hf, new TGLayoutHints(lh));
259
260 hf = new TGHorizontalFrame(osf);
261 hf->AddFrame(new TGLabel(hf, "Z:"),new TGLayoutHints(fLl));
262 fGeomData[kScaleZ] = new TGNumberEntry(hf, 1.0, 5, kNEzs);
264 fGeomData[kScaleZ]->Connect("ValueSet(Long_t)", "TGLPShapeObjEditor",
265 this, "GeoValueSet(Long_t)");
266 osf->AddFrame(hf, new TGLayoutHints(lh));
267
268 hf = new TGHorizontalFrame(osf);
272 osf->AddFrame(hf, new TGLayoutHints(lh));
273
274 // Modify button
275 fGeoApplyButton = new TGTextButton(fGeoFrame, "Modify object");
278 fGeoApplyButton->Connect("Pressed()", "TGLPShapeObjEditor", this, "DoGeoButton()");
279}
280
281////////////////////////////////////////////////////////////////////////////////
282/// Set color sliders from 17 component 'rgba'.
283
285{
288
289 for (Int_t i = 0; i < 17; ++i) fRGBA[i] = rgba[i];
290
291 fRedSlider->SetPosition(Int_t(fRGBA[fLMode * 4] * 100));
292 fGreenSlider->SetPosition(Int_t(fRGBA[fLMode * 4 + 1] * 100));
293 fBlueSlider->SetPosition(Int_t(fRGBA[fLMode * 4 + 2] * 100));
294 fShineSlider->SetPosition(Int_t(fRGBA[16]));
295
296 DrawSphere();
297}
298
299////////////////////////////////////////////////////////////////////////////////
300/// Process slider movement.
301
303{
304 TGSlider *frm = (TGSlider *)gTQSender;
305
306 if (frm) {
307 Int_t wid = frm->WidgetId();
308
309 switch (wid) {
310 case kHSr:
311 fRGBA[fLMode * 4] = val / 100.f;
312 break;
313 case kHSg:
314 fRGBA[fLMode * 4 + 1] = val / 100.f;
315 break;
316 case kHSb:
317 fRGBA[fLMode * 4 + 2] = val / 100.f;
318 break;
319 case kHSa:
320 fRGBA[fLMode * 4 + 3] = val / 100.f;
321 break;
322 case kHSs:
323 fRGBA[16] = val;
324 break;
325 }
326
327 fColorApplyButton->SetState(kButtonUp);
328 fColorApplyFamily->SetState(kButtonUp);
329 DrawSphere();
330 }
331}
332
333////////////////////////////////////////////////////////////////////////////////
334/// Process button action.
335
337{
338 TGButton *btn = (TGButton *) gTQSender;
339 Int_t id = btn->WidgetId();
340
341 switch (id) {
342 case kCPd:
343 fLightTypes[fLMode]->SetState(kButtonUp);
346 break;
347 case kCPa:
348 fLightTypes[fLMode]->SetState(kButtonUp);
351 break;
352 case kCPs:
353 fLightTypes[fLMode]->SetState(kButtonUp);
356 break;
357 case kCPe:
358 fLightTypes[fLMode]->SetState(kButtonUp);
361 break;
362 case kTBa:
365 if (fPShape) {
366 fPShape->SetColor(GetRGBA());
367 }
368 fPShapeObj->fViewer->RequestDraw();
369 break;
370 case kTBaf:
373 if (fPShape) {
374 fPShape->SetColorOnFamily(GetRGBA());
375 }
376 fPShapeObj->fViewer->RequestDraw();
377 break;
378 }
379}
380
381////////////////////////////////////////////////////////////////////////////////
382/// Create Diffuse/Ambient/Specular/Emissive radio buttons and sub-frames.
383
385{
386 TGGroupFrame *partFrame = new TGGroupFrame(fColorFrame, "Color components:", kLHintsTop | kLHintsCenterX);
387 fColorFrame->AddFrame(partFrame, new TGLayoutHints(kLHintsTop | kLHintsCenterX, 2, 0, 2, 2));
388
390 TGMatrixLayout *ml = new TGMatrixLayout(partFrame, 0, 1, 10);
391 partFrame->SetLayoutManager(ml);
392
393 // partFrame will delete the layout manager ml for us so don't add to fTrash
394 fLightTypes[kDiffuse] = new TGRadioButton(partFrame, "Diffuse", kCPd);
395 fLightTypes[kDiffuse]->Connect("Pressed()", "TGLPShapeObjEditor", this, "DoColorButton()");
396 fLightTypes[kDiffuse]->SetToolTipText("Diffuse component of color");
397 partFrame->AddFrame(fLightTypes[kDiffuse]);
398
399 fLightTypes[kAmbient] = new TGRadioButton(partFrame, "Ambient", kCPa);
400 fLightTypes[kAmbient]->Connect("Pressed()", "TGLPShapeObjEditor", this, "DoColorButton()");
401 fLightTypes[kAmbient]->SetToolTipText("Ambient component of color");
402 partFrame->AddFrame(fLightTypes[kAmbient]);
403
404 fLightTypes[kSpecular] = new TGRadioButton(partFrame, "Specular", kCPs);
405 fLightTypes[kSpecular]->Connect("Pressed()", "TGLPShapeObjEditor", this, "DoColorButton()");
406 fLightTypes[kSpecular]->SetToolTipText("Specular component of color");
407 partFrame->AddFrame(fLightTypes[kSpecular]);
408
409 fLightTypes[kEmission] = new TGRadioButton(partFrame, "Emissive", kCPe);
410 fLightTypes[kEmission]->Connect("Pressed()", "TGLPShapeObjEditor", this, "DoColorButton()");
411 fLightTypes[kEmission]->SetToolTipText("Emissive component of color");
412 partFrame->AddFrame(fLightTypes[kEmission]);
413
415 fLightTypes[fLMode]->SetState(kButtonDown);
416}
417
418////////////////////////////////////////////////////////////////////////////////
419/// Create GUI for setting light color.
420
422{
423 UInt_t sw = 120; //fColorFrame->GetDefalutWidth();,
424
425 // Create Red/Green/BlueAlpha/Shine sliders
426 fColorFrame->AddFrame(new TGLabel(fColorFrame, "Red :"), new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 0, 0, 0));
428 fRedSlider->Connect("PositionChanged(Int_t)", "TGLPShapeObjEditor", this, "DoColorSlider(Int_t)");
429 fRedSlider->SetRange(0, 100);
430 fRedSlider->SetPosition(Int_t(fRGBA[0] * 100));
431 fColorFrame->AddFrame(fRedSlider, new TGLayoutHints(fLs));
432
433
434 fColorFrame->AddFrame(new TGLabel(fColorFrame, "Green :"), new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 0, 0, 0));
436 fGreenSlider->Connect("PositionChanged(Int_t)", "TGLPShapeObjEditor", this, "DoColorSlider(Int_t)");
437 fGreenSlider->SetRange(0, 100);
438 fGreenSlider->SetPosition(Int_t(fRGBA[1] * 100));
439 fColorFrame->AddFrame(fGreenSlider, new TGLayoutHints(fLs));
440
441
442 fColorFrame->AddFrame(new TGLabel(fColorFrame, "Blue :"), new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 0, 0, 0));
444 fBlueSlider->Connect("PositionChanged(Int_t)", "TGLPShapeObjEditor", this, "DoColorSlider(Int_t)");
445 fBlueSlider->SetRange(0, 100);
446 fBlueSlider->SetPosition(Int_t(fRGBA[2] * 100));
447 fColorFrame->AddFrame(fBlueSlider, new TGLayoutHints(fLs));
448
449 fColorFrame->AddFrame(new TGLabel(fColorFrame, "Shine :"), new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 0, 0, 0));
451 fShineSlider->Connect("PositionChanged(Int_t)", "TGLPShapeObjEditor", this, "DoColorSlider(Int_t)");
452 fShineSlider->SetRange(0, 128);
453 fColorFrame->AddFrame(fShineSlider, new TGLayoutHints(fLs));
454}
455
456////////////////////////////////////////////////////////////////////////////////
457/// Update GUI sliders from internal data.
458
460{
461 fRedSlider->SetPosition(Int_t(fRGBA[fLMode * 4] * 100));
462 fGreenSlider->SetPosition(Int_t(fRGBA[fLMode * 4 + 1] * 100));
463 fBlueSlider->SetPosition(Int_t(fRGBA[fLMode * 4 + 2] * 100));
464 // fAlphaSlider->SetPosition(Int_t(fRGBA[fLMode * 4 + 3] * 100));
465
466 if (fRGBA[16] >= 0.f)
467 fShineSlider->SetPosition(Int_t(fRGBA[16]));
468}
469
470////////////////////////////////////////////////////////////////////////////////
471/// Redraw widget. Render sphere and pass to base-class.
472
478
479////////////////////////////////////////////////////////////////////////////////
480
481namespace {
482 GLUquadric *GetQuadric()
483 {
484 // GLU quadric.
485
486 static struct Init {
487 Init()
488 {
489 fQuad = gluNewQuadric();
490 if (!fQuad) {
491 Error("GetQuadric::Init", "could not create quadric object");
492 } else {
493 gluQuadricOrientation(fQuad, (GLenum)GLU_OUTSIDE);
494 gluQuadricDrawStyle(fQuad, (GLenum)GLU_FILL);
495 gluQuadricNormals(fQuad, (GLenum)GLU_FLAT);
496 }
497 }
498 ~Init()
499 {
500 if(fQuad)
501 gluDeleteQuadric(fQuad);
502 }
503 GLUquadric *fQuad;
504 }singleton;
505
506 return singleton.fQuad;
507 }
508
509}
510
511////////////////////////////////////////////////////////////////////////////////
512/// Draw local sphere reflecting current color options.
513
515{
516 if (!gVirtualX->IsCmdThread()) {
517 gROOT->ProcessLineFast(Form("((TGLPShapeObjEditor *)0x%zx)->DrawSphere()", (size_t)this));
518 return;
519 }
520
522
523 fMatView->MakeCurrent();
524 glViewport(0, 0, fMatView->GetWidth(), fMatView->GetHeight());
525 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
526
527 glEnable(GL_LIGHTING);
528 glEnable(GL_LIGHT0);
529 glEnable(GL_DEPTH_TEST);
530 glEnable(GL_CULL_FACE);
531 glCullFace(GL_BACK);
532 glMatrixMode(GL_PROJECTION);
533 glLoadIdentity();
534 glFrustum(-0.5, 0.5, -0.5, 0.5, 1., 10.);
535 glMatrixMode(GL_MODELVIEW);
536 glLoadIdentity();
537 Float_t ligPos[] = {0.f, 0.f, 0.f, 1.f};
538 glLightfv(GL_LIGHT0, GL_POSITION, ligPos);
539 glTranslated(0., 0., -3.);
540
541 const Float_t whiteColor[] = {1.f, 1.f, 1.f, 1.f};
542 const Float_t nullColor[] = {0.f, 0.f, 0.f, 1.f};
543
544 if (fRGBA[16] < 0.f) {
545 glLightfv(GL_LIGHT0, GL_DIFFUSE, fRGBA);
546 glLightfv(GL_LIGHT0, GL_AMBIENT, fRGBA + 4);
547 glLightfv(GL_LIGHT0, GL_SPECULAR, fRGBA + 8);
548 glMaterialfv(GL_FRONT, GL_DIFFUSE, whiteColor);
549 glMaterialfv(GL_FRONT, GL_AMBIENT, nullColor);
550 glMaterialfv(GL_FRONT, GL_SPECULAR, whiteColor);
551 glMaterialfv(GL_FRONT, GL_EMISSION, nullColor);
552 glMaterialf(GL_FRONT, GL_SHININESS, 60.f);
553 } else {
554 glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteColor);
555 glLightfv(GL_LIGHT0, GL_AMBIENT, nullColor);
556 glLightfv(GL_LIGHT0, GL_SPECULAR, whiteColor);
557 glMaterialfv(GL_FRONT, GL_DIFFUSE, fRGBA);
558 glMaterialfv(GL_FRONT, GL_AMBIENT, fRGBA + 4);
559 glMaterialfv(GL_FRONT, GL_SPECULAR, fRGBA + 8);
560 glMaterialfv(GL_FRONT, GL_EMISSION, fRGBA + 12);
561 glMaterialf(GL_FRONT, GL_SHININESS, fRGBA[16]);
562 }
563
564 glEnable(GL_BLEND);
565 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
566 GLUquadric * quad = GetQuadric();
567 if (quad) {
568 glRotated(-90., 1., 0., 0.);
569 gluSphere(quad, 1., 100, 100);
570 }
571 glDisable(GL_BLEND);
572
573 fMatView->SwapBuffers();
574}
575
576////////////////////////////////////////////////////////////////////////////////
577/// Create widgets to chose colors component and its RGBA values on fGedEditor
578/// model or family it belongs to.
579
581{
582 fColorFrame = this;
583
584 fMatView = TGLWidget::Create(fColorFrame, kFALSE, kTRUE, nullptr, 120, 120);
585 fColorFrame->AddFrame(fMatView, new TGLayoutHints(kLHintsTop | kLHintsCenterX, 2, 0, 2, 2));
586
588
590
591 //apply button creation
595 fColorApplyButton->Connect("Pressed()", "TGLPShapeObjEditor", this, "DoColorButton()");
596 //apply to family button creation
597 fColorApplyFamily = new TGTextButton(fColorFrame, "Apply to family", kTBaf);
600 fColorApplyFamily->Connect("Pressed()", "TGLPShapeObjEditor", this, "DoColorButton()");
601}
@ kButton1Down
Definition Buttons.h:17
#define GLU_OUTSIDE
Definition GL_glu.h:203
#define GLU_FLAT
Definition GL_glu.h:199
unsigned int GLenum
Definition GL_glu.h:266
#define GLU_FILL
Definition GL_glu.h:191
@ kVerticalFrame
Definition GuiTypes.h:381
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
#define c(i)
Definition RSha256.hxx:101
int Int_t
Definition RtypesCore.h:45
long Long_t
Definition RtypesCore.h:54
unsigned int UInt_t
Definition RtypesCore.h:46
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
double Double_t
Definition RtypesCore.h:59
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassImp(name)
Definition Rtypes.h:377
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:185
@ kButtonDown
Definition TGButton.h:54
@ kButtonDisabled
Definition TGButton.h:56
@ kButtonUp
Definition TGButton.h:53
@ kTBEndOfList
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsCenterX
Definition TGLayout.h:25
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
@ kScaleBoth
Definition TGSlider.h:36
@ kSlider1
Definition TGSlider.h:30
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize wid
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Int_t i
R__EXTERN void * gTQSender
Definition TQObject.h:46
#define gROOT
Definition TROOT.h:414
externTVirtualMutex * gROOTMutex
Definition TROOT.h:63
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2489
#define R__LOCKGUARD(mutex)
#define gVirtualX
Definition TVirtualX.h:337
A button abstract base class.
Definition TGButton.h:68
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
Definition TGFrame.cxx:1000
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
void DoRedraw() override
Redraw the frame.
Definition TGFrame.cxx:430
A composite frame with a border and a title.
Definition TGFrame.h:522
virtual void SetTitlePos(ETitlePos pos=kLeft)
Definition TGFrame.h:564
Concrete class for horizontal slider.
Definition TGSlider.h:119
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:385
GUI editor for TGLPShapeObj.
void SetColorSlidersPos()
Update GUI sliders from internal data.
void PShapeModified() override
Shape has been modified.
void CreateColorSliders()
Create GUI for setting light color.
TGCompositeFrame * fColorFrame
TGButton * fLightTypes[4]
void CreateGeoControls()
Create GUI for setting scale and position.
TGNumberEntry * fGeomData[6]
void GeoValueSet(Long_t unusedVal)
Process setting of value in edit box - activate 'Apply' button.
void SetModel(TObject *obj) override
Sets model or disables/hides viewer.
void SetScale(const Double_t *scale)
Set internal scale data from 3 component 'c'.
void DoRedraw() override
Redraw widget. Render sphere and pass to base-class.
TGLPShapeObj * fPShapeObj
TGLPShapeObjEditor(const TGWindow *p=nullptr, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor of TGLPhysicalShape editor GUI.
void DoColorButton()
Process button action.
~TGLPShapeObjEditor() override
Destroy color editor GUI component.
void DrawSphere() const
Draw local sphere reflecting current color options.
void CreateColorControls()
Create widgets to chose colors component and its RGBA values on fGedEditor model or family it belongs...
TGCompositeFrame * fGeoFrame
const Float_t * GetRGBA() const
void SetRGBA(const Float_t *rgba)
Set color sliders from 17 component 'rgba'.
void SetPShape(TGLPhysicalShape *shape) override
Shape has changed.
void CreateColorRadioButtons()
Create Diffuse/Ambient/Specular/Emissive radio buttons and sub-frames.
void SetCenter(const Double_t *center)
Set internal center data from 3 component 'c'.
void DoGeoButton()
Process 'Apply' - update the viewer object from GUI.
void GetObjectData(Double_t *shift, Double_t *scale)
Extract the GUI object data, return center in 3 component 'center' scale in 3 component 'scale'.
void DoColorSlider(Int_t val)
Process slider movement.
Wrap TGLPysicalShape into TObject so that it can be edited using GED.
virtual void SetPShape(TGLPhysicalShape *shape)
Set the shape.
TGLPhysicalShape * fPShape
friend class TGLPhysicalShape
3 component (x/y/z) vector class.
Definition TGLUtil.h:248
3 component (x/y/z) vertex class.
Definition TGLUtil.h:84
Double_t * Arr()
Definition TGLUtil.h:127
static TGLWidget * Create(const TGWindow *parent, Bool_t selectInput, Bool_t shareDefault, const TGLPaintDevice *shareDevice, UInt_t width, UInt_t height)
Static constructor for creating widget with default pixel format.
Definition TGLWidget.cxx:83
This class handles GUI labels.
Definition TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
This layout managers does not make use of TGLayoutHints.
Definition TGLayout.h:269
TGNumberEntry is a number entry input widget with up/down buttons.
@ kNELLimitMin
Lower limit only.
Selects different options.
Definition TGButton.h:321
Slider widgets allow easy selection of a range.
Definition TGSlider.h:40
Yield an action as soon as it is clicked.
Definition TGButton.h:142
Int_t WidgetId() const
Definition TGWidget.h:68
ROOT GUI Window base class.
Definition TGWindow.h:23
TGedEditor * fGedEditor
manager of this frame
Definition TGedFrame.h:48
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by 'owner' in extra tab 'name'.
TGedFrame(const TGedFrame &)=delete
Mother of all ROOT objects.
Definition TObject.h:41