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.

1328 lines
35 KiB
C++

// LaiPuLaserView.cpp : CLaiPuLaserView <20><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>
//
#include "stdafx.h"
// SHARED_HANDLERS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɸѡ<C9B8><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// ATL <20><>Ŀ<EFBFBD>н<EFBFBD><D0BD>ж<EFBFBD><D0B6><EFBFBD><E5A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD>
#ifndef SHARED_HANDLERS
#include "LaiPuLaser.h"
#endif
#include "LaiPuLaserDoc.h"
#include "LaiPuLaserView.h"
#include "MainFrm.h"
#include "MouseToolmgr.h"
#include "GlobalDrawMgr.h"
#include "MarkObjPropertieMgr.h"
#include "GlobalFunction.h"
#include "CommandDelete.h"
#include "CommandMove.h"
#include "LogMgr.h"
#include "DlgArray.h"
#include "WorkAreaMgr.h"
#include "Ruler.h"
#include "ModuleDeviceMgr.h"
#include "ModuleDrawMgr.h"
#include "CommandMgr.h"
#include "WorkDataMgr.h"
#include "TemplateMgr.h"
#include "AuthorityMgr.h"
#include "ObjFillMgr.h"
#include "CommonFlowMgr.h"
#include "CriticalSection.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CLaiPuLaserView
#if 1
IMPLEMENT_DYNCREATE(CLaiPuLaserView, CScrollView)
BEGIN_MESSAGE_MAP(CLaiPuLaserView, CScrollView)
// <20><>׼<EFBFBD><D7BC>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
ON_COMMAND(ID_FILE_PRINT, &CScrollView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, &CScrollView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, OnFilePrintPreview)
ON_COMMAND(ID_MOUSE_RECT, OnToolRect)
ON_UPDATE_COMMAND_UI(ID_MOUSE_RECT, OnUpdateToolRect)
ON_COMMAND(ID_TOOL_POINT, OnToolOnePoint)
ON_UPDATE_COMMAND_UI(ID_TOOL_POINT, OnUpdateToolOnePoint)
ON_COMMAND(ID_LASER_COORD, OnToolLaserCoord)
ON_UPDATE_COMMAND_UI(ID_LASER_COORD, OnUpdateToolLaserCoord)
ON_COMMAND(ID_MOUSE_CIRCLE, OnToolCircle)
ON_UPDATE_COMMAND_UI(ID_MOUSE_CIRCLE, OnUpdateToolCircle)
ON_COMMAND(ID_MOUSE_LINE, OnToolLine)
ON_UPDATE_COMMAND_UI(ID_MOUSE_LINE, OnUpdateToolLine)
ON_COMMAND(ID_PLINE, OnToolPline)
ON_UPDATE_COMMAND_UI(ID_PLINE, OnUpdateToolPline)
ON_COMMAND(ID_POLYGON, OnToolPolygon)
ON_UPDATE_COMMAND_UI(ID_POLYGON, OnUpdateToolPolygon)
ON_COMMAND(ID_UNDO, OnUndo)
ON_UPDATE_COMMAND_UI(ID_UNDO, OnUpdateUndo)
ON_COMMAND(ID_REDO, OnRedo)
ON_UPDATE_COMMAND_UI(ID_REDO, OnUpdateRedo)
ON_COMMAND(ID_ROTATO, OnToolRotato)
ON_COMMAND(ID_SLE_ALL, OnSelAllObj)
ON_COMMAND(ID_REV_SEL_OBJ, OnRevSelObj)
ON_COMMAND(ID_ZOOM_IN, OnZoomIn)
ON_COMMAND(ID_ZOOM_OUT, OnZoomOut)
ON_COMMAND(ID_WORK_SPACE_VIEW, OnWorkSpaceView)
ON_COMMAND(ID_MOVE_TO_CENTER, OnMoveToCenter)
ON_COMMAND(ID_OBJ_FILL, OnObjFill)
ON_COMMAND(ID_MIRROR_H, OnMirrorH)
ON_COMMAND(ID_MIRROR_V, OnMirrorV)
ON_COMMAND(ID_ROTATO_90_L, OnRotato90L)
ON_COMMAND(ID_ROTATO_90_R, OnRotato90R)
ON_COMMAND(ID_ARRAY, OnArray)
ON_COMMAND(ID_CUT, OnCut)
ON_COMMAND(ID_BREAK, OnBreak)
ON_COMMAND(ID_CHAMFER, OnChamfer)
ON_COMMAND(ID_FILLET, OnFillet)
ON_COMMAND(ID_EXPLODE, OnExplode)
ON_COMMAND(ID_DELETE, OnDelSelObj)
ON_COMMAND(ID_JOIN, OnJoin)
ON_COMMAND(ID_COPY, OnCopy)
ON_COMMAND(ID_MOVE, OnMove)
ON_COMMAND(ID_DIS_MEASURE, OnMeasure)
ON_COMMAND(ID_REVERSE, OnReverse)
ON_COMMAND(ID_ADD_NODE, OnAddNode)
ON_COMMAND(ID_DEL_NODE, OnDelNode)
ON_UPDATE_COMMAND_UI(ID_ROTATO, OnUpdateObjOperate)
ON_UPDATE_COMMAND_UI(ID_MOVE_TO_CENTER, OnUpdateObjOperate)
ON_UPDATE_COMMAND_UI(ID_OBJ_FILL, OnUpdateObjOperate)
ON_UPDATE_COMMAND_UI(ID_MIRROR_H, OnUpdateObjOperate)
ON_UPDATE_COMMAND_UI(ID_MIRROR_V, OnUpdateObjOperate)
ON_UPDATE_COMMAND_UI(ID_ROTATO_90_L, OnUpdateObjOperate)
ON_UPDATE_COMMAND_UI(ID_ROTATO_90_R, OnUpdateObjOperate)
ON_UPDATE_COMMAND_UI(ID_ARRAY, OnUpdateObjOperate)
ON_UPDATE_COMMAND_UI(ID_CHAMFER, OnUpdateObjOperate)
ON_UPDATE_COMMAND_UI(ID_FILLET, OnUpdateObjOperate)
ON_UPDATE_COMMAND_UI(ID_EXPLODE, OnUpdateObjOperate)
ON_UPDATE_COMMAND_UI(ID_DELETE, OnUpdateObjOperate)
ON_UPDATE_COMMAND_UI(ID_FILL, OnUpdateObjOperate)
ON_UPDATE_COMMAND_UI(ID_JOIN, OnUpdateObjOperate)
ON_UPDATE_COMMAND_UI(ID_COPY, OnUpdateObjOperate)
ON_UPDATE_COMMAND_UI(ID_MOVE, OnUpdateObjOperate)
ON_UPDATE_COMMAND_UI(ID_REVERSE, OnUpdateObjOperate)
ON_WM_ERASEBKGND()
ON_WM_CONTEXTMENU()
ON_WM_RBUTTONUP()
ON_WM_MOUSEWHEEL()//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_RBUTTONDOWN()
ON_WM_RBUTTONUP()
ON_WM_SETCURSOR()//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
END_MESSAGE_MAP()
#endif
// CLaiPuLaserView <20><><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD>
CLaiPuLaserView::CLaiPuLaserView()
{
m_bFirstIn = true;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD>һ<EFBFBD>ν<EFBFBD><CEBD><EFBFBD>
m_bCtrl = false;//ctrl <20><><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
m_bEraseBkgnd = true;//<2F>Ƿ<EFBFBD><C7B7>ػ汳<D8BB><E6B1B3>ɫ
m_bEraseBkgnd2 = true;//<2F>Ƿ<EFBFBD><C7B7>ػ汳<D8BB><E6B1B3>ɫ(<28><><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6>ָ<EFBFBD>)
}
CLaiPuLaserView::~CLaiPuLaserView()
{
}
//<2F><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
CLaiPuLaserView* m_pView = NULL;//<2F><><EFBFBD>浱ǰ<E6B5B1><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
BOOL CLaiPuLaserView::PreCreateWindow(CREATESTRUCT& cs)
{
// CREATESTRUCT cs <20><><EFBFBD>޸Ĵ<DEB8><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
return CScrollView::PreCreateWindow(cs);
}
//<2F><><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>һ<EFBFBD>ε<EFBFBD><CEB5><EFBFBD>OnDrawǰ<77><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>OnInitialUpdate
void CLaiPuLaserView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
CSize Size;
Size = gDraw->GetScrollViewSize();
SetZoomSizes(Size);
}
#if 1//<2F><><EFBFBD><EFBFBD>
HDC CLaiPuLaserView::GetHDC()
{
return ::GetDC(GetSafeHwnd());
}
CDC* CLaiPuLaserView::GetCDC()
{
return CDC::FromHandle(GetHDC());
}
// CLaiPuLaserView <20><><EFBFBD><EFBFBD>
void CLaiPuLaserView::OnDraw(CDC* pDC)
{
CLaiPuLaserDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
if(m_bFirstIn)
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۲<EFBFBD>
DoZoomFull();
}
//<2F>Ȳ<EFBFBD><C8B2><EFBFBD>֮ǰ<D6AE>IJ<EFBFBD>׽<EFBFBD><D7BD>
gMouseToolMgr.ResetCatchPoint(pDC);
//ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD>һЩ<D2BB><D0A9><EFBFBD><EFBFBD>
gModuleDeviceMgr.Draw(pDC);
gModuleDrawMgr.Draw(pDC);
//<2F><><EFBFBD>Ƶ<EFBFBD>ǰlayer <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(!m_bFirstIn)
{
gLayer.Draw(pDC);
}
m_bFirstIn = false;
}
#endif
// CLaiPuLaserView <20><>ӡ
void CLaiPuLaserView::OnFilePrintPreview()
{
#ifndef SHARED_HANDLERS
AFXPrintPreview(this);
#endif
}
BOOL CLaiPuLaserView::OnPreparePrinting(CPrintInfo* pInfo)
{
// Ĭ<><C4AC>׼<EFBFBD><D7BC>
return DoPreparePrinting(pInfo);
}
void CLaiPuLaserView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
}
void CLaiPuLaserView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
}
#if 1//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̲<EFBFBD><CCB2><EFBFBD>
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
BOOL CLaiPuLaserView::OnMouseWheel(UINT nFlags,short zDelta,CPoint point)
{
if(gDraw->IsbMouseWheel())
{
CClientDC dc(this);
OnPrepareDC(&dc);
dc.DPtoLP(&point);
//<2F>Ȳ<EFBFBD><C8B2><EFBFBD>֮ǰ<D6AE>IJ<EFBFBD>׽<EFBFBD><D7BD>
gMouseToolMgr.ResetCatchPoint(&dc);
if(zDelta > 0)//<2F><><EFBFBD>Ϲ<EFBFBD><CFB9>Ŵ<EFBFBD>
{
DoZoomIn(gDraw->GetCurZoomPoint());
}
else if(zDelta < 0)//<2F><><EFBFBD>¹<EFBFBD><C2B9><EFBFBD>С
{
DoZoomOut(gDraw->GetCurZoomPoint());
}
//<2F><>ʾ<EFBFBD><CABE><EFBFBD>ű<EFBFBD><C5B1><EFBFBD>
CMainFrame *pFrame = (CMainFrame*)AfxGetApp()->GetMainWnd();
pFrame->ShowViewScale(m_zoomScale);
}
return TRUE;
}
void CLaiPuLaserView::OnMouseMove(UINT nFlags, CPoint point)
{
//<2F><>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>Ϊ<EFBFBD><EFBFBD><E8B1B8><EFBFBD><EFBFBD>
CClientDC dc(this);
OnPrepareDC(&dc);
dc.DPtoLP(&point);
gDraw->SetCurZoomPoint(point);//<2F><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>ŵ<EFBFBD>
gDraw->SetbNeedRedraw(true);
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CMainFrame *pFrame = (CMainFrame*)AfxGetApp()->GetMainWnd();
pFrame->ShowMouseCoord(point);
//<2F><><EFBFBD><EFBFBD><EAB9A4>
gMouseToolMgr.OnMouseMove(nFlags,point,dc);
//<2F><><EFBFBD>Ʊ<EFBFBD><C6B1>߹<EFBFBD><DFB9><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
gRuler->DrawMousePos(&dc, point);
CScrollView::OnMouseMove(nFlags, point);
}
void CLaiPuLaserView::OnLButtonDown(UINT nFlags, CPoint point)
{
//<2F><>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>Ϊ<EFBFBD><EFBFBD><E8B1B8><EFBFBD><EFBFBD>
CClientDC dc(this);
OnPrepareDC(&dc);
dc.DPtoLP(&point);
gMouseToolMgr.OnLButtonDown(nFlags,point,dc);
CScrollView::OnLButtonDown(nFlags, point);
}
void CLaiPuLaserView::OnLButtonUp(UINT nFlags, CPoint point)
{
//<2F><>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>Ϊ<EFBFBD><EFBFBD><E8B1B8><EFBFBD><EFBFBD>
CClientDC dc(this);
OnPrepareDC(&dc);
dc.DPtoLP(&point);
gMouseToolMgr.OnLButtonUp(nFlags,point,dc);
CScrollView::OnLButtonUp(nFlags, point);
}
void CLaiPuLaserView::OnRButtonDown(UINT nFlags, CPoint point)
{
//<2F><>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>Ϊ<EFBFBD><EFBFBD><E8B1B8><EFBFBD><EFBFBD>
CClientDC dc(this);
OnPrepareDC(&dc);
dc.DPtoLP(&point);
gMouseToolMgr.OnRButtonDown(nFlags,point,dc);
//CScrollView::OnRButtonDown(nFlags, point);
}
void CLaiPuLaserView::OnRButtonUp(UINT nFlags, CPoint point)
{
//<2F><>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>Ϊ<EFBFBD><EFBFBD><E8B1B8><EFBFBD><EFBFBD>
CClientDC dc(this);
OnPrepareDC(&dc);
dc.DPtoLP(&point);
gMouseToolMgr.OnRButtonUp(nFlags,point,dc);
//CScrollView::OnRButtonUp(nFlags, point);
}
void CLaiPuLaserView::OnMButtonDown(UINT nFlags, CPoint point)
{
}
void CLaiPuLaserView::OnMButtonUp(UINT nFlags, CPoint point)
{
}
//ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
void CLaiPuLaserView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ
if(SB_LINEDOWN == nSBCode || SB_LINEUP == nSBCode)
{
CScrollView::OnHScroll(nSBCode, nPos, pScrollBar);
Invalidate();
}
//<2F>ϵ<EFBFBD>ʱ<EFBFBD><CAB1>
if(SB_THUMBTRACK == nSBCode)
{
CScrollView::OnHScroll(SB_THUMBTRACK, nPos, pScrollBar);
Invalidate();
}
//<2F><><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD>
if(SB_THUMBPOSITION == nSBCode)
{
CScrollView::OnHScroll(SB_THUMBPOSITION, nPos, pScrollBar);
Invalidate();
}
}
//<2F><>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
void CLaiPuLaserView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ
if(SB_LINEDOWN == nSBCode || SB_LINEUP == nSBCode)
{
CScrollView::OnVScroll(nSBCode, nPos, pScrollBar);
Invalidate();
}
//<2F>ϵ<EFBFBD>ʱ<EFBFBD><CAB1>
if(SB_THUMBTRACK == nSBCode)
{
CScrollView::OnVScroll(SB_THUMBTRACK, nPos, pScrollBar);
Invalidate();
}
//<2F><><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD>
if(SB_THUMBPOSITION == nSBCode)
{
CScrollView::OnVScroll(SB_THUMBPOSITION, nPos, pScrollBar);
Invalidate();
}
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ
BOOL CLaiPuLaserView::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_KEYDOWN)
{
char c = pMsg->wParam;
switch(c)
{
case VK_CONTROL:
m_bCtrl = true;
OnCtrl();
break;
case 'A'://ctrl + A ȫѡ
if(m_bCtrl)
{
OnSelAllObj();
}
break;
case 'Z'://ctrl + Z <20><><EFBFBD><EFBFBD>
if(m_bCtrl)
{
OnUndo();
}
break;
case 'Y'://ctrl + Y <20><><EFBFBD><EFBFBD>
if(m_bCtrl)
{
OnRedo();
}
break;
case 'S'://ctrl + S <20><><EFBFBD><EFBFBD>
if(m_bCtrl)
{
//<2F><><EFBFBD><EFBFBD>
}
break;
case VK_SPACE:
OnSpace();
break;
case VK_ESCAPE://Esc <20><>
OnEscape();
break;
case VK_DELETE://ɾ<><C9BE>
OnDelSelObj();
break;
case VK_UP:
OnArrowDir(_DIR_U);
break;
case VK_DOWN:
OnArrowDir(_DIR_D);
break;
case VK_LEFT:
OnArrowDir(_DIR_L);
break;
case VK_RIGHT:
OnArrowDir(_DIR_R);
break;
default:
break;
}
}
if(pMsg->message==WM_KEYUP)
{
switch(pMsg->wParam)
{
case VK_CONTROL:
m_bCtrl = false;
break;
default:
break;
}
}
return CScrollView::PreTranslateMessage(pMsg);
}
//ESC <20><><EFBFBD><EFBFBD>Ӧ
void CLaiPuLaserView::OnEscape()
{
CClientDC dc(this);
OnPrepareDC(&dc);
gMouseToolMgr.OnEscapeKey(&dc);
gLayer.NotSelAllObj();//obj ȫ<><C8AB>ѡ
gMouseToolMgr.SetMouseTool(_TOOL_POINT);
GetFrame()->ResetCaptionBar();
RefreshView();
gLogMgr->WriteDebugLog("OnEscape");
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ
void CLaiPuLaserView::MoveObjToPtByDir(DIRECTION dir,double Dis)
{
double MoveDisX = 0;
double MoveDisY = 0;
switch(dir)
{
case _DIR_L:
MoveDisX -= Dis;
break;
case _DIR_R:
MoveDisX += Dis;
break;
case _DIR_U:
MoveDisY += Dis;
break;
case _DIR_D:
MoveDisY -= Dis;
break;
default:
break;
}
gLayer.OnMove(MoveDisX,MoveDisY);
RefreshView();
}
#endif
#if 1//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void CLaiPuLaserView::OnArrowDir(DIRECTION dir)
{
MoveObjToPtByDir(dir,gDraw->GetKeyboardMoveDis());
}
//<2F>ո<EFBFBD><D5B8><EFBFBD>
void CLaiPuLaserView::OnSpace()
{
}
void CLaiPuLaserView::OnCtrl()
{
}
#endif
void CLaiPuLaserView::OnContextMenu(CWnd* /* pWnd */, CPoint point)
{
#ifndef SHARED_HANDLERS
theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_EDIT, point.x, point.y, this, TRUE);
#endif
}
// CLaiPuLaserView <20><><EFBFBD><EFBFBD>
#ifdef _DEBUG
void CLaiPuLaserView::AssertValid() const
{
CView::AssertValid();
}
void CLaiPuLaserView::Dump(CDumpContext& dc) const
{
CScrollView::Dump(dc);
}
CLaiPuLaserDoc* CLaiPuLaserView::GetDocument() const // <20>ǵ<EFBFBD><C7B5>԰汾<D4B0><E6B1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CLaiPuLaserDoc)));
return (CLaiPuLaserDoc*)m_pDocument;
}
#endif //_DEBUG
#if 1//view <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/*---------------------------------------------------------------------------
FUNCTION: SetZoomSizes
PURPOSE : Set up the CLaiPuLaserView class with the logical page size, and
scrolling page/line units.
This replaces CScrollView::SetScrollSizes.
---------------------------------------------------------------------------*/
void CLaiPuLaserView::SetZoomSizes (SIZE sizeTotal,const SIZE& sizePage,const SIZE& sizeLine)
{
// Set up the defaults
ASSERT(sizeTotal.cx >= 0 && sizeTotal.cy >= 0);
m_nMapMode = MM_ANISOTROPIC; // Need for arbitrary scaling
m_totalLog = sizeTotal;
// Setup default Viewport extent to be conversion of Window extent
// into device units.
//BLOCK for DC
{
CWindowDC dc(NULL);
dc.SetMapMode(m_nMapMode);
// total size
m_totalDev = m_totalLog;
dc.LPtoDP((LPPOINT)&m_totalDev);
} // Release DC here
// Save the origional Viewport Extent
m_origTotalDev = m_totalDev;
// Save the origional scrollbar info - for CalcBars
m_origPageDev = sizePage;
m_origLineDev = sizeLine;
// Fugure out scroll bar info
CalcBars();
// Notify the class that the zoom scale was set
NotifyZoom();
} // SetZoomSizes
/*---------------------------------------------------------------------------
FUNCTION: OnPrepareDC
PURPOSE : Override of CScrollView for MM_ANISOTROPIC zoom mode
---------------------------------------------------------------------------*/
void CLaiPuLaserView::OnPrepareDC (CDC* pDC,CPrintInfo* pInfo)
{
#ifdef _DEBUG
if (m_nMapMode != MM_ANISOTROPIC) {
TRACE0("Error: must call SetZoomSizes() before painting zoom view\n");
ASSERT(FALSE);
return;
}
#endif //_DEBUG
ASSERT_VALID(pDC);
ASSERT(m_totalLog.cx >= 0 && m_totalLog.cy >= 0);
ASSERT(m_totalDev.cx >= 0 && m_totalDev.cy >= 0);
// Set the Mapping mode, and the window and viewport extents
pDC->SetMapMode(m_nMapMode);//<2F>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><D3B3>ģʽ
pDC->SetViewportExt(m_totalDev); // in device coordinates
pDC->SetWindowExt(m_totalLog);// in logical coordinates
CPoint ptVpOrg;
// by default shift viewport origin in negative direction of scroll
ASSERT(pDC->GetWindowOrg() == CPoint(0,0));
ptVpOrg = -GetDeviceScrollPosition();
// Center full fit
CRect rect;
GetClientRect(&rect);
// if client area is larger than total device size,
// override scroll positions to place origin such that
// output is centered in the window
if (m_totalDev.cx < rect.Width())
ptVpOrg.x = (rect.Width() - m_totalDev.cx) / 2;
if (m_totalDev.cy < rect.Height())
ptVpOrg.y = (rect.Height() - m_totalDev.cy) / 2;
// Set the new origin
pDC->SetViewportOrg(ptVpOrg);
// For default Printing behavior
CScrollView::OnPrepareDC(pDC, pInfo);
} // OnPrepareDC
/*---------------------------------------------------------------------------
FUNCTION: CalcBars
PURPOSE : Update the scrollbars - uses logical units
Call when the Viewport changes size.
---------------------------------------------------------------------------*/
void CLaiPuLaserView::CalcBars (void)
{
{ // BLOCK for DC
CWindowDC dc(NULL);
dc.SetMapMode(m_nMapMode);
// Calculate new device units for scrollbar
// Start with origional logical units from SetScrollPos
m_pageDev = m_origPageDev;
dc.LPtoDP((LPPOINT)&m_pageDev);
m_lineDev = m_origLineDev;
dc.LPtoDP((LPPOINT)&m_lineDev);
} // Free DC
// Make sure of the range
if (m_pageDev.cy < 0) m_pageDev.cy = -m_pageDev.cy;
if (m_lineDev.cy < 0) m_lineDev.cy = -m_lineDev.cy;
// If none specified - use one tenth
ASSERT(m_totalDev.cx >= 0 && m_totalDev.cy >= 0);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>еľ<D0B5><C4BE><EFBFBD>
//double Scale = m_zoomScale/DEFAULT_SCALE;
double Scale = m_zoomScale/VIEW_SCALE20;
double min = 10;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>
double max = 500;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
double val = 20*Scale;
if(val<min)
{
val = min;
}
if(val>max)
{
val = max;
}
if(m_pageDev.cx == 0)
m_pageDev.cx = m_totalDev.cx/val;
if(m_pageDev.cy == 0)
m_pageDev.cy = m_totalDev.cy/val;
if(m_lineDev.cx == 0)
m_lineDev.cx = m_pageDev.cx /val;
if(m_lineDev.cy == 0)
m_lineDev.cy = m_pageDev.cy /val;
// Now update the scrollbars
if (m_hWnd != NULL)
{
UpdateBars();
Invalidate(TRUE); // Zoom scale changed, redraw all
}
} // CalcBars
//<2F>Ŵ<EFBFBD>
int CLaiPuLaserView::DoZoomIn(CPoint Point)
{
CPoint ptCenter;
ASSERT(m_nMapMode == MM_ANISOTROPIC);
CPoint CurPt = GetScreenCenterPoint();
double Scale = gDraw->GetMouseWheelScale();
// Save the current center point.
ptCenter.x = CurPt.x+(Point.x-CurPt.x)*(Scale-1);
ptCenter.y = CurPt.y+(Point.y-CurPt.y)*(Scale-1);
// Increase the zoom scale.
if(m_zoomScale<MAX_SCALE)
m_zoomScale *= Scale;
else
return TRUE;
// Modify the Viewport extent
m_totalDev.cx = (int) ((double) m_origTotalDev.cx * m_zoomScale);
m_totalDev.cy = (int) ((double) m_origTotalDev.cy * m_zoomScale);
CalcBars();
// Set the current center point.
CenterOnLogicalPoint(ptCenter);
// Notify the class that a new zoom scale was done
NotifyZoom();
return TRUE;
}
//<2F><>С
int CLaiPuLaserView::DoZoomOut(CPoint Point)
{
CPoint ptCenter;
ASSERT(m_nMapMode == MM_ANISOTROPIC);
CPoint CurPt = GetScreenCenterPoint();
double Scale = gDraw->GetMouseWheelScale();
// Save the current center point.
ptCenter.x = CurPt.x-(Point.x-CurPt.x)*(Scale-1);
ptCenter.y = CurPt.y-(Point.y-CurPt.y)*(Scale-1);
// Decrease the zoom scale.
if(m_zoomScale>MIN_SCALE)
m_zoomScale /= Scale;
else
return TRUE;
// Modify the Viewport extent
m_totalDev.cx = (int) ((double) m_origTotalDev.cx * m_zoomScale);
m_totalDev.cy = (int) ((double) m_origTotalDev.cy * m_zoomScale);
CalcBars();
// Set the current center point (logical coordinates.
CenterOnLogicalPoint(ptCenter);
// Notify the class that a new zoom scale was done
NotifyZoom();
return TRUE;
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۲<EFBFBD>(<28><><EFBFBD>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܻ<EFBFBD><DCBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
int CLaiPuLaserView::DoZoomFull(void)
{
RectView(gDraw->GetWorkAreaViewScale());
return TRUE;
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۲<EFBFBD>
void CLaiPuLaserView::RectView(double scale,Dbxy pt)
{
ASSERT(m_nMapMode == MM_ANISOTROPIC);
CRect rect;
CPoint point = gDraw->Dbxy2CPoint(pt);
//<2F><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>
m_zoomScale = scale;
// Modify the Viewport extent
m_totalDev.cx = (int) ((double) m_origTotalDev.cx * m_zoomScale);
m_totalDev.cy = (int) ((double) m_origTotalDev.cy * m_zoomScale);
CalcBars();
// Set the current center point.
CenterOnLogicalPoint(point);
// Notify the class that a new zoom scale was done
NotifyZoom();
}
/*---------------------------------------------------------------------------
FUNCTION: CenterOnLogicalPoint
PURPOSE : Same as CScrollView::CenterOnPoint, but for logical coordinates
---------------------------------------------------------------------------*/
void CLaiPuLaserView::CenterOnLogicalPoint(CPoint pt)
{
//Convert the point to device coordinates
ViewLPtoDP(&pt);
// Account for scroll bar position
ClientToDevice(pt);
// Use CScrollView's function for device coordinates
CScrollView::CenterOnPoint(pt);
} // CenterOnLogicalPoint
/*---------------------------------------------------------------------------
FUNCTION: GetLogicalCenterPoint
PURPOSE : Get the center of screen in logical coordinates
---------------------------------------------------------------------------*/
CPoint CLaiPuLaserView::GetLogicalCenterPoint (void) // Point in logical units
{
CPoint pt;
CRect rect;
// Get the center of screen
GetClientRect(&rect);
pt.x = (rect.Width() / 2);
pt.y = (rect.Height() / 2);
// Convert the point to logical coordinates
ViewDPtoLP(&pt);
return pt;
} // GetLogicalCenterPoint
/*---------------------------------------------------------------------------
FUNCTION: ViewDPtoLP
PURPOSE : Same as DPtoLP, but gets the Client DC for the view
---------------------------------------------------------------------------*/
void CLaiPuLaserView::ViewDPtoLP (
LPPOINT lpPoints,
int nCount)
{
// Convert to logical units
// Called from View when no DC is available
ASSERT(m_nMapMode > 0); // must be set
CWindowDC dc(this);
OnPrepareDC(&dc);
dc.DPtoLP(lpPoints, nCount);
} // ViewDPtoLP
/*---------------------------------------------------------------------------
FUNCTION: ViewLPtoDP
PURPOSE : Same as LPtoDP, but gets the Client DC for the view
---------------------------------------------------------------------------*/
void CLaiPuLaserView::ViewLPtoDP (
LPPOINT lpPoints,
int nCount)
{
// Convert to logical units
// Called from View when no DC is available
ASSERT(m_nMapMode > 0); // must be set
CWindowDC dc(this);
OnPrepareDC(&dc);
dc.LPtoDP(lpPoints, nCount);
} // ViewLPtoDP
/*---------------------------------------------------------------------------
FUNCTION: ClientToDevice
PURPOSE : Convert from Client coordinates to relative Device coordinates
---------------------------------------------------------------------------*/
void CLaiPuLaserView::ClientToDevice (
CPoint &point)
{
// Need to account for scrollbar position
CPoint scrollPt = GetDeviceScrollPosition();
point.x += scrollPt.x;
point.y += scrollPt.y;
} // ClientToDevice
/*---------------------------------------------------------------------------
FUNCTION: NormalizeRect
PURPOSE : Normalize the rectangle
---------------------------------------------------------------------------*/
void CLaiPuLaserView::NormalizeRect (
CRect &rect)
{
if (rect.left > rect.right) {
int r = rect.right;
rect.right = rect.left;
rect.left = r;
}
if (rect.top > rect.bottom) {
int b = rect.bottom;
rect.bottom = rect.top;
rect.top = b;
}
} // NormalizeRect
/*---------------------------------------------------------------------------
FUNCTION: PersistRatio
PURPOSE : Make a CSize maintain the given ratio (by shrinking if nescessary)
---------------------------------------------------------------------------*/
void CLaiPuLaserView::PersistRatio (
const CSize &orig,
CSize &dest,
CPoint &remainder)
{
double ratio1 = (double) orig.cx / orig.cy;
double ratio2 = (double) dest.cx / dest.cy;
int newSize;
// Do nothing if they are the same
if (ratio1 > ratio2)
{
// Shrink hieght
newSize = (int)(dest.cx / ratio1);
remainder.x = 0;
remainder.y = dest.cy - newSize;
dest.cy = newSize;
} else if (ratio2 > ratio1)
{
// Shrink width
newSize = (int)(dest.cy * ratio1);
remainder.x = dest.cx - newSize;
remainder.y = 0;
dest.cx = newSize;
}
} // PersistRatio
//<2F><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
int CLaiPuLaserView::GetCurrScaleVal(int val)
{
return (val/m_zoomScale);
}
double CLaiPuLaserView::GetCurrScaleVal(double val)
{
return (val/m_zoomScale);
}
#endif
#if 1//<2F><>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>
//<2F>Ŵ<EFBFBD>
void CLaiPuLaserView::OnZoomIn()
{
DoZoomIn(GetScreenCenterPoint());
}
void CLaiPuLaserView::OnZoomOut()
{
DoZoomOut(GetScreenCenterPoint());
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۲<EFBFBD>
void CLaiPuLaserView::OnWorkSpaceView()
{
DoZoomFull();
}
#endif
#if 1//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void CLaiPuLaserView::OnUndo()
{
gCommandMgr.Undo();
RefreshView();
//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gMarkObjPropertieMgr->UpdateSelMarkObjPropertie();
}
void CLaiPuLaserView::OnUpdateUndo(CCmdUI* pCmdUI)
{
if(gCommandMgr.HasUndoCmd())
{
pCmdUI->Enable(true);
}
else
{
pCmdUI->Enable(false);
}
pCmdUI->SetCheck(false);
}
void CLaiPuLaserView::OnRedo()
{
gCommandMgr.Redo();
RefreshView();
//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gMarkObjPropertieMgr->UpdateSelMarkObjPropertie();
}
void CLaiPuLaserView::OnUpdateRedo(CCmdUI* pCmdUI)
{
if(gCommandMgr.HasRedoCmd())
{
pCmdUI->Enable(true);
}
else
{
pCmdUI->Enable(false);
}
pCmdUI->SetCheck(false);
}
#endif
#if 1//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void CLaiPuLaserView::OnToolPoint()
{
gMouseToolMgr.SetMouseTool(_TOOL_POINT);
}
void CLaiPuLaserView::OnToolRect()
{
gMouseToolMgr.SetMouseTool(_TOOL_RECT);
gLayer.SelAllObj();
gLayer.RevSelAllObj();
RefreshView();
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gMarkObjPropertieMgr->UpdateSelMarkObjPropertie();
}
void CLaiPuLaserView::OnUpdateToolRect(CCmdUI* pCmdUI)
{
pCmdUI->Enable(true);
pCmdUI->SetCheck(gMouseToolMgr.GetToolType()==_TOOL_RECT?1:0);
}
//<2F><><EFBFBD><EFBFBD>
void CLaiPuLaserView::OnToolOnePoint()
{
gMouseToolMgr.SetMouseTool(_TOOL_ONE_POINT);
gLayer.SelAllObj();
gLayer.RevSelAllObj();
RefreshView();
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gMarkObjPropertieMgr->UpdateSelMarkObjPropertie();
}
void CLaiPuLaserView::OnUpdateToolOnePoint(CCmdUI* pCmdUI)
{
pCmdUI->Enable(true);
pCmdUI->SetCheck(gMouseToolMgr.GetToolType()==_TOOL_ONE_POINT?1:0);
}
void CLaiPuLaserView::OnToolLaserCoord()
{
gMouseToolMgr.SetMouseTool(_TOOL_LASER_COORD);
RefreshView();
}
void CLaiPuLaserView::OnUpdateToolLaserCoord(CCmdUI* pCmdUI)
{
pCmdUI->Enable(false);
pCmdUI->SetCheck(gMouseToolMgr.GetToolType()==_TOOL_LASER_COORD?1:0);
}
void CLaiPuLaserView::OnToolPolygon()
{
}
void CLaiPuLaserView::OnUpdateToolPolygon(CCmdUI* pCmdUI)
{
}
void CLaiPuLaserView::OnToolCircle()
{
gMouseToolMgr.SetMouseTool(_TOOL_CIRCLE);
gLayer.SelAllObj();
gLayer.RevSelAllObj();
RefreshView();
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gMarkObjPropertieMgr->UpdateSelMarkObjPropertie();
}
void CLaiPuLaserView::OnUpdateToolCircle(CCmdUI* pCmdUI)
{
pCmdUI->Enable(true);
pCmdUI->SetCheck(gMouseToolMgr.GetToolType()==_TOOL_CIRCLE?1:0);
}
void CLaiPuLaserView::OnToolLine()
{
gMouseToolMgr.SetMouseTool(_TOOL_LINE);
gLayer.SelAllObj();
gLayer.RevSelAllObj();
RefreshView();
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gMarkObjPropertieMgr->UpdateSelMarkObjPropertie();
}
void CLaiPuLaserView::OnUpdateToolLine(CCmdUI* pCmdUI)
{
pCmdUI->Enable(true);
pCmdUI->SetCheck(gMouseToolMgr.GetToolType()==_TOOL_LINE?1:0);
}
void CLaiPuLaserView::OnToolPline()
{
gMouseToolMgr.SetMouseTool(_TOOL_PLINE);
gLayer.SelAllObj();
gLayer.RevSelAllObj();
RefreshView();
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gMarkObjPropertieMgr->UpdateSelMarkObjPropertie();
}
void CLaiPuLaserView::OnUpdateToolPline(CCmdUI* pCmdUI)
{
pCmdUI->Enable(true);
pCmdUI->SetCheck(gMouseToolMgr.GetToolType()==_TOOL_PLINE?1:0);
}
#endif
#if 1//ͼ<>β<EFBFBD><CEB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void CLaiPuLaserView::OnUpdateObjOperate(CCmdUI* pCmdUI)
{
if(gLayer.HasObjSel())
{
pCmdUI->Enable(true);
}
else
{
pCmdUI->Enable(false);
}
}
void CLaiPuLaserView::OnSelAllObj()
{
if(gDraw->IsEditLayerObj())
{
gLayer.SelAllObj();
RefreshView();
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gMarkObjPropertieMgr->UpdateSelMarkObjPropertie();
}
}
void CLaiPuLaserView::OnMoveToCenter()
{
MoveSelObjToCenter();
}
void CLaiPuLaserView::MoveSelObjToCenter()
{
CLayer & layer = gLayer;
Dbxy pt = layer.GetSelObjRect().GetCenterPt();
layer.OnMove(pt.x*(-1),pt.y*(-1));
RefreshView();
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gMarkObjPropertieMgr->UpdateSelMarkObjPropertie();
}
//<2F><>ѡ
void CLaiPuLaserView::OnRevSelObj()
{
if(gDraw->IsEditLayerObj())
{
gLayer.RevSelAllObj();
RefreshView();
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gMarkObjPropertieMgr->UpdateSelMarkObjPropertie();
}
}
void CLaiPuLaserView::OnDelSelObj()
{
CLayer &layer = gLayer;
if(layer.HasObjSel())
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
CCommandDelete *pCmd = new CCommandDelete;
gCommandMgr.AddUndoCommand(pCmd);
pCmd->Excute();
RefreshView();
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gMarkObjPropertieMgr->UpdateSelMarkObjPropertie();
}
}
//ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD>
void CLaiPuLaserView::OnMirrorH()
{
gLayer.OnMirror(_X);
RefreshView();
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gMarkObjPropertieMgr->UpdateSelMarkObjPropertie();
}
//<2F><>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD>
void CLaiPuLaserView::OnMirrorV()
{
gLayer.OnMirror(_Y);
RefreshView();
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gMarkObjPropertieMgr->UpdateSelMarkObjPropertie();
}
//<2F><><EFBFBD><EFBFBD>ת90<39><30>
void CLaiPuLaserView::OnRotato90L()
{
gLayer.OnRotato(90);
RefreshView();
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gMarkObjPropertieMgr->UpdateSelMarkObjPropertie();
}
void CLaiPuLaserView::OnRotato90R()
{
gLayer.OnRotato(-90);
RefreshView();
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gMarkObjPropertieMgr->UpdateSelMarkObjPropertie();
}
void CLaiPuLaserView::OnToolRotato()
{
gMouseToolMgr.SetMouseTool(_TOOL_ROTATO);
}
void CLaiPuLaserView::OnCut()
{
gMouseToolMgr.SetMouseTool(_TOOL_CUT);
gLayer.SelAllObj();
gLayer.RevSelAllObj();
RefreshView();
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gMarkObjPropertieMgr->UpdateSelMarkObjPropertie();
}
//<2F><><EFBFBD>Ͻڵ<CFBD>
void CLaiPuLaserView::OnBreak()
{
gMouseToolMgr.SetMouseTool(_TOOL_BREAK_NODE);
}
void CLaiPuLaserView::OnChamfer()
{
}
void CLaiPuLaserView::OnFillet()
{
}
//<2F>ֽ<EFBFBD>
void CLaiPuLaserView::OnExplode()
{
gLayer.OnExplode();
RefreshView();
}
//<2F>ϲ<EFBFBD>
void CLaiPuLaserView::OnJoin()
{
if(gLayer.OnJoin())
{
RefreshView();
gLogMgr->WriteDebugLog("OnJoin ----OK ");
}
else
{
gLogMgr->WriteDebugLog("OnJoin ----Err ");
}
}
void CLaiPuLaserView::OnCopy()
{
gMouseToolMgr.SetMouseTool(_TOOL_COPY);
}
void CLaiPuLaserView::OnMove()
{
gMouseToolMgr.SetMouseTool(_TOOL_MOVE2);
}
//<2F><>ת
void CLaiPuLaserView::OnReverse()
{
gLayer.OnReverseSelObj();
RefreshView();
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gMarkObjPropertieMgr->UpdateSelMarkObjPropertie();
}
void CLaiPuLaserView::OnAddNode()
{
gMouseToolMgr.SetMouseTool(_TOOL_ADD_NODE);
RefreshView();
}
void CLaiPuLaserView::OnDelNode()
{
gMouseToolMgr.SetMouseTool(_TOOL_DEL_NODE);
RefreshView();
}
void CLaiPuLaserView::OnMeasure()
{
gMouseToolMgr.SetMouseTool(_TOOL_MEASURE);
gLayer.SelAllObj();
gLayer.RevSelAllObj();
RefreshView();
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gMarkObjPropertieMgr->UpdateSelMarkObjPropertie();
}
//<2F><><EFBFBD><EFBFBD>
void CLaiPuLaserView::OnArray()
{
CDlgArray dlg;
if(dlg.DoModal()==IDOK)
{
RefreshView();
}
}
void CLaiPuLaserView::OnObjFill()
{
}
#endif
#if 1
//<2F><><EFBFBD><EFBFBD>view <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
BOOL CLaiPuLaserView::OnEraseBkgnd(CDC *pDC)
{
if(m_bEraseBkgnd2&&m_bEraseBkgnd)
{
CScrollView::OnEraseBkgnd(pDC);
CRect rect;
GetClientRect(rect);
CBrush BkgndBrush;
COLORREF color = RGB_BLACK;
color = gDraw->GetBkgndColor();
BkgndBrush.CreateSolidBrush(color);
pDC->FillRect(&rect,&BkgndBrush);
}
m_bEraseBkgnd = true;//<2F>ָ<EFBFBD>
return TRUE;
}
BOOL CLaiPuLaserView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
return true;
}
//<2F>ػ<EFBFBD>view
void CLaiPuLaserView::RefreshView()
{
#if 1
if(gDraw->IsbDlgLayerViewShow())
{
CString WndName = "Wafer View";
CString WndMsg = "Invalidate";
SendMsgToWnd(WndName,WndMsg);
}
else
{
//<2F><>Ҫ<EFBFBD>ڱ༭<DAB1><E0BCAD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2>
if(gDraw->IsbObjEditMode())
{
gCriticalSection_ViewInvalidate.Lock();
gLogMgr->WriteDebugLog("RefreshView");
Invalidate();
gCriticalSection_ViewInvalidate.Unlock();
}
}
#else
Invalidate();
#endif
}
CPoint CLaiPuLaserView::GetScreenCenterPoint()
{
CClientDC dc(this);
OnPrepareDC(&dc);
//<2F><>ȡ<EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>Χ
CRect rect;
GetClientRect(&rect);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD>ڿͻ<DABF><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
dc.DPtoLP(rect);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>
CPoint Cpoint;
Cpoint.x = (rect.left + (rect.right-rect.left)/2);
Cpoint.y = (rect.top + (rect.bottom-rect.top)/2);
return Cpoint;
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Χ
void CLaiPuLaserView::LimitCursor()
{
CRect rect;
GetClientRect(&rect);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD>ڿͻ<DABF><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ClientToScreen(&rect);//<2F><><EFBFBD><EFBFBD><EFBFBD>ε<EFBFBD><CEB5>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>
ClipCursor(&rect);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Χ
}
//<2F>ͷŶ<CDB7><C5B6><EFBFBD><EFBFBD>Χ<EAB7B6><CEA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void CLaiPuLaserView::ReleseLimitCursor()
{
ClipCursor(NULL);//<2F>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void CLaiPuLaserView::SetCursorStyle(MOUSE_TOOL type)
{
switch(type)
{
case _TOOL_POINT:
SetCursor(AfxGetApp()->LoadCursor(IDC_MOUSE_POINT));
break;
case _TOOL_RECT:
case _TOOL_LINE:
case _TOOL_PLINE:
case _TOOL_CIRCLE:
case _TOOL_MOVE2:
case _TOOL_ROTATO:
case _TOOL_COPY:
case _TOOL_MEASURE:
case _TOOL_ONE_POINT:
case _TOOL_LASER_COORD:
case _TOOL_PT_MOVE_TO_CCD:
case _TOOL_SET_MARK_PT:
SetCursor(AfxGetApp()->LoadCursor(IDC_MOUSE_DRAW));
break;
case _TOOL_TEXT:
case _TOOL_BARCODE:
SetCursor(AfxGetApp()->LoadCursor(IDC_MOUSE_TXT));
break;
case _TOOL_MOVE:
SetCursor(AfxGetApp()->LoadCursor(IDC_MOUSE_MOVE));
break;
case _TOOL_CUT:
case _TOOL_ADD_NODE:
case _TOOL_DEL_NODE:
case _TOOL_BREAK_NODE:
SetCursor(AfxGetApp()->LoadCursor(IDC_MOUSE_NODE));
break;
case _TOOL_MOVE_NODE:
case _TOOL_STRETCH:
SetCursor(AfxGetApp()->LoadCursor(IDC_MOUSE_HAND));
break;
default:
break;
}
}
#endif