Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/visualization/OpenGL/src/G4OpenGLXmMainMenubarCallbacks.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/G4OpenGLXmMainMenubarCallbacks.cc (Version 11.3.0) and /visualization/OpenGL/src/G4OpenGLXmMainMenubarCallbacks.cc (Version 11.1.3)


  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 //                                                 27 //
 28 //                                                 28 // 
 29 // Andrew Walkden  16th April 1997                 29 // Andrew Walkden  16th April 1997
 30 // G4OpenGLXmMainMenubarCallbacks :                30 // G4OpenGLXmMainMenubarCallbacks : 
 31 //                       Collection of callbac     31 //                       Collection of callback functions
 32 //                       to handle events gene     32 //                       to handle events generated by the
 33 //                       main OpenGLXm window      33 //                       main OpenGLXm window menubar.
 34 //                                                 34 //
 35 // See G4OpenGLXmMainMenubarCallbacks.hh for m     35 // See G4OpenGLXmMainMenubarCallbacks.hh for more information.
 36                                                    36 
 37                                                    37 
 38 #include "G4OpenGLXmViewer.hh"                     38 #include "G4OpenGLXmViewer.hh"
 39                                                    39 
 40 #include "G4Xt.hh"                                 40 #include "G4Xt.hh"
 41                                                    41 
 42 #include "G4VSceneHandler.hh"                      42 #include "G4VSceneHandler.hh"
 43                                                    43 
 44 #include "G4Scene.hh"                              44 #include "G4Scene.hh"
 45                                                    45 
 46 #include "G4OpenGLXmRadioButton.hh"                46 #include "G4OpenGLXmRadioButton.hh"
 47 #include "G4OpenGLXmSliderBar.hh"                  47 #include "G4OpenGLXmSliderBar.hh"
 48 #include "G4OpenGLXmFourArrowButtons.hh"           48 #include "G4OpenGLXmFourArrowButtons.hh"
 49 #include "G4OpenGLXmTextField.hh"                  49 #include "G4OpenGLXmTextField.hh"
 50 #include "G4OpenGLXmPushButton.hh"                 50 #include "G4OpenGLXmPushButton.hh"
 51 #include "G4OpenGLXmBox.hh"                        51 #include "G4OpenGLXmBox.hh"
 52 #include "G4OpenGLXmFramedBox.hh"                  52 #include "G4OpenGLXmFramedBox.hh"
 53 #include "G4OpenGLXmTopLevelShell.hh"              53 #include "G4OpenGLXmTopLevelShell.hh"
 54 #include "G4OpenGLXmSeparator.hh"                  54 #include "G4OpenGLXmSeparator.hh"
 55                                                    55 
 56 #include <sstream>                                 56 #include <sstream>
 57                                                    57 
 58 void G4OpenGLXmViewer::actions_callback (Widge     58 void G4OpenGLXmViewer::actions_callback (Widget w, 
 59                XtPointer clientData,               59                XtPointer clientData,
 60                XtPointer)                          60                XtPointer)
 61 {                                                  61 {
 62                                                    62   
 63   G4OpenGLXmViewer* pView;                         63   G4OpenGLXmViewer* pView;
 64   G4long choice = (G4long)clientData;              64   G4long choice = (G4long)clientData;
 65                                                    65   
 66                                                    66   
 67   XtVaGetValues (XtParent(w),                      67   XtVaGetValues (XtParent(w), 
 68      XmNuserData, &pView,                          68      XmNuserData, &pView, 
 69      NULL);                                        69      NULL);
 70                                                    70   
 71   switch (choice) {                                71   switch (choice) {
 72                                                    72     
 73   case 0:                                          73   case 0:
 74                                                    74     
 75     {                                              75     {
 76                                                    76       
 77       if (!pView->fprotation_top) {                77       if (!pView->fprotation_top) {
 78   std::ostringstream rot_Name;                     78   std::ostringstream rot_Name;
 79   rot_Name << pView->GetSceneHandler()->GetSce     79   rot_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
 80                                                    80   
 81   pView->fprotation_top = new G4OpenGLXmTopLev     81   pView->fprotation_top = new G4OpenGLXmTopLevelShell (pView,
 82                    (char*)rot_Name.str().c_str     82                    (char*)rot_Name.str().c_str());
 83   pView->fprotation_button_box = new G4OpenGLX     83   pView->fprotation_button_box = new G4OpenGLXmBox ("Rotation button box", True);
 84                                                    84   
 85   pView->fprotation_top->AddChild (pView->fpro     85   pView->fprotation_top->AddChild (pView->fprotation_button_box);
 86                                                    86   
 87   XtCallbackRec* rot_cb_list = new XtCallbackR     87   XtCallbackRec* rot_cb_list = new XtCallbackRec[2];
 88   rot_cb_list[0].callback = set_rot_subject_ca     88   rot_cb_list[0].callback = set_rot_subject_callback;
 89   rot_cb_list[0].closure = pView;                  89   rot_cb_list[0].closure = pView; 
 90   rot_cb_list[1].callback = NULL;                  90   rot_cb_list[1].callback = NULL;
 91                                                    91   
 92   pView->fprotation_button1 = new G4OpenGLXmRa     92   pView->fprotation_button1 = new G4OpenGLXmRadioButton
 93     ("Object",                                     93     ("Object",
 94      rot_cb_list,                                  94      rot_cb_list,
 95      pView->GetViewParameters().GetLightsMoveW     95      pView->GetViewParameters().GetLightsMoveWithCamera(),
 96      0);                                           96      0);
 97                                                    97   
 98   pView->fprotation_button2 = new G4OpenGLXmRa     98   pView->fprotation_button2 = new G4OpenGLXmRadioButton
 99     ("Camera",                                     99     ("Camera",
100      rot_cb_list,                                 100      rot_cb_list,
101      !(pView->GetViewParameters().GetLightsMov    101      !(pView->GetViewParameters().GetLightsMoveWithCamera()),
102      1);                                          102      1);
103                                                   103   
104   pView->fprotation_button_box->AddChild (pVie    104   pView->fprotation_button_box->AddChild (pView->fprotation_button1);
105   pView->fprotation_button_box->AddChild (pVie    105   pView->fprotation_button_box->AddChild (pView->fprotation_button2);
106                                                   106   
107   pView->fprotation_slider_box = new G4OpenGLX    107   pView->fprotation_slider_box = new G4OpenGLXmBox ("Rotation slider box", False);
108   pView->fprotation_top->AddChild (pView->fpro    108   pView->fprotation_top->AddChild (pView->fprotation_slider_box);
109                                                   109   
110   XtCallbackRec* rot_slider_list = new XtCallb    110   XtCallbackRec* rot_slider_list = new XtCallbackRec[2];
111   rot_slider_list[0].callback = set_rot_sens_c    111   rot_slider_list[0].callback = set_rot_sens_callback;
112   rot_slider_list[0].closure = pView;             112   rot_slider_list[0].closure = pView; 
113   rot_slider_list[1].callback = NULL;             113   rot_slider_list[1].callback = NULL;
114                                                   114   
115   pView->fprotation_slider = new G4OpenGLXmSli    115   pView->fprotation_slider = new G4OpenGLXmSliderBar ("Rotation slider",
116                   rot_slider_list,                116                   rot_slider_list,
117                   True,                           117                   True,
118                   2,                              118                   2,
119                   pView->fRot_sens,               119                   pView->fRot_sens,
120                   pView->rot_sens_limit,          120                   pView->rot_sens_limit,
121                   0);                             121                   0);
122   pView->fprotation_slider_box->AddChild (pVie    122   pView->fprotation_slider_box->AddChild (pView->fprotation_slider);
123                                                   123   
124   pView->fprotation_arrow_box = new G4OpenGLXm    124   pView->fprotation_arrow_box = new G4OpenGLXmBox ("Rotation arrow box", False);
125   pView->fprotation_top->AddChild (pView->fpro    125   pView->fprotation_top->AddChild (pView->fprotation_arrow_box);
126                                                   126   
127   XtCallbackRec** rotation_callbacks = new XtC    127   XtCallbackRec** rotation_callbacks = new XtCallbackRec*[4];
128   for (G4int i = 0; i < 4; i++) {                 128   for (G4int i = 0; i < 4; i++) {
129     rotation_callbacks[i] = new XtCallbackRec[    129     rotation_callbacks[i] = new XtCallbackRec[2];
130   }                                               130   }
131   rotation_callbacks[0][0].callback = phi_rota    131   rotation_callbacks[0][0].callback = phi_rotation_callback;
132   rotation_callbacks[0][0].closure =  pView;      132   rotation_callbacks[0][0].closure =  pView;
133   rotation_callbacks[0][1].callback = NULL;       133   rotation_callbacks[0][1].callback = NULL;
134                                                   134   
135   rotation_callbacks[1][0].callback = phi_rota    135   rotation_callbacks[1][0].callback = phi_rotation_callback;
136   rotation_callbacks[1][0].closure =  pView;      136   rotation_callbacks[1][0].closure =  pView;
137   rotation_callbacks[1][1].callback = NULL;       137   rotation_callbacks[1][1].callback = NULL;
138                                                   138   
139   rotation_callbacks[2][0].callback = theta_ro    139   rotation_callbacks[2][0].callback = theta_rotation_callback;
140   rotation_callbacks[2][0].closure =  pView;      140   rotation_callbacks[2][0].closure =  pView;
141   rotation_callbacks[2][1].callback = NULL;       141   rotation_callbacks[2][1].callback = NULL;
142                                                   142   
143   rotation_callbacks[3][0].callback = theta_ro    143   rotation_callbacks[3][0].callback = theta_rotation_callback;
144   rotation_callbacks[3][0].closure =  pView;      144   rotation_callbacks[3][0].closure =  pView;
145   rotation_callbacks[3][1].callback = NULL;       145   rotation_callbacks[3][1].callback = NULL;
146                                                   146   
147   pView->fprotation_arrow = new G4OpenGLXmFour    147   pView->fprotation_arrow = new G4OpenGLXmFourArrowButtons (rotation_callbacks);
148                                                   148   
149   pView->fprotation_arrow_box->AddChild (pView    149   pView->fprotation_arrow_box->AddChild (pView->fprotation_arrow);
150                                                   150   
151   pView->fprotation_top->Realize ();              151   pView->fprotation_top->Realize ();
152       }                                           152       }
153       break;                                      153       break;
154                                                   154       
155     }                                             155     }
156                                                   156   
157                                                   157   
158   case 1:                                         158   case 1:
159     {                                             159     {
160       if (!pView->GetSceneHandler()->GetScene(    160       if (!pView->GetSceneHandler()->GetScene()) {
161         break;                                    161         break;
162       }                                           162       }
163       if (!pView->fppanning_top) {                163       if (!pView->fppanning_top) {
164   std::ostringstream pan_Name;                    164   std::ostringstream pan_Name;
165   pan_Name << pView->GetSceneHandler()->GetSce    165   pan_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
166                                                   166   
167   pView->fppanning_top = new G4OpenGLXmTopLeve    167   pView->fppanning_top = new G4OpenGLXmTopLevelShell (pView, 
168                   (char*)pan_Name.str().c_str(    168                   (char*)pan_Name.str().c_str());
169                                                   169   
170   pView->fppanning_box = new G4OpenGLXmFramedB    170   pView->fppanning_box = new G4OpenGLXmFramedBox ("Pan up-down-left-right", 
171               False);                             171               False);
172                                                   172   
173   pView->fppanning_top->AddChild (pView->fppan    173   pView->fppanning_top->AddChild (pView->fppanning_box);
174                                                   174   
175   XtCallbackRec** pan_callbacks = new XtCallba    175   XtCallbackRec** pan_callbacks = new XtCallbackRec*[4];
176   for (G4int i = 0; i < 4; i++) {                 176   for (G4int i = 0; i < 4; i++) {
177     pan_callbacks[i] = new XtCallbackRec[2];      177     pan_callbacks[i] = new XtCallbackRec[2];
178   }                                               178   }
179   pan_callbacks[0][0].callback = pan_up_down_c    179   pan_callbacks[0][0].callback = pan_up_down_callback;
180   pan_callbacks[0][0].closure = pView;            180   pan_callbacks[0][0].closure = pView; 
181   pan_callbacks[0][1].callback = NULL;            181   pan_callbacks[0][1].callback = NULL;
182                                                   182   
183   pan_callbacks[1][0].callback = pan_up_down_c    183   pan_callbacks[1][0].callback = pan_up_down_callback;
184   pan_callbacks[1][0].closure = pView;            184   pan_callbacks[1][0].closure = pView; 
185   pan_callbacks[1][1].callback = NULL;            185   pan_callbacks[1][1].callback = NULL;
186                                                   186   
187   pan_callbacks[2][0].callback = pan_left_righ    187   pan_callbacks[2][0].callback = pan_left_right_callback;
188   pan_callbacks[2][0].closure = pView;            188   pan_callbacks[2][0].closure = pView; 
189   pan_callbacks[2][1].callback = NULL;            189   pan_callbacks[2][1].callback = NULL;
190                                                   190   
191   pan_callbacks[3][0].callback = pan_left_righ    191   pan_callbacks[3][0].callback = pan_left_right_callback;
192   pan_callbacks[3][0].closure = pView;            192   pan_callbacks[3][0].closure = pView; 
193   pan_callbacks[3][1].callback = NULL;            193   pan_callbacks[3][1].callback = NULL;
194                                                   194   
195   pView->fppanning_arrows = new G4OpenGLXmFour    195   pView->fppanning_arrows = new G4OpenGLXmFourArrowButtons (pan_callbacks);
196                                                   196   
197   pView->fppanning_box->AddChild (pView->fppan    197   pView->fppanning_box->AddChild (pView->fppanning_arrows);
198                                                   198   
199   XtCallbackRec* pan_slider_list = new XtCallb    199   XtCallbackRec* pan_slider_list = new XtCallbackRec[2];
200   pan_slider_list[0].callback = set_pan_sens_c    200   pan_slider_list[0].callback = set_pan_sens_callback;
201   pan_slider_list[0].closure = pView;             201   pan_slider_list[0].closure = pView; 
202   pan_slider_list[1].callback = NULL;             202   pan_slider_list[1].callback = NULL;
203                                                   203   
204   pView->fppanning_slider = new G4OpenGLXmSlid    204   pView->fppanning_slider = new G4OpenGLXmSliderBar ("Panning slider",
205                  pan_slider_list,                 205                  pan_slider_list,
206                  True,                            206                  True,
207                  2,                               207                  2,
208                  pView->fPan_sens = pView->Get    208                  pView->fPan_sens = pView->GetSceneHandler()->GetScene()->GetExtent().GetExtentRadius() / 10.0,
209                  pView->pan_sens_limit = pView    209                  pView->pan_sens_limit = pView->GetSceneHandler()->GetScene()->GetExtent().GetExtentRadius(),
210                  0);                              210                  0);
211   pView->fppanning_box->AddChild (pView->fppan    211   pView->fppanning_box->AddChild (pView->fppanning_slider);
212                                                   212   
213   pView->fpzoom_box = new G4OpenGLXmFramedBox     213   pView->fpzoom_box = new G4OpenGLXmFramedBox ("Zoom", 
214                  False);                          214                  False);      
215   pView->fppanning_top->AddChild (pView->fpzoo    215   pView->fppanning_top->AddChild (pView->fpzoom_box);
216                                                   216   
217   XtCallbackRec* zoom_slider_list = new XtCall    217   XtCallbackRec* zoom_slider_list = new XtCallbackRec[2];
218   zoom_slider_list[0].callback = zoom_callback    218   zoom_slider_list[0].callback = zoom_callback;
219   zoom_slider_list[0].closure = pView;            219   zoom_slider_list[0].closure = pView; 
220   zoom_slider_list[1].callback = NULL;            220   zoom_slider_list[1].callback = NULL;
221                                                   221   
222   pView->fpzoom_slider = new G4OpenGLXmSliderB    222   pView->fpzoom_slider = new G4OpenGLXmSliderBar ("Zoom slider",
223               zoom_slider_list,                   223               zoom_slider_list,
224               True,                               224               True,
225               2,                                  225               2,
226               pView->fVP.GetZoomFactor(),         226               pView->fVP.GetZoomFactor(),
227               pView->zoom_high,                   227               pView->zoom_high,
228               pView->zoom_low);                   228               pView->zoom_low);
229   pView->fpzoom_box->AddChild (pView->fpzoom_s    229   pView->fpzoom_box->AddChild (pView->fpzoom_slider);
230                                                   230   
231   pView->fpdolly_box = new G4OpenGLXmFramedBox    231   pView->fpdolly_box = new G4OpenGLXmFramedBox ("Dolly", 
232                   False);                         232                   False);      
233   pView->fppanning_top->AddChild (pView->fpdol    233   pView->fppanning_top->AddChild (pView->fpdolly_box);
234                                                   234   
235   XtCallbackRec* dolly_slider_list = new XtCal    235   XtCallbackRec* dolly_slider_list = new XtCallbackRec[2];
236   dolly_slider_list[0].callback = dolly_callba    236   dolly_slider_list[0].callback = dolly_callback;
237   dolly_slider_list[0].closure = pView;           237   dolly_slider_list[0].closure = pView; 
238   dolly_slider_list[1].callback = NULL;           238   dolly_slider_list[1].callback = NULL;
239                                                   239   
240   pView->fpdolly_slider = new G4OpenGLXmSlider    240   pView->fpdolly_slider = new G4OpenGLXmSliderBar ("Dolly slider",
241                dolly_slider_list,                 241                dolly_slider_list,
242                True,                              242                True,
243                2,                                 243                2,
244                pView->fVP.GetDolly(),             244                pView->fVP.GetDolly(),
245                pView->dolly_high = pView->GetS    245                pView->dolly_high = pView->GetSceneHandler()->GetScene()->GetExtent().GetExtentRadius(),
246                pView->dolly_low = -(pView->Get    246                pView->dolly_low = -(pView->GetSceneHandler()->GetScene()->GetExtent().GetExtentRadius()));
247   //               pView->dolly_high,             247   //               pView->dolly_high,
248   //               pView->dolly_low);             248   //               pView->dolly_low);
249   pView->fpdolly_box->AddChild (pView->fpdolly    249   pView->fpdolly_box->AddChild (pView->fpdolly_slider);
250                                                   250   
251   pView->fppanning_top->Realize ();               251   pView->fppanning_top->Realize ();
252         pView->UpdateControlPanel ();             252         pView->UpdateControlPanel ();
253       }                                           253       }
254                                                   254 
255       break;                                      255       break;
256                                                   256       
257     }                                             257     }
258   case 2:                                         258   case 2:
259     {                                             259     {
260                                                   260       
261       if (!pView->fpsetting_top) {                261       if (!pView->fpsetting_top) {
262   std::ostringstream set_Name;                    262   std::ostringstream set_Name;
263   set_Name << pView->GetSceneHandler()->GetSce    263   set_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
264                                                   264   
265   pView->fpsetting_top = new G4OpenGLXmTopLeve    265   pView->fpsetting_top = new G4OpenGLXmTopLevelShell(pView,
266                  (char*)set_Name.str().c_str()    266                  (char*)set_Name.str().c_str());
267                                                   267   
268   pView->fpsetting_box = new G4OpenGLXmFramedB    268   pView->fpsetting_box = new G4OpenGLXmFramedBox ("Set values for control panels",
269               False);                             269               False);
270   pView->fpsetting_top->AddChild (pView->fpset    270   pView->fpsetting_top->AddChild (pView->fpsetting_box);
271                                                   271   
272   pView->fppan_set = new G4OpenGLXmTextField (    272   pView->fppan_set = new G4OpenGLXmTextField ("Upper limit of pan sensitivity",
273                 &(pView->pan_sens_limit));        273                 &(pView->pan_sens_limit));
274                                                   274   
275   pView->fprot_set = new G4OpenGLXmTextField (    275   pView->fprot_set = new G4OpenGLXmTextField ("Upper limit of rotation sensitivity",
276                 &(pView->rot_sens_limit));        276                 &(pView->rot_sens_limit));
277                                                   277   
278   pView->fpzoom_upper = new G4OpenGLXmTextFiel    278   pView->fpzoom_upper = new G4OpenGLXmTextField ("Upper limit of zoom",
279                    &(pView->zoom_high));          279                    &(pView->zoom_high));
280                                                   280   
281   pView->fpzoom_lower = new G4OpenGLXmTextFiel    281   pView->fpzoom_lower = new G4OpenGLXmTextField ("Lower limit of zoom",
282                    &(pView->zoom_low));           282                    &(pView->zoom_low));
283                                                   283   
284   pView->fpdolly_upper = new G4OpenGLXmTextFie    284   pView->fpdolly_upper = new G4OpenGLXmTextField ("Upper limit of dolly",
285               &(pView->dolly_high));              285               &(pView->dolly_high));
286                                                   286   
287   pView->fpdolly_lower = new G4OpenGLXmTextFie    287   pView->fpdolly_lower = new G4OpenGLXmTextField ("Lower limit of dolly",
288               &(pView->dolly_low));               288               &(pView->dolly_low));
289                                                   289   
290   XtCallbackRec* ok_list = new XtCallbackRec[2    290   XtCallbackRec* ok_list = new XtCallbackRec[2];
291   ok_list[0].callback = update_panels_callback    291   ok_list[0].callback = update_panels_callback;
292   ok_list[0].closure = pView;                     292   ok_list[0].closure = pView; 
293   ok_list[1].callback = NULL;                     293   ok_list[1].callback = NULL;
294                                                   294   
295                                                   295   
296   pView->fpok_button = new G4OpenGLXmPushButto    296   pView->fpok_button = new G4OpenGLXmPushButton ("ok",
297                    ok_list);                      297                    ok_list);
298                                                   298   
299   pView->fpsetting_box->AddChild (pView->fppan    299   pView->fpsetting_box->AddChild (pView->fppan_set);
300   pView->fpsetting_box->AddChild (pView->fprot    300   pView->fpsetting_box->AddChild (pView->fprot_set);
301   pView->fpsetting_box->AddChild (pView->fpzoo    301   pView->fpsetting_box->AddChild (pView->fpzoom_upper);
302   pView->fpsetting_box->AddChild (pView->fpzoo    302   pView->fpsetting_box->AddChild (pView->fpzoom_lower);
303   pView->fpsetting_box->AddChild (pView->fpdol    303   pView->fpsetting_box->AddChild (pView->fpdolly_upper);
304   pView->fpsetting_box->AddChild (pView->fpdol    304   pView->fpsetting_box->AddChild (pView->fpdolly_lower);
305   pView->fpsetting_box->AddChild (pView->fpok_    305   pView->fpsetting_box->AddChild (pView->fpok_button);
306                                                   306   
307   pView->fpsetting_top->Realize ();               307   pView->fpsetting_top->Realize ();
308                                                   308   
309       }                                           309       }
310                                                   310 
311       break;                                      311       break;
312     }                                             312     }
313                                                   313   
314   default:                                        314   default:
315     G4Exception                                   315     G4Exception
316       ("G4OpenGLXmViewer::actions_callback",      316       ("G4OpenGLXmViewer::actions_callback",
317        "opengl2001", FatalException,              317        "opengl2001", FatalException,
318        "Unrecognised widget child of control_c    318        "Unrecognised widget child of control_callback");
319   }                                               319   }
320                                                   320   
321   return;                                         321   return;
322 }                                                 322 }
323                                                   323 
324                                                   324 
325                                                   325 
326 void G4OpenGLXmViewer::misc_callback (Widget w    326 void G4OpenGLXmViewer::misc_callback (Widget w, 
327             XtPointer clientData,                 327             XtPointer clientData, 
328             XtPointer)                            328             XtPointer) 
329 {                                                 329 {
330   G4OpenGLXmViewer* pView;                        330   G4OpenGLXmViewer* pView;
331   G4long choice = (G4long)clientData;             331   G4long choice = (G4long)clientData;
332   XtVaGetValues (XtParent(w),                     332   XtVaGetValues (XtParent(w), 
333      XmNuserData, &pView,                         333      XmNuserData, &pView, 
334      NULL);                                       334      NULL);
335                                                   335   
336   switch (choice) {                               336   switch (choice) {
337                                                   337     
338   case 0:                                         338   case 0:
339     {                                             339     {
340                                                   340 
341       if (!pView->fpmiscellany_top) {             341       if (!pView->fpmiscellany_top) {
342                                                   342   
343   std::ostringstream misc_Name;                   343   std::ostringstream misc_Name;
344   misc_Name << pView->GetSceneHandler()->GetSc    344   misc_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
345                                                   345   
346   pView->fpmiscellany_top = new G4OpenGLXmTopL    346   pView->fpmiscellany_top = new G4OpenGLXmTopLevelShell (pView, 
347                      (char*)misc_Name.str().c_    347                      (char*)misc_Name.str().c_str());
348   pView->fpwobble_box = new G4OpenGLXmFramedBo    348   pView->fpwobble_box = new G4OpenGLXmFramedBox ("Wobble view",
349                    True);                         349                    True);
350   pView->fpmiscellany_top->AddChild (pView->fp    350   pView->fpmiscellany_top->AddChild (pView->fpwobble_box);
351                                                   351   
352   XtCallbackRec* wob_cb_list = new XtCallbackR    352   XtCallbackRec* wob_cb_list = new XtCallbackRec[2];
353   wob_cb_list[0].callback = wobble_callback;      353   wob_cb_list[0].callback = wobble_callback;
354   wob_cb_list[0].closure = pView;                 354   wob_cb_list[0].closure = pView; 
355   wob_cb_list[1].callback = NULL;                 355   wob_cb_list[1].callback = NULL;
356                                                   356   
357                                                   357   
358   pView->fpwobble_button = new G4OpenGLXmPushB    358   pView->fpwobble_button = new G4OpenGLXmPushButton ("Wobble",
359                  wob_cb_list);                    359                  wob_cb_list);
360                                                   360   
361   XtCallbackRec* wobble_slider_list = new XtCa    361   XtCallbackRec* wobble_slider_list = new XtCallbackRec[2];
362   wobble_slider_list[0].callback = set_wob_sen    362   wobble_slider_list[0].callback = set_wob_sens_callback;
363   wobble_slider_list[0].closure = pView;          363   wobble_slider_list[0].closure = pView; 
364   wobble_slider_list[1].callback = NULL;          364   wobble_slider_list[1].callback = NULL;
365                                                   365   
366   pView->fpwobble_slider = new G4OpenGLXmSlide    366   pView->fpwobble_slider = new G4OpenGLXmSliderBar ("Wobble slider",
367                 wobble_slider_list,               367                 wobble_slider_list,
368                 True,                             368                 True,
369                 0,                                369                 0,
370                 pView->wob_sens,                  370                 pView->wob_sens,
371                 pView->wob_high,                  371                 pView->wob_high,
372                 pView->wob_low);                  372                 pView->wob_low);
373   pView->fpwobble_box->AddChild (pView->fpwobb    373   pView->fpwobble_box->AddChild (pView->fpwobble_button);
374   pView->fpwobble_box->AddChild (pView->fpwobb    374   pView->fpwobble_box->AddChild (pView->fpwobble_slider);
375                                                   375   
376   pView->fpreset_box = new G4OpenGLXmFramedBox    376   pView->fpreset_box = new G4OpenGLXmFramedBox ("Reset view",
377                   True);                          377                   True);
378   pView->fpmiscellany_top->AddChild (pView->fp    378   pView->fpmiscellany_top->AddChild (pView->fpreset_box);
379                                                   379   
380   XtCallbackRec* rst_cb_list = new XtCallbackR    380   XtCallbackRec* rst_cb_list = new XtCallbackRec[3];
381   rst_cb_list[0].callback = reset_callback;       381   rst_cb_list[0].callback = reset_callback;
382   rst_cb_list[0].closure = pView;                 382   rst_cb_list[0].closure = pView; 
383   rst_cb_list[1].callback = update_panels_call    383   rst_cb_list[1].callback = update_panels_callback;
384   rst_cb_list[1].closure = pView;                 384   rst_cb_list[1].closure = pView; 
385   rst_cb_list[2].callback = NULL;                 385   rst_cb_list[2].callback = NULL;
386                                                   386   
387   pView->fpreset_button = new G4OpenGLXmPushBu    387   pView->fpreset_button = new G4OpenGLXmPushButton ("Reset",
388                 rst_cb_list);                     388                 rst_cb_list);
389                                                   389   
390   pView->fpreset_box->AddChild (pView->fpreset    390   pView->fpreset_box->AddChild (pView->fpreset_button);
391                                                   391   
392   pView->fpproj_style_box = new G4OpenGLXmFram    392   pView->fpproj_style_box = new G4OpenGLXmFramedBox ("Projection style",
393                  True);                           393                  True);
394   pView->fpmiscellany_top->AddChild (pView->fp    394   pView->fpmiscellany_top->AddChild (pView->fpproj_style_box);
395                                                   395   
396   XtCallbackRec* proj_cb_list = new XtCallback    396   XtCallbackRec* proj_cb_list = new XtCallbackRec[2];
397   proj_cb_list[0].callback = projection_callba    397   proj_cb_list[0].callback = projection_callback;
398   proj_cb_list[0].closure = pView;                398   proj_cb_list[0].closure = pView; 
399   proj_cb_list[1].callback = NULL;                399   proj_cb_list[1].callback = NULL;
400                                                   400   
401   pView->fporthogonal_button = new G4OpenGLXmR    401   pView->fporthogonal_button = new G4OpenGLXmRadioButton ("Orthographic",
402                 proj_cb_list,                     402                 proj_cb_list,
403                 pView->fVP.GetFieldHalfAngle()    403                 pView->fVP.GetFieldHalfAngle() > 0. ? False : True,
404                 0);                               404                 0);
405                                                   405   
406   pView->fpperspective_button = new G4OpenGLXm    406   pView->fpperspective_button = new G4OpenGLXmRadioButton ("Perspective",
407                  proj_cb_list,                    407                  proj_cb_list,
408                  pView->fVP.GetFieldHalfAngle(    408                  pView->fVP.GetFieldHalfAngle() > 0. ? True : False,
409                  1);                              409                  1);
410                                                   410   
411   pView->fpfov_text = new G4OpenGLXmTextField     411   pView->fpfov_text = new G4OpenGLXmTextField ("Field of view 0.1 -> 89.5 degrees.",
412                  &(pView->fov));                  412                  &(pView->fov));
413                                                   413   
414   pView->fpproj_style_box->AddChild (pView->fp    414   pView->fpproj_style_box->AddChild (pView->fpperspective_button);
415   pView->fpproj_style_box->AddChild (pView->fp    415   pView->fpproj_style_box->AddChild (pView->fporthogonal_button);
416   pView->fpproj_style_box->AddChild (pView->fp    416   pView->fpproj_style_box->AddChild (pView->fpfov_text);
417                                                   417   
418   pView->fpmiscellany_top->Realize ();            418   pView->fpmiscellany_top->Realize ();
419                                                   419 
420       }                                           420       }
421                                                   421       
422       break;                                      422       break;
423     }                                             423     }
424                                                   424   
425   case 1:                                         425   case 1:
426     {                                             426     {
427       G4Xt::getInstance () -> RequireExitSecon    427       G4Xt::getInstance () -> RequireExitSecondaryLoop (OGL_EXIT_CODE);
428       break;                                      428       break;
429     }                                             429     }
430                                                   430   
431   case 2:                                         431   case 2:
432     {                                             432     {
433       if (!pView->fpprint_top) {                  433       if (!pView->fpprint_top) {
434                                                   434   
435   std::ostringstream print_Name;                  435   std::ostringstream print_Name;
436   print_Name << pView->GetSceneHandler()->GetS    436   print_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
437                                                   437   
438   pView->fpprint_top = new G4OpenGLXmTopLevelS    438   pView->fpprint_top = new G4OpenGLXmTopLevelShell (pView, 
439                 (char*)print_Name.str().c_str(    439                 (char*)print_Name.str().c_str());
440                                                   440 
441   pView->fpprint_box = new G4OpenGLXmFramedBox    441   pView->fpprint_box = new G4OpenGLXmFramedBox ("Create EPS file of current view",
442                    False);                        442                    False);
443                                                   443 
444   pView->fpprint_top->AddChild (pView->fpprint    444   pView->fpprint_top->AddChild (pView->fpprint_box);
445                                                   445   
446   pView->fpprint_col_box = new G4OpenGLXmFrame    446   pView->fpprint_col_box = new G4OpenGLXmFramedBox ("Colour choice",
447                 True);                            447                 True);
448   pView->fpprint_top->AddChild (pView->fpprint    448   pView->fpprint_top->AddChild (pView->fpprint_col_box);
449                                                   449 
450   XtCallbackRec* prcol_cb_list = new XtCallbac    450   XtCallbackRec* prcol_cb_list = new XtCallbackRec[2];
451   prcol_cb_list[0].callback = set_print_colour    451   prcol_cb_list[0].callback = set_print_colour_callback;
452   prcol_cb_list[0].closure = pView;               452   prcol_cb_list[0].closure = pView; 
453   prcol_cb_list[1].callback = NULL;               453   prcol_cb_list[1].callback = NULL;
454                                                   454   
455   pView->fpprint_col_radio1 = new G4OpenGLXmRa    455   pView->fpprint_col_radio1 = new G4OpenGLXmRadioButton ("Black and white",
456                      prcol_cb_list,               456                      prcol_cb_list,
457                      pView->fPrintColour==fals    457                      pView->fPrintColour==false ? True : False,
458                      0);                          458                      0);
459                                                   459   
460   pView->fpprint_col_radio2 = new G4OpenGLXmRa    460   pView->fpprint_col_radio2 = new G4OpenGLXmRadioButton ("Colour",
461                      prcol_cb_list,               461                      prcol_cb_list,
462                      pView->fPrintColour==true    462                      pView->fPrintColour==true ? True : False,
463                      1);                          463                      1);
464                                                   464   
465   pView->fpprint_col_box->AddChild (pView->fpp    465   pView->fpprint_col_box->AddChild (pView->fpprint_col_radio1);
466   pView->fpprint_col_box->AddChild (pView->fpp    466   pView->fpprint_col_box->AddChild (pView->fpprint_col_radio2);
467                                                   467 
468   pView->fpprint_style_box = new G4OpenGLXmFra    468   pView->fpprint_style_box = new G4OpenGLXmFramedBox ("File type",
469                   True);                          469                   True);
470   pView->fpprint_top->AddChild (pView->fpprint    470   pView->fpprint_top->AddChild (pView->fpprint_style_box);
471                                                   471 
472   XtCallbackRec* prsty_cb_list = new XtCallbac    472   XtCallbackRec* prsty_cb_list = new XtCallbackRec[2];
473   prsty_cb_list[0].callback = set_print_style_    473   prsty_cb_list[0].callback = set_print_style_callback;
474   prsty_cb_list[0].closure = pView;               474   prsty_cb_list[0].closure = pView; 
475   prsty_cb_list[1].callback = NULL;               475   prsty_cb_list[1].callback = NULL;
476                                                   476   
477   pView->fpprint_style_radio1 = new G4OpenGLXm    477   pView->fpprint_style_radio1 = new G4OpenGLXmRadioButton ("Screen dump (pixmap)",
478                  prsty_cb_list,                   478                  prsty_cb_list,
479                  pView->fVectoredPs==false ? T    479                  pView->fVectoredPs==false ? True : False,
480                  0);                              480                  0);
481                                                   481   
482   pView->fpprint_style_radio2 = new G4OpenGLXm    482   pView->fpprint_style_radio2 = new G4OpenGLXmRadioButton ("PostScript",
483                  prsty_cb_list,                   483                  prsty_cb_list,
484                  pView->fVectoredPs==true ? Tr    484                  pView->fVectoredPs==true ? True : False,
485                  1);                              485                  1);
486                                                   486   
487   pView->fpprint_style_box->AddChild (pView->f    487   pView->fpprint_style_box->AddChild (pView->fpprint_style_radio1);
488   pView->fpprint_style_box->AddChild (pView->f    488   pView->fpprint_style_box->AddChild (pView->fpprint_style_radio2);
489                                                   489   
490   pView->fpprint_text = new G4OpenGLXmTextFiel    490   pView->fpprint_text = new G4OpenGLXmTextField ("Name of .eps file to save",
491                    (pView->getRealPrintFilenam    491                    (pView->getRealPrintFilename().c_str()));
492   pView->fpprint_box->AddChild (pView->fpprint    492   pView->fpprint_box->AddChild (pView->fpprint_text); 
493                                                   493   
494   pView->fpprint_line = new G4OpenGLXmSeparato    494   pView->fpprint_line = new G4OpenGLXmSeparator ();
495   pView->fpprint_box->AddChild (pView->fpprint    495   pView->fpprint_box->AddChild (pView->fpprint_line);
496                                                   496 
497   XtCallbackRec* pri_cb_list = new XtCallbackR    497   XtCallbackRec* pri_cb_list = new XtCallbackRec[2];
498   pri_cb_list[0].callback = print_callback;       498   pri_cb_list[0].callback = print_callback;
499   pri_cb_list[0].closure = pView;                 499   pri_cb_list[0].closure = pView; 
500   pri_cb_list[1].callback = NULL;                 500   pri_cb_list[1].callback = NULL;
501                                                   501   
502                                                   502   
503   pView->fpprint_button = new G4OpenGLXmPushBu    503   pView->fpprint_button = new G4OpenGLXmPushButton ("Create EPS file",
504                 pri_cb_list);                     504                 pri_cb_list);
505                                                   505   
506   pView->fpprint_box->AddChild (pView->fpprint    506   pView->fpprint_box->AddChild (pView->fpprint_button);
507   pView->fpprint_top->Realize ();                 507   pView->fpprint_top->Realize ();
508                                                   508 
509       }                                           509       }
510                                                   510       
511       ///ajw                                      511       ///ajw
512       break;                                      512       break;
513     }                                             513     }
514                                                   514   
515   default:                                        515   default:
516     G4Exception                                   516     G4Exception
517       ("G4OpenGLXmViewer::misc_callback",         517       ("G4OpenGLXmViewer::misc_callback",
518        "opengl2002", FatalException,              518        "opengl2002", FatalException,
519        "Unrecognised widget child of misc_call    519        "Unrecognised widget child of misc_callback.");
520   }                                               520   }
521                                                   521   
522   return;                                         522   return;
523                                                   523   
524 }                                                 524 }
525                                                   525 
526 void G4OpenGLXmViewer::set_wob_sens_callback (    526 void G4OpenGLXmViewer::set_wob_sens_callback (Widget w, 
527               XtPointer clientData,               527               XtPointer clientData, 
528               XtPointer callData)                 528               XtPointer callData) 
529 {                                                 529 {
530   XmScaleCallbackStruct *cbs = (XmScaleCallbac    530   XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
531   G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*    531   G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
532   short dp = -1;                                  532   short dp = -1;
533   G4float ten_to_the_dp = 10.;                    533   G4float ten_to_the_dp = 10.;
534                                                   534   
535   XtVaGetValues (w,                               535   XtVaGetValues (w, 
536      XmNdecimalPoints, &dp,                       536      XmNdecimalPoints, &dp,
537      NULL);                                       537      NULL);
538                                                   538   
539   if (dp == 0) {                                  539   if (dp == 0) {
540     ten_to_the_dp = 1.;                           540     ten_to_the_dp = 1.;
541   } else if ( dp > 0) {                           541   } else if ( dp > 0) {
542     for (G4int i = 1; i < (G4int)dp; i++) {       542     for (G4int i = 1; i < (G4int)dp; i++) {
543       ten_to_the_dp *= 10.;                       543       ten_to_the_dp *= 10.;
544     }                                             544     }
545   } else {                                        545   } else {
546     G4Exception                                   546     G4Exception
547       ("G4OpenGLXmViewer::set_wob_sens_callbac    547       ("G4OpenGLXmViewer::set_wob_sens_callback",
548        "opengl2003", FatalException,              548        "opengl2003", FatalException,
549        "Bad value returned for dp in set_rot_s    549        "Bad value returned for dp in set_rot_sens_callback");
550   }                                               550   }
551                                                   551   
552   pView->wob_sens = (G4float)(cbs->value) / te    552   pView->wob_sens = (G4float)(cbs->value) / ten_to_the_dp;
553 }                                                 553 }  
554                                                   554 
555 void G4OpenGLXmViewer::update_panels_callback     555 void G4OpenGLXmViewer::update_panels_callback (Widget, 
556                XtPointer clientData,              556                XtPointer clientData, 
557                XtPointer)                         557                XtPointer) 
558 {                                                 558 {
559   G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*    559   G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
560                                                   560   
561   if (pView->fppanning_slider) {                  561   if (pView->fppanning_slider) {
562     pView->fppanning_slider->SetMaxValue (pVie    562     pView->fppanning_slider->SetMaxValue (pView->pan_sens_limit);
563   }                                               563   }
564   if (pView->fprotation_slider) {                 564   if (pView->fprotation_slider) {
565     pView->fprotation_slider->SetMaxValue (pVi    565     pView->fprotation_slider->SetMaxValue (pView->rot_sens_limit);
566   }                                               566   }
567                                                   567   
568   if (pView->fpzoom_slider) {                     568   if (pView->fpzoom_slider) {
569     pView->fpzoom_slider->SetMaxValue (pView->    569     pView->fpzoom_slider->SetMaxValue (pView->zoom_high);
570     pView->fpzoom_slider->SetMinValue (pView->    570     pView->fpzoom_slider->SetMinValue (pView->zoom_low);
571     pView->fpzoom_slider->SetInitialValue (pVi    571     pView->fpzoom_slider->SetInitialValue (pView->fVP.GetZoomFactor());
572   }                                               572   }
573                                                   573   
574   if (pView->fpdolly_slider) {                    574   if (pView->fpdolly_slider) {
575     pView->fpdolly_slider->SetMaxValue (pView-    575     pView->fpdolly_slider->SetMaxValue (pView->dolly_high);
576     pView->fpdolly_slider->SetMinValue (pView-    576     pView->fpdolly_slider->SetMinValue (pView->dolly_low);
577   }                                               577   }
578 }                                                 578 }
579                                                   579