Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoXtFullViewer.h
Go to the documentation of this file.
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : Alain Dumesny (MMM yyyy)
25**=======================================================================*/
26/*=======================================================================
27 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
28 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
29 *** ***
30 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
31 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
32 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
33 *** ***
34 *** RESTRICTED RIGHTS LEGEND ***
35 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
36 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
37 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
38 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
39 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
40 *** ***
41 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, ***
42 *** BORDEAUX, FRANCE ***
43 *** ALL RIGHTS RESERVED ***
44**=======================================================================*/
45/*=======================================================================
46** Modified by : Tristan Mehamli (Nov 2009)
47**=======================================================================*/
48
49
50#ifdef SOQT
52#elif defined _WIN32
54#else // _WIN32
55
56#ifndef _SO_XT_FULL_VIEWER_
57#define _SO_XT_FULL_VIEWER_
58
59#include <Xm/Xm.h>
61#include <Inventor/SbPList.h>
64
65// classes used
66class SoXtResource;
68class SoRecordDialog;
69
71//
72// Class: SoXtFullViewer
73//
74// The SoXtFullViewer component class is the abstract base class for all
75// viewers which include a decoration around the rendering area. The
76// decoration is made of thumbwheels, sliders and push/toggle buttons. There
77// is also a popup menu which includes all of the viewing options and methods.
78//
80
175{
176 public:
179 {
195 BUILD_ALL = 0xff
196 };
197
205 void setDecoration( SbBool onOrOff );
206
210 SbBool isDecoration() { return m_guiFullViewer->isDecoration(); }
211
241 void setPopupMenuEnabled( SbBool trueOrFalse );
242
246 SbBool isPopupMenuEnabled() { return m_guiFullViewer->isPopupMenuEnabled(); }
247
253 SoWidget getAppPushButtonParent() const { return appButtonForm; }
254
262 void addAppPushButton( SoWidget newButton );
263
272 void insertAppPushButton( SoWidget newButton, int index );
273
277 void removeAppPushButton( SoWidget oldButton );
278
282 int findAppPushButton( SoWidget oldButton ) { return appButtonList->find(oldButton); }
283
287 int lengthAppPushButton() { return appButtonList->getLength(); }
288
292 SoWidget getRenderAreaWidget() { return raWidget; }
293
294 // redefine these from the base class
295 virtual void setViewing( SbBool onOrOff );
296 virtual void setHeadlight( SbBool onOrOff );
297 virtual void setDrawStyle( SoXtViewer::DrawType type, SoXtViewer::DrawStyle style );
298 virtual void setBufferingType( SoXtViewer::BufferType type );
299 virtual void setCamera( SoCamera* cam );
300 virtual void hide();
301
302 // Allow app, eg. 3SA, to control this if desired. --mmh Jun-99
304 void setStereoDialog( SoStereoDialog *newDialog ) { m_stereoDialogBox = newDialog; }
305
310
311 private:
312 virtual ~SoXtFullViewer();
313
314 SoGuiFullViewer* getGuiFullViewer() const;
315
316 // retro compatibilty, don't use them directly. Call their accessors.
317 float rightWheelVal, leftWheelVal, bottomWheelVal;
318 SbBool popupEnabled;
319
320 // Constructor/Destructor
321 SoXtFullViewer( SoWidget parent,
322 const char* name,
323 SbBool buildInsideParent,
324 SoXtFullViewer::BuildFlag flag,
325 SoXtViewer::Type type,
326 SbBool buildNow,
327 SbBool sync = TRUE );
328 private:
329
330 SoXtFullViewer( SoWidget parent,
331 const char* name,
332 SbBool buildInsideParent,
333 SoXtFullViewer::BuildFlag flag,
334 SoXtViewer::Type type,
335 SbBool buildNow,
336 SbBool sync,
337 SoGuiFullViewer* guiFullViewer );
338
339 // general decoration vars
340 SoWidget mgrWidget; // form which manages all other widgets
341 SoWidget raWidget; // render area widget
342 SoWidget leftTrimForm, bottomTrimForm, rightTrimForm;
343
344 // thumb wheel vars
345 SoWidget rightWheel, bottomWheel, leftWheel;
346 char* rightWheelStr, *bottomWheelStr, *leftWheelStr;
347 SoWidget rightWheelLabel, bottomWheelLabel, leftWheelLabel;
348
349 // widget list of viewer buttons
350 SbPList* viewerButtonWidgets;
351
352 // The button widget should be used as the parent widget
353 // when creating new buttons
354 SoWidget getButtonWidget() const { return appButtonForm; }
355
356 // popup menu vars
357 SoWidget popupWidget, *popupToggleWidgets;
358 SoWidget* drawStyleWidgets, *bufferStyleWidgets;
359 char* popupTitle;
360
361 //
362 // Build/destroy decoration routines
363 //
364 SoWidget buildWidget( SoWidget parent );
365 void buildLeftWheel( SoWidget parent );
366
367 virtual void buildDecoration( SoWidget parent );
368 virtual SoWidget buildLeftTrim( SoWidget parent );
369 virtual SoWidget buildBottomTrim( SoWidget parent );
370 virtual SoWidget buildRightTrim( SoWidget parent );
371 SoWidget buildAppButtons( SoWidget parent );
372 SoWidget buildViewerButtons( SoWidget parent );
373 virtual void createViewerButtons( SoWidget parent );
374
375 //
376 // popup menu build routines
377 //
378 virtual void buildPopupMenu();
379 virtual void destroyPopupMenu();
380 void setPopupMenuString( const char* name );
381 SoWidget buildFunctionsSubmenu( SoWidget popup );
382 SoWidget buildDrawStyleSubmenu( SoWidget popup );
383
384 //
385 // Preference sheet build routines
386 //
387 void setPrefSheetString( const char* name );
388 virtual void createPrefSheet();
389 void createPrefSheetShellAndForm( SoWidget& shell, SoWidget& form );
390 void createDefaultPrefSheetParts( SoWidget widgetList[], int& num, SoWidget form );
391 void layoutPartsAndMapPrefSheet( SoWidget widgetList[], int num, SoWidget form, SoWidget shell );
392 SoWidget createSeekPrefSheetGuts( SoWidget parent );
393 SoWidget createSeekDistPrefSheetGuts( SoWidget parent );
394 SoWidget createZoomPrefSheetGuts( SoWidget parent );
395 SoWidget createClippingPrefSheetGuts( SoWidget parent );
396 SoWidget createStereoPrefSheetGuts( SoWidget parent );
397 SoWidget createFsaaPrefSheetGuts( SoWidget parent );
398 SoWidget createRecordPrefSheetGuts( SoWidget parent );
399 SoWidget createSpeedPrefSheetGuts( SoWidget parent );
400
401 // Subclasses SHOULD redefine these to do viewer specific tasks
402 // since these do nothing in the base class. those routines are
403 // called by the thumb wheels whenever they rotate.
404 virtual void rightWheelMotion( float newVal );
405 virtual void bottomWheelMotion( float newVal );
406 virtual void leftWheelMotion( float newVal );
407
408 // Subclasses can redefine these to add viewer functionality. They
409 // by default call start and finish interactive viewing methods.
410 // (defined in the base class).
411 virtual void rightWheelStart();
412 virtual void bottomWheelStart();
413 virtual void leftWheelStart();
414 virtual void rightWheelFinish();
415 virtual void bottomWheelFinish();
416 virtual void leftWheelFinish();
417
418 // Subclasses SHOULD set those wheel string to whatever functionality
419 // name they are redefining the thumb wheels to do. Default names are
420 // "Motion X, "Motion Y" and "Motion Z" for bottom, left and right wheels.
421 void setBottomWheelString( const char* name );
422 void setLeftWheelString( const char* name );
423 void setRightWheelString( const char* name );
424
425 // Subclasses SHOULD redefine the openViewerHelpCard() routine to bring
426 // their help card (called by push button and popup menu entry).
427 // They can simply call SoXtComponent::openHelpCard() to open their
428 // specific help card.
429 virtual void openViewerHelpCard();
430
431 // popup menu callbacks
432 static void popMenuCallback( SoWidget w, SoXtFullViewer* v, XEvent* event, Boolean* b );
433 static void drawStyleMenuPick( SoWidget w, int id, void* data );
434 static void bufferStyleMenuPick( SoWidget w, int id, void* data );
435 static void menuPick( SoWidget w, int id, XmAnyCallbackStruct* s );
436
437 virtual void setSeekButton( SbBool onOff );
438
439private:
440
441 void constructorCommon( SoXtFullViewer::BuildFlag buildFlag, SbBool buildNow );
442
443 SoGuiFullViewer* m_guiFullViewer; // Implementation class for SoXxFullViewer
444
445 SbBool firstBuild; // set FALSE after buildWidget called once
446
447 // app button vars
448 SoWidget appButtonForm;
449 SbPList* appButtonList;
450
451 void doAppButtonLayout( int start );
452
453 // this is called the first time the widget is built
454 void getResources( SoXtResource* xr );
455
456 // push buttons vars and callbacks
457 SoXtBitmapButton* buttonList[10];
458 static void pushButtonCB( SoWidget w, int id, void* data );
459
460 // pref sheet variables
461 SoWidget prefSheetShellWidget;
462 char* prefSheetStr;
463 static void prefSheetDestroyCB( SoWidget w, SoXtFullViewer* v, void* data );
464 static void stereoSheetDestroyCB( SoWidget w, SoXtFullViewer* v, void* data );
465
466 // seek pref sheet callbacks
467 static void seekPrefSheetFieldCB( SoWidget field, SoXtFullViewer* v, void* data );
468 static void seekPrefSheetToggle1CB( SoWidget tog1, SoWidget tog2, void* data );
469 static void seekPrefSheetToggle2CB( SoWidget tog1, SoWidget tog2, void* data );
470
471 // zoom pref sheet vars and callbacks
472 SoWidget* zoomWidgets;
473 SbVec2f zoomSldRange;
474 void setCameraZoom( float zoom );
475 float getCameraZoom();
476 void setZoomSliderPosition( float zoom );
477 void setZoomFieldString( float zoom );
478 static void zoomSliderCB( SoWidget w, SoXtFullViewer* v, XtPointer* d );
479 static void zoomFieldCB( SoWidget field, SoXtFullViewer* v, XtPointer* d );
480 static void zoomPrefSheetMinFieldCB( SoWidget field, SoXtFullViewer* v, void* data );
481 static void zoomPrefSheetMaxFieldCB( SoWidget field, SoXtFullViewer* v, void* data );
482
483 // seek dist pref sheet vars and callbacks
484 int seekDistWheelVal;
485 SoWidget seekDistField;
486 static void seekDistWheelCB( SoWidget w, SoXtFullViewer* v, XtPointer* d );
487 static void seekDistFieldCB( SoWidget field, SoXtFullViewer* v, void* data );
488 static void seekDistPercPrefSheetToggleCB( SoWidget tog1, SoWidget tog2, void* data );
489 static void seekDistAbsPrefSheetToggleCB( SoWidget tog1, SoWidget tog2, void* data );
490
491 // clipping plane pref sheet callbacks and variables
492 SoWidget clipWheelForm;
493 int clipNearWheelVal, clipFarWheelVal;
494 SoWidget clipNearField, clipFarField;
495 static void clipPrefSheetToggleCB( SoWidget toggle, SoWidget parent, void* data );
496 static void clipNearWheelCB( SoWidget w, SoXtFullViewer* v, XtPointer* d );
497 static void clipFarWheelCB( SoWidget w, SoXtFullViewer* v, XtPointer* d );
498 static void clipFieldCB( SoWidget field, SoXtFullViewer* v, void* data );
499
500 // stereo viewing pref sheet callbacks and variables
501 SoWidget stereoWheelForm, stereoField, stereoLabel;
502 int stereoWheelVal;
503 static void stereoPrefSheetToggleCB( SoWidget toggle, SoWidget parent, void* data );
504 static void stereoWheelCB( SoWidget w, SoXtFullViewer* v, XtPointer* d );
505 static void stereoFieldCB( SoWidget field, SoXtFullViewer *v, void* data );
506
507 // Recording sheet callbacks and variable
508 SoWidget recordingLabel;
509 static void recordingPrefSheetToggleCB( SoWidget toggle, SoWidget parent, void* data );
510
511 // FSAA
512 SoWidget fsaaLabel;
513 static void fsaaPrefSheetToggleCB( SoWidget toggle, SoWidget parent, void* data );
514
515 // dolly speed pref sheet callbacks
516 static void speedIncPrefSheetButtonCB( SoWidget w, SoXtFullViewer *p, void* v );
517 static void speedDecPrefSheetButtonCB( SoWidget w, SoXtFullViewer *p, void* v );
518
519 // callback functions for thumbwheels
520 static void rightWheelCB( SoWidget w, SoXtFullViewer* v, XtPointer* d );
521 static void bottomWheelCB( SoWidget w, SoXtFullViewer* v, XtPointer* d );
522 static void leftWheelCB( SoWidget w, SoXtFullViewer* v, XtPointer* d );
523
524 SbBool seekDistAsPercentage;
525};
526
527#endif /* _SO_XT_FULL_VIEWER_ */
528
529#endif // _WIN32
530
531
#define TRUE
Possible value of SbBool.
Definition SbBase.h:77
union _XEvent XEvent
Definition SoQtDef.h:120
char Boolean
Definition SoQtDef.h:119
void * XtPointer
Definition SoQtDef.h:118
#define SoWidget
Definition SoQtDef.h:40
void start()
#define XmAnyCallbackStruct
Definition SoWinDef.h:127
#define SoXtFullViewer
Definition SoXt2SoQt.h:74
#define SoXtBitmapButton
Definition SoXt2SoQt.h:36
List of generic (void *) pointers.
Definition SbPList.h:77
int find(const void *ptr) const
Returns index of given pointer in list, or -1 if not found.
int getLength() const
Returns number of pointers in list.
Definition SbPList.h:125
2D vector class.
Definition SbVec.h:76
Abstract base class for camera nodes.
Definition SoCamera.h:188
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Component that l...
Base viewer class which adds a decoration around the rendering area.
virtual void setBufferingType(SoXtViewer::BufferType type)
Sets the current buffering type in the main view (default SoXtViewer::BUFFER_DOUBLE).
virtual void setDrawStyle(SoXtViewer::DrawType type, SoXtViewer::DrawStyle style)
Sets the current drawing style in the main view.
BuildFlag
This specifies what should be build by default in the constructor
@ BUILD_DECORATION
Build the decoration only.
@ BUILD_ALL
Build everything by default.
@ BUILD_POPUP
Build the popup menu only.
@ BUILD_NONE
Doesn't build anything extra.
SoWidget getAppPushButtonParent() const
Returns the parent widget, which is needed when creating new buttons.
virtual void setHeadlight(SbBool onOrOff)
Turns the headlight on/off (default on).
virtual void hide()
This hides the component.
void addAppPushButton(SoWidget newButton)
Adds application push button, which will be placed in the left hand side decoration trim.
int lengthAppPushButton()
Returns number of application push buttons.
SoStereoDialog * getStereoDialog()
SbBool isDecoration()
Returns whether the viewer component trim is on or off.
void insertAppPushButton(SoWidget newButton, int index)
Adds application push button, which will be placed in the left hand side decoration trim.
SoStereoDialog * m_stereoDialogBox
Pointer to the stereo dialog.
void setDecoration(SbBool onOrOff)
Shows/hides the viewer component trim (default on).
void setPopupMenuEnabled(SbBool trueOrFalse)
Enables/disables the viewer popup menu (default enabled).
SoWidget getRenderAreaWidget()
Returns the render area widget.
SbBool isPopupMenuEnabled()
Returns whether the viewer popup menu is enabled or disabled.
void setStereoDialog(SoStereoDialog *newDialog)
void removeAppPushButton(SoWidget oldButton)
Removes specified application push button.
virtual void setViewing(SbBool onOrOff)
Sets whether the viewer is turned on or off.
int findAppPushButton(SoWidget oldButton)
Returns index of specified push button.
virtual void setCamera(SoCamera *cam)
Sets the edited camera.
Used to retrieve X resources for SoXt components and widgets .
Viewer component lowest base class.
Definition SoXtViewer.h:185
int SbBool
Boolean type.
Definition SbBase.h:87