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 00129 class SoWinPlaneViewer : public SoWinFullViewer 00130 { 00131 00132 public: 00141 SoWinPlaneViewer( SoWidget parent = NULL, 00142 const char* name = NULL, 00143 SbBool buildInsideParent = TRUE, 00144 SoWinFullViewer::BuildFlag flag = SoWinFullViewer::BUILD_ALL, 00145 SoWinViewer::Type type = SoWinViewer::BROWSER ); 00149 ~SoWinPlaneViewer(); 00150 00154 void setPlane( const SbVec3f& newNormal, const SbVec3f& newRight ); 00155 00156 // 00157 // redefine these to add Plane viewer functionality 00158 // 00159 virtual void setViewing( SbBool onOrOff ); 00160 virtual void setCamera( SoCamera* cam ); 00161 virtual void setCursorEnabled( SbBool onOrOff ); 00162 virtual void setSeekMode( SbBool onOrOff ); 00163 00164 // This constructor takes a boolean whether to build the widget now. 00165 // Subclasses can pass FALSE, then call SoWinPlaneViewer::buildWidget() 00166 // when they are ready for it to be built. 00167 private: 00168 00169 SoGuiPlaneViewer* getGuiPlaneViewer() const; 00170 00171 SoWinPlaneViewer( SoWidget parent, 00172 const char* name, 00173 SbBool buildInsideParent, 00174 SoWinFullViewer::BuildFlag flag, 00175 SoWinViewer::Type type, 00176 SbBool buildNow, 00177 SbBool sync = TRUE ); 00178 00179 private: 00180 SoWidget buildWidget( SoWidget parent ); 00181 00182 // redefine these 00183 virtual SbString getDefaultWidgetName() const; 00184 virtual SbString getDefaultTitle() const; 00185 virtual SbString getDefaultIconTitle() const; 00186 00187 // redefine those routines to do viewer specific stuff 00188 virtual void processEvent( XAnyEvent* anyevent ); 00189 virtual void actualRedraw(); 00190 00191 // Define those thumb wheels to translate in the viewer plane 00192 virtual void bottomWheelMotion( float newVal ); 00193 virtual void leftWheelMotion( float newVal ); 00194 virtual void rightWheelMotion( float newVal ); 00195 virtual void mouseWheelMotion( float newVal ); 00196 00197 // add viewer preference stuff 00198 virtual void createPrefSheet(); 00199 00200 // add some viewer buttons 00201 virtual void createViewerButtons( SoWidget parent ); 00202 00203 // Define this to bring the viewer help card 00204 virtual void openViewerHelpCard(); 00205 00206 // Redefine this to keep the same camera rotation when seeking 00207 virtual void computeSeekFinalOrientation(); 00208 00209 // It's a long story, but since we can't attach callbacks to a window 00210 // quite like we can to an Xt widget, it makes more sense for the 00211 // subclass viewer to handle the buttons it knows about then pass 00212 // the rest back up to SoWinFullViewer. 00213 // 00214 // So WINxx this function must be virtual and protected, not private. 00215 virtual void pushButtonCB( SoWidget w, int id, void* data ); 00216 00217 virtual void updateCursor(); 00218 00219 private: 00220 00221 SoGuiPlaneViewer* m_guiPlaneViewer; // Implementation class for SoXxPlaneViewer 00222 00223 // push button vars and callbacks 00224 SoWinBitmapButton* buttonList[10]; 00225 00226 void updateViewerMode( unsigned int state ); 00227 void switchMode( int newMode ); 00228 00229 // this is called by both constructors 00230 void constructorCommon( SbBool buildNow ); 00231 00232 // Utility function called from processEvent 00233 void processPopupItem( int item ); 00234 }; 00235 00236 #include <Inventor/Win/SoWinEndStrict.h> 00237 00238 #endif /* _SO_WIN_PLANE_VIEWER_ */ 00239 00240