|
|
#include "stdafx.h"
|
|
|
#include "SigmaView.h"
|
|
|
#include "SectionDoc.h"
|
|
|
#include "ItemCurveEdit.h"
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void ViewMouseDown(CSigmaView* pView, int mouseX, int mouseY)
|
|
|
{
|
|
|
CPoint pt;
|
|
|
pt.x = mouseX;
|
|
|
pt.y = mouseY;
|
|
|
pView->ViewMouseDown(0, pt);
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void ViewMouseMove(CSigmaView* pView, HDC hdcMem, int mouseX, int mouseY)
|
|
|
{
|
|
|
//CDC *pDC = new CDC;
|
|
|
//CDC *pDC = CDC::FromHandle(hdcMem);
|
|
|
//pDC->Attach(hdcMem);
|
|
|
//pView->SetDc(pDC);
|
|
|
//CDC *pDC = CDC::FromHandle(hdcMem);
|
|
|
//pView->SetDrawDC(pDC);
|
|
|
|
|
|
CPoint pt;
|
|
|
pt.x = mouseX;
|
|
|
pt.y = mouseY;
|
|
|
pView->ViewMouseMove(0, pt);
|
|
|
|
|
|
//CDC::FromHandle(hdcMem)->DeleteDC();
|
|
|
}
|
|
|
|
|
|
//extern "C" __declspec(dllexport)
|
|
|
//void CanvasMouseMove(CSigmaView* pView, HDC hdc, int mouseX, int mouseY)
|
|
|
//{
|
|
|
// if (pView == NULL)
|
|
|
// return;
|
|
|
//
|
|
|
// CDC *pDC = CDC::FromHandle(hdc);
|
|
|
// //pView->SetScreenDC(pDC);
|
|
|
//
|
|
|
// CPoint pt;
|
|
|
// pt.x = mouseX;
|
|
|
// pt.y = mouseY;
|
|
|
//
|
|
|
// //pView->DrawCrossLine(pDC, pt);
|
|
|
// pView->UpdateCrossLine(pDC, pt);
|
|
|
//}
|
|
|
//
|
|
|
//extern "C" __declspec(dllexport)
|
|
|
//void CanvasDrawCrossLine(CSigmaView* pView, HDC hdc, int mouseX, int mouseY)
|
|
|
//{
|
|
|
// if (pView == NULL)
|
|
|
// return;
|
|
|
//
|
|
|
// CDC *pDC = CDC::FromHandle(hdc);
|
|
|
// //pView->SetScreenDC(pDC);
|
|
|
//
|
|
|
// CPoint pt;
|
|
|
// pt.x = mouseX;
|
|
|
// pt.y = mouseY;
|
|
|
//
|
|
|
// pView->DrawCrossLine(pDC, pt);
|
|
|
//}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void TestMouseMove(CSigmaView* pView, HDC hdcMem, int mouseX, int mouseY)
|
|
|
{
|
|
|
for (int i = 0; i < 1000; i++)
|
|
|
{
|
|
|
POINT ptOld;
|
|
|
::MoveToEx(hdcMem, mouseX + i, mouseY, &ptOld);
|
|
|
::LineTo(hdcMem, mouseX + i + 200, mouseY + 200);
|
|
|
}
|
|
|
/*
|
|
|
if (pView == NULL)
|
|
|
return;
|
|
|
|
|
|
CPoint pt;
|
|
|
pt.x = mouseX;
|
|
|
pt.y = mouseY;
|
|
|
|
|
|
CItem * pItem = pView->GetItem();
|
|
|
if (pItem)
|
|
|
{
|
|
|
pItem->SetHDC(hdcMem);
|
|
|
pItem->OnMouseMove(0, pt, NULL);
|
|
|
}
|
|
|
*/
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void ViewMouseUp(CSigmaView* pView, int mouseX, int mouseY)
|
|
|
{
|
|
|
CPoint pt;
|
|
|
pt.x = mouseX;
|
|
|
pt.y = mouseY;
|
|
|
pView->ViewMouseUp(0, pt);
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void OnLButtonDown(CSigmaView* pView, int mouseX, int mouseY, HDC hdc, int vk)
|
|
|
{
|
|
|
if (pView == NULL)
|
|
|
return;
|
|
|
CItem * pItem = pView->GetItem();
|
|
|
if (pItem == NULL)
|
|
|
return;
|
|
|
|
|
|
pItem->m_client = pView->m_client;
|
|
|
CPoint pt;
|
|
|
pt.x = mouseX;
|
|
|
pt.y = mouseY;
|
|
|
|
|
|
if (pView->HasEnableBKGrid())
|
|
|
pt = pView->GetGridPoint(pt);
|
|
|
|
|
|
if (hdc != nullptr)
|
|
|
{
|
|
|
CDC *pDC = CDC::FromHandle(hdc);
|
|
|
pItem->SetScreenDC(pDC);
|
|
|
pItem->SetBackGroundDC(pView->m_pImgDC);
|
|
|
pItem->OnLButtonDown(pDC, 0, pt, vk);
|
|
|
}
|
|
|
else {
|
|
|
pItem->OnLButtonDown(nullptr, 0, pt, vk);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ֵ:-1 <20><><EFBFBD><EFBFBD> 0 <20><><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 δѡ<CEB4><D1A1>Ԫ<EFBFBD><D4AA> 2 ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
extern "C" __declspec(dllexport)
|
|
|
int OnLButtonDoubleClick(CSigmaView* pView, int mouseX, int mouseY) //, HDC hdc)
|
|
|
{
|
|
|
if (pView == 0)
|
|
|
return -1;
|
|
|
if (pView->m_pDoc == 0)
|
|
|
return -1;
|
|
|
|
|
|
CPoint point(mouseX, mouseY);
|
|
|
|
|
|
if (pView->HasEnableBKGrid())
|
|
|
point = pView->GetGridPoint(point);
|
|
|
|
|
|
CSigmaDoc* pDoc = pView->m_pDoc;
|
|
|
if (pDoc->GetItem())
|
|
|
{
|
|
|
pDoc->GetItem()->OnLButtonDblClk(0, point);
|
|
|
return 0;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
CPoint2D pt = pDoc->GetDC().GetReal(point);
|
|
|
POSITION p = pDoc->GetSelectedItem(pt);
|
|
|
if (!p)
|
|
|
return 1;
|
|
|
|
|
|
int type = pDoc->GetDraw()->GetElementType(p);
|
|
|
if (type == DOUBLEFOX_CURVE)
|
|
|
{
|
|
|
pDoc->ClearSelectionSet();
|
|
|
pDoc->AddToSelectionSet(p);
|
|
|
return 2;
|
|
|
}
|
|
|
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void OnLButtonUp(CSigmaView* pView, int mouseX, int mouseY, HDC hdc, int vk)
|
|
|
{
|
|
|
if (pView == NULL)
|
|
|
return;
|
|
|
|
|
|
CItem * pItem = pView->GetItem();
|
|
|
if (pItem == NULL)
|
|
|
return;
|
|
|
CPoint pt;
|
|
|
pt.x = mouseX;
|
|
|
pt.y = mouseY;
|
|
|
|
|
|
if (pView->HasEnableBKGrid())
|
|
|
pt = pView->GetGridPoint(pt);
|
|
|
if (hdc != NULL)
|
|
|
{
|
|
|
CDC *pDC = CDC::FromHandle(hdc);
|
|
|
//pView->SetScreenDC(pDC);
|
|
|
pItem->SetScreenDC(pDC);
|
|
|
pItem->SetBackGroundDC(pView->m_pImgDC);
|
|
|
pItem->OnLButtonUp(pDC, 0, pt, vk);
|
|
|
}
|
|
|
else {
|
|
|
pItem->OnLButtonUp(nullptr, 0, pt, vk);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void OnRButtonDown(CSigmaView* pView, int mouseX, int mouseY, HDC hdc, int vk)
|
|
|
{
|
|
|
if (pView == NULL)
|
|
|
return;
|
|
|
|
|
|
CItem * pItem = pView->GetItem();
|
|
|
if (pItem == NULL)
|
|
|
return;
|
|
|
|
|
|
pItem->m_client = pView->m_client;
|
|
|
CPoint pt;
|
|
|
pt.x = mouseX;
|
|
|
pt.y = mouseY;
|
|
|
|
|
|
if (pView->HasEnableBKGrid())
|
|
|
pt = pView->GetGridPoint(pt);
|
|
|
|
|
|
if (hdc != nullptr)
|
|
|
{
|
|
|
CDC *pDC = CDC::FromHandle(hdc);
|
|
|
pItem->SetScreenDC(pDC);
|
|
|
pItem->SetBackGroundDC(pView->m_pImgDC);
|
|
|
pItem->OnRButtonDown(0, pt);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
pItem->OnRButtonDown(0, pt);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void OnRButtonUp(CSigmaView* pView, int mouseX, int mouseY, HDC hdc, int vk)
|
|
|
{
|
|
|
if (pView == NULL)
|
|
|
return;
|
|
|
|
|
|
pView->SetLastRightButtonPoint({ mouseX, mouseY });
|
|
|
|
|
|
CItem * pItem = pView->GetItem();
|
|
|
if (pItem == NULL)
|
|
|
return;
|
|
|
|
|
|
CPoint pt;
|
|
|
pt.x = mouseX;
|
|
|
pt.y = mouseY;
|
|
|
|
|
|
if (pView->HasEnableBKGrid())
|
|
|
pt = pView->GetGridPoint(pt);
|
|
|
if (hdc != NULL)
|
|
|
{
|
|
|
CDC *pDC = CDC::FromHandle(hdc);
|
|
|
pItem->SetScreenDC(pDC);
|
|
|
pItem->SetBackGroundDC(pView->m_pImgDC);
|
|
|
pItem->OnRButtonUp(0, pt);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
pItem->OnRButtonUp(0, pt);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void OnMouseWheel(CSigmaView* pView, uint32_t button, int32_t clicks, int32_t x, int32_t y, int32_t delta)
|
|
|
{
|
|
|
if (pView == NULL)
|
|
|
return;
|
|
|
|
|
|
CItem * pItem = pView->GetItem();
|
|
|
if (pItem == NULL)
|
|
|
return;
|
|
|
|
|
|
pItem->OnMouseWheel(button, clicks, x, y, delta);
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
bool OnKeyDown(CSigmaView* pView, int keyValue, HDC hdc) //C#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>keyValue <20>պõ<D5BA><C3B5><EFBFBD>VK_XXX <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
if (pView == NULL)
|
|
|
return false;
|
|
|
|
|
|
CItem * pItem = pView->GetItem();
|
|
|
if (pItem == NULL)
|
|
|
return false;
|
|
|
|
|
|
CDC *pDC = CDC::FromHandle(hdc);
|
|
|
pView->SetScreenDC(pDC);
|
|
|
pItem->SetScreenDC(pDC);
|
|
|
pItem->SetBackGroundDC(pView->m_pImgDC);
|
|
|
|
|
|
return pItem->OnKeyDown(keyValue, 0, 0);
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
int OnKeyUp(CSigmaView* pView, int keyValue, HDC hdc) //C#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>keyValue <20>պõ<D5BA><C3B5><EFBFBD>VK_XXX <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
if (pView == NULL)
|
|
|
return -1;
|
|
|
|
|
|
CItem * pItem = pView->GetItem();
|
|
|
if (pItem == NULL)
|
|
|
return -1;
|
|
|
|
|
|
CDC *pDC = CDC::FromHandle(hdc);
|
|
|
pView->SetScreenDC(pDC);
|
|
|
|
|
|
pItem->SetScreenDC(pDC);
|
|
|
pItem->SetBackGroundDC(pView->m_pImgDC);
|
|
|
|
|
|
BOOL b = pItem->OnKeyUp(keyValue, 0, 0);
|
|
|
if (b == TRUE)
|
|
|
return 1;
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
//buttonStatus<75>ĵ<EFBFBD>һλ<D2BB><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬ <20>ڶ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD>м<EFBFBD><D0BC><EFBFBD>״̬ <20><><EFBFBD><EFBFBD>λ<EFBFBD>Ҽ<EFBFBD>״̬
|
|
|
extern "C" __declspec(dllexport)
|
|
|
int ItemMouseMove(CSigmaView* pView, HDC hMemDC, int mouseX, int mouseY, int buttonStatus)
|
|
|
{
|
|
|
if (pView == NULL)
|
|
|
return 0;
|
|
|
|
|
|
CDC *pDC = CDC::FromHandle(hMemDC);
|
|
|
pView->SetScreenDC(pDC);
|
|
|
|
|
|
CPoint pt;
|
|
|
pt.x = mouseX;
|
|
|
pt.y = mouseY;
|
|
|
|
|
|
if (pView->HasEnableBKGrid())
|
|
|
pt = pView->GetGridPoint(pt);
|
|
|
|
|
|
//pView->DrawCrossLine(pDC, pt);
|
|
|
|
|
|
CItem * pItem = pView->GetItem();
|
|
|
if (pItem) {
|
|
|
pItem->SetScreenDC(pDC);
|
|
|
return pItem->OnMouseMove(pDC, buttonStatus, pt);
|
|
|
}
|
|
|
//CDC::FromHandle(hMemDC)->DeleteDC();
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void ItemMouseMoveStatus(CSigmaView* pView, HDC hMemDC, int mouseX, int mouseY, int buttonStatus, BYTE*& destBuffer, int& destLen)
|
|
|
{
|
|
|
if (pView == NULL)
|
|
|
return;
|
|
|
|
|
|
CDC *pDC = CDC::FromHandle(hMemDC);
|
|
|
pView->SetScreenDC(pDC);
|
|
|
|
|
|
CPoint pt;
|
|
|
pt.x = mouseX;
|
|
|
pt.y = mouseY;
|
|
|
|
|
|
if (pView->HasEnableBKGrid())
|
|
|
pt = pView->GetGridPoint(pt);
|
|
|
|
|
|
//pView->DrawCrossLine(pDC, pt);
|
|
|
|
|
|
CItem * pItem = pView->GetItem();
|
|
|
if (pItem) {
|
|
|
pItem->SetScreenDC(pDC);
|
|
|
pItem->OnMouseMoveStatus(pDC, buttonStatus, pt, destBuffer, destLen);
|
|
|
}
|
|
|
//CDC::FromHandle(hMemDC)->DeleteDC();
|
|
|
} |