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 9.2.p3)


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