37 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER
41 #include <Xm/ToggleB.h>
45 void G4OpenGLXmViewer::zoom_callback (Widget
w,
49 XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
50 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
55 XmNdecimalPoints, &dp,
75 pView->fVP.SetZoomFactor (zoomBy);
81 void G4OpenGLXmViewer::dolly_callback (Widget w,
85 XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
86 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
91 XmNdecimalPoints, &dp,
107 pView->fVP.SetDolly (dolly);
114 void G4OpenGLXmViewer::pan_left_right_callback (Widget w,
115 XtPointer clientData,
118 XmArrowButtonCallbackStruct *cbs = (XmArrowButtonCallbackStruct*) callData;
119 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
121 pView->pan_right = get_boolean_userData (w);
123 if (cbs->reason == XmCR_ARM) {
124 left_right_pan_callback (pView,NULL);
125 }
else if (cbs->reason == XmCR_DISARM) {
126 XtRemoveTimeOut (pView->pan_timer);
130 void G4OpenGLXmViewer::left_right_pan_callback (XtPointer clientData,
131 XtIntervalId* timer_id)
134 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
137 if (pView->pan_right) {
138 delta = pView->fPan_sens;
140 delta = -pView->fPan_sens;
144 = pView -> GetSceneHandler()->GetScene()->GetStandardTargetPoint();
146 G4Point3D tp = stp + pView -> fVP.GetCurrentTargetPoint ();
148 const G4Vector3D& upVector = pView->fVP.GetUpVector ();
149 const G4Vector3D& vpVector = pView->fVP.GetViewpointDirection ();
154 tp += delta * unitRight;
155 pView->fVP.SetCurrentTargetPoint (tp - stp);
161 pView->pan_timer = XtAppAddTimeOut
163 timer_id == NULL ? 500 : 1,
164 left_right_pan_callback,
168 void G4OpenGLXmViewer::pan_up_down_callback (Widget w,
169 XtPointer clientData,
172 XmArrowButtonCallbackStruct *cbs = (XmArrowButtonCallbackStruct*) callData;
173 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
175 pView->pan_up = get_boolean_userData (w);
177 if (cbs->reason == XmCR_ARM) {
178 up_down_pan_callback (pView,NULL);
179 }
else if (cbs->reason == XmCR_DISARM) {
180 XtRemoveTimeOut (pView->pan_timer);
184 void G4OpenGLXmViewer::up_down_pan_callback (XtPointer clientData,
185 XtIntervalId* timer_id)
187 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
191 delta = pView->fPan_sens;
193 delta = -(pView->fPan_sens);
197 = pView -> GetSceneHandler()->GetScene()->GetStandardTargetPoint();
198 G4Point3D tp = stp + pView -> fVP.GetCurrentTargetPoint ();
199 const G4Vector3D& upVector = pView->fVP.GetUpVector ();
200 const G4Vector3D& vpVector = pView->fVP.GetViewpointDirection ();
204 tp += delta * unitUp;
205 pView->fVP.SetCurrentTargetPoint (tp - stp);
211 pView->pan_timer = XtAppAddTimeOut
213 timer_id == NULL ? 500 : 1,
214 up_down_pan_callback,
218 void G4OpenGLXmViewer::set_pan_sens_callback (Widget w,
219 XtPointer clientData,
222 XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
223 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
228 XmNdecimalPoints, &dp,
233 }
else if ( dp > 0) {
235 ten_to_the_dp *= 10.;
242 pView->fPan_sens = (
G4double)((cbs->value) / ten_to_the_dp);