Alphabetical Class Index   File Members   Compound Members   File List  

CHoopsView Class Reference

The CHoopsView class provides a HOOPS-specific implementation of the CView object. More...

#include <CHoopsView.h>

List of all members.

Public Member Functions

HRESULT UpdateDI8State (unsigned long devIndex)
HRESULT InitDI8 (void)
CHoopsDocGetDocument ()
HBaseViewGetHoopsView (void)
CPalette * GetPalette ()
void InitializePalette ()
bool GetFastPrint (void)
void SetFastPrint (bool fastprint)
bool GetMetaPrint (void)
void SetMetaPrint (bool metaprint)
int GetMetafileType (void)
void SetMetafileType (int emf_or_wmf)
bool GetFirstUpdate ()
void SetFirstUpdate (bool firstupdate)
bool GetClipboardTruecolor (void)
void SetClipboardTruecolor (bool truecolor)
void SaveEMF (const char *filename, HOutputHandlerOptions *options=0)
 saves scene to enhanced metafile
HC_KEY GetViewKey ()
HC_KEY GetSceneKey ()
void AdjustAxisWindow ()
virtual void OnDraw (CDC *pDC)
 overridden but currently does nothing
virtual BOOL PreCreateWindow (CREATESTRUCT &cs)
virtual void OnInitialUpdate ()
virtual BOOL Create (LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID, CCreateContext *pContext=NULL)

Public Attributes

DIDevice * dev_handle
DIDeviceInfo * g_pDevice
int g_nDevices

Protected Member Functions

 DECLARE_DYNCREATE (CHoopsView)
 implements runtime object creation
unsigned long MapFlags (unsigned long state)
unsigned long MapKeyFlags (BYTE *virtual_key_state)
virtual BOOL OnPreparePrinting (CPrintInfo *pInfo)
 overloaded but currently does nothing
virtual void OnBeginPrinting (CDC *pDC, CPrintInfo *pInfo)
 overloaded but currently does nothing
virtual void OnEndPrinting (CDC *pDC, CPrintInfo *pInfo)
 overloaded but currently does nothing
virtual void OnPrint (CDC *pDC, CPrintInfo *pInfo)
virtual void OnDisplayChanged (int xres, int yres, int depth)
void GetIntRectangle (HIntRectangle *rectangle)
void EditCopy (GDIExportInformation *pInfo)
virtual afx_msg void OnPaint ()
virtual afx_msg void OnSize (UINT, int, int)
virtual afx_msg void OnEditCopy ()
virtual afx_msg void OnKeyDown (UINT nChar, UINT nRepCnt, UINT nFlags)
virtual afx_msg void OnKeyUp (UINT nChar, UINT nRepCnt, UINT nFlags)
virtual afx_msg void OnLButtonDblClk (UINT nFlags, CPoint point)
virtual afx_msg void OnLButtonDown (UINT nFlags, CPoint point)
virtual afx_msg void OnLButtonUp (UINT nFlags, CPoint point)
virtual afx_msg void OnMouseMove (UINT nFlags, CPoint point)
virtual afx_msg void OnRButtonDblClk (UINT nFlags, CPoint point)
virtual afx_msg void OnRButtonDown (UINT nFlags, CPoint point)
virtual afx_msg void OnMButtonUp (UINT nFlags, CPoint point)
virtual afx_msg void OnMButtonDown (UINT nFlags, CPoint point)
virtual afx_msg void OnRButtonUp (UINT nFlags, CPoint point)
virtual afx_msg BOOL OnSetCursor (CWnd *pWnd, UINT nHitTest, UINT message)
virtual afx_msg void OnTimer (UINT nIDEvent)
virtual afx_msg BOOL OnMouseWheel (UINT nFlags, short zDelta, CPoint pt)
virtual afx_msg LRESULT OnAFXDisplayChange (WPARAM wparam, LPARAM lparam)
virtual afx_msg BOOL OnWndMsg (UINT message, WPARAM wParam, LPARAM lParam, LRESULT *pResult)

Static Protected Member Functions

static bool GetKeyState (unsigned int key, int &flags)

Protected Attributes

CPalette * m_pViewPalette
bool m_bFastPrint
bool m_bUsingDI8Joystick
DIDeviceInfo * di8_data
bool m_bMetaPrint
bool m_bClipboardTruecolor
int m_MetafileType
HBaseViewm_pHView
HC_KEY m_ViewKey
HC_KEY m_SceneKey


Detailed Description

