// FdbSaveTemplate.cpp : _xZkqqHx_iDeDiDjDiDhGiDiKiDiBiDjDiDgFiBfLiDfGiDiHiDjD_xHqqkZx_ _xZkqqHx_iDhEiDeAiDeDiDiL_xHqqkZx_
//

#include "stdafx.h"
// 06.04.25 Fukushiro M. 1_xZkqqHx_iNhDjFmPiNfI_xHqqkZx_ ()
//#include "resource.h"			// For IDD_SYS_DLG_TEMPLATE_SAVE.
#include "DynamicDraw.h"		// For IDD_SYS_DLG_TEMPLATE_SAVE,FFGetApp().
#include "UtilDlg.h"			// For SetUnitString.etc.
#include "UtilStr.h"			// For GetResString.
#include "FdbSaveTemplate.h"	// This header.

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


/////////////////////////////////////////////////////////////////////////////
// FCFdbSaveTemplate

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCFdbSaveTemplate::FCFdbSaveTemplate
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDfCiDjDiDfIiDgHiDiJiDeOiDfOiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	lpszDefExt		:_xZkqqHx_iDgGiDhEiDeIiDiLiDgHiCmMiKgHjCkDiOhBiCpAiOhHjCoIiBeC_xHqqkZx_
 *			lpszFileName	:_xZkqqHx_iDgGiDhEiDeIiDiLiDgHiCmMiDhEiDeAiDeDiDiLjGlMiCpAiOhHjCoIiBeC_xHqqkZx_
 *			dwFlags			:_xZkqqHx_iDfPiDeDiDeBiDiNiDePiDhEiDiJiDePiCpAiOhHjCoIiBeC_xHqqkZx_
 *			lpszFilter		:_xZkqqHx_iDhEiDeCiDiLiDfOiCpAiOhHjCoIiBeC_xHqqkZx_
 *			pParentWnd		:_xZkqqHx_jAgFiDeFiDeCiDjDiDgIiDeFiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	03.06.24 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
FCFdbSaveTemplate::FCFdbSaveTemplate (	const wchar_t* wcpDefExt,
										const wchar_t* wcpFileName,
										DWORD dwFlags,
										const wchar_t* wcpFilter,
										HWND hwndParent,
										const wchar_t* wcpTitle)
				: BASE_CLASS(FALSE, wcpDefExt, wcpFileName, dwFlags, wcpFilter, hwndParent, wcpTitle)
{
	// _xZkqqHx_iDhEiDeAiDeDiDiLiDfPiDeDiDeBiDiNiDePiCmJiPgEiCmLiCoJiDgFiDjDiDhGiDiMiBfLiDgHiDiKiDfMiBfLiDfIiCpAjAnNjCoIiBeC_xHqqkZx_
	m_ofn.lpTemplateName = MAKEINTRESOURCE(IDD_SYS_DLG_TEMPLATE_SAVE);
	m_ofn.hInstance = FFGetApp()->GetResourceInstance();
	m_ofn.Flags |= OFN_ENABLETEMPLATE;
	// _xZkqqHx_iDhHiDiLiDhGiDhLiDfOiDjDiCpAjFfMiOkGiBeC_xHqqkZx_
	m_ofn.Flags |= OFN_SHOWHELP;

	//----- _xZkqqHx_jFmPjAjEiPiJiKpKiJlL_xHqqkZx_ -----
	m_bIsSaveObject = TRUE;
	m_bIsSaveChip = TRUE;

	// _xZkqqHx_iPpDiLlFiImLjBlGiDhHiDiLiDhGiCmM_xHqqkZx_ID_xZkqqHx_iCpAjAnNjCoIiBeC_xHqqkZx_
	SetHelpID(IDD_SYS_DLG_TEMPLATE_SAVE);
} // FCFdbSaveTemplate::FCFdbSaveTemplate.

/////////////////////////////////////////////////////////////////////////////
// _xZkqqHx_iDiGiBfLiDfFiKnGjAjEiBeC_xHqqkZx_

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCFdbSaveTemplate::GetIsSaveObject
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFjEjFgJiCpAjFnLjBlGiClHiCoJiCkJiCmHiCkEiCkJiCmMjAnNjCoIiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jFnLjBlGiClHiCoJiPoKiNiHiCmN_xHqqkZx_TRUE_xZkqqHx_iBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	03.06.24 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
BOOL FCFdbSaveTemplate::GetIsSaveObject () const
{
	return m_bIsSaveObject;
} // FCFdbSaveTemplate::GetIsSaveObject.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCFdbSaveTemplate::GetIsSaveChip
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgAiDgCiDhGiCpAjFnLjBlGiClHiCoJiCkJiCmHiCkEiCkJiCmMjAnNjCoIiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jFnLjBlGiClHiCoJiPoKiNiHiCmN_xHqqkZx_TRUE_xZkqqHx_iBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	03.06.24 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
BOOL FCFdbSaveTemplate::GetIsSaveChip () const
{
	return m_bIsSaveChip;
} // FCFdbSaveTemplate::GetIsSaveChip.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCFdbSaveTemplate::OnFileTypeChanged
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDhEiDeCiDiLiDfOiCmMiDfCiDjDiDhLiDhLiDgCiDeOiDfIiCmMjBeJjBpAiCkKjFmPiNfIiClDiCoKiClNiPoKiNiHiCmJiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	lFiterIndex	:_xZkqqHx_jBeJjBpAiClDiCoKiClNiDhEiDeCiDiLiDfOiCmMiDeDiDjDiDgGiDgCiDeOiDfIiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	03.06.23 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCFdbSaveTemplate::OnFileTypeChanged (long lFilterIndex)
{
	// Superclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
	BASE_CLASS::OnFileTypeChanged(lFilterIndex);
	UpdateActivate();
} // FCFdbSaveTemplate::OnFileTypeChanged.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCFdbSaveTemplate::OnOK
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	OK_xZkqqHx_iDhLiDfOiDjDiCkKiJjPiClDiCoKiClNiCmGiCkLiCmJiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jCiNiInD_xHqqkZx_>	_xZkqqHx_jCmKiPoNiCmMiDfPiDeDiDeBiDiNiDePiCmM_xHqqkZx_OnOK_xZkqqHx_iCmGiCmNiIoBiCkEiBeCiDiGiBfLiDfFjCoIiLgAiCmM_xHqqkZx_virtual_xZkqqHx_iKnGjAjEiCmFiCkAiCoIiBeB_xHqqkZx_
 *			myDlgProc_xZkqqHx_iCkJiCoHiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	03.06.24 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCFdbSaveTemplate::OnOK ()
{
	if (GetParent()->GetDlgItem(IDC_TPS_CHK_IS_SAVE_OBJECT)->IsWindowEnabled())
		m_bIsSaveObject = GetParent()->IsDlgButtonChecked(IDC_TPS_CHK_IS_SAVE_OBJECT);
	else
		m_bIsSaveObject = TRUE;
	if (GetParent()->GetDlgItem(IDC_TPS_CHK_IS_SAVE_CHIP)->IsWindowEnabled())
		m_bIsSaveChip = GetParent()->IsDlgButtonChecked(IDC_TPS_CHK_IS_SAVE_CHIP);
	else
		m_bIsSaveChip = TRUE;
	// Superclass_xZkqqHx_iKnGjAjEiBeC_xHqqkZx_
	BASE_CLASS::OnOK();
} // FCFdbSaveTemplate::OnOK.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCFdbSaveTemplate::UpdateActivate
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iKgFiDfCiDjDiDgHiDiNiBfLiDiLiCmMjHeMiMpIiBeFjGlDiMpIiCpAiNfIjAfGiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	03.06.23 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCFdbSaveTemplate::UpdateActivate ()
{
	// _xZkqqHx_iMlLiNnNiCmMiDhEiDeCiDiLiDfOiCmJiIoKjChGiClHiCoJiKgHjCkDiOhBiCpAiOoGjDlOiBeC_xHqqkZx_
	WString wstrExtension;
	GetFilterFileExt(wstrExtension, m_ofn.nFilterIndex - 1);

//----- 06.04.04 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//	if (wcsicmp(wstrExtension, FD_FILE_EXT_STANDARD_FORMAT) == 0)
//	//----- _xZkqqHx_iDhEiDeCiDiLiDfOjAnNjCoIiCkKjCmKiPoNiDhEiDeIiBfLiDhNiDgCiDgHiCmMjFlGiPjB_xHqqkZx_(.mdrw)_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ -----
//	{
//		GetParent()->GetDlgItem(IDC_TPS_CHK_IS_SAVE_OBJECT)->EnableWindow(FALSE);
//		GetParent()->GetDlgItem(IDC_TPS_CHK_IS_SAVE_CHIP)->EnableWindow(FALSE);
//	} else
//	//----- _xZkqqHx_iDhEiDeCiDiLiDfOjAnNjCoIiCkKjCmKiPoNiDhEiDeIiBfLiDhNiDgCiDgHiCmMjFlGiPjB_xHqqkZx_(.mdrw)_xZkqqHx_iImIiKePiCmMiPoKiNiH_xHqqkZx_ -----
//	{
//		GetParent()->GetDlgItem(IDC_TPS_CHK_IS_SAVE_OBJECT)->EnableWindow(TRUE);
//		GetParent()->GetDlgItem(IDC_TPS_CHK_IS_SAVE_CHIP)->EnableWindow(TRUE);
//	}
//----- 06.04.04 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----
} // FCFdbSaveTemplate::UpdateActivate.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCFdbSaveTemplate::OnInitDialog
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDfPiDeDiDeBiDiNiDePiPiJiKpKiJlLiOjOiCmJiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	03.06.24 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
BOOL FCFdbSaveTemplate::OnInitDialog ()
{
	// Superclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
	BASE_CLASS::OnInitDialog();

	//----- _xZkqqHx_iDgFiDjDiDhGiDiMiBfLiDgHiCmMiDgAiDeGiDgCiDeOiDhLiDfOiDjDiDfCiDjDiDgHiDiNiBfLiDiLiCpAjAgFiCmMiOhBiCmJjFhEiCkPjBnGiCkG_xHqqkZx_ -----
	// _xZkqqHx_jAgFiCmMiOhBiCmJiClFiCmIiCkCiCmGiBeBiDfOiDhFiBeB_xHqqkZx_1_xZkqqHx_jFlGiOjKiDeMiBfLiDfCiDhNiDjDiDgIiCpAiOpDiCkPjFhEiCkPiCmIiCkCiBeC_xHqqkZx_

	// _xZkqqHx_iDhEiDeAiDeDiDiLiDfPiDeDiDeBiDiNiDePiCmMiImKjChFiCpAiOkGiClHiDfCiDjDiDgHiDiNiBfLiDiLiCmMiNmAjFfHiCpAiOoGjDlOiBeC_xHqqkZx_
	CRect rtDlgTemplate;
	GetDlgItem(1119)->GetWindowRect(rtDlgTemplate);

	// _xZkqqHx_iBhFjFjEjFgJiCpAjFnLjBlGiClHiCoJiCkJiBeIiBhGiDhLiDfOiDjDiCmMjAnNjCoIiBeC_xHqqkZx_
	// _xZkqqHx_jAgFiCpAjFhEiCkPjBnGiCkGiCmEiCoAiDhEiDeAiDeDiDiLiDfPiDeDiDeBiDiNiDePiCmGiCmMiImKjChFiKnGiMfHiCpAiInLiOjNiClHiCoJiCoGiCkEiCmJ_xHqqkZx_
	// _xZkqqHx_iDeFiDeCiDjDiDgIiDeFiImKjChFiCpAiInKjDkOiClHiCoJiBeC_xHqqkZx_
	CWnd* pWndIsSaveChip = GetDlgItem(IDC_TPS_CHK_IS_SAVE_CHIP);
	CRect rtIsSaveChip;
	pWndIsSaveChip->GetWindowRect(rtIsSaveChip);
	pWndIsSaveChip->SetParent(GetParent());
	pWndIsSaveChip->MoveWindow(rtIsSaveChip.left - rtDlgTemplate.left,
								rtIsSaveChip.top - rtDlgTemplate.top,
								rtIsSaveChip.Width(), rtIsSaveChip.Height());

	// _xZkqqHx_iBhFiDgAiDgCiDhGiCpAjFnLjBlGiClHiCoJiCkJiBeIiBhGiDhLiDfOiDjDiCmMjAnNjCoIiBeC_xHqqkZx_
	// _xZkqqHx_jAgFiCpAjFhEiCkPjBnGiCkGiCmEiCoAiDhEiDeAiDeDiDiLiDfPiDeDiDeBiDiNiDePiCmGiCmMiImKjChFiKnGiMfHiCpAiInLiOjNiClHiCoJiCoGiCkEiCmJ_xHqqkZx_
	// _xZkqqHx_iDeFiDeCiDjDiDgIiDeFiImKjChFiCpAiInKjDkOiClHiCoJiBeC_xHqqkZx_
	CWnd* pWndIsSaveObject = GetDlgItem(IDC_TPS_CHK_IS_SAVE_OBJECT);
	CRect rtIsSaveObject;
	pWndIsSaveObject->GetWindowRect(rtIsSaveObject);
	pWndIsSaveObject->SetParent(GetParent());
	pWndIsSaveObject->MoveWindow(rtIsSaveObject.left - rtDlgTemplate.left,
								rtIsSaveObject.top - rtDlgTemplate.top,
								rtIsSaveObject.Width(), rtIsSaveObject.Height());

	GetParent()->CheckDlgButton(IDC_TPS_CHK_IS_SAVE_CHIP, m_bIsSaveChip);
	GetParent()->CheckDlgButton(IDC_TPS_CHK_IS_SAVE_OBJECT, m_bIsSaveObject);

	// _xZkqqHx_iDfCiDjDiDgHiDiNiBfLiDiLiCmMjHeMiMpIiBeFjGlDiMpIiCpAjAnNjCoIiClHiCoJiBeC_xHqqkZx_
	UpdateActivate();
	// _xZkqqHx_iDfPiDeDiDeBiDiNiDePiCmMjCfAiImKjFfMiOkGiCpAjAnNjCoIiClHiCoJiBeC_xHqqkZx_
	::SetUnitString(m_hWnd);
	// _xZkqqHx_jHjIiCkLjIhCjBmOiJjOjFlGiOjKjHpBiCmMjAnNjCoIiCpAiNhDiCkEiBeC_xHqqkZx_
	::RightByLeftHand(m_hWnd);
	// _xZkqqHx_iDfPiDeDiDeBiDiNiDePiCpAiDhNiDeFiDfIiImKjChFiCmJiInKjDkOiBeC_xHqqkZx_
	FFJustifyWindow(m_hWnd);
	return TRUE;  // _xZkqqHx_iDfCiDjDiDgHiDiNiBfLiDiLiCmJiDhEiDeIiBfLiDeKiDfIiCpAjAnNjCoIiClFiCmIiCkCiCmGiCkLiBeBjGnPiCoIjCgMiCmN_xHqqkZx_ TRUE _xZkqqHx_iCmGiCmIiCoIiCnMiClH_xHqqkZx_
	              // _xZkqqHx_jHoBiKeP_xHqqkZx_: OCX _xZkqqHx_iDhGiDiNiDhAiDgFiDeC_xHqqkZx_ _xZkqqHx_iDhJiBfLiDfHiCmMjGnPiCoIjCgMiCmN_xHqqkZx_ FALSE _xZkqqHx_iCmGiCmIiCoIiCnMiClH_xHqqkZx_
} // FCFdbSaveTemplate::OnInitDialog.

//----- 03.06.23 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//void FCFdbSaveTemplate::OnTpsChkIsSaveChip ()
//{
//	m_bIsSaveChip = GetParent()->IsDlgButtonChecked(IDC_TPS_CHK_IS_SAVE_CHIP);
//} // FCFdbSaveTemplate::OnTpsChkIsSaveChip.
//
//void FCFdbSaveTemplate::OnTpsChkIsSaveObject ()
//{
//	m_bIsSaveObject = GetParent()->IsDlgButtonChecked(IDC_TPS_CHK_IS_SAVE_OBJECT);
//} // FCFdbSaveTemplate::OnTpsChkIsSaveObject.
//----- 03.06.23 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----
