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.
145 lines
4.1 KiB
C++
145 lines
4.1 KiB
C++
#include "StdAfx.h"
|
|
#include "MouseToolRect.h"
|
|
#include "ObjPline.h"
|
|
#include "GlobalFunction.h"
|
|
#include "GlobalDrawMgr.h"
|
|
#include "LogMgr.h"
|
|
|
|
CMouseToolRect::CMouseToolRect(void)
|
|
{
|
|
//깃푯으-------------------------start
|
|
GetFrame()->ResetCaptionBar();
|
|
GetFrame()->SetCaptionCmdStr(CMD_RECT_FIRST_PT);
|
|
GetFrame()->RefreashCaptionBar();
|
|
//깃푯으-------------------------end
|
|
m_Width = 0;
|
|
m_Hight = 0;
|
|
}
|
|
CMouseToolRect::~CMouseToolRect(void)
|
|
{
|
|
}
|
|
void CMouseToolRect::OperateOver()
|
|
{
|
|
//------------------------------------휑羚start
|
|
CString val1;
|
|
val1.Format("%lf",m_Width);
|
|
CString val2;
|
|
val2.Format("%lf",m_Hight);
|
|
gLogMgr->WriteCmd(CMD_RECT_SIZE,val1,val2);
|
|
//------------------------------------휑羚end
|
|
//깃푯으-------------------------start
|
|
GetFrame()->ResetCaptionBar();
|
|
//깃푯으-------------------------end
|
|
//警속寧즈
|
|
AddCreatCommand();
|
|
//써監
|
|
m_Status = _STATUS_END;
|
|
|
|
CMouseTool::OperateOver();
|
|
}
|
|
|
|
void CMouseToolRect::OnLButtonDown(UINT nFlags, CPoint point,CClientDC &dc)
|
|
{
|
|
Dbxy pt = gDraw->CPoint2Dbxy(point);
|
|
if(m_Status==_STATUS_1)
|
|
{
|
|
SaveDownPoint(point);
|
|
CObjPline *p = new CObjPline;
|
|
p->Creat(pt,m_Width,m_Hight);
|
|
AddObject(p);
|
|
//------------------------------------휑羚start
|
|
CString val1;
|
|
val1.Format("%lf",pt.x);
|
|
CString val2;
|
|
val2.Format("%lf",pt.y);
|
|
gLogMgr->WriteCmd(CMD_RECT_FIRST_PT,val1,val2);
|
|
//------------------------------------휑羚end
|
|
//깃푯으-------------------------start
|
|
GetFrame()->ResetCaptionBar();
|
|
GetFrame()->SetCaptionCmdStr(CMD_RECT_SIZE);
|
|
GetFrame()->RefreashCaptionBar();
|
|
//깃푯으-------------------------end
|
|
ToNextStatus();
|
|
}
|
|
else
|
|
{
|
|
OperateOver();
|
|
}
|
|
}
|
|
void CMouseToolRect::OnLButtonUp(UINT nFlags, CPoint point,CClientDC &dc)
|
|
{
|
|
|
|
}
|
|
void CMouseToolRect::OnMouseMove(UINT nFlag, CPoint point,CClientDC &dc)
|
|
{
|
|
Dbxy pt = gDraw->CPoint2Dbxy(point);
|
|
if(m_Status!=_STATUS_1)
|
|
{
|
|
CObjBase *pCurOptObject = m_TmpObjContainer.GetCurOpObj();
|
|
if(pCurOptObject)
|
|
{
|
|
CObjPline *p = dynamic_cast<CObjPline*>(pCurOptObject);
|
|
|
|
m_Width = pt.x-m_DownPoint.x;
|
|
m_Hight = pt.y-m_DownPoint.y;
|
|
|
|
m_TmpObjContainer.XorRedrawObj(&dc,false);
|
|
p->Creat(m_DownPoint,m_Width,m_Hight);
|
|
m_TmpObjContainer.XorRedrawObj(&dc,false);
|
|
|
|
//榴檄으-----------------------------start
|
|
CString str1 = "앤近[욱똑] [멕똑]";
|
|
CString str2;
|
|
str2.Format("%lf",m_Width);
|
|
CString str3;
|
|
str3.Format("%lf",m_Hight);
|
|
GetFrame()->ResetStatusBarExtStr();
|
|
GetFrame()->SetStatusBarExtStr(str1,str2,str3);
|
|
//榴檄으-----------------------------end
|
|
}
|
|
}
|
|
}
|
|
bool CMouseToolRect::OnSetCmd(CString str)
|
|
{
|
|
if(m_Status==_STATUS_2)
|
|
{
|
|
double Val1=0;//욱똑
|
|
double Val2=0;//멕똑
|
|
int result = GetTwoNum(str,Val1,Val2);
|
|
if(result>0)
|
|
{
|
|
if(result == 2 && Val1>0 && Val2>0)//욱똑멕똑狼댕黨0 ,랍할矜狼谿珂渴흙
|
|
{
|
|
//몽앴柑깃돨貫零윱털뙤
|
|
if(m_Width<0)
|
|
{
|
|
m_Width = Val1*(-1);
|
|
}
|
|
else
|
|
{
|
|
m_Width = Val1;
|
|
}
|
|
if(m_Hight<0)
|
|
{
|
|
m_Hight = Val2*(-1);
|
|
}
|
|
else
|
|
{
|
|
m_Hight = Val2;
|
|
}
|
|
|
|
CObjBase *pCurOptObject = m_TmpObjContainer.GetCurOpObj();
|
|
if(pCurOptObject)
|
|
{
|
|
CObjPline *p = dynamic_cast<CObjPline*>(pCurOptObject);
|
|
p->Creat(m_DownPoint,m_Width,m_Hight);
|
|
}
|
|
OperateOver();
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|