#ifndef __ToolBaseEdit_h
#define __ToolBaseEdit_h

#include "FoundDoc.h"		// For g_pDoc.
#include "DBLShortLine.h"	// For DBLShortLine.
#include "ToolBaseFDA.h"	// Super class.
#include "ToolSelectObjTmpl.h"	// For Superclass.

#ifdef SUPER_CLASS
#undef SUPER_CLASS
#endif
// 05.06.10 Fukushiro M. 1_xZkqqHx_iNhDjFmPiNfI_xHqqkZx_ ()
//#define SUPER_CLASS FCToolBaseFDA
#define SUPER_CLASS FCToolSelectObjTmpl<FCToolBaseFDA, FCToolBaseEditId>

// FCToolSelectTmpl _xZkqqHx_iCmMiDgFiDjDiDhGiDiMiBfLiDgH_xHqqkZx_ID_xZkqqHx_iCpAjCoIiLgAiBeC_xHqqkZx_
typedef struct FCToolBaseEditId {} *XXX_EditObjDynabase;
#define XXX_EDIT_OBJ_BASE		XXX_EditObjDynabase(NULL)

class FCToolBaseEdit : public SUPER_CLASS
{
protected:
typedef SUPER_CLASS BASE_CLASS;

typedef FC4Fold<long, long, long, long> FCHandleId;

public:
	FCToolBaseEdit ();
//----- 05.06.04 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
	virtual void	OnSelectObjModified ();
	virtual void	OnZoomChanged ();
//----- 05.06.04 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----
// 05.06.05 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ ()
	virtual void	OnObjSelectChanged ();

//	virtual void	OnDraw (CDC* pDC);
	virtual void	Select (CDC* pDC);
	virtual BOOL	CanSelectTool () const;
	virtual BOOL	CanHandle (const FCObjDynabase* pObj) const;

//----- 05.06.05 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//	virtual void	OnAppendSelectObj (CDC* pDC, FCObjDynabase* pObj);
//	virtual void	OnRemoveSelectObj (CDC* pDC, FCObjDynabase* pObj);
//----- 05.06.05 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----


// 01.08.09 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//	virtual BOOL	IsObjectCommandEnable (DWORD dwCmdID) const;

protected:
	//----- FCToolBaseFDA_xZkqqHx_iCmMiDfEiDhFiDeOiDiJiDfIiCmFjFeLjHhGiCmJiJjOiClGiCmE_xHqqkZx_ -----
	virtual HCURSOR	GetDefaultIdleCursor () const;
	virtual int		TransFDA (int iState, int iEvent);
	virtual void	StateFDA (int iState, CDC* pDC);

	//----- _xZkqqHx_jBeKiInKiPpDjBnEiPiIjHjN_xHqqkZx_ -----
//----- 05.06.06 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
// 05.06.10 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//	virtual void	StateBeforeExitTool (CDC* pDC);			// _xZkqqHx_iDgDiBfLiDiLiPeJjHlJiPiAjEpFiBeC_xHqqkZx_
	virtual void	StateCheckExitToolByButton (CDC* pDC);			// _xZkqqHx_iDgDiBfLiDiLiPeJjHlJiDgAiDeGiDgCiDeOiBeC_xHqqkZx_
	virtual void	StateSelUnselEditObject (CDC* pDC);		// _xZkqqHx_jFnCiPfHjFjEjFgJiCmMjBeJjBpAjCmHiJmBiBeFiJpAiPjMiBeC_xHqqkZx_

//----- 05.06.06 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----
//----- 05.06.10 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//	virtual void	StateSelObject (CDC* pDC);				// _xZkqqHx_jFjEjFgJjBeJjBpAjCmHiJmBiBeC_xHqqkZx_
//	virtual void	StateStartEncloseEditObj (CDC* pDC);	// _xZkqqHx_jFjEjFgJjFoPiImNiKeKiOgOiBeC_xHqqkZx_
//	virtual void	StateEnclosingEditObj (CDC* pDC);		// _xZkqqHx_jFjEjFgJjFoPiImNjCiGiBeC_xHqqkZx_
//	virtual void	StateStopEncloseEditObj (CDC* pDC);		// _xZkqqHx_jFjEjFgJjFoPiImNiPeJjHlJiBeC_xHqqkZx_
//----- 05.06.10 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

	//----- FCToolBaseEdit_xZkqqHx_iCmMiDfEiDhFiDeOiDiJiDfIiCmFjFeLjAhL_xHqqkZx_ -----
	virtual void	ResetEditHandleList () = NULL;

	//----- FCToolSelectTmpl_xZkqqHx_iCmMiDfEiDhFiDeOiDiJiDfIiCmFjFeLjAhL_xHqqkZx_ -----
	virtual void	SelectXXX (XXX_EditObjDynabase, FCObjDynabase* pObj, CDC* pDC);

	//----- _xZkqqHx_iClBiCmMiDeOiDiJiDfIiMmFjHeM_xHqqkZx_ -----
	virtual void	ClearEditHandleList ();
	virtual void	AddEditHandle (const DBLPoint& mmpt, const FCHandleId& ids);
	virtual void	AddEditHandle (const DBLShortLine& mmsl, const FCHandleId& ids);
	virtual void	AddEditHandle (const DBLRect& mmrt, const FCHandleId& ids);
	virtual void	AddEditHandle (const DBLPointVector& vmmptPoly, const FCHandleId& ids);
	virtual void	CheckHitHandle (set<FCHandleId>& stIds, const DBLPoint& mmptMsc);
	virtual BOOL	IsFarEnoughFromHandle (const DBLPoint& mmptMsc) const;

protected:
// _xZkqqHx_iClBiCmMiDeOiDiJiDfIiMmFjHeMiCmMjCoIiLgAiBeC_xHqqkZx_
enum
{
	STATE_BEGIN = BASE_CLASS::STATE_END,	// _xZkqqHx_iPpDjBnEiKeKiOgOiBeC_xHqqkZx_
//	STATE_SEL_OBJECT,				// _xZkqqHx_jFjEjFgJjBeJjBpAjCmHiJmBiBeC_xHqqkZx_
//----- 05.06.06 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
	STATE_BEFORE_EXIT_TOOL,				// _xZkqqHx_iDgDiBfLiDiLiPeJjHlJiPiAjEpFiBeC_xHqqkZx_
	STATE_CHECK_EXIT_TOOL_BY_BUTTON,	// _xZkqqHx_iDhNiDeFiDfIiDhLiDfOiDjDiCmJiCoGiCoJiDgDiBfLiDiLiPeJjHlJiDgAiDeGiDgCiDeOiBeC_xHqqkZx_
//----- 05.06.06 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----
//----- 05.06.10 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//	STATE_START_ENCLOSE_EDIT_OBJ,	// _xZkqqHx_jFjEjFgJjFoPiImNiKeKiOgOiBeC_xHqqkZx_
//	STATE_ENCLOSING_EDIT_OBJ,		// _xZkqqHx_jFjEjFgJjFoPiImNjCiGiBeC_xHqqkZx_
//	STATE_STOP_ENCLOSE_EDIT_OBJ,	// _xZkqqHx_jFjEjFgJjFoPiImNiPeJjHlJiBeC_xHqqkZx_
//----- 05.06.10 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----
	STATE_SEL_UNSEL_EDIT_OBJECT,	// _xZkqqHx_jFnCiPfHjFjEjFgJiCmMjBeJjBpAjCmHiJmBiBeFiJpAiPjMiBeC_xHqqkZx_

	STATE_END,						// _xZkqqHx_iPpDjBnEiPeJjHlJiBeC_xHqqkZx_
};

protected:
	//----- _xZkqqHx_iDfOiBfLiDfBiDgCiDgHiKnGiMfH_xHqqkZx_ -----
	FCObjDynabase*	m_pObjTarget;		// _xZkqqHx_iDfOiBfLiDfBiDgCiDgHjFjEjFgJiBeC_xHqqkZx_

	//----- _xZkqqHx_jFnCiPfHiDgOiDjDiDgIiDiL_xHqqkZx_ -----
	template<class T> struct FCHandleRec
	{
		FCHandleRec (const T& area, const FCHandleId& ids) :
			m_area(area), m_ids(ids) {}
		T			m_area;
		FCHandleId	m_ids;
	};
	DBLPoint			m_mmptLastCheckHitPoint;
	set<FCHandleId>		m_stLastHitIds;
	vector< FCHandleRec<DBLPoint> >			m_vPointHandle;
	vector< FCHandleRec<DBLShortLine> >		m_vLineHandle;
	vector< FCHandleRec<DBLRect> >			m_vRectHandle;
	vector< FCHandleRec<DBLPointVector> >	m_vPolylineHandle;
}; // class FCToolBaseEdit.

#endif//__ToolBaseEdit_h
