Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoQtFullViewer.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : Alain Dumesny (MMM yyyy)
22**=======================================================================*/
23
24
25#ifndef _SO_QT_FULL_VIEWER_
26#define _SO_QT_FULL_VIEWER_
27#include <Inventor/Qt/OivQtCompat.h>
28
29#include <QScrollBar>
30#include <QPushButton>
31#include <QString>
32#include <QLabel>
33#include <QMenu>
34#include <QAction>
35#include <QVBoxLayout>
36#include <QHBoxLayout>
37
38#include <Inventor/Qt/viewers/SoQtViewer.h>
39
40#include <Inventor/SbPList.h>
41
42#include <Inventor/Gui/viewers/SoGuiFullViewer.h>
43
44#include <QPointer>
45
46// classes used
47class SoFieldSensor;
48class SoQtThumbWheel;
49class SoStereoDialog;
50class QLineEdit;
51class SoRecordDialog;
52
54//
55// Class: SoQtFullViewer
56//
57// The SoQtFullViewer component class is the abstract base class for all
58// viewers which include a decoration around the rendering area. The
59// decoration is made of thumbwheels, sliders and push/toggle buttons. There
60// is also a popup menu which includes all of the viewing options and methods.
61//
63
89{
90
91 Q_OBJECT
92
93public:
98 {
102 BUILD_NONE = 0x00,
110 BUILD_POPUP = 0x02,
114 BUILD_ALL = 0xff
115 };
116
124 virtual void setDecoration( SbBool onOrOff );
125
129 SbBool isDecoration() { return m_guiFullViewer->isDecoration(); }
130
160 void setPopupMenuEnabled( SbBool trueOrFalse );
161
165 SbBool isPopupMenuEnabled() { return m_guiFullViewer->isPopupMenuEnabled(); }
166
170 void setClientPopupMenu( QMenu* menu );
171
176
180 QWidget* getAppPushButtonParent() const { return appButtonForm; }
181
190 void addAppPushButton( SoQtButton* newButton );
191
200 void insertAppPushButton( SoQtButton* newButton, int index );
201
205 void removeAppPushButton( SoQtButton* oldButton );
206
210 int findAppPushButton( SoQtButton* oldButton ) { return appButtonList->find(oldButton); }
211
215 int lengthAppPushButton() { return appButtonList->getLength(); }
216
220 QWidget* getRenderAreaWidget() { return raWidget; }
221
222 // redefine these from the base class
223 virtual void setViewing( SbBool onOrOff );
224
225 virtual void setCamera( SoCamera* cam );
226 virtual void hide();
227 virtual void setHeadlight( SbBool onOrOff);
230
234 virtual SoStereoDialog* getStereoDialog() { return stereoDialogBox; }
235
239 void setStereoDialog( SoStereoDialog* newDialog );
240
244 QPointer<QMenu> mainPopup;
245
249 QPointer<QMenu> funcPopup;
250
254 QPointer<QMenu> drawPopup;
255
259 QPointer<QMenu> prefPopup;
260
268
269 /*
270 * Tracks the checkmark for "Moving" draw style.
271 */
273
274 /*
275 * Tracks the checkmark for the buffering draw style.
276 */
278
282 QPointer<QMenu> ClientPopup;
283
284 private:
285 virtual ~SoQtFullViewer();
286
287 SoGuiFullViewer* getGuiFullViewer() const;
288
289 virtual void openStereoDialog();
290 virtual void openRecordDialog();
291
292 virtual void internalSetViewingMode( int ) {};
293 virtual int internalGetViewingMode() const { return 0; };
294 virtual void defineCursors() { SoQtViewer::defineCursors(); };
295
296 // retro compatibilty, don't use them directly. Call their accessors.
297 float rightWheelVal, leftWheelVal, bottomWheelVal;
298 SbBool popupEnabled;
299
300private:
301 // Constructor/Destructor
302 SoQtFullViewer( QWidget* parent,
303 const char* name,
304 SbBool buildInsideParent,
306 SoQtViewer::Type type,
307 SbBool buildNow,
308 SbBool sync );
309
310 SoQtFullViewer( QWidget* parent,
311 const char* name,
312 SbBool buildInsideParent,
314 SoQtViewer::Type type,
315 SbBool buildNow,
316 SbBool sync,
317 SoGuiFullViewer* guiFullViewer );
318
319 // general decoration vars
320 QWidget *mgrWidget; // form which manages all other widgets
321 QWidget *raWidget; // render area widget
322
323 QPointer<QWidget> leftTrimForm, bottomTrimForm, rightTrimForm;
324 QWidget* subMgrWidget;
325 QHBoxLayout* subHbl; // subMgrWidget layout
326
327 QPointer<QWidget> zoomForm;
328 QLineEdit *zoomField;
329 QScrollBar *zoomSlider;
330 SoFieldSensor *zoomSensor; // attached to camera zoom field
331
332 // thumb wheel vars
333 SoQtThumbWheel *rightWheel, *bottomWheel, *leftWheel , *extraWheel;
334
335 QPointer<QWidget> extraTrimForm;
336 float extraWheelVal;
337 QString extraWheelStr;
338 int extraLabelHeight;
339 QWidget *extraWheelLabel; //Handle of static control
340
341 // static control that contains all the viewer
342 // buttons on the right side
343 QPointer<QWidget> vwrButtonForm;
344
345 QBrush backgroundBrush; //Used to paint control bkgds
346
347 QString rightWheelStr, bottomWheelStr, leftWheelStr;
348 QLabel *rightWheelLabel, *bottomWheelLabel, *leftWheelLabel, *zoomLabel;
349
350 // widget list of viewer buttons
351 SbPList *viewerButtonWidgets;
352
353 int numFullVwrButtons;
354
355 // Subclasses should override this function (in addition to
356 // createViewerButtons), handle selection if it's a button they
357 // added and if not kick it back up to this function.
358 virtual void pushButtonCB( int id );
359
360 // The button widget should be used as the parent widget
361 // when creating new buttons
362 QWidget *getButtonWidget() const { return appButtonForm; }
363
364 // popup menu vars
365 QWidget *popupWidget, *popupToggleWidgets;
366 QWidget *drawStyleWidgets, *bufferStyleWidgets[3];
367 QString popupTitle;
368
369 //
370 // Build/destroy decoration routines
371 //
372 QWidget *buildWidget( QWidget* parent );
373
374 virtual void buildDecoration();
375 virtual QWidget *buildLeftTrim( QWidget* parent );
376 virtual QWidget *buildBottomTrim( QWidget* parent );
377 virtual QWidget *buildRightTrim( QWidget* parent );
378 virtual QWidget *buildZoomSlider( QWidget* parent );
379 QWidget *buildAppButtons( QWidget* parent );
380 QWidget *buildViewerButtons( QWidget* parent );
381 virtual void createViewerButtons( QWidget* parent );
382
383 //
384 // popup menu build routines
385 //
386 virtual void buildPopupMenu();
387
388 virtual void destroyPopupMenu();
389 void setPopupMenuString( const QString& name );
390 QWidget* buildFunctionsSubmenu( QWidget* popup );
391 QWidget* buildDrawStyleSubmenu( QWidget* popup );
392
393 // Display the main or the client popup menu
394 virtual void displayPopupMenu( QPoint point );
395
396 // Subclasses SHOULD redefine these to do viewer specific tasks
397 // since these do nothing in the base class. those routines are
398 // called by the thumb wheels whenever they rotate.
399 virtual void rightWheelMotion( float f );
400 virtual void bottomWheelMotion( float f);
401 virtual void leftWheelMotion( float f );
402
403 // Subclasses can redefine these to add viewer functionality. They
404 // by default call start and finish interactive viewing methods.
405 // (defined in the base class).
406 virtual void rightWheelStart();
407 virtual void bottomWheelStart();
408 virtual void leftWheelStart();
409 virtual void rightWheelFinish();
410 virtual void bottomWheelFinish();
411 virtual void leftWheelFinish();
412
413 // Subclasses SHOULD set those wheel string to whatever functionality
414 // name they are redefining the thumb wheels to do. Default names are
415 // "Motion X, "Motion Y" and "Motion Z" for bottom, left and right wheels.
416 void setBottomWheelString( const QString& name );
417 void setLeftWheelString( const QString& name );
418 void setRightWheelString( const QString& name );
419
420 // Subclasses SHOULD redefine the openViewerHelpCard() routine to bring
421 // their help card (called by push button and popup menu entry).
422 // They can simply call SoQtComponent::openHelpCard() to open their
423 // specific help card.
424 virtual void openViewerHelpCard();
425
426 // redefine this to load the popup menu colormap
427 virtual void afterRealizeHook();
428
429private:
430 QPointer<QWidget> appButtonForm;
431
432 int SO_WHEEL_DELTA;
433
434 virtual void setSeekButton( SbBool onOff );
435
436private:
437 void constructorCommon( SoQtFullViewer::BuildFlag buildFlag, SbBool buildNow );
438
439 SoGuiFullViewer* m_guiFullViewer; // Implementation class for SoXxFullViewer
440
441 SbBool firstBuild; // set FALSE after buildWidget called once
442 SbBool m_seekState;
443
444 // app button vars
445 SbPList* appButtonList;
446 void doAppButtonLayout( int start, SoQtButton* newButton );
447
448 SoStereoDialog *stereoDialogBox;
449 SoRecordDialog* m_recordDialogBox;
450
451 // zoom slider vars and routines
452 SbVec2f zoomSldRange;
453 void setCameraZoom( float zoom );
454 float getCameraZoom();
455 void setZoomSliderPosition( float zoom );
456 void setZoomFieldString( float zoom );
457
458 static void zoomSensorCB( void* d, SoSensor* s );
459
460 // push buttons vars and callbacks
461 SoQtButton* buttonList[10];
462
463 // pref sheet variables
464 QWidget* prefSheetShellWidget;
465 char* prefSheetStr;
466
467 // seek dist pref sheet vars and callbacks
468 int seekDistWheelVal;
469 QWidget* seekDistField;
470
471 // clipping plane pref sheet callbacks and variables
472 QWidget* clipWheelForm;
473 int clipNearWheelVal, clipFarWheelVal;
474 QWidget* clipNearField, clipFarField;
475
476 // stereo viewing pref sheet callbacks and variables
477 QWidget* stereoWheelForm, stereoField, stereoLabel;
478 int stereoWheelVal;
479
480 void UPDATE_CHECKMARK( QAction* curItem, QAction* item );
481
482 QVBoxLayout* mgrVbl; // mgrWidget layout
483
484private:
485
486 //pixmap
487 QPixmap IDB_PUSH_PICK;
488 QPixmap IDB_PUSH_VIEW;
489 QPixmap IDB_PUSH_HELP;
490 QPixmap IDB_PUSH_HOME;
491 QPixmap IDB_PUSH_SETHOME;
492 QPixmap IDB_PUSH_VIEWALL;
493 QPixmap IDB_PUSH_SEEK;
494 QPixmap IDB_PUSH_GRAYSEEK;
495
496 // Popup menu: need this to have a link to the menu items.
497 QAction* IDM_DPOPUP_ASIS;
498 QAction* IDM_DPOPUP_HLINE;
499 QAction* IDM_DPOPUP_NOTEX;
500 QAction* IDM_DPOPUP_LOWRES;
501 QAction* IDM_DPOPUP_WIRE;
502 QAction* IDM_DPOPUP_POINTS;
503 QAction* IDM_DPOPUP_BBOX;
504 //move style
505 QAction* IDM_DPOPUP_MSAMEAS ;
506 QAction* IDM_DPOPUP_MNOTEX;
507 QAction* IDM_DPOPUP_MLOWRES;
508#ifdef _WIN32
509 QAction* IDM_DPOPUP_MHLINE;
510#endif
511 QAction* IDM_DPOPUP_MWIRE;
512 QAction* IDM_DPOPUP_MPOINTS;
513 QAction* IDM_DPOPUP_MBBOX;
514 //buffer
515 QAction* IDM_DPOPUP_SBUFFER;
516 QAction* IDM_DPOPUP_DBUFFER;
517 QAction* IDM_DPOPUP_IBUFFER;
518 //preference menu
519 QAction* IDM_PPOPUP_SEEK;
520 QAction* IDM_PPOPUP_CLIP;
521 QAction* IDM_PPOPUP_SPIN;
522 QAction* IDM_PPOPUP_INTERACTIVE;
523 QAction* IDM_PPOPUP_AXES;
524 QAction* IDM_PPOPUP_STEREO;
525 QAction* IDM_PPOPUP_FSAA;
526 QAction* IDM_PPOPUP_RECORD;
527 //mainPopup
528 QAction* IDM_MPOPUP_VIEWING;
529 QAction* IDM_MPOPUP_DECORAT;
530 QAction* IDM_MPOPUP_FULLSCREEN;
531 QAction* IDM_MPOPUP_HLIGHT;
532
533#ifndef HIDDEN_FROM_DOC
534 protected Q_SLOTS:
535 //slot for thumbwheel
539 void leftWheelDrag( int value );
540 void leftWheelOther();
541 void rightWheelDrag( int value );
542 void rightWheelOther();
543 void bottomWheelDrag( int value );
544 void bottomWheelOther();
545
549 void slotPushPickButton();
550 void slotPushViewButton();
551 void slotPushHelpButton();
552 void slotPushHomeButton();
553 void slotPushSetHomeButton();
554 void slotPushViewAllButton();
555 void slotPushSeekButton();
556
557 //Q_SLOTS for popup menu
561 void slot_popup_home();
562 void slot_popup_setHome();
563 void slot_popup_viewAll();
564 void slot_popup_seek();
565
566 //preference menu
570 void slot_popup_seekToPoint();
571 void slot_popup_clip();
572 void slot_popup_interactive();
573 void slot_popup_stereo();
574 void slot_popup_fsaa();
575 void slot_popup_recording();
576
577 //mainpopup
581 void slot_popup_viewing();
582 void slot_popup_decoration();
583 void slot_popup_fullscreen();
584 void slot_popup_headLight();
585
586 //draw style menu
590 void slot_popup_asIs();
591 void slot_popup_hiddenLine();
592 void slot_popup_noTexture();
593 void slot_popup_lowResolution();
594 void slot_popup_wireFrame();
595 void slot_popup_points();
596 void slot_popup_boundingBox();
597 void slot_popup_moveSameAsStill();
598 void slot_popup_moveNoTexture();
599 void slot_popup_moveLowRes();
600 void slot_popup_moveWireFrame();
601 void slot_popup_movePoints();
602 void slot_popup_moveBoundingBox();
603 void slot_popup_singleBuffer();
604 void slot_popup_doubleBuffer();
605 void slot_popup_interactiveBuffer();
606
607#endif // HIDDEN_FROM_DOC
608
609 private Q_SLOTS:
610 void visibilityChangeCB( SbBool visible );
611 void zoomSliderCB( int value );
612 void textChangedSlot();
613 void setNum( int value );
614 void slot_internalStereoDialogDestroyed();
615 void slot_externalStereoDialogDestroyed();
616 void slot_internalRecordDialogDestroyed();
617};
618
619#endif /* _SO_QT_FULL_VIEWER_ */
620
621
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
Sensor class that can be attached to Open Inventor fields.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Base viewer clas...
QAction * curPopupMoveItem
QAction * curPopupDrawItem
In this version we track the currently "check marked" menu item in the Draw Style submenu (only one c...
virtual void setHeadlight(SbBool onOrOff)
Turns the headlight on/off (default on).
void setPopupMenuEnabled(SbBool trueOrFalse)
Enables/disables the viewer popup menu (default enabled).
void setStereoDialog(SoStereoDialog *newDialog)
Sets the stereo dialog the viewer should use.
int lengthAppPushButton()
Returns number of application push buttons.
QPointer< QMenu > funcPopup
Pointer to the Functions submenu.
virtual void setBufferingType(SoQtViewer::BufferType type)
Sets the current buffering type in the main view (default SoQtViewer::BUFFER_DOUBLE).
SbBool isDecoration()
Returns whether the viewer component trim is on or off.
QWidget * getRenderAreaWidget()
Returns the render area window handle.
QPointer< QMenu > mainPopup
Pointer to the root of the popup menu.
QWidget * getAppPushButtonParent() const
Returns application push button parent.
SbBool isClientPopupMenuInstalled()
Returns TRUE if an application-specific popup menu is installed.
QAction * curPopupBufferItem
void setClientPopupMenu(QMenu *menu)
Enables application-specific popup menu.
void insertAppPushButton(SoQtButton *newButton, int index)
Adds application push button, which will be placed in the left hand side decoration trim.
void addAppPushButton(SoQtButton *newButton)
Adds application push button, which will be placed in the left hand side decoration trim.
QPointer< QMenu > ClientPopup
Popup menu provided by a client (i.e.
virtual void setDecoration(SbBool onOrOff)
Shows/hides the viewer component trim (default on).
QPointer< QMenu > prefPopup
Pointer to the Preferences submenu.
BuildFlag
Build flags.
@ BUILD_DECORATION
Build the decoration only.
@ BUILD_NONE
Doesn't build anything extra.
@ BUILD_ALL
Build everything by default.
@ BUILD_POPUP
Build the popup menu only.
QPointer< QMenu > drawPopup
Pointer to the Draw Style submenu.
SbBool isPopupMenuEnabled()
Returns whether the viewer popup menu is enabled or disabled.
virtual void setCamera(SoCamera *cam)
Sets the edited camera.
virtual void setDrawStyle(SoQtViewer::DrawType type, SoQtViewer::DrawStyle style)
Sets the current drawing style in the main view.
virtual void hide()
This hides the component.
virtual void setViewing(SbBool onOrOff)
Sets whether the viewer is turned on or off.
virtual SoStereoDialog * getStereoDialog()
Returns the current stereo dialog.
int findAppPushButton(SoQtButton *oldButton)
Returns index of specified push button.
void removeAppPushButton(SoQtButton *oldButton)
Removes specified application push button.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Viewer component...
Definition SoQtViewer.h:177
Type
Editor types.
Definition SoQtViewer.h:194
DrawType
Draw types.
Definition SoQtViewer.h:257
DrawStyle
List of possible drawing styles.
Definition SoQtViewer.h:212
BufferType
List of different buffering types.
Definition SoQtViewer.h:270
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:100
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Component that l...
int SbBool
Boolean type.
Definition SbBase.h:87