#ifndef __ToolBasePolyEdit_h
#define __ToolBasePolyEdit_h

#include "ToolSelectTmpl.h"	// Super class.
#include "ToolBaseEdit.h"	// Super class.

#ifdef SUPER_CLASS
#undef SUPER_CLASS
#endif
#define SUPER_CLASS FCToolSelectTmpl<FCToolBaseEdit, longPair, FCToolBasePolyEditId>

// FCToolSelectTmpl _xZkqqHx_iCmMiDgFiDjDiDhGiDiMiBfLiDgH_xHqqkZx_ID_xZkqqHx_iCpAjCoIiLgAiBeC_xHqqkZx_
typedef struct FCToolBasePolyEditId {} *XXX_Joint;
#define XXX_JOINT	XXX_Joint(NULL)

class FCObjFigure;

/*************************************************************************
 * <_xZkqqHx_iDeOiDiJiDfI_xHqqkZx_>	FCToolBasePolyEdit
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	FCObjPoly/FCObjLine_xZkqqHx_jDjJiCpAjFnCiPfHiClHiCoJiClNiCnPiCmMiDgDiBfLiDiLiCmMiKoOjGhLiDeOiDiJiDfIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.04.28 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
class FCToolBasePolyEdit : public SUPER_CLASS
{
protected:
typedef SUPER_CLASS BASE_CLASS;

public:
	//----- _xZkqqHx_iDfEiDhFiDeOiDiJiDfIiCmFjEeDiInD_xHqqkZx_ -----
	virtual void	Select (CDC* pDC);
	virtual void	DrawSelectMark (CDC* pDC, FCObjDynabase* pObj);
	virtual BOOL	CanObjectAlignObj (FTAlignType nType) const;
	virtual void	OnObjectAlignObj (FTAlignType nType);
	virtual BOOL	IsObjectCommandEnable (DWORD dwCmdID) const;

protected:
	//----- _xZkqqHx_iDfEiDhFiDeOiDiJiDfIiCmFjFeLjAhL_xHqqkZx_ -----
	virtual long	GetLineCount () const = 0;
	virtual BOOL	IsOpenLine (long lLineIndex) const = 0;
	virtual long	GetJointCount (long lLineIndex) const = 0;
	virtual void	GetBezierControls (	FCBezierControls& bc,
										long lLineIndex,
										long lJointIndex,
										BOOL bIsForward) const = 0;
	virtual FCObjFigure*	GetLineObject (long lLineIndex) const = 0;
	virtual void	SetJointPoint (longPair index, DBLPoint mmpt) = 0;
	virtual void	DrawJointSelectMark (CDC* pDC, longPair index) const = 0;
	virtual long	JointIDtoMolipID (long lJointId) const = 0;
// 06.12.09 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ ()
	virtual void	DrawSelectedBezier (CDC* pDC) const = 0;

	//----- FCToolSelectTmpl_xZkqqHx_iCmMiDfEiDhFiDeOiDiJiDfIiCmFjFeLjAhL_xHqqkZx_ -----
	virtual longPair InvalidValueXXX (XXX_Joint) const;
	virtual void	SelectXXX (XXX_Joint, longPair xxx, CDC* pDC);
	virtual void	UnselectXXX (XXX_Joint, longPair xxx, CDC* pDC);

//----- 05.09.03 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
	//----- FCToolSelectTmpl_xZkqqHx_iCmMiDfEiDhFiDeOiDiJiDfIiCmFiBeB_xHqqkZx_XXX_xZkqqHx_iDeJiDhFiDfHiDeGiDeOiDgHiCpAiInKjDkOiClHiCoJiPoKiNiHiCmNjFeLjAhL_xHqqkZx_ -----
	virtual BOOL	CanMoveXXX (XXX_Joint) const;
//----- 05.09.03 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----
//----- 06.12.09 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
	virtual void	DrawFirstImageXXX (XXX_Joint, CDC* pDC);
	virtual void	RedrawMovingImageXXX (XXX_Joint, const DBLPoint& mmptMove, CDC* pDC);
	virtual void	DrawLastImageXXX (XXX_Joint, CDC* pDC);
//----- 06.12.09 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----

	//----- FCToolBaseFDA_xZkqqHx_iCmMiDfEiDhFiDeOiDiJiDfIiCmFjFeLjHhGiCmJiJjOiClGiCmE_xHqqkZx_ -----
// 06.12.09 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ ()
	virtual void	OnDrawState (CDC* pDC, int iState);
	virtual int		TransFDA (int iState, int iEvent);
	virtual void	StateFDA (int iState, CDC* pDC);

	//----- _xZkqqHx_jBeKiInKiPpDjBnEiPiIjHjN_xHqqkZx_ -----
	virtual void	StateStartMoveXXX (XXX_Joint, CDC* pDC);
	virtual void	StateMovingXXX (XXX_Joint, CDC* pDC);
// 06.10.17 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//	virtual void	StateStopMoveXXX (XXX_Joint, CDC* pDC);
	virtual void	StateDoMoveXXX (XXX_Joint, CDC* pDC);
	virtual void	StateContextMenuJoint (CDC* pDC);
	virtual void	StateJointLinkCommand (CDC* pDC);
//----- 05.09.03 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//	virtual void	StateReLink (CDC* pDC) = NULL;
//	virtual void	StateStopMoveJoint (CDC* pDC) = NULL;
//	virtual void	StateDoMoveJointSnap (CDC* pDC) = NULL;
//----- 05.09.03 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----
// 06.10.12 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ ()
	virtual void	StateWaitContextMenuJoint (CDC* pDC);

	virtual DWORD	CommandToLinkKind (DWORD dwCommand, BOOL bIsCenterMolipFrom);	// PopupLinkMenu_xZkqqHx_iCmMiDiBiDgKiDiFiBfLiCkJiCoHiDiKiDjDiDeOiOoNiCpAiOoGjDlOiBeC_xHqqkZx_

//----- 06.10.17 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
	virtual DBLPoint	CalcLinkOffsetWhenMoveJoint (	const FCObjDynabase* pObjH,
														long lMolipIdH,
														const FCObjDynabase* pObjK,
														long lMolipIdK,
														const DBLPoint& mmptH,
														WORD wLinkKind) const;
	virtual void	AppendJointMovedRgn (long lLineIndex, const longSet& stJointIndex) = 0;
//----- 06.10.17 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----

protected:
// _xZkqqHx_iClBiCmMiDeOiDiJiDfIiMmFjHeMiCmMjCoIiLgAiBeC_xHqqkZx_
enum
{
	STATE_BEGIN = BASE_CLASS::STATE_END,	// _xZkqqHx_iPpDjBnEiKeKiOgOiBeC_xHqqkZx_
//----- 05.09.03 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//	STATE_START_MOVE_JOINT,			// _xZkqqHx_jIeBiMiLjDfPiInKjDkOiKeKiOgOiBeC_xHqqkZx_
//	STATE_MOVING_JOINT,				// _xZkqqHx_jIeBiMiLjDfPiInKjDkOjCiGiBeC_xHqqkZx_
//----- 05.09.03 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----
	STATE_CONTEXT_MENU_JOINT,		// _xZkqqHx_iDiKiDjDiDeOiDiBiDgKiDiFiBfL_xHqqkZx___xZkqqHx_jIeBiMiLjDfPiBeC_xHqqkZx_
	STATE_JOINT_LINK_COMMAND,		// _xZkqqHx_jIeBiMiLjDfPiDiKiDjDiDeOiDfCiDhNiDjDiDgIiBeC_xHqqkZx_
//----- 05.09.03 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//	STATE_RE_LINK,					// _xZkqqHx_iDiKiDjDiDeOjFhEjBnGiCkGiBeC_xHqqkZx_
//	STATE_STOP_MOVE_JOINT,			// _xZkqqHx_jIeBiMiLjDfPiInKjDkOiPeJjHlJiBeC_xHqqkZx_
//	STATE_DO_MOVE_JOINT_SNAP,		// _xZkqqHx_jIeBiMiLjDfPiDfIiDgJiDgCiDhGiInKjDkOiBeC_xHqqkZx_
//----- 05.09.03 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----
// 06.10.12 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ ()
	STATE_WAIT_CONTEXT_MENU_JOINT,	// _xZkqqHx_iDiKiDjDiDeOiDiBiDgKiDiFiBfL_xHqqkZx___xZkqqHx_jIeBiMiLjDfPjBnCiClPiBeC_xHqqkZx_

	STATE_END,						// _xZkqqHx_iPpDjBnEiPeJjHlJiBeC_xHqqkZx_
};

protected:
	DWORD			m_dwJointLinkKind;	// _xZkqqHx_jCfLjDfPiCmJiDiKiDjDiDeOiCpAjCkDiCoJiPoKiNiHiCmMiDiKiDjDiDeOiOoNiBeC_xHqqkZx_
// 06.12.11 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ ()
	DBLPointVector	m_vMovingJointOrig;	// _xZkqqHx_iInKjDkOjCiGjIeBiMiLjDfPiCmMiBeBiDeJiDiKiDfHiDgJiDiLiImKjChFiBeC_xHqqkZx_
}; // class FCToolBasePolyEdit.

#endif//__ToolBasePolyEdit_h
