home *** CD-ROM | disk | FTP | other *** search
- /////////////////////////////////////////////////////////////////////////////
- //
- // CSurView.h : Interface of the CSurroundView class
- //
- /////////////////////////////////////////////////////////////////////////////
- //
- // (C) Copyright Black Diamond Consulting, Inc 1996. All rights reserved.
- //
- // You have a royalty-free right to use, modify, reproduce and
- // distribute the Sample Files (and/or any modified version) in
- // any way you find useful, provided that you agree that Black
- // Diamond Consulting has no warranty obligations or liability
- // for any Sample Application Files which are modified.
- //
- // Revision History:
- //
- /////////////////////////////////////////////////////////////////////////////
-
- #define __CSURVIEW_H__
-
- #include "Surround.h"
- #include "dib.h"
-
- class CSurroundView : public CView
- {
-
- private: // Data members
- HPALETTE m_hPalette; // palette handle for the view
- HBITMAP m_hOffscreenBitmap; // bitmap for the current SV
- void* m_pOffscreenBits; // bits for the current SV
- CPoint m_anchorPoint; // Anchor point
- UINT m_cursorID;
-
- struct
- {
- BITMAPINFOHEADER header;
- RGBQUAD colors[256];
- } m_offscreenInfo; // bitmap for the view
-
- struct
- {
- short version;
- short numberOfEntries;
- PALETTEENTRY entries[256];
- } m_logicalPalette; // Palette entries
-
- protected: // Data members
- ISurroundView* m_pSV; // the surround view pointer
- SPHERE_RECT m_viewExtents; // view extents
- SPHERE_POINT m_location; // Displayed image coordinates
- CSize m_size; // Size of current view
- UINT m_zoomInKey; // Key used for zooming in
- UINT m_zoomOutKey; // Key used for zooming out
- float m_fZoom; // Percentage of zoom
-
- public: // Accessors
- ISurroundView* GetView() { return m_pSV; }
- BOOL IsViewPresent() { return m_pSV != NULL; }
- LONG ViewWidth() { return m_size.cx; }
- LONG ViewHeight() { return m_size.cy; }
-
- protected:
- CSurroundView();
- DECLARE_DYNAMIC( CSurroundView )
- void Reset();
- virtual ISurround* GetISurround() = 0; // Pure virtual function
- void UpdateOffscreenBitmap();
- BOOL UpdateSurroundView();
- HPALETTE CreateIdentityPalette( int nColors );
- void ScrollImage( CPoint &anchorPoint, BOOL bLeftButton = TRUE );
- void SetZoomKeys( int zoomInKey, int zoomOutKey );
- HGLOBAL GetImage( LPSPHERE_POINT pLocation, LPSIZE pSize );
- BOOL PutImage( PDIB pDib, LPSPHERE_POINT pLocation, LPSIZE pSize );
- BOOL CopyImage( LPSPHERE_POINT pLocation, LPSIZE pSize );
-
- HRESULT SphereToView( LPSPHERE_POINT pLocation, LPPOINT pPoint );
- HRESULT SphereToView( LPSPHERE_POINT pLocation, LPSIZE pSize, LPRECT pRect );
- HRESULT ViewToSphere( LPPOINT pPoint, LPSPHERE_POINT pLocation );
- HRESULT ViewToSphere( LPRECT pRect, LPSPHERE_POINT pLocation, LPSIZE pSize );
-
- //{{AFX_MSG(CSurroundView)
- afx_msg BOOL OnEraseBkgnd( CDC* pDC );
- afx_msg void OnSize( UINT nType, int cx, int cy );
- afx_msg BOOL OnSetCursor( CWnd* pWnd, UINT nHitTest, UINT message );
- afx_msg void OnLButtonDown( UINT nFlags, CPoint point );
- afx_msg void OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags );
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
-
- public:
- virtual ~CSurroundView();
- void GetMaxViewSize( SIZE *pSize );
-
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CSurroundView)
- public:
- virtual void OnDraw( CDC* pDC ); // overridden to draw this view
- virtual void OnInitialUpdate();
- protected:
- //}}AFX_VIRTUAL
- };
-
-
- /////////////////////////////////////////////////////////////////////////////
-