Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members

ZoomView.h

00001 // uizoom.h : header file
00002 //      Implements Zooming functions in a CScrollView window
00003 //
00004 // Written by Brad Pirtle, CS:72450,1156, Internet:pirtle@qlogic.com
00005 // Copyright 1994, QuickLogic Corp., all rights reserved.
00006 // Version 1.0
00007 #ifndef ZOOMVIEW_H
00008 #define ZOOMVIEW_H
00009 
00010 /////////////////////////////////////////////////////////////////////////////
00011 // CZoomView view
00012 class CZoomView : public CScrollView
00013 {
00014     DECLARE_DYNCREATE(CZoomView)
00015 protected:
00016     CZoomView();        // protected constructor used by dynamic creation
00017 
00018     // Operations
00019 public:
00020     // Overridden CScrollView member functions
00021     void SetZoomSizes(SIZE sizeTotal,
00022                       const SIZE& sizePage = sizeDefault,
00023                       const SIZE& sizeLine = sizeDefault);
00024     void CenterOnLogicalPoint(CPoint ptCenter);
00025     CPoint GetLogicalCenterPoint(void);
00026 
00027     // Zooming functions
00028     typedef enum {MODE_ZOOMOFF, MODE_ZOOMIN, MODE_ZOOMOUT} ZoomMode_;
00029     void      SetZoomMode(ZoomMode_ zoomMode);
00030     ZoomMode_ GetZoomMode() {return m_zoomMode;};
00031     int       DoZoomIn    (CRect &rect);
00032     int       DoZoomIn    (CPoint *point = NULL, double delta = 1.25);
00033     int       DoZoomOut   (CPoint *point = NULL, double delta = 1.25);
00034     int       DoZoomFull  ();
00035     // bdelmee code change
00036     double    GetZoomRatio() const { return m_zoomScale; }
00037     void      SetZoomRatio( double r ) { m_zoomScale = r; }
00038 
00039     // Override this to get notified of zoom scale change
00040     virtual void NotifyZoom(void) {};
00041 
00042     // Zooming utility functions
00043     void    ViewDPtoLP (LPPOINT lpPoints, int nCount = 1);
00044     void    ViewLPtoDP (LPPOINT lpPoints, int nCount = 1);
00045     void    ClientToDevice(CPoint &point);
00046     void    NormalizeRect(CRect &rect);
00047     void    DrawBox(CDC &dc, CRect &rect, bool xor = true);
00048     void    DrawLine(CDC &dc, const int &x1, const int &y1,
00049                      const int &x2, const int &y2, bool xor = true);
00050 
00051     // Implementation
00052 protected:
00053     virtual ~CZoomView();
00054 #ifdef _DEBUG
00055     virtual void AssertValid() const;
00056 #endif //_DEBUG
00057     virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL);
00058     virtual void OnDraw(CDC* pDC) { };
00059 private:
00060     // Internally called functions
00061     void        PersistRatio(const CSize &orig, CSize &dest, CPoint &remainder);
00062     void        CalcBars(void);
00063 
00064     // Private member variables
00065     ZoomMode_ m_zoomMode;
00066     bool      m_bCaptured;
00067     CRect     m_ptDragRect;
00068     CSize     m_origTotalDev;           // Original total size in device units
00069     CSize     m_origPageDev;            // Original per page scroll size in device units
00070     CSize     m_origLineDev;            // Original per line scroll size in device units
00071     double    m_zoomScale;
00072     HCURSOR   m_hZoomCursor;
00073 
00074 public:
00075     // Generated message map functions
00076     //{{AFX_MSG(CZoomView)
00077     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00078     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00079     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00080     afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00081     afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
00082     //}}AFX_MSG
00083 
00084     DECLARE_MESSAGE_MAP()
00085 };
00086 
00087 /////////////////////////////////////////////////////////////////////////////
00088 #endif

Generated on Sun Jun 6 13:42:22 2004 for paintlib by doxygen 1.3.2