source: tags/before-XString-Modif/OpenGL/src/G4OpenGLXmViewer.cc @ 895

Last change on this file since 895 was 895, checked in by garnier, 16 years ago

tag

  • Property svn:mime-type set to text/cpp
File size: 20.4 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26//
27// $Id: G4OpenGLXmViewer.cc,v 1.24 2007/08/21 14:05:51 allison Exp $
28// GEANT4 tag $Name: HEAD $
29//
30//
31// Andrew Walkden  10th February 1997
32// G4OpenGLXmViewer : Class derived from G4OpenGLXViewer, to provide
33//                  (Motif) widget OpenGL functionality for GEANT4.
34
35#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
36
37#include "globals.hh"
38
39#include "G4OpenGLXmViewer.hh"
40
41#include "G4VisExtent.hh"
42#include "G4LogicalVolume.hh"
43#include "G4VSolid.hh"
44#include "G4Point3D.hh"
45#include "G4Normal3D.hh"
46
47#include "G4OpenGLXmSliderBar.hh"
48
49#include "G4Xt.hh"
50#include <X11/Shell.h>
51
52#include <sstream>
53
54void G4OpenGLXmViewer::ShowView () {
55
56  G4Xt::getInstance () -> SecondaryLoop ();
57
58}
59
60void G4OpenGLXmViewer::GetXmConnection () {
61 
62  G4Xt* interactorManager = G4Xt::getInstance ();
63  toplevel = (Widget)interactorManager->GetMainInteractor();
64  app      = XtWidgetToApplicationContext(toplevel);
65
66  if (!toplevel) {
67    fViewId = -1;  // This flags an error.
68    G4cerr << "G4OpenGLXmViewer::GetXmConnection unable to Initialize"
69      " application context." << G4endl;
70    return;
71  }
72
73  // Better to put this in an X11 resource file !!!
74  std::ostringstream oss;
75  oss <<
76    "*glxarea*width: " << fVP.GetWindowSizeHintX() << "\n"
77    "*glxarea*height: " << fVP.GetWindowSizeHintY() << "\n"
78    /*
79    // Tried this as a replacement for the above two lines, but
80    // sub-windows (rotation, etc.) came same size!!
81    "*geometry: " << fVP.GetXGeometryString() << "\n"
82    */
83    "*frame*x: 10\n"
84    "*frame*y: 10\n"
85    "*frame*topOffset: 10\n"
86    "*frame*bottomOffset: 10\n"
87    "*frame*rightOffset: 10\n"
88    "*frame*leftOffset: 10\n"
89    "*frame*shadowType: SHADOW_IN\n"
90    "*frame*useColorObj: False\n"
91    "*frame*primaryColorSetId: 3\n"
92    "*frame*secondaryColorSetId: 3\n"
93    "*menubar*useColorObj: False\n"
94    "*menubar*primaryColorSetId: 3\n"
95    "*menubar*secondaryColorSetId: 3\n"
96    "*toplevel*useColorObj: False\n"
97    "*toplevel*primaryColorSetId: 3\n"
98    "*toplevel*secondaryColorSetId: 3\n";
99  interactorManager->PutStringInResourceDatabase ((char*)oss.str().c_str());
100
101  //  interactorManager->AddSecondaryLoopPostAction ((G4SecondaryLoopAction)G4OpenGLXmViewerSecondaryLoopPostAction);
102 
103  shell = XtAppCreateShell ((String)fName.data(),(String)fName.data(),topLevelShellWidgetClass,XtDisplay(toplevel),NULL,0);
104  interactorManager->AddShell (shell);
105
106  dpy = XtDisplay (shell);
107
108  if (!dpy) {
109    fViewId = -1;  // This flags an error.
110    G4cerr << "G4OpenGLXmViewer::GetXmConnection unable to connect to display."
111         << G4endl;
112    return;
113  }
114
115  if (!glXQueryExtension (dpy, &errorBase, &eventBase)) {
116    fViewId = -1;  // This flags an error.
117    G4cerr << "G4OpenGLXmViewer::GetXmConnection. X Server has no GLX extension."
118         << G4endl;;
119    return;
120  }
121}
122
123void G4OpenGLXmViewer::CreateMainWindow () {
124
125  bgnd = XWhitePixelOfScreen (XtScreen(shell));
126  borcol = XBlackPixelOfScreen (XtScreen(shell));
127 
128  XtVaSetValues (shell,
129                 XtNvisual, vi -> visual,
130                 XtNdepth, vi -> depth,
131                 XtNcolormap, cmap,
132                 XtNborderColor, &borcol,
133                 XtNbackground, &bgnd,
134                 XmNtitle, fName.data(),
135                 NULL);
136
137  main_win = XtVaCreateManagedWidget ("main_win",
138                                      xmMainWindowWidgetClass,
139                                      shell,
140                                      XtNvisual, vi -> visual,
141                                      XtNdepth, vi -> depth,
142                                      XtNcolormap, cmap,
143                                      XtNborderColor, borcol,
144                                      XtNbackground, bgnd,
145                                      NULL);
146
147  //*********Create a menu bar for the window********
148  style_str = XmStringCreateLocalized ((char*)"Style");
149  actions_str = XmStringCreateLocalized ((char*)"Actions");
150  misc_str = XmStringCreateLocalized ((char*)"Miscellany");
151  spec_str = XmStringCreateLocalized ((char*)"Special");
152
153  menubar = XmVaCreateSimpleMenuBar (main_win,
154                                     (char*)"menubar",
155                                     XmVaCASCADEBUTTON, style_str, 'S',
156                                     XmVaCASCADEBUTTON, actions_str, 'A',
157                                     XmVaCASCADEBUTTON, misc_str, 'M',
158                                     XmVaCASCADEBUTTON, spec_str, 'p',
159                                     XtNvisual, vi -> visual,
160                                     XtNdepth, vi -> depth,
161                                     XtNcolormap, cmap,
162                                     XtNborderColor, borcol,
163                                     XtNbackground, bgnd,
164                                     NULL);
165
166  XmStringFree (style_str);
167  XmStringFree (actions_str);
168  XmStringFree (misc_str);
169  XmStringFree (spec_str);
170
171  G4cout << "Created menubar" << G4endl;
172
173
174  //*********Create style pulldown menu on menubar*********
175  rep_str = XmStringCreateLocalized ((char*)"Representation");
176  draw_str = XmStringCreateLocalized ((char*)"Drawing");
177  bgnd_str = XmStringCreateLocalized ((char*)"Background color");
178
179  style_cascade = XmVaCreateSimplePulldownMenu
180    (menubar,
181     (char*)"style",
182     0,
183     NULL,
184     XmVaCASCADEBUTTON, rep_str, 'R',
185     XmVaCASCADEBUTTON, draw_str, 'D',
186     XmVaCASCADEBUTTON, bgnd_str, 'B',
187     XtNvisual, vi -> visual,
188     XtNdepth, vi -> depth,
189     XtNcolormap, cmap,
190     XtNborderColor, borcol,
191     XtNbackground, bgnd,
192     NULL);
193 
194  XmStringFree (rep_str);
195  XmStringFree (draw_str);
196  XmStringFree (bgnd_str);
197
198  //  G4cout << "Created Style pulldown menu" << G4endl;
199
200  //Add Representation pullright menu to style cascade...
201  polyhedron_str = XmStringCreateLocalized ((char*)"Polyhedron");
202  nurbs_str = XmStringCreateLocalized ((char*)"NURBS");
203
204  rep_style_pullright = XmVaCreateSimplePulldownMenu
205    (style_cascade,
206     (char*)"rep_style",
207     0,
208     rep_style_callback,
209     XmVaRADIOBUTTON, polyhedron_str, 'P', NULL, NULL,
210     XmVaRADIOBUTTON, nurbs_str, 'N', NULL, NULL,
211     XmNradioBehavior, True,
212     XmNradioAlwaysOne, True,
213     XmNuserData, this,
214     XtNvisual, vi -> visual,
215     XtNdepth, vi -> depth,
216     XtNcolormap, cmap,
217     XtNborderColor, borcol,
218     XtNbackground, bgnd,
219     NULL);
220 
221  Widget special_widget;
222
223  G4ViewParameters::RepStyle style;
224  style = fVP.GetRepStyle();
225 
226  if (style == G4ViewParameters::polyhedron) {
227    special_widget = XtNameToWidget(rep_style_pullright, "button_0");
228    if(special_widget) {
229      XtVaSetValues (special_widget, XmNset, True, NULL);
230    }
231  } else if (style == G4ViewParameters::nurbs) {
232    special_widget = XtNameToWidget(rep_style_pullright, "button_1");
233    if(special_widget) {
234      XtVaSetValues (special_widget, XmNset, True, NULL);
235    }
236  } else {
237    G4Exception("Invalid Representation style in G4OpenGLXmViewer::CreateContext");
238  }
239  XmStringFree (polyhedron_str);
240  XmStringFree (nurbs_str);
241 
242  //  G4cout << "Created Representation pulldown menu" << G4endl;
243
244  //Add Drawing pullright menu to style cascade...
245  wireframe_str = XmStringCreateLocalized ((char*)"Wireframe");
246  hlr_str = XmStringCreateLocalized ((char*)"Hidden line removal");
247  hsr_str = XmStringCreateLocalized ((char*)"Hidden surface removal");
248  hlhsr_str = XmStringCreateLocalized ((char*)"Hidden line and surface removal");
249
250  drawing_style_pullright = XmVaCreateSimplePulldownMenu
251    (style_cascade,
252     (char*)"drawing_style",
253     1,
254     drawing_style_callback,
255     XmVaRADIOBUTTON, wireframe_str, 'W', NULL, NULL,
256     XmVaRADIOBUTTON, hlr_str, 'L', NULL, NULL,
257     XmVaRADIOBUTTON, hsr_str, 'S', NULL, NULL,
258     XmVaRADIOBUTTON, hlhsr_str, 'H', NULL, NULL,
259     XmNradioBehavior, True,
260     XmNradioAlwaysOne, True,
261     XmNuserData, this,
262     XtNvisual, vi -> visual,
263     XtNdepth, vi -> depth,
264     XtNcolormap, cmap,
265     XtNborderColor, borcol,
266     XtNbackground, bgnd,
267     NULL);
268 
269  G4ViewParameters::DrawingStyle d_style;
270  d_style = fVP.GetDrawingStyle();
271 
272  if (d_style == G4ViewParameters::wireframe) {
273    special_widget = XtNameToWidget(drawing_style_pullright, "button_0");
274    if(special_widget) {
275      XtVaSetValues (special_widget, XmNset, True, NULL);
276    }
277  } else if (d_style == G4ViewParameters::hlr) {
278    special_widget = XtNameToWidget(drawing_style_pullright, "button_1");
279    if(special_widget) {
280      XtVaSetValues (special_widget, XmNset, True, NULL);
281    }
282  } else if (d_style == G4ViewParameters::hsr) {
283    special_widget = XtNameToWidget(drawing_style_pullright, "button_2");
284    if(special_widget) {
285      XtVaSetValues (special_widget, XmNset, True, NULL);
286    }
287  } else if (d_style == G4ViewParameters::hlhsr) {
288    special_widget = XtNameToWidget(drawing_style_pullright, "button_3");
289    if(special_widget) {
290      XtVaSetValues (special_widget, XmNset, True, NULL);
291    }
292  } else {
293    G4Exception("Invalid Drawing style in G4OpenGLXmViewer::CreateContext");
294  }
295
296  XmStringFree (wireframe_str);
297  XmStringFree (hlr_str);
298  XmStringFree (hsr_str);
299  XmStringFree (hlhsr_str);
300
301  //  G4cout << "Created Drawing pullright menu" << G4endl;
302
303  //Add Drawing pullright menu to style cascade...
304  white_str = XmStringCreateLocalized ((char*)"White");
305  black_str = XmStringCreateLocalized ((char*)"Black");
306
307  background_color_pullright = XmVaCreateSimplePulldownMenu
308    (style_cascade,
309     (char*)"background_color",
310     2,
311     background_color_callback,
312     XmVaRADIOBUTTON, white_str, 'W', NULL, NULL,
313     XmVaRADIOBUTTON, black_str, 'B', NULL, NULL,
314     XmNradioBehavior, True,
315     XmNradioAlwaysOne, True,
316     XmNuserData, this,
317     XtNvisual, vi -> visual,
318     XtNdepth, vi -> depth,
319     XtNcolormap, cmap,
320     XtNborderColor, borcol,
321     XtNbackground, bgnd,
322     NULL);
323 
324  if (background.GetRed() == 1. &&
325      background.GetGreen() == 1. &&
326      background.GetBlue() == 1.) {
327    special_widget = XtNameToWidget(background_color_pullright, "button_0");
328    if(special_widget) {
329      XtVaSetValues (special_widget, XmNset, True, NULL);
330    }
331  } else {
332    special_widget = XtNameToWidget(background_color_pullright, "button_1");
333    if(special_widget) {
334      XtVaSetValues (special_widget, XmNset, True, NULL);
335    }
336  }
337
338  XmStringFree (white_str);
339  XmStringFree (black_str);
340
341  //  G4cout << "Created Background color pullright menu" << G4endl;
342
343  //*********Create actions pulldown menu on menubar*********
344  rot_str = XmStringCreateLocalized ((char*)"Rotation control panel");
345  pan_str = XmStringCreateLocalized ((char*)"Panning control panel");
346  set_str = XmStringCreateLocalized ((char*)"Set control panel limits");
347
348  actions_cascade = XmVaCreateSimplePulldownMenu
349    (menubar,
350     (char*)"actions",
351     1,
352     actions_callback,
353     XmVaPUSHBUTTON, rot_str, 'R', NULL, NULL,
354     XmVaPUSHBUTTON, pan_str, 'P', NULL, NULL,
355     XmVaPUSHBUTTON, set_str, 'S', NULL, NULL,
356     XmNuserData, this,
357     XtNvisual, vi -> visual,
358     XtNdepth, vi -> depth,
359     XtNcolormap, cmap,
360     XtNborderColor, borcol,
361     XtNbackground, bgnd,
362     NULL);
363 
364  XmStringFree (rot_str);
365  XmStringFree (pan_str);
366  XmStringFree (set_str);
367  G4cout << "Created Actions pulldown menu" << G4endl;
368
369  misc_str = XmStringCreateLocalized ((char*)"Miscellany control panel");
370  exit_str = XmStringCreateLocalized ((char*)"Exit to G4Vis>");
371  print_str = XmStringCreateLocalized ((char*)"Create .eps file");
372
373  //*********Create miscellany pulldown menu on menubar*********
374  misc_cascade = XmVaCreateSimplePulldownMenu
375    (menubar,
376     (char*)"miscellany",
377     2,
378     misc_callback,
379     XmVaPUSHBUTTON, misc_str, 'M', NULL, NULL,
380     XmVaPUSHBUTTON, exit_str, 'E', NULL, NULL,
381     XmVaPUSHBUTTON, print_str, 'P', NULL, NULL,
382     XmNuserData, this,
383     XtNvisual, vi -> visual,
384     XtNdepth, vi -> depth,
385     XtNcolormap, cmap,
386     XtNborderColor, borcol,
387     XtNbackground, bgnd,
388     NULL);
389 
390  XmStringFree (misc_str);
391  XmStringFree (exit_str);
392  XmStringFree (print_str);
393  G4cout << "Created Miscellany pulldown menu" << G4endl;
394
395  trans_str = XmStringCreateLocalized ((char*)"Transparency");
396  anti_str = XmStringCreateLocalized ((char*)"Antialiasing");
397  halo_str = XmStringCreateLocalized ((char*)"Haloing");
398  aux_edge_str = XmStringCreateLocalized ((char*)"Auxiliary edges");
399
400  //*********Create special pulldown menu on menubar*********
401  spec_cascade = XmVaCreateSimplePulldownMenu
402    (menubar,
403     (char*)"special",
404     3,
405     NULL,
406     XmVaCASCADEBUTTON, trans_str, 'T',
407     XmVaCASCADEBUTTON, anti_str, 'A',
408     XmVaCASCADEBUTTON, halo_str, 'H',
409     XmVaCASCADEBUTTON, aux_edge_str, 'E',
410     XtNvisual, vi -> visual,
411     XtNdepth, vi -> depth,
412     XtNcolormap, cmap,
413     XtNborderColor, borcol,
414     XtNbackground, bgnd,
415     NULL);
416 
417  XmStringFree (trans_str);
418  XmStringFree (anti_str);
419  XmStringFree (halo_str);
420  XmStringFree (aux_edge_str);
421
422  //  G4cout << "Created Special pulldown menu" << G4endl;
423
424  //Add Transparency pullright menu to special cascade...
425  off_str = XmStringCreateLocalized ((char*)"Off");
426  on_str = XmStringCreateLocalized ((char*)"On");
427
428  transparency_pullright = XmVaCreateSimplePulldownMenu
429    (spec_cascade,
430     (char*)"transparency",
431     0,
432     transparency_callback,
433     XmVaRADIOBUTTON, off_str, 'f', NULL, NULL,
434     XmVaRADIOBUTTON, on_str, 'n', NULL, NULL,
435     XmNradioBehavior, True,
436     XmNradioAlwaysOne, True,
437     XmNuserData, this,
438     XtNvisual, vi -> visual,
439     XtNdepth, vi -> depth,
440     XtNcolormap, cmap,
441     XtNborderColor, borcol,
442     XtNbackground, bgnd,
443     NULL);
444 
445  if (transparency_enabled == false) {
446    special_widget = XtNameToWidget(transparency_pullright, "button_0");
447    if(special_widget) {
448      XtVaSetValues (special_widget, XmNset, True, NULL);
449    }
450  } else if (transparency_enabled == true) {
451    special_widget = XtNameToWidget(transparency_pullright, "button_1");
452    if(special_widget) {
453      XtVaSetValues (special_widget, XmNset, True, NULL);
454    }
455  } else {
456    G4Exception("transparency_enabled in G4OpenGLXmViewer is neither true nor false!!");
457  }
458
459  //Add antialias pullright menu to special cascade...
460  antialias_pullright = XmVaCreateSimplePulldownMenu
461    (spec_cascade,
462     (char*)"antialias",
463     1,
464     antialias_callback,
465     XmVaRADIOBUTTON, off_str, 'f', NULL, NULL,
466     XmVaRADIOBUTTON, on_str, 'n', NULL, NULL,
467     XmNradioBehavior, True,
468     XmNradioAlwaysOne, True,
469     XmNuserData, this,
470     XtNvisual, vi -> visual,
471     XtNdepth, vi -> depth,
472     XtNcolormap, cmap,
473     XtNborderColor, borcol,
474     XtNbackground, bgnd,
475     NULL);
476 
477  if (antialiasing_enabled == false) {
478    special_widget = XtNameToWidget(antialias_pullright, "button_0");
479    if(special_widget) {
480      XtVaSetValues (special_widget, XmNset, True, NULL);
481    }
482  } else if (antialiasing_enabled == true) {
483    special_widget = XtNameToWidget(antialias_pullright, "button_1");
484    if(special_widget) {
485      XtVaSetValues (special_widget, XmNset, True, NULL);
486    }
487  } else {
488    G4Exception("antialiasing_enabled in G4OpenGLXmViewer is neither true nor false!!");
489  }
490
491  //Add Haloing pullright menu to special cascade...
492  haloing_pullright = XmVaCreateSimplePulldownMenu
493    (spec_cascade,
494     (char*)"haloing",
495     2,
496     haloing_callback,
497     XmVaRADIOBUTTON, off_str, 'f', NULL, NULL,
498     XmVaRADIOBUTTON, on_str, 'n', NULL, NULL,
499     XmNradioBehavior, True,
500     XmNradioAlwaysOne, True,
501     XmNuserData, this,
502     XtNvisual, vi -> visual,
503     XtNdepth, vi -> depth,
504     XtNcolormap, cmap,
505     XtNborderColor, borcol,
506     XtNbackground, bgnd,
507     NULL);
508 
509  if (haloing_enabled == false) {
510    special_widget = XtNameToWidget(haloing_pullright, "button_0");
511    if(special_widget) {
512      XtVaSetValues (special_widget, XmNset, True, NULL);
513    }
514  } else if (haloing_enabled == true) {
515    special_widget = XtNameToWidget(haloing_pullright, "button_1");
516    if(special_widget) {
517      XtVaSetValues (special_widget, XmNset, True, NULL);
518    }
519  } else {
520    G4Exception("haloing_enabled in G4OpenGLXmViewer is neither true nor false!!");
521  }
522
523  //Add Aux_Edge pullright menu to special cascade...
524  aux_edge_pullright = XmVaCreateSimplePulldownMenu
525    (spec_cascade,
526     (char*)"aux_edge",
527     3,
528     aux_edge_callback,
529     XmVaRADIOBUTTON, off_str, 'f', NULL, NULL,
530     XmVaRADIOBUTTON, on_str, 'n', NULL, NULL,
531     XmNradioBehavior, True,
532     XmNradioAlwaysOne, True,
533     XmNuserData, this,
534     XtNvisual, vi -> visual,
535     XtNdepth, vi -> depth,
536     XtNcolormap, cmap,
537     XtNborderColor, borcol,
538     XtNbackground, bgnd,
539     NULL);
540 
541  if (!fVP.IsAuxEdgeVisible()) {
542    special_widget = XtNameToWidget(aux_edge_pullright, "button_0");
543    if(special_widget) {
544      XtVaSetValues (special_widget, XmNset, True, NULL);
545    }
546  } else {
547    special_widget = XtNameToWidget(aux_edge_pullright, "button_1");
548    if(special_widget) {
549      XtVaSetValues (special_widget, XmNset, True, NULL);
550    }
551  }
552
553  XtManageChild (menubar);
554  frame = XtVaCreateManagedWidget ((char*)"frame",
555                                   xmFrameWidgetClass, main_win,
556                                   XtNvisual, vi -> visual,
557                                   XtNdepth, vi -> depth,
558                                   XtNcolormap, cmap,
559                                   XtNborderColor, borcol,
560                                   XtNbackground, bgnd,
561                                   NULL);
562
563  glxarea = XtVaCreateManagedWidget ((char*)"glxarea",
564                                     xmDrawingAreaWidgetClass,
565                                     frame,
566                                     XtNvisual, vi -> visual,
567                                     XtNdepth, vi -> depth,
568                                     XtNcolormap, cmap,
569                                     XtNborderColor, borcol,
570                                     XtNbackground, bgnd,
571                                     NULL);
572 
573  XtAddCallback (glxarea,
574                 XmNexposeCallback,
575                 expose_callback,
576                 this);
577
578  XtAddCallback (glxarea,
579                 XmNresizeCallback,
580                 resize_callback,
581                 this);
582
583  XmMainWindowSetAreas (main_win,  // main widget, children are specified
584                        menubar,   // widget to use as menu bar
585                        NULL,      // widget to use as command window
586                        NULL,      // widget for horizontal scroll bar
587                        NULL,      // widget for vertical scroll bar
588                        frame      // widget to be used for work window
589                        );
590
591  XtRealizeWidget(shell);
592 
593  // Once widget is realized (ie, associated with a created X window), we
594  // can bind the OpenGL rendering context to the window.
595
596  Dimension width, height;
597  XtVaGetValues (glxarea,XmNwidth,&width,XmNheight,&height,NULL);
598#ifdef G4DEBUG
599  printf("CreateWindow Size:%d - %d \n",width,height);
600#endif
601  WinSize_x = (G4int) width;
602  WinSize_y = (G4int) height;
603
604  win = XtWindow (glxarea);
605
606  glXMakeCurrent (dpy, win, cx);
607
608}
609
610G4OpenGLXmViewer::G4OpenGLXmViewer (G4OpenGLSceneHandler& scene):
611G4VViewer (scene, -1),
612G4OpenGLViewer (scene),
613G4OpenGLXViewer (scene),
614zoom_high (fVP.GetZoomFactor() * 10.0),
615zoom_low (fVP.GetZoomFactor() / 10.0),
616dolly_low (fVP.GetDolly() - 1000.0),
617dolly_high (fVP.GetDolly() + 1000.0),
618fov (0.0),
619rot_sens_limit (90.),
620pan_sens_limit (100.),
621rot_sens (1.),
622wob_sens (20.),
623original_vp(fVP.GetViewpointDirection()),
624frameNo (0),
625fprotation_top (0),
626fprotation_slider (0),
627fppanning_top (0),
628fppanning_slider (0),
629fpzoom_slider (0),
630fpdolly_slider (0),
631fpsetting_top (0),
632fpmiscellany_top (0),
633fpprint_top (0)
634{
635  WinSize_x = 100;
636  WinSize_y = 100;
637 
638  GetXmConnection ();
639  if (fViewId < 0) return;
640}
641
642G4OpenGLXmViewer::~G4OpenGLXmViewer ()
643{
644  XtDestroyWidget  (shell);
645  win = 0; // ...to avoid XDestroyWindow in G4OpenGLXViewer base class
646  // because XtDestroyWidget has already destroyed it.
647  G4Xt::getInstance () ->RemoveShell (shell);
648
649/******************************
650  if (fprotation_top) {
651    delete fprotation_top;
652  }
653
654  if (fppanning_top) {
655    delete fppanning_top;
656  }
657
658  if (fpsetting_top) {
659    delete fpsetting_top;
660  }
661
662  if (fpmiscellany_top) {
663    delete fpmiscellany_top;
664  }
665******************************/
666
667}
668
669#endif
Note: See TracBrowser for help on using the repository browser.