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.
219 lines
7.8 KiB
C++
219 lines
7.8 KiB
C++
|
|
// LaiPuLaserView.h : CLaiPuLaserView 类的接口
|
|
//
|
|
|
|
#pragma once
|
|
#include "LaiPuLaserDoc.h"
|
|
#include "EnumDirection.h"
|
|
#include "GlobalDefine.h"
|
|
|
|
#if 1//view 缩放
|
|
#define VIEW_SCALE1 (0.000097)
|
|
#define VIEW_SCALE2 (0.000121)
|
|
#define VIEW_SCALE3 (0.000151)
|
|
#define VIEW_SCALE4 (0.000189)
|
|
#define VIEW_SCALE5 (0.000236)
|
|
#define VIEW_SCALE6 (0.000295)
|
|
#define VIEW_SCALE7 (0.000369)
|
|
#define VIEW_SCALE8 (0.000461)
|
|
#define VIEW_SCALE9 (0.000576)
|
|
#define VIEW_SCALE10 (0.000721)
|
|
#define VIEW_SCALE11 (0.000901)
|
|
#define VIEW_SCALE12 (0.001126)
|
|
#define VIEW_SCALE13 (0.001407)
|
|
#define VIEW_SCALE14 (0.001759)
|
|
#define VIEW_SCALE15 (0.002199)
|
|
#define VIEW_SCALE16 (0.002749)
|
|
#define VIEW_SCALE17 (0.003436)
|
|
#define VIEW_SCALE18 (0.004295)
|
|
#define VIEW_SCALE19 (0.005369)
|
|
#define VIEW_SCALE20 (0.006711)
|
|
#define VIEW_SCALE21 (0.008389)
|
|
#define VIEW_SCALE22 (0.010486)
|
|
#define VIEW_SCALE23 (0.013107)
|
|
#define VIEW_SCALE24 (0.016384)
|
|
#define VIEW_SCALE25 (0.020480)
|
|
#define VIEW_SCALE26 (0.025600)
|
|
#define VIEW_SCALE27 (0.032001)
|
|
#define VIEW_SCALE28 (0.040001)
|
|
#define VIEW_SCALE29 (0.050001)
|
|
#define VIEW_SCALE30 (0.062501)
|
|
#define VIEW_SCALE31 (0.078126)
|
|
#define VIEW_SCALE32 (0.097658)
|
|
#define VIEW_SCALE33 (0.122072)
|
|
#define VIEW_SCALE34 (0.152590)
|
|
#define VIEW_SCALE35 (0.190738)
|
|
#define VIEW_SCALE36 (0.238423)
|
|
#define VIEW_SCALE37 (0.298028)
|
|
#define VIEW_SCALE38 (0.372535)
|
|
#define VIEW_SCALE39 (0.465669)
|
|
#define VIEW_SCALE40 (0.582086)
|
|
#define VIEW_SCALE41 (0.727608)
|
|
#define VIEW_SCALE42 (0.909510)
|
|
#define VIEW_SCALE43 (1.136887)
|
|
#define VIEW_SCALE44 (1.421109)
|
|
#define VIEW_SCALE45 (1.776387)
|
|
#define VIEW_SCALE46 (2.220483)
|
|
#define VIEW_SCALE47 (2.775604)
|
|
#define VIEW_SCALE48 (3.469505)
|
|
#define DEFAULT_SCALE VIEW_SCALE17 //初始view的缩放比例
|
|
#define SCALE_ONE_TIME (1.25) //每次缩放倍数
|
|
#define MAX_SCALE (3.0) //最大放大倍数
|
|
#define MIN_SCALE VIEW_SCALE1 //最小缩小倍数
|
|
#endif
|
|
|
|
|
|
class CLaiPuLaserView : public CScrollView
|
|
{
|
|
protected: // 仅从序列化创建
|
|
CLaiPuLaserView();
|
|
DECLARE_DYNCREATE(CLaiPuLaserView)
|
|
// 重写
|
|
public:
|
|
virtual void OnDraw(CDC* pDC); // 重写以绘制该视图
|
|
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
|
virtual void OnInitialUpdate();
|
|
virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL);
|
|
void LimitCursor();
|
|
void ReleseLimitCursor();
|
|
HDC GetHDC();
|
|
CDC* GetCDC();
|
|
afx_msg BOOL PreTranslateMessage(MSG* pMsg);
|
|
protected:
|
|
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
|
|
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
|
|
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
|
|
// 实现
|
|
public:
|
|
virtual ~CLaiPuLaserView();
|
|
#ifdef _DEBUG
|
|
virtual void AssertValid() const;
|
|
virtual void Dump(CDumpContext& dc) const;
|
|
#endif
|
|
|
|
// 操作
|
|
public:
|
|
CLaiPuLaserDoc* GetDocument() const;
|
|
int GetCurrScaleVal(int val);//单位是像素
|
|
double GetCurrScaleVal(double val);//单位:毫米
|
|
void RefreshView();
|
|
void OnEscape();
|
|
void MoveObjToPtByDir(DIRECTION dir,double Dis);
|
|
afx_msg BOOL OnMouseWheel(UINT nFlags,short zDelta,CPoint pt);
|
|
double GetCurZoomScale(){return m_zoomScale;};
|
|
afx_msg void OnZoomIn();
|
|
afx_msg void OnZoomOut();
|
|
void SetCursorStyle(MOUSE_TOOL type);
|
|
int DoZoomFull();
|
|
void RectView(double scale,Dbxy pt = Dbxy(0,0));
|
|
void NotEraseBkgndOneTime(){m_bEraseBkgnd = false;};
|
|
void MoveSelObjToCenter();
|
|
void SetbEraseBkgnd(bool b){m_bEraseBkgnd2 = b;}
|
|
afx_msg BOOL OnEraseBkgnd(CDC* pDC);//背景颜色
|
|
private:
|
|
void OnArrowDir(DIRECTION dir);
|
|
void OnSpace();
|
|
void OnCtrl();
|
|
private:
|
|
bool m_bFirstIn;//是否第一次进入
|
|
bool m_bCtrl;//ctrl 键是否按下
|
|
bool m_bEraseBkgnd;//是否重绘背景色(这个标志位每次会自动恢复)
|
|
bool m_bEraseBkgnd2;//是否重绘背景色(不会自动恢复)
|
|
private:
|
|
#if 1//view 缩放用
|
|
void SetZoomSizes(SIZE sizeTotal, const SIZE& sizePage = sizeDefault, const SIZE& sizeLine = sizeDefault);
|
|
void CenterOnLogicalPoint(CPoint ptCenter);
|
|
CPoint GetLogicalCenterPoint(void);
|
|
|
|
// Zooming functions
|
|
int DoZoomIn(CPoint CenterPoint);
|
|
int DoZoomOut(CPoint CenterPoint);
|
|
|
|
|
|
// Override this to get notified of zoom scale change
|
|
virtual void NotifyZoom(void) {};
|
|
|
|
// Zooming utility functions
|
|
void ViewDPtoLP (LPPOINT lpPoints, int nCount = 1);
|
|
void ViewLPtoDP (LPPOINT lpPoints, int nCount = 1);
|
|
void ClientToDevice(CPoint &point);
|
|
void NormalizeRect(CRect &rect);
|
|
void PersistRatio(const CSize &orig, CSize &dest, CPoint &remainder);
|
|
void CalcBars(void);
|
|
CRect m_ptDragRect;
|
|
CSize m_origTotalDev; // Origional total size in device units
|
|
CSize m_origPageDev; // Origional per page scroll size in device units
|
|
CSize m_origLineDev; // Origional per line scroll size in device units
|
|
double m_zoomScale;//当前缩放比例
|
|
#endif
|
|
CPoint GetScreenCenterPoint();
|
|
|
|
// 生成的消息映射函数
|
|
protected:
|
|
afx_msg void OnFilePrintPreview();
|
|
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
|
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
|
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
|
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
|
|
afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
|
|
afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
|
|
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
|
|
|
|
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
|
|
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
|
|
|
|
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
|
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
|
|
afx_msg void OnToolPoint();
|
|
afx_msg void OnUndo();
|
|
afx_msg void OnArray();
|
|
afx_msg void OnCut();
|
|
afx_msg void OnReverse();
|
|
afx_msg void OnAddNode();
|
|
afx_msg void OnDelNode();
|
|
afx_msg void OnBreak();
|
|
afx_msg void OnChamfer();
|
|
afx_msg void OnFillet();
|
|
afx_msg void OnExplode();
|
|
afx_msg void OnMeasure();
|
|
afx_msg void OnJoin();
|
|
afx_msg void OnUpdateUndo(CCmdUI* pCmdUI);
|
|
afx_msg void OnRedo();
|
|
afx_msg void OnUpdateRedo(CCmdUI* pCmdUI);
|
|
afx_msg void OnToolRect();
|
|
afx_msg void OnUpdateToolRect(CCmdUI* pCmdUI);
|
|
afx_msg void OnToolOnePoint();
|
|
afx_msg void OnUpdateToolOnePoint(CCmdUI* pCmdUI);
|
|
afx_msg void OnToolLaserCoord();
|
|
afx_msg void OnUpdateToolLaserCoord(CCmdUI* pCmdUI);
|
|
afx_msg void OnToolPolygon();
|
|
afx_msg void OnUpdateToolPolygon(CCmdUI* pCmdUI);
|
|
afx_msg void OnToolRotato();
|
|
afx_msg void OnUpdateObjOperate(CCmdUI* pCmdUI);
|
|
afx_msg void OnToolCircle();
|
|
afx_msg void OnUpdateToolCircle(CCmdUI* pCmdUI);
|
|
afx_msg void OnToolLine();
|
|
afx_msg void OnUpdateToolLine(CCmdUI* pCmdUI);
|
|
afx_msg void OnToolPline();
|
|
afx_msg void OnUpdateToolPline(CCmdUI* pCmdUI);
|
|
afx_msg void OnSelAllObj();
|
|
afx_msg void OnRevSelObj();
|
|
afx_msg void OnMoveToCenter();
|
|
afx_msg void OnObjFill();
|
|
afx_msg void OnDelSelObj();
|
|
afx_msg void OnWorkSpaceView() ;
|
|
afx_msg void OnMirrorH();
|
|
afx_msg void OnMirrorV();
|
|
afx_msg void OnRotato90L();
|
|
afx_msg void OnRotato90R();
|
|
afx_msg void OnCopy();
|
|
afx_msg void OnMove();
|
|
DECLARE_MESSAGE_MAP()
|
|
};
|
|
|
|
#ifndef _DEBUG // LaiPuLaserView.cpp 中的调试版本
|
|
inline CLaiPuLaserDoc* CLaiPuLaserView::GetDocument() const
|
|
{ return reinterpret_cast<CLaiPuLaserDoc*>(m_pDocument); }
|
|
#endif
|
|
|
|
extern CLaiPuLaserView* m_pView; |