home *** CD-ROM | disk | FTP | other *** search
- // ScrView.cpp : implementation of the CScrView class
- //
-
- #include "stdafx.h"
- #include "ScrDemo.h"
- #include "ScrDoc.h"
- #include "ScrView.h"
-
- #include "..\\..\\..\\..\\include\\ltdlgocx.h"
- #include "leaddlg.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- extern CScrDemo theApp;
-
- /////////////////////////////////////////////////////////////////////////////
- // CScrView
-
- IMPLEMENT_DYNCREATE(CScrView, CView)
-
- BEGIN_MESSAGE_MAP(CScrView, CView)
- //{{AFX_MSG_MAP(CScrView)
- // ON_COMMAND(IDM_CAPTURE_FROMEXEDLGTABBEDVIEW, OnCaptureFromexedlgtabbedview)
- // ON_COMMAND(IDM_CAPTURE_FULLSCREEN, OnCaptureFullscreen)
- // ON_COMMAND(IDM_CAPTURE_MOUSECURSOR, OnCaptureMousecursor)
- // ON_COMMAND(IDM_CAPTURE_SELECTEDOBJECT, OnCaptureSelectedobject)
- // ON_COMMAND(IDM_CAPTURE_WINDOWUNDERCURSOR, OnCaptureWindowundercursor)
- // ON_COMMAND(IDM_OPTIONS_OBJECT, OnOptionsObject)
- ON_COMMAND(ID_FILE_SAVE_AS, OnFileSaveAs)
- ON_WM_SIZE()
- ON_WM_CREATE()
- //}}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()
-
- /////////////////////////////////////////////////////////////////////////////
- // CScrView construction/destruction
-
- CScrView::CScrView()
- {
- // TODO: add construction code here
-
- }
-
- CScrView::~CScrView()
- {
- }
-
- BOOL CScrView::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
-
- return CView::PreCreateWindow(cs);
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CScrView drawing
-
- void CScrView::OnDraw(CDC* pDC)
- {
- CScrDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
-
- // TODO: add draw code for native data here
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CScrView printing
-
- BOOL CScrView::OnPreparePrinting(CPrintInfo* pInfo)
- {
- // default preparation
- return DoPreparePrinting(pInfo);
- }
-
- void CScrView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add extra initialization before printing
- }
-
- void CScrView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add cleanup after printing
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CScrView diagnostics
-
- #ifdef _DEBUG
- void CScrView::AssertValid() const
- {
- CView::AssertValid();
- }
-
- void CScrView::Dump(CDumpContext& dc) const
- {
- CView::Dump(dc);
- }
-
- CScrDoc* CScrView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CScrDoc)));
- return (CScrDoc*)m_pDocument;
- }
- #endif //_DEBUG
-
- /////////////////////////////////////////////////////////////////////////////
- // CScrView message handlers
-
- void CScrView::OnFileSaveAs()
- {
- // TODO: Add your command handler code here
- CLeadDlg m_LEADDlg1;
- char szDir[300];
-
-
- GetCurrentDirectory(sizeof(szDir),szDir);
- if(m_LEADDlg1.Create(NULL,0,CRect(0,0,0,0),this,0))
- {
- m_LEADDlg1.SetEnableMethodErrors(FALSE);
- m_LEADDlg1.SetBitmap(m_LeadBitmap.GetBitmap()); //assign the bitmap for processing
- m_LEADDlg1.SetDialogTitle("Save A File");
- m_LEADDlg1.SetFileDlgFlags(OFN_CREATEPROMPT);
- m_LEADDlg1.SetInitialDir(szDir);
- m_LEADDlg1.SetUIFlags( DLG_FS_AUTOPROCESS |
- DLG_FS_95STYLE |
- DLG_FS_PROGRESSIVE |
- DLG_FS_MULTIPAGE |
- DLG_FS_STAMP |
- DLG_FS_QFACTOR );
- m_LEADDlg1.SetSaveFormatFlags(DLG_FS_ALL);
- m_LEADDlg1.FileSave((long)m_hWnd);
- GetDocument()->SetModifiedFlag (FALSE);
- }
-
- }
-
- void CScrView::OnSize(UINT nType, int cx, int cy)
- {
- CView::OnSize(nType, cx, cy);
- // TODO: Add your message handler code here
- if (m_LeadBitmap.GetBitmap())
- m_LeadBitmap.MoveWindow(0,0,cx,cy);
-
- }
-
- int CScrView::OnCreate(LPCREATESTRUCT lpCreateStruct)
- {
- if (CView::OnCreate(lpCreateStruct) == -1)
- return -1;
-
- // TODO: Add your specialized creation code here
-
- if (theApp.m_LeadBitmap)
- {
- m_LeadBitmap.Create(NULL,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,0x100);
- m_LeadBitmap.SetBitmap((long)theApp.m_LeadBitmap);
- // UNLOCKSUPPORT(m_LeadBitmap);
- if (m_LeadBitmap.GetBitmap())
- if (m_LeadBitmap.GetHasRgn())
- {
- m_LeadBitmap.SetRgnFrameType(2/*CLead::RGNFRAME_ANIMATED*/);
- }
-
- }
-
- return 0;
- }
-