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
184
186
189const Int_t TGLSAViewer::fgInitW = 780;
190const Int_t TGLSAViewer::fgInitH = 670;
191
192// A lot of raw pointers/naked new-expressions - good way to discredit C++ (or C++ programmer
193// ROOT has system to cleanup - I'll try to use it
194
195const char *gGLSaveAsTypes[] = {"Encapsulated PostScript", "*.eps",
196 "PDF", "*.pdf",
197 "GIF", "*.gif",
198 "Animated GIF", "*.gif+",
199 "JPEG", "*.jpg",
200 "PNG", "*.png",
201 nullptr, nullptr};
202
203////////////////////////////////////////////////////////////////////////////////
204/// Construct a standalone viewer, bound to supplied 'pad'.
205
207 TGLViewer(pad, fgInitX, fgInitY, fgInitW, fgInitH),
208 fFrame(nullptr),
209 fFormat(format),
210 fFileMenu(nullptr),
211 fFileSaveMenu(nullptr),
212 fCameraMenu(nullptr),
213 fHelpMenu(nullptr),
214 fLeftVerticalFrame(nullptr),
215 fRightVerticalFrame(nullptr),
216 fDirName("."),
217 fTypeIdx(0),
218 fOverwrite(kFALSE),
219 fMenuBar(nullptr),
220 fMenuBut(nullptr),
221 fHideMenuBar(kFALSE),
222 fMenuHidingTimer(nullptr),
223 fMenuHidingShowMenu(kTRUE),
224 fDeleteMenuBar(kFALSE)
225{
226 fFrame = new TGLSAFrame(*this);
227
228 CreateMenus();
229 CreateFrames();
230
231 fFrame->SetWindowName("ROOT's GL viewer");
232 fFrame->SetClassHints("GLViewer", "GLViewer");
236
240
241 // set recursive cleanup, but exclude fGedEditor
242 // destructor of fGedEditor has own way of handling child nodes
247
248 Show();
249}
250
251////////////////////////////////////////////////////////////////////////////////
252/// Construct an embedded standalone viewer, bound to supplied 'pad'.
253/// If format is passed, it gets adopted by the viewer as it might
254/// need to be reused several times when recreating the GL-widget.
255///
256/// Modified version of the previous constructor for embedding the
257/// viewer into another frame (parent).
258
260 TGLFormat* format) :
261 TGLViewer(pad, fgInitX, fgInitY, fgInitW, fgInitH),
262 fFrame(nullptr),
263 fFormat(format),
264 fFileMenu(nullptr),
265 fCameraMenu(nullptr),
266 fHelpMenu(nullptr),
267 fLeftVerticalFrame(nullptr),
268 fRightVerticalFrame(nullptr),
269 fTypeIdx(0),
270 fMenuBar(nullptr),
271 fMenuBut(nullptr),
272 fHideMenuBar(kFALSE),
273 fMenuHidingTimer(nullptr),
274 fMenuHidingShowMenu(kTRUE),
275 fDeleteMenuBar(kFALSE)
276{
277 fGedEditor = ged;
278 fFrame = new TGLSAFrame(parent, *this);
279
280 CreateMenus();
281 CreateFrames();
282
287
288 // set recursive cleanup, but exclude fGedEditor
289 // destructor of fGedEditor has own way of handling child nodes
291 {
296 }
297
298 Show();
299}
300
301////////////////////////////////////////////////////////////////////////////////
302/// Destroy standalone viewer object.
303
305{
307
309
310 delete fHelpMenu;
311 delete fCameraMenu;
312 delete fFileSaveMenu;
313 delete fFileMenu;
314 if(fDeleteMenuBar) {
315 delete fMenuBar;
316 }
317 delete fFormat;
318 delete fFrame;
319 fGLWidget = nullptr;
320}
321
322////////////////////////////////////////////////////////////////////////////////
323/// Return the main-frame.
324
326{
327 return fFrame;
328}
329
330////////////////////////////////////////////////////////////////////////////////
331/// Create a GLwidget, it is an error if it is already created.
332/// This is needed for frame-swapping on mac.
333
335{
336 if (fGLWidget) {
337 Error("CreateGLWidget", "Widget already exists.");
338 return;
339 }
340
341 if (fFormat == nullptr)
342 fFormat = new TGLFormat;
343
346
348 fFrame->Layout();
349
351}
352
353////////////////////////////////////////////////////////////////////////////////
354/// Destroy the GLwidget, it is an error if it does not exist.
355/// This is needed for frame-swapping on mac.
356
358{
359 if (fGLWidget == nullptr) {
360 Error("DestroyGLWidget", "Widget does not exist.");
361 return;
362 }
363
365 fGLWidget->SetEventHandler(nullptr);
366
369 fGLWidget = nullptr;
370}
371
372////////////////////////////////////////////////////////////////////////////////
373///File/Camera/Help menus.
374
376{
378 fFileMenu->AddEntry("&Hide Menus", kGLHideMenus);
379 fFileMenu->AddEntry("&Edit Object", kGLEditObject);
381 fFileMenu->AddEntry("&Close Viewer", kGLCloseViewer);
384 fFileSaveMenu->AddEntry("viewer.&eps", kGLSaveEPS);
385 fFileSaveMenu->AddEntry("viewer.&pdf", kGLSavePDF);
386 fFileSaveMenu->AddEntry("viewer.&gif", kGLSaveGIF);
387 fFileSaveMenu->AddEntry("viewer.g&if+", kGLSaveAnimGIF);
388 fFileSaveMenu->AddEntry("viewer.&jpg", kGLSaveJPG);
389 fFileSaveMenu->AddEntry("viewer.p&ng", kGLSavePNG);
391 fFileMenu->AddEntry("Save &As...", kGLSaveAS);
393 fFileMenu->AddEntry("&Quit ROOT", kGLQuitROOT);
395
397 fCameraMenu->AddEntry("Perspective (Floor XOZ)", kGLPerspXOZ);
398 fCameraMenu->AddEntry("Perspective (Floor YOZ)", kGLPerspYOZ);
399 fCameraMenu->AddEntry("Perspective (Floor XOY)", kGLPerspXOY);
400 fCameraMenu->AddEntry("Orthographic (XOY)", kGLXOY);
401 fCameraMenu->AddEntry("Orthographic (XOZ)", kGLXOZ);
402 fCameraMenu->AddEntry("Orthographic (ZOY)", kGLZOY);
403 fCameraMenu->AddEntry("Orthographic (ZOX)", kGLZOX);
404 fCameraMenu->AddEntry("Orthographic (XnOY)", kGLXnOY);
405 fCameraMenu->AddEntry("Orthographic (XnOZ)", kGLXnOZ);
406 fCameraMenu->AddEntry("Orthographic (ZnOY)", kGLZnOY);
407 fCameraMenu->AddEntry("Orthographic (ZnOX)", kGLZnOX);
409 fCameraMenu->AddEntry("Ortho allow rotate", kGLOrthoRotate);
410 fCameraMenu->AddEntry("Ortho allow dolly", kGLOrthoDolly);
412
414 fHelpMenu->AddEntry("Help on GL Viewer...", kGLHelpViewer);
416 fHelpMenu->AddEntry("&About ROOT...", kGLHelpAbout);
418
419 // Create menubar
421 fMenuBar->AddPopup("&File", fFileMenu, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
422 fMenuBar->AddPopup("&Camera", fCameraMenu, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
425 gVirtualX->SelectInput(fMenuBar->GetId(),
429
430 fMenuBut = new TGButton(fFrame);
432 fMenuBut->Resize(20, 4);
433 fMenuBut->SetBackgroundColor(0x80A0C0);
435}
436
437////////////////////////////////////////////////////////////////////////////////
438/// Internal frames creation.
439
441{
442 TGCompositeFrame* compositeFrame = fFrame;
443 if (fGedEditor == nullptr)
444 {
445 compositeFrame = new TGCompositeFrame(fFrame, 100, 100, kHorizontalFrame | kRaisedFrame);
447
448 fLeftVerticalFrame = new TGVerticalFrame(compositeFrame, 195, 10, kFixedWidth);
449 compositeFrame->AddFrame(fLeftVerticalFrame, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 2, 2, 2, 2));
450
451 const TGWindow* cw = fFrame->GetClient()->GetRoot();
453
454 fGedEditor = new TGedEditor();
460
461 TGVSplitter *splitter = new TGVSplitter(compositeFrame);
463 compositeFrame->AddFrame(splitter, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 0,1,2,2) );
464 }
465
466 // SunkenFrame introduces 1-pixel offset - in TGFrame.cxx:163
467 //
468 // TGVerticalFrame *rightVerticalFrame = new TGVerticalFrame(compositeFrame, 10, 10, kSunkenFrame);
469 // compositeFrame->AddFrame(rightVerticalFrame, new TGLayoutHints(kLHintsRight | kLHintsExpandX | kLHintsExpandY,0,2,2,2));
470 fRightVerticalFrame = new TGVerticalFrame(compositeFrame, 10, 10);
472
473 fEventHandler = new TGLEventHandler(nullptr, this);
475}
476
477////////////////////////////////////////////////////////////////////////////////
478/// Update GUI components for embedded viewer selection change.
479/// Override from TGLViewer.
480
482{
483 TGLPhysicalShape *selected = const_cast<TGLPhysicalShape*>(GetSelected());
484
485 if (selected) {
486 fPShapeWrap->fPShape = selected;
489 else
491 } else {
492 fPShapeWrap->fPShape = nullptr;
494 }
495}
496
497////////////////////////////////////////////////////////////////////////////////
498/// Show the viewer
499
501{
502 fFrame->MapRaised();
504 RequestDraw();
505}
506
507////////////////////////////////////////////////////////////////////////////////
508/// Close the viewer - destructed.
509
511{
512 // Commit suicide when contained GUI is closed.
513 delete this;
514}
515
516////////////////////////////////////////////////////////////////////////////////
517/// Delete the menu bar.
518
520{
522}
523
524////////////////////////////////////////////////////////////////////////////////
525/// Deactivate menu entries for closing the GL window and exiting ROOT.
526
528{
531}
532
533////////////////////////////////////////////////////////////////////////////////
534/// Enable hiding of menu bar.
535
537{
538 if (fHideMenuBar)
539 return;
540
542
543 fMenuBar->Connect("ProcessedEvent(Event_t*)", "TGLSAViewer", this, "HandleMenuBarHiding(Event_t*)");
544 fMenuBut->Connect("ProcessedEvent(Event_t*)", "TGLSAViewer", this, "HandleMenuBarHiding(Event_t*)");
545
548 fFrame->Layout();
549
551 fMenuHidingTimer->Connect("Timeout()", "TGLSAViewer", this, "MenuHidingTimeout()");
552
554}
555
556////////////////////////////////////////////////////////////////////////////////
557/// Disable hiding of menu bar.
558
560{
561 if (!fHideMenuBar)
562 return;
563
565
566 fMenuBar->Disconnect("ProcessedEvent(Event_t*)", this, "HandleMenuBarHiding(Event_t*)");
567 fMenuBut->Disconnect("ProcessedEvent(Event_t*)", this, "HandleMenuBarHiding(Event_t*)");
568
571 fFrame->Layout();
572
574 delete fMenuHidingTimer;
575 fMenuHidingTimer = nullptr;
576
578}
579
580////////////////////////////////////////////////////////////////////////////////
581/// Maybe switch menu-bar / menu-button.
582
584{
586
587 if (f == fMenuBut)
588 {
589 if (ev->fType == kEnterNotify)
591 else
593 }
594 else if (f == fMenuBar)
595 {
596 if (ev->fType == kLeaveNotify &&
597 (ev->fX < 0 || ev->fX >= (Int_t) f->GetWidth() ||
598 ev->fY < 0 || ev->fY >= (Int_t) f->GetHeight()))
599 {
600 if (fMenuBar->GetCurrent() == nullptr)
602 else
603 fMenuBar->GetCurrent()->Connect("ProcessedEvent(Event_t*)", "TGLSAViewer", this, "HandleMenuBarHiding(Event_t*)");
604 }
605 else
606 {
608 }
609 }
610 else
611 {
612 f->Disconnect("ProcessedEvent(Event_t*)", this);
614 }
615}
616
617////////////////////////////////////////////////////////////////////////////////
618/// Reset the timer for menu-bar hiding.
619
621{
622 // This happens, mysteriously.
623 if (fMenuHidingTimer == nullptr)
624 return;
625
627
628 fMenuHidingShowMenu = show_menu;
629
633}
634
635////////////////////////////////////////////////////////////////////////////////
636/// Action for menu-hiding timeout.
637
639{
644 } else {
647 }
648 fFrame->Layout();
649}
650
651////////////////////////////////////////////////////////////////////////////////
652/// Set global timeout for menu-hiding in mili-seconds.
653/// Static function.
654
656{
657 fgMenuHidingTimeout = timeout;
658}
659
660////////////////////////////////////////////////////////////////////////////////
661/// Process GUI message capture by the main GUI frame (TGLSAFrame).
662
664{
665 switch (GET_MSG(msg)) {
666 case kC_COMMAND:
667 switch (GET_SUBMSG(msg)) {
668 case kCM_BUTTON:
669 case kCM_MENU:
670 switch (parm1) {
671 case kGLHelpAbout: {
672#ifdef R__UNIX
673 TString rootx = TROOT::GetBinDir() + "/root -a &";
674 gSystem->Exec(rootx);
675#else
676#ifdef WIN32
678#else
679 char str[32];
680 snprintf(str,32, "About ROOT %s...", gROOT->GetVersion());
681 hd = new TRootHelpDialog(this, str, 600, 400);
682 hd->SetText(gHelpAbout);
683 hd->Popup();
684#endif
685#endif
686 break;
687 }
688 case kGLHelpViewer: {
689 TRootHelpDialog * hd = new TRootHelpDialog(fFrame, "Help on GL Viewer...", 660, 400);
690 hd->AddText(fgHelpText1);
691 hd->AddText(fgHelpText2);
692 hd->Popup();
693 break;
694 }
695 case kGLPerspYOZ:
697 break;
698 case kGLPerspXOZ:
700 break;
701 case kGLPerspXOY:
703 break;
704 case kGLXOY:
706 break;
707 case kGLXOZ:
709 break;
710 case kGLZOY:
712 break;
713 case kGLZOX:
715 break;
716 case kGLXnOY:
718 break;
719 case kGLXnOZ:
721 break;
722 case kGLZnOY:
724 break;
725 case kGLZnOX:
727 break;
728 case kGLOrthoRotate:
730 break;
731 case kGLOrthoDolly:
733 break;
734 case kGLSaveEPS:
735 SavePicture("viewer.eps");
736 break;
737 case kGLSavePDF:
738 SavePicture("viewer.pdf");
739 break;
740 case kGLSaveGIF:
741 SavePicture("viewer.gif");
742 break;
743 case kGLSaveAnimGIF:
744 SavePicture("viewer.gif+");
745 break;
746 case kGLSaveJPG:
747 SavePicture("viewer.jpg");
748 break;
749 case kGLSavePNG:
750 SavePicture("viewer.png");
751 break;
752 case kGLSaveAS:
753 {
754 TGFileInfo fi;
759 new TGFileDialog(gClient->GetDefaultRoot(), fFrame, kFDSave, &fi);
760 if (!fi.fFilename) return kTRUE;
761 TString ft(fi.fFileTypes[fi.fFileTypeIdx+1]);
762 fDirName = fi.fIniDir;
765
766 TString file = fi.fFilename;
767 Bool_t match = kFALSE;
768 const char** fin = gGLSaveAsTypes; ++fin;
769 while (*fin != nullptr)
770 {
771 if (file.EndsWith(*fin + 1))
772 {
773 match = kTRUE;
774 break;
775 }
776 fin += 2;
777 }
778 if ( ! match)
779 {
780 file += ft(ft.Index("."), ft.Length());
781 }
782 SavePicture(file);
783 }
784 break;
785 case kGLHideMenus:
786 if (fHideMenuBar)
788 else
790 break;
791 case kGLEditObject:
793 break;
794 case kGLCloseViewer:
795 // Exit needs to be delayed to avoid bad drawable X ids - GUI
796 // will all be changed in future anyway
797 TTimer::SingleShot(50, "TGLSAFrame", fFrame, "SendCloseMessage()");
798 break;
799 case kGLQuitROOT:
801 delete this;
803 break;
804 default:
805 break;
806 }
807 default:
808 break;
809 }
810 default:
811 break;
812 }
813
814 return kTRUE;
815}
816
817////////////////////////////////////////////////////////////////////////////////
818/// Toggle state of the 'Edit Object' menu entry.
819
821{
824 else
827}
828
829////////////////////////////////////////////////////////////////////////////////
830/// Toggle state of the 'Ortho allow rotate' menu entry.
831
833{
836 else
845}
846
847////////////////////////////////////////////////////////////////////////////////
848/// Toggle state of the 'Ortho allow dolly' menu entry.
849
851{
854 else
860}
@ 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
Definition RtypesCore.h:45
long Long_t
Definition RtypesCore.h:54
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassImp(name)
Definition Rtypes.h:377
R__EXTERN TApplication * gApplication
#define gClient
Definition TGClient.h:156
@ 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:406
R__EXTERN TSystem * gSystem
Definition TSystem.h:555
#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:1540
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:234
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition TGClient.cxx:224
void SetRoot(TGWindow *root=nullptr)
Sets the current root (i.e.
Definition TGClient.cxx:244
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:316
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
virtual TList * GetList() const
Definition TGFrame.h:310
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1164
void Layout() override
Layout the elements of the composite frame.
Definition TGFrame.cxx:1257
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition TGFrame.cxx:1204
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1072
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
Definition TGFrame.cxx:1149
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition TGFrame.cxx:1190
This class creates a file selection dialog.
char * fFilename
selected file name
Int_t fFileTypeIdx
selected file type, index in fFileTypes
const char ** fFileTypes
file types used to filter selectable files
char * fIniDir
on input: initial directory, on output: new directory
Bool_t fOverwrite
if true overwrite the file with existing name on save
void SetIniDir(const char *inidir)
Set directory name.
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:321
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:629
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:605
void SetBackgroundColor(Pixel_t back) override
Set background color (override from TGWindow base class).
Definition TGFrame.cxx:312
void MapWindow() override
map window
Definition TGFrame.h:204
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:276
void UnmapWindow() override
unmap window
Definition TGFrame.h:206
void MapRaised() override
map raised
Definition TGFrame.h:205
Encapsulation of format / contents of an OpenGL buffer.
Definition TGLFormat.h:36
TObject * GetExternal() const
void SetDollyToZoom(Bool_t x)
void SetEnableRotate(Bool_t x)
TGLPhysicalShape * fPShape
Concrete physical shape - a GL drawable.
const TGLLogicalShape * GetLogical() const
Standalone GL Viewer GUI main frame.
Definition TGLSAFrame.h:29
The top level standalone GL-viewer - created via plugin manager.
Definition TGLSAViewer.h:38
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:83
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:1858
void SetWMPosition(Int_t x, Int_t y)
Give the window manager a window position hint.
Definition TGFrame.cxx:1881
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1788
void SetMWMHints(UInt_t value, UInt_t funcs, UInt_t input)
Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
Definition TGFrame.cxx:1868
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:418
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:1845
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:1152
virtual void CheckEntry(Int_t id)
Check a menu entry (i.e. add a check mark in front of it).
Definition TGMenu.cxx:1782
virtual void UnCheckEntry(Int_t id)
Uncheck menu entry (i.e. remove check mark).
Definition TGMenu.cxx:1807
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:1926
virtual void AddSeparator(TGMenuEntry *before=nullptr)
Add a menu separator to the menu.
Definition TGMenu.cxx:1060
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:990
void SetFrame(TGFrame *frame, Bool_t left) override
Set frame to be resized.
A composite frame that layout their children in vertical way.
Definition TGFrame.h:374
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.
TObject * Remove(TObject *obj) override
Remove object from the list.
Definition TList.cxx:820
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
Definition TList.cxx:657
void AddFirst(TObject *obj) override
Add object at the beginning of the list.
Definition TList.cxx:98
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:987
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:869
Bool_t Disconnect(const char *signal=nullptr, void *receiver=nullptr, const char *slot=nullptr)
Disconnects signal of this object from slot of receiver.
static const TString & GetBinDir()
Get the binary directory in the installation. Static utility function.
Definition TROOT.cxx:2942
A TRootHelpDialog is used to display help text (or any text in a dialog window).
void Popup()
Show help dialog.
void AddText(const char *helpText)
Add help text from helpText buffer to already existing text in TGTextView.
Basic string class.
Definition TString.h:139
Ssiz_t Length() const
Definition TString.h:417
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition TString.cxx:2244
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:651
virtual Int_t Exec(const char *shellcmd)
Execute a command.
Definition TSystem.cxx:653
Handles synchronous and a-synchronous timer events.
Definition TTimer.h:51
virtual void TurnOff()
Remove timer from system timer list.
Definition TTimer.cxx:231
virtual void TurnOn()
Add the timer to the system timer list.
Definition TTimer.cxx:243
void Reset()
Reset the timer.
Definition TTimer.cxx:159
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:258
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
EGEventType fType
of event (see EGEventType)
Definition GuiTypes.h:175
Int_t fY
pointer x, y coordinates in event window
Definition GuiTypes.h:178
Int_t fX
Definition GuiTypes.h:178