Click here to Skip to main content
15,885,693 members
Articles / Desktop Programming / MFC

A Simple Vector Editor

Rate me:
Please Sign up or sign in to vote.
4.85/5 (10 votes)
5 Jun 20022 min read 121.8K   1.4K   29  
A simeple editor to make my polygon class a bit more usable.
// VectorEditorDlg.h : header file
//

#if !defined(AFX_VECTOREDITORDLG_H__3F2FF2A7_C05C_11D5_A04D_006067718D04__INCLUDED_)
#define AFX_VECTOREDITORDLG_H__3F2FF2A7_C05C_11D5_A04D_006067718D04__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

/////////////////////////////////////////////////////////////////////////////
// CVectorEditorDlg dialog
class CDoublePointArray : public CArray<CDoublePoint, CDoublePoint> { };


class CVectorEditorDlg : public CDialog
{
// Construction
public:
	CVectorEditorDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CVectorEditorDlg)
	enum { IDD = IDD_VECTOREDITOR_DIALOG };
	CButton	c_Transformations;
	CStatic	x_Scale;
	CStatic	x_Angle;
	CButton	c_Ticks;
	CButton	c_Axis;
	CImageButton	c_Up;
	CSpinButtonCtrl	c_SpinScale;
	CSpinButtonCtrl	c_SpinAngle;
	CImageButton	c_ShiftUp;
	CImageButton	c_ShiftRight;
	CImageButton	c_ShiftLeft;
	CImageButton	c_ShiftDown;
	CDrawing	c_Image;
	CButton	x_Shift;
	CEdit	c_Scale;
	CStatic	c_Position;
	CTreeCtrl	c_Points;
	CEdit	c_NewPoint;
	CImageButton	c_Down;
	CButton	c_Delete;
	CEdit	c_Angle;
	CButton	c_Add;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CVectorEditorDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	BOOL modified;
	BOOL DoFileSave(BOOL prompt);
	void SetModified(BOOL mode = TRUE) { modified = mode; }
	BOOL GetModified() { return modified; }
	BOOL initialized;
	BOOL IsTreeCtrlEditMessage(WPARAM KeyCode);
	void updateControls();
	void updatePicture();
	void GetPoints(CDoublePointArray & data);
	void SetPoints(const CDoublePointArray & data);
	BOOL QuerySave();
	CString filename;

	afx_msg LRESULT OnDrawMove(WPARAM, LPARAM);
	afx_msg LRESULT OnDrawClick(WPARAM, LPARAM);
	afx_msg LRESULT OnDrawDblClick(WPARAM, LPARAM);
	// Generated message map functions
	//{{AFX_MSG(CVectorEditorDlg)
	afx_msg void OnDown();
	afx_msg void OnUp();
	afx_msg void OnAdd();
	afx_msg void OnDelete();
	afx_msg void OnFileOpen();
	afx_msg void OnFileSave();
	virtual BOOL OnInitDialog();
	afx_msg void OnChangeNewpoint();
	afx_msg void OnEndlabeleditPoints(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnSelchangedPoints(NMHDR* pNMHDR, LRESULT* pResult);
	virtual void OnOK();
	virtual void OnCancel();
	afx_msg void OnChangeAngle();
	afx_msg void OnChangeScale();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnClose();
	afx_msg void OnShiftDown();
	afx_msg void OnShiftLeft();
	afx_msg void OnShiftRight();
	afx_msg void OnShiftUp();
	afx_msg void OnAbout();
	afx_msg void OnTicks();
	afx_msg void OnAxis();
	afx_msg void OnFileNew();
	afx_msg void OnFileSaveAs();
	afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_VECTOREDITORDLG_H__3F2FF2A7_C05C_11D5_A04D_006067718D04__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Retired
United States United States
PhD, Computer Science, Carnegie Mellon University, 1975
Certificate in Forensic Science and the Law, Duquesne University, 2008

Co-Author, [i]Win32 Programming[/i]

Comments and Discussions