// CommonDrawDoc.cpp : _xZkqqHx_iDeDiDjDiDhGiDiKiDiBiDjDiDgFiBfLiDfGiDiHiDjD_xHqqkZx_ _xZkqqHx_iDhEiDeAiDeDiDiL_xHqqkZx_
//

#include "stdafx.h"
#include "DynamicDraw.h"
#include "Env.h"			// For g_pEnv.
#include "CommonDrawFrame.h"// For FFCommonDrawFrame().
#include "ObjChipMaster.h"	// For FCObjChipMaster.
#include "LinkManager.h"	// For FCLinkManager.
#include "CommonDrawDoc.h"	// This Header.

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

// Superclass_xZkqqHx_iCmMjCoIiLgAiBeC_xHqqkZx_

/////////////////////////////////////////////////////////////////////////////
// CFCCommonDrawDoc

IMPLEMENT_DYNCREATE(CFCCommonDrawDoc, CFCFoundDoc)

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCCommonDrawDoc::CFCCommonDrawDoc
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDfCiDjDiDfIiDgHiDiJiDeOiDfOiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.12.21 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
CFCCommonDrawDoc::CFCCommonDrawDoc ()
{
} // CFCCommonDrawDoc::CFCCommonDrawDoc.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCCommonDrawDoc::~CFCCommonDrawDoc
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgGiDfIiDgHiDiJiDeOiDfOiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.12.23 Fukushiro M. _xZkqqHx_iDfCiDiBiDjDiDgHiNoMjAkM_xHqqkZx_
 *************************************************************************/
CFCCommonDrawDoc::~CFCCommonDrawDoc ()
{
} // CFCCommonDrawDoc::~CFCCommonDrawDoc.

BEGIN_MESSAGE_MAP(CFCCommonDrawDoc, BASE_CLASS)
	//{{AFX_MSG_MAP(CFCCommonDrawDoc)
	ON_COMMAND(ID_GRAPHICS_CHIP_COPY, OnGraphicsChipCopy)
	ON_UPDATE_COMMAND_UI(ID_GRAPHICS_CHIP_COPY, OnUpdateGraphicsChipCopy)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFCCommonDrawDoc _xZkqqHx_iDiGiBfLiDfFiKnGjAjEiBeC_xHqqkZx_

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCCommonDrawDoc::OnRepairDocument
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFlGiPjBiPeDjFjMiPiIjHjNiCpAiNhDiCkEiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	00.04.23 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void CFCCommonDrawDoc::OnRepairDocument ()
{
} // CFCCommonDrawDoc::OnRepairDocument.

/////////////////////////////////////////////////////////////////////////////
// CFCCommonDrawDoc _xZkqqHx_jAgGjCgG_xHqqkZx_

#ifdef _DEBUG
void CFCCommonDrawDoc::AssertValid() const
{
	BASE_CLASS::AssertValid();
} // CFCCommonDrawDoc::AssertValid.

void CFCCommonDrawDoc::Dump(CDumpContext& dc) const
{
	BASE_CLASS::Dump(dc);
} // CFCCommonDrawDoc::Dump.
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CFCCommonDrawDoc _xZkqqHx_iDfGiDiKiDeBiDiJiDeDiDfJ_xHqqkZx_

/////////////////////////////////////////////////////////////////////////////
// CFCCommonDrawDoc _xZkqqHx_iDfCiDhNiDjDiDgI_xHqqkZx_

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCCommonDrawDoc::OnGraphicsChipCopy
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDiBiDgKiDiFiBfLiBhFiDgAiDgCiDhGiCpAiDfCiDhDiBfLiBhGiCkJiCoHiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	00.08.03 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void CFCCommonDrawDoc::OnGraphicsChipCopy ()
{
	// ID_xZkqqHx_iDgFiBfLiDhFiDiLiCpAiMpAiKlHiBeC_xHqqkZx_FCLinkManager::AppendLink_xZkqqHx_jDjJiCkKiOgHjHhAiClHiCoJiBeC_xHqqkZx_
	FCObjIDTbl idtable;
	DWORDSet stObjLabel;
	// _xZkqqHx_jFjEjFgJ_xHqqkZx_ID_xZkqqHx_iDgFiBfLiDhFiDiLiCpAiBeBiDiKiDfFiBfLiDhF_xHqqkZx_ID_xZkqqHx_iCpAjGiEiCnPiCmEiPiJiKpKiJlLiBeC_xHqqkZx_
	CFCFoundDoc::InitObjIdTblByReservedId(idtable);
// 06.04.03 Fukushiro M. 1_xZkqqHx_iNhDjFmPiNfI_xHqqkZx_ ()
//	FCObjIDTbl* oitpBackup = SetObjIDTbl(&idtable);
	FC2Fold<FCObjIDTbl*, DWORDSet*> oitpBackup = SetObjIDTbl(&idtable, &stObjLabel);
	// _xZkqqHx_iDfCiDhDiBfLiClHiCoJiDgAiDgCiDhGiCpAiOoGiCoIiPgPiClHiBeC_xHqqkZx_
	FCObjChipMaster* pChip = (FCObjChipMaster*)g_pEnv->GetChipRec(FFCommonDrawFrame()->GetCurChipId())->m_objpChipMaster;
	// _xZkqqHx_iDgAiDgCiDhGiCmM_xHqqkZx_ID_xZkqqHx_iCpAiClLiCmMiCnMiCnM_xHqqkZx_ID_xZkqqHx_iDgFiBfLiDhFiDiLiCmJiPjBiCkLiPgPiClHiBeCiDgAiDgCiDhG_xHqqkZx_ID_xZkqqHx_iCmJjFmPiNfIiCkKiCkJiCkJiCoHiCmIiCkCiCoGiCkEiCmJiBeC_xHqqkZx_
	pChip->RegisterObjForceID();
	// _xZkqqHx_iDfCiDhDiBfLiClHiCoJjFjEjFgJiBeC_xHqqkZx_
	ObjDynabaseVector vObj;
	FCLinkRecVector vLinkRec;
	if (pChip->GetChipKind() == FDCM_OBJECT_CHIP)
	//----- _xZkqqHx_jDmGjHkHjFjEjFgJiDgAiDgCiDhG_xHqqkZx_ -----
	{
		// _xZkqqHx_iDgAiDgCiDhGjCiGiCmMiDiKiDjDiDeOiCpAiOoGiCoIiPgPiClHiBeC_xHqqkZx_
		pChip->GetLink(vLinkRec);
		// _xZkqqHx_iDgAiDgCiDhGiCmMiDiBiDjDiDgPjFjEjFgJiCpAiOoGiCoIiPgPiClHiBeC_xHqqkZx_
		vObj.insert(vObj.end(),
					pChip->GetMemberArray(),
					pChip->GetMemberArray() + pChip->GetMemberSize());
	} else
	//----- _xZkqqHx_jFkBiNiHjFjEjFgJiDgAiDgCiDhG_xHqqkZx_ -----
	{
		vObj.push_back(pChip);
	}
	// _xZkqqHx_iDiKiDjDiDeOiDhNiDgMiBfLiDfHiDiDiCmJiDiKiDjDiDeOiCpAjDgPjIfOiBeC_xHqqkZx_
	FCLinkManager linkMgr;
	FCLinkRecVector::const_iterator iLk;
	for (iLk = vLinkRec.begin(); iLk != vLinkRec.end(); iLk++)
		linkMgr.AppendLink((*iLk).m_mlpFrom, (*iLk).m_mlpTo, (*iLk).m_wLinkKind);
	// _xZkqqHx_iDfCiDhDiBfLiBeC_xHqqkZx_
	OnCopy(vObj, &linkMgr);
	// ID_xZkqqHx_iDgFiBfLiDhFiDiLiCpAiMlDiCmJjGnPiClHiBeC_xHqqkZx_
	SetObjIDTbl(oitpBackup.first, oitpBackup.second);
} // CFCCommonDrawDoc::OnGraphicsChipCopy.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCCommonDrawDoc::OnUpdateGraphicsChipCopy
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDiBiDgKiDiFiBfLiBhFiDgAiDgCiDhGiCpAiDfCiDhDiBfLiBhGiCmMjHeMiMpIiBeFjGlDiMpIiCpAjAnNjCoIiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pCmdUI	:_xZkqqHx_iDiBiDgKiDiFiBfLiCmMjFfMiOkGiPpDjBnEiCpAiOhHjCoIiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	00.08.03 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void CFCCommonDrawDoc::OnUpdateGraphicsChipCopy (CCmdUI* pCmdUI)
{
	pCmdUI->Enable(FFCanBasicOperate() && FFCommonDrawFrame()->GetCurChipId() != FD_CHIP_UNSPECIFY);
} // CFCCommonDrawDoc::OnUpdateGraphicsChipCopy.