The CHoopsView class provides a HOOPS-specific implementation of the CView object.

CHoopsView creates and manages the connection of a HOOPS/3dGS driver instance to a CView object, which includes properly updating the window during exposes/resizes. It contains a pointer to a corresponding HOOPS/MVO HBaseView object.

It includes built-in support for printing, print preview, and copying to cliboard of the HOOPS/3dGS scene, and encapsulates palette management if HOOPS/3dGS is being used on 8-bit system with the MSW Driver.

This is the base class from which all custom HOOPS-based MFC/MDI CView objects should be derived.


Member Function Documentation

unsigned long CHoopsView::MapFlags ( unsigned long  state  )  [protected]

Maps the MFC button and Shift/Control state to abstracted HOOPS/MVO values

unsigned long CHoopsView::MapKeyFlags ( BYTE *  virtual_key_state  )  [protected]

Maps the MFC key state to abstracted HOOPS/MVO values

CHoopsDoc * CHoopsView::GetDocument (  )  [inline]

Returns:
A Pointer to the CHoopsDoc object that being viewed by this CHoopsView object

HBaseView* CHoopsView::GetHoopsView ( void   )  [inline]

Returns:
The pointer to the HBaseView object associated with this CView object.

CPalette* CHoopsView::GetPalette (  ) 

Returns:
The palette used for this view. This will be null if we are in 24-bit mode. If the palette is being shared among all views, this will return the shared palette, otherwise it will return this view's unique palette

void CHoopsView::InitializePalette (  ) 

Initialize this view's unique palette (meaning that we aren't sharing a palette among all views, which should be quite rare)

bool CHoopsView::GetFastPrint ( void   )  [inline]

Returns:
A Boolean indicating whether native GDI printing or a fast bitmap blit will be used for printing. The default is true.

void CHoopsView::SetFastPrint ( bool  fastprint  )  [inline]

Sets whether native GDI printing or a fast bitmap blit will be used for printing. The default is true.

bool CHoopsView::GetMetaPrint ( void   )  [inline]

Returns:
A Boolean indicating whether a Windows Enhanced Metafile will first be created and then played to the printer when CHoopsView::OnPrint() is called. The default is false.

void CHoopsView::SetMetaPrint ( bool  metaprint  )  [inline]

Sets whether a Windows Enhanced Metafile containing the scene will first be created and then played to the printer when CHoopsView::OnPrint() is called (rather than the scene going straight to the printer). The default is false.

int CHoopsView::GetMetafileType ( void   )  [inline]

Returns:
An integer indicating whether an emf or wmf will be for clipboard rendering. The default is EMF.

void CHoopsView::SetMetafileType ( int  emf_or_wmf  )  [inline]

Sets whether an emf or wmf will be used for clipboard rendering. The default is EMF.

bool CHoopsView::GetFirstUpdate (  )  [inline]

Returns:
A Boolean indicating whether the first update has occurred.

void CHoopsView::SetFirstUpdate ( bool  firstupdate  )  [inline]

Sets whether the first view update has occurred.

bool CHoopsView::GetClipboardTruecolor ( void   )  [inline]

Returns:
A Boolean indicating whether copying to clipboard uses mapped or true color. The default is true.

void CHoopsView::SetClipboardTruecolor ( bool  truecolor  )  [inline]

Sets whether copying to clipboard uses mapped or true color. The default is true.

HC_KEY CHoopsView::GetViewKey (  ) 

Returns:
The key of the HOOPS segment denoting the top of the view hierarchy; usually the driver instance segment

HC_KEY CHoopsView::GetSceneKey (  ) 

Returns:
The key of the HOOPS segment denoting the top of the scene hierarchy, usually a subsegment of the view segment key, and the location where the camera is set

void CHoopsView::AdjustAxisWindow (  ) 

Adjusts the relative size of the Axis window so that it always has the same size if the outer window is resized

virtual BOOL CHoopsView::PreCreateWindow ( CREATESTRUCT &  cs  )  [virtual]

We overload the PreCreateWindow method to modify the CWnd window class; necessary for OpenGL support

virtual void CHoopsView::OnInitialUpdate (  )  [virtual]

Performs some HOOPS/MFC specific initialization: if HOOPS/MFC is being used in palette mode and each view has a unique palette, the palette is initialized.

virtual BOOL CHoopsView::Create ( LPCTSTR  lpszClassName,
LPCTSTR  lpszWindowName,
DWORD  dwStyle,
const RECT &  rect,
CWnd *  pParentWnd,
UINT  nID,
CCreateContext *  pContext = NULL 
) [virtual]

We overload the Create method to modify the CWnd window style; necessary for OpenGL support

virtual void CHoopsView::OnPrint ( CDC *  pDC,
CPrintInfo *  pInfo 
) [protected, virtual]

Prints the scene, or performs a print preview, according to the tye of Windows DC. If m_bFastPrint is true, the scene will be rendered to an offscreen bitmap and stretch-blitted to the printer. If false, the scene will be decomposed into native GDI information (2D vector and/or raster data).

If m_bFastPrint is true, it might be desirable to set m_bMetaPrint to true as well. In some cases, text and other objects may not print correctly without turning on both of these switches. See the section on GDI Driver Printing in the HOOPS/3dGS Platform and Device Guide for more details.

virtual void CHoopsView::OnDisplayChanged ( int  xres,
int  yres,
int  depth 
) [protected, virtual]

Called when display change happens. This can be used to adjust when screen orientation changes or resolution changes.

void CHoopsView::GetIntRectangle ( HIntRectangle rectangle  )  [protected]

helper to get the current ClientRect into a platform-independent structure

void CHoopsView::EditCopy ( GDIExportInformation pInfo  )  [protected]

does the actual work for copy to clipboard.

virtual afx_msg void CHoopsView::OnPaint (  )  [protected, virtual]

Overloaded CView method. Instructs HOOPS to traverse the scene-graph and update the display

virtual afx_msg void CHoopsView::OnEditCopy (  )  [protected, virtual]

Renders the scene to a Windows Metafile (emf or wmf) and places it on the clipboard. The type of metafile generated is accessed through GetMetafileType and SetMetafileType.

virtual afx_msg void CHoopsView::OnKeyDown ( UINT  nChar,
UINT  nRepCnt,
UINT  nFlags 
) [protected, virtual]

Calls the OnKeyDown method of the view's current HOOPS/MVO HBaseOperator object. The GUI specific flags are mapped to HOOPS/MVO abstracted flags use the CHoopsView::MapFlags method

virtual afx_msg void CHoopsView::OnKeyUp ( UINT  nChar,
UINT  nRepCnt,
UINT  nFlags 
) [protected, virtual]

Calls the OnKeyUp method of the view's current HOOPS/MVO HBaseOperator object. The GUI specific flags are mapped to HOOPS/MVO abstracted flags use the CHoopsView::MapFlags method

virtual afx_msg void CHoopsView::OnLButtonDblClk ( UINT  nFlags,
CPoint  point 
) [protected, virtual]

Dispatches the OnLButtonDblClk event to all event listeners that are registered for the OnLButtonDblClk event type. The GUI specific flags are mapped to HOOPS/MVO abstracted flags use the CHoopsView::MapFlags method

virtual afx_msg void CHoopsView::OnLButtonDown ( UINT  nFlags,
CPoint  point 
) [protected, virtual]

Dispatches the OnLButtonDown event to all event listeners that are registered for the OnLButtonDown event type. The GUI specific flags are mapped to HOOPS/MVO abstracted flags use the CHoopsView::MapFlags method

virtual afx_msg void CHoopsView::OnLButtonUp ( UINT  nFlags,
CPoint  point 
) [protected, virtual]

Dispatches the OnLButtonUp event to all event listeners that are registered for the OnLButtonUp event type. The GUI specific flags are mapped to HOOPS/MVO abstracted flags use the CHoopsView::MapFlags method

virtual afx_msg void CHoopsView::OnMouseMove ( UINT  nFlags,
CPoint  point 
) [protected, virtual]

Dispatches the OnMouseMove event to all event listeners that are registered for the OnMouseMove event type. The GUI specific flags are mapped to HOOPS/MVO abstracted flags use the CHoopsView::MapFlags method

virtual afx_msg void CHoopsView::OnRButtonDblClk ( UINT  nFlags,
CPoint  point 
) [protected, virtual]

Dispatches the OnRButtonDblClk event to all event listeners that are registered for the OnRButtonDblClk event type. The GUI specific flags are mapped to HOOPS/MVO abstracted flags use the CHoopsView::MapFlags method

virtual afx_msg void CHoopsView::OnRButtonDown ( UINT  nFlags,
CPoint  point 
) [protected, virtual]

Dispatches the OnRButtonDown event to all event listeners that are registered for the OnRButtonDown event type. The GUI specific flags are mapped to HOOPS/MVO abstracted flags use the CHoopsView::MapFlags method

virtual afx_msg void CHoopsView::OnMButtonUp ( UINT  nFlags,
CPoint  point 
) [protected, virtual]

Dispatches the OnMButtonUp event to all event listeners that are registered for the OnMButtonUp event type. The GUI specific flags are mapped to HOOPS/MVO abstracted flags use the CHoopsView::MapFlags method

virtual afx_msg void CHoopsView::OnMButtonDown ( UINT  nFlags,
CPoint  point 
) [protected, virtual]

Dispatches the OnMButtonDown event to all event listeners that are registered for the OnMButtonDown event type. The GUI specific flags are mapped to HOOPS/MVO abstracted flags use the CHoopsView::MapFlags method

virtual afx_msg void CHoopsView::OnRButtonUp ( UINT  nFlags,
CPoint  point 
) [protected, virtual]

Dispatches the OnRButtonUp event to all event listeners that are registered for the OnRButtonUp event type. The GUI specific flags are mapped to HOOPS/MVO abstracted flags use the CHoopsView::MapFlags method

virtual afx_msg BOOL CHoopsView::OnSetCursor ( CWnd *  pWnd,
UINT  nHitTest,
UINT  message 
) [protected, virtual]

Returns:
Nonzero to halt further processing, or 0 to continue The default implementation sets the cursor to the standard cursor (IDC_ARROW) If you want your own cursor, override the function and do not call the base class.

virtual afx_msg void CHoopsView::OnTimer ( UINT  nIDEvent  )  [protected, virtual]

Calls the OnTimer method of the view's current HOOPS/MVO HBaseOperator object. The GUI specific flags are mapped to HOOPS/MVO abstracted flags use the CHoopsView::MapFlags method

static bool CHoopsView::GetKeyState ( unsigned int  key,
int &  flags 
) [static, protected]

Callback for retrieving low-level key-presses

Parameters:
key ASCII Value of key to query state for
flags Status of Modifier keys (MVO_LEFT_SHIFT, MVO_RIGHT_SHIFT, MVO_SHIFT, MVO_CONTROL)
Returns:
True if specified key is pressed

virtual afx_msg BOOL CHoopsView::OnMouseWheel ( UINT  nFlags,
short  zDelta,
CPoint  pt 
) [protected, virtual]

Dispatches the OnMouseWheel event to all event listeners that are registered for the OnMouseWheel event type. The GUI specific flags are mapped to HOOPS/MVO abstracted flags use the CHoopsView::MapFlags method

virtual afx_msg LRESULT CHoopsView::OnAFXDisplayChange ( WPARAM  wparam,
LPARAM  lparam 
) [protected, virtual]

Called when WM_DISPLAYCHANGE happens. Calls OnDisplayChange();

virtual afx_msg BOOL CHoopsView::OnWndMsg ( UINT  message,
WPARAM  wParam,
LPARAM  lParam,
LRESULT *  pResult 
) [protected, virtual]

Called when WM_POWERBROADCAST is sent by CHoopsFrame, from a "resume suspend". Calls HC_Control_Update to "reset device".


Member Data Documentation

CPalette* CHoopsView::m_pViewPalette [protected]

Pointer to this view's unique palette. This will be null if we're in 24-bit mode, or if palettes are shared among all views.

bool CHoopsView::m_bFastPrint [protected]

If true, the scene is rendered to an offscreen bitmap and stretch-blitted to the printer or Windows metafile during printing or copy to clipboard. The default is true.

If true, we have initialized and are using a 3DMouse or Joystick using DirectInput

bool CHoopsView::m_bMetaPrint [protected]

If true, the scene is rendered to a windows metafile and then played to the printer. The default is false.

If true, the scene will render to the clipboard in truecolor mode. The default is true.

int CHoopsView::m_MetafileType [protected]

Type of metafile generated when m_bMetaPrint==true, 0=WMF amd 1=EMF.

Pointer to HBaseView MVO object associated with this CView object.

HC_KEY CHoopsView::m_ViewKey [protected]

The key of the HOOPS driver instance segment associated with this view Intended to be used as an ALTERNATIVE to MVO (and the HBaseView object referenced by m_pHView)

HC_KEY CHoopsView::m_SceneKey [protected]

The key of the HOOPS segment representing the top of the scene hierarchy, typically a subsegment of the driver instance segment (m_ViewKey) Intended to be used in conjuction with m_view_key as an ALTERNATIVE to MVO (and the HBaseView object referenced by m_pHView)


The documentation for this class was generated from the following file: