📄 eastdrawview.cpp
字号:
void CEastDrawView::OnDelete()
{
// TODO: Add your command handler code here
this->DeleteSelect();
}
void CEastDrawView::OnBUTTON32830Lock()
{
// TODO: Add your command handler code here
m_IsLocked=!m_IsLocked;
}
void CEastDrawView::OnUpdateBUTTON32830Lock(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_IsLocked?1:0);
}
void CEastDrawView::OnUpdateBUTTONDLine(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_CurrentDrawTool==DLine_Tool?1:0);
}
void CEastDrawView::OnUpdateBUTTON32776Rectangle(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_CurrentDrawTool==Rectangle_Tool?1:0);
}
void CEastDrawView::OnUpdateBUTTON32778RoundRectangle(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_CurrentDrawTool==RoundRectangle_Tool?1:0);
}
void CEastDrawView::OnUpdateBUTTON32791Polygon(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_CurrentDrawTool==Polygon_Tool?1:0);
}
void CEastDrawView::OnUpdateBUTTON32779Ellipse(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_CurrentDrawTool==Ellipse_Tool?1:0);
}
void CEastDrawView::OnUpdateBUTTON32780Round(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_CurrentDrawTool==Round_Tool?1:0);
}
void CEastDrawView::OnUpdateBUTTON32777Curve(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_CurrentDrawTool==Curve_Tool?1:0);
}
void CEastDrawView::OnUpdateBUTTONLiEllipse(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_CurrentDrawTool==LiEllipse_Tool?1:0);
}
void CEastDrawView::OnUpdateBUTTON32800RoundArc(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_CurrentDrawTool==RoundArc_Tool?1:0);
}
void CEastDrawView::OnUpdateBUTTON32805EllipseArc(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_CurrentDrawTool==EllipseArc_Tool?1:0);
}
void CEastDrawView::OnUpdateBUTTON32807PolyBezier(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_CurrentDrawTool==PolyBezier_Tool?1:0);
}
void CEastDrawView::OnUpdateBUTTON32809Text(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_CurrentDrawTool==Text_Tool?1:0);
}
void CEastDrawView::OnUpdateBUTTON32774Move(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_CurrentDrawStatus!=Draw_Status&&m_CurrentDrawStatus!=0?1:0);
}
void CEastDrawView::OnBUTTON32845Axis()
{
// TODO: Add your command handler code here
CClientDC dc(this);
OnPrepareDC(&dc);
dc.SetWindowOrg(m_CenterPoint);
DrawAxis(&dc);
m_HaveAxis=!m_HaveAxis;
}
void CEastDrawView::OnUpdateBUTTON32845Axis(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_HaveAxis?1:0);
}
void CEastDrawView::OnBUTTON32850ReDraw()
{
// TODO: Add your command handler code here
CEastDrawDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CClientDC dc(this);
this->OnPrepareDC(&dc);
dc.SetWindowOrg(m_CenterPoint);
CBitmap*Oldmap;
CBitmap Bitmap;
CDC memDC;
Bitmap.CreateCompatibleBitmap(&dc,this->GetTotalSize().cx,this->GetTotalSize().cy);
memDC.CreateCompatibleDC(&dc);
Oldmap=memDC.SelectObject(&Bitmap);
memDC.SetWindowOrg(m_CenterPoint);
CRect client;
CBrush br(RGB(255,0,255));
GetClientRect(client);
dc.DPtoLP(&client);
memDC.SetMapMode(dc.GetMapMode());
memDC.PatBlt(client.left,client.top,client.Width(),client.Height(),WHITENESS);
this->DrawAll(&memDC);
if(this->m_HaveAxis)
this->DrawAxis(&memDC);
dc.BitBlt(client.left,client.top,client.Width(),client.Height(),&memDC,client.left,client.top,SRCCOPY);
memDC.DeleteDC();
}
void CEastDrawView::DrawAll(CDC *pDrawDC)
{
CEastDrawDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CDC*pDC=pDrawDC;
for(int i=0;i<pDoc->m_PolygonArray.GetSize();i++)
{
CPolygon*pPolygon=(CPolygon*)pDoc->m_PolygonArray.GetAt(i);
pPolygon->DrawStatic(pDC);
if(pPolygon->m_HaveFindFirst)
pPolygon->ShowSelectPoint(pDC);
}
for(i=0;i<pDoc->m_PolyBezierArray.GetSize();i++)
{
CPolyBezier*pPolyBezier=(CPolyBezier*)pDoc->m_PolyBezierArray.GetAt(i);
pPolyBezier->DrawStatic(pDC);
if(pPolyBezier->m_HaveFindFirst)
pPolyBezier->ShowSelectPoint(pDC);
}
for(i=0;i<pDoc->m_DLineArray.GetSize();i++)
{
CDLine*pDLine=(CDLine*)pDoc->m_DLineArray.GetAt(i);
pDLine->DrawStatic(pDC);
if(pDLine->m_HaveFindFirst)
pDLine->ShowSelectPoint(pDC);
}
for(i=0;i<pDoc->m_CurveArray.GetSize();i++)
{
CCurve*pCurve=(CCurve*)pDoc->m_CurveArray.GetAt(i);
pCurve->DrawStatic(pDC);
if(pCurve->m_HaveFindFirst)
pCurve->ShowSelectPoint(pDC);
}
for(i=0;i<pDoc->m_RectangleArray.GetSize();i++)
{
CRectangle*pRectangle=(CRectangle*)pDoc->m_RectangleArray.GetAt(i);
pRectangle->DrawStatic(pDC);
if(pRectangle->m_HaveFindFirst)
pRectangle->ShowSelectPoint(pDC);
}
for(i=0;i<pDoc->m_RoundRectangleArray.GetSize();i++)
{
CRoundRectangle*pRoundRectangle=(CRoundRectangle*)pDoc->m_RoundRectangleArray.GetAt(i);
pRoundRectangle->DrawStatic(pDC);
if(pRoundRectangle->m_HaveFindFirst)
pRoundRectangle->ShowSelectPoint(pDC);
}
for(i=0;i<pDoc->m_EllipseArray.GetSize();i++)
{
CEllipse*pEllipse=(CEllipse*)pDoc->m_EllipseArray.GetAt(i);
pEllipse->DrawStatic(pDC);
if(pEllipse->m_HaveFindFirst)
pEllipse->ShowSelectPoint(pDC);
}
for(i=0;i<pDoc->m_RoundArray.GetSize();i++)
{
CRound*pRound=(CRound*)pDoc->m_RoundArray.GetAt(i);
pRound->DrawStatic(pDC);
if(pRound->m_HaveFindFirst)
pRound->ShowSelectPoint(pDC);
}
for(i=0;i<pDoc->m_LiEllipseArray.GetSize();i++)
{
CEllipse*pLiEllipse=(CEllipse*)pDoc->m_LiEllipseArray.GetAt(i);
pLiEllipse->DrawStatic(pDC);
if(pLiEllipse->m_HaveFindFirst)
pLiEllipse->ShowSelectPoint(pDC);
}
for(i=0;i<pDoc->m_RoundArcArray.GetSize();i++)
{
CRoundArc*pRoundArc=(CRoundArc*)pDoc->m_RoundArcArray.GetAt(i);
pRoundArc->DrawStatic(pDC);
if(pRoundArc->m_HaveFindFirst)
pRoundArc->ShowSelectPoint(pDC);
}
for(i=0;i<pDoc->m_EllipseArcArray.GetSize();i++)
{
CEllipseArc*pEllipseArc=(CEllipseArc*)pDoc->m_EllipseArcArray.GetAt(i);
pEllipseArc->DrawStatic(pDC);
if(pEllipseArc->m_HaveFindFirst)
pEllipseArc->ShowSelectPoint(pDC);
}
for(i=0;i<pDoc->m_TextArray.GetSize();i++)
{
CText*pText=(CText*)pDoc->m_TextArray.GetAt(i);
pText->DrawStatic(pDC);
if(pText->m_HaveFindFirst)
pText->ShowSelectPoint(pDC);
}
// TODO: add draw code for native data here
}
void CEastDrawView::OnBUTTON32856DONothing()
{
// TODO: Add your command handler code here
CClientDC dc(this);
OnPrepareDC(&dc);
dc.SetWindowOrg(m_CenterPoint);
// TODO: Add your command handler code here
if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
ResetSelectStatus();
CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
if(pMainFrame->m_wndStyleBar.IsWindowVisible())
{
pMainFrame->ShowFontBar(false);
if(this->m_LBDownTimes==1)
{
this->m_LBDownTimes=2;
this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
}
}
m_CurrentDrawTool=0;
m_CurrentDrawStatus=0;
m_LBDownTimes=0;
}
void CEastDrawView::AddTempFile()
{
CEastDrawDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDoc->AddTempFile();
}
void CEastDrawView::AutoSave()
{
CEastDrawDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDoc->AutoSave();
}
void CEastDrawView::ExchangeSave()
{
CEastDrawDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDoc->SetModifiedFlag();
if(m_IsLastMove)
{
pDoc->Requeue(m_Index,m_Rtimes);
m_IsLastMove=false;
m_Index=0;
}
else
{
m_Index=0;
if(m_Rtimes<6)
m_Rtimes++;
}
pDoc->ExchangeSave(m_Index,m_Rtimes);
}
void CEastDrawView::OnBUTTON32858OnDo()
{
// TODO: Add your command handler code here
CEastDrawDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if(m_Index<5)
{
m_Index++;
this->m_IsLastMove=true;
pDoc->OnBUTTON32858OnDo(m_Index);
OnBUTTON32850ReDraw();
}
}
void CEastDrawView::OnBUTTON32859ReDo()
{
// TODO: Add your command handler code here
CEastDrawDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if(m_Index>0)
{
m_Index--;
pDoc->OnBUTTON32858OnDo(m_Index);
m_IsLastMove=true;
OnBUTTON32850ReDraw();
}
}
void CEastDrawView::OnUpdateBUTTON32858OnDo(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(m_Index<5&&m_Index<m_Rtimes&&m_Rtimes!=0?true:false);
}
void CEastDrawView::OnUpdateBUTTON32859ReDo(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(m_Index>0&&m_Rtimes!=0?true:false);
}
void CEastDrawView::ReMoveTemp()
{
CEastDrawDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDoc->ReMoveTemp();
}
void CEastDrawView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{
// TODO: Add your specialized code here and/or call the base class
CClientDC dc(this);
int nHorzSC = dc.GetDeviceCaps(LOGPIXELSX);
int nHorzPR = pDC->GetDeviceCaps(LOGPIXELSX);
int PhyToDis=nHorzPR/nHorzSC;
pDC->SetMapMode(MM_ANISOTROPIC);
pDC->SetWindowExt(GetTotalSize());
pDC->SetViewportExt(GetTotalSize().cx*PhyToDis,GetTotalSize().cy*PhyToDis);
pDC->SetWindowOrg(m_CenterPoint.x,m_CenterPoint.y);
this->DrawAll(pDC);
if(this->m_HaveAxis)
this->DrawAxis(pDC);
}
BOOL CEastDrawView::OnPreparePrinting(CPrintInfo* pInfo)
{
// TODO: call DoPreparePrinting to invoke the Print dialog box
return DoPreparePrinting(pInfo);
}
void CEastDrawView::SetBoxFont()
{
CMainFrame*pMainFrame=STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
pMainFrame->m_wndStyleBar.IniFont();
}
void CEastDrawView::OnMouseCapOn()
{
// TODO: Add your command handler code here
m_IsMouseCap=!m_IsMouseCap;
}
void CEastDrawView::OnUpdateMouseCapOn(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_IsMouseCap?1:0);
}
void CEastDrawView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
CSize size=this->GetTotalSize();
CRect rect;
this->GetClientRect(&rect);
switch(nChar)
{
case VK_UP:
if(rect.bottom<size.cy)
ScrollToPosition(CPoint(GetDeviceScrollPosition().x,GetDeviceScrollPosition().y-rect.Height()/2));
break;
case VK_DOWN:
if(rect.bottom<size.cy)
ScrollToPosition(CPoint(GetDeviceScrollPosition().x,GetDeviceScrollPosition().y+rect.Height()/2));
break;
case VK_LEFT:
ScrollToPosition(CPoint(GetDeviceScrollPosition().x-rect.Width()/2,GetDeviceScrollPosition().y));
break;
case VK_RIGHT:
ScrollToPosition(CPoint(GetDeviceScrollPosition().x+rect.Width()/2,GetDeviceScrollPosition().y));
break;
case VK_HOME:
ScrollToPosition(CPoint(0,0));
break;
}
CScrollView::OnKeyDown(nChar, nRepCnt, nFlags);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -