Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/visualization/OpenGL/src/G4OpenGLXmViewer.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /visualization/OpenGL/src/G4OpenGLXmViewer.cc (Version 11.3.0) and /visualization/OpenGL/src/G4OpenGLXmViewer.cc (Version 9.2.p4)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
                                                   >>  27 // $Id: G4OpenGLXmViewer.cc,v 1.24.6.1 2009/03/13 09:02:57 gcosmo Exp $
                                                   >>  28 // GEANT4 tag $Name: geant4-09-02-patch-04 $
 27 //                                                 29 //
 28 //                                                 30 // 
 29 // Andrew Walkden  10th February 1997              31 // Andrew Walkden  10th February 1997
 30 // G4OpenGLXmViewer : Class derived from G4Ope     32 // G4OpenGLXmViewer : Class derived from G4OpenGLXViewer, to provide
 31 //                  (Motif) widget OpenGL func     33 //                  (Motif) widget OpenGL functionality for GEANT4.
 32                                                    34 
                                                   >>  35 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER
                                                   >>  36 
 33 #include "globals.hh"                              37 #include "globals.hh"
 34                                                    38 
 35 #include "G4OpenGLXmViewer.hh"                     39 #include "G4OpenGLXmViewer.hh"
 36 #include "G4OpenGLSceneHandler.hh"             << 
 37                                                    40 
 38 #include "G4VisExtent.hh"                          41 #include "G4VisExtent.hh"
 39 #include "G4LogicalVolume.hh"                      42 #include "G4LogicalVolume.hh"
 40 #include "G4VSolid.hh"                             43 #include "G4VSolid.hh"
 41 #include "G4Point3D.hh"                            44 #include "G4Point3D.hh"
 42 #include "G4Normal3D.hh"                           45 #include "G4Normal3D.hh"
 43                                                    46 
 44 #include "G4Scene.hh"                          << 
 45                                                << 
 46 #include "G4OpenGLXmSliderBar.hh"                  47 #include "G4OpenGLXmSliderBar.hh"
 47 #include "G4OpenGLXmTextField.hh"              << 
 48                                                    48 
 49 #include "G4Xt.hh"                                 49 #include "G4Xt.hh"
 50 #include <X11/Shell.h>                             50 #include <X11/Shell.h>
 51 #include <Xm/MainW.h>                          << 
 52 #include <Xm/Frame.h>                          << 
 53 #include <Xm/DrawingA.h>                       << 
 54                                                    51 
 55 #include <sstream>                                 52 #include <sstream>
 56                                                    53 
 57 void G4OpenGLXmViewer::ShowView () {               54 void G4OpenGLXmViewer::ShowView () {
 58                                                    55 
 59 //  glXWaitGL (); //Wait for effects of all pr << 
 60                 //be propagated before progres << 
 61 // JA: Commented out July 2021 - slows renderi << 
 62 // don't see any adverse effects.              << 
 63                                                << 
 64   glFlush ();                                  << 
 65                                                << 
 66   G4Xt::getInstance () -> SecondaryLoop ();        56   G4Xt::getInstance () -> SecondaryLoop ();
 67                                                    57 
 68 }                                                  58 }
 69                                                    59 
 70 void G4OpenGLXmViewer::ResetView () {          << 
 71   // reset global parameters                   << 
 72   G4OpenGLViewer::ResetView();                 << 
 73                                                << 
 74   //reset Xm parameteres                       << 
 75   zoom_high  = fVP.GetZoomFactor() * 10.0;     << 
 76   zoom_low = fVP.GetZoomFactor() / 10.0;       << 
 77   rot_sens_limit = 90.;                        << 
 78   wob_low = 0.;                                << 
 79   wob_high = 50.;                              << 
 80   wob_sens = 20.;                              << 
 81                                                << 
 82   bool firstInit = true;                       << 
 83   if (GetSceneHandler() != NULL) {             << 
 84     if (GetSceneHandler()->GetScene() != NULL) << 
 85       firstInit = false;                       << 
 86     }                                          << 
 87   }                                            << 
 88   if (firstInit) {                             << 
 89     pan_sens_limit = 100.;                     << 
 90     fPan_sens = pan_sens_limit / 10.0;         << 
 91     dolly_low  = fVP.GetDolly() - 1000.0;      << 
 92     dolly_high = fVP.GetDolly() + 1000.0;      << 
 93   } else {                                     << 
 94     fPan_sens = GetSceneHandler()->GetScene()- << 
 95     pan_sens_limit = GetSceneHandler()->GetSce << 
 96                                                << 
 97     dolly_high = GetSceneHandler()->GetScene() << 
 98     dolly_low = -(GetSceneHandler()->GetScene( << 
 99   }                                            << 
100                                                << 
101   UpdateControlPanel ();                       << 
102                                                << 
103                                                << 
104   // FIXME : L.Garnier 12 Oct 2011             << 
105   // Has also to change the Camera/Object, but << 
106                                                << 
107 }                                              << 
108                                                << 
109                                                << 
110 void G4OpenGLXmViewer::GetXmConnection () {        60 void G4OpenGLXmViewer::GetXmConnection () {
111                                                    61   
112   G4Xt* interactorManager = G4Xt::getInstance      62   G4Xt* interactorManager = G4Xt::getInstance ();
113   toplevel = (Widget)interactorManager->GetMai     63   toplevel = (Widget)interactorManager->GetMainInteractor();
114   app      = XtWidgetToApplicationContext(topl     64   app      = XtWidgetToApplicationContext(toplevel);
115                                                    65 
116   if (!toplevel) {                                 66   if (!toplevel) {
117     fViewId = -1;  // This flags an error.         67     fViewId = -1;  // This flags an error.
118     G4cerr << "G4OpenGLXmViewer::GetXmConnecti     68     G4cerr << "G4OpenGLXmViewer::GetXmConnection unable to Initialize"
119       " application context." << G4endl;           69       " application context." << G4endl;
120     return;                                        70     return;
121   }                                                71   }
122                                                    72 
123   // Better to put this in an X11 resource fil     73   // Better to put this in an X11 resource file !!!
124   std::ostringstream oss;                          74   std::ostringstream oss;
125   oss <<                                           75   oss <<
126     "*glxarea*width: " << fVP.GetWindowSizeHin     76     "*glxarea*width: " << fVP.GetWindowSizeHintX() << "\n"
127     "*glxarea*height: " << fVP.GetWindowSizeHi     77     "*glxarea*height: " << fVP.GetWindowSizeHintY() << "\n"
128     /*                                             78     /*
129     // Tried this as a replacement for the abo     79     // Tried this as a replacement for the above two lines, but
130     // sub-windows (rotation, etc.) came same      80     // sub-windows (rotation, etc.) came same size!!
131     "*geometry: " << fVP.GetXGeometryString()      81     "*geometry: " << fVP.GetXGeometryString() << "\n"
132     */                                             82     */
133     "*frame*x: 10\n"                               83     "*frame*x: 10\n"
134     "*frame*y: 10\n"                               84     "*frame*y: 10\n"
135     "*frame*topOffset: 10\n"                       85     "*frame*topOffset: 10\n"
136     "*frame*bottomOffset: 10\n"                    86     "*frame*bottomOffset: 10\n"
137     "*frame*rightOffset: 10\n"                     87     "*frame*rightOffset: 10\n"
138     "*frame*leftOffset: 10\n"                      88     "*frame*leftOffset: 10\n"
139     "*frame*shadowType: SHADOW_IN\n"               89     "*frame*shadowType: SHADOW_IN\n"
140     "*frame*useColorObj: False\n"                  90     "*frame*useColorObj: False\n"
141     "*frame*primaryColorSetId: 3\n"                91     "*frame*primaryColorSetId: 3\n"
142     "*frame*secondaryColorSetId: 3\n"              92     "*frame*secondaryColorSetId: 3\n"
143     "*menubar*useColorObj: False\n"                93     "*menubar*useColorObj: False\n"
144     "*menubar*primaryColorSetId: 3\n"              94     "*menubar*primaryColorSetId: 3\n"
145     "*menubar*secondaryColorSetId: 3\n"            95     "*menubar*secondaryColorSetId: 3\n"
146     "*toplevel*useColorObj: False\n"               96     "*toplevel*useColorObj: False\n"
147     "*toplevel*primaryColorSetId: 3\n"             97     "*toplevel*primaryColorSetId: 3\n"
148     "*toplevel*secondaryColorSetId: 3\n";          98     "*toplevel*secondaryColorSetId: 3\n";
149   interactorManager->PutStringInResourceDataba     99   interactorManager->PutStringInResourceDatabase ((char*)oss.str().c_str());
150                                                   100 
151   //  interactorManager->AddSecondaryLoopPostA    101   //  interactorManager->AddSecondaryLoopPostAction ((G4SecondaryLoopAction)G4OpenGLXmViewerSecondaryLoopPostAction);
152                                                   102   
153   shell = XtAppCreateShell ((String)fName.data    103   shell = XtAppCreateShell ((String)fName.data(),(String)fName.data(),topLevelShellWidgetClass,XtDisplay(toplevel),NULL,0); 
154   interactorManager->AddShell (shell);            104   interactorManager->AddShell (shell);
155                                                   105 
156   dpy = XtDisplay (shell);                        106   dpy = XtDisplay (shell);
157                                                   107 
158   if (!dpy) {                                     108   if (!dpy) {
159     fViewId = -1;  // This flags an error.        109     fViewId = -1;  // This flags an error.
160     G4cerr << "G4OpenGLXmViewer::GetXmConnecti    110     G4cerr << "G4OpenGLXmViewer::GetXmConnection unable to connect to display."
161    << G4endl;                                     111    << G4endl;
162     return;                                       112     return;
163   }                                               113   }
164                                                   114 
165   if (!glXQueryExtension (dpy, &errorBase, &ev    115   if (!glXQueryExtension (dpy, &errorBase, &eventBase)) {
166     fViewId = -1;  // This flags an error.        116     fViewId = -1;  // This flags an error.
167     G4cerr << "G4OpenGLXmViewer::GetXmConnecti    117     G4cerr << "G4OpenGLXmViewer::GetXmConnection. X Server has no GLX extension."
168    << G4endl;;                                    118    << G4endl;;
169     return;                                       119     return;
170   }                                               120   }
171 }                                                 121 }
172                                                   122 
173 void G4OpenGLXmViewer::CreateMainWindow () {      123 void G4OpenGLXmViewer::CreateMainWindow () {
174                                                   124 
175   bgnd = XWhitePixelOfScreen (XtScreen(shell))    125   bgnd = XWhitePixelOfScreen (XtScreen(shell));
176   borcol = XBlackPixelOfScreen (XtScreen(shell    126   borcol = XBlackPixelOfScreen (XtScreen(shell));
177                                                   127   
178   ResizeWindow(fVP.GetWindowSizeHintX(),fVP.Ge << 128   fWinSize_x = fVP.GetWindowSizeHintX();
179                                                << 129   fWinSize_y = fVP.GetWindowSizeHintY();
180   G4int x_origin = fVP.GetWindowAbsoluteLocati    130   G4int x_origin = fVP.GetWindowAbsoluteLocationHintX(DisplayWidth(dpy, vi -> screen));
181                                                   131 
182   // FIXME,  screen size != window size on MAC    132   // FIXME,  screen size != window size on MAC, but I don't know have to get the menuBar
183   // size on MAC. L.Garnier 01/2009               133   // size on MAC. L.Garnier 01/2009
184   G4int y_origin = fVP.GetWindowAbsoluteLocati    134   G4int y_origin = fVP.GetWindowAbsoluteLocationHintY(DisplayHeight(dpy, vi -> screen));
185                                                   135 
186   if (fVP.IsWindowSizeHintX () && fVP.IsWindow    136   if (fVP.IsWindowSizeHintX () && fVP.IsWindowLocationHintX () && fVP.IsWindowLocationHintY ()) {
187     XtVaSetValues (shell,                         137     XtVaSetValues (shell, 
188                    XtNvisual, vi -> visual,       138                    XtNvisual, vi -> visual, 
189                    XtNdepth, vi -> depth,         139                    XtNdepth, vi -> depth,
190                    XtNcolormap, cmap,             140                    XtNcolormap, cmap, 
191                    XtNwidth, getWinWidth(),    << 141                    XtNwidth, fWinSize_x,
192                    XtNheight, getWinHeight(),  << 142                    XtNheight, fWinSize_y,
193                    XtNx, x_origin,                143                    XtNx, x_origin,
194                    XtNy, y_origin,                144                    XtNy, y_origin,
195                    XtNborderColor, &borcol,       145                    XtNborderColor, &borcol,
196                    XtNbackground, &bgnd,          146                    XtNbackground, &bgnd,
197                    XmNtitle, fName.data(),        147                    XmNtitle, fName.data(),
198                    NULL);                         148                    NULL);
199   } else if (fVP.IsWindowSizeHintX () && !(fVP    149   } else if (fVP.IsWindowSizeHintX () && !(fVP.IsWindowLocationHintX () || fVP.IsWindowLocationHintY ())) {
200     XtVaSetValues (shell,                         150     XtVaSetValues (shell, 
201                    XtNvisual, vi -> visual,       151                    XtNvisual, vi -> visual, 
202                    XtNdepth, vi -> depth,         152                    XtNdepth, vi -> depth,
203                    XtNcolormap, cmap,             153                    XtNcolormap, cmap, 
204                    XtNwidth, getWinWidth(),    << 154                    XtNwidth, fWinSize_x,
205                    XtNheight, getWinHeight(),  << 155                    XtNheight, fWinSize_y,
206                    XtNborderColor, &borcol,       156                    XtNborderColor, &borcol,
207                    XtNbackground, &bgnd,          157                    XtNbackground, &bgnd,
208                    XmNtitle, fName.data(),        158                    XmNtitle, fName.data(),
209                    NULL);                         159                    NULL);
210   } else if ((!fVP.IsWindowSizeHintX ()) && fV    160   } else if ((!fVP.IsWindowSizeHintX ()) && fVP.IsWindowLocationHintX () && fVP.IsWindowLocationHintY ()) {
211     XtVaSetValues (shell,                         161     XtVaSetValues (shell, 
212                    XtNvisual, vi -> visual,       162                    XtNvisual, vi -> visual, 
213                    XtNdepth, vi -> depth,         163                    XtNdepth, vi -> depth,
214                    XtNcolormap, cmap,             164                    XtNcolormap, cmap, 
215                    XtNx, x_origin,                165                    XtNx, x_origin,
216                    XtNy, y_origin,                166                    XtNy, y_origin,
217                    XtNborderColor, &borcol,       167                    XtNborderColor, &borcol,
218                    XtNbackground, &bgnd,          168                    XtNbackground, &bgnd,
219                    XmNtitle, fName.data(),        169                    XmNtitle, fName.data(),
220                    NULL);                         170                    NULL);
221   } else {                                        171   } else {
222     XtVaSetValues (shell,                         172     XtVaSetValues (shell, 
223                    XtNvisual, vi -> visual,       173                    XtNvisual, vi -> visual, 
224                    XtNdepth, vi -> depth,         174                    XtNdepth, vi -> depth,
225                    XtNcolormap, cmap,             175                    XtNcolormap, cmap, 
226                    XtNborderColor, &borcol,       176                    XtNborderColor, &borcol,
227                    XtNbackground, &bgnd,          177                    XtNbackground, &bgnd,
228                    XmNtitle, fName.data(),        178                    XmNtitle, fName.data(),
229                    NULL);                         179                    NULL);
230   }                                               180   }
231                                                   181 
232                                                   182 
233   main_win = XtVaCreateManagedWidget ("main_wi    183   main_win = XtVaCreateManagedWidget ("main_win", 
234               xmMainWindowWidgetClass,            184               xmMainWindowWidgetClass,
235               shell,                              185               shell,
236               XtNvisual, vi -> visual,            186               XtNvisual, vi -> visual, 
237               XtNdepth, vi -> depth,              187               XtNdepth, vi -> depth, 
238               XtNcolormap, cmap,                  188               XtNcolormap, cmap, 
239               XtNborderColor, borcol,             189               XtNborderColor, borcol,
240               XtNbackground, bgnd,                190               XtNbackground, bgnd,
241               NULL);                              191               NULL);
242                                                   192 
243   //*********Create a menu bar for the window*    193   //*********Create a menu bar for the window********
244   style_str = XmStringCreateLocalized ((char*) << 194   style_str = XmStringCreateLocalized ((char*)"Style");
245   actions_str = XmStringCreateLocalized ((char << 195   actions_str = XmStringCreateLocalized ((char*)"Actions");
246   misc_str = XmStringCreateLocalized ((char*)m << 196   misc_str = XmStringCreateLocalized ((char*)"Miscellany");
247   spec_str = XmStringCreateLocalized ((char*)m << 197   spec_str = XmStringCreateLocalized ((char*)"Special");
248                                                   198 
249   menubar = XmVaCreateSimpleMenuBar (main_win,    199   menubar = XmVaCreateSimpleMenuBar (main_win,
250              (char*)menu_str[8].c_str(),       << 200              (char*)"menubar",
251              XmVaCASCADEBUTTON, style_str,   ( << 201              XmVaCASCADEBUTTON, style_str, 'S',
252              XmVaCASCADEBUTTON, actions_str, ( << 202              XmVaCASCADEBUTTON, actions_str, 'A',
253              XmVaCASCADEBUTTON, misc_str,    ( << 203              XmVaCASCADEBUTTON, misc_str, 'M',
254              XmVaCASCADEBUTTON, spec_str,    ( << 204              XmVaCASCADEBUTTON, spec_str, 'p',
255              XtNvisual, vi -> visual,             205              XtNvisual, vi -> visual, 
256              XtNdepth, vi -> depth,               206              XtNdepth, vi -> depth, 
257              XtNcolormap, cmap,                   207              XtNcolormap, cmap, 
258              XtNborderColor, borcol,              208              XtNborderColor, borcol,
259              XtNbackground, bgnd,                 209              XtNbackground, bgnd,
260              NULL);                               210              NULL);
261                                                   211 
262   XmStringFree (style_str);                       212   XmStringFree (style_str);
263   XmStringFree (actions_str);                     213   XmStringFree (actions_str);
264   XmStringFree (misc_str);                        214   XmStringFree (misc_str);
265   XmStringFree (spec_str);                        215   XmStringFree (spec_str);
266                                                   216 
267   G4cout << "Created menubar" << G4endl;          217   G4cout << "Created menubar" << G4endl;
268                                                   218 
269                                                   219 
270   //*********Create style pulldown menu on men    220   //*********Create style pulldown menu on menubar*********
271   draw_str = XmStringCreateLocalized ((char*)m << 221   rep_str = XmStringCreateLocalized ((char*)"Representation");
272   bgnd_str = XmStringCreateLocalized ((char*)m << 222   draw_str = XmStringCreateLocalized ((char*)"Drawing");
                                                   >> 223   bgnd_str = XmStringCreateLocalized ((char*)"Background color");
273                                                   224 
274   style_cascade = XmVaCreateSimplePulldownMenu    225   style_cascade = XmVaCreateSimplePulldownMenu
275     (menubar,                                     226     (menubar,
276      (char*)menu_str[1].c_str(),               << 227      (char*)"style",
277      0,                                           228      0,
278      NULL,                                        229      NULL,
279      XmVaCASCADEBUTTON, draw_str, (KeySym)XK_D << 230      XmVaCASCADEBUTTON, rep_str, 'R',
280      XmVaCASCADEBUTTON, bgnd_str, (KeySym)XK_B << 231      XmVaCASCADEBUTTON, draw_str, 'D',
                                                   >> 232      XmVaCASCADEBUTTON, bgnd_str, 'B',
281      XtNvisual, vi -> visual,                     233      XtNvisual, vi -> visual, 
282      XtNdepth, vi -> depth,                       234      XtNdepth, vi -> depth, 
283      XtNcolormap, cmap,                           235      XtNcolormap, cmap, 
284      XtNborderColor, borcol,                      236      XtNborderColor, borcol,
285      XtNbackground, bgnd,                         237      XtNbackground, bgnd,
286      NULL);                                       238      NULL);
287                                                   239   
                                                   >> 240   XmStringFree (rep_str);
288   XmStringFree (draw_str);                        241   XmStringFree (draw_str);
289   XmStringFree (bgnd_str);                        242   XmStringFree (bgnd_str);
290                                                   243 
291   //  G4cout << "Created Style pulldown menu"     244   //  G4cout << "Created Style pulldown menu" << G4endl;
292                                                   245 
                                                   >> 246   //Add Representation pullright menu to style cascade...
                                                   >> 247   polyhedron_str = XmStringCreateLocalized ((char*)"Polyhedron");
                                                   >> 248   nurbs_str = XmStringCreateLocalized ((char*)"NURBS");
                                                   >> 249 
                                                   >> 250   rep_style_pullright = XmVaCreateSimplePulldownMenu 
                                                   >> 251     (style_cascade,
                                                   >> 252      (char*)"rep_style",
                                                   >> 253      0,
                                                   >> 254      rep_style_callback,
                                                   >> 255      XmVaRADIOBUTTON, polyhedron_str, 'P', NULL, NULL,
                                                   >> 256      XmVaRADIOBUTTON, nurbs_str, 'N', NULL, NULL,
                                                   >> 257      XmNradioBehavior, True, 
                                                   >> 258      XmNradioAlwaysOne, True, 
                                                   >> 259      XmNuserData, this, 
                                                   >> 260      XtNvisual, vi -> visual, 
                                                   >> 261      XtNdepth, vi -> depth, 
                                                   >> 262      XtNcolormap, cmap, 
                                                   >> 263      XtNborderColor, borcol,
                                                   >> 264      XtNbackground, bgnd,
                                                   >> 265      NULL);
                                                   >> 266   
                                                   >> 267   Widget special_widget;
                                                   >> 268 
                                                   >> 269   G4ViewParameters::RepStyle style;
                                                   >> 270   style = fVP.GetRepStyle();
                                                   >> 271   
                                                   >> 272   if (style == G4ViewParameters::polyhedron) {
                                                   >> 273     special_widget = XtNameToWidget(rep_style_pullright, "button_0");
                                                   >> 274     if(special_widget) {
                                                   >> 275       XtVaSetValues (special_widget, XmNset, True, NULL);
                                                   >> 276     }
                                                   >> 277   } else if (style == G4ViewParameters::nurbs) {
                                                   >> 278     special_widget = XtNameToWidget(rep_style_pullright, "button_1");
                                                   >> 279     if(special_widget) {
                                                   >> 280       XtVaSetValues (special_widget, XmNset, True, NULL);
                                                   >> 281     }
                                                   >> 282   } else {
                                                   >> 283     G4Exception("Invalid Representation style in G4OpenGLXmViewer::CreateContext");
                                                   >> 284   }
                                                   >> 285   XmStringFree (polyhedron_str);
                                                   >> 286   XmStringFree (nurbs_str);
                                                   >> 287   
                                                   >> 288   //  G4cout << "Created Representation pulldown menu" << G4endl;
                                                   >> 289 
293   //Add Drawing pullright menu to style cascad    290   //Add Drawing pullright menu to style cascade...
294   wireframe_str = XmStringCreateLocalized ((ch << 291   wireframe_str = XmStringCreateLocalized ((char*)"Wireframe");
295   hlr_str = XmStringCreateLocalized ((char*)me << 292   hlr_str = XmStringCreateLocalized ((char*)"Hidden line removal");
296   hsr_str = XmStringCreateLocalized ((char*)me << 293   hsr_str = XmStringCreateLocalized ((char*)"Hidden surface removal");
297   hlhsr_str = XmStringCreateLocalized ((char*) << 294   hlhsr_str = XmStringCreateLocalized ((char*)"Hidden line and surface removal");
298                                                   295 
299   drawing_style_pullright = XmVaCreateSimplePu    296   drawing_style_pullright = XmVaCreateSimplePulldownMenu 
300     (style_cascade,                               297     (style_cascade,
301      (char*)menu_str[15].c_str(),              << 298      (char*)"drawing_style",
302      1,                                           299      1,
303      drawing_style_callback,                      300      drawing_style_callback,
304      XmVaRADIOBUTTON, wireframe_str, (KeySym)X << 301      XmVaRADIOBUTTON, wireframe_str, 'W', NULL, NULL,
305      XmVaRADIOBUTTON, hlr_str,       (KeySym)X << 302      XmVaRADIOBUTTON, hlr_str, 'L', NULL, NULL,
306      XmVaRADIOBUTTON, hsr_str,       (KeySym)X << 303      XmVaRADIOBUTTON, hsr_str, 'S', NULL, NULL,
307      XmVaRADIOBUTTON, hlhsr_str,     (KeySym)X << 304      XmVaRADIOBUTTON, hlhsr_str, 'H', NULL, NULL,
308      XmNradioBehavior, True,                      305      XmNradioBehavior, True, 
309      XmNradioAlwaysOne, True,                     306      XmNradioAlwaysOne, True, 
310      XmNuserData, this,                           307      XmNuserData, this,
311      XtNvisual, vi -> visual,                     308      XtNvisual, vi -> visual, 
312      XtNdepth, vi -> depth,                       309      XtNdepth, vi -> depth, 
313      XtNcolormap, cmap,                           310      XtNcolormap, cmap, 
314      XtNborderColor, borcol,                      311      XtNborderColor, borcol,
315      XtNbackground, bgnd,                         312      XtNbackground, bgnd,
316      NULL);                                       313      NULL);
317                                                   314   
318   Widget special_widget;                       << 
319                                                << 
320   G4ViewParameters::DrawingStyle d_style;         315   G4ViewParameters::DrawingStyle d_style;
321   d_style = fVP.GetDrawingStyle();                316   d_style = fVP.GetDrawingStyle();
322                                                   317   
323   if (d_style == G4ViewParameters::wireframe)     318   if (d_style == G4ViewParameters::wireframe) {
324     special_widget = XtNameToWidget(drawing_st    319     special_widget = XtNameToWidget(drawing_style_pullright, "button_0");
325     if(special_widget) {                          320     if(special_widget) {
326       XtVaSetValues (special_widget, XmNset, T    321       XtVaSetValues (special_widget, XmNset, True, NULL);
327     }                                             322     }
328   } else if (d_style == G4ViewParameters::hlr)    323   } else if (d_style == G4ViewParameters::hlr) {
329     special_widget = XtNameToWidget(drawing_st    324     special_widget = XtNameToWidget(drawing_style_pullright, "button_1");
330     if(special_widget) {                          325     if(special_widget) {
331       XtVaSetValues (special_widget, XmNset, T    326       XtVaSetValues (special_widget, XmNset, True, NULL);
332     }                                             327     }
333   } else if (d_style == G4ViewParameters::hsr)    328   } else if (d_style == G4ViewParameters::hsr) {
334     special_widget = XtNameToWidget(drawing_st    329     special_widget = XtNameToWidget(drawing_style_pullright, "button_2");
335     if(special_widget) {                          330     if(special_widget) {
336       XtVaSetValues (special_widget, XmNset, T    331       XtVaSetValues (special_widget, XmNset, True, NULL);
337     }                                             332     }
338   } else if (d_style == G4ViewParameters::hlhs    333   } else if (d_style == G4ViewParameters::hlhsr) {
339     special_widget = XtNameToWidget(drawing_st    334     special_widget = XtNameToWidget(drawing_style_pullright, "button_3");
340     if(special_widget) {                          335     if(special_widget) {
341       XtVaSetValues (special_widget, XmNset, T    336       XtVaSetValues (special_widget, XmNset, True, NULL);
342     }                                             337     }
343   } else {                                        338   } else {
344     G4Exception                                << 339     G4Exception("Invalid Drawing style in G4OpenGLXmViewer::CreateContext");
345       ("G4OpenGLXmViewer::CreateMainWindow",   << 
346        "opengl2015", FatalException,           << 
347        "Invalid Drawing style in G4OpenGLXmVie << 
348   }                                               340   }
349                                                   341 
350   XmStringFree (wireframe_str);                   342   XmStringFree (wireframe_str);
351   XmStringFree (hlr_str);                         343   XmStringFree (hlr_str);
352   XmStringFree (hsr_str);                         344   XmStringFree (hsr_str);
353   XmStringFree (hlhsr_str);                       345   XmStringFree (hlhsr_str);
354                                                   346 
355   //  G4cout << "Created Drawing pullright men    347   //  G4cout << "Created Drawing pullright menu" << G4endl;
356                                                   348 
357   //Add Drawing pullright menu to style cascad    349   //Add Drawing pullright menu to style cascade...
358   white_str = XmStringCreateLocalized ((char*) << 350   white_str = XmStringCreateLocalized ((char*)"White");
359   black_str = XmStringCreateLocalized ((char*) << 351   black_str = XmStringCreateLocalized ((char*)"Black");
360                                                   352 
361   background_color_pullright = XmVaCreateSimpl    353   background_color_pullright = XmVaCreateSimplePulldownMenu 
362     (style_cascade,                               354     (style_cascade,
363      (char*)menu_str[18].c_str(),              << 355      (char*)"background_color",
364      2,                                           356      2,
365      background_color_callback,                   357      background_color_callback,
366      XmVaRADIOBUTTON, white_str, (KeySym)XK_W, << 358      XmVaRADIOBUTTON, white_str, 'W', NULL, NULL,
367      XmVaRADIOBUTTON, black_str, (KeySym)XK_B, << 359      XmVaRADIOBUTTON, black_str, 'B', NULL, NULL,
368      XmNradioBehavior, True,                      360      XmNradioBehavior, True, 
369      XmNradioAlwaysOne, True,                     361      XmNradioAlwaysOne, True, 
370      XmNuserData, this,                           362      XmNuserData, this,
371      XtNvisual, vi -> visual,                     363      XtNvisual, vi -> visual, 
372      XtNdepth, vi -> depth,                       364      XtNdepth, vi -> depth, 
373      XtNcolormap, cmap,                           365      XtNcolormap, cmap, 
374      XtNborderColor, borcol,                      366      XtNborderColor, borcol,
375      XtNbackground, bgnd,                         367      XtNbackground, bgnd,
376      NULL);                                       368      NULL);
377                                                   369   
378   if (background.GetRed() == 1. &&                370   if (background.GetRed() == 1. &&
379       background.GetGreen() == 1. &&              371       background.GetGreen() == 1. &&
380       background.GetBlue() == 1.) {               372       background.GetBlue() == 1.) {
381     special_widget = XtNameToWidget(background    373     special_widget = XtNameToWidget(background_color_pullright, "button_0");
382     if(special_widget) {                          374     if(special_widget) {
383       XtVaSetValues (special_widget, XmNset, T    375       XtVaSetValues (special_widget, XmNset, True, NULL);
384     }                                             376     }
385   } else {                                        377   } else {
386     special_widget = XtNameToWidget(background    378     special_widget = XtNameToWidget(background_color_pullright, "button_1");
387     if(special_widget) {                          379     if(special_widget) {
388       XtVaSetValues (special_widget, XmNset, T    380       XtVaSetValues (special_widget, XmNset, True, NULL);
389     }                                             381     }
390   }                                               382   }
391                                                   383 
392   XmStringFree (white_str);                       384   XmStringFree (white_str);
393   XmStringFree (black_str);                       385   XmStringFree (black_str);
394                                                   386 
395   //  G4cout << "Created Background color pull    387   //  G4cout << "Created Background color pullright menu" << G4endl;
396                                                   388 
397   //*********Create actions pulldown menu on m    389   //*********Create actions pulldown menu on menubar*********
398   rot_str = XmStringCreateLocalized ((char*)me << 390   rot_str = XmStringCreateLocalized ((char*)"Rotation control panel");
399   pan_str = XmStringCreateLocalized ((char*)me << 391   pan_str = XmStringCreateLocalized ((char*)"Panning control panel");
400   set_str = XmStringCreateLocalized ((char*)me << 392   set_str = XmStringCreateLocalized ((char*)"Set control panel limits");
401                                                   393 
402   actions_cascade = XmVaCreateSimplePulldownMe    394   actions_cascade = XmVaCreateSimplePulldownMenu
403     (menubar,                                     395     (menubar,
404      (char*)menu_str[3].c_str(),               << 396      (char*)"actions",
405      1,                                           397      1,
406      actions_callback,                            398      actions_callback,
407      XmVaPUSHBUTTON, rot_str, (KeySym)XK_R, NU << 399      XmVaPUSHBUTTON, rot_str, 'R', NULL, NULL,
408      XmVaPUSHBUTTON, pan_str, (KeySym)XK_P, NU << 400      XmVaPUSHBUTTON, pan_str, 'P', NULL, NULL,
409      XmVaPUSHBUTTON, set_str, (KeySym)XK_S, NU << 401      XmVaPUSHBUTTON, set_str, 'S', NULL, NULL,
410      XmNuserData, this,                           402      XmNuserData, this, 
411      XtNvisual, vi -> visual,                     403      XtNvisual, vi -> visual, 
412      XtNdepth, vi -> depth,                       404      XtNdepth, vi -> depth, 
413      XtNcolormap, cmap,                           405      XtNcolormap, cmap, 
414      XtNborderColor, borcol,                      406      XtNborderColor, borcol,
415      XtNbackground, bgnd,                         407      XtNbackground, bgnd,
416      NULL);                                       408      NULL);
417                                                   409   
418   XmStringFree (rot_str);                         410   XmStringFree (rot_str);
419   XmStringFree (pan_str);                         411   XmStringFree (pan_str);
420   XmStringFree (set_str);                         412   XmStringFree (set_str);
421   G4cout << "Created Actions pulldown menu" <<    413   G4cout << "Created Actions pulldown menu" << G4endl;
422                                                   414 
423   misc_str = XmStringCreateLocalized ((char*)m << 415   misc_str = XmStringCreateLocalized ((char*)"Miscellany control panel");
424   exit_str = XmStringCreateLocalized ((char*)m << 416   exit_str = XmStringCreateLocalized ((char*)"Exit to G4Vis>");
425   print_str = XmStringCreateLocalized ((char*) << 417   print_str = XmStringCreateLocalized ((char*)"Create .eps file");
426                                                   418 
427   //*********Create miscellany pulldown menu o    419   //*********Create miscellany pulldown menu on menubar*********
428   misc_cascade = XmVaCreateSimplePulldownMenu     420   misc_cascade = XmVaCreateSimplePulldownMenu
429     (menubar,                                     421     (menubar,
430      (char*)menu_str[5].c_str(),               << 422      (char*)"miscellany",
431      2,                                           423      2,
432      misc_callback,                               424      misc_callback,
433      XmVaPUSHBUTTON, misc_str,  (KeySym)XK_M,  << 425      XmVaPUSHBUTTON, misc_str, 'M', NULL, NULL,
434      XmVaPUSHBUTTON, exit_str,  (KeySym)XK_E,  << 426      XmVaPUSHBUTTON, exit_str, 'E', NULL, NULL,
435      XmVaPUSHBUTTON, print_str, (KeySym)XK_P,  << 427      XmVaPUSHBUTTON, print_str, 'P', NULL, NULL,
436      XmNuserData, this,                           428      XmNuserData, this,
437      XtNvisual, vi -> visual,                     429      XtNvisual, vi -> visual, 
438      XtNdepth, vi -> depth,                       430      XtNdepth, vi -> depth, 
439      XtNcolormap, cmap,                           431      XtNcolormap, cmap, 
440      XtNborderColor, borcol,                      432      XtNborderColor, borcol,
441      XtNbackground, bgnd,                         433      XtNbackground, bgnd,
442      NULL);                                       434      NULL);
443                                                   435   
444   XmStringFree (misc_str);                        436   XmStringFree (misc_str);
445   XmStringFree (exit_str);                        437   XmStringFree (exit_str);
446   XmStringFree (print_str);                       438   XmStringFree (print_str);
447   G4cout << "Created Miscellany pulldown menu"    439   G4cout << "Created Miscellany pulldown menu" << G4endl;
448                                                   440 
449   trans_str = XmStringCreateLocalized ((char*) << 441   trans_str = XmStringCreateLocalized ((char*)"Transparency");
450   anti_str = XmStringCreateLocalized ((char*)m << 442   anti_str = XmStringCreateLocalized ((char*)"Antialiasing");
451   halo_str = XmStringCreateLocalized ((char*)m << 443   halo_str = XmStringCreateLocalized ((char*)"Haloing");
452   aux_edge_str = XmStringCreateLocalized ((cha << 444   aux_edge_str = XmStringCreateLocalized ((char*)"Auxiliary edges");
453                                                   445 
454   //*********Create special pulldown menu on m    446   //*********Create special pulldown menu on menubar*********
455   spec_cascade = XmVaCreateSimplePulldownMenu     447   spec_cascade = XmVaCreateSimplePulldownMenu
456     (menubar,                                     448     (menubar,
457      (char*)menu_str[7].c_str(),               << 449      (char*)"special",
458      3,                                           450      3,
459      NULL,                                        451      NULL,
460      XmVaCASCADEBUTTON, trans_str,    (KeySym) << 452      XmVaCASCADEBUTTON, trans_str, 'T',
461      XmVaCASCADEBUTTON, anti_str,     (KeySym) << 453      XmVaCASCADEBUTTON, anti_str, 'A',
462      XmVaCASCADEBUTTON, halo_str,     (KeySym) << 454      XmVaCASCADEBUTTON, halo_str, 'H',
463      XmVaCASCADEBUTTON, aux_edge_str, (KeySym) << 455      XmVaCASCADEBUTTON, aux_edge_str, 'E',
464      XtNvisual, vi -> visual,                     456      XtNvisual, vi -> visual, 
465      XtNdepth, vi -> depth,                       457      XtNdepth, vi -> depth, 
466      XtNcolormap, cmap,                           458      XtNcolormap, cmap, 
467      XtNborderColor, borcol,                      459      XtNborderColor, borcol,
468      XtNbackground, bgnd,                         460      XtNbackground, bgnd,
469      NULL);                                       461      NULL);
470                                                   462   
471   XmStringFree (trans_str);                       463   XmStringFree (trans_str);
472   XmStringFree (anti_str);                        464   XmStringFree (anti_str);
473   XmStringFree (halo_str);                        465   XmStringFree (halo_str);
474   XmStringFree (aux_edge_str);                    466   XmStringFree (aux_edge_str);
475                                                   467 
476   //  G4cout << "Created Special pulldown menu    468   //  G4cout << "Created Special pulldown menu" << G4endl;
477                                                   469 
478   //Add Transparency pullright menu to special    470   //Add Transparency pullright menu to special cascade...
479   off_str = XmStringCreateLocalized ((char*)me << 471   off_str = XmStringCreateLocalized ((char*)"Off");
480   on_str = XmStringCreateLocalized ((char*)men << 472   on_str = XmStringCreateLocalized ((char*)"On");
481                                                   473 
482   transparency_pullright = XmVaCreateSimplePul    474   transparency_pullright = XmVaCreateSimplePulldownMenu 
483     (spec_cascade,                                475     (spec_cascade,
484      (char*)menu_str[26].c_str(),              << 476      (char*)"transparency",
485      0,                                           477      0,
486      transparency_callback,                       478      transparency_callback,
487      XmVaRADIOBUTTON, off_str, (KeySym)XK_f, N << 479      XmVaRADIOBUTTON, off_str, 'f', NULL, NULL,
488      XmVaRADIOBUTTON, on_str,  (KeySym)XK_n, N << 480      XmVaRADIOBUTTON, on_str, 'n', NULL, NULL,
489      XmNradioBehavior, True,                      481      XmNradioBehavior, True, 
490      XmNradioAlwaysOne, True,                     482      XmNradioAlwaysOne, True, 
491      XmNuserData, this,                           483      XmNuserData, this,
492      XtNvisual, vi -> visual,                     484      XtNvisual, vi -> visual, 
493      XtNdepth, vi -> depth,                       485      XtNdepth, vi -> depth, 
494      XtNcolormap, cmap,                           486      XtNcolormap, cmap, 
495      XtNborderColor, borcol,                      487      XtNborderColor, borcol,
496      XtNbackground, bgnd,                         488      XtNbackground, bgnd,
497      NULL);                                       489      NULL);
498                                                   490   
499   if (transparency_enabled == false) {            491   if (transparency_enabled == false) {
500     special_widget = XtNameToWidget(transparen    492     special_widget = XtNameToWidget(transparency_pullright, "button_0");
501     if(special_widget) {                          493     if(special_widget) {
502       XtVaSetValues (special_widget, XmNset, T    494       XtVaSetValues (special_widget, XmNset, True, NULL);
503     }                                             495     }
504   } else if (transparency_enabled == true) {      496   } else if (transparency_enabled == true) {
505     special_widget = XtNameToWidget(transparen    497     special_widget = XtNameToWidget(transparency_pullright, "button_1");
506     if(special_widget) {                          498     if(special_widget) {
507       XtVaSetValues (special_widget, XmNset, T    499       XtVaSetValues (special_widget, XmNset, True, NULL);
508     }                                             500     }
509   } else {                                        501   } else {
510     G4Exception                                << 502     G4Exception("transparency_enabled in G4OpenGLXmViewer is neither true nor false!!");
511       ("G4OpenGLXmViewer::CreateMainWindow",   << 
512        "opengl2016", FatalException,           << 
513        "transparency_enabled in G4OpenGLXmView << 
514   }                                               503   }
515                                                   504 
516   //Add antialias pullright menu to special ca    505   //Add antialias pullright menu to special cascade...
517   antialias_pullright = XmVaCreateSimplePulldo    506   antialias_pullright = XmVaCreateSimplePulldownMenu 
518     (spec_cascade,                                507     (spec_cascade,
519      (char*)menu_str[28].c_str(),              << 508      (char*)"antialias",
520      1,                                           509      1,
521      antialias_callback,                          510      antialias_callback,
522      XmVaRADIOBUTTON, off_str, (KeySym)XK_f, N << 511      XmVaRADIOBUTTON, off_str, 'f', NULL, NULL,
523      XmVaRADIOBUTTON, on_str,  (KeySym)XK_n, N << 512      XmVaRADIOBUTTON, on_str, 'n', NULL, NULL,
524      XmNradioBehavior, True,                      513      XmNradioBehavior, True, 
525      XmNradioAlwaysOne, True,                     514      XmNradioAlwaysOne, True, 
526      XmNuserData, this,                           515      XmNuserData, this,
527      XtNvisual, vi -> visual,                     516      XtNvisual, vi -> visual, 
528      XtNdepth, vi -> depth,                       517      XtNdepth, vi -> depth, 
529      XtNcolormap, cmap,                           518      XtNcolormap, cmap, 
530      XtNborderColor, borcol,                      519      XtNborderColor, borcol,
531      XtNbackground, bgnd,                         520      XtNbackground, bgnd,
532      NULL);                                       521      NULL);
533                                                   522   
534   if (antialiasing_enabled == false) {            523   if (antialiasing_enabled == false) {
535     special_widget = XtNameToWidget(antialias_    524     special_widget = XtNameToWidget(antialias_pullright, "button_0");
536     if(special_widget) {                          525     if(special_widget) {
537       XtVaSetValues (special_widget, XmNset, T    526       XtVaSetValues (special_widget, XmNset, True, NULL);
538     }                                             527     }
539   } else if (antialiasing_enabled == true) {      528   } else if (antialiasing_enabled == true) {
540     special_widget = XtNameToWidget(antialias_    529     special_widget = XtNameToWidget(antialias_pullright, "button_1");
541     if(special_widget) {                          530     if(special_widget) {
542       XtVaSetValues (special_widget, XmNset, T    531       XtVaSetValues (special_widget, XmNset, True, NULL);
543     }                                             532     }
544   } else {                                        533   } else {
545     G4Exception                                << 534     G4Exception("antialiasing_enabled in G4OpenGLXmViewer is neither true nor false!!");
546       ("G4OpenGLXmViewer::CreateMainWindow",   << 
547        "opengl2017", FatalException,           << 
548        "antialiasing_enabled in G4OpenGLXmView << 
549   }                                               535   }
550                                                   536 
551   //Add Haloing pullright menu to special casc    537   //Add Haloing pullright menu to special cascade...
552   haloing_pullright = XmVaCreateSimplePulldown    538   haloing_pullright = XmVaCreateSimplePulldownMenu 
553     (spec_cascade,                                539     (spec_cascade,
554      (char*)menu_str[30].c_str(),              << 540      (char*)"haloing",
555      2,                                           541      2,
556      haloing_callback,                            542      haloing_callback,
557      XmVaRADIOBUTTON, off_str, (KeySym)XK_f, N << 543      XmVaRADIOBUTTON, off_str, 'f', NULL, NULL,
558      XmVaRADIOBUTTON, on_str,  (KeySym)XK_n, N << 544      XmVaRADIOBUTTON, on_str, 'n', NULL, NULL,
559      XmNradioBehavior, True,                      545      XmNradioBehavior, True, 
560      XmNradioAlwaysOne, True,                     546      XmNradioAlwaysOne, True, 
561      XmNuserData, this,                           547      XmNuserData, this,
562      XtNvisual, vi -> visual,                     548      XtNvisual, vi -> visual, 
563      XtNdepth, vi -> depth,                       549      XtNdepth, vi -> depth, 
564      XtNcolormap, cmap,                           550      XtNcolormap, cmap, 
565      XtNborderColor, borcol,                      551      XtNborderColor, borcol,
566      XtNbackground, bgnd,                         552      XtNbackground, bgnd,
567      NULL);                                       553      NULL);
568                                                   554   
569   if (haloing_enabled == false) {                 555   if (haloing_enabled == false) {
570     special_widget = XtNameToWidget(haloing_pu    556     special_widget = XtNameToWidget(haloing_pullright, "button_0");
571     if(special_widget) {                          557     if(special_widget) {
572       XtVaSetValues (special_widget, XmNset, T    558       XtVaSetValues (special_widget, XmNset, True, NULL);
573     }                                             559     }
574   } else if (haloing_enabled == true) {           560   } else if (haloing_enabled == true) {
575     special_widget = XtNameToWidget(haloing_pu    561     special_widget = XtNameToWidget(haloing_pullright, "button_1");
576     if(special_widget) {                          562     if(special_widget) {
577       XtVaSetValues (special_widget, XmNset, T    563       XtVaSetValues (special_widget, XmNset, True, NULL);
578     }                                             564     }
579   } else {                                        565   } else {
580     G4Exception                                << 566     G4Exception("haloing_enabled in G4OpenGLXmViewer is neither true nor false!!");
581       ("G4OpenGLXmViewer::CreateMainWindow",   << 
582        "opengl2018", FatalException,           << 
583        "haloing_enabled in G4OpenGLXmViewer is << 
584   }                                               567   }
585                                                   568 
586   //Add Aux_Edge pullright menu to special cas    569   //Add Aux_Edge pullright menu to special cascade...
587   aux_edge_pullright = XmVaCreateSimplePulldow    570   aux_edge_pullright = XmVaCreateSimplePulldownMenu 
588     (spec_cascade,                                571     (spec_cascade,
589      (char*)menu_str[32].c_str(),              << 572      (char*)"aux_edge",
590      3,                                           573      3,
591      aux_edge_callback,                           574      aux_edge_callback,
592      XmVaRADIOBUTTON, off_str, (KeySym)XK_f, N << 575      XmVaRADIOBUTTON, off_str, 'f', NULL, NULL,
593      XmVaRADIOBUTTON, on_str,  (KeySym)XK_n, N << 576      XmVaRADIOBUTTON, on_str, 'n', NULL, NULL,
594      XmNradioBehavior, True,                      577      XmNradioBehavior, True, 
595      XmNradioAlwaysOne, True,                     578      XmNradioAlwaysOne, True, 
596      XmNuserData, this,                           579      XmNuserData, this,
597      XtNvisual, vi -> visual,                     580      XtNvisual, vi -> visual, 
598      XtNdepth, vi -> depth,                       581      XtNdepth, vi -> depth, 
599      XtNcolormap, cmap,                           582      XtNcolormap, cmap, 
600      XtNborderColor, borcol,                      583      XtNborderColor, borcol,
601      XtNbackground, bgnd,                         584      XtNbackground, bgnd,
602      NULL);                                       585      NULL);
603                                                   586   
604   if (!fVP.IsAuxEdgeVisible()) {                  587   if (!fVP.IsAuxEdgeVisible()) {
605     special_widget = XtNameToWidget(aux_edge_p    588     special_widget = XtNameToWidget(aux_edge_pullright, "button_0");
606     if(special_widget) {                          589     if(special_widget) {
607       XtVaSetValues (special_widget, XmNset, T    590       XtVaSetValues (special_widget, XmNset, True, NULL);
608     }                                             591     }
609   } else {                                        592   } else {
610     special_widget = XtNameToWidget(aux_edge_p    593     special_widget = XtNameToWidget(aux_edge_pullright, "button_1");
611     if(special_widget) {                          594     if(special_widget) {
612       XtVaSetValues (special_widget, XmNset, T    595       XtVaSetValues (special_widget, XmNset, True, NULL);
613     }                                             596     }
614   }                                               597   }
615                                                   598 
616   XtManageChild (menubar);                        599   XtManageChild (menubar);
617   frame = XtVaCreateManagedWidget ((char*)menu << 600   frame = XtVaCreateManagedWidget ((char*)"frame",
618            xmFrameWidgetClass, main_win,          601            xmFrameWidgetClass, main_win,
619            XtNvisual, vi -> visual,               602            XtNvisual, vi -> visual, 
620            XtNdepth, vi -> depth,                 603            XtNdepth, vi -> depth, 
621            XtNcolormap, cmap,                     604            XtNcolormap, cmap, 
622            XtNborderColor, borcol,                605            XtNborderColor, borcol,
623            XtNbackground, bgnd,                   606            XtNbackground, bgnd,
624            NULL);                                 607            NULL);
625                                                   608 
626   glxarea = XtVaCreateManagedWidget ((char*)me << 609   glxarea = XtVaCreateManagedWidget ((char*)"glxarea", 
627              xmDrawingAreaWidgetClass,            610              xmDrawingAreaWidgetClass,
628              frame,                               611              frame,
629              XtNvisual, vi -> visual,             612              XtNvisual, vi -> visual, 
630              XtNdepth, vi -> depth,               613              XtNdepth, vi -> depth, 
631              XtNcolormap, cmap,                   614              XtNcolormap, cmap, 
632              XtNborderColor, borcol,              615              XtNborderColor, borcol,
633              XtNbackground, bgnd,                 616              XtNbackground, bgnd,
634              NULL);                               617              NULL);
635                                                   618   
636                                                   619 
637   XmMainWindowSetAreas (main_win,  // main wid    620   XmMainWindowSetAreas (main_win,  // main widget, children are specified 
638       menubar,   // widget to use as menu bar     621       menubar,   // widget to use as menu bar
639       NULL,      // widget to use as command w    622       NULL,      // widget to use as command window
640       NULL,      // widget for horizontal scro    623       NULL,      // widget for horizontal scroll bar
641       NULL,      // widget for vertical scroll    624       NULL,      // widget for vertical scroll bar
642       frame      // widget to be used for work    625       frame      // widget to be used for work window
643       );                                          626       );
644                                                   627 
645   XtRealizeWidget(shell);                         628   XtRealizeWidget(shell);
646                                                   629   
647   // Once widget is realized (ie, associated w    630   // Once widget is realized (ie, associated with a created X window), we
648   // can bind the OpenGL rendering context to     631   // can bind the OpenGL rendering context to the window.
649                                                   632 
650   win = XtWindow (glxarea);                       633   win = XtWindow (glxarea);
651                                                   634 
652   glXMakeCurrent (dpy, win, cxMaster);         << 635   glXMakeCurrent (dpy, win, cx);
653                                                   636 
654   // This should be add AFTER glXMakeCurrent d    637   // This should be add AFTER glXMakeCurrent done because it will fire a resizeCallback
655   XtAddCallback (glxarea,                         638   XtAddCallback (glxarea, 
656      XmNresizeCallback,                           639      XmNresizeCallback, 
657      resize_callback,                             640      resize_callback, 
658      this);                                       641      this);
659                                                   642 
660   XtAddCallback (glxarea,                         643   XtAddCallback (glxarea, 
661      XmNexposeCallback,                           644      XmNexposeCallback, 
662      expose_callback,                             645      expose_callback, 
663      this);                                       646      this);
664                                                   647 
665 }                                                 648 }
666                                                   649 
667 G4OpenGLXmViewer::G4OpenGLXmViewer (G4OpenGLSc    650 G4OpenGLXmViewer::G4OpenGLXmViewer (G4OpenGLSceneHandler& scene):
668 G4VViewer (scene, -1),                            651 G4VViewer (scene, -1),
669 G4OpenGLViewer (scene),                           652 G4OpenGLViewer (scene),
670 G4OpenGLXViewer (scene),                          653 G4OpenGLXViewer (scene),
671 toplevel (0),                                  << 654 zoom_high (fVP.GetZoomFactor() * 10.0),
672 shell (0),                                     << 655 zoom_low (fVP.GetZoomFactor() / 10.0),
673 main_win (0),                                  << 656 dolly_low (fVP.GetDolly() - 1000.0),
674 menubar (0),                                   << 657 dolly_high (fVP.GetDolly() + 1000.0),
675 style_cascade (0),                             << 
676 actions_cascade (0),                           << 
677 misc_cascade (0),                              << 
678 spec_cascade (0),                              << 
679 drawing_style_pullright (0),                   << 
680 background_color_pullright (0),                << 
681 transparency_pullright (0),                    << 
682 antialias_pullright (0),                       << 
683 haloing_pullright (0),                         << 
684 aux_edge_pullright (0),                        << 
685 frame (0),                                     << 
686 glxarea (0),                                   << 
687 style_str (0),                                 << 
688 actions_str (0),                               << 
689 misc_str (0),                                  << 
690 spec_str (0),                                  << 
691 draw_str (0),                                  << 
692 polyhedron_str (0),                            << 
693 wireframe_str (0),                             << 
694 hlr_str (0),                                   << 
695 hsr_str (0),                                   << 
696 hlhsr_str (0),                                 << 
697 set_str (0),                                   << 
698 rot_str (0),                                   << 
699 pan_str (0),                                   << 
700 exit_str (0),                                  << 
701 quit_str (0),                                  << 
702 print_str (0),                                 << 
703 white_str (0),                                 << 
704 black_str (0),                                 << 
705 anti_str (0),                                  << 
706 trans_str (0),                                 << 
707 halo_str (0),                                  << 
708 aux_edge_str (0),                              << 
709 bgnd_str (0),                                  << 
710 off_str (0),                                   << 
711 on_str (0),                                    << 
712 zoom_high (0.0),                               << 
713 zoom_low (0.0),                                << 
714 pan_low (0.0),                                 << 
715 pan_high (0.0),                                << 
716 dolly_low (0.0),                               << 
717 dolly_high (0.0),                              << 
718 fov (0.0),                                        658 fov (0.0),
719 rot_sens_limit (0.0),                          << 659 rot_sens_limit (90.),
720 pan_sens_limit (0.0),                          << 660 pan_sens_limit (100.),
721 wob_high (0.0),                                << 661 rot_sens (1.),
722 wob_low (0.0),                                 << 662 wob_sens (20.),
723 wob_sens (0.0),                                << 
724 pan_right (false),                             << 
725 rotate_right (false),                          << 
726 pan_up (false),                                << 
727 rotate_up (false),                             << 
728 original_vp(fVP.GetViewpointDirection()),         663 original_vp(fVP.GetViewpointDirection()),
729 frameNo (0),                                      664 frameNo (0),
730 fprotation_top (0),                               665 fprotation_top (0),
731 fprotation_button_box (0),                     << 
732 fprotation_button1 (0),                        << 
733 fprotation_button2 (0),                        << 
734 fprotation_slider_box (0),                     << 
735 fprotation_slider (0),                            666 fprotation_slider (0),
736 fprotation_arrow_box (0),                      << 
737 fprotation_arrow (0),                          << 
738 fppanning_top (0),                                667 fppanning_top (0),
739 fppanning_box (0),                             << 
740 fppanning_arrows (0),                          << 
741 fppanning_slider (0),                             668 fppanning_slider (0),
742 fpzoom_box (0),                                << 
743 fpzoom_slider (0),                                669 fpzoom_slider (0),
744 fpdolly_box (0),                               << 
745 fpdolly_slider (0),                               670 fpdolly_slider (0),
746 fpsetting_top (0),                                671 fpsetting_top (0),
747 fpsetting_box (0),                             << 
748 fppan_set (0),                                 << 
749 fprot_set (0),                                 << 
750 fpzoom_upper (0),                              << 
751 fpzoom_lower (0),                              << 
752 fpdolly_upper (0),                             << 
753 fpdolly_lower (0),                             << 
754 fpok_button (0),                               << 
755 fpmiscellany_top (0),                             672 fpmiscellany_top (0),
756 fpwobble_box (0),                              << 673 fpprint_top (0)
757 fpwobble_button (0),                           << 
758 fpwobble_slider (0),                           << 
759 fpreset_box (0),                               << 
760 fpreset_button (0),                            << 
761 fpproj_style_box (0),                          << 
762 fporthogonal_button (0),                       << 
763 fpperspective_button (0),                      << 
764 fpfov_text (0),                                << 
765 fpprint_top (0),                               << 
766 fpprint_box (0),                               << 
767 fpprint_col_box (0),                           << 
768 fpprint_style_box (0),                         << 
769 fpprint_text (0),                              << 
770 fpprint_button (0),                            << 
771 fpprint_line (0),                              << 
772 fpprint_col_radio1 (0),                        << 
773 fpprint_col_radio2 (0),                        << 
774 fpprint_style_radio1 (0),                      << 
775 fpprint_style_radio2 (0)                       << 
776 {                                                 674 {
777   GetXmConnection ();                             675   GetXmConnection ();
778   ResetView();                                 << 
779   if (fViewId < 0) return;                        676   if (fViewId < 0) return;
780 }                                                 677 }
781                                                   678 
782                                                << 
783 void G4OpenGLXmViewer::UpdateControlPanel () { << 
784                                                << 
785   // set new values                            << 
786                                                << 
787   if (fprotation_slider) {                     << 
788     fprotation_slider->SetInitialValue(fRot_se << 
789     fprotation_slider->SetMaxValue(rot_sens_li << 
790     fprotation_slider->SetMinValue(0);         << 
791   }                                            << 
792   if (fppanning_slider) {                      << 
793     fppanning_slider->SetInitialValue(fPan_sen << 
794     fppanning_slider->SetMaxValue(pan_sens_lim << 
795     fppanning_slider->SetMinValue(0);          << 
796   }                                            << 
797   if (fpzoom_slider) {                         << 
798     fpzoom_slider->SetInitialValue(fVP.GetZoom << 
799     fpzoom_slider->SetMinValue(zoom_low);      << 
800     fpzoom_slider->SetMaxValue(zoom_high);     << 
801   }                                            << 
802   if (fpdolly_slider) {                        << 
803     fpdolly_slider->SetInitialValue(fVP.GetDol << 
804     fpdolly_slider->SetMinValue(dolly_low);    << 
805     fpdolly_slider->SetMaxValue(dolly_high);   << 
806   }                                            << 
807                                                << 
808   if (fpwobble_slider) {                       << 
809     fpwobble_slider->SetInitialValue(fVP.GetDo << 
810   }                                            << 
811                                                << 
812   if (fppan_set) {                             << 
813     fppan_set->SetValue(pan_sens_limit);       << 
814   }                                            << 
815                                                << 
816   if (fprot_set) {                             << 
817     fprot_set->SetValue(rot_sens_limit);       << 
818   }                                            << 
819                                                << 
820   if (fpzoom_upper) {                          << 
821     fpzoom_upper->SetValue(zoom_high);         << 
822   }                                            << 
823                                                << 
824   if (fpzoom_lower) {                          << 
825     fpzoom_lower->SetValue(zoom_low);          << 
826   }                                            << 
827   if (fpdolly_upper) {                         << 
828     fpdolly_upper->SetValue(dolly_high);       << 
829   }                                            << 
830                                                << 
831   if (fpdolly_lower) {                         << 
832     fpdolly_lower->SetValue(dolly_low);        << 
833   }                                            << 
834                                                << 
835                                                << 
836 }                                              << 
837                                                << 
838                                                << 
839 G4OpenGLXmViewer::~G4OpenGLXmViewer ()            679 G4OpenGLXmViewer::~G4OpenGLXmViewer ()
840 {                                                 680 {
841   XtDestroyWidget  (shell);                       681   XtDestroyWidget  (shell);
842   win = 0; // ...to avoid XDestroyWindow in G4    682   win = 0; // ...to avoid XDestroyWindow in G4OpenGLXViewer base class
843   // because XtDestroyWidget has already destr    683   // because XtDestroyWidget has already destroyed it.
844   G4Xt::getInstance () ->RemoveShell (shell);     684   G4Xt::getInstance () ->RemoveShell (shell);
845                                                   685 
846 /******************************                   686 /******************************
847   if (fprotation_top) {                           687   if (fprotation_top) {
848     delete fprotation_top;                        688     delete fprotation_top;
849   }                                               689   }
850                                                   690 
851   if (fppanning_top) {                            691   if (fppanning_top) {
852     delete fppanning_top;                         692     delete fppanning_top;
853   }                                               693   }
854                                                   694 
855   if (fpsetting_top) {                            695   if (fpsetting_top) {
856     delete fpsetting_top;                         696     delete fpsetting_top;
857   }                                               697   }
858                                                   698 
859   if (fpmiscellany_top) {                         699   if (fpmiscellany_top) {
860     delete fpmiscellany_top;                      700     delete fpmiscellany_top;
861   }                                               701   }
862 ******************************/                   702 ******************************/
863                                                   703 
864 }                                                 704 }
                                                   >> 705 
                                                   >> 706 #endif
865                                                   707