www.pudn.com > 44757463.rar > GraphSoftView.h
// GraphSoftView.h : interface of the CGraphSoftView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_GRAPHSOFTVIEW_H__53AAF3E1_0795_4348_B18E_E4F7E992594B__INCLUDED_)
#define AFX_GRAPHSOFTVIEW_H__53AAF3E1_0795_4348_B18E_E4F7E992594B__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "afxtempl.h"
#include "GraphDefines.h"
#include "GraphSoftDoc.h"
#include "Shape.h"
#include "MenuEx.h"
class CGraphSoftDoc;
class CGraphSoftView : public CScrollView
{
protected: // create from serialization only
CGraphSoftView();
DECLARE_DYNCREATE(CGraphSoftView)
// Attributes
public:
int m_nMouseFlag;//判断鼠标状态
//0-------左右键都未按下
//1-------左键按下
bool m_bDrawFlag;//程序状态:画否
//0-------不画
//1-------画
//MOUSE_STATE m_mouseStatePrev;
int m_nCurrentPenWidth;
COLORREF m_clrCurrentColor;
COLORREF m_clrCurrentFill;
COLORREF m_clrBkColor;
COLORREF m_clrDefaultColor;
// CPoint m_ptPrev;
// CPoint m_ptStart;
float m_flPrevX;
float m_flPrevY;
float m_flStartX;
float m_flStartY;
// CArray m_ptArray;
CArray m_flArrayX;
CArray m_flArrayY;
GRAPH_OPERATION m_graph_op;
bool m_bGraphOp;
bool m_bCanSelectGraphType;
CPoint m_ptSelectGraphCenter;
//CPoint m_ptRotateCenter;
float m_flRotCenterX;
float m_flRotCenterY;
bool m_bSelectRotateCenter;
CRect m_rectSelectGraph;
CShape* m_pCurrentShape;
SHAPE_FILLSTYLE m_shapeCurFillStyle;
UINT m_unPrevCur;
CToolBar* m_pToolBar;
CRect m_rectMaxWindow;
CFlRect m_rectTarget;
float m_flRate;//放大的比例
CArray m_ArrDataPrevX;
CArray m_ArrDataPrevY;
// Operations
public:
void Redraw(CDC* pDC,CRect* const pRect=NULL,bool bDrawRect=FALSE,COLORREF color=RGB(0,0,0));
void SetDrawMenuEnable(bool bEnable);
void GraphOperator(CDC* pDC,GRAPH_OPERATION opId,float PrevX,float PrevY,float CurX,float CurY);
CPoint GetSelectGraphCenter();
CRect GetSelectGraphBoundaryRect();
void DrawCut();
void Lp2Dp(CPoint* pPt);//逻辑屏幕坐标--->实际屏幕坐标
void Lp2Dp(CRect* pRect);
void Lp2Dp(float& flX,float& flY);
void Dp2Lp(CPoint* pPt);//实际屏幕坐标--->逻辑屏幕坐标
void Dp2Lp(CRect* pRect);
void Dp2Lp(float& flX,float& flY);
CGraphSoftDoc* GetDocument();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGraphSoftView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual BOOL DestroyWindow();
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
virtual void OnInitialUpdate();
virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL);
protected:
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void CalcWindowRect(LPRECT lpClientRect, UINT nAdjustType = adjustBorder);
virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CGraphSoftView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CGraphSoftView)
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnDrawDdaline();
afx_msg void OnFileExport();
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
afx_msg void OnGraphMove();
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnUpdateDrawDdaline(CCmdUI* pCmdUI);
afx_msg void OnDrawRectangle();
afx_msg void OnDrawRoundrect();
afx_msg void OnDrawPolygon();
afx_msg void OnUpdateDrawPolygon(CCmdUI* pCmdUI);
afx_msg void OnUpdateDrawRectangle(CCmdUI* pCmdUI);
afx_msg void OnUpdateDrawRoundrect(CCmdUI* pCmdUI);
afx_msg void OnDrawEllipse();
afx_msg void OnUpdateDrawEllipse(CCmdUI* pCmdUI);
afx_msg void OnDrawCircle();
afx_msg void OnUpdateDrawCircle(CCmdUI* pCmdUI);
afx_msg void OnDrawNone();
afx_msg void OnUpdateDrawNone(CCmdUI* pCmdUI);
afx_msg void OnGraphMagnify();
afx_msg void OnGraphRotate();
afx_msg void OnGraphPropertiy();
afx_msg void OnGraphDelete();
afx_msg void OnGraphCopy();
afx_msg void OnDestroy();
afx_msg void OnSelectAll();
afx_msg void OnUpdateSelectAll(CCmdUI* pCmdUI);
afx_msg void OnOperationOver();
afx_msg void OnUpdateGraphDelete(CCmdUI* pCmdUI);
afx_msg void OnSelectPenwidth();
afx_msg void OnUpdateSelectPenwidth(CCmdUI* pCmdUI);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnDrawParallelogram();
afx_msg void OnUpdateDrawParallelogram(CCmdUI* pCmdUI);
afx_msg void OnGraphRotatecenterSet();
afx_msg void OnGraphRotateLeft();
afx_msg void OnGraphRotateRight();
afx_msg void OnUpdateGraphRotatecenterSet(CCmdUI* pCmdUI);
afx_msg void OnInputConfirm();
afx_msg void OnShapeOver();
afx_msg void OnDrawModelcurve2avb();
afx_msg void OnUpdateDrawModelcurve2avb(CCmdUI* pCmdUI);
afx_msg void OnDrawModelcurve3param();
afx_msg void OnUpdateDrawModelcurve3param(CCmdUI* pCmdUI);
afx_msg void OnUpdateGraphCopy(CCmdUI* pCmdUI);
afx_msg void OnUpdateGraphMagnify(CCmdUI* pCmdUI);
afx_msg void OnUpdateGraphMove(CCmdUI* pCmdUI);
afx_msg void OnUpdateGraphPropertiy(CCmdUI* pCmdUI);
afx_msg void OnUpdateGraphRotate(CCmdUI* pCmdUI);
afx_msg void OnDrawBeziercurve();
afx_msg void OnUpdateDrawBeziercurve(CCmdUI* pCmdUI);
afx_msg void OnUpdateInputConfirm(CCmdUI* pCmdUI);
afx_msg void OnSelectFillColor();
afx_msg void OnGraphEdit();
afx_msg void OnGraphPointshide();
afx_msg void OnGraphPointsshow();
afx_msg void OnGraphLefttoright();
afx_msg void OnGraphToptobottom();
afx_msg void OnUpdateGraphToptobottom(CCmdUI* pCmdUI);
afx_msg void OnUpdateGraphEdit(CCmdUI* pCmdUI);
afx_msg void OnUpdateGraphLefttoright(CCmdUI* pCmdUI);
afx_msg void OnUpdateGraphPointshide(CCmdUI* pCmdUI);
afx_msg void OnUpdateGraphPointsshow(CCmdUI* pCmdUI);
afx_msg void OnUpdateOperationOver(CCmdUI* pCmdUI);
afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnUpdateGraphRotateLeft(CCmdUI* pCmdUI);
afx_msg void OnUpdateGraphRotateRight(CCmdUI* pCmdUI);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnSelGraphPoint(WPARAM wParam,LPARAM lParam);//user define
afx_msg void OnSelGraphRotate(WPARAM wParam,LPARAM lParam);//user define
afx_msg void OnSelGraphColor(WPARAM wParam,LPARAM lParam);//user define
afx_msg void OnSelGraphFillClr(WPARAM wParam,LPARAM lParam);//user define
afx_msg void OnSelGraphFillSty(WPARAM wParam,LPARAM lParam);//user define
afx_msg void OnSelGraphPenWidth(WPARAM wParam,LPARAM lParam);//user define
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnHelpfile();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#ifndef _DEBUG // debug version in GraphSoftView.cpp
inline CGraphSoftDoc* CGraphSoftView::GetDocument()
{ return (CGraphSoftDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_GRAPHSOFTVIEW_H__53AAF3E1_0795_4348_B18E_E4F7E992594B__INCLUDED_)