// RasterProcSink.cpp : implementation file // #include "stdafx.h" #include "leadRaster.h" #include "RasterProcSink.h" #include "MainFrm.h" #include "DemoView.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern CDemoApp theApp; ///////////////////////////////////////////////////////////////////////////// // CRasterProcSink IMPLEMENT_DYNCREATE(CRasterProcSink, CCmdTarget) CRasterProcSink::CRasterProcSink() { EnableAutomation(); } CRasterProcSink::~CRasterProcSink() { } void CRasterProcSink::OnFinalRelease() { // When the last reference for an automation object is released // OnFinalRelease is called. The base class will automatically // deletes the object. Add additional cleanup required for your // object before calling the base class. CCmdTarget::OnFinalRelease(); } BEGIN_MESSAGE_MAP(CRasterProcSink, CCmdTarget) //{{AFX_MSG_MAP(CRasterProcSink) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_MSG_MAP END_MESSAGE_MAP() BEGIN_DISPATCH_MAP(CRasterProcSink, CCmdTarget) //{{AFX_DISPATCH_MAP(CRasterProcSink) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_DISPATCH_MAP DISP_FUNCTION_ID(CRasterProcSink,"OnSliceBitmap",8,OnSliceBitmap,VT_EMPTY,VTS_I4 VTS_I4 VTS_I4 VTS_I4 VTS_I4 VTS_I4) END_DISPATCH_MAP() // Note: we add support for IID_IRasterProcSink to support typesafe binding // from VBA. This IID must match the GUID that is attached to the // dispinterface in the .ODL file. // {FCEC20F1-6B67-4CFC-A652-C2ABCCFC8A8C} static const IID IID_IRasterProcSink = { 0xfcec20f1, 0x6b67, 0x4cfc, { 0xa6, 0x52, 0xc2, 0xab, 0xcc, 0xfc, 0x8a, 0x8c } }; BEGIN_INTERFACE_MAP(CRasterProcSink, CCmdTarget) INTERFACE_PART(CRasterProcSink, DIID__LEADRasterProcessEvents, Dispatch) END_INTERFACE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRasterProcSink message handlers void CRasterProcSink::OnSliceBitmap(long Bitmap, long lLeft, long lTop, long lWidth, long lHeight, long lAngle) { CMainFrame* pFrame = (CMainFrame*)AfxGetApp()->GetMainWnd(); CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame(); CDemoView *pView = (CDemoView *) pChild->GetActiveView(); if(!pView->m_RasterView.GetRaster().GetHasRgn()) { pView->m_RasterView.GetRaster().SetRgnRect((float)lLeft, (float)lTop, (float)lWidth, (float)lHeight, L_RGN_SET); } else { pView->m_RasterView.GetRaster().SetRgnRect((float)lLeft, (float)lTop, (float)lWidth, (float)lHeight, L_RGN_XOR); } }