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 #ifndef __CIVFCOMPONENT_H__
00026 #define __CIVFCOMPONENT_H__
00027
00028 #include <Inventor/SbBasic.h>
00029 #include <SoVersion.h>
00030
00031
00032 #if defined(_DEBUG)
00033 #ifdef UNICODE
00034 # define __IVFDLL "IvfUD.dll"
00035 # define __IVFLIB "IvfUD.lib"
00036 #else
00037 # define __IVFDLL "IvfD.dll"
00038 # define __IVFLIB "IvfD.lib"
00039 #endif
00040 #else
00041 #ifdef UNICODE
00042 # define __IVFDLL "IvfU.dll"
00043 # define __IVFLIB "IvfU.lib"
00044 #else
00045 # define __IVFDLL "Ivf.dll"
00046 # define __IVFLIB "Ivf.lib"
00047 #endif
00048 #endif
00049 #ifndef Ivf_EXPORTS
00050 #ifndef OIV_DISABLE_AUTOLINK
00051 # pragma comment(lib,__IVFLIB)
00052 #endif
00053 #endif
00054
00055 #include <Inventor/SoModule.h>
00056 SO_MODULE_HEADER(SoIvf, __IVFDLL)
00057
00058 class SbColor;
00059 class SoError;
00060 class SoWinComponent;
00061 class SoNode;
00062 class SoPathList;
00063 class SoPath;
00064 class SoPickedPoint;
00065 class SoWinClipboard;
00066 class SoGroup;
00067 class SoCamera;
00068 class SoEventCallback;
00069 class SoSceneManager;
00070 class SoSelection;
00071 class SbViewportRegion;
00072 class SoWWWAnchor;
00073 class SoOffscreenRenderer;
00074 class SoGLRenderAction;
00075
00076 class CIvfApp;
00077 class CIvfMainFrame;
00078 class CIvfDocument;
00079 class SoDEPRECATED CIvfComponent
00107 {
00108 friend class CIvfMainFrame;
00109 friend class CIvfDocument;
00110
00111 public:
00112 CIvfComponent();
00113
00117 virtual SoSelection *IvfGetSelectionNode();
00118
00124 virtual void IvfCreateComponent(CWnd *pWnd,
00125 void *pCreateArgs=NULL) = 0;
00126
00130 virtual void IvfDestroyComponent() = 0;
00131
00135 virtual SoWinClipboard *IvfGetClipboard();
00136
00140 virtual SoWinComponent *IvfGetSoWinComponent() ;
00141
00146 void IvfResetComponent(CIvfDocument *pDoc);
00147
00151 virtual BOOL IvfIsSelected();
00152
00156 void IvfViewmodesSelectionmode();
00157 void IvfViewmodesViewingmode();
00158
00163 virtual void IvfSetSceneGraph(SoNode *pRoot) = 0;
00164
00169 virtual SoNode * IvfGetSceneGraph()=0;
00170
00175 virtual SoNode * IvfGetBaseViewerSceneGraph()=0;
00176
00180 virtual void IvfReleaseSceneGraph() = 0;
00181
00185 virtual void IvfSetBackgroundColor(SbColor &) = 0;
00186
00190 virtual void IvfSetHeadlight(BOOL) = 0;
00191 virtual BOOL IvfIsHeadlight() = 0;
00192
00197 virtual void IvfSetActiveCamera(int nCamera);
00198
00202 virtual void IvfSetActiveCamera(SoCamera *pCam)=0;
00203
00207 virtual SoCamera * IvfGetActiveCamera()=0;
00208
00213 virtual void IvfSaveHomePosition()=0;
00214
00218 virtual void IvfResetToHomePosition()=0;
00219
00223 virtual void IvfViewAll()=0;
00224
00228 virtual const SbViewportRegion & IvfGetViewportRegion()=0;
00229
00233 virtual SoGLRenderAction *IvfGetGLRenderAction()=0;
00234
00238 virtual SoSceneManager *IvfGetSceneManager()=0;
00239
00243 virtual BOOL IvfIsViewing()=0;
00244
00248 virtual void IvfSetViewing(BOOL flag)=0;
00249
00251 enum IvfViewerType
00252 {
00254 IVF_NONE,
00256 IVF_WALK,
00258 IVF_EXAMINER
00259 };
00260
00261
00262 static void setIgnoreError(WORD err_mask);
00263 static void clearIgnoreError(WORD err_mask);
00264 static BOOL isIgnoreError(WORD err_mask);
00265
00266 static WORD IVF_IGNORE_READERROR;
00267 static WORD IVF_IGNORE_MEMERROR;
00268 static WORD IVF_IGNORE_DBGINFO;
00269 static WORD IVF_IGNORE_DBGWARNING;
00270 static WORD IVF_IGNORE_DBGERROR;
00271
00272
00273 private: protected:
00278 virtual void IvfSceneGraphChanged() ;
00279
00283 void IvfOnBeginPrinting();
00284 void IvfOnPrint(CDC *);
00285 void IvfOnEndPrinting();
00286
00290 BOOL IvfSaveAsBitmap(LPCTSTR pFilename);
00291
00295 virtual void IvfOnSelection(SoPath *);
00296 virtual void IvfOnDeSelection(SoPath *);
00297 static void IvfStaticSelectionCB(void *, SoPath *);
00298 static void IvfStaticDeSelectionCB(void *, SoPath *);
00299
00304 virtual void IvfRemoveManips(void);
00305 virtual void IvfRestoreManips(void);
00306
00310 void IvfOnEditCopy();
00311 void IvfOnUpdateEditCopy(CCmdUI* pCmdUI);
00312 void IvfOnEditCut();
00313 void IvfOnUpdateEditCut(CCmdUI* pCmdUI);
00314 void IvfOnEditPaste();
00315 void IvfOnUpdateEditPaste(CCmdUI* pCmdUI);
00316 void IvfOnUpdateEditUndo(CCmdUI* pCmdUI);
00317
00335 virtual void IvfOnSelectViewpoint(int nCamera);
00336
00337
00338
00349 virtual void IvfOnUrlDisplayChanged(LPCTSTR urlName);
00350
00361 virtual SoPath * IvfOnSelectionPick(const SoPickedPoint *pick );
00362
00375 virtual void IvfOnViewAnchor(SoPath *pPath);
00376
00380 void IvfOnSelectionEnable();
00381 void IvfOnUpdateSelectionEnable(CCmdUI* pCmdUI);
00382
00387 static void IvfErrorCallback( const SoError *error, void *data );
00388
00393 virtual void IvfPrePasteAction();
00394 virtual void IvfPostPasteAction();
00395 virtual void IvfPreCopyAction();
00396 virtual void IvfPostCopyAction();
00397 virtual void IvfPreCutAction();
00398
00399 virtual ~CIvfComponent();
00400
00415 virtual void IvfSetupUrlDisplayCallback(SoGroup *root);
00416
00421 virtual void IvfRemoveUrlDisplayCallback(SoGroup *root);
00422
00433 virtual void IvfLoc2Callback(
00434 void *userData,
00435 SoEventCallback *node);
00436
00437
00444 static void IvfStaticLoc2Callback(
00445 void *userData,
00446 SoEventCallback *node);
00447
00452 virtual void IvfSetupSelectionPickCallback();
00453
00457 virtual void IvfRemoveSelectionPickCallback();
00458
00459
00465 static SoPath * IvfStaticSelectionPickCB(
00466 void *userData,
00467 const SoPickedPoint *pick);
00468
00475 static void IvfPasteDoneCB(void *userData, SoPathList *pathList);
00476 void IvfPasteDone(SoPathList *pathList);
00477
00481 void IvfDestroySelectedObjects();
00482
00487 virtual void IvfOnDestroy();
00488
00496 virtual void IvfOnPaint();
00497 virtual void IvfOnPaint( CWnd *pWnd );
00498
00507 virtual BOOL IvfOnEraseBkgnd( CDC* pDC );
00508
00512 virtual void IvfOnCreate(LPCREATESTRUCT lpCreateStruc);
00513
00518 virtual void IvfOnInitialUpdate(CWnd *pWnd);
00519
00524 virtual void IvfOnActivateComponent(CView *pActivateView = NULL);
00525
00530 virtual void IvfOnDeactivateComponent();
00531
00536 virtual BOOL IvfOnCommand(WPARAM wParam, LPARAM lParam);
00537
00542 virtual BOOL IvfOnCmdMsg(UINT nID, int nCode, void* pExtra,
00543 AFX_CMDHANDLERINFO* pHandlerInfo) ;
00544
00550 virtual void IvfOnSelectViewAnchors();
00551
00556 virtual BOOL IvfIsViewpointMsg(UINT nID, int nCode, void* pExtra,
00557 AFX_CMDHANDLERINFO* pHandlerInfo);
00558
00563 virtual BOOL IvfIsSceneViewer();
00564
00568 SoWinComponent * m_pComponent;
00569
00573 void * m_pCreateArgs;
00574
00578 SoWinClipboard *m_pClipboard;
00579 SoSelection *m_pSelection;
00580
00584 SoOffscreenRenderer *m_pOffscreen;
00585
00593 CWnd * m_pWnd;
00594
00595
00600 SoEventCallback * m_pEventCB;
00601
00605 BOOL m_nEnableSelection;
00606
00611 BOOL m_bBgColorChangedSet;
00612
00613 static WORD m_fIgnoreError;
00614 };
00615
00616
00617
00625 #define IVF_COMPONENT_BASE()\
00626 public:\
00627 virtual void IvfCreateComponent(CWnd *pWnd, void *pVwrArgs=NULL);\
00628 virtual void IvfDestroyComponent();\
00629 virtual void IvfSetSceneGraph(SoNode *pRoot) ;\
00630 virtual SoNode * IvfGetSceneGraph();\
00631 virtual SoNode * IvfGetBaseViewerSceneGraph();\
00632 virtual void IvfReleaseSceneGraph();\
00633 virtual void IvfSetBackgroundColor(SbColor &bg);\
00634 virtual void IvfSetHeadlight(BOOL);\
00635 virtual BOOL IvfIsHeadlight();\
00636 virtual void IvfSetActiveCamera(SoCamera *pCam);\
00637 virtual SoCamera * IvfGetActiveCamera();\
00638 virtual void IvfSaveHomePosition();\
00639 virtual void IvfResetToHomePosition();\
00640 virtual void IvfViewAll();\
00641 virtual SoGLRenderAction * IvfGetGLRenderAction();\
00642 virtual const SbViewportRegion & IvfGetViewportRegion();\
00643 virtual SoSceneManager *IvfGetSceneManager();\
00644 virtual BOOL IvfIsViewing();\
00645 virtual void IvfSetViewing(BOOL flag);
00646
00647
00653 #define IVF_MFC_ON_METHOD_NAME(CmdName) On##CmdName
00654 #define IVF_MFC_ON_UPD_METHOD_NAME(CmdName) OnUpdate##CmdName
00655
00656 #define IVF_ON_METHOD_NAME(CmdName) IvfOn##CmdName
00657 #define IVF_ON_UPD_METHOD_NAME(CmdName) IvfOnUpdate##CmdName
00658
00659 #define IVF_COMMAND_HANDLER(ComponentName,CmdName) \
00660 void ComponentName::IVF_MFC_ON_METHOD_NAME(CmdName) () \
00661 { \
00662 IVF_ON_METHOD_NAME(CmdName) (); \
00663 } \
00664 void ComponentName::IVF_MFC_ON_UPD_METHOD_NAME(CmdName) (CCmdUI* pCmdUI)\
00665 { \
00666 IVF_ON_UPD_METHOD_NAME(CmdName) (pCmdUI); \
00667 }
00668
00672 #define IVF_COMMAND_HANDLER_BETA2(ComponentName,VwrName,CmdName) \
00673 void ComponentName::IVF_MFC_ON_METHOD_NAME(CmdName) () \
00674 { \
00675 IVF_ON_METHOD_NAME(CmdName) (); \
00676 } \
00677 void ComponentName::IVF_MFC_ON_UPD_METHOD_NAME(CmdName) (CCmdUI* pCmdUI)\
00678 { \
00679 IVF_ON_UPD_METHOD_NAME(CmdName) (pCmdUI); \
00680 }
00681
00682 #endif
00683
00684