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

// LaiPuLaserView.h : CLaiPuLaserView <20><><EFBFBD>Ľӿ<C4BD>
//
#pragma once
#include "LaiPuLaserDoc.h"
#include "EnumDirection.h"
#include "GlobalDefine.h"
#if 1//view <20><><EFBFBD><EFBFBD>
#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 //<2F><>ʼview<65><77><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD><C5B1><EFBFBD>
#define SCALE_ONE_TIME (1.25) //ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD><C5B1><EFBFBD>
#define MAX_SCALE (3.0) //<2F><><EFBFBD><EFBFBD><EFBFBD>Ŵ<EFBFBD><C5B4><EFBFBD><EFBFBD><EFBFBD>
#define MIN_SCALE VIEW_SCALE1 //<2F><>С<EFBFBD><D0A1>С<EFBFBD><D0A1><EFBFBD><EFBFBD>
#endif
class CLaiPuLaserView : public CScrollView
{
protected: // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD>
CLaiPuLaserView();
DECLARE_DYNCREATE(CLaiPuLaserView)
// <20><>д
public:
virtual void OnDraw(CDC* pDC); // <20><>д<EFBFBD>Ի<EFBFBD><D4BB>Ƹ<EFBFBD><C6B8><EFBFBD>ͼ
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);
// ʵ<><CAB5>
public:
virtual ~CLaiPuLaserView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// <20><><EFBFBD><EFBFBD>
public:
CLaiPuLaserDoc* GetDocument() const;
int GetCurrScaleVal(int val);//<2F><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
double GetCurrScaleVal(double val);//<2F><>λ:<3A><><EFBFBD><EFBFBD>
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);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
private:
void OnArrowDir(DIRECTION dir);
void OnSpace();
void OnCtrl();
private:
bool m_bFirstIn;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD>һ<EFBFBD>ν<EFBFBD><CEBD><EFBFBD>
bool m_bCtrl;//ctrl <20><><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
bool m_bEraseBkgnd;//<2F>Ƿ<EFBFBD><C7B7>ػ汳<D8BB><E6B1B3>ɫ(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־λÿ<CEBB>λ<EFBFBD><CEBB>Զ<EFBFBD><D4B6>ָ<EFBFBD>)
bool m_bEraseBkgnd2;//<2F>Ƿ<EFBFBD><C7B7>ػ汳<D8BB><E6B1B3>ɫ(<28><><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6>ָ<EFBFBD>)
private:
#if 1//view <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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;//<2F><>ǰ<EFBFBD><C7B0><EFBFBD>ű<EFBFBD><C5B1><EFBFBD>
#endif
CPoint GetScreenCenterPoint();
// <20><><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD>Ϣӳ<CFA2><EFBFBD><E4BAAF>
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 <20>еĵ<D0B5><C4B5>԰汾
inline CLaiPuLaserDoc* CLaiPuLaserView::GetDocument() const
{ return reinterpret_cast<CLaiPuLaserDoc*>(m_pDocument); }
#endif
extern CLaiPuLaserView* m_pView;