#include "stdafx.h"
#include "FoundDoc.h"			// For g_pDoc.
#include "PrsObjProperty.h"		// For CFCPrsObjProperty.
#include "ToolGroupEdit.h"		// This header.

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolGroupEdit::CanObjectProperties
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDhGiDiNiDhAiDgFiDeCiDfPiDeDiDeBiDiNiDePiCkKjFfMiOkGiJmCjEfMiCkJiCmHiCkEiCkJiCpAjClCiCnHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_iJmCjEfMiCmMiPoKiNiHiCmN_xHqqkZx_ TRUE_xZkqqHx_iBeBjFhDiJmCjEfMiCmMiPoKiNiHiCmN_xHqqkZx_ FALSE _xZkqqHx_iCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.06.29 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
BOOL FCToolGroupEdit::CanObjectProperties () const
{
	// _xZkqqHx_iDgFiDeMiDfIiDgHjFnCiPfHjCiGiBeB_xHqqkZx_OLE_xZkqqHx_jFnCiPfHjCiGiCmIiCoHiCmOjGlDiMpIiBeC_xHqqkZx_
// 05.10.23 Fukushiro M. 1_xZkqqHx_iNhDjFmPiNfI_xHqqkZx_ ()
//	if (!FFIsSheetReady()) return FALSE;
	if (!FFCanEditReadOnlyDocumentEnv()) return FALSE;
	if (GetSelectLocalObjVector().empty()) return FALSE;
	return TRUE;
} // FCToolGroupEdit::CanObjectProperties.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolGroupEdit::OnObjectProperties
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iJeFiDhLiDfOiDjDiDeOiDiKiDgCiDeOiCmJiCoGiCmBiCmEjFfMiOkGiClDiCoKiCoJiDiBiDgKiDiFiBfLiCmMiDhGiDiNiDhAiDgFiDeC_xHqqkZx_
 *          _xZkqqHx_jBeJjBpAiCmFiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.06.29 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCToolGroupEdit::OnObjectProperties ()
{
	// ID_OBJECT_PROPERTIES = "_xZkqqHx_jFjEjFgJiCmMiDhGiDiNiDhAiDgFiDeC_xHqqkZx_"
	CFCPrsObjProperty sheet(ID_OBJECT_PROPERTIES);
	// _xZkqqHx_iDhGiDiNiDhAiDgFiDeCiDfGiBfLiDgHiCmJiDfOiBfLiDfBiDgCiDgHiCmMjFjEjFgJiCpAjAnNjCoIiBeC_xHqqkZx_
	sheet.SetTargetObject(&GetSelectLocalObjVector());
	// _xZkqqHx_iDhGiDiNiDhAiDgFiDeCiDhJiBfLiDfHiCpAiNoMjAkMiBeC_xHqqkZx_
	CPropertyPageVector vPropPage;
	(*GetSelectLocalObjVector().begin())->CreatePropertyPage(vPropPage, GetSelectLocalObjVector());
	// _xZkqqHx_iDhJiBfLiDfHiCpAiDhGiDiNiDhAiDgFiDeCiDfGiBfLiDgHiCmJjCmHiJmBiBeC_xHqqkZx_
	CPropertyPageVector::const_iterator iPN;
	for (iPN = vPropPage.begin(); iPN != vPropPage.end(); ++iPN)
		sheet.AddPage(*iPN);
	// _xZkqqHx_iDhGiDiNiDhAiDgFiDeCiDfGiBfLiDgHiCpAiDhMiDgCiDhGiDeBiDgCiDhGiBeC_xHqqkZx_
	sheet.DoModal();
	// _xZkqqHx_iDhGiDiNiDhAiDgFiDeCiDhJiBfLiDfHiCpAiJpAjFpKiBeC_xHqqkZx_
	for (iPN = vPropPage.begin(); iPN != vPropPage.end(); ++iPN)
		delete *iPN;
} // FCToolGroupEdit::OnObjectProperties.

//----- 06.02.23 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolGroupEdit::LocalObjMovedBefore
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFjEjFgJiInKjDkOiBeFiDiKiDfEiDeDiDfJiCmMjBePiPiIjHjNiCpAiNhDiCkEiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.08.08 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
// *************************************************************************/
//void FCToolGroupEdit::LocalObjMovedBefore (const ObjDynabaseVector& vObj)
//{
//	//----- _xZkqqHx_iInKjDkOjBePiCmMiMmFjHeMiDiKiBfLiDfHiDiHiDjDiCpAjAnNjCoI_xHqqkZx_ -----
//	g_pView->AddEmptyRgn();
//	// _xZkqqHx_jBeJjBpAjFjEjFgJiCmMiMmFjHeMiDiKiBfLiDfHiDiHiDjDiCpAjAnNjCoIiBeC_xHqqkZx_
//	g_pView->AppendToLastRgn(vObj);
//
//	//---- _xZkqqHx_iInKjDkOjBePiCmMjFnCiPfHjApMiCpAiPmBiLiO_xHqqkZx_ -----
//	CClientDC dc(g_pView);
//	g_pView->OnPrepareDC(&dc, NULL);
//	ObjDynabaseVector::const_iterator iObj;
//	for (iObj = g_pView->SelectObjVector().begin();
//		 iObj != g_pView->SelectObjVector().end(); iObj++)
//	{
//		DrawSelectMark(&dc, *iObj);
//	}
//
//	//----- _xZkqqHx_iDePiDiLiBfLiDhGjFjEjFgJiCmJiKnGiCoNiCoJiDiKiDjDiDeOiCmMiCnNiOpLiCnPiClNiDhNiDgMiBfLiDfHiDiDiBfLiCpAiNoMjAkM_xHqqkZx_ -----
//	m_linkManagerLocal.ClearAll();
//	for (iObj = g_pView->SelectObjVector().begin();
//		 iObj != g_pView->SelectObjVector().end(); iObj++)
//	{
//		// _xZkqqHx_iDePiDiLiBfLiDhGjDoAiDiKiDjDiDeOiCpAiOoGjDlOiBeC_xHqqkZx_
//		FCLinkRecVector vLinkRec;
//		((FCObjGroup*)*iObj)->GetLink(vLinkRec);
//		//----- _xZkqqHx_iDiKiDjDiDeOiCpAjDgPjIfOiClHiCoJ_xHqqkZx_ -----
//		for (long lIdx = 0; lIdx < vLinkRec.size(); lIdx++)
//		{
//			m_linkManagerLocal.AppendLink(	vLinkRec[lIdx].m_mlpFrom,
//											vLinkRec[lIdx].m_mlpTo,
//											vLinkRec[lIdx].m_wLinkKind);
//		}
//	}
//} // FCToolGroupEdit::LocalObjMovedBefore.
//
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolGroupEdit::LocalObjMovedAfter
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFjEjFgJiInKjDkOiBeFiDiKiDfEiDeDiDfJiCmMiMoDiPiIjHjNiCpAiNhDiCkEiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.08.08 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
// *************************************************************************/
//void FCToolGroupEdit::LocalObjMovedAfter (const ObjDynabaseVector& vObj)
//{
//	// _xZkqqHx_iLpDiDiKiBfLiDfHiDiHiDjDiCpAjAnNjCoIiBeC_xHqqkZx_
//	g_pView->AddEmptyRgn();
//	// _xZkqqHx_jBeJjBpAjFjEjFgJiCmMiMmFjHeMiDiKiBfLiDfHiDiHiDjDiCpAjAnNjCoIiBeC_xHqqkZx_
//	g_pView->AppendToLastRgn(vObj);
//
//	// _xZkqqHx_jFjEjFgJiCmMiDiKiDfEiDeDiDfJiCpAjCmKjCgNiBeCjDoAjFjEiCmFiDfCiDhNiDjDiDgIiCpAjEkNiNhDiBeC_xHqqkZx_
//	m_linkManagerLocal.MovedNotify(vObj, FALSE);
//	m_linkManagerLocal.ClearAll();
//
//	FTMolipSet stMolip;
//	ObjDynabaseVector::const_iterator iObj;
//	for (iObj = vObj.begin(); iObj != vObj.end(); iObj++)
//	{
//		stMolip.insert(FCMolipRec((*iObj)->GetGroupParent()->GetObjID(), -1));
//	}
//	// _xZkqqHx_iDePiDiLiBfLiDhGjFjEjFgJiCmMjFmPiMgAiCpAjCmKjCgNiBeC_xHqqkZx_
//	g_pDoc->LinkManager()->MovedNotify(stMolip);
//
//	// _xZkqqHx_jFjEjFgJiCmMjBkOjAkLjFmPiNfIiCpAiDgDiBfLiDiLiCmJjCmKjCgNiClHiCoJiBeC_xHqqkZx_
//	// _xZkqqHx_iClBiCoKiCpAjDpMiCoKiCmIiCkCiCmGiBeB_xHqqkZx_ToolPolyEdit_xZkqqHx_iCmIiCmHiBeBjDoAjFjEiCmJjFnCiPfHjHhAiDgGiBfLiDfOiCpA_xHqqkZx_
//	// _xZkqqHx_iOjNiCmCiDgDiBfLiDiLiCmMjDoAjFjEiDgGiBfLiDfOiCkKiNfIjAfGiClDiCoKiCmIiCkCiBeC_xHqqkZx_
//	// _xZkqqHx_iNfIjAfGiClDiCoKiCmIiCkCiPoKiNiHiBeBiImIiJlKiCmM_xHqqkZx_DrawSelectMark_xZkqqHx_iCmNiMmDiCkCiImKjChFiCmJ_xHqqkZx_
//	// _xZkqqHx_jFnCiPfHjApMiCpAjFgAiJoGiClFiCmEiClFiCnMiCkEiBeC_xHqqkZx_
//	OnSelectObjModified();
//
//	//---- _xZkqqHx_iInKjDkOiMoDiCmMjFnCiPfHjApMiCpAjFgAiJoG_xHqqkZx_ -----
//	CClientDC dc(g_pView);
//	g_pView->OnPrepareDC(&dc, NULL);
//	for (iObj = g_pView->SelectObjVector().begin();
//		 iObj != g_pView->SelectObjVector().end(); iObj++)
//	{
//		DrawSelectMark(&dc, *iObj);
//	}
//
//	// _xZkqqHx_iMmFjHeMiDiKiBfLiDfHiDiHiDjDiCpAiNmEjFgAiJoGiBeC_xHqqkZx_
//	g_pView->SendRgnRedraw();
//} // FCToolGroupEdit::LocalObjMovedAfter.
//----- 06.02.23 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

//----- 06.06.13 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
// _xZkqqHx_iDePiDiLiBfLiDhGjFjEjFgJjCiGiCmMiDiKiDjDiDeOiCkKjGlDiMpIiCmJiCmIiCmBiCmEiCkCiClNiCmMiCmFiPeDjAlDiBeC_xHqqkZx_

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolGroupEdit::LocalObjMovedBefore
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFjEjFgJiInKjDkOiBeFiDiKiDfEiDeDiDfJiCmMjBePiPiIjHjNiCpAiNhDiCkEiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	vObj	:_xZkqqHx_iInKjDkOiClDiCoKiCoJjFjEjFgJiCpAiOhHjCoIiBeCiDePiDiLiBfLiDhGjFjEjFgJjFnCiPfHiCmMiPoKiNiHiCmN_xHqqkZx_
 *					 _xZkqqHx_iInKjDkOiClDiCoKiCoJiDiBiDjDiDgPiBfLjFjEjFgJiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.06.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCToolGroupEdit::LocalObjMovedBefore (const ObjDynabaseVector& vObj)
{
	// Baseclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
	BASE_CLASS::LocalObjMovedBefore(vObj);
	//----- _xZkqqHx_iDePiDiLiBfLiDhGjFjEjFgJiCmJiKnGiCoNiCoJiDiKiDjDiDeOiCmMiCnNiOpLiCnPiClNiDhNiDgMiBfLiDfHiDiDiBfLiCpAiNoMjAkM_xHqqkZx_ -----
	m_linkManagerLocal.ClearAll();

	// vObj_xZkqqHx_iCmNiDePiDiLiBfLiDhGjFjEjFgJiCmMiDiBiDjDiDgPiBfLiCkKiKnMiCnMiCoKiCoJiPoKiNiHiCoAiCkAiCoJiCmMiCmFiBeBiDgHiDgCiDhGjFjEjFgJiCpAiPfHiCnPiCoJiBeC_xHqqkZx_
	ObjDynabaseSet stMoveTopObj;
	mdef_const_iterator(ObjDynabaseVector, iObj);
	m1_for (iObj, m_vMovedObj)
		stMoveTopObj.insert((*iObj)->GetGroupTop());
	mdef_const_iterator(ObjDynabaseSet, iObs);
	m1_for (iObs, stMoveTopObj)
	{
		// _xZkqqHx_iDePiDiLiBfLiDhGjDoAiDiKiDjDiDeOiCpAiOoGjDlOiBeC_xHqqkZx_
		FCLinkRecVector vLinkRec;
		((const FCObjGroup*)*iObs)->GetLink(vLinkRec);
		//----- _xZkqqHx_iDiKiDjDiDeOiCpAjDgPjIfOiClHiCoJ_xHqqkZx_ -----
		for (long lIdx = 0; lIdx < vLinkRec.size(); lIdx++)
		{
			m_linkManagerLocal.AppendLink(	vLinkRec[lIdx].m_mlpFrom,
											vLinkRec[lIdx].m_mlpTo,
											vLinkRec[lIdx].m_wLinkKind);
		}
	}
} // FCToolGroupEdit::LocalObjMovedBefore.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolGroupEdit::LocalObjMovedAfter
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFjEjFgJiInKjDkOiBeFiDiKiDfEiDeDiDfJiCmMiMoDiPiIjHjNiCpAiNhDiCkEiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.06.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCToolGroupEdit::LocalObjMovedAfter ()
{
	// _xZkqqHx_jFjEjFgJiCmMiDiKiDfEiDeDiDfJiCpAjCmKjCgNiBeCjDoAjFjEiCmFiDfCiDhNiDjDiDgIiCpAjEkNiNhDiBeC_xHqqkZx_
	m_linkManagerLocal.MovedNotify(m_vMovedObj, FALSE);
	m_linkManagerLocal.ClearAll();

	// Baseclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
	BASE_CLASS::LocalObjMovedAfter();
} // FCToolGroupEdit::LocalObjMovedAfter.
//----- 06.06.13 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolGroupEdit::CanEditSelectedLocal
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgDiBfLiDiLiDiNiBfLiDeKiDiLjBeJjBpAiCmMjFjEjFgJiCkKjFnCiPfHiJmCjEfMiCkJiCmHiCkEiCkJiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jFnCiPfHiJmCjEfMiCmIiCoHiCmO_xHqqkZx_ TRUE_xZkqqHx_iBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.08.19 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
BOOL FCToolGroupEdit::CanEditSelectedLocal () const
{
	return FFCanEditSelected() && !GetSelectLocalObjVector().empty();
} // FCToolGroupEdit::CanEditSelectedLocal.

//----- 05.06.10 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolBaseEdit::TransFDA
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iMiIjCoIjAkLjHeMiMmAiDeJiBfLiDgHiDhNiDgHiDjDiCmMjBeKiInKiCpAjFnEiClHiBeC_xHqqkZx_ToolBaseEdit.mdrw_xZkqqHx_iCpAiOfBiPmGiBeC_xHqqkZx_
// *
// * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	iState	:_xZkqqHx_iMlLiNnNiCmMiPpDjBnEiCpAiOhHjCoIiBeC_xHqqkZx_
// *			iEvent	:_xZkqqHx_iDeDiDhIiDjDiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jBeKiInKiMoDiCmMiPpDjBnEiCpAjFnEiClHiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.08.19 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
// *************************************************************************/
//int FCToolGroupEdit::TransFDA (int iState, int iEvent)
//{
//	if (g_pView->SelectObjVector().empty())
//	//----- _xZkqqHx_jFjEjFgJjBeJjBpAjCiGiCmFiCmNjGlDiCkC_xHqqkZx_ -----
//	{
//		// _xZkqqHx_jFnCiPfHiDgDiBfLiDiLiLkEjCmKiCmMiPiIjHjNiCnGiBeC_xHqqkZx_
//		return FCToolBaseEdit::TransFDA(iState, iEvent);
//	}
//	return BASE_CLASS::TransFDA(iState, iEvent);
//} // FCToolGroupEdit::TransFDA.
//----- 05.06.10 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolGroupEdit::ResetEditHandleList
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFnCiPfHiDgOiDjDiDgIiDiLiDiKiDfIiDgHiCpAiNmEjAnNjCoIiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.06.06 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCToolGroupEdit::ResetEditHandleList ()
{
	// _xZkqqHx_jFnCiPfHiDgOiDjDiDgIiDiLiDiKiDfIiDgHiCpAiDeOiDiKiDeBiBeC_xHqqkZx_
	ClearEditHandleList();
	ObjDynabaseVector::const_iterator iObj;
	for (iObj = g_pView->SelectObjVector().begin();
		 iObj != g_pView->SelectObjVector().end(); iObj++)
	{
		// _xZkqqHx_jFjEjFgJiCmMiLoJiMgAiCpAjDgPjIfOiBeC_xHqqkZx_ID=(_xZkqqHx_jFjEjFgJ_xHqqkZx_ID, 0, 0, 0)_xZkqqHx_iBeC_xHqqkZx_
		AddEditHandle(	(*iObj)->GetResizeFrame(),
						FCHandleId(long((*iObj)->GetObjID()), 0, 0, 0));
	}
} // FCToolGroupEdit::ResetEditHandleList.
