00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #ifdef SOQT
00051 # include <Inventor/Qt/viewers/SoQtFullViewer.h>
00052 #elif defined(SOWX)
00053 # include <Inventor/Wx/viewers/SoWxFullViewer.h>
00054 #elif defined _WIN32
00055 # include <Inventor/Win/viewers/SoWinFullViewer.h>
00056 #else // _WIN32
00057
00058 #ifndef _SO_XT_FULL_VIEWER_
00059 #define _SO_XT_FULL_VIEWER_
00060
00061 #include <Xm/Xm.h>
00062 #include <Inventor/Xt/viewers/SoXtViewer.h>
00063 #include <Inventor/SbPList.h>
00064 #include <Inventor/components/stereo/SoStereoDialog.h>
00065 #include <Inventor/Gui/viewers/SoGuiFullViewer.h>
00066
00067
00068 class SoXtResource;
00069 class SoXtBitmapButton;
00070 class SoRecordDialog;
00071
00073
00074
00075
00076
00077
00078
00079
00080
00082
00176 class SoXtFullViewer : public SoXtViewer
00177 {
00178 public:
00180 enum BuildFlag
00181 {
00185 BUILD_NONE = 0x00,
00189 BUILD_DECORATION = 0x01,
00193 BUILD_POPUP = 0x02,
00197 BUILD_ALL = 0xff
00198 };
00199
00207 void setDecoration( SbBool onOrOff );
00208
00212 SbBool isDecoration() { return m_guiFullViewer->isDecoration(); }
00213
00243 void setPopupMenuEnabled( SbBool trueOrFalse );
00244
00248 SbBool isPopupMenuEnabled() { return m_guiFullViewer->isPopupMenuEnabled(); }
00249
00255 SoWidget getAppPushButtonParent() const { return appButtonForm; }
00256
00264 void addAppPushButton( SoWidget newButton );
00265
00274 void insertAppPushButton( SoWidget newButton, int index );
00275
00279 void removeAppPushButton( SoWidget oldButton );
00280
00284 int findAppPushButton( SoWidget oldButton ) { return appButtonList->find(oldButton); }
00285
00289 int lengthAppPushButton() { return appButtonList->getLength(); }
00290
00294 SoWidget getRenderAreaWidget() { return raWidget; }
00295
00296
00297 virtual void setViewing( SbBool onOrOff );
00298 virtual void setHeadlight( SbBool onOrOff );
00299 virtual void setDrawStyle( SoXtViewer::DrawType type, SoXtViewer::DrawStyle style );
00300 virtual void setBufferingType( SoXtViewer::BufferType type );
00301 virtual void setCamera( SoCamera* cam );
00302 virtual void hide();
00303
00304
00305 SoStereoDialog* getStereoDialog() { return m_stereoDialogBox; }
00306 void setStereoDialog( SoStereoDialog *newDialog ) { m_stereoDialogBox = newDialog; }
00307
00311 SoStereoDialog* m_stereoDialogBox;
00312
00313 private:
00314 virtual ~SoXtFullViewer();
00315
00316 SoGuiFullViewer* getGuiFullViewer() const;
00317
00318
00319 float rightWheelVal, leftWheelVal, bottomWheelVal;
00320 SbBool popupEnabled;
00321
00322
00323 SoXtFullViewer( SoWidget parent,
00324 const char* name,
00325 SbBool buildInsideParent,
00326 SoXtFullViewer::BuildFlag flag,
00327 SoXtViewer::Type type,
00328 SbBool buildNow,
00329 SbBool sync = TRUE );
00330 private:
00331
00332 SoXtFullViewer( SoWidget parent,
00333 const char* name,
00334 SbBool buildInsideParent,
00335 SoXtFullViewer::BuildFlag flag,
00336 SoXtViewer::Type type,
00337 SbBool buildNow,
00338 SbBool sync,
00339 SoGuiFullViewer* guiFullViewer );
00340
00341
00342 SoWidget mgrWidget;
00343 SoWidget raWidget;
00344 SoWidget leftTrimForm, bottomTrimForm, rightTrimForm;
00345
00346
00347 SoWidget rightWheel, bottomWheel, leftWheel;
00348 char* rightWheelStr, *bottomWheelStr, *leftWheelStr;
00349 SoWidget rightWheelLabel, bottomWheelLabel, leftWheelLabel;
00350
00351
00352 SbPList* viewerButtonWidgets;
00353
00354
00355
00356 SoWidget getButtonWidget() const { return appButtonForm; }
00357
00358
00359 SoWidget popupWidget, *popupToggleWidgets;
00360 SoWidget* drawStyleWidgets, *bufferStyleWidgets;
00361 char* popupTitle;
00362
00363
00364
00365
00366 SoWidget buildWidget( SoWidget parent );
00367 void buildLeftWheel( SoWidget parent );
00368
00369 virtual void buildDecoration( SoWidget parent );
00370 virtual SoWidget buildLeftTrim( SoWidget parent );
00371 virtual SoWidget buildBottomTrim( SoWidget parent );
00372 virtual SoWidget buildRightTrim( SoWidget parent );
00373 SoWidget buildAppButtons( SoWidget parent );
00374 SoWidget buildViewerButtons( SoWidget parent );
00375 virtual void createViewerButtons( SoWidget parent );
00376
00377
00378
00379
00380 virtual void buildPopupMenu();
00381 virtual void destroyPopupMenu();
00382 void setPopupMenuString( const char* name );
00383 SoWidget buildFunctionsSubmenu( SoWidget popup );
00384 SoWidget buildDrawStyleSubmenu( SoWidget popup );
00385
00386
00387
00388
00389 void setPrefSheetString( const char* name );
00390 virtual void createPrefSheet();
00391 void createPrefSheetShellAndForm( SoWidget& shell, SoWidget& form );
00392 void createDefaultPrefSheetParts( SoWidget widgetList[], int& num, SoWidget form );
00393 void layoutPartsAndMapPrefSheet( SoWidget widgetList[], int num, SoWidget form, SoWidget shell );
00394 SoWidget createSeekPrefSheetGuts( SoWidget parent );
00395 SoWidget createSeekDistPrefSheetGuts( SoWidget parent );
00396 SoWidget createZoomPrefSheetGuts( SoWidget parent );
00397 SoWidget createClippingPrefSheetGuts( SoWidget parent );
00398 SoWidget createStereoPrefSheetGuts( SoWidget parent );
00399 SoWidget createFsaaPrefSheetGuts( SoWidget parent );
00400 SoWidget createRecordPrefSheetGuts( SoWidget parent );
00401 SoWidget createSpeedPrefSheetGuts( SoWidget parent );
00402
00403
00404
00405
00406 virtual void rightWheelMotion( float newVal );
00407 virtual void bottomWheelMotion( float newVal );
00408 virtual void leftWheelMotion( float newVal );
00409
00410
00411
00412
00413 virtual void rightWheelStart();
00414 virtual void bottomWheelStart();
00415 virtual void leftWheelStart();
00416 virtual void rightWheelFinish();
00417 virtual void bottomWheelFinish();
00418 virtual void leftWheelFinish();
00419
00420
00421
00422
00423 void setBottomWheelString( const char* name );
00424 void setLeftWheelString( const char* name );
00425 void setRightWheelString( const char* name );
00426
00427
00428
00429
00430
00431 virtual void openViewerHelpCard();
00432
00433
00434 static void popMenuCallback( SoWidget w, SoXtFullViewer* v, XEvent* event, Boolean* b );
00435 static void drawStyleMenuPick( SoWidget w, int id, void* data );
00436 static void bufferStyleMenuPick( SoWidget w, int id, void* data );
00437 static void menuPick( SoWidget w, int id, XmAnyCallbackStruct* s );
00438
00439 virtual void setSeekButton( SbBool onOff );
00440
00441 private:
00442
00443 void constructorCommon( SoXtFullViewer::BuildFlag buildFlag, SbBool buildNow );
00444
00445 SoGuiFullViewer* m_guiFullViewer;
00446
00447 SbBool firstBuild;
00448
00449
00450 SoWidget appButtonForm;
00451 SbPList* appButtonList;
00452
00453 void doAppButtonLayout( int start );
00454
00455
00456 void getResources( SoXtResource* xr );
00457
00458
00459 SoXtBitmapButton* buttonList[10];
00460 static void pushButtonCB( SoWidget w, int id, void* data );
00461
00462
00463 SoWidget prefSheetShellWidget;
00464 char* prefSheetStr;
00465 static void prefSheetDestroyCB( SoWidget w, SoXtFullViewer* v, void* data );
00466 static void stereoSheetDestroyCB( SoWidget w, SoXtFullViewer* v, void* data );
00467
00468
00469 static void seekPrefSheetFieldCB( SoWidget field, SoXtFullViewer* v, void* data );
00470 static void seekPrefSheetToggle1CB( SoWidget tog1, SoWidget tog2, void* data );
00471 static void seekPrefSheetToggle2CB( SoWidget tog1, SoWidget tog2, void* data );
00472
00473
00474 SoWidget* zoomWidgets;
00475 SbVec2f zoomSldRange;
00476 void setCameraZoom( float zoom );
00477 float getCameraZoom();
00478 void setZoomSliderPosition( float zoom );
00479 void setZoomFieldString( float zoom );
00480 static void zoomSliderCB( SoWidget w, SoXtFullViewer* v, XtPointer* d );
00481 static void zoomFieldCB( SoWidget field, SoXtFullViewer* v, XtPointer* d );
00482 static void zoomPrefSheetMinFieldCB( SoWidget field, SoXtFullViewer* v, void* data );
00483 static void zoomPrefSheetMaxFieldCB( SoWidget field, SoXtFullViewer* v, void* data );
00484
00485
00486 int seekDistWheelVal;
00487 SoWidget seekDistField;
00488 static void seekDistWheelCB( SoWidget w, SoXtFullViewer* v, XtPointer* d );
00489 static void seekDistFieldCB( SoWidget field, SoXtFullViewer* v, void* data );
00490 static void seekDistPercPrefSheetToggleCB( SoWidget tog1, SoWidget tog2, void* data );
00491 static void seekDistAbsPrefSheetToggleCB( SoWidget tog1, SoWidget tog2, void* data );
00492
00493
00494 SoWidget clipWheelForm;
00495 int clipNearWheelVal, clipFarWheelVal;
00496 SoWidget clipNearField, clipFarField;
00497 static void clipPrefSheetToggleCB( SoWidget toggle, SoWidget parent, void* data );
00498 static void clipNearWheelCB( SoWidget w, SoXtFullViewer* v, XtPointer* d );
00499 static void clipFarWheelCB( SoWidget w, SoXtFullViewer* v, XtPointer* d );
00500 static void clipFieldCB( SoWidget field, SoXtFullViewer* v, void* data );
00501
00502
00503 SoWidget stereoWheelForm, stereoField, stereoLabel;
00504 int stereoWheelVal;
00505 static void stereoPrefSheetToggleCB( SoWidget toggle, SoWidget parent, void* data );
00506 static void stereoWheelCB( SoWidget w, SoXtFullViewer* v, XtPointer* d );
00507 static void stereoFieldCB( SoWidget field, SoXtFullViewer *v, void* data );
00508
00509
00510 SoWidget recordingLabel;
00511 static void recordingPrefSheetToggleCB( SoWidget toggle, SoWidget parent, void* data );
00512
00513
00514 SoWidget fsaaLabel;
00515 static void fsaaPrefSheetToggleCB( SoWidget toggle, SoWidget parent, void* data );
00516
00517
00518 static void speedIncPrefSheetButtonCB( SoWidget w, SoXtFullViewer *p, void* v );
00519 static void speedDecPrefSheetButtonCB( SoWidget w, SoXtFullViewer *p, void* v );
00520
00521
00522 static void rightWheelCB( SoWidget w, SoXtFullViewer* v, XtPointer* d );
00523 static void bottomWheelCB( SoWidget w, SoXtFullViewer* v, XtPointer* d );
00524 static void leftWheelCB( SoWidget w, SoXtFullViewer* v, XtPointer* d );
00525
00526 SbBool seekDistAsPercentage;
00527 };
00528
00529 #endif
00530
00531 #endif // _WIN32
00532
00533
00534