// PrsObjProperty.cpp : _xZkqqHx_iDeDiDjDiDhGiDiKiDiBiDjDiDgFiBfLiDfGiDiHiDjD_xHqqkZx_ _xZkqqHx_iDhEiDeAiDeDiDiL_xHqqkZx_
//

#include "stdafx.h"
#include "DynamicDraw.h"
#include "DynamicDrawView.h"	// For g_pView.
#include "UtilStr.h"		// For FFExtractUntil.
#include "ToolBase.h"		// For g_pView->GetCurrentTool.
#include "ObjDynabase.h"		// For m_pvTarget.
#include "FoundDoc.h"		// For g_pDoc.
// 05.06.21 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ ()
#include "LinkManager.h"	// For FCLinkManager.
#include "PrsObjProperty.h"	// This header.

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


/////////////////////////////////////////////////////////////////////////////
// CFCPrsObjProperty

IMPLEMENT_DYNAMIC(CFCPrsObjProperty, CFCPropertySheet)

CFCPrsObjProperty::CFCPrsObjProperty (UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
	:BASE_CLASS(nIDCaption, pParentWnd, iSelectPage)
{
	SetTitle(WStrToTStr(FFExtractUntil(FFLoadWString(nIDCaption), '\n')));
// 00.12.23 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ ()
	m_bIsToolInside = FALSE;
} // CFCPrsObjProperty::CFCPrsObjProperty.

CFCPrsObjProperty::CFCPrsObjProperty (LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
	:BASE_CLASS(pszCaption, pParentWnd, iSelectPage)
{
// 00.12.23 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ ()
	m_bIsToolInside = FALSE;
} // CFCPrsObjProperty::CFCPrsObjProperty.

CFCPrsObjProperty::~CFCPrsObjProperty ()
{
} // CFCPrsObjProperty::~CFCPrsObjProperty.


BEGIN_MESSAGE_MAP(CFCPrsObjProperty, BASE_CLASS)
	//{{AFX_MSG_MAP(CFCPrsObjProperty)
	ON_WM_CREATE()
	ON_WM_DESTROY()
	//}}AFX_MSG_MAP
	ON_COMMAND(ID_APPLY_NOW, OnApplyNow)
	ON_COMMAND(IDOK, OnOK)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFCPrsObjProperty _xZkqqHx_iDiGiBfLiDfFiKnGjAjEiBeC_xHqqkZx_

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCPrsObjProperty::SetTargetObject
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDfOiBfLiDfBiDgCiDgHiCmMjFjEjFgJiPfHiNiHiCpAjAnNjCoIiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pvSelect	:_xZkqqHx_iDfOiBfLiDfBiDgCiDgHjFjEjFgJiBeC_xHqqkZx_
 *			bToolInside	:_xZkqqHx_iDgDiBfLiDiLjDoAjFjEjFjEjFgJiCmMiPoKiNiHiCmN_xHqqkZx_ TRUE_xZkqqHx_iCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.04.25 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void CFCPrsObjProperty::SetTargetObject (const ObjDynabaseVector* pvSelect, BOOL bToolInside)
{
	m_pvTarget = pvSelect;
	m_bIsToolInside = bToolInside;
} // CFCPrsObjProperty::SetTargetObject.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCPrsObjProperty::GetTargetObject
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDfOiBfLiDfBiDgCiDgHiCmMjFjEjFgJiPfHiNiHiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_iDfOiBfLiDfBiDgCiDgHjFjEjFgJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.04.25 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
const ObjDynabaseVector* CFCPrsObjProperty::GetTargetObject () const
{
	return m_pvTarget;
} // CFCPrsObjProperty::GetTargetObject.

/////////////////////////////////////////////////////////////////////////////
// CFCPrsObjProperty _xZkqqHx_iDeJiBfLiDgPiBfLiDiJiDeDiDgIiKnGjAjEiBeC_xHqqkZx_

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCPrsObjProperty::DoModal
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDhGiDiNiDhAiDgFiDeCiDfGiBfLiDgHiCpAiDiCiBfLiDfPiDiLjFfMiOkGiClHiCoJiCmGiCkLiCmJiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jFfMiOkGiMiLiJmKiBgJiCmHiCmMiDhLiDfOiDjDiCmFiPeJjHlJiCkJiBgKiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.04.25 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
int CFCPrsObjProperty::DoModal ()
{
	// _xZkqqHx_jDoAjFjEjFjEjFgJ_xHqqkZx_ _xZkqqHx_iBjF_xHqqkZx_ _xZkqqHx_iKmCiLkLjFnCiPfHjFhDiJmC_xHqqkZx_ _xZkqqHx_iIlNiCkCiCmN_xHqqkZx_ _xZkqqHx_jBeJjBpAjFjEjFgJ_xHqqkZx_ _xZkqqHx_iBjF_xHqqkZx_ _xZkqqHx_jBeJjBpAjFjEjFgJjFnCiPfHjFhDiJmC_xHqqkZx_
	// _xZkqqHx_iCmIiCoHiCmOiBeBjDeLjHhAiDhLiDfOiDjDiCpAiJeCiClHiBeC_xHqqkZx_
	if ((m_bIsToolInside && !FFCanEditDocumentEnv()) ||
		(!m_bIsToolInside && !FFCanEditSelected()))
		m_psh.dwFlags |= PSH_NOAPPLYNOW;
	return BASE_CLASS::DoModal();
} // CFCPrsObjProperty::DoModal.

/////////////////////////////////////////////////////////////////////////////
// CFCPrsObjProperty _xZkqqHx_iDiBiDgCiDfKiBfLiDfH_xHqqkZx_ _xZkqqHx_iDgOiDjDiDgIiDiJ_xHqqkZx_

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCPrsObjProperty::OnCreate
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDeFiDeCiDjDiDgIiDeFiNoMjAkMiOjOiCmJiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.04.25 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
int CFCPrsObjProperty::OnCreate (LPCREATESTRUCT lpCreateStruct)
{
	if (BASE_CLASS::OnCreate(lpCreateStruct) == -1)
		return -1;

	if (!g_pDoc->IsReadOnly())
	//----- _xZkqqHx_iPjBiCkLiNjOiCnNiJmCiCmMiPoKiNiH_xHqqkZx_ -----
	{
		// _xZkqqHx_iDfCiDhNiDjDiDgIiDfKiDgCiDfGiDiHiDjDiKeKiOgOiBeCiDfPiDeDiDeBiDiNiDePiCmFiCmM_xHqqkZx_"_xZkqqHx_jDeLjHhA_xHqqkZx_"_xZkqqHx_iDhLiDfOiDjDiCmFiCmMiDfCiDhNiDjDiDgIiPiIjHjNiCpA_xHqqkZx_
		// _xZkqqHx_iCfAiDfKiDgCiDfGiDiHiDjDiCmJjEfLiCnPiCoJiClNiCnPiCmJiOmAiNhDiBeC_xHqqkZx_
		g_pDoc->SessionBegin();
	}
	return 0;
} // CFCPrsObjProperty::OnCreate.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCPrsObjProperty::OnApplyNow
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jDeLjHhAiDhLiDfOiDjDiCkJiCoHiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.04.25 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void CFCPrsObjProperty::OnApplyNow ()
{
	OnOK();
} // CFCPrsObjProperty::OnApplyNow.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCPrsObjProperty::OnOK
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	OK_xZkqqHx_iDhLiDfOiDjDiCkKiJjPiClDiCoKiClNiOjOiBeBjDeLjHhAiDhLiDfOiDjDiCkKiJjPiClDiCoKiClNiOjOiCmJiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.02.02 Fukushiro M. _xZkqqHx_iDfCiDiBiDjDiDgHiNoMjAkM_xHqqkZx_
 *************************************************************************/
void CFCPrsObjProperty::OnOK ()
{
	// _xZkqqHx_jFnCiPfHjFhDiJmCjEfMiCmIiCoHiCmOiBeBiDeMiDiDiDjDiDfKiDiLiDhLiDfOiDjDiCmFiPeJjHlJiBeC_xHqqkZx_
	if (m_psh.dwFlags & PSH_NOAPPLYNOW)
	{
		PressButton(PSBTN_CANCEL);
		return;
	}
	if (m_bIsToolInside)
	//----- _xZkqqHx_iDgDiBfLiDiLjDoAjFjEjFjEjFgJiDhGiDiNiDhAiDgFiDeCiCmMiPoKiNiH_xHqqkZx_ -----
	{
		// _xZkqqHx_iDfCiDhNiDjDiDgIiDfKiDgCiDfGiDiHiDjDiKeKiOgOiBeC_xHqqkZx_OK_xZkqqHx_iDhLiDfOiDjDiCmFiCmNiCmIiCkNiBeB_xHqqkZx_"_xZkqqHx_jDeLjHhA_xHqqkZx_"_xZkqqHx_iDhLiDfOiDjDiCmMjDhIiCmJ_xHqqkZx_
		// SessionBegin_xZkqqHx_iCkKiOmAiNhDiClDiCoKiCoJiCoGiCkEiCmJiBeC_xHqqkZx_
		g_pDoc->SessionBegin();
		Default();	// _xZkqqHx_iDgGiDhEiDeIiDiLiDgHiCmMiDeFiDeCiDjDiDgIiDeFiDiBiDgCiDfKiBfLiDfHiPiIjHjNiCpAiMmEiCnBiPgPiClHiBeC_xHqqkZx_
					// _xZkqqHx_iClBiCoKiCmJiCoGiCoIiKgF_xHqqkZx_PropertyPage_xZkqqHx_iCmM_xHqqkZx_OnApply,OnOK_xZkqqHx_iKnGjAjEiCkKiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
		// _xZkqqHx_iDfCiDhNiDjDiDgIiDfKiDgCiDfGiDiHiDjDiPeJjHlJiBeC_xHqqkZx_
		g_pDoc->SessionEnd();
	} else
	//----- _xZkqqHx_jCmKiPoNiCmMjBeJjBpAjFjEjFgJiDhGiDiNiDhAiDgFiDeCiCmMiPoKiNiH_xHqqkZx_ -----
	{
		//----- _xZkqqHx_iDgDiBfLiDiLiCmMiPeDjAlDjApMiBeBjDfPjDjJiCpAiPmBiLiOiClHiCoJ_xHqqkZx_ -----
		CClientDC dc(g_pView);
		g_pView->OnPrepareDC(&dc, NULL);
		g_pView->GetCurrentTool()->OnDraw(&dc);
		//----- _xZkqqHx_jBkOjAkLjFmPiNfIjBePiCmMjFjEjFgJiCpAiDiKiBfLiDfHiDiHiDjDjDgPjIfO_xHqqkZx_ -----
		g_pView->AddEmptyRgn();
		g_pView->AppendToLastRgn(*m_pvTarget);

		// _xZkqqHx_iDfCiDhNiDjDiDgIiDfKiDgCiDfGiDiHiDjDiKeKiOgOiBeC_xHqqkZx_OK_xZkqqHx_iDhLiDfOiDjDiCmFiCmNiCmIiCkNiBeB_xHqqkZx_"_xZkqqHx_jDeLjHhA_xHqqkZx_"_xZkqqHx_iDhLiDfOiDjDiCmMjDhIiCmJ_xHqqkZx_
		// SessionBegin_xZkqqHx_iCkKiOmAiNhDiClDiCoKiCoJiCoGiCkEiCmJiBeC_xHqqkZx_
		g_pDoc->SessionBegin();
		Default();	// _xZkqqHx_iDgGiDhEiDeIiDiLiDgHiCmMiDeFiDeCiDjDiDgIiDeFiDiBiDgCiDfKiBfLiDfHiPiIjHjNiCpAiMmEiCnBiPgPiClHiBeC_xHqqkZx_
					// _xZkqqHx_iClBiCoKiCmJiCoGiCoIiKgF_xHqqkZx_PropertyPage_xZkqqHx_iCmM_xHqqkZx_OnApply,OnOK_xZkqqHx_iKnGjAjEiCkKiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_

//----- 05.06.21 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
		// _xZkqqHx_jFjEjFgJiCmMjFmPiMgAiCpAjCmKjCgNiBeCjDoAjFjEiCmFiDfCiDhNiDjDiDgIiCpAjEkNiNhDiBeC_xHqqkZx_
		// _xZkqqHx_jFjEjFgJiCmMjFmPiMgAiBeFiJpBjDfNjDjJiCmJjElKiCmBiCmEiBeBiDiKiDjDiDeOjAoGjFjEjFgJiCpAjFmPiMgAiClHiCoJjFeLjHhGiCkKiCkAiCoJiBeC_xHqqkZx_
		// _xZkqqHx_jFjEjFgJiCkKjFmPiMgAiClDiCoKiCoJiCmGiCmNiMmAiCoHiCmIiCkCiCkKiBeBiPiIjHjNiClFjGfJiCoKiCpAjGgIiCkOiClNiCnPiCmJiBeB_xHqqkZx_
		// _xZkqqHx_iClBiClBiCmFiCnMiCmGiCnPiCmEiPiIjHjNiClFiClNjFpLiCkKiCoGiCkCiBeC_xHqqkZx_
		g_pDoc->LinkManager()->MovedNotify(*GetTargetObject());
//----- 05.06.21 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----

		// _xZkqqHx_iDfCiDhNiDjDiDgIiDfKiDgCiDfGiDiHiDjDiPeJjHlJiBeC_xHqqkZx_
		g_pDoc->SessionEnd();

		// _xZkqqHx_jFjEjFgJiCmMjBkOjAkLjFmPiNfIiCpAiDgDiBfLiDiLiCmJjCmKjCgNiClHiCoJiBeC_xHqqkZx_
		g_pView->GetCurrentTool()->OnSelectObjModified();
		//----- _xZkqqHx_jBkOjAkLjFmPiNfIiMoDiCmMjFjEjFgJiCpAiDiKiBfLiDfHiDiHiDjDjDgPjIfO_xHqqkZx_ -----
		g_pView->AddEmptyRgn();
		g_pView->AppendToLastRgn(*m_pvTarget);
		//----- _xZkqqHx_iDgDiBfLiDiLiCmMiPeDjAlDjApMiBeBjDfPjDjJiCpAjFgAiJoGiClHiCoJ_xHqqkZx_ -----
		g_pView->GetCurrentTool()->OnDraw(&dc);
		// _xZkqqHx_iDiKiBfLiDfHiDiHiDjDiNmEjFgAiJoGiBeC_xHqqkZx_
		g_pView->SendRgnRedraw();
	}
} // CFCPrsObjProperty::OnOK.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCPrsObjProperty::OnDestroy
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDeFiDeCiDjDiDgIiDeFiCkKjEgKiKpMiClDiCoKiCoJiCmGiCkLiCmJiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.12.01 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void CFCPrsObjProperty::OnDestroy ()
{
	BASE_CLASS::OnDestroy();
	if (!g_pDoc->IsReadOnly())
	//----- _xZkqqHx_iPjBiCkLiNjOiCnNiJmCiCmMiPoKiNiH_xHqqkZx_ -----
	{
		// _xZkqqHx_iDfCiDhNiDjDiDgIiDfKiDgCiDfGiDiHiDjDiPeJjHlJiBeC_xHqqkZx_
		g_pDoc->SessionEnd();
	}
} // CFCPrsObjProperty::OnDestroy.

