|
|
#include "stdafx.h"
|
|
|
#include "SigmaView.h"
|
|
|
#include "PrintTool.h"
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
int PreviewPrint_Start(CSigmaView * pView)
|
|
|
{
|
|
|
if (pView == 0)
|
|
|
return -1;
|
|
|
|
|
|
if (pView->m_pDoc == 0)
|
|
|
return -1;
|
|
|
|
|
|
pView->m_pDoc->EnablePreview(true);
|
|
|
pView->m_pDoc->PushDC();
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
int PreviewPrint_End(CSigmaView * pView)
|
|
|
{
|
|
|
if (pView == 0)
|
|
|
return -1;
|
|
|
|
|
|
if (pView->m_pDoc == 0)
|
|
|
return -1;
|
|
|
|
|
|
pView->m_pDoc->PopDC();
|
|
|
pView->m_pDoc->EnablePreview(false);
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
int GeoSigma_Print(CSigmaView * pView, HDC hdc, int left, int top, int right, int bottom)
|
|
|
{
|
|
|
//CDC *pDC = CDC::FromHandle(hdc);
|
|
|
//pView->SetDc(pDC);
|
|
|
//pView->SetClient(left, top, right, bottom);
|
|
|
//pView->InitialView();
|
|
|
pView->DrawForPrint();
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void GeoSigma_GetPageMargins(CSigmaView * pView, int * top, int * bottom, int * left, int * right)
|
|
|
{
|
|
|
pView->GetPageMargin(top, bottom, left, right);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void GeoSigma_SetPageMargins(CSigmaView * pView, int topPageMargin, int bottomPageMargin, int leftPageMargin, int rightPageMargin)
|
|
|
{
|
|
|
pView->SetPageMargin(topPageMargin, bottomPageMargin, leftPageMargin, rightPageMargin);
|
|
|
}
|
|
|
|
|
|
static CItemView * GetItemView(CSigmaView * pView)
|
|
|
{
|
|
|
if (pView == 0)
|
|
|
return 0;
|
|
|
|
|
|
if (pView->m_pDoc == 0)
|
|
|
return 0;
|
|
|
|
|
|
return pView->m_pDoc->GetItemView();
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
int Print_ViewMouseDown(CSigmaView * pView, int mouseX, int mouseY)
|
|
|
{
|
|
|
CItemView* item = GetItemView(pView);
|
|
|
if (item == 0)
|
|
|
return -1;
|
|
|
|
|
|
CPoint pt(mouseX, mouseY);
|
|
|
item->OnLButtonDownForPreviewPrint(0, pt);
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
int Print_ViewMouseMove(CSigmaView* pView, int mouseX, int mouseY)
|
|
|
{
|
|
|
CItemView* item = GetItemView(pView);
|
|
|
if (item == 0)
|
|
|
return -1;
|
|
|
|
|
|
CPoint pt(mouseX, mouseY);
|
|
|
item->OnMouseMoveForPreviewPrint(0, pt);
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
int Print_ViewMouseUp(CSigmaView* pView, int mouseX, int mouseY)
|
|
|
{
|
|
|
CItemView* item = GetItemView(pView);
|
|
|
if (item == 0)
|
|
|
return -1;
|
|
|
|
|
|
CPoint pt(mouseX, mouseY);
|
|
|
item->OnLButtonUpForPreviewPrint(0, pt);
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
int Print_ViewAll(CSigmaView* pView)
|
|
|
{
|
|
|
if (pView == 0)
|
|
|
return -1;
|
|
|
|
|
|
if (pView->m_pDoc == 0)
|
|
|
return -1;
|
|
|
|
|
|
CPrintTool tool(pView->m_pDoc);
|
|
|
tool.ViewAll(pView->GetDc());
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
int Print_SetScreenRect(CSigmaView* pView, int width, int height)
|
|
|
{
|
|
|
CItemView* item = GetItemView(pView);
|
|
|
if (item == 0)
|
|
|
return -1;
|
|
|
|
|
|
CRect rect;
|
|
|
rect.top = rect.left = 0;
|
|
|
rect.right = width;
|
|
|
rect.bottom = height;
|
|
|
|
|
|
item->SetScreenRect(rect);
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
//overlapWidth Ϊ<>ص<EFBFBD><D8B5><EFBFBD><EFBFBD>ȵ<EFBFBD><C8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
extern "C" __declspec(dllexport)
|
|
|
int Print_GetNumberOfPartition(CSigmaView * pView, int * rowOut, int * colOut, int overlapWidth)
|
|
|
{
|
|
|
if (pView == 0)
|
|
|
return -1;
|
|
|
|
|
|
CPrintTool tool(pView->m_pDoc);
|
|
|
tool.GetPartitionNum(*rowOut, *colOut, overlapWidth);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
int Print_Part(CSigmaView * pView, PrintPartition * partition)
|
|
|
{
|
|
|
if (pView == 0)
|
|
|
return -1;
|
|
|
|
|
|
CPrintTool tool(pView->m_pDoc);
|
|
|
tool.Part(partition);
|
|
|
return 0;
|
|
|
}
|
|
|
|