home *** CD-ROM | disk | FTP | other *** search
- // vfDaoView.cpp : implementation of the CVfDaoView class
- //
-
- #include "stdafx.h"
- #include "vfDao.h"
-
- #include "vfDaoDoc.h"
- #include "vfDaoView.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CVfDaoView
-
- IMPLEMENT_DYNCREATE(CVfDaoView, CView)
-
- BEGIN_MESSAGE_MAP(CVfDaoView, CView)
- //{{AFX_MSG_MAP(CVfDaoView)
- ON_WM_CREATE()
- ON_WM_SIZE()
- ON_WM_SETFOCUS()
- ON_WM_ERASEBKGND()
- //}}AFX_MSG_MAP
- // Standard printing commands
- ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
- ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
- ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CVfDaoView construction/destruction
-
- CVfDaoView::CVfDaoView()
- {
- }
-
- CVfDaoView::~CVfDaoView()
- {
- }
-
- BOOL CVfDaoView::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- return CView::PreCreateWindow(cs);
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CVfDaoView drawing
-
- void CVfDaoView::OnDraw(CDC* pDC)
- {
- CVfDaoDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
-
- // TODO: add draw code for native data here
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CVfDaoView diagnostics
-
- #ifdef _DEBUG
- void CVfDaoView::AssertValid() const
- {
- CView::AssertValid();
- }
-
- void CVfDaoView::Dump(CDumpContext& dc) const
- {
- CView::Dump(dc);
- }
-
- CVfDaoDoc* CVfDaoView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CVfDaoDoc)));
- return (CVfDaoDoc*)m_pDocument;
- }
- #endif //_DEBUG
-
- /////////////////////////////////////////////////////////////////////////////
- // CVfDaoView message handlers
-
- int CVfDaoView::OnCreate(LPCREATESTRUCT lpCreateStruct)
- {
- int rc;
- CRect rect(10, 10, 200, 200);
-
- if (CView::OnCreate(lpCreateStruct) == -1)
- return -1;
-
- rc = m_vfMovie.Create("VForm", rect, this, 100);
- if(!rc)
- {
- AfxMessageBox("Could not create Movie VForm");
- return -1;
- }
-
- m_vfMovie.PrintStyle(VFPRINT_ALL);
- return 0;
- }
-
- void CVfDaoView::OnSize(UINT nType, int cx, int cy)
- {
- CView::OnSize(nType, cx, cy);
- m_vfMovie.ResizeToParent();
- }
-
- void CVfDaoView::OnSetFocus(CWnd* pOldWnd)
- {
- // CView::OnSetFocus(pOldWnd);
- m_vfMovie.SetFocus();
- }
-
- BOOL CVfDaoView::OnEraseBkgnd(CDC* pDC)
- {
- /* --- Only use this if using Snap Resizing ----
- CRect rect;
- CBrush backBrush(GetSysColor(COLOR_3DFACE));
- CBrush* pOldBrush = pDC->SelectObject(&backBrush);
-
- pDC->GetClipBox(&rect); // Erase the area needed
- pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATCOPY);
- pDC->SelectObject(pOldBrush);
- ----- */
- return TRUE;
- }
-
- void CVfDaoView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
- {
- m_vfMovie.DoPrint(pDC, pInfo);
- // CView::OnPrint(pDC, pInfo);
- }
-
- void CVfDaoView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
- {
- // Set the page info again, since the user may have changed the printer since
- // we set it up in OnPreparePrinting
- m_vfMovie.CalcPageInfo(pDC, pInfo);
- }
-
- BOOL CVfDaoView::OnPreparePrinting(CPrintInfo* pInfo)
- {
- return m_vfMovie.DoPreparePrinting(this, pInfo);
- // return DoPreparePrinting(pInfo);
- }
-
- void CVfDaoView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo)
- {
- CView::OnPrepareDC(pDC, pInfo);
- m_vfMovie.DoPrepareDC(pDC, pInfo);
- }
-
-