Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4OpenGLXmViewer.hh
Go to the documentation of this file.
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$
28 //
29 //
30 // Andrew Walkden 10th February 1997
31 // G4OpenGLXmViewer : Class derived from G4OpenGLXViewer, to provide
32 // (Motif) widget OpenGL functionality for GEANT4.
33 
34 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER
35 
36 #ifndef G4OPENGLXMVIEWER_HH
37 #define G4OPENGLXMVIEWER_HH
38 
39 #include "G4OpenGLXViewer.hh"
40 #include "globals.hh"
41 
42 #include <Xm/Xm.h>
43 
44 class G4OpenGLXmTopLevelShell;
45 class G4OpenGLXmRadioButton;
46 class G4OpenGLXmPushButton;
47 class G4OpenGLXmSliderBar;
48 class G4OpenGLXmBox;
49 class G4OpenGLXmTextField;
50 class G4OpenGLXmFramedBox;
51 class G4OpenGLXmFourArrowButtons;
52 class G4OpenGLXmSeparator;
53 
54 class G4OpenGLXmViewer: public G4OpenGLXViewer {
55 
56 public:
57  G4OpenGLXmViewer (G4OpenGLSceneHandler& scene);
58  virtual ~G4OpenGLXmViewer ();
59 
60 protected:
61  virtual void ShowView ();
62  void ResetView ();
63  void GetXmConnection ();
64  virtual void CreateMainWindow ();
65 
66  XtAppContext app;
67  XtWorkProcId workId;
68  Widget toplevel,
69  shell,
70  main_win,
71  menubar,
72  style_cascade,
73  actions_cascade,
74  misc_cascade,
75  spec_cascade,
76  rep_style_pullright,
77  drawing_style_pullright,
78  background_color_pullright,
79  transparency_pullright,
80  antialias_pullright,
81  haloing_pullright,
82  aux_edge_pullright,
83  frame,
84  glxarea;
85 
86  XmString style_str,
87  actions_str,
88  misc_str,
89  spec_str,
90  rep_str,
91  draw_str,
92  polyhedron_str,
93  nurbs_str,
94  wireframe_str,
95  hlr_str,
96  hsr_str,
97  hlhsr_str,
98  set_str,
99  rot_str,
100  pan_str,
101  exit_str,
102  quit_str,
103  print_str,
104  white_str,
105  black_str,
106  anti_str,
107  trans_str,
108  halo_str,
109  aux_edge_str,
110  bgnd_str,
111  off_str,
112  on_str;
113 
114  G4double zoom_high,
115  zoom_low,
116  pan_low,
117  pan_high,
118  dolly_low,
119  dolly_high,
120  fov,
121  rot_sens_limit,
122  pan_sens_limit,
123  wob_high,
124  wob_low,
125  wob_sens;
126 
127  Pixel bgnd,
128  borcol;
129 
130  G4bool pan_right,
131  rotate_right,
132  pan_up,
133  rotate_up;
134 
135  XtIntervalId rotation_timer,
136  pan_timer,
137  wobble_timer;
138 
139  G4Vector3D original_vp;
140 
141  G4int frameNo;
142 
143  G4OpenGLXmTopLevelShell* fprotation_top;
144  G4OpenGLXmBox* fprotation_button_box;
145  G4OpenGLXmRadioButton* fprotation_button1;
146  G4OpenGLXmRadioButton* fprotation_button2;
147  G4OpenGLXmBox* fprotation_slider_box;
148  G4OpenGLXmSliderBar* fprotation_slider;
149  G4OpenGLXmBox* fprotation_arrow_box;
150  G4OpenGLXmFourArrowButtons* fprotation_arrow;
151 
152  G4OpenGLXmTopLevelShell* fppanning_top;
153  G4OpenGLXmFramedBox* fppanning_box;
154  G4OpenGLXmFourArrowButtons* fppanning_arrows;
155  G4OpenGLXmSliderBar* fppanning_slider;
156  G4OpenGLXmFramedBox* fpzoom_box;
157  G4OpenGLXmSliderBar* fpzoom_slider;
158  G4OpenGLXmFramedBox* fpdolly_box;
159  G4OpenGLXmSliderBar* fpdolly_slider;
160 
161  G4OpenGLXmTopLevelShell* fpsetting_top;
162  G4OpenGLXmFramedBox* fpsetting_box;
163  G4OpenGLXmTextField* fppan_set;
164  G4OpenGLXmTextField* fprot_set;
165  G4OpenGLXmTextField* fpzoom_upper;
166  G4OpenGLXmTextField* fpzoom_lower;
167  G4OpenGLXmTextField* fpdolly_upper;
168  G4OpenGLXmTextField* fpdolly_lower;
169  G4OpenGLXmPushButton* fpok_button;
170 
171  G4OpenGLXmTopLevelShell* fpmiscellany_top;
172  G4OpenGLXmFramedBox* fpwobble_box;
173  G4OpenGLXmPushButton* fpwobble_button;
174  G4OpenGLXmSliderBar* fpwobble_slider;
175  G4OpenGLXmFramedBox* fpreset_box;
176  G4OpenGLXmPushButton* fpreset_button;
177  G4OpenGLXmFramedBox* fpproj_style_box;
178  G4OpenGLXmRadioButton* fporthogonal_button;
179  G4OpenGLXmRadioButton* fpperspective_button;
180  G4OpenGLXmTextField* fpfov_text;
181 
182  G4OpenGLXmTopLevelShell* fpprint_top;
183  G4OpenGLXmFramedBox* fpprint_box;
184  G4OpenGLXmFramedBox* fpprint_col_box;
185  G4OpenGLXmFramedBox* fpprint_style_box;
186  G4OpenGLXmTextField* fpprint_text;
187  G4OpenGLXmPushButton* fpprint_button;
188  G4OpenGLXmSeparator* fpprint_line;
189  G4OpenGLXmRadioButton* fpprint_col_radio1;
190  G4OpenGLXmRadioButton* fpprint_col_radio2;
191  G4OpenGLXmRadioButton* fpprint_style_radio1;
192  G4OpenGLXmRadioButton* fpprint_style_radio2;
193 
194 public:
195 
196  static void expose_callback (Widget w,
197  XtPointer clientData,
198  XtPointer callData);
199 
200  static void resize_callback (Widget w,
201  XtPointer clientData,
202  XtPointer callData);
203 
204  static void actions_callback (Widget w,
205  XtPointer clientData,
206  XtPointer callData);
207 
208  static void misc_callback (Widget w,
209  XtPointer clientData,
210  XtPointer callData);
211 
212  static void Add_set_field (char* widget,
213  char* widget_text,
214  Widget* row_col_box,
215  Widget* wid,
216  G4double* val,
217  G4OpenGLXmViewer* pView);
218 
219  static void zoom_callback (Widget w,
220  XtPointer clientData,
221  XtPointer callData);
222 
223  static void dolly_callback (Widget w,
224  XtPointer clientData,
225  XtPointer callData);
226 
227  static void pan_left_right_callback (Widget w,
228  XtPointer clientData,
229  XtPointer callData);
230 
231  static void left_right_pan_callback (XtPointer clientData,
232  XtIntervalId* timer_id);
233 
234  static void theta_rotation_callback (Widget w,
235  XtPointer clientData,
236  XtPointer callData);
237 
238  static void phi_rotation_callback (Widget w,
239  XtPointer clientData,
240  XtPointer callData);
241 
242  static void pan_up_down_callback (Widget w,
243  XtPointer clientData,
244  XtPointer callData);
245 
246  static void up_down_pan_callback (XtPointer clientData,
247  XtIntervalId* timer_id);
248 
249  static void drawing_style_callback (Widget w,
250  XtPointer clientData,
251  XtPointer callData);
252 
253  static void rep_style_callback (Widget w,
254  XtPointer clientData,
255  XtPointer callData);
256 
257  static void background_color_callback (Widget w,
258  XtPointer clientData,
259  XtPointer callData);
260 
261  static void set_rot_subject_callback (Widget w,
262  XtPointer clientData,
263  XtPointer callData);
264 
265  static void set_rot_sens_callback (Widget w,
266  XtPointer clientData,
267  XtPointer callData);
268 
269  static void set_pan_sens_callback (Widget w,
270  XtPointer clientData,
271  XtPointer callData);
272 
273  static void set_wob_sens_callback (Widget w,
274  XtPointer clientData,
275  XtPointer callData);
276 
277  static void projection_callback (Widget w,
278  XtPointer clientData,
279  XtPointer callData);
280 
281  static void wobble_callback (Widget w,
282  XtPointer clientData,
283  XtPointer callData);
284 
285  static void reset_callback (Widget w,
286  XtPointer clientData,
287  XtPointer callData);
288 
289  static void update_panels_callback (Widget w,
290  XtPointer clientData,
291  XtPointer callData);
292 
293  static void wobble_timer_callback (XtPointer clientData,
294  XtIntervalId* timerid);
295 
296  static void Add_radio_box (char* label_string,
297  Widget* parent_frame_widget,
298  XtCallbackRec* radio_box_cb,
299  G4int num_buttons,
300  G4int default_button,
301  char* radio_box_name,
302  char** button_names,
303  G4OpenGLXmViewer* pView);
304 
305  static void Add_four_arrow_buttons (G4OpenGLXmViewer* pView,
306  XtCallbackRec** arrow_callbacks,
307  Widget* parent_widget);
308 
309  static void Add_slider_box (char* label_string,
310  G4int num_sliders,
311  char** slider_name,
312  G4OpenGLXmViewer* pView,
313  G4double* min_array,
314  G4double* max_array,
315  G4double* value_array,
316  G4bool* show,
317  short* decimals,
318  unsigned char* orientation,
319  unsigned char* direction,
320  XtCallbackRec** slider_box_cb,
321  Widget* parent_frame_widget);
322 
323  static void rotate_in_theta (XtPointer clientData,
324  XtIntervalId* timer_id);
325 
326  static void rotate_in_phi (XtPointer clientData,
327  XtIntervalId* timer_id);
328 
329  static void get_double_value_callback (Widget w,
330  XtPointer clientData,
331  XtPointer callData);
332 
333  static void get_text_callback (Widget w,
334  XtPointer clientData,
335  XtPointer callData);
336 
337  static void transparency_callback (Widget w,
338  XtPointer clientData,
339  XtPointer callData);
340 
341  static void antialias_callback (Widget w,
342  XtPointer clientData,
343  XtPointer callData);
344 
345  static void haloing_callback (Widget w,
346  XtPointer clientData,
347  XtPointer callData);
348 
349  static void aux_edge_callback (Widget w,
350  XtPointer clientData,
351  XtPointer callData);
352 
353  static void set_print_colour_callback (Widget w,
354  XtPointer clientData,
355  XtPointer callData);
356 
357  static void set_print_style_callback (Widget w,
358  XtPointer clientData,
359  XtPointer callData);
360 
361  static void print_callback (Widget w,
362  XtPointer clientData,
363  XtPointer callData);
364 
365  static G4bool get_boolean_userData (Widget w);
366 
367  static G4int get_int_userData (Widget w);
368 
369  friend class G4OpenGLXmVWidgetObject;
370  friend class G4OpenGLXmViewerMessenger;
371 
372 private:
373  G4OpenGLXmViewer (const G4OpenGLXmViewer&);
374  G4OpenGLXmViewer& operator = (const G4OpenGLXmViewer&);
375  void UpdateControlPanel();
376  // Update the content of the control panel
377 };
378 
379 #endif
380 
381 #endif
382