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