Geant4  10.03.p03
 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: G4OpenGLXmViewer.hh 66373 2012-12-18 09:41:34Z gcosmo $
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  drawing_style_pullright,
77  background_color_pullright,
78  transparency_pullright,
79  antialias_pullright,
80  haloing_pullright,
81  aux_edge_pullright,
82  frame,
83  glxarea;
84 
85  XmString style_str,
86  actions_str,
87  misc_str,
88  spec_str,
89  draw_str,
90  polyhedron_str,
91  wireframe_str,
92  hlr_str,
93  hsr_str,
94  hlhsr_str,
95  set_str,
96  rot_str,
97  pan_str,
98  exit_str,
99  quit_str,
100  print_str,
101  white_str,
102  black_str,
103  anti_str,
104  trans_str,
105  halo_str,
106  aux_edge_str,
107  bgnd_str,
108  off_str,
109  on_str;
110 
111  G4double zoom_high,
112  zoom_low,
113  pan_low,
114  pan_high,
115  dolly_low,
116  dolly_high,
117  fov,
118  rot_sens_limit,
119  pan_sens_limit,
120  wob_high,
121  wob_low,
122  wob_sens;
123 
124  Pixel bgnd,
125  borcol;
126 
127  G4bool pan_right,
128  rotate_right,
129  pan_up,
130  rotate_up;
131 
132  XtIntervalId rotation_timer,
133  pan_timer,
134  wobble_timer;
135 
136  G4Vector3D original_vp;
137 
138  G4int frameNo;
139 
140  G4OpenGLXmTopLevelShell* fprotation_top;
141  G4OpenGLXmBox* fprotation_button_box;
142  G4OpenGLXmRadioButton* fprotation_button1;
143  G4OpenGLXmRadioButton* fprotation_button2;
144  G4OpenGLXmBox* fprotation_slider_box;
145  G4OpenGLXmSliderBar* fprotation_slider;
146  G4OpenGLXmBox* fprotation_arrow_box;
147  G4OpenGLXmFourArrowButtons* fprotation_arrow;
148 
149  G4OpenGLXmTopLevelShell* fppanning_top;
150  G4OpenGLXmFramedBox* fppanning_box;
151  G4OpenGLXmFourArrowButtons* fppanning_arrows;
152  G4OpenGLXmSliderBar* fppanning_slider;
153  G4OpenGLXmFramedBox* fpzoom_box;
154  G4OpenGLXmSliderBar* fpzoom_slider;
155  G4OpenGLXmFramedBox* fpdolly_box;
156  G4OpenGLXmSliderBar* fpdolly_slider;
157 
158  G4OpenGLXmTopLevelShell* fpsetting_top;
159  G4OpenGLXmFramedBox* fpsetting_box;
160  G4OpenGLXmTextField* fppan_set;
161  G4OpenGLXmTextField* fprot_set;
162  G4OpenGLXmTextField* fpzoom_upper;
163  G4OpenGLXmTextField* fpzoom_lower;
164  G4OpenGLXmTextField* fpdolly_upper;
165  G4OpenGLXmTextField* fpdolly_lower;
166  G4OpenGLXmPushButton* fpok_button;
167 
168  G4OpenGLXmTopLevelShell* fpmiscellany_top;
169  G4OpenGLXmFramedBox* fpwobble_box;
170  G4OpenGLXmPushButton* fpwobble_button;
171  G4OpenGLXmSliderBar* fpwobble_slider;
172  G4OpenGLXmFramedBox* fpreset_box;
173  G4OpenGLXmPushButton* fpreset_button;
174  G4OpenGLXmFramedBox* fpproj_style_box;
175  G4OpenGLXmRadioButton* fporthogonal_button;
176  G4OpenGLXmRadioButton* fpperspective_button;
177  G4OpenGLXmTextField* fpfov_text;
178 
179  G4OpenGLXmTopLevelShell* fpprint_top;
180  G4OpenGLXmFramedBox* fpprint_box;
181  G4OpenGLXmFramedBox* fpprint_col_box;
182  G4OpenGLXmFramedBox* fpprint_style_box;
183  G4OpenGLXmTextField* fpprint_text;
184  G4OpenGLXmPushButton* fpprint_button;
185  G4OpenGLXmSeparator* fpprint_line;
186  G4OpenGLXmRadioButton* fpprint_col_radio1;
187  G4OpenGLXmRadioButton* fpprint_col_radio2;
188  G4OpenGLXmRadioButton* fpprint_style_radio1;
189  G4OpenGLXmRadioButton* fpprint_style_radio2;
190 
191 public:
192 
193  static void expose_callback (Widget w,
194  XtPointer clientData,
195  XtPointer callData);
196 
197  static void resize_callback (Widget w,
198  XtPointer clientData,
199  XtPointer callData);
200 
201  static void actions_callback (Widget w,
202  XtPointer clientData,
203  XtPointer callData);
204 
205  static void misc_callback (Widget w,
206  XtPointer clientData,
207  XtPointer callData);
208 
209  static void Add_set_field (char* widget,
210  char* widget_text,
211  Widget* row_col_box,
212  Widget* wid,
213  G4double* val,
214  G4OpenGLXmViewer* pView);
215 
216  static void zoom_callback (Widget w,
217  XtPointer clientData,
218  XtPointer callData);
219 
220  static void dolly_callback (Widget w,
221  XtPointer clientData,
222  XtPointer callData);
223 
224  static void pan_left_right_callback (Widget w,
225  XtPointer clientData,
226  XtPointer callData);
227 
228  static void left_right_pan_callback (XtPointer clientData,
229  XtIntervalId* timer_id);
230 
231  static void theta_rotation_callback (Widget w,
232  XtPointer clientData,
233  XtPointer callData);
234 
235  static void phi_rotation_callback (Widget w,
236  XtPointer clientData,
237  XtPointer callData);
238 
239  static void pan_up_down_callback (Widget w,
240  XtPointer clientData,
241  XtPointer callData);
242 
243  static void up_down_pan_callback (XtPointer clientData,
244  XtIntervalId* timer_id);
245 
246  static void drawing_style_callback (Widget w,
247  XtPointer clientData,
248  XtPointer callData);
249 
250  static void background_color_callback (Widget w,
251  XtPointer clientData,
252  XtPointer callData);
253 
254  static void set_rot_subject_callback (Widget w,
255  XtPointer clientData,
256  XtPointer callData);
257 
258  static void set_rot_sens_callback (Widget w,
259  XtPointer clientData,
260  XtPointer callData);
261 
262  static void set_pan_sens_callback (Widget w,
263  XtPointer clientData,
264  XtPointer callData);
265 
266  static void set_wob_sens_callback (Widget w,
267  XtPointer clientData,
268  XtPointer callData);
269 
270  static void projection_callback (Widget w,
271  XtPointer clientData,
272  XtPointer callData);
273 
274  static void wobble_callback (Widget w,
275  XtPointer clientData,
276  XtPointer callData);
277 
278  static void reset_callback (Widget w,
279  XtPointer clientData,
280  XtPointer callData);
281 
282  static void update_panels_callback (Widget w,
283  XtPointer clientData,
284  XtPointer callData);
285 
286  static void wobble_timer_callback (XtPointer clientData,
287  XtIntervalId* timerid);
288 
289  static void Add_radio_box (char* label_string,
290  Widget* parent_frame_widget,
291  XtCallbackRec* radio_box_cb,
292  G4int num_buttons,
293  G4int default_button,
294  char* radio_box_name,
295  char** button_names,
296  G4OpenGLXmViewer* pView);
297 
298  static void Add_four_arrow_buttons (G4OpenGLXmViewer* pView,
299  XtCallbackRec** arrow_callbacks,
300  Widget* parent_widget);
301 
302  static void Add_slider_box (char* label_string,
303  G4int num_sliders,
304  char** slider_name,
305  G4OpenGLXmViewer* pView,
306  G4double* min_array,
307  G4double* max_array,
308  G4double* value_array,
309  G4bool* show,
310  short* decimals,
311  unsigned char* orientation,
312  unsigned char* direction,
313  XtCallbackRec** slider_box_cb,
314  Widget* parent_frame_widget);
315 
316  static void rotate_in_theta (XtPointer clientData,
317  XtIntervalId* timer_id);
318 
319  static void rotate_in_phi (XtPointer clientData,
320  XtIntervalId* timer_id);
321 
322  static void get_double_value_callback (Widget w,
323  XtPointer clientData,
324  XtPointer callData);
325 
326  static void get_text_callback (Widget w,
327  XtPointer clientData,
328  XtPointer callData);
329 
330  static void transparency_callback (Widget w,
331  XtPointer clientData,
332  XtPointer callData);
333 
334  static void antialias_callback (Widget w,
335  XtPointer clientData,
336  XtPointer callData);
337 
338  static void haloing_callback (Widget w,
339  XtPointer clientData,
340  XtPointer callData);
341 
342  static void aux_edge_callback (Widget w,
343  XtPointer clientData,
344  XtPointer callData);
345 
346  static void set_print_colour_callback (Widget w,
347  XtPointer clientData,
348  XtPointer callData);
349 
350  static void set_print_style_callback (Widget w,
351  XtPointer clientData,
352  XtPointer callData);
353 
354  static void print_callback (Widget w,
355  XtPointer clientData,
356  XtPointer callData);
357 
358  static G4bool get_boolean_userData (Widget w);
359 
360  static G4int get_int_userData (Widget w);
361 
362  friend class G4OpenGLXmVWidgetObject;
363  friend class G4OpenGLXmViewerMessenger;
364 
365 private:
366  G4OpenGLXmViewer (const G4OpenGLXmViewer&);
367  G4OpenGLXmViewer& operator = (const G4OpenGLXmViewer&);
368  void UpdateControlPanel();
369  // Update the content of the control panel
370 };
371 
372 #endif
373 
374 #endif
375 
int G4int
Definition: G4Types.hh:78
tuple app
Definition: demo.py:189
bool G4bool
Definition: G4Types.hh:79
double G4double
Definition: G4Types.hh:76