Скачиваний:
9
Добавлен:
01.05.2014
Размер:
4.03 Кб
Скачать
// SketcherView.h : interface of the CSketcherView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_SKETCHERVIEW_H__623441AD_57EA_11D0_9257_00201834E2A3__INCLUDED_)
#define AFX_SKETCHERVIEW_H__623441AD_57EA_11D0_9257_00201834E2A3__INCLUDED_

#include "Figure.h"
#include "NodeDialog.h"

#include <stack>

class CSketcherView : public CScrollView
{
protected: // create from serialization only
	CSketcherView();
	DECLARE_DYNCREATE(CSketcherView)

// Attributes
public:
	void ResetScrollSizes();
	CSketcherDoc* GetDocument();

protected:
    CPoint m_FirstPoint;       // First point recorded for an element
    CPoint m_SecondPoint;      // Second point recorded for an element
    Figure* m_pTempElement;  // Pointer to temporary element
    Figure* m_pSelected;     // Currently selected element
    BOOL m_MoveMode;           // Move element flag
    CPoint m_CursorPos;        // Cursor position
    CPoint m_FirstPos;         // Original position in a move
//	BOOL m_SelectVertexMode;


protected:
    Figure* CreateElement(); // Create a new element on the heap
    Figure* SelectElement(CPoint aPoint);           // Select an element
    void MoveElement(CClientDC& aDC, CPoint& point);  // Move an element
	CNodeDialog nodeDlg;
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CSketcherView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	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 OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
	//}}AFX_VIRTUAL

// Implementation
private:
	enum MODE { EDIT, LINK, UNLINK, TOUR, ITERATOR };
	MODE mode;
	virtual ~CSketcherView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	Figure* m_pNodeFound;
	int m_Scale;
	//{{AFX_MSG(CSketcherView)
	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 OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMove();
	afx_msg void OnSendtoback();
	afx_msg void OnDelete();
	afx_msg void OnModeLink();
	afx_msg void OnUpdateModeLink(CCmdUI* pCmdUI);
	afx_msg void OnModeEdit();
	afx_msg void OnUpdateModeEdit(CCmdUI* pCmdUI);
	afx_msg void OnModeTour();
	afx_msg void OnUpdateModeTour(CCmdUI* pCmdUI);
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnElementColorBlack();
	afx_msg void OnElementColorBlue();
	afx_msg void OnElementColorGreen();
	afx_msg void OnElementColorRed();
	afx_msg void OnModeUnlink();
	afx_msg void OnUpdateModeUnlink(CCmdUI* pCmdUI);
	afx_msg void OnScale();
	afx_msg void OnModeIterator();
	afx_msg void OnUpdateModeIterator(CCmdUI* pCmdUI);
	afx_msg void OnElementFind();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
private:
	void resetSelections();
	void selectRLink();
	void selectLLink();
	Figure* m_pTourSel;
	Figure* m_pTourSelNext;
	Figure* vertex2;
	Figure* vertex1;

	std::stack<Figure*> vertexes;
};

#ifndef _DEBUG  // debug version in SketcherView.cpp
inline CSketcherDoc* CSketcherView::GetDocument()
   { return (CSketcherDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SKETCHERVIEW_H__623441AD_57EA_11D0_9257_00201834E2A3__INCLUDED_)
Соседние файлы в папке Лабораторная работа 23