Class Hierarchy   File List   Compound Members  

CHoopsControl.h

00001 //
00002 // Copyright (c) 2000 by Tech Soft 3D, LLC.
00003 // The information contained herein is confidential and proprietary to
00004 // Tech Soft 3D, LLC., and considered a trade secret as defined under
00005 // civil and criminal statutes.  Tech Soft 3D shall pursue its civil
00006 // and criminal remedies in the event of unauthorized use or misappropriation
00007 // of its trade secrets.  Use of this information by anyone other than
00008 // authorized employees of Tech Soft 3D, LLC. is granted only under a
00009 // written non-disclosure agreement, expressly prescribing the scope and
00010 // manner of such use.
00011 //
00012 // $Header: /files/homes/master/cvs/hoops_master/docs_hoops/HoopsActiveX/HoopsMFC/ref_manual/CHoopsControl.h-source.html,v 1.2 2006-08-07 20:39:02 stage Exp $
00013 //
00014 
00015 #if !defined(AFX_CHOOPSCONTROL_H__E312B99F_42D6_11D3_8C8B_0080C7975371__INCLUDED_)
00016 #define AFX_CHOOPSCONTROL_H__E312B99F_42D6_11D3_8C8B_0080C7975371__INCLUDED_
00017 
00018 #if _MSC_VER > 1000
00019 #pragma once
00020 #endif // _MSC_VER > 1000
00021 
00022 // CHoopsControl.h : Declaration of the CHoopsControl ActiveX Control class.
00023 #include "HUtility.h"
00024 
00025 #include "HStream.h"
00026 #include "HOpcodeHandler.h"
00027 
00028 #include "CHoopsDataLoader.h"
00029 #include "resource.h"
00030 
00031 // msw driver options debug
00032 #define DEBUG_NO_WINDOWS_HOOK           0x00000040
00033 #define DEBUG_FORCE_FULL_COLOR          0x00000010
00034 #define DEBUG_SFB_COPY_TO_CLIPBOARD     0x00004000
00035 #define DEBUG_NO_RASTERS_IN_PRINTING    0x00020000
00036 #define DEBUG_PRINTING_MODE             0x00040000
00037 #define DEBUG_CLIPBOARD_MODE            0x00080000
00038 
00039 // rendering options debug
00040 #define DEBUG_NO_PAINTERS_PANELLING     0x00000008
00041 
00042 #define WMF             0
00043 #define EMF             1
00044 
00045 
00046 class HBaseModel;
00047 class HCtrlView;
00048 class HBaseOperator;
00049 
00050 
00051 class TK_Custom_Bounding : public TK_Bounding 
00052 {
00053 
00054 private:
00055 
00056     CHoopsControl * m_pControl;
00057 
00058 public:
00059 
00060     TK_Custom_Bounding(unsigned char opcode, CHoopsControl * pCtrl) : TK_Bounding(opcode) { m_pControl = pCtrl; }
00061     
00062     TK_Status   Execute (HStreamFileToolkit & tk) alter;    
00063 };
00064 
00065 
00066 class StreamBuffer 
00067 {
00068 
00069 public:
00070 
00071     long size;
00072     void * data;
00073     void * deleteme;
00074 
00075     StreamBuffer(long s, void * d) { size = s; data = d; deleteme = null;  next = null; };
00076 
00077     StreamBuffer *next;
00078 };
00079 
00080 
00082 // CHoopsControl : See CHoopsControl.cpp for implementation.
00083 
00084 
00086 
00096 class CHoopsControl : public COleControl
00097 {
00098     DECLARE_DYNCREATE(CHoopsControl);
00099 
00100     friend class CHoopsDataLoader;
00101     friend unsigned int HStreamFileReadingThread(LPVOID pParam);
00102     friend static void event_checker(void);
00103 
00104 private:
00105 
00106     // current reading mode of the HStreamToolkit object
00107     TK_Status           reading_mode;
00108 
00109     // streaming mgmt variables
00110     int                 counter;                // number of HSF buffers pending (waiting to be processed)
00111     bool                m_first_buffer;
00112     bool                terminate;
00113     bool                pause_streaming;        // indicates that streaming should be paused during user interaction
00114     bool                m_bReadingComplete;     // indicates that streaming thread is complete
00115     bool                m_first_update;         // flag indicating whether the first update has occurred (meaning the window is mapped, etc...)
00116     StreamBuffer        *streamBufferHead;
00117     StreamBuffer        *streamBufferTail;
00118     CRITICAL_SECTION    buffer_list_lock;
00119 
00120 
00121     bool                m_bBoundingRead;
00122 
00123 
00124     // denotes whether the model data is to be serialized to/from container's document
00125     BOOL                m_bEmbedded;
00126 
00127 
00128     IWebBrowserApp *    m_pInternetExplorer;    // ptr to the IWebBrowserApp interface of MSIE
00129     CString             m_loadPendingFile;
00130 
00131     // camera state variables
00132     BOOL                m_bCameraNeedsToBeSet;
00133     CString             m_projection;
00134     float               m_fieldHeight;
00135     float               m_fieldWidth;
00136     HPoint              m_upVector;
00137     HPoint              m_target;
00138     HPoint              m_position;
00139     int                 m_cx;
00140     int                 m_cy;
00141 
00142 
00143     unsigned long       MapFlags( unsigned long state ); //map to mvo codes
00144 
00145     bool                disable_painters_in_metafile;
00146 
00147 
00148     // URL utilities
00149     bool                ContainerIsIE (void);
00150     int                 ReverseFindOneOf (CString & str, CString & pattern);
00151     void                ResolveRelativePath (CString & urlname);
00152 
00153 
00154     // serialization utilities
00155     void                ReadFileFromArchive (CArchive & ar);
00156     void                WriteFileToArchive (CArchive & ar);
00157     void                LoadPendingFile (void);
00158 
00159 
00160     // clipboard and printing utilities
00161     void                DrawToMetafile (HWND hWnd, HDC hDC);
00162     void                PrintAsMetafile (CDC *pPrinterDC);
00163     void                PrintNormal (CDC * pPrinterDC);
00164 
00165 
00166 public: 
00167     // Constructor
00168     CHoopsControl();
00169 
00171     HCtrlView * GetHoopsView( void ) { return m_pHoopsView; }
00172 
00173     // URL parsing/loading methods
00174     bool                LoadFromUrl (CString const & urlname);
00175     bool                FullyQualifyUrl (CString & urlname);
00176  
00182     bool                m_bBlockStreamingUpdate;
00183 
00185     void                Copy (void);
00186 
00188     void                Print (CString csDocumentName);
00189         
00194     bool                GetFastPrint (void) {return m_bFastPrint;};
00195 
00197     void                SetFastPrint (bool fastprint) {m_bFastPrint = fastprint;};
00198 
00203     bool                GetMetaPrint (void) {return m_bMetaPrint;};
00204 
00206     void                SetMetaPrint (bool metaprint) {m_bMetaPrint = metaprint;};
00207 
00209     int                 GetMetafileType (void) { return m_MetafileType; };
00210 
00212     void                SetMetafileType (int emf_or_wmf) { m_MetafileType = emf_or_wmf; };
00213 
00215     bool                GetFirstUpdate(){return m_first_update;};
00216 
00218     void                SetFirstUpdate(bool firstupdate){m_first_update = firstupdate;};
00219 
00221     bool                GetClipboardTruecolor (void) { return m_bClipboardTruecolor; };
00222 
00224     void                SetClipboardTruecolor (bool truecolor) { m_bClipboardTruecolor = truecolor; };
00225 
00226 
00228     void                SetEmbedded (BOOL bVal);
00229 
00231     BOOL                IsEmbedded (void);
00232 
00233     // Overrides
00234     // ClassWizard generated virtual function overrides
00235     //{{AFX_VIRTUAL(CHoopsControl)
00236     public:
00237     virtual void OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid);
00238     virtual void OnHideToolBars();
00239     virtual void DoPropExchange(CPropExchange* pPX);
00240     virtual void OnResetState();
00241     virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
00242     virtual void Serialize(CArchive& ar);
00243     protected:
00244     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00245     virtual void OnDrawMetafile(CDC* pDC, const CRect& rcBounds);
00246     //}}AFX_VIRTUAL
00247 
00248 protected:
00249     // destructor
00250     ~CHoopsControl();
00251 
00253     HBaseModel *        m_pHoopsModel;  
00254     
00256     HCtrlView *         m_pHoopsView;       
00257     
00258 
00260     bool                m_bRequiresFitting;
00261 
00266     bool                m_bFastPrint;   
00267     
00272     bool                m_bMetaPrint;      
00273     
00275     bool                m_bClipboardTruecolor;
00276 
00278     int                 m_MetafileType;
00279     
00284     CHoopsDataLoader *  m_pDataLoader;
00285  
00286 
00287     DECLARE_OLECREATE_EX(CHoopsControl);        // Class factory and guid
00288     DECLARE_OLETYPELIB(CHoopsControl);      // GetTypeInfo
00289     DECLARE_PROPPAGEIDS(CHoopsControl);     // Property page IDs
00290     DECLARE_OLECTLTYPE(CHoopsControl);      // Type name and misc status
00291 
00292 // Message maps
00293     //{{AFX_MSG(CHoopsControl)
00294     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00295     afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
00296     afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
00297     afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
00298     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00299     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00300     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00301     afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
00302     afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00303     afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
00304     afx_msg void OnTimer(UINT nIDEvent);
00305     afx_msg LRESULT OnNewStreamFileBuffer(WPARAM wParam, LPARAM lParam);
00306 //  afx_msg void AboutBox();
00307     //}}AFX_MSG
00308     DECLARE_MESSAGE_MAP()
00309 
00310 // Dispatch maps
00311     //{{AFX_DISPATCH(CHoopsControl)
00312         // NOTE - ClassWizard will add and remove member functions here.
00313         //    DO NOT EDIT what you see in these blocks of generated code !
00314     //}}AFX_DISPATCH
00315     DECLARE_DISPATCH_MAP()
00316 
00317     afx_msg void AboutBox();
00318 
00319 // Event maps
00320     //{{AFX_EVENT(CHoopsControl)
00321         // NOTE - ClassWizard will add and remove member functions here.
00322         //    DO NOT EDIT what you see in these blocks of generated code !
00323     //}}AFX_EVENT
00324     DECLARE_EVENT_MAP()
00325 
00326 // Dispatch and event IDs
00327 public:
00328     enum {
00329     //{{AFX_DISP_ID(CHoopsControl)
00330         // NOTE: ClassWizard will add and remove enumeration elements here.
00331         //    DO NOT EDIT what you see in these blocks of generated code !
00332     //}}AFX_DISP_ID
00333     };
00334 };
00335 
00337 // CAboutHoopsControl dialog
00338 
00339 class CAboutHoopsControl : public CDialog
00340 {
00341 // Construction
00342 public:
00343     CAboutHoopsControl(CWnd* pParent = NULL);   // standard constructor
00344     void LoadUrl (CString & url);
00345 
00346 // Dialog Data
00347     //{{AFX_DATA(CAboutHoopsControl)
00348     enum { IDD = IDD_ABOUTBOX_HOOPS };
00349         // NOTE: the ClassWizard will add data members here
00350     //}}AFX_DATA
00351 
00352 
00353 // Overrides
00354     // ClassWizard generated virtual function overrides
00355     //{{AFX_VIRTUAL(CAboutHoopsControl)
00356     protected:
00357     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00358     //}}AFX_VIRTUAL
00359 
00360 // Implementation
00361 protected:
00362 
00363     // Generated message map functions
00364     //{{AFX_MSG(CAboutHoopsControl)
00365     afx_msg void OnVisitHoops3d();
00366     //}}AFX_MSG
00367     DECLARE_MESSAGE_MAP()
00368 };
00369 //{{AFX_INSERT_LOCATION}}
00370 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00371 
00372 #endif // !defined(AFX_CHOOPSCONTROL_H__E312B99F_42D6_11D3_8C8B_0080C7975371__INCLUDED)


Copyright © 2000 Tech Soft 3D