00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : VSG (MMM YYYY) 00022 **=======================================================================*/ 00023 00024 00025 00026 #ifndef _SO_WIN_PLANE_VIEWER_ 00027 #define _SO_WIN_PLANE_VIEWER_ 00028 00029 #include <Inventor/Win/SoWinBeginStrict.h> 00030 00031 #include <Inventor/Win/viewers/SoWinFullViewer.h> 00032 #include <Inventor/SbLinear.h> 00033 00034 #include <Inventor/Gui/viewers/SoGuiPlaneViewer.h> 00035 00036 class SoWinBitmapButton; 00037 00039 // 00040 // Class: SoWinPlaneViewer 00041 // 00042 // Plane Viewer - allows the user to move left, right, up, and down a 00043 // given plane, as well as roll the viewer and zoom in and out. 00044 // 00045 // 00046 // Keys used by this viewer: 00047 // ------------------------- 00048 // 00049 // Left Mouse: Dolly in and out (gets closer to and further away from the 00050 // object). 00051 // 00052 // Middle Mouse: 00053 // Ctrl + Left Mouse: Translate up, down, left and right. 00054 // 00055 // Ctrl + Middle Mouse: Used for roll action (rotates around the viewer 00056 // forward direction). 00057 // 00058 // Shift + Ctrl + Left Mouse: Roll (same as Ctrl + Middle Mouse behavior 00059 // but added by VSG to support the standard 00060 // Microsoft 2-button mouse). 00061 // 00062 // <s> + click: Alternative to the Seek button. Press (but do not hold down) 00063 // the <s> key, then click on a target object. 00064 // 00065 // Right Mouse: Open the popup menu. 00066 // 00068 00130 class SoWinPlaneViewer : public SoWinFullViewer 00131 { 00132 00133 public: 00142 SoWinPlaneViewer( SoWidget parent = NULL, 00143 const char* name = NULL, 00144 SbBool buildInsideParent = TRUE, 00145 SoWinFullViewer::BuildFlag flag = SoWinFullViewer::BUILD_ALL, 00146 SoWinViewer::Type type = SoWinViewer::BROWSER ); 00150 ~SoWinPlaneViewer(); 00151 00155 void setPlane( const SbVec3f& newNormal, const SbVec3f& newRight ); 00156 00157 // 00158 // redefine these to add Plane viewer functionality 00159 // 00160 virtual void setViewing( SbBool onOrOff ); 00161 virtual void setCamera( SoCamera* cam ); 00162 virtual void setCursorEnabled( SbBool onOrOff ); 00163 virtual void setSeekMode( SbBool onOrOff ); 00164 00165 // This constructor takes a boolean whether to build the widget now. 00166 // Subclasses can pass FALSE, then call SoWinPlaneViewer::buildWidget() 00167 // when they are ready for it to be built. 00168 private: 00169 00170 SoGuiPlaneViewer* getGuiPlaneViewer() const; 00171 00172 SoWinPlaneViewer( SoWidget parent, 00173 const char* name, 00174 SbBool buildInsideParent, 00175 SoWinFullViewer::BuildFlag flag, 00176 SoWinViewer::Type type, 00177 SbBool buildNow, 00178 SbBool sync = TRUE ); 00179 00180 private: 00181 SoWidget buildWidget( SoWidget parent ); 00182 00183 // redefine these 00184 virtual SbString getDefaultWidgetName() const; 00185 virtual SbString getDefaultTitle() const; 00186 virtual SbString getDefaultIconTitle() const; 00187 00188 // redefine those routines to do viewer specific stuff 00189 virtual void processEvent( XAnyEvent* anyevent ); 00190 virtual void actualRedraw(); 00191 00192 // Define those thumb wheels to translate in the viewer plane 00193 virtual void bottomWheelMotion( float newVal ); 00194 virtual void leftWheelMotion( float newVal ); 00195 virtual void rightWheelMotion( float newVal ); 00196 virtual void mouseWheelMotion( float newVal ); 00197 00198 // add viewer preference stuff 00199 virtual void createPrefSheet(); 00200 00201 // add some viewer buttons 00202 virtual void createViewerButtons( SoWidget parent ); 00203 00204 // Define this to bring the viewer help card 00205 virtual void openViewerHelpCard(); 00206 00207 // Redefine this to keep the same camera rotation when seeking 00208 virtual void computeSeekFinalOrientation(); 00209 00210 // It's a long story, but since we can't attach callbacks to a window 00211 // quite like we can to an Xt widget, it makes more sense for the 00212 // subclass viewer to handle the buttons it knows about then pass 00213 // the rest back up to SoWinFullViewer. 00214 // 00215 // So WINxx this function must be virtual and protected, not private. 00216 virtual void pushButtonCB( SoWidget w, int id, void* data ); 00217 00218 virtual void updateCursor(); 00219 00220 private: 00221 00222 SoGuiPlaneViewer* m_guiPlaneViewer; // Implementation class for SoXxPlaneViewer 00223 00224 // push button vars and callbacks 00225 SoWinBitmapButton* buttonList[10]; 00226 00227 void updateViewerMode( unsigned int state ); 00228 void switchMode( int newMode ); 00229 00230 // this is called by both constructors 00231 void constructorCommon( SbBool buildNow ); 00232 00233 // Utility function called from processEvent 00234 void processPopupItem( int item ); 00235 }; 00236 00237 #include <Inventor/Win/SoWinEndStrict.h> 00238 00239 #endif /* _SO_WIN_PLANE_VIEWER_ */ 00240 00241