| 1 | //
|
|---|
| 2 | // ********************************************************************
|
|---|
| 3 | // * License and Disclaimer *
|
|---|
| 4 | // * *
|
|---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of *
|
|---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and *
|
|---|
| 7 | // * conditions of the Geant4 Software License, included in the file *
|
|---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These *
|
|---|
| 9 | // * include a list of copyright holders. *
|
|---|
| 10 | // * *
|
|---|
| 11 | // * Neither the authors of this software system, nor their employing *
|
|---|
| 12 | // * institutes,nor the agencies providing financial support for this *
|
|---|
| 13 | // * work make any representation or warranty, express or implied, *
|
|---|
| 14 | // * regarding this software system or assume any liability for its *
|
|---|
| 15 | // * use. Please see the license in the file LICENSE and URL above *
|
|---|
| 16 | // * for the full disclaimer and the limitation of liability. *
|
|---|
| 17 | // * *
|
|---|
| 18 | // * This code implementation is the result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | //
|
|---|
| 27 | // $Id: G4OpenGLXmMainMenubarCallbacks.cc,v 1.13 2006/06/29 21:19:48 gunter Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-08-01-patch-01 $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // Andrew Walkden 16th April 1997
|
|---|
| 32 | // G4OpenGLXmMainMenubarCallbacks :
|
|---|
| 33 | // Collection of callback functions
|
|---|
| 34 | // to handle events generated by the
|
|---|
| 35 | // main OpenGLXm window menubar.
|
|---|
| 36 | //
|
|---|
| 37 | // See G4OpenGLXmMainMenubarCallbacks.hh for more information.
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 | #ifdef G4VIS_BUILD_OPENGLXM_DRIVER
|
|---|
| 41 |
|
|---|
| 42 | #include "G4Xt.hh"
|
|---|
| 43 |
|
|---|
| 44 | #include "G4OpenGLXmViewer.hh"
|
|---|
| 45 |
|
|---|
| 46 | #include "G4Scene.hh"
|
|---|
| 47 |
|
|---|
| 48 | #include "G4OpenGLXmRadioButton.hh"
|
|---|
| 49 | #include "G4OpenGLXmSliderBar.hh"
|
|---|
| 50 | #include "G4OpenGLXmFourArrowButtons.hh"
|
|---|
| 51 | #include "G4OpenGLXmTextField.hh"
|
|---|
| 52 | #include "G4OpenGLXmPushButton.hh"
|
|---|
| 53 | #include "G4OpenGLXmBox.hh"
|
|---|
| 54 | #include "G4OpenGLXmFramedBox.hh"
|
|---|
| 55 | #include "G4OpenGLXmTopLevelShell.hh"
|
|---|
| 56 | #include "G4OpenGLXmSeparator.hh"
|
|---|
| 57 |
|
|---|
| 58 | #include <sstream>
|
|---|
| 59 |
|
|---|
| 60 | void G4OpenGLXmViewer::actions_callback (Widget w,
|
|---|
| 61 | XtPointer clientData,
|
|---|
| 62 | XtPointer)
|
|---|
| 63 | {
|
|---|
| 64 |
|
|---|
| 65 | G4OpenGLXmViewer* pView;
|
|---|
| 66 | G4long choice = (G4long)clientData;
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 | XtVaGetValues (XtParent(w),
|
|---|
| 70 | XmNuserData, &pView,
|
|---|
| 71 | NULL);
|
|---|
| 72 |
|
|---|
| 73 | switch (choice) {
|
|---|
| 74 |
|
|---|
| 75 | case 0:
|
|---|
| 76 |
|
|---|
| 77 | {
|
|---|
| 78 |
|
|---|
| 79 | if (!pView->fprotation_top) {
|
|---|
| 80 | std::ostringstream rot_Name;
|
|---|
| 81 | rot_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
|
|---|
| 82 |
|
|---|
| 83 | pView->fprotation_top = new G4OpenGLXmTopLevelShell (pView,
|
|---|
| 84 | (char*)rot_Name.str().c_str());
|
|---|
| 85 | pView->fprotation_button_box = new G4OpenGLXmBox ("Rotation button box", True);
|
|---|
| 86 |
|
|---|
| 87 | pView->fprotation_top->AddChild (pView->fprotation_button_box);
|
|---|
| 88 |
|
|---|
| 89 | XtCallbackRec* rot_cb_list = new XtCallbackRec[2];
|
|---|
| 90 | rot_cb_list[0].callback = set_rot_subject_callback;
|
|---|
| 91 | rot_cb_list[0].closure = pView;
|
|---|
| 92 | rot_cb_list[1].callback = NULL;
|
|---|
| 93 |
|
|---|
| 94 | pView->fprotation_button1 = new G4OpenGLXmRadioButton
|
|---|
| 95 | ("Object",
|
|---|
| 96 | rot_cb_list,
|
|---|
| 97 | pView->GetViewParameters().GetLightsMoveWithCamera(),
|
|---|
| 98 | 0);
|
|---|
| 99 |
|
|---|
| 100 | pView->fprotation_button2 = new G4OpenGLXmRadioButton
|
|---|
| 101 | ("Camera",
|
|---|
| 102 | rot_cb_list,
|
|---|
| 103 | !(pView->GetViewParameters().GetLightsMoveWithCamera()),
|
|---|
| 104 | 1);
|
|---|
| 105 |
|
|---|
| 106 | pView->fprotation_button_box->AddChild (pView->fprotation_button1);
|
|---|
| 107 | pView->fprotation_button_box->AddChild (pView->fprotation_button2);
|
|---|
| 108 |
|
|---|
| 109 | pView->fprotation_slider_box = new G4OpenGLXmBox ("Rotation slider box", False);
|
|---|
| 110 | pView->fprotation_top->AddChild (pView->fprotation_slider_box);
|
|---|
| 111 |
|
|---|
| 112 | XtCallbackRec* rot_slider_list = new XtCallbackRec[2];
|
|---|
| 113 | rot_slider_list[0].callback = set_rot_sens_callback;
|
|---|
| 114 | rot_slider_list[0].closure = pView;
|
|---|
| 115 | rot_slider_list[1].callback = NULL;
|
|---|
| 116 |
|
|---|
| 117 | pView->fprotation_slider = new G4OpenGLXmSliderBar ("Rotation slider",
|
|---|
| 118 | rot_slider_list,
|
|---|
| 119 | True,
|
|---|
| 120 | 2,
|
|---|
| 121 | pView->rot_sens,
|
|---|
| 122 | pView->rot_sens_limit,
|
|---|
| 123 | 0);
|
|---|
| 124 | pView->fprotation_slider_box->AddChild (pView->fprotation_slider);
|
|---|
| 125 |
|
|---|
| 126 | pView->fprotation_arrow_box = new G4OpenGLXmBox ("Rotation arrow box", False);
|
|---|
| 127 | pView->fprotation_top->AddChild (pView->fprotation_arrow_box);
|
|---|
| 128 |
|
|---|
| 129 | XtCallbackRec** rotation_callbacks = new XtCallbackRec*[4];
|
|---|
| 130 | for (G4int i = 0; i < 4; i++) {
|
|---|
| 131 | rotation_callbacks[i] = new XtCallbackRec[2];
|
|---|
| 132 | }
|
|---|
| 133 | rotation_callbacks[0][0].callback = phi_rotation_callback;
|
|---|
| 134 | rotation_callbacks[0][0].closure = pView;
|
|---|
| 135 | rotation_callbacks[0][1].callback = NULL;
|
|---|
| 136 |
|
|---|
| 137 | rotation_callbacks[1][0].callback = phi_rotation_callback;
|
|---|
| 138 | rotation_callbacks[1][0].closure = pView;
|
|---|
| 139 | rotation_callbacks[1][1].callback = NULL;
|
|---|
| 140 |
|
|---|
| 141 | rotation_callbacks[2][0].callback = theta_rotation_callback;
|
|---|
| 142 | rotation_callbacks[2][0].closure = pView;
|
|---|
| 143 | rotation_callbacks[2][1].callback = NULL;
|
|---|
| 144 |
|
|---|
| 145 | rotation_callbacks[3][0].callback = theta_rotation_callback;
|
|---|
| 146 | rotation_callbacks[3][0].closure = pView;
|
|---|
| 147 | rotation_callbacks[3][1].callback = NULL;
|
|---|
| 148 |
|
|---|
| 149 | pView->fprotation_arrow = new G4OpenGLXmFourArrowButtons (rotation_callbacks);
|
|---|
| 150 |
|
|---|
| 151 | pView->fprotation_arrow_box->AddChild (pView->fprotation_arrow);
|
|---|
| 152 |
|
|---|
| 153 | pView->fprotation_top->Realize ();
|
|---|
| 154 | }
|
|---|
| 155 | break;
|
|---|
| 156 |
|
|---|
| 157 | }
|
|---|
| 158 |
|
|---|
| 159 |
|
|---|
| 160 | case 1:
|
|---|
| 161 | {
|
|---|
| 162 |
|
|---|
| 163 | if (!pView->fppanning_top) {
|
|---|
| 164 | std::ostringstream pan_Name;
|
|---|
| 165 | pan_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
|
|---|
| 166 |
|
|---|
| 167 | pView->fppanning_top = new G4OpenGLXmTopLevelShell (pView,
|
|---|
| 168 | (char*)pan_Name.str().c_str());
|
|---|
| 169 |
|
|---|
| 170 | pView->fppanning_box = new G4OpenGLXmFramedBox ("Pan up-down-left-right",
|
|---|
| 171 | False);
|
|---|
| 172 |
|
|---|
| 173 | pView->fppanning_top->AddChild (pView->fppanning_box);
|
|---|
| 174 |
|
|---|
| 175 | XtCallbackRec** pan_callbacks = new XtCallbackRec*[4];
|
|---|
| 176 | for (G4int i = 0; i < 4; i++) {
|
|---|
| 177 | pan_callbacks[i] = new XtCallbackRec[2];
|
|---|
| 178 | }
|
|---|
| 179 | pan_callbacks[0][0].callback = pan_up_down_callback;
|
|---|
| 180 | pan_callbacks[0][0].closure = pView;
|
|---|
| 181 | pan_callbacks[0][1].callback = NULL;
|
|---|
| 182 |
|
|---|
| 183 | pan_callbacks[1][0].callback = pan_up_down_callback;
|
|---|
| 184 | pan_callbacks[1][0].closure = pView;
|
|---|
| 185 | pan_callbacks[1][1].callback = NULL;
|
|---|
| 186 |
|
|---|
| 187 | pan_callbacks[2][0].callback = pan_left_right_callback;
|
|---|
| 188 | pan_callbacks[2][0].closure = pView;
|
|---|
| 189 | pan_callbacks[2][1].callback = NULL;
|
|---|
| 190 |
|
|---|
| 191 | pan_callbacks[3][0].callback = pan_left_right_callback;
|
|---|
| 192 | pan_callbacks[3][0].closure = pView;
|
|---|
| 193 | pan_callbacks[3][1].callback = NULL;
|
|---|
| 194 |
|
|---|
| 195 | pView->fppanning_arrows = new G4OpenGLXmFourArrowButtons (pan_callbacks);
|
|---|
| 196 |
|
|---|
| 197 | pView->fppanning_box->AddChild (pView->fppanning_arrows);
|
|---|
| 198 |
|
|---|
| 199 | XtCallbackRec* pan_slider_list = new XtCallbackRec[2];
|
|---|
| 200 | pan_slider_list[0].callback = set_pan_sens_callback;
|
|---|
| 201 | pan_slider_list[0].closure = pView;
|
|---|
| 202 | pan_slider_list[1].callback = NULL;
|
|---|
| 203 |
|
|---|
| 204 | pView->fppanning_slider = new G4OpenGLXmSliderBar ("Panning slider",
|
|---|
| 205 | pan_slider_list,
|
|---|
| 206 | True,
|
|---|
| 207 | 2,
|
|---|
| 208 | pView->pan_sens = pView->GetSceneHandler()->GetScene()->GetExtent().GetExtentRadius() / 10.0,
|
|---|
| 209 | pView->pan_sens_limit = pView->GetSceneHandler()->GetScene()->GetExtent().GetExtentRadius(),
|
|---|
| 210 | 0);
|
|---|
| 211 | pView->fppanning_box->AddChild (pView->fppanning_slider);
|
|---|
| 212 |
|
|---|
| 213 | pView->fpzoom_box = new G4OpenGLXmFramedBox ("Zoom",
|
|---|
| 214 | False);
|
|---|
| 215 | pView->fppanning_top->AddChild (pView->fpzoom_box);
|
|---|
| 216 |
|
|---|
| 217 | XtCallbackRec* zoom_slider_list = new XtCallbackRec[2];
|
|---|
| 218 | zoom_slider_list[0].callback = zoom_callback;
|
|---|
| 219 | zoom_slider_list[0].closure = pView;
|
|---|
| 220 | zoom_slider_list[1].callback = NULL;
|
|---|
| 221 |
|
|---|
| 222 | pView->fpzoom_slider = new G4OpenGLXmSliderBar ("Zoom slider",
|
|---|
| 223 | zoom_slider_list,
|
|---|
| 224 | True,
|
|---|
| 225 | 2,
|
|---|
| 226 | pView->fVP.GetZoomFactor(),
|
|---|
| 227 | pView->zoom_high,
|
|---|
| 228 | pView->zoom_low);
|
|---|
| 229 | pView->fpzoom_box->AddChild (pView->fpzoom_slider);
|
|---|
| 230 |
|
|---|
| 231 | pView->fpdolly_box = new G4OpenGLXmFramedBox ("Dolly",
|
|---|
| 232 | False);
|
|---|
| 233 | pView->fppanning_top->AddChild (pView->fpdolly_box);
|
|---|
| 234 |
|
|---|
| 235 | XtCallbackRec* dolly_slider_list = new XtCallbackRec[2];
|
|---|
| 236 | dolly_slider_list[0].callback = dolly_callback;
|
|---|
| 237 | dolly_slider_list[0].closure = pView;
|
|---|
| 238 | dolly_slider_list[1].callback = NULL;
|
|---|
| 239 |
|
|---|
| 240 | pView->fpdolly_slider = new G4OpenGLXmSliderBar ("Dolly slider",
|
|---|
| 241 | dolly_slider_list,
|
|---|
| 242 | True,
|
|---|
| 243 | 2,
|
|---|
| 244 | pView->fVP.GetDolly(),
|
|---|
| 245 | pView->dolly_high = pView->GetSceneHandler()->GetScene()->GetExtent().GetExtentRadius(),
|
|---|
| 246 | pView->dolly_low = -(pView->GetSceneHandler()->GetScene()->GetExtent().GetExtentRadius()));
|
|---|
| 247 | // pView->dolly_high,
|
|---|
| 248 | // pView->dolly_low);
|
|---|
| 249 | pView->fpdolly_box->AddChild (pView->fpdolly_slider);
|
|---|
| 250 |
|
|---|
| 251 | pView->fppanning_top->Realize ();
|
|---|
| 252 | }
|
|---|
| 253 |
|
|---|
| 254 | break;
|
|---|
| 255 |
|
|---|
| 256 | }
|
|---|
| 257 | case 2:
|
|---|
| 258 | {
|
|---|
| 259 |
|
|---|
| 260 | if (!pView->fpsetting_top) {
|
|---|
| 261 | std::ostringstream set_Name;
|
|---|
| 262 | set_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
|
|---|
| 263 |
|
|---|
| 264 | pView->fpsetting_top = new G4OpenGLXmTopLevelShell(pView,
|
|---|
| 265 | (char*)set_Name.str().c_str());
|
|---|
| 266 |
|
|---|
| 267 | pView->fpsetting_box = new G4OpenGLXmFramedBox ("Set values for control panels",
|
|---|
| 268 | False);
|
|---|
| 269 | pView->fpsetting_top->AddChild (pView->fpsetting_box);
|
|---|
| 270 |
|
|---|
| 271 | pView->fppan_set = new G4OpenGLXmTextField ("Upper limit of pan sensitivity",
|
|---|
| 272 | &(pView->pan_sens_limit));
|
|---|
| 273 |
|
|---|
| 274 | pView->fprot_set = new G4OpenGLXmTextField ("Upper limit of rotation sensitivity",
|
|---|
| 275 | &(pView->rot_sens_limit));
|
|---|
| 276 |
|
|---|
| 277 | pView->fpzoom_upper = new G4OpenGLXmTextField ("Upper limit of zoom",
|
|---|
| 278 | &(pView->zoom_high));
|
|---|
| 279 |
|
|---|
| 280 | pView->fpzoom_lower = new G4OpenGLXmTextField ("Lower limit of zoom",
|
|---|
| 281 | &(pView->zoom_low));
|
|---|
| 282 |
|
|---|
| 283 | pView->fpdolly_upper = new G4OpenGLXmTextField ("Upper limit of dolly",
|
|---|
| 284 | &(pView->dolly_high));
|
|---|
| 285 |
|
|---|
| 286 | pView->fpdolly_lower = new G4OpenGLXmTextField ("Lower limit of dolly",
|
|---|
| 287 | &(pView->dolly_low));
|
|---|
| 288 |
|
|---|
| 289 | XtCallbackRec* ok_list = new XtCallbackRec[2];
|
|---|
| 290 | ok_list[0].callback = update_panels_callback;
|
|---|
| 291 | ok_list[0].closure = pView;
|
|---|
| 292 | ok_list[1].callback = NULL;
|
|---|
| 293 |
|
|---|
| 294 |
|
|---|
| 295 | pView->fpok_button = new G4OpenGLXmPushButton ("ok",
|
|---|
| 296 | ok_list);
|
|---|
| 297 |
|
|---|
| 298 | pView->fpsetting_box->AddChild (pView->fppan_set);
|
|---|
| 299 | pView->fpsetting_box->AddChild (pView->fprot_set);
|
|---|
| 300 | pView->fpsetting_box->AddChild (pView->fpzoom_upper);
|
|---|
| 301 | pView->fpsetting_box->AddChild (pView->fpzoom_lower);
|
|---|
| 302 | pView->fpsetting_box->AddChild (pView->fpdolly_upper);
|
|---|
| 303 | pView->fpsetting_box->AddChild (pView->fpdolly_lower);
|
|---|
| 304 | pView->fpsetting_box->AddChild (pView->fpok_button);
|
|---|
| 305 |
|
|---|
| 306 | pView->fpsetting_top->Realize ();
|
|---|
| 307 |
|
|---|
| 308 | }
|
|---|
| 309 |
|
|---|
| 310 | break;
|
|---|
| 311 | }
|
|---|
| 312 |
|
|---|
| 313 | default:
|
|---|
| 314 | G4Exception("Unrecognised widget child of control_callback");
|
|---|
| 315 | }
|
|---|
| 316 |
|
|---|
| 317 | return;
|
|---|
| 318 | }
|
|---|
| 319 |
|
|---|
| 320 |
|
|---|
| 321 |
|
|---|
| 322 | void G4OpenGLXmViewer::misc_callback (Widget w,
|
|---|
| 323 | XtPointer clientData,
|
|---|
| 324 | XtPointer)
|
|---|
| 325 | {
|
|---|
| 326 | G4OpenGLXmViewer* pView;
|
|---|
| 327 | G4long choice = (G4long)clientData;
|
|---|
| 328 | XtVaGetValues (XtParent(w),
|
|---|
| 329 | XmNuserData, &pView,
|
|---|
| 330 | NULL);
|
|---|
| 331 |
|
|---|
| 332 | switch (choice) {
|
|---|
| 333 |
|
|---|
| 334 | case 0:
|
|---|
| 335 | {
|
|---|
| 336 |
|
|---|
| 337 | if (!pView->fpmiscellany_top) {
|
|---|
| 338 |
|
|---|
| 339 | std::ostringstream misc_Name;
|
|---|
| 340 | misc_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
|
|---|
| 341 |
|
|---|
| 342 | pView->fpmiscellany_top = new G4OpenGLXmTopLevelShell (pView,
|
|---|
| 343 | (char*)misc_Name.str().c_str());
|
|---|
| 344 | pView->fpwobble_box = new G4OpenGLXmFramedBox ("Wobble view",
|
|---|
| 345 | True);
|
|---|
| 346 | pView->fpmiscellany_top->AddChild (pView->fpwobble_box);
|
|---|
| 347 |
|
|---|
| 348 | XtCallbackRec* wob_cb_list = new XtCallbackRec[2];
|
|---|
| 349 | wob_cb_list[0].callback = wobble_callback;
|
|---|
| 350 | wob_cb_list[0].closure = pView;
|
|---|
| 351 | wob_cb_list[1].callback = NULL;
|
|---|
| 352 |
|
|---|
| 353 |
|
|---|
| 354 | pView->fpwobble_button = new G4OpenGLXmPushButton ("Wobble",
|
|---|
| 355 | wob_cb_list);
|
|---|
| 356 |
|
|---|
| 357 | XtCallbackRec* wobble_slider_list = new XtCallbackRec[2];
|
|---|
| 358 | wobble_slider_list[0].callback = set_wob_sens_callback;
|
|---|
| 359 | wobble_slider_list[0].closure = pView;
|
|---|
| 360 | wobble_slider_list[1].callback = NULL;
|
|---|
| 361 |
|
|---|
| 362 | pView->fpwobble_slider = new G4OpenGLXmSliderBar ("Wobble slider",
|
|---|
| 363 | wobble_slider_list,
|
|---|
| 364 | True,
|
|---|
| 365 | 0,
|
|---|
| 366 | 20,
|
|---|
| 367 | 50,
|
|---|
| 368 | 0);
|
|---|
| 369 | pView->fpwobble_box->AddChild (pView->fpwobble_button);
|
|---|
| 370 | pView->fpwobble_box->AddChild (pView->fpwobble_slider);
|
|---|
| 371 |
|
|---|
| 372 | pView->fpreset_box = new G4OpenGLXmFramedBox ("Reset view",
|
|---|
| 373 | True);
|
|---|
| 374 | pView->fpmiscellany_top->AddChild (pView->fpreset_box);
|
|---|
| 375 |
|
|---|
| 376 | XtCallbackRec* rst_cb_list = new XtCallbackRec[3];
|
|---|
| 377 | rst_cb_list[0].callback = reset_callback;
|
|---|
| 378 | rst_cb_list[0].closure = pView;
|
|---|
| 379 | rst_cb_list[1].callback = update_panels_callback;
|
|---|
| 380 | rst_cb_list[1].closure = pView;
|
|---|
| 381 | rst_cb_list[2].callback = NULL;
|
|---|
| 382 |
|
|---|
| 383 | pView->fpreset_button = new G4OpenGLXmPushButton ("Reset",
|
|---|
| 384 | rst_cb_list);
|
|---|
| 385 |
|
|---|
| 386 | pView->fpreset_box->AddChild (pView->fpreset_button);
|
|---|
| 387 |
|
|---|
| 388 | pView->fpproj_style_box = new G4OpenGLXmFramedBox ("Projection style",
|
|---|
| 389 | True);
|
|---|
| 390 | pView->fpmiscellany_top->AddChild (pView->fpproj_style_box);
|
|---|
| 391 |
|
|---|
| 392 | XtCallbackRec* proj_cb_list = new XtCallbackRec[2];
|
|---|
| 393 | proj_cb_list[0].callback = projection_callback;
|
|---|
| 394 | proj_cb_list[0].closure = pView;
|
|---|
| 395 | proj_cb_list[1].callback = NULL;
|
|---|
| 396 |
|
|---|
| 397 | pView->fporthogonal_button = new G4OpenGLXmRadioButton ("Orthographic",
|
|---|
| 398 | proj_cb_list,
|
|---|
| 399 | pView->fVP.GetFieldHalfAngle() > 0. ? False : True,
|
|---|
| 400 | 0);
|
|---|
| 401 |
|
|---|
| 402 | pView->fpperspective_button = new G4OpenGLXmRadioButton ("Perspective",
|
|---|
| 403 | proj_cb_list,
|
|---|
| 404 | pView->fVP.GetFieldHalfAngle() > 0. ? True : False,
|
|---|
| 405 | 1);
|
|---|
| 406 |
|
|---|
| 407 | pView->fpfov_text = new G4OpenGLXmTextField ("Field of view 0.1 -> 89.5 degrees.",
|
|---|
| 408 | &(pView->fov));
|
|---|
| 409 |
|
|---|
| 410 | pView->fpproj_style_box->AddChild (pView->fpperspective_button);
|
|---|
| 411 | pView->fpproj_style_box->AddChild (pView->fporthogonal_button);
|
|---|
| 412 | pView->fpproj_style_box->AddChild (pView->fpfov_text);
|
|---|
| 413 |
|
|---|
| 414 | pView->fpmiscellany_top->Realize ();
|
|---|
| 415 |
|
|---|
| 416 | }
|
|---|
| 417 |
|
|---|
| 418 | break;
|
|---|
| 419 | }
|
|---|
| 420 |
|
|---|
| 421 | case 1:
|
|---|
| 422 | {
|
|---|
| 423 | G4Xt::getInstance () -> RequireExitSecondaryLoop (OGL_EXIT_CODE);
|
|---|
| 424 | break;
|
|---|
| 425 | }
|
|---|
| 426 |
|
|---|
| 427 | case 2:
|
|---|
| 428 | {
|
|---|
| 429 | if (!pView->fpprint_top) {
|
|---|
| 430 |
|
|---|
| 431 | std::ostringstream print_Name;
|
|---|
| 432 | print_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
|
|---|
| 433 |
|
|---|
| 434 | pView->fpprint_top = new G4OpenGLXmTopLevelShell (pView,
|
|---|
| 435 | (char*)print_Name.str().c_str());
|
|---|
| 436 |
|
|---|
| 437 | pView->fpprint_box = new G4OpenGLXmFramedBox ("Create EPS file of current view",
|
|---|
| 438 | False);
|
|---|
| 439 |
|
|---|
| 440 | pView->fpprint_top->AddChild (pView->fpprint_box);
|
|---|
| 441 |
|
|---|
| 442 | pView->fpprint_col_box = new G4OpenGLXmFramedBox ("Colour choice",
|
|---|
| 443 | True);
|
|---|
| 444 | pView->fpprint_top->AddChild (pView->fpprint_col_box);
|
|---|
| 445 |
|
|---|
| 446 | XtCallbackRec* prcol_cb_list = new XtCallbackRec[2];
|
|---|
| 447 | prcol_cb_list[0].callback = set_print_colour_callback;
|
|---|
| 448 | prcol_cb_list[0].closure = pView;
|
|---|
| 449 | prcol_cb_list[1].callback = NULL;
|
|---|
| 450 |
|
|---|
| 451 | pView->fpprint_col_radio1 = new G4OpenGLXmRadioButton ("Black and white",
|
|---|
| 452 | prcol_cb_list,
|
|---|
| 453 | pView->print_colour==false ? True : False,
|
|---|
| 454 | 0);
|
|---|
| 455 |
|
|---|
| 456 | pView->fpprint_col_radio2 = new G4OpenGLXmRadioButton ("Colour",
|
|---|
| 457 | prcol_cb_list,
|
|---|
| 458 | pView->print_colour==true ? True : False,
|
|---|
| 459 | 1);
|
|---|
| 460 |
|
|---|
| 461 | pView->fpprint_col_box->AddChild (pView->fpprint_col_radio1);
|
|---|
| 462 | pView->fpprint_col_box->AddChild (pView->fpprint_col_radio2);
|
|---|
| 463 |
|
|---|
| 464 | pView->fpprint_style_box = new G4OpenGLXmFramedBox ("File type",
|
|---|
| 465 | True);
|
|---|
| 466 | pView->fpprint_top->AddChild (pView->fpprint_style_box);
|
|---|
| 467 |
|
|---|
| 468 | XtCallbackRec* prsty_cb_list = new XtCallbackRec[2];
|
|---|
| 469 | prsty_cb_list[0].callback = set_print_style_callback;
|
|---|
| 470 | prsty_cb_list[0].closure = pView;
|
|---|
| 471 | prsty_cb_list[1].callback = NULL;
|
|---|
| 472 |
|
|---|
| 473 | pView->fpprint_style_radio1 = new G4OpenGLXmRadioButton ("Screen dump (pixmap)",
|
|---|
| 474 | prsty_cb_list,
|
|---|
| 475 | pView->vectored_ps==false ? True : False,
|
|---|
| 476 | 0);
|
|---|
| 477 |
|
|---|
| 478 | pView->fpprint_style_radio2 = new G4OpenGLXmRadioButton ("PostScript",
|
|---|
| 479 | prsty_cb_list,
|
|---|
| 480 | pView->vectored_ps==true ? True : False,
|
|---|
| 481 | 1);
|
|---|
| 482 |
|
|---|
| 483 | pView->fpprint_style_box->AddChild (pView->fpprint_style_radio1);
|
|---|
| 484 | pView->fpprint_style_box->AddChild (pView->fpprint_style_radio2);
|
|---|
| 485 |
|
|---|
| 486 | pView->fpprint_text = new G4OpenGLXmTextField ("Name of .eps file to save",
|
|---|
| 487 | (pView->print_string));
|
|---|
| 488 | pView->fpprint_box->AddChild (pView->fpprint_text);
|
|---|
| 489 |
|
|---|
| 490 | pView->fpprint_line = new G4OpenGLXmSeparator ();
|
|---|
| 491 | pView->fpprint_box->AddChild (pView->fpprint_line);
|
|---|
| 492 |
|
|---|
| 493 | XtCallbackRec* pri_cb_list = new XtCallbackRec[2];
|
|---|
| 494 | pri_cb_list[0].callback = print_callback;
|
|---|
| 495 | pri_cb_list[0].closure = pView;
|
|---|
| 496 | pri_cb_list[1].callback = NULL;
|
|---|
| 497 |
|
|---|
| 498 |
|
|---|
| 499 | pView->fpprint_button = new G4OpenGLXmPushButton ("Create EPS file",
|
|---|
| 500 | pri_cb_list);
|
|---|
| 501 |
|
|---|
| 502 | pView->fpprint_box->AddChild (pView->fpprint_button);
|
|---|
| 503 | pView->fpprint_top->Realize ();
|
|---|
| 504 |
|
|---|
| 505 | }
|
|---|
| 506 |
|
|---|
| 507 | ///ajw
|
|---|
| 508 | break;
|
|---|
| 509 | }
|
|---|
| 510 |
|
|---|
| 511 | default:
|
|---|
| 512 | G4Exception("Unrecognised widget child of misc_callback.");
|
|---|
| 513 | }
|
|---|
| 514 |
|
|---|
| 515 | return;
|
|---|
| 516 |
|
|---|
| 517 | }
|
|---|
| 518 |
|
|---|
| 519 | void G4OpenGLXmViewer::set_wob_sens_callback (Widget w,
|
|---|
| 520 | XtPointer clientData,
|
|---|
| 521 | XtPointer callData)
|
|---|
| 522 | {
|
|---|
| 523 | XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
|
|---|
| 524 | G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
|
|---|
| 525 | short dp = -1;
|
|---|
| 526 | G4float ten_to_the_dp = 10.;
|
|---|
| 527 |
|
|---|
| 528 | XtVaGetValues (w,
|
|---|
| 529 | XmNdecimalPoints, &dp,
|
|---|
| 530 | NULL);
|
|---|
| 531 |
|
|---|
| 532 | if (dp == 0) {
|
|---|
| 533 | ten_to_the_dp = 1.;
|
|---|
| 534 | } else if ( dp > 0) {
|
|---|
| 535 | for (G4int i = 1; i < (G4int)dp; i++) {
|
|---|
| 536 | ten_to_the_dp *= 10.;
|
|---|
| 537 | }
|
|---|
| 538 | } else {
|
|---|
| 539 | G4Exception("Bad value returned for dp in set_rot_sens_callback");
|
|---|
| 540 | }
|
|---|
| 541 |
|
|---|
| 542 | pView->wob_sens = (G4float)(cbs->value) / ten_to_the_dp;
|
|---|
| 543 | }
|
|---|
| 544 |
|
|---|
| 545 | void G4OpenGLXmViewer::update_panels_callback (Widget,
|
|---|
| 546 | XtPointer clientData,
|
|---|
| 547 | XtPointer)
|
|---|
| 548 | {
|
|---|
| 549 | G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
|
|---|
| 550 |
|
|---|
| 551 | if (pView->fppanning_slider) {
|
|---|
| 552 | pView->fppanning_slider->SetMaxValue (pView->pan_sens_limit);
|
|---|
| 553 | }
|
|---|
| 554 | if (pView->fprotation_slider) {
|
|---|
| 555 | pView->fprotation_slider->SetMaxValue (pView->rot_sens_limit);
|
|---|
| 556 | }
|
|---|
| 557 |
|
|---|
| 558 | if (pView->fpzoom_slider) {
|
|---|
| 559 | pView->fpzoom_slider->SetMaxValue (pView->zoom_high);
|
|---|
| 560 | pView->fpzoom_slider->SetMinValue (pView->zoom_low);
|
|---|
| 561 | pView->fpzoom_slider->SetInitialValue (pView->fVP.GetZoomFactor());
|
|---|
| 562 | }
|
|---|
| 563 |
|
|---|
| 564 | if (pView->fpdolly_slider) {
|
|---|
| 565 | pView->fpdolly_slider->SetMaxValue (pView->dolly_high);
|
|---|
| 566 | pView->fpdolly_slider->SetMinValue (pView->dolly_low);
|
|---|
| 567 | }
|
|---|
| 568 | }
|
|---|
| 569 |
|
|---|
| 570 | #endif
|
|---|