| 41 | #include "G4Scene.hh" |
| 42 | |
| 43 | void G4OpenGLXmViewer::zoom_callback (Widget w, |
| 44 | XtPointer clientData, |
| 45 | XtPointer callData) |
| 46 | { |
| 47 | XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData; |
| 48 | G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData; |
| 49 | short dp = -1; |
| 50 | G4float ten_to_the_dp = 10.; |
| 51 | |
| 52 | XtVaGetValues (w, |
| 53 | XmNdecimalPoints, &dp, |
| 54 | NULL); |
| 55 | |
| 56 | if (dp == 0) { |
| 57 | ten_to_the_dp = 1.; |
| 58 | } else if ( dp > 0) { |
| 59 | for (G4int i = 1; i < (G4int)dp; i++) { |
| 60 | ten_to_the_dp *= 10.; |
| 61 | } |
| 62 | } else { |
| 63 | G4cout << "dp is " << dp << G4endl; |
| 64 | return; |
| 65 | } |
| 66 | |
| 67 | |
| 68 | G4double zoomBy = (G4double)(cbs->value) / ten_to_the_dp; |
| 69 | if (zoomBy <= 0.01) { |
| 70 | zoomBy = 0.01; |
| 71 | } |
| 72 | |
| 73 | pView->fVP.SetZoomFactor (zoomBy); |
| 74 | pView->SetView (); |
| 75 | pView->ClearView (); |
| 76 | pView -> DrawView (); |
| 77 | } |
| 78 | |
| 79 | void G4OpenGLXmViewer::dolly_callback (Widget w, |
| 80 | XtPointer clientData, |