You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
2.7 KiB
C++

#include "StdAfx.h"
#include "MouseToolPointer.h"
#include "LogMgr.h"
#include "GlobalDrawMgr.h"
#include "DrawSimpleShape.h"
#include "GlobalFunction.h"
#include "MarkAreaMgr.h"
#define PT_SEL_SCALE 0.1 //<2F><>ѡrect <20>ı<EFBFBD><C4B1><EFBFBD>
CMouseToolPointer::CMouseToolPointer(void)
{
}
CMouseToolPointer::~CMouseToolPointer(void)
{
}
void CMouseToolPointer::OnLButtonDown(UINT nFlags, CPoint point,CClientDC &dc)
{
CLayer &layer = gLayer;
if(m_Status==_STATUS_1)
{
SaveDownPoint(point);//<2F><>¼<EFBFBD><C2BC>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
ToNextStatus();
}
else
{
DbRect rect;
Dbxy pt2 = gDraw->CPoint2Dbxy(point);
if(gDraw->IsbRectSel())//ֻ<>п<EFBFBD>ѡ<EFBFBD><D1A1>ʱ<EFBFBD><CAB1><EFBFBD>Ż<EFBFBD><C5BB><EFBFBD>
{
DrawRect(&dc,gDraw->GetMouseRectPen(),m_DownPoint,pt2);
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
rect.Creat(m_DownPoint,pt2);
if(rect.IsZero())//<2F><>ѡ
{
if(gDraw->IsbPointSel())
{
rect = gDraw->GetCurPointRect(pt2,PT_SEL_SCALE);
layer.SelObjectInRect(rect,false);
}
}
else
{
if(gDraw->IsbRectSel())//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫȫ<D2AA><C8AB><EFBFBD><EFBFBD>ס<EFBFBD><D7A1><EFBFBD><EFBFBD>
if(m_DownPoint.x<pt2.x)
{
layer.SelObjectInRect(rect,true);
}
else//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>Ҳ<EFBFBD><D2B2>
{
layer.SelObjectInRect(rect,false);
}
gMarkAreaMgr->SelAreaByPt(rect.GetCenterPt());
}
}
GetCurViewPtr()->RefreshView();
m_Status = _STATUS_1;
}
}
void CMouseToolPointer::OnLButtonUp(UINT nFlags, CPoint point,CClientDC &dc)
{
if(m_Status!=_STATUS_1)//<2F><>ѡ
{
Dbxy pt2 = gDraw->CPoint2Dbxy(point);
DbRect rect;
rect = gDraw->GetCurPointRect(pt2,PT_SEL_SCALE);
if(gDraw->IsbPointSel())
{
if(gLayer.SelObjectInRect(rect,false))
{
GetCurViewPtr()->RefreshView();
m_Status = _STATUS_1;
}
}
}
}
void CMouseToolPointer::OnMouseMove(UINT nFlags, CPoint point,CClientDC &dc)
{
Dbxy pt2 = gDraw->CPoint2Dbxy(m_PreMovePt);
Dbxy pt2New = gDraw->CPoint2Dbxy(point);
if(m_Status!=_STATUS_1)//<2F><>ѡͼ<D1A1><CDBC>
{
if(gDraw->IsbRectSel())//ֻ<>п<EFBFBD>ѡ<EFBFBD><D1A1>ʱ<EFBFBD><CAB1><EFBFBD>Ż<EFBFBD><C5BB><EFBFBD>
{
if(HasPreMovePt())//<2F><><EFBFBD><EFBFBD>֮ǰ<D6AE><C7B0>
{
DrawRect(&dc,gDraw->GetMouseRectPen(),m_DownPoint,pt2);
}
DrawRect(&dc,gDraw->GetMouseRectPen(),m_DownPoint,pt2New);
}
SavePreMovePt(point);
}
}