Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGLSAViewer.cxx
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Timur Pocheptsov / Richard Maunder
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, 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#include <memory>
13
14#include "TRootHelpDialog.h"
15#include "TPluginManager.h"
16#include "TApplication.h"
17#include "TGClient.h"
18#include "TGCanvas.h"
19#include "HelpText.h"
20#include "GuiTypes.h"
21#include "TG3DLine.h"
22#include "TSystem.h"
23#include "TGFrame.h"
24#include "TGMenu.h"
25#include "TGSplitter.h"
26#include "TGButton.h"
27#include "snprintf.h"
28
29#include "TVirtualPad.h"
30#include "TGedEditor.h"
31#include "TRootEmbeddedCanvas.h"
32#include "TString.h"
33#include "TGFileDialog.h"
34#include "TVirtualX.h"
35
36#include "TGLOutput.h"
37#include "TGLFormat.h"
38
39#include "TGLLogicalShape.h"
40#include "TGLPhysicalShape.h"
41#include "TGLPShapeObj.h"
42#include "TGLClip.h"
43#include "TROOT.h"
44
45#ifdef WIN32
46#include "TWin32SplashThread.h"
47#endif
48
49#include "TGLWidget.h"
50#include "TGLSAViewer.h"
51#include "TGLSAFrame.h"
52#include "TGLEventHandler.h"
53
54
55const char * TGLSAViewer::fgHelpText1 = "\
56DIRECT SCENE INTERACTIONS\n\n\
57 Press:\n\
58 \tw --- wireframe mode\n\
59 \te --- switch between dark / light color-set\n\
60 \tr --- filled polygons mode\n\
61 \tt --- outline mode\n\
62 \tj --- ZOOM in\n\
63 \tk --- ZOOM out\n\
64 \ta --- switch on/off arc-ball camera rotation control\n\
65 \tArrow Keys --- PAN (TRUCK) across scene\n\
66 \tHome --- reset current camera\n\
67 \tCtrl-Home --- switch external/automatic camera center\n\
68\n\
69 LEFT mouse button -- ROTATE (ORBIT) the scene by holding the mouse button and moving\n\
70 the mouse (perspective camera, needs to be enabled in menu for orthographic cameras).\n\
71 By default, the scene will be rotated about its center. To select arbitrary center\n\
72 bring up the viewer-editor (e.g., shift-click into empty background) and use\n\
73 'Camera center' controls in the 'Guides' tab.\n\
74\n\
75 MIDDLE mouse button or arrow keys -- PAN (TRUCK) the camera.\n\
76\n\
77 RIGHT mouse button action depends on camera type:\n\
78 orthographic -- zoom,\n\
79 perspective -- move camera forwards / backwards\n\
80\n\
81 By pressing Ctrl and Shift keys the mouse precision can be changed:\n\
82 Shift -- 10 times less precise\n\
83 Ctrl -- 10 times more precise\n\
84 Ctrl Shift -- 100 times more precise\n\
85\n\
86 Mouse wheel action depends on camera type:\n\
87 orthographic -- zoom,\n\
88 perspective -- change field-of-view (focal length)\n\
89\n\
90 To invert direction of mouse and key actions from scene-centric\n\
91 to viewer-centric, set in your .rootrc file:\n\
92 OpenGL.EventHandler.ViewerCentricControls: 1\n\
93\n\
94 Double click will show GUI editor of the viewer (if assigned).\n\
95\n\
96 RESET the camera via the button in viewer-editor or Home key.\n\
97\n\
98 SELECT a shape with Shift+Left mouse button click.\n\
99\n\
100 SELECT the viewer with Shift+Left mouse button click on a free space.\n\
101\n\
102 MOVE a selected shape using Shift+Mid mouse drag.\n\
103\n\
104 Invoke the CONTEXT menu with Shift+Right mouse click.\n\n"
105 "Secondary selection and direct render object interaction is initiated\n\
106 by Alt+Left mouse click (Mod1, actually). Only few classes support this option.\n\
107 When 'Alt' is taken by window manager, try Alt-Ctrl-Left.\n\
108\n\
109CAMERA\n\
110\n\
111 The \"Camera\" menu is used to select the different projections from \n\
112 the 3D world onto the 2D viewport. There are three perspective cameras:\n\
113\n\
114 \tPerspective (Floor XOZ)\n\
115 \tPerspective (Floor YOZ)\n\
116 \tPerspective (Floor XOY)\n\
117\n\
118 In each case the floor plane (defined by two axes) is kept level.\n\
119\n\
120 There are also four orthographic cameras:\n\
121\n\
122 \tOrthographic (XOY)\n\
123 \tOrthographic (XOZ)\n\
124 \tOrthographic (ZOY)\n\
125 \tOrthographic (ZOX)\n\
126\n\
127 In each case the first axis is placed horizontal, the second vertical e.g.\n\
128 XOY means X horizontal, Y vertical.\n\n";
129
130const char * TGLSAViewer::fgHelpText2 = "\
131SHAPES COLOR AND MATERIAL\n\
132\n\
133 The selected shape's color can be modified in the Shapes-Color tabs.\n\
134 Shape's color is specified by the percentage of red, green, blue light\n\
135 it reflects. A surface can reflect DIFFUSE, AMBIENT and SPECULAR light.\n\
136 A surface can also emit light. The EMISSIVE parameter allows to define it.\n\
137 The surface SHININESS can also be modified.\n\
138\n\
139SHAPES GEOMETRY\n\
140\n\
141 The selected shape's location and geometry can be modified in the Shapes-Geom\n\
142 tabs by entering desired values in respective number entry controls.\n\
143\n\
144SCENE CLIPPING\n\
145\n\
146 In the Scene-Clipping tabs select a 'Clip Type': None, Plane, Box\n\
147\n\
148 For 'Plane' and 'Box' the lower pane shows the relevant parameters:\n\
149\n\
150\tPlane: Equation coefficients of form aX + bY + cZ + d = 0\n\
151\tBox: Center X/Y/Z and Length X/Y/Z\n\n"
152 "For Box checking the 'Show / Edit' checkbox shows the clip box (in light blue)\n\
153 in viewer. It also attaches the current manipulator to the box - enabling\n\
154 direct editing in viewer.\n\
155\n\
156MANIPULATORS\n\
157\n\
158 A widget attached to the selected object - allowing direct manipulation\n\
159 of the object with respect to its local axes.\n\
160\n\
161 There are three modes, toggled with keys while manipulator is active, that is,\n\
162 mouse pointer is above it (switches color to yellow):\n\
163 \tMode\t\tWidget Component Style\t\tKey\n\
164 \t----\t\t----------------------\t\t---\n\
165 \tTranslation\tLocal axes with arrows\t\tv\n\
166 \tScale\t\tLocal axes with boxes\t\tx\n\
167 \tRotate\t\tLocal axes rings\t\tc\n\
168\n\
169 Each widget has three axis components - red (X), green (Y) and blue (Z).\n\
170 The component turns yellow, indicating an active state, when the mouse is moved\n\
171 over it. Left click and drag on the active component to adjust the objects\n\
172 translation, scale or rotation.\n\
173 Some objects do not support all manipulations (e.g. clipping planes cannot be \n\
174 scaled). If a manipulation is not permitted the component it drawn in grey and \n\
175 cannot be selected/dragged.\n";
176
177
178/** \class TGLSAViewer
179\ingroup opengl
180The top level standalone GL-viewer - created via plugin manager.
181*/
182
183
185
188const Int_t TGLSAViewer::fgInitW = 780;
189const Int_t TGLSAViewer::fgInitH = 670;
190
191// A lot of raw pointers/naked new-expressions - good way to discredit C++ (or C++ programmer
192// ROOT has system to cleanup - I'll try to use it
193
194const char *gGLSaveAsTypes[] = {"Encapsulated PostScript", "*.eps",
195 "PDF", "*.pdf",
196 "GIF", "*.gif",
197 "Animated GIF", "*.gif+",
198 "JPEG", "*.jpg",
199 "PNG", "*.png",
200 nullptr, nullptr};
201
202////////////////////////////////////////////////////////////////////////////////
203/// Construct a standalone viewer, bound to supplied 'pad'.
204
206 TGLViewer(pad, fgInitX, fgInitY, fgInitW, fgInitH),
207 fFrame(nullptr),
208 fFormat(format),
209 fFileMenu(nullptr),
210 fFileSaveMenu(nullptr),
211 fCameraMenu(nullptr),
212 fHelpMenu(nullptr),
213 fLeftVerticalFrame(nullptr),
214 fRightVerticalFrame(nullptr),
215 fDirName("."),
216 fTypeIdx(0),
217 fOverwrite(kFALSE),
218 fMenuBar(nullptr),
219 fMenuBut(nullptr),
220 fHideMenuBar(kFALSE),
221 fMenuHidingTimer(nullptr),
222 fMenuHidingShowMenu(kTRUE),
223 fDeleteMenuBar(kFALSE)
224{
225 fFrame = new TGLSAFrame(*this);
226
227 CreateMenus();
228 CreateFrames();
229
230 fFrame->SetWindowName("ROOT's GL viewer");
231 fFrame->SetClassHints("GLViewer", "GLViewer");
235
239
240 // set recursive cleanup, but exclude fGedEditor
241 // destructor of fGedEditor has own way of handling child nodes
242 TObject* fe = fLeftVerticalFrame->GetList()->First();
243 fLeftVerticalFrame->GetList()->Remove(fe);
245 fLeftVerticalFrame->GetList()->AddFirst(fe);
246
247 Show();
248}
249
250////////////////////////////////////////////////////////////////////////////////
251/// Construct an embedded standalone viewer, bound to supplied 'pad'.
252/// If format is passed, it gets adopted by the viewer as it might
253/// need to be reused several times when recreating the GL-widget.
254///
255/// Modified version of the previous constructor for embedding the
256/// viewer into another frame (parent).
257
259 TGLFormat* format) :
260 TGLViewer(pad, fgInitX, fgInitY, fgInitW, fgInitH),
261 fFrame(nullptr),
262 fFormat(format),
263 fFileMenu(nullptr),
264 fCameraMenu(nullptr),
265 fHelpMenu(nullptr),
266 fLeftVerticalFrame(nullptr),
267 fRightVerticalFrame(nullptr),
268 fTypeIdx(0),
269 fMenuBar(nullptr),
270 fMenuBut(nullptr),
271 fHideMenuBar(kFALSE),
272 fMenuHidingTimer(nullptr),
273 fMenuHidingShowMenu(kTRUE),
274 fDeleteMenuBar(kFALSE)
275{
276 fGedEditor = ged;
277 fFrame = new TGLSAFrame(parent, *this);
278
279 CreateMenus();
280 CreateFrames();
281
286
287 // set recursive cleanup, but exclude fGedEditor
288 // destructor of fGedEditor has own way of handling child nodes
290 {
291 TObject* fe = fLeftVerticalFrame->GetList()->First();
292 fLeftVerticalFrame->GetList()->Remove(fe);
294 fLeftVerticalFrame->GetList()->AddFirst(fe);
295 }
296
297 Show();
298}
299
300////////////////////////////////////////////////////////////////////////////////
301/// Destroy standalone viewer object.
302
304{
306
308
309 delete fHelpMenu;
310 delete fCameraMenu;
311 delete fFileSaveMenu;
312 delete fFileMenu;
313 if(fDeleteMenuBar) {
314 delete fMenuBar;
315 }
316 delete fFormat;
317 delete fFrame;
318 fGLWidget = nullptr;
319}
320
321////////////////////////////////////////////////////////////////////////////////
322/// Return the main-frame.
323
325{
326 return fFrame;
327}
328
329////////////////////////////////////////////////////////////////////////////////
330/// Create a GLwidget, it is an error if it is already created.
331/// This is needed for frame-swapping on mac.
332
334{
335 if (fGLWidget) {
336 Error("CreateGLWidget", "Widget already exists.");
337 return;
338 }
339
340 if (fFormat == nullptr)
341 fFormat = new TGLFormat;
342
345
347 fFrame->Layout();
348
350}
351
352////////////////////////////////////////////////////////////////////////////////
353/// Destroy the GLwidget, it is an error if it does not exist.
354/// This is needed for frame-swapping on mac.
355
357{
358 if (fGLWidget == nullptr) {
359 Error("DestroyGLWidget", "Widget does not exist.");
360 return;
361 }
362
364 fGLWidget->SetEventHandler(nullptr);
365
368 fGLWidget = nullptr;
369}
370
371////////////////////////////////////////////////////////////////////////////////
372///File/Camera/Help menus.
373
375{
377 fFileMenu->AddEntry("&Hide Menus", kGLHideMenus);
378 fFileMenu->AddEntry("&Edit Object", kGLEditObject);
380 fFileMenu->AddEntry("&Close Viewer", kGLCloseViewer);
383 fFileSaveMenu->AddEntry("viewer.&eps", kGLSaveEPS);
384 fFileSaveMenu->AddEntry("viewer.&pdf", kGLSavePDF);
385 fFileSaveMenu->AddEntry("viewer.&gif", kGLSaveGIF);
386 fFileSaveMenu->AddEntry("viewer.g&if+", kGLSaveAnimGIF);
387 fFileSaveMenu->AddEntry("viewer.&jpg", kGLSaveJPG);
388 fFileSaveMenu->AddEntry("viewer.p&ng", kGLSavePNG);
390 fFileMenu->AddEntry("Save &As...", kGLSaveAS);
392 fFileMenu->AddEntry("&Quit ROOT", kGLQuitROOT);
394
396 fCameraMenu->AddEntry("Perspective (Floor XOZ)", kGLPerspXOZ);
397 fCameraMenu->AddEntry("Perspective (Floor YOZ)", kGLPerspYOZ);
398 fCameraMenu->AddEntry("Perspective (Floor XOY)", kGLPerspXOY);
399 fCameraMenu->AddEntry("Orthographic (XOY)", kGLXOY);
400 fCameraMenu->AddEntry("Orthographic (XOZ)", kGLXOZ);
401 fCameraMenu->AddEntry("Orthographic (ZOY)", kGLZOY);
402 fCameraMenu->AddEntry("Orthographic (ZOX)", kGLZOX);
403 fCameraMenu->AddEntry("Orthographic (XnOY)", kGLXnOY);
404 fCameraMenu->AddEntry("Orthographic (XnOZ)", kGLXnOZ);
405 fCameraMenu->AddEntry("Orthographic (ZnOY)", kGLZnOY);
406 fCameraMenu->AddEntry("Orthographic (ZnOX)", kGLZnOX);
408 fCameraMenu->AddEntry("Ortho allow rotate", kGLOrthoRotate);
409 fCameraMenu->AddEntry("Ortho allow dolly", kGLOrthoDolly);
411
413 fHelpMenu->AddEntry("Help on GL Viewer...", kGLHelpViewer);
415 fHelpMenu->AddEntry("&About ROOT...", kGLHelpAbout);
417
418 // Create menubar
420 fMenuBar->AddPopup("&File", fFileMenu, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
421 fMenuBar->AddPopup("&Camera", fCameraMenu, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
424 gVirtualX->SelectInput(fMenuBar->GetId(),
428
429 fMenuBut = new TGButton(fFrame);
431 fMenuBut->Resize(20, 4);
432 fMenuBut->SetBackgroundColor(0x80A0C0);
434}
435
436////////////////////////////////////////////////////////////////////////////////
437/// Internal frames creation.
438
440{
442 if (fGedEditor == nullptr)
443 {
446
449
450 const TGWindow* cw = fFrame->GetClient()->GetRoot();
452
453 fGedEditor = new TGedEditor();
459
463 }
464
465 // SunkenFrame introduces 1-pixel offset - in TGFrame.cxx:163
466 //
467 // TGVerticalFrame *rightVerticalFrame = new TGVerticalFrame(compositeFrame, 10, 10, kSunkenFrame);
468 // compositeFrame->AddFrame(rightVerticalFrame, new TGLayoutHints(kLHintsRight | kLHintsExpandX | kLHintsExpandY,0,2,2,2));
471
472 fEventHandler = new TGLEventHandler(nullptr, this);
474}
475
476////////////////////////////////////////////////////////////////////////////////
477/// Update GUI components for embedded viewer selection change.
478/// Override from TGLViewer.
479
481{
482 TGLPhysicalShape *selected = const_cast<TGLPhysicalShape*>(GetSelected());
483
484 if (selected) {
485 fPShapeWrap->fPShape = selected;
487 fGedEditor->SetModel(fPad, selected->GetLogical()->GetExternal(), kButton1Down);
488 else
490 } else {
491 fPShapeWrap->fPShape = nullptr;
493 }
494}
495
496////////////////////////////////////////////////////////////////////////////////
497/// Show the viewer
498
500{
501 fFrame->MapRaised();
503 RequestDraw();
504}
505
506////////////////////////////////////////////////////////////////////////////////
507/// Close the viewer - destructed.
508
510{
511 // Commit suicide when contained GUI is closed.
512 delete this;
513}
514
515////////////////////////////////////////////////////////////////////////////////
516/// Delete the menu bar.
517
522
523////////////////////////////////////////////////////////////////////////////////
524/// Deactivate menu entries for closing the GL window and exiting ROOT.
525
531
532////////////////////////////////////////////////////////////////////////////////
533/// Enable hiding of menu bar.
534
536{
537 if (fHideMenuBar)
538 return;
539
541
542 fMenuBar->Connect("ProcessedEvent(Event_t*)", "TGLSAViewer", this, "HandleMenuBarHiding(Event_t*)");
543 fMenuBut->Connect("ProcessedEvent(Event_t*)", "TGLSAViewer", this, "HandleMenuBarHiding(Event_t*)");
544
547 fFrame->Layout();
548
550 fMenuHidingTimer->Connect("Timeout()", "TGLSAViewer", this, "MenuHidingTimeout()");
551
553}
554
555////////////////////////////////////////////////////////////////////////////////
556/// Disable hiding of menu bar.
557
559{
560 if (!fHideMenuBar)
561 return;
562
564
565 fMenuBar->Disconnect("ProcessedEvent(Event_t*)", this, "HandleMenuBarHiding(Event_t*)");
566 fMenuBut->Disconnect("ProcessedEvent(Event_t*)", this, "HandleMenuBarHiding(Event_t*)");
567
570 fFrame->Layout();
571
573 delete fMenuHidingTimer;
574 fMenuHidingTimer = nullptr;
575
577}
578
579////////////////////////////////////////////////////////////////////////////////
580/// Maybe switch menu-bar / menu-button.
581
583{
585
586 if (f == fMenuBut)
587 {
588 if (ev->fType == kEnterNotify)
590 else
592 }
593 else if (f == fMenuBar)
594 {
595 if (ev->fType == kLeaveNotify &&
596 (ev->fX < 0 || ev->fX >= (Int_t) f->GetWidth() ||
597 ev->fY < 0 || ev->fY >= (Int_t) f->GetHeight()))
598 {
599 if (fMenuBar->GetCurrent() == nullptr)
601 else
602 fMenuBar->GetCurrent()->Connect("ProcessedEvent(Event_t*)", "TGLSAViewer", this, "HandleMenuBarHiding(Event_t*)");
603 }
604 else
605 {
607 }
608 }
609 else
610 {
611 f->Disconnect("ProcessedEvent(Event_t*)", this);
613 }
614}
615
616////////////////////////////////////////////////////////////////////////////////
617/// Reset the timer for menu-bar hiding.
618
620{
621 // This happens, mysteriously.
622 if (fMenuHidingTimer == nullptr)
623 return;
624
626
628
632}
633
634////////////////////////////////////////////////////////////////////////////////
635/// Action for menu-hiding timeout.
636
649
650////////////////////////////////////////////////////////////////////////////////
651/// Set global timeout for menu-hiding in mili-seconds.
652/// Static function.
653
658
659////////////////////////////////////////////////////////////////////////////////
660/// Process GUI message capture by the main GUI frame (TGLSAFrame).
661
663{
664 switch (GET_MSG(msg)) {
665 case kC_COMMAND:
666 switch (GET_SUBMSG(msg)) {
667 case kCM_BUTTON:
668 case kCM_MENU:
669 switch (parm1) {
670 case kGLHelpAbout: {
671#ifdef WIN32
673#else
674 char str[32];
675 snprintf(str,32, "About ROOT %s...", gROOT->GetVersion());
676 TRootHelpDialog * hd = new TRootHelpDialog(fFrame, str, 600, 400);
677 hd->SetText(gHelpAbout);
678 hd->Popup();
679#endif
680 break;
681 }
682 case kGLHelpViewer: {
683 TRootHelpDialog * hd = new TRootHelpDialog(fFrame, "Help on GL Viewer...", 660, 400);
684 hd->AddText(fgHelpText1);
685 hd->AddText(fgHelpText2);
686 hd->Popup();
687 break;
688 }
689 case kGLPerspYOZ:
691 break;
692 case kGLPerspXOZ:
694 break;
695 case kGLPerspXOY:
697 break;
698 case kGLXOY:
700 break;
701 case kGLXOZ:
703 break;
704 case kGLZOY:
706 break;
707 case kGLZOX:
709 break;
710 case kGLXnOY:
712 break;
713 case kGLXnOZ:
715 break;
716 case kGLZnOY:
718 break;
719 case kGLZnOX:
721 break;
722 case kGLOrthoRotate:
724 break;
725 case kGLOrthoDolly:
727 break;
728 case kGLSaveEPS:
729 SavePicture("viewer.eps");
730 break;
731 case kGLSavePDF:
732 SavePicture("viewer.pdf");
733 break;
734 case kGLSaveGIF:
735 SavePicture("viewer.gif");
736 break;
737 case kGLSaveAnimGIF:
738 SavePicture("viewer.gif+");
739 break;
740 case kGLSaveJPG:
741 SavePicture("viewer.jpg");
742 break;
743 case kGLSavePNG:
744 SavePicture("viewer.png");
745 break;
746 case kGLSaveAS:
747 {
749 fi.fFileTypes = gGLSaveAsTypes;
750 fi.SetIniDir(fDirName);
751 fi.fFileTypeIdx = fTypeIdx;
752 fi.fOverwrite = fOverwrite;
753 new TGFileDialog(gClient->GetDefaultRoot(), fFrame, kFDSave, &fi);
754 if (!fi.fFilename) return kTRUE;
755 TString ft(fi.fFileTypes[fi.fFileTypeIdx+1]);
756 fDirName = fi.fIniDir;
757 fTypeIdx = fi.fFileTypeIdx;
758 fOverwrite = fi.fOverwrite;
759
760 TString file = fi.fFilename;
761 Bool_t match = kFALSE;
762 const char** fin = gGLSaveAsTypes; ++fin;
763 while (*fin != nullptr)
764 {
765 if (file.EndsWith(*fin + 1))
766 {
767 match = kTRUE;
768 break;
769 }
770 fin += 2;
771 }
772 if ( ! match)
773 {
774 file += ft(ft.Index("."), ft.Length());
775 }
776 SavePicture(file);
777 }
778 break;
779 case kGLHideMenus:
780 if (fHideMenuBar)
782 else
784 break;
785 case kGLEditObject:
787 break;
788 case kGLCloseViewer:
789 // Exit needs to be delayed to avoid bad drawable X ids - GUI
790 // will all be changed in future anyway
791 TTimer::SingleShot(50, "TGLSAFrame", fFrame, "SendCloseMessage()");
792 break;
793 case kGLQuitROOT:
795 delete this;
797 break;
798 default:
799 break;
800 }
801 default:
802 break;
803 }
804 default:
805 break;
806 }
807
808 return kTRUE;
809}
810
811////////////////////////////////////////////////////////////////////////////////
812/// Toggle state of the 'Edit Object' menu entry.
813
822
823////////////////////////////////////////////////////////////////////////////////
824/// Toggle state of the 'Ortho allow rotate' menu entry.
825
840
841////////////////////////////////////////////////////////////////////////////////
842/// Toggle state of the 'Ortho allow dolly' menu entry.
843
@ kButton1Down
Definition Buttons.h:17
@ kEnterNotify
Definition GuiTypes.h:61
@ kLeaveNotify
Definition GuiTypes.h:61
const Mask_t kFocusChangeMask
Definition GuiTypes.h:169
const Mask_t kExposureMask
Definition GuiTypes.h:165
const Mask_t kKeyPressMask
Definition GuiTypes.h:159
const Mask_t kPointerMotionMask
Definition GuiTypes.h:163
@ kRaisedFrame
Definition GuiTypes.h:384
@ kFixedWidth
Definition GuiTypes.h:387
@ kHorizontalFrame
Definition GuiTypes.h:382
@ kFixedHeight
Definition GuiTypes.h:389
const Mask_t kLeaveWindowMask
Definition GuiTypes.h:168
const Mask_t kStructureNotifyMask
Definition GuiTypes.h:166
const Mask_t kEnterWindowMask
Definition GuiTypes.h:167
R__EXTERN const char gHelpAbout[]
Definition HelpText.h:17
#define f(i)
Definition RSha256.hxx:104
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
Definition RtypesCore.h:68
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
R__EXTERN TApplication * gApplication
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define gClient
Definition TGClient.h:157
@ kFDSave
@ kMWMFuncAll
Definition TGFrame.h:49
@ kMWMDecorAll
Definition TGFrame.h:63
@ kMWMInputModeless
Definition TGFrame.h:57
@ kDeepCleanup
Definition TGFrame.h:42
const char * gGLSaveAsTypes[]
@ kLHintsRight
Definition TGLayout.h:26
@ kLHintsExpandY
Definition TGLayout.h:31
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsNormal
Definition TGLayout.h:32
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t format
R__EXTERN void * gTQSender
Definition TQObject.h:46
#define gROOT
Definition TROOT.h:411
#define gVirtualX
Definition TVirtualX.h:337
Int_t GET_MSG(Long_t val)
@ kCM_MENU
@ kC_COMMAND
@ kCM_BUTTON
Int_t GET_SUBMSG(Long_t val)
#define snprintf
Definition civetweb.c:1579
Bool_t ReturnFromRun() const
virtual void Terminate(Int_t status=0)
Terminate the application by call TSystem::Exit() unless application has been told to return from Run...
A button abstract base class.
Definition TGButton.h:68
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition TGClient.cxx:233
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition TGClient.cxx:223
void SetRoot(TGWindow *root=nullptr)
Sets the current root (i.e.
Definition TGClient.cxx:243
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:289
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:318
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1109
virtual TList * GetList() const
Definition TGFrame.h:312
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1156
void Layout() override
Layout the elements of the composite frame.
Definition TGFrame.cxx:1249
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition TGFrame.cxx:1196
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1064
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
Definition TGFrame.cxx:1141
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition TGFrame.cxx:1182
This class creates a file selection dialog.
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
virtual void ChangeOptions(UInt_t options)
Change frame options. Options is an OR of the EFrameTypes.
Definition TGFrame.cxx:313
void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0) override
Move and/or resize the frame.
Definition TGFrame.cxx:621
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:597
void SetBackgroundColor(Pixel_t back) override
Set background color (override from TGWindow base class).
Definition TGFrame.cxx:304
void MapWindow() override
map window
Definition TGFrame.h:206
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:268
void UnmapWindow() override
unmap window
Definition TGFrame.h:208
void MapRaised() override
map raised
Definition TGFrame.h:207
Encapsulation of format / contents of an OpenGL buffer.
Definition TGLFormat.h:36
void SetDollyToZoom(Bool_t x)
void SetEnableRotate(Bool_t x)
TGLPhysicalShape * fPShape
Concrete physical shape - a GL drawable.
Standalone GL Viewer GUI main frame.
Definition TGLSAFrame.h:29
void Show()
Show the viewer.
Bool_t fDeleteMenuBar
Definition TGLSAViewer.h:73
static void SetMenuHidingTimeout(Long_t timeout)
Set global timeout for menu-hiding in mili-seconds.
void ToggleOrthoDolly()
Toggle state of the 'Ortho allow dolly' menu entry.
TGPopupMenu * fFileMenu
Definition TGLSAViewer.h:54
static const Int_t fgInitH
Definition TGLSAViewer.h:83
Bool_t ProcessFrameMessage(Long_t msg, Long_t parm1, Long_t)
Process GUI message capture by the main GUI frame (TGLSAFrame).
void EnableMenuBarHiding()
Enable hiding of menu bar.
TGLSAViewer(const TGLSAViewer &)
TString fDirName
Definition TGLSAViewer.h:64
TGCompositeFrame * fRightVerticalFrame
Definition TGLSAViewer.h:62
TGMenuBar * fMenuBar
Definition TGLSAViewer.h:67
TGPopupMenu * fHelpMenu
Definition TGLSAViewer.h:57
void ResetMenuHidingTimer(Bool_t show_menu)
Reset the timer for menu-bar hiding.
void CreateMenus()
File/Camera/Help menus.
void ToggleOrthoRotate()
Toggle state of the 'Ortho allow rotate' menu entry.
void CreateFrames()
Internal frames creation.
void SelectionChanged() override
Update GUI components for embedded viewer selection change.
Int_t fTypeIdx
Definition TGLSAViewer.h:65
void CreateGLWidget() override
Create a GLwidget, it is an error if it is already created.
void DeleteMenuBar()
Delete the menu bar.
void HandleMenuBarHiding(Event_t *ev)
Maybe switch menu-bar / menu-button.
static const char * fgHelpText2
Definition TGLSAViewer.h:86
TTimer * fMenuHidingTimer
Definition TGLSAViewer.h:70
void MenuHidingTimeout()
Action for menu-hiding timeout.
static Long_t fgMenuHidingTimeout
Definition TGLSAViewer.h:75
void DestroyGLWidget() override
Destroy the GLwidget, it is an error if it does not exist.
void Close()
Close the viewer - destructed.
void DisableMenuBarHiding()
Disable hiding of menu bar.
Bool_t fOverwrite
Definition TGLSAViewer.h:66
static const Int_t fgInitX
Definition TGLSAViewer.h:80
Bool_t fHideMenuBar
Definition TGLSAViewer.h:69
static const Int_t fgInitW
Definition TGLSAViewer.h:82
TGLFormat * fFormat
Definition TGLSAViewer.h:53
TGPopupMenu * fFileSaveMenu
Definition TGLSAViewer.h:55
void ToggleEditObject()
Toggle state of the 'Edit Object' menu entry.
TGCompositeFrame * GetFrame() const
Return the main-frame.
TGButton * fMenuBut
Definition TGLSAViewer.h:68
TGPopupMenu * fCameraMenu
Definition TGLSAViewer.h:56
~TGLSAViewer() override
Destroy standalone viewer object.
TGCompositeFrame * fLeftVerticalFrame
Definition TGLSAViewer.h:60
void DisableCloseMenuEntries()
Deactivate menu entries for closing the GL window and exiting ROOT.
TGLSAFrame * fFrame
Definition TGLSAViewer.h:52
static const char * fgHelpText1
Definition TGLSAViewer.h:85
static const Int_t fgInitY
Definition TGLSAViewer.h:81
Bool_t fMenuHidingShowMenu
Definition TGLSAViewer.h:71
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Definition TGLViewer.h:55
TGLOrthoCamera fOrthoXOYCamera
Definition TGLViewer.h:88
TGLOrthoCamera fOrthoXnOZCamera
Definition TGLViewer.h:93
TGEventHandler * fEventHandler
select record from last overlay select
Definition TGLViewer.h:119
TGLOrthoCamera fOrthoZnOYCamera
Definition TGLViewer.h:94
void RequestDraw(Short_t LOD=TGLRnrCtx::kLODMed)
Post request for redraw of viewer at level of detail 'LOD' Request is directed via cross thread gVirt...
TGLOrthoCamera fOrthoZOYCamera
Definition TGLViewer.h:90
TGLPShapeObj * fPShapeWrap
GED editor.
Definition TGLViewer.h:121
TGLWidget * fGLWidget
Definition TGLViewer.h:185
void SetCurrentCamera(ECameraType camera)
Set current active camera - 'cameraType' one of: kCameraPerspX, kCameraPerspY, kCameraPerspZ,...
Bool_t SavePicture()
Save current image using the default file name which can be set via SetPictureFileName() and defaults...
TGLOrthoCamera fOrthoXOZCamera
Definition TGLViewer.h:89
TGedEditor * fGedEditor
event handler
Definition TGLViewer.h:120
TVirtualPad * fPad
Definition TGLViewer.h:78
friend class TGLEventHandler
Definition TGLViewer.h:57
const TGLPhysicalShape * GetSelected() const
Return selected physical shape.
TGLOrthoCamera fOrthoXnOYCamera
Definition TGLViewer.h:92
@ kCameraPerspXOY
Definition TGLViewer.h:61
@ kCameraPerspXOZ
Definition TGLViewer.h:61
@ kCameraOrthoXnOZ
Definition TGLViewer.h:63
@ kCameraPerspYOZ
Definition TGLViewer.h:61
@ kCameraOrthoZnOY
Definition TGLViewer.h:63
@ kCameraOrthoZOY
Definition TGLViewer.h:62
@ kCameraOrthoXOY
Definition TGLViewer.h:62
@ kCameraOrthoZOX
Definition TGLViewer.h:62
@ kCameraOrthoZnOX
Definition TGLViewer.h:63
@ kCameraOrthoXOZ
Definition TGLViewer.h:62
@ kCameraOrthoXnOY
Definition TGLViewer.h:63
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:82
void SetEventHandler(TGEventHandler *eh)
Set event-handler. All events are passed to this object.
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition TGFrame.cxx:1850
void SetWMPosition(Int_t x, Int_t y)
Give the window manager a window position hint.
Definition TGFrame.cxx:1873
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1780
void SetMWMHints(UInt_t value, UInt_t funcs, UInt_t input)
Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
Definition TGFrame.cxx:1860
The TGMenu.h header contains all different menu classes.
Definition TGMenu.h:282
virtual TGMenuTitle * GetCurrent() const
Definition TGMenu.h:326
virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=nullptr)
Add popup menu to menu bar.
Definition TGMenu.cxx:414
Handle_t GetId() const
Definition TGObject.h:41
TGClient * GetClient() const
Definition TGObject.h:42
This class creates a popup menu object.
Definition TGMenu.h:110
virtual Bool_t IsEntryChecked(Int_t id)
Return true if menu item is checked.
Definition TGMenu.cxx:1841
virtual void AddPopup(TGHotString *s, TGPopupMenu *popup, TGMenuEntry *before=nullptr, const TGPicture *p=nullptr)
Add a (cascading) popup menu to a popup menu.
Definition TGMenu.cxx:1148
virtual void CheckEntry(Int_t id)
Check a menu entry (i.e. add a check mark in front of it).
Definition TGMenu.cxx:1778
virtual void UnCheckEntry(Int_t id)
Uncheck menu entry (i.e. remove check mark).
Definition TGMenu.cxx:1803
virtual void Associate(const TGWindow *w)
Definition TGMenu.h:206
virtual void DeleteEntry(Int_t id)
Delete entry with specified id from menu.
Definition TGMenu.cxx:1922
virtual void AddSeparator(TGMenuEntry *before=nullptr)
Add a menu separator to the menu.
Definition TGMenu.cxx:1056
virtual void AddEntry(TGHotString *s, Int_t id, void *ud=nullptr, const TGPicture *p=nullptr, TGMenuEntry *before=nullptr)
Add a menu entry.
Definition TGMenu.cxx:986
A composite frame that layout their children in vertical way.
Definition TGFrame.h:376
ROOT GUI Window base class.
Definition TGWindow.h:23
TGCanvas * GetTGCanvas() const
Definition TGedEditor.h:72
virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event, Bool_t force=kFALSE)
Activate object editors according to the selected object.
virtual void DisconnectFromCanvas()
Disconnect this editor from the Selected signal of fCanvas.
Mother of all ROOT objects.
Definition TObject.h:41
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1071
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:865
Bool_t Disconnect(const char *signal=nullptr, void *receiver=nullptr, const char *slot=nullptr)
Disconnects signal of this object from slot of receiver.
A TRootHelpDialog is used to display help text (or any text in a dialog window).
Basic string class.
Definition TString.h:138
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition TString.cxx:2250
Handles synchronous and a-synchronous timer events.
Definition TTimer.h:51
virtual void TurnOff()
Remove timer from system timer list.
Definition TTimer.cxx:234
virtual void TurnOn()
Add the timer to the system timer list.
Definition TTimer.cxx:246
void Reset()
Reset the timer.
Definition TTimer.cxx:162
static void SingleShot(Int_t milliSec, const char *receiver_class, void *receiver, const char *method)
This static function calls a slot after a given time interval.
Definition TTimer.cxx:261
void SetTime(Long_t milliSec)
Definition TTimer.h:91
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
Event structure.
Definition GuiTypes.h:174