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