📄 eastdrawview.cpp
字号:
pDoc->m_TextArray.Add((CText*)m_pCurrentUnit);
}
m_pCurrentUnit->OnLButtonDown(&dc,this,point);
}
if(m_CurrentDrawTool==EllipseArc_Tool)
{
if(this->m_LBDownTimes==1)
{
m_pCurrentUnit=new CEllipseArc;
pDoc->m_EllipseArcArray.Add((CEllipseArc*)m_pCurrentUnit);
}
if(this->m_LBDownTimes==2)
{
m_pCurrentUnit->ComputSloap(m_pCurrentUnit->m_FirstPoint,point);
m_pCurrentUnit->m_CenterPoint=CPoint((m_pCurrentUnit->m_FirstPoint.x+point.x)/2,(m_pCurrentUnit->m_FirstPoint.y+point.y)/2);
m_pCurrentUnit->ComputRadiusY(m_pCurrentUnit->m_CenterPoint,point);
}
if(this->m_LBDownTimes==3)
{
m_pCurrentUnit->m_FourthPoint=point;
m_pCurrentUnit->m_FifthPoint=point;
m_pCurrentUnit->ComputeIntersectionPointFirst(point);
m_pCurrentUnit->ComputeIntersectionPointSecond(point);
}
}
if(m_CurrentDrawTool==RoundArc_Tool)
{
if(this->m_LBDownTimes==1)
{
m_pCurrentUnit=new CRoundArc;
pDoc->m_RoundArcArray.Add((CRoundArc*)m_pCurrentUnit);
}
if(this->m_LBDownTimes==2)
{
m_pCurrentUnit->m_SecondPoint=point;
m_pCurrentUnit->ComputeSloap1(m_pCurrentUnit->m_FirstPoint,m_pCurrentUnit->m_SecondPoint);
m_pCurrentUnit->m_ThirdPoint=m_pCurrentUnit->m_FirstPoint;
}
}//******if(m_CurrentDrawTool==RoundArc_Tool)
if(m_CurrentDrawTool==Polygon_Tool)
{
if(this->m_LBDownTimes==1)
{
m_pCurrentUnit=new CPolygon;
pDoc->m_PolygonArray.Add((CPolygon*)m_pCurrentUnit);
m_pCurrentUnit->m_PointList->Add(point);
}
if(this->m_LBDownTimes!=0&&this->m_LBDownTimes!=1)
{
m_pCurrentUnit->m_PointList->Add(point);
}
}//******if(m_CurrentDrawTool==Polygon_Tool)
if(m_CurrentDrawTool==Ellipse_Tool)
{
if(m_LBDownTimes==1)
{
m_pCurrentUnit=new CEllipse;
pDoc->m_EllipseArray.Add((CEllipse*)m_pCurrentUnit);
}
if(m_LBDownTimes==2)
{
m_pCurrentUnit->ComputSloap(m_pCurrentUnit->m_FirstPoint,point);
m_pCurrentUnit->m_CenterPoint=CPoint((m_pCurrentUnit->m_FirstPoint.x+point.x)/2,(m_pCurrentUnit->m_FirstPoint.y+point.y)/2);
m_pCurrentUnit->ComputRadiusX(m_pCurrentUnit->m_CenterPoint,point);
m_pCurrentUnit->ComputRadiusY(m_pCurrentUnit->m_CenterPoint,point);
m_pCurrentUnit->ellipseMidpoint(&dc,m_pCurrentUnit->m_CenterPoint.x,m_pCurrentUnit->m_CenterPoint.y,m_pCurrentUnit->m_Xr,m_pCurrentUnit->m_Yr);
}
if(this->m_LBDownTimes==0)
{
m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_FirstPoint,m_pCurrentUnit->m_SecondPoint);
}
}//******if(m_CurrentDrawTool==Ellipse_Tool)
if(m_CurrentDrawTool==Round_Tool)
{
if(m_LBDownTimes==1)
{
m_pCurrentUnit=new CRound;
pDoc->m_RoundArray.Add((CRound*)m_pCurrentUnit);
m_pCurrentUnit->m_CenterPoint=point;
}
if(m_LBDownTimes==0)
{
m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_CenterPoint,point);
}
}
if(m_CurrentDrawTool==RoundRectangle_Tool)
{
if(m_LBDownTimes==1)
{
m_pCurrentUnit=new CRoundRectangle;
pDoc->m_RoundRectangleArray.Add((CRoundRectangle*)m_pCurrentUnit);
}
}
if(m_CurrentDrawTool==LiEllipse_Tool)
{
if(m_LBDownTimes==1)
{
m_pCurrentUnit=new CLiEllipse;
pDoc->m_LiEllipseArray.Add((CLiEllipse*)m_pCurrentUnit);
}
}
if(m_CurrentDrawTool==DLine_Tool)
{
if(m_LBDownTimes==1)
{
m_pCurrentUnit=new CDLine;
pDoc->m_DLineArray.Add((CDLine*)m_pCurrentUnit);
}
}
if(m_CurrentDrawTool==Curve_Tool)
{
if(m_LBDownTimes==1)
{
m_pCurrentUnit=(CCurve*)new CCurve;
pDoc->m_CurveArray.Add((CCurve*)m_pCurrentUnit);
m_pCurrentUnit->m_PointList->Add(point);
m_pCurrentUnit->m_PointList->Add(point);
}
}//******if(m_CurrentDrawTool==Curve_Tool)
if(m_CurrentDrawTool==Rectangle_Tool)
{
if(m_LBDownTimes==1)
{
m_pCurrentUnit=(CRectangle*)new CRectangle;
pDoc->m_RectangleArray.Add((CRectangle*)m_pCurrentUnit);
}
}//******if(m_CurrentDrawTool==Rectangle_Tool)
}//*****if(m_CurrentDrawStatus==Draw_Status)
if((m_CurrentDrawStatus==Draw_Status&&m_LBDownTimes==1)||(m_bHaveFindSecond&&!m_IsLocked))
{
m_DLineProperty->m_DLineDlg1->UpdateData();
m_pCurrentUnit->m_FirstPoint=m_FirstPoint;
m_pCurrentUnit->m_SecondPoint=m_SecondPoint;
m_pCurrentUnit->m_PenStyle=m_DLineProperty->m_DLineDlg1->m_PenStyle;
m_pCurrentUnit->m_PenWidth=m_DLineProperty->m_DLineDlg1->m_Edit_LineWidth;
m_pCurrentUnit->m_PenColor=m_DLineProperty->m_DLineDlg2->m_PenColor;
m_pCurrentUnit->m_BrushColor=m_DLineProperty->m_DLineDlg2->m_BrushColor;
m_pCurrentUnit->m_BrushHatch=m_DLineProperty->m_DLineDlg1->m_BrushHatch;
m_pCurrentUnit->m_BrushStyle=m_DLineProperty->m_DLineDlg1->m_BrushStyle;
m_pCurrentUnit->m_BackgroundColor=m_DLineProperty->m_DLineDlg2->m_BackgroundColor;
//if(m_DLineProperty->m_Mode->m_bMode)
// m_pCurrentUnit->m_DrawingMode=m_DLineProperty->m_Mode->m_DrawingMode;
//else
m_pCurrentUnit->m_DrawingMode=dc.GetROP2();
m_pCurrentUnit->m_BkMode=m_DLineProperty->m_DLineDlg1->m_BKMode;//m_DLineProperty->m_Mode->m_BKMode;
}//**********if(this->m_LBDownTimes==1&&m_bHaveFindFirst)
if(m_bHaveFindSecond&&m_IsLocked)
{
m_DLineProperty->m_DLineDlg1->UpdateData();
m_pCurrentUnit->m_FirstPoint=m_FirstPoint;
m_pCurrentUnit->m_SecondPoint=m_SecondPoint;
m_DLineProperty->m_DLineDlg1->m_PenStyle=m_pCurrentUnit->m_PenStyle;
m_DLineProperty->m_DLineDlg1->m_Edit_LineWidth=m_pCurrentUnit->m_PenWidth;
m_DLineProperty->m_DLineDlg2->m_PenColor=m_pCurrentUnit->m_PenColor;
m_DLineProperty->m_DLineDlg2->m_BrushColor=m_pCurrentUnit->m_BrushColor;
m_DLineProperty->m_DLineDlg1->m_BrushHatch=m_pCurrentUnit->m_BrushHatch;
m_DLineProperty->m_DLineDlg1->m_BrushStyle=m_pCurrentUnit->m_BrushStyle;
m_DLineProperty->m_DLineDlg2->m_BackgroundColor=m_pCurrentUnit->m_BackgroundColor;
m_pCurrentUnit->m_DrawingMode=dc.GetROP2();
m_DLineProperty->m_DLineDlg1->m_BKMode=m_pCurrentUnit->m_BkMode;
// if(m_DLineProperty->m_Mode->m_bMode)
//m_DLineProperty->m_Mode->m_DrawingMode=m_pCurrentUnit->m_DrawingMode;
m_DLineProperty->GetActivePage()->UpdateData(false);
m_DLineProperty->GetActivePage()->Invalidate();
}
if(m_bHaveFindSecond)
{
m_pCurrentUnit->DrawStatic(&dc);
}
if(m_CurrentDrawStatus==Drag_Status)
{
m_FirstPoint=m_pCurrentUnit->m_FoundPoint;
m_SecondPoint=m_pCurrentUnit->m_FoundPoint;
}
if(m_CurrentDrawStatus==Change_Status)//&&m_CurrentDrawTool==Ellipse_Tool)
{
m_FirstPoint=m_pCurrentUnit->m_FoundPoint;
m_SecondPoint=m_pCurrentUnit->m_FoundPoint;
if(this->m_CurrentDrawTool==Text_Tool)
{
m_pCurrentUnit->OnLButtonDown(&dc,this,point);
}
}
if(m_IsMouseCap&&m_bHaveFindSecond)
this->SetCapture();
CScrollView::OnLButtonDown(nFlags, point);
}
//***************************************************************************************
//***************************************************************************************
//***************************************************************************************
//***************************************************************************************
void CEastDrawView::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CPoint Devpoint=point;
CClientDC dc(this);
this->OnPrepareDC(&dc);
dc.SetWindowOrg(m_CenterPoint);
dc.DPtoLP(&point);
dc.SetROP2(R2_NOTXORPEN);
this->ComputeMinandMaxPoint(point);
m_ChangeingPoint=point;
this->SetMousePosText(point,Devpoint);
if(m_DLineProperty->m_DLineDlg2->m_Draw_Status==Select_Color_Status)
{
m_DLineProperty->m_DLineDlg2->m_Color=dc.GetPixel(point);
m_DLineProperty->m_DLineDlg2->OnChange(dc.GetPixel(point));
m_CurrentDrawStatus=0;
m_DLineProperty->m_DLineDlg2->m_Draw_Status=0;
m_CurrentDrawTool=0;
}
if(m_IsMouseCap&&m_bHaveFindSecond)
this->SetCapture();
CScrollView::OnLButtonUp(nFlags, point);
}
//***************************************************************************************
//***************************************************************************************
//***************************************************************************************
//***************************************************************************************
//***************************************************************************************
void CEastDrawView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CPoint Devpoint=point;
CClientDC dc(this);
this->OnPrepareDC(&dc);
dc.SetWindowOrg(m_CenterPoint);
dc.DPtoLP(&point);
dc.SetROP2(R2_NOTXORPEN);
this->ComputeMinandMaxPoint(point);
m_ChangeingPoint=point;
this->SetMousePosText(point,Devpoint);
if(m_DLineProperty->m_DLineDlg2->m_Draw_Status==Select_Color_Status)
{
m_DLineProperty->m_DLineDlg2->OnChange(dc.GetPixel(point));
m_CurrentDrawStatus=Select_Color_Status;
m_CurrentDrawTool=0;
}
if((m_LBDownTimes!=0)&&(m_CurrentDrawStatus==Draw_Status||m_CurrentDrawStatus==Change_Status))
{
if(m_CurrentDrawStatus==Change_Status)
{
m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_FoundPoint,m_SecondPoint);
}
m_pCurrentUnit->OnMouseMove(&dc,this,point);
if(m_CurrentDrawStatus==Change_Status)
m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_FoundPoint,point);
}//*********if(m_IsDrawing&&(m_CurrentDrawStatus==Draw_Status||m_CurrentDrawStatus==Exchange_Status))
if(m_CurrentDrawStatus==Drag_Status)
{
m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_FoundPoint,m_SecondPoint);
dc.SetROP2(R2_NOTXORPEN);
m_pCurrentUnit->m_DrawingMode=dc.GetROP2();
if(m_CurrentDrawTool!=EllipseArc_Tool)
m_pCurrentUnit->DrawActive(&dc,point);
m_FirstPoint=m_SecondPoint;
m_SecondPoint=point;
m_pCurrentUnit->OnMouseMove(&dc,this,point);
m_pCurrentUnit->m_DrawingMode=dc.GetROP2();
if(m_CurrentDrawTool!=EllipseArc_Tool)
m_pCurrentUnit->DrawActive(&dc,point);
m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_FoundPoint,point);
}
CScrollView::OnMouseMove(nFlags, point);
}
void CEastDrawView::OnBUTTONDLine()
{
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=DLine_Tool;
m_CurrentDrawStatus=Draw_Status;
this->m_LBDownTimes=0;
}
void CEastDrawView::OnBUTTON32774Move()
{
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=Select_Status;
m_LBDownTimes=0;
}
void CEastDrawView::OnBUTTON32775CircumRotate()
{
CClientDC dc(this);
OnPrepareDC(&dc);
dc.SetWindowOrg(m_CenterPoint);
// TODO: Add your command handler code here
//m_CurrentDrawStatus=Select_Status;
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=Circumrotate_Status;
}
void CEastDrawView::OnBUTTON32777Curve()
{
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=Curve_Tool;
m_LBDownTimes=0;
m_CurrentDrawStatus=Draw_Status;
}
void CEastDrawView::OnBUTTON32776Rectangle()
{
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);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -