Logo ROOT   6.10/09
Reference Guide
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 "TGLabel.h"
25 #include "TGMenu.h"
26 #include "TGButton.h"
27 #include "TGSplitter.h"
28 #include "TColor.h"
29 
30 #include "TVirtualPad.h"
31 #include "TGedEditor.h"
32 #include "TRootEmbeddedCanvas.h"
33 #include "TString.h"
34 #include "TGFileDialog.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 "TGLPhysicalShape.h"
50 #include "TGLWidget.h"
51 #include "TGLSAViewer.h"
52 #include "TGLSAFrame.h"
53 #include "TGLOutput.h"
54 #include "TGLEventHandler.h"
55 
56 
57 const char * TGLSAViewer::fgHelpText1 = "\
58 DIRECT SCENE INTERACTIONS\n\n\
59  Press:\n\
60  \tw --- wireframe mode\n\
61  \te --- switch between dark / light color-set\n\
62  \tr --- filled polygons mode\n\
63  \tt --- outline mode\n\
64  \tj --- ZOOM in\n\
65  \tk --- ZOOM out\n\
66  \ta --- switch on/off arc-ball camera rotation control\n\
67  \tArrow Keys --- PAN (TRUCK) across scene\n\
68  \tHome --- reset current camera\n\
69  \tCtrl-Home --- switch external/automatic camera center\n\
70 \n\
71  LEFT mouse button -- ROTATE (ORBIT) the scene by holding the mouse button and moving\n\
72  the mouse (perspective camera, needs to be enabled in menu for orthographic cameras).\n\
73  By default, the scene will be rotated about its center. To select arbitrary center\n\
74  bring up the viewer-editor (e.g., shift-click into empty background) and use\n\
75  'Camera center' controls in the 'Guides' tab.\n\
76 \n\
77  MIDDLE mouse button or arrow keys -- PAN (TRUCK) the camera.\n\
78 \n\
79  RIGHT mouse button action depends on camera type:\n\
80  orthographic -- zoom,\n\
81  perspective -- move camera forwards / backwards\n\
82 \n\
83  By pressing Ctrl and Shift keys the mouse precision can be changed:\n\
84  Shift -- 10 times less precise\n\
85  Ctrl -- 10 times more precise\n\
86  Ctrl Shift -- 100 times more precise\n\
87 \n\
88  Mouse wheel action depends on camera type:\n\
89  orthographic -- zoom,\n\
90  perspective -- change field-of-view (focal length)\n\
91 \n\
92  To invert direction of mouse and key actions from scene-centric\n\
93  to viewer-centric, set in your .rootrc file:\n\
94  OpenGL.EventHandler.ViewerCentricControls: 1\n\
95 \n\
96  Double click will show GUI editor of the viewer (if assigned).\n\
97 \n\
98  RESET the camera via the button in viewer-editor or Home key.\n\
99 \n\
100  SELECT a shape with Shift+Left mouse button click.\n\
101 \n\
102  SELECT the viewer with Shift+Left mouse button click on a free space.\n\
103 \n\
104  MOVE a selected shape using Shift+Mid mouse drag.\n\
105 \n\
106  Invoke the CONTEXT menu with Shift+Right mouse click.\n\n"
107  "Secondary selection and direct render object interaction is initiated\n\
108  by Alt+Left mouse click (Mod1, actually). Only few classes support this option.\n\
109  When 'Alt' is taken by window manager, try Alt-Ctrl-Left.\n\
110 \n\
111 CAMERA\n\
112 \n\
113  The \"Camera\" menu is used to select the different projections from \n\
114  the 3D world onto the 2D viewport. There are three perspective cameras:\n\
115 \n\
116  \tPerspective (Floor XOZ)\n\
117  \tPerspective (Floor YOZ)\n\
118  \tPerspective (Floor XOY)\n\
119 \n\
120  In each case the floor plane (defined by two axes) is kept level.\n\
121 \n\
122  There are also three orthographic cameras:\n\
123 \n\
124  \tOrthographic (XOY)\n\
125  \tOrthographic (XOZ)\n\
126  \tOrthographic (ZOY)\n\
127 \n\
128  In each case the first axis is placed horizontal, the second vertical e.g.\n\
129  XOY means X horizontal, Y vertical.\n\n";
130 
131 const char * TGLSAViewer::fgHelpText2 = "\
132 SHAPES COLOR AND MATERIAL\n\
133 \n\
134  The selected shape's color can be modified in the Shapes-Color tabs.\n\
135  Shape's color is specified by the percentage of red, green, blue light\n\
136  it reflects. A surface can reflect DIFFUSE, AMBIENT and SPECULAR light.\n\
137  A surface can also emit light. The EMISSIVE parameter allows to define it.\n\
138  The surface SHININESS can also be modified.\n\
139 \n\
140 SHAPES GEOMETRY\n\
141 \n\
142  The selected shape's location and geometry can be modified in the Shapes-Geom\n\
143  tabs by entering desired values in respective number entry controls.\n\
144 \n\
145 SCENE CLIPPING\n\
146 \n\
147  In the Scene-Clipping tabs select a 'Clip Type': None, Plane, Box\n\
148 \n\
149  For 'Plane' and 'Box' the lower pane shows the relevant parameters:\n\
150 \n\
151 \tPlane: Equation coefficients of form aX + bY + cZ + d = 0\n\
152 \tBox: Center X/Y/Z and Length X/Y/Z\n\n"
153  "For Box checking the 'Show / Edit' checkbox shows the clip box (in light blue)\n\
154  in viewer. It also attaches the current manipulator to the box - enabling\n\
155  direct editing in viewer.\n\
156 \n\
157 MANIPULATORS\n\
158 \n\
159  A widget attached to the selected object - allowing direct manipulation\n\
160  of the object with respect to its local axes.\n\
161 \n\
162  There are three modes, toggled with keys while manipulator is active, that is,\n\
163  mouse pointer is above it (switches color to yellow):\n\
164  \tMode\t\tWidget Component Style\t\tKey\n\
165  \t----\t\t----------------------\t\t---\n\
166  \tTranslation\tLocal axes with arrows\t\tv\n\
167  \tScale\t\tLocal axes with boxes\t\tx\n\
168  \tRotate\t\tLocal axes rings\t\tc\n\
169 \n\
170  Each widget has three axis components - red (X), green (Y) and blue (Z).\n\
171  The component turns yellow, indicating an active state, when the mouse is moved\n\
172  over it. Left click and drag on the active component to adjust the objects\n\
173  translation, scale or rotation.\n\
174  Some objects do not support all manipulations (e.g. clipping planes cannot be \n\
175  scaled). If a manipulation is not permitted the component it drawn in grey and \n\
176  cannot be selected/dragged.\n";
177 
178 
179 /** \class TGLSAViewer
180 \ingroup opengl
181 The top level standalone GL-viewer - created via plugin manager.
182 */
183 
185 
187 
188 const Int_t TGLSAViewer::fgInitX = 0;
189 const Int_t TGLSAViewer::fgInitY = 0;
190 const Int_t TGLSAViewer::fgInitW = 780;
191 const Int_t TGLSAViewer::fgInitH = 670;
192 
193 // A lot of raw pointers/naked new-expressions - good way to discredit C++ (or C++ programmer
194 // ROOT has system to cleanup - I'll try to use it
195 
196 const char *gGLSaveAsTypes[] = {"Encapsulated PostScript", "*.eps",
197  "PDF", "*.pdf",
198  "GIF", "*.gif",
199  "Animated GIF", "*.gif+",
200  "JPEG", "*.jpg",
201  "PNG", "*.png",
202  0, 0};
203 
204 ////////////////////////////////////////////////////////////////////////////////
205 /// Construct a standalone viewer, bound to supplied 'pad'.
206 
208  TGLViewer(pad, fgInitX, fgInitY, fgInitW, fgInitH),
209  fFrame(0),
210  fFormat(format),
211  fFileMenu(0),
212  fFileSaveMenu(0),
213  fCameraMenu(0),
214  fHelpMenu(0),
215  fLeftVerticalFrame(0),
216  fRightVerticalFrame(0),
217  fDirName("."),
218  fTypeIdx(0),
219  fOverwrite(kFALSE),
220  fMenuBar(0),
221  fMenuBut(0),
222  fHideMenuBar(kFALSE),
223  fMenuHidingTimer(0),
224  fMenuHidingShowMenu(kTRUE),
225  fDeleteMenuBar(kFALSE)
226 {
227  fFrame = new TGLSAFrame(*this);
228 
229  CreateMenus();
230  CreateFrames();
231 
232  fFrame->SetWindowName("ROOT's GL viewer");
233  fFrame->SetClassHints("GLViewer", "GLViewer");
237 
241 
242  // set recursive cleanup, but exclude fGedEditor
243  // destructor of fGedEditor has own way of handling child nodes
248 
249  Show();
250 }
251 
252 ////////////////////////////////////////////////////////////////////////////////
253 /// Construct an embedded standalone viewer, bound to supplied 'pad'.
254 /// If format is passed, it gets adopted by the viewer as it might
255 /// need to be reused several times when recreating the GL-widget.
256 ///
257 /// Modified version of the previous constructor for embedding the
258 /// viewer into another frame (parent).
259 
261  TGLFormat* format) :
263  fFrame(0),
264  fFormat(format),
265  fFileMenu(0),
266  fCameraMenu(0),
267  fHelpMenu(0),
270  fTypeIdx(0),
271  fMenuBar(0),
272  fMenuBut(0),
274  fMenuHidingTimer(0),
277 {
278  fGedEditor = ged;
279  fFrame = new TGLSAFrame(parent, *this);
280 
281  CreateMenus();
282  CreateFrames();
283 
288 
289  // set recursive cleanup, but exclude fGedEditor
290  // destructor of fGedEditor has own way of handling child nodes
291  if (fLeftVerticalFrame)
292  {
297  }
298 
299  Show();
300 }
301 
302 ////////////////////////////////////////////////////////////////////////////////
303 /// Destroy standalone viewer object.
304 
306 {
308 
310 
311  delete fHelpMenu;
312  delete fCameraMenu;
313  delete fFileSaveMenu;
314  delete fFileMenu;
315  if(fDeleteMenuBar) {
316  delete fMenuBar;
317  }
318  delete fFormat;
319  delete fFrame;
320  fGLWidget = 0;
321 }
322 
323 ////////////////////////////////////////////////////////////////////////////////
324 /// Return the main-frame.
325 
327 {
328  return fFrame;
329 }
330 
331 ////////////////////////////////////////////////////////////////////////////////
332 /// Create a GLwidget, it is an error if it is already created.
333 /// This is needed for frame-swapping on mac.
334 
336 {
337  if (fGLWidget) {
338  Error("CreateGLWidget", "Widget already exists.");
339  return;
340  }
341 
342  if (fFormat == 0)
343  fFormat = new TGLFormat;
344 
347 
349  fFrame->Layout();
350 
351  fGLWidget->MapWindow();
352 }
353 
354 ////////////////////////////////////////////////////////////////////////////////
355 /// Destroy the GLwidget, it is an error if it does not exist.
356 /// This is needed for frame-swapping on mac.
357 
359 {
360  if (fGLWidget == 0) {
361  Error("DestroyGLWidget", "Widget does not exist.");
362  return;
363  }
364 
367 
370  fGLWidget = 0;
371 }
372 
373 ////////////////////////////////////////////////////////////////////////////////
374 ///File/Camera/Help menus.
375 
377 {
379  fFileMenu->AddEntry("&Hide Menus", kGLHideMenus);
380  fFileMenu->AddEntry("&Edit Object", kGLEditObject);
382  fFileMenu->AddEntry("&Close Viewer", kGLCloseViewer);
385  fFileSaveMenu->AddEntry("viewer.&eps", kGLSaveEPS);
386  fFileSaveMenu->AddEntry("viewer.&pdf", kGLSavePDF);
387  fFileSaveMenu->AddEntry("viewer.&gif", kGLSaveGIF);
388  fFileSaveMenu->AddEntry("viewer.g&if+", kGLSaveAnimGIF);
389  fFileSaveMenu->AddEntry("viewer.&jpg", kGLSaveJPG);
390  fFileSaveMenu->AddEntry("viewer.p&ng", kGLSavePNG);
391  fFileMenu->AddPopup("&Save", fFileSaveMenu);
392  fFileMenu->AddEntry("Save &As...", kGLSaveAS);
394  fFileMenu->AddEntry("&Quit ROOT", kGLQuitROOT);
396 
398  fCameraMenu->AddEntry("Perspective (Floor XOZ)", kGLPerspXOZ);
399  fCameraMenu->AddEntry("Perspective (Floor YOZ)", kGLPerspYOZ);
400  fCameraMenu->AddEntry("Perspective (Floor XOY)", kGLPerspXOY);
401  fCameraMenu->AddEntry("Orthographic (XOY)", kGLXOY);
402  fCameraMenu->AddEntry("Orthographic (XOZ)", kGLXOZ);
403  fCameraMenu->AddEntry("Orthographic (ZOY)", kGLZOY);
404  fCameraMenu->AddEntry("Orthographic (XnOY)", kGLXnOY);
405  fCameraMenu->AddEntry("Orthographic (XnOZ)", kGLXnOZ);
406  fCameraMenu->AddEntry("Orthographic (ZnOY)", kGLZnOY);
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
419  fMenuBar = new TGMenuBar(fFrame);
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 {
441  TGCompositeFrame* compositeFrame = fFrame;
442  if (fGedEditor == 0)
443  {
444  compositeFrame = new TGCompositeFrame(fFrame, 100, 100, kHorizontalFrame | kRaisedFrame);
445  fFrame->AddFrame(compositeFrame, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
446 
447  fLeftVerticalFrame = new TGVerticalFrame(compositeFrame, 195, 10, kFixedWidth);
448  compositeFrame->AddFrame(fLeftVerticalFrame, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 2, 2, 2, 2));
449 
450  const TGWindow* cw = fFrame->GetClient()->GetRoot();
452 
453  fGedEditor = new TGedEditor();
459 
460  TGVSplitter *splitter = new TGVSplitter(compositeFrame);
461  splitter->SetFrame(fLeftVerticalFrame, kTRUE);
462  compositeFrame->AddFrame(splitter, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 0,1,2,2) );
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));
469  fRightVerticalFrame = new TGVerticalFrame(compositeFrame, 10, 10);
471 
472  fEventHandler = new TGLEventHandler(0, this);
473  CreateGLWidget();
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;
488  else
490  } else {
491  fPShapeWrap->fPShape = 0;
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 
519 {
521 }
522 
523 ////////////////////////////////////////////////////////////////////////////////
524 /// Deactivate menu entries for closing the GL window and exiting ROOT.
525 
527 {
530 }
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 
549  fMenuHidingTimer = new TTimer;
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 = 0;
575 
577 }
578 
579 ////////////////////////////////////////////////////////////////////////////////
580 /// Maybe switch menu-bar / menu-button.
581 
583 {
584  TGFrame *f = (TGFrame*) gTQSender;
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() == 0)
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 == 0)
623  return;
624 
626 
627  fMenuHidingShowMenu = show_menu;
628 
632 }
633 
634 ////////////////////////////////////////////////////////////////////////////////
635 /// Action for menu-hiding timeout.
636 
638 {
640  if (fMenuHidingShowMenu) {
643  } else {
646  }
647  fFrame->Layout();
648 }
649 
650 ////////////////////////////////////////////////////////////////////////////////
651 /// Set global timeout for menu-hiding in mili-seconds.
652 /// Static function.
653 
655 {
656  fgMenuHidingTimeout = timeout;
657 }
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 R__UNIX
672  TString rootx = TROOT::GetBinDir() + "/root -a &";
673  gSystem->Exec(rootx);
674 #else
675 #ifdef WIN32
677 #else
678  char str[32];
679  snprintf(str,32, "About ROOT %s...", gROOT->GetVersion());
680  hd = new TRootHelpDialog(this, str, 600, 400);
681  hd->SetText(gHelpAbout);
682  hd->Popup();
683 #endif
684 #endif
685  break;
686  }
687  case kGLHelpViewer: {
688  TRootHelpDialog * hd = new TRootHelpDialog(fFrame, "Help on GL Viewer...", 660, 400);
689  hd->AddText(fgHelpText1);
690  hd->AddText(fgHelpText2);
691  hd->Popup();
692  break;
693  }
694  case kGLPerspYOZ:
696  break;
697  case kGLPerspXOZ:
699  break;
700  case kGLPerspXOY:
702  break;
703  case kGLXOY:
705  break;
706  case kGLXOZ:
708  break;
709  case kGLZOY:
711  break;
712  case kGLXnOY:
714  break;
715  case kGLXnOZ:
717  break;
718  case kGLZnOY:
720  break;
721  case kGLOrthoRotate:
723  break;
724  case kGLOrthoDolly:
726  break;
727  case kGLSaveEPS:
728  SavePicture("viewer.eps");
729  break;
730  case kGLSavePDF:
731  SavePicture("viewer.pdf");
732  break;
733  case kGLSaveGIF:
734  SavePicture("viewer.gif");
735  break;
736  case kGLSaveAnimGIF:
737  SavePicture("viewer.gif+");
738  break;
739  case kGLSaveJPG:
740  SavePicture("viewer.jpg");
741  break;
742  case kGLSavePNG:
743  SavePicture("viewer.png");
744  break;
745  case kGLSaveAS:
746  {
747  TGFileInfo fi;
749  fi.fIniDir = StrDup(fDirName);
750  fi.fFileTypeIdx = fTypeIdx;
751  fi.fOverwrite = fOverwrite;
752  new TGFileDialog(gClient->GetDefaultRoot(), fFrame, kFDSave, &fi);
753  if (!fi.fFilename) return kTRUE;
754  TString ft(fi.fFileTypes[fi.fFileTypeIdx+1]);
755  fDirName = fi.fIniDir;
756  fTypeIdx = fi.fFileTypeIdx;
757  fOverwrite = fi.fOverwrite;
758 
759  TString file = fi.fFilename;
760  Bool_t match = kFALSE;
761  const char** fin = gGLSaveAsTypes; ++fin;
762  while (*fin != 0)
763  {
764  if (file.EndsWith(*fin + 1))
765  {
766  match = kTRUE;
767  break;
768  }
769  fin += 2;
770  }
771  if ( ! match)
772  {
773  file += ft(ft.Index("."), ft.Length());
774  }
775  SavePicture(file);
776  }
777  break;
778  case kGLHideMenus:
779  if (fHideMenuBar)
781  else
783  break;
784  case kGLEditObject:
786  break;
787  case kGLCloseViewer:
788  // Exit needs to be delayed to avoid bad drawable X ids - GUI
789  // will all be changed in future anyway
790  TTimer::SingleShot(50, "TGLSAFrame", fFrame, "SendCloseMessage()");
791  break;
792  case kGLQuitROOT:
793  if (!gApplication->ReturnFromRun())
794  delete this;
796  break;
797  default:
798  break;
799  }
800  default:
801  break;
802  }
803  default:
804  break;
805  }
806 
807  return kTRUE;
808 }
809 
810 ////////////////////////////////////////////////////////////////////////////////
811 /// Toggle state of the 'Edit Object' menu entry.
812 
814 {
817  else
820 }
821 
822 ////////////////////////////////////////////////////////////////////////////////
823 /// Toggle state of the 'Ortho allow rotate' menu entry.
824 
826 {
829  else
838 }
839 
840 ////////////////////////////////////////////////////////////////////////////////
841 /// Toggle state of the 'Ortho allow dolly' menu entry.
842 
844 {
847  else
853 }
TGEventHandler * fEventHandler
select record from last overlay select
Definition: TGLViewer.h:119
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition: TGFrame.cxx:1172
void ToggleEditObject()
Toggle state of the &#39;Edit Object&#39; menu entry.
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
TGMenuBar * fMenuBar
Definition: TGLSAViewer.h:67
void SetRoot(TGWindow *root=0)
Sets the current root (i.e.
Definition: TGClient.cxx:242
TGLFormat * fFormat
Definition: TGLSAViewer.h:53
virtual void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0)
Move and/or resize the frame.
Definition: TGFrame.cxx:611
TGPopupMenu * fHelpMenu
Definition: TGLSAViewer.h:57
static const Int_t fgInitX
Definition: TGLSAViewer.h:80
void Reset()
Reset the timer.
Definition: TTimer.cxx:157
static const Int_t fgInitW
Definition: TGLSAViewer.h:82
Bool_t fOverwrite
Definition: TGFileDialog.h:65
static const Int_t fgInitH
Definition: TGLSAViewer.h:83
void MenuHidingTimeout()
Action for menu-hiding timeout.
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition: TGFrame.cxx:1746
R__EXTERN void * gTQSender
Definition: TQObject.h:45
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition: TGClient.cxx:222
REAL splitter
Definition: triangle.c:616
UInt_t GetHeight() const
Definition: TGFrame.h:272
TGLOrthoCamera fOrthoXnOZCamera
Definition: TGLViewer.h:94
TGLSAFrame * fFrame
Definition: TGLSAViewer.h:52
const Mask_t kLeaveWindowMask
Definition: GuiTypes.h:167
virtual void SetFrame(TGFrame *frame, Bool_t left)
Set frame to be resized.
Definition: TGSplitter.cxx:140
TGLOrthoCamera fOrthoXOZCamera
Definition: TGLViewer.h:91
TGLOrthoCamera fOrthoXOYCamera
Definition: TGLViewer.h:90
void ResetMenuHidingTimer(Bool_t show_menu)
Reset the timer for menu-bar hiding.
virtual void AddFirst(TObject *obj)
Add object at the beginning of the list.
Definition: TList.cxx:97
virtual Bool_t IsEntryChecked(Int_t id)
Return true if menu item is checked.
Definition: TGMenu.cxx:1835
virtual void UnCheckEntry(Int_t id)
Uncheck menu entry (i.e. remove check mark).
Definition: TGMenu.cxx:1797
#define gROOT
Definition: TROOT.h:375
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:587
Int_t fY
Definition: GuiTypes.h:177
Basic string class.
Definition: TString.h:129
#define gClient
Definition: TGClient.h:166
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:256
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition: TGFrame.cxx:1186
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const TGLPhysicalShape * GetSelected() const
Return selected physical shape.
Definition: TGLViewer.cxx:2063
TGButton * fMenuBut
Definition: TGLSAViewer.h:68
virtual void AddEntry(TGHotString *s, Int_t id, void *ud=0, const TGPicture *p=0, TGMenuEntry *before=0)
Add a menu entry.
Definition: TGMenu.cxx:987
virtual void Terminate(Int_t status=0)
Terminate the application by call TSystem::Exit() unless application has been told to return from Run...
Bool_t fDeleteMenuBar
Definition: TGLSAViewer.h:73
R__EXTERN TApplication * gApplication
Definition: TApplication.h:165
static std::string format(double x, double y, int digits, int width)
Bool_t fHideMenuBar
Definition: TGLSAViewer.h:69
UInt_t GetWidth() const
Definition: TGFrame.h:271
virtual void MapRaised()
Definition: TGFrame.h:252
Handle_t GetId() const
Definition: TGObject.h:48
virtual void AddSeparator(TGMenuEntry *before=0)
Add a menu separator to the menu.
Definition: TGMenu.cxx:1057
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1239
R__EXTERN const char gHelpAbout[]
Definition: HelpText.h:14
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
Definition: TGFrame.cxx:1131
void SetEnableRotate(Bool_t x)
Concrete physical shape - a GL drawable.
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
const Mask_t kPointerMotionMask
Definition: GuiTypes.h:162
void HandleMenuBarHiding(Event_t *ev)
Maybe switch menu-bar / menu-button.
const char ** fFileTypes
Definition: TGFileDialog.h:63
TGPopupMenu * fFileMenu
Definition: TGLSAViewer.h:54
TGLSAViewer(const TGLSAViewer &)
void SetEventHandler(TGEventHandler *eh)
Set event-handler. All events are passed to this object.
Definition: TGLWidget.cxx:558
TString fDirName
Definition: TGLSAViewer.h:64
void DeleteMenuBar()
Delete the menu bar.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition: TString.cxx:2231
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
Definition: TGFrame.cxx:294
virtual TList * GetList() const
Definition: TGFrame.h:369
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition: TGFrame.cxx:1814
TGCanvas * GetTGCanvas() const
Definition: TGedEditor.h:83
TVirtualPad * fPad
Definition: TGLViewer.h:80
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:49
void ToggleOrthoDolly()
Toggle state of the &#39;Ortho allow dolly&#39; menu entry.
Encapsulation of format / contents of an OpenGL buffer.
Definition: TGLFormat.h:35
const char * gGLSaveAsTypes[]
TGLWidget * fGLWidget
Definition: TGLViewer.h:185
static void SetMenuHidingTimeout(Long_t timeout)
Set global timeout for menu-hiding in mili-seconds.
The top level standalone GL-viewer - created via plugin manager.
Definition: TGLSAViewer.h:37
TGPopupMenu * fCameraMenu
Definition: TGLSAViewer.h:56
const Mask_t kKeyPressMask
Definition: GuiTypes.h:158
TGLPhysicalShape * fPShape
Definition: TGLPShapeObj.h:23
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:867
void RequestDraw(Short_t LOD=TGLRnrCtx::kLODMed)
Post request for redraw of viewer at level of detail &#39;LOD&#39; Request is directed via cross thread gVirt...
Definition: TGLViewer.cxx:436
TObject * GetExternal() const
void Close()
Close the viewer - destructed.
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:561
Bool_t fOverwrite
Definition: TGLSAViewer.h:66
void DisableCloseMenuEntries()
Deactivate menu entries for closing the GL window and exiting ROOT.
R__EXTERN TSystem * gSystem
Definition: TSystem.h:539
void Popup()
Show help dialog.
EGEventType fType
Definition: GuiTypes.h:174
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition: TGFrame.h:375
Int_t GET_SUBMSG(Long_t val)
virtual void CreateGLWidget()
Create a GLwidget, it is an error if it is already created.
TGCompositeFrame * fLeftVerticalFrame
Definition: TGLSAViewer.h:60
void EnableMenuBarHiding()
Enable hiding of menu bar.
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition: TList.cxx:679
virtual void Associate(const TGWindow *w)
Definition: TGMenu.h:219
const Mask_t kExposureMask
Definition: GuiTypes.h:164
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:873
Ssiz_t Length() const
Definition: TString.h:388
Bool_t ProcessFrameMessage(Long_t msg, Long_t parm1, Long_t)
Process GUI message capture by the main GUI frame (TGLSAFrame).
virtual void TurnOff()
Remove timer from system timer list.
Definition: TTimer.cxx:229
TGPopupMenu * fFileSaveMenu
Definition: TGLSAViewer.h:55
virtual TGMenuTitle * GetCurrent() const
Definition: TGMenu.h:348
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:51
void AddText(const char *helpText)
Add help text from helpText buffer to already existing text in TGTextView.
TTimer * fMenuHidingTimer
Definition: TGLSAViewer.h:70
virtual void SelectionChanged()
Update GUI components for embedded viewer selection change.
virtual Int_t Exec(const char *shellcmd)
Execute a command.
Definition: TSystem.cxx:660
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Definition: TGLViewer.h:53
TGClient * GetClient() const
Definition: TGObject.h:49
Standalone GL Viewer GUI main frame.
Definition: TGLSAFrame.h:28
~TGLSAViewer()
Destroy standalone viewer object.
#define gVirtualX
Definition: TVirtualX.h:350
char * StrDup(const char *str)
Duplicate the string str.
Definition: TString.cxx:2524
Int_t GET_MSG(Long_t val)
const Bool_t kFALSE
Definition: RtypesCore.h:92
void SetDollyToZoom(Bool_t x)
const Mask_t kEnterWindowMask
Definition: GuiTypes.h:166
long Long_t
Definition: RtypesCore.h:50
TGCompositeFrame * fRightVerticalFrame
Definition: TGLSAViewer.h:62
#define ClassImp(name)
Definition: Rtypes.h:336
double f(double x)
const Mask_t kStructureNotifyMask
Definition: GuiTypes.h:165
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
Definition: TGFrame.cxx:1054
friend class TGLEventHandler
Definition: TGLViewer.h:59
void CreateFrames()
Internal frames creation.
TGLOrthoCamera fOrthoXnOYCamera
Definition: TGLViewer.h:93
TGLOrthoCamera fOrthoZOYCamera
Definition: TGLViewer.h:92
TGLOrthoCamera fOrthoZnOYCamera
Definition: TGLViewer.h:95
Int_t fFileTypeIdx
Definition: TGFileDialog.h:64
char * fFilename
Definition: TGFileDialog.h:61
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
Definition: TQObject.cxx:1025
void SetCurrentCamera(ECameraType camera)
Set current active camera - &#39;cameraType&#39; one of: kCameraPerspX, kCameraPerspY, kCameraPerspZ, kCameraOrthoXOY, kCameraOrthoXOZ, kCameraOrthoZOY, kCameraOrthoXnOY, kCameraOrthoXnOZ, kCameraOrthoZnOY.
Definition: TGLViewer.cxx:1786
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
static const Int_t fgInitY
Definition: TGLSAViewer.h:81
void ToggleOrthoRotate()
Toggle state of the &#39;Ortho allow rotate&#39; menu entry.
virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event, Bool_t force=kFALSE)
Activate object editors according to the selected object.
Definition: TGedEditor.cxx:349
TGCompositeFrame * GetFrame() const
Return the main-frame.
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1146
Mother of all ROOT objects.
Definition: TObject.h:37
Int_t fTypeIdx
Definition: TGLSAViewer.h:65
virtual void UnmapWindow()
Definition: TGFrame.h:253
void SetWMPosition(Int_t x, Int_t y)
Give the window manager a window position hint.
Definition: TGFrame.cxx:1837
virtual void CheckEntry(Int_t id)
Check a menu entry (i.e. add a check mark in front of it).
Definition: TGMenu.cxx:1772
static Long_t fgMenuHidingTimeout
Definition: TGLSAViewer.h:75
Definition: file.py:1
virtual void MapWindow()
Definition: TGFrame.h:251
static const char * fgHelpText1
Definition: TGLSAViewer.h:85
const Mask_t kFocusChangeMask
Definition: GuiTypes.h:168
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition: TGClient.cxx:232
#define snprintf
Definition: civetweb.c:822
virtual void DeleteEntry(Int_t id)
Delete entry with specified id from menu.
Definition: TGMenu.cxx:1916
Bool_t fMenuHidingShowMenu
Definition: TGLSAViewer.h:71
void Show()
Show the viewer.
static const TString & GetBinDir()
Get the binary directory in the installation. Static utility function.
Definition: TROOT.cxx:2728
virtual void AddPopup(TGHotString *s, TGPopupMenu *popup, TGMenuEntry *before=0, const TGPicture *p=0)
Add a (cascading) popup menu to a popup menu.
Definition: TGMenu.cxx:1149
Bool_t ReturnFromRun() const
Definition: TApplication.h:148
virtual void DisconnectFromCanvas()
Disconnect this editor from the Selected signal of fCanvas.
Definition: TGedEditor.cxx:322
virtual void DeleteWindow()
Delete window.
Definition: TGFrame.cxx:258
void CreateMenus()
File/Camera/Help menus.
virtual void DestroyGLWidget()
Destroy the GLwidget, it is an error if it does not exist.
void SetMWMHints(UInt_t value, UInt_t funcs, UInt_t input)
Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
Definition: TGFrame.cxx:1824
TGedEditor * fGedEditor
event handler
Definition: TGLViewer.h:120
void DisableMenuBarHiding()
Disable hiding of menu bar.
virtual void TurnOn()
Add the timer to the system timer list.
Definition: TTimer.cxx:241
const Bool_t kTRUE
Definition: RtypesCore.h:91
static const char * fgHelpText2
Definition: TGLSAViewer.h:86
virtual void ChangeOptions(UInt_t options)
Change frame options. Options is an OR of the EFrameTypes.
Definition: TGFrame.cxx:303
Int_t fX
Definition: GuiTypes.h:177
virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=0)
Add popup menu to menu bar.
Definition: TGMenu.cxx:415
const TGLLogicalShape * GetLogical() const
Bool_t SavePicture()
Save current image using the default file name which can be set via SetPictureFileName() and defaults...
Definition: TGLViewer.cxx:781
char * fIniDir
Definition: TGFileDialog.h:62
TGLPShapeObj * fPShapeWrap
GED editor.
Definition: TGLViewer.h:121
void SetTime(Long_t milliSec)
Definition: TTimer.h:90