// DLgCrossSheet.cpp : _xZkqqHx_iDeDiDjDiDhGiDiKiDiBiDjDiDgFiBfLiDfGiDiHiDjD_xHqqkZx_ _xZkqqHx_iDhEiDeAiDeDiDiL_xHqqkZx_
//

#include "stdafx.h"
#include "DynamicDraw.h"
#include "FoundDoc.h"		// For g_pDoc.
// 03.07.18 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//#include "MainFrame.h"		// For g_pFrame.
#include "DynamicDrawView.h"	// For g_pView.
#include "UtilStdLib.h"		// For m1_for.
#include "UtilDlg.h"		// For FFJustifyWindow.
#include "UtilWin.h"		// For FFInsertColumn.
#include "SheetManager.h"	// For FCSheetManager.
#include "LayerManager.h"	// For FCLayerManager.
#include "FrameWnd.h"		// For FFGetMainWnd().
#include "DLgCrossSheet.h"	// This header.

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

/////////////////////////////////////////////////////////////////////////////
// CFCDLgCrossSheet _xZkqqHx_iDfPiDeDiDeBiDiNiDeP_xHqqkZx_

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCDLgCrossSheet::CFCDLgCrossSheet
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	
 *
 * <_xZkqqHx_iPnKiNnH_xHqqkZx_>	
 *
 * <_xZkqqHx_jCiNiInD_xHqqkZx_>	
 *
 * <_xZkqqHx_iJpAjAoA_xHqqkZx_>	
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	03.06.24 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
CFCDLgCrossSheet::CFCDLgCrossSheet (CWnd* pParent /*=NULL*/)
	: BASE_CLASS(CFCDLgCrossSheet::IDD, pParent)
{
	//{{AFX_DATA_INIT(CFCDLgCrossSheet)
		// _xZkqqHx_iDiBiDiC_xHqqkZx_ - ClassWizard _xZkqqHx_iCmNiClBiCmMiImKjChFiCmJiDhNiDgCiDhDiDjDiDePjHhAiCmMiDhNiDeOiDiNiCpAjCmHiJmBiCnMiClNiCmNiNoNiPjMiClFiCnMiClHiBeC_xHqqkZx_
	//}}AFX_DATA_INIT
} // CFCDLgCrossSheet::CFCDLgCrossSheet.

void CFCDLgCrossSheet::DoDataExchange(CDataExchange* pDX)
{
	BASE_CLASS::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CFCDLgCrossSheet)
		// _xZkqqHx_iDiBiDiC_xHqqkZx_ - ClassWizard _xZkqqHx_iCmNiClBiCmMiImKjChFiCmJiDhNiDgCiDhDiDjDiDePjHhAiCmMiDhNiDeOiDiNiCpAjCmHiJmBiCnMiClNiCmNiNoNiPjMiClFiCnMiClHiBeC_xHqqkZx_
	//}}AFX_DATA_MAP
} // CFCDLgCrossSheet::DoDataExchange.

BEGIN_MESSAGE_MAP(CFCDLgCrossSheet, BASE_CLASS)
	//{{AFX_MSG_MAP(CFCDLgCrossSheet)
	ON_NOTIFY(NM_DBLCLK, IDC_CST_LSV_LAYER, OnDblclkCstLsvLayer)
	ON_NOTIFY(NM_DBLCLK, IDC_CST_LSV_SHEET, OnDblclkCstLsvSheet)
	ON_NOTIFY(LVN_ITEMCHANGED, IDC_CST_LSV_SHEET, OnItemchangedCstLsvSheet)
	ON_NOTIFY(NM_RDBLCLK, IDC_CST_LSV_LAYER, OnRdblclkCstLsvLayer)
	ON_NOTIFY(NM_RDBLCLK, IDC_CST_LSV_SHEET, OnRdblclkCstLsvSheet)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFCDLgCrossSheet _xZkqqHx_iDiBiDgCiDfKiBfLiDfH_xHqqkZx_ _xZkqqHx_iDgOiDjDiDgIiDiJ_xHqqkZx_

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCDLgCrossSheet::OnInitDialog
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDfPiDeDiDeBiDiNiDePiCmMiPiJiKpKiJlLiOjOiCmJiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.01 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
BOOL CFCDLgCrossSheet::OnInitDialog ()
{
	// Superclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
	BASE_CLASS::OnInitDialog();

	ObjDynabaseVector::const_iterator iObj;
	for (iObj = g_pView->SelectObjVector().begin();
		 iObj != g_pView->SelectObjVector().end(); iObj++)
	{
		// _xZkqqHx_jBeJjBpAjCiGjFjEjFgJiCmMiDiMiDeDiDiEiBfLiCnGjCmHiJmBiBeC_xHqqkZx_
		m_stLayer.insert(g_pDoc->ObjDynabaseToLZOrder(*iObj).dwLayerIdx);
	}
	m_imageList.Create(16, 16, ILC_MASK, 4, 4);
	m_imageList.Add(FFGetApp()->LoadIcon(IDI_CURRENT_MARK));	// Image 0.
	m_imageList.Add(FFGetApp()->LoadIcon(IDI_CHECK2));			// Image 1.
	m_imageList.Add(FFGetApp()->LoadIcon(IDI_CHK_CRNT));		// Image 2.
	m_imageList.Add(FFGetApp()->LoadIcon(IDI_CHECK2_NOT));		// Image 3.

	//----- _xZkqqHx_iDfGiBfLiDgHiDiKiDfIiDgHiCmMiPiJiKpKjAnNjCoI_xHqqkZx_ -----
	CListCtrl* pSheetCtrl = (CListCtrl*)GetDlgItem(IDC_CST_LSV_SHEET);
	// _xZkqqHx_jBfDiNhDjBeJjBpAiDhNiBfLiDeOiCkKjFfMiOkGiClDiCoKiCoJiCoGiCkEiCmJiDfIiDfOiDeDiDiLjFmPiNfIiBeC_xHqqkZx_
	pSheetCtrl->SetExtendedStyle(pSheetCtrl->GetExtendedStyle()|LVS_EX_FULLROWSELECT);
	// _xZkqqHx_iDeBiDeDiDfCiDjDjFfMiOkGjHhAiDeDiDiBiBfLiDfHiDiKiDfIiDgHiCpAjAnNjCoIiBeC_xHqqkZx_
	pSheetCtrl->SetImageList(&m_imageList, LVSIL_SMALL);
	// _xZkqqHx_iJlMiCmMjClHiClDiCmFiBeBiDeKiDiJiDiAiCpAjBhNjDpMiBeC_xHqqkZx_
	FFInsertColumn(pSheetCtrl, 0, L"", LVCFMT_LEFT, 10);

	//----- _xZkqqHx_iDiMiDeDiDiEiBfLiDiKiDfIiDgHiCmMiPiJiKpKjAnNjCoI_xHqqkZx_ -----
	CListCtrl* pLayerCtrl = (CListCtrl*)GetDlgItem(IDC_CST_LSV_LAYER);
	// _xZkqqHx_jBfDiNhDjBeJjBpAiDhNiBfLiDeOiCkKjFfMiOkGiClDiCoKiCoJiCoGiCkEiCmJiDfIiDfOiDeDiDiLjFmPiNfIiBeC_xHqqkZx_
	pLayerCtrl->SetExtendedStyle(pLayerCtrl->GetExtendedStyle()|LVS_EX_FULLROWSELECT);
	// _xZkqqHx_iDeBiDeDiDfCiDjDjFfMiOkGjHhAiDeDiDiBiBfLiDfHiDiKiDfIiDgHiCpAjAnNjCoIiBeC_xHqqkZx_
	pLayerCtrl->SetImageList(&m_imageList, LVSIL_SMALL);
	// _xZkqqHx_iJlMiCmMjClHiClDiCmFiBeBiDeKiDiJiDiAiCpAjBhNjDpMiBeC_xHqqkZx_
	FFInsertColumn(pLayerCtrl, 0, L"", LVCFMT_LEFT, 10);

	CString strName;
	WString wstrName;
	long lCurSheetIdx = 0;
	for (long lIdx = 0; lIdx < g_pDoc->GetSheetManager()->GetSheetIndexSize(); lIdx++)
	{
		SheetID stid = g_pDoc->GetSheetManager()->SheetIndexToID(lIdx);
		// _xZkqqHx_iDfGiBfLiDgHjGlMiCpAiOoGjDlOiBeC_xHqqkZx_
		g_pDoc->GetSheetManager()->GetSheetInfo(wstrName, stid);
		strName = WStrToTStr(wstrName);
		LV_ITEM	lvitem;
		lvitem.mask = LVIF_IMAGE|LVIF_TEXT;
		lvitem.iItem = lIdx;
		lvitem.iSubItem = 0;
		lvitem.pszText = (_TCHAR*)(const _TCHAR*)strName;
		if (stid == g_pDoc->GetCurrentSheetId())
		//----- _xZkqqHx_iDeKiDiMiDjDiDgHiDfGiBfLiDgHiCmMiPoKiNiH_xHqqkZx_ -----
		{
			lvitem.iImage = 0;	// _xZkqqHx_iDeKiDiMiDjDiDgHiDhNiBfLiDeOiCmMiCnNiBeC_xHqqkZx_
			lCurSheetIdx = lIdx;
		} else
		//----- _xZkqqHx_iDeKiDiMiDjDiDgHiDfGiBfLiDgHiImIiKePiCmMiPoKiNiH_xHqqkZx_ -----
		{
			lvitem.iImage = 4;	// _xZkqqHx_iDhNiBfLiDeOjGlDiClFiBeC_xHqqkZx_
		}
		pSheetCtrl->InsertItem(&lvitem);
		pSheetCtrl->SetItemData(lIdx, stid);
	}
	//----- _xZkqqHx_iDeKiDiJiDiAiCmMjAnNjCoI_xHqqkZx_ -----
	CRect rect;
	pSheetCtrl->GetClientRect(rect);
	// _xZkqqHx_jClHiClDiCpAjAnNjCoIiBeCiClBiClBiCmFjAnNjCoIiClFiCmIiCkCiCmGiBeBiDfIiDeOiDiNiBfLiDiLiDgPiBfLjFjNiCpAiNgMjHlGiCmFiCkLiCmIiCkCiBeC_xHqqkZx_
	pSheetCtrl->SetColumnWidth(0, rect.Width());

	// _xZkqqHx_iDeKiDiMiDjDiDgHiDfGiBfLiDgHiCpAjBeJjBpAiPpDjBnEiCmJiBeC_xHqqkZx_OnItemchangedCstLsvSheet_xZkqqHx_iCkKjBkGiOjOiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
	pSheetCtrl->SetItemState(lCurSheetIdx, LVIS_SELECTED, LVIS_SELECTED);
	//----- _xZkqqHx_iDeKiDiMiDjDiDgHiDfGiBfLiDgHiCkKiDiKiDfIiDgHiDfCiDjDiDgHiDiNiBfLiDiLjCiGiJjLiCmJjHiIiCoJiCoGiCkEiCmJiDfIiDeOiDiNiBfLiDiL_xHqqkZx_ -----
	CPoint point;
	pSheetCtrl->GetItemPosition(lCurSheetIdx, &point);
	pSheetCtrl->Scroll(CSize(0, point.y - (rect.Height() / 2)));

	//----- _xZkqqHx_iDeKiDiMiDjDiDgHiDiMiDeDiDiEiBfLiImKjChFiCkKiDhNiDeFiDfIiDeKiBfLiDfMiDiLiPoDiCmJjHiIiCoJiCoGiCkEiCmJiDfPiDeDiDeBiDiNiDePiInKjDkO_xHqqkZx_ -----
	// _xZkqqHx_iDeKiDiMiDjDiDgHiDiMiDeDiDiEiBfLiCmMiDeBiDeDiDgFiDiAiDeDiDjDiDgGiDgCiDeOiDfIiBeC_xHqqkZx_
	const DWORD dwCurrent = g_pDoc->GetCurrentSheet()->GetLayerSize() - 1 - g_pDoc->GetCurrentLayerIdx();
	CRect rtItem;
	pLayerCtrl->GetItemRect(dwCurrent, rtItem, LVIR_BOUNDS);
	CPoint ptItem = rtItem.CenterPoint();
	// ptItem_xZkqqHx_iCpAiDfPiDeDiDeBiDiNiDePiNmAjFfHiMgOiCmJjFmPiKlHiBeC_xHqqkZx_
	pLayerCtrl->MapWindowPoints(this, &ptItem, 1);

	// _xZkqqHx_iDfPiDeDiDeBiDiNiDePiCmMjCfAiImKjFfMiOkGiCpAjAnNjCoIiClHiCoJiBeC_xHqqkZx_
	::SetUnitString(m_hWnd);
	// _xZkqqHx_jHjIiCkLjIhCjBmOiJjOjFlGiOjKjHpBiCmMjAnNjCoIiCpAiNhDiCkEiBeC_xHqqkZx_
	::RightByLeftHand(m_hWnd);
	// _xZkqqHx_iDfPiDeDiDeBiDiNiDePiCpAiDhNiDeFiDfIiImKjChFiCmJiInKjDkOiBeC_xHqqkZx_
	FFJustifyWindow(m_hWnd, &ptItem);

	return TRUE;  // _xZkqqHx_iDfCiDjDiDgHiDiNiBfLiDiLiCmJiDhEiDeIiBfLiDeKiDfIiCpAjAnNjCoIiClFiCmIiCkCiCmGiCkLiBeBjGnPiCoIjCgMiCmN_xHqqkZx_ TRUE _xZkqqHx_iCmGiCmIiCoIiCnMiClH_xHqqkZx_
	              // _xZkqqHx_jHoBiKeP_xHqqkZx_: OCX _xZkqqHx_iDhGiDiNiDhAiDgFiDeC_xHqqkZx_ _xZkqqHx_iDhJiBfLiDfHiCmMjGnPiCoIjCgMiCmN_xHqqkZx_ FALSE _xZkqqHx_iCmGiCmIiCoIiCnMiClH_xHqqkZx_
} // CFCDLgCrossSheet::OnInitDialog.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCDLgCrossSheet::OnOK
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	OK_xZkqqHx_iDhLiDfOiDjDiCpAiJjPiClFiClNiCmGiCkLiCmJiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.01 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void CFCDLgCrossSheet::OnOK ()
{
do {
	CListCtrl* pSheetCtrl = (CListCtrl*)GetDlgItem(IDC_CST_LSV_SHEET);
	CListCtrl* pLayerCtrl = (CListCtrl*)GetDlgItem(IDC_CST_LSV_LAYER);
	POSITION pos = pSheetCtrl->GetFirstSelectedItemPosition();
	if (pos == NULL) break;
	int iSheetIdx = pSheetCtrl->GetNextSelectedItem(pos);
	pos = pLayerCtrl->GetFirstSelectedItemPosition();
	if (pos == NULL) break;
	int iLayerIdx = pLayerCtrl->GetNextSelectedItem(pos);
	DWORD dwLayerIdx = pLayerCtrl->GetItemCount() - 1 - iLayerIdx;

	g_pDoc->SessionBegin();
//----- 06.02.15 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
//	if (g_pDoc->CmdMoveSheetLayerObjs(g_pView->SelectObjVector(),
//									pSheetCtrl->GetItemData(iSheetIdx), dwLayerIdx))
//	{
//		// _xZkqqHx_iNmEjFgAiJoGjHhAiCmMiMmFjHeMiDiKiBfLiDfHiDiHiDjDiCmJjHmMiIoGiCpAjCmHiJmBiBeC_xHqqkZx_
//		g_pView->AppendToLastRgn(g_pView->SelectObjVector());
//	}
//----- 06.02.15 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
	// _xZkqqHx_jFjEjFgJiCkKiInKjDkOiClDiCoKiClNiCkJiBeI_xHqqkZx_
	BOOL bMoved = FALSE;
	mdef_const_iterator(ObjDynabaseVector, iObj);
	m1_for (iObj, g_pView->SelectObjVector())
	{
		if (g_pDoc->CmdCross1ObjSheetLayer(*iObj, pSheetCtrl->GetItemData(iSheetIdx), dwLayerIdx))
			bMoved = TRUE;
	}
	// _xZkqqHx_iNmEjFgAiJoGjHhAiCmMiMmFjHeMiDiKiBfLiDfHiDiHiDjDiCmJjHmMiIoGiCpAjCmHiJmBiBeC_xHqqkZx_
	if (bMoved)
		g_pView->AppendToLastRgn(g_pView->SelectObjVector());
//----- 06.02.15 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----
	g_pDoc->SessionEnd();

	// _xZkqqHx_iDiMiDeDiDiEiBfLjFmPiNfIiCpAiDhCiDiFiBfLiCmJjCmKjCgNiBeCjBeJjBpAjFjEjFgJiCmMjFmPiNfIjDjJiCpAiNhDiCkEiBeC_xHqqkZx_
	g_pView->PostMessage(WM_USER_LAYER_UPDATED);
	// _xZkqqHx_iDhEiDiMiBfLiDiAiCmJiDiMiDeDiDiEiBfLjFmPiNfIiCpAjCmKjCgNiBeC_xHqqkZx_
	FFGetMainWnd()->PostMessage(WM_USER_LAYER_UPDATED);
	// _xZkqqHx_iMmFjHeMiDiKiBfLiDfHiDiHiDjDiCpAiNmEjFgAiJoGiBeC_xHqqkZx_
	g_pView->SendRgnRedraw();

} while (FALSE);
	// Superclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
	BASE_CLASS::OnOK();
} // CFCDLgCrossSheet::OnOK.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCDLgCrossSheet::OnDblclkCstLsvSheet
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDfGiBfLiDgHiDiKiDfIiDgHiCpAiDfPiDhFiDiLiDeOiDiKiDgCiDeOiCmFiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.01 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void CFCDLgCrossSheet::OnDblclkCstLsvSheet (NMHDR* pNMHDR, LRESULT* pResult)
{
	// OK_xZkqqHx_iCpAiDhMiDfIiDgHiClHiCoJiBeC_xHqqkZx_
	PostMessage(WM_COMMAND, IDOK, 0);
	*pResult = 0;
} // CFCDLgCrossSheet::OnDblclkCstLsvSheet.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCDLgCrossSheet::OnDblclkCstLsvLayer
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDiMiDeDiDiEiBfLiDiKiDfIiDgHiCpAiDfPiDhFiDiLiDeOiDiKiDgCiDeOiCmFiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.01 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void CFCDLgCrossSheet::OnDblclkCstLsvLayer (NMHDR* pNMHDR, LRESULT* pResult)
{
	// OK_xZkqqHx_iCpAiDhMiDfIiDgHiClHiCoJiBeC_xHqqkZx_
	PostMessage(WM_COMMAND, IDOK, 0);
	*pResult = 0;
} // CFCDLgCrossSheet::OnDblclkCstLsvLayer.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCDLgCrossSheet::OnRdblclkCstLsvLayer
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDiMiDeDiDiEiBfLiDiKiDfIiDgHiCmMiJeFiDfPiDhFiDiLiDeOiDiKiDgCiDeOiCmFiOmAiNhDiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.07.20 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void CFCDLgCrossSheet::OnRdblclkCstLsvLayer (NMHDR* pNMHDR, LRESULT* pResult)
{
	// OK_xZkqqHx_iCpAiDhMiDfIiDgHiClHiCoJiBeC_xHqqkZx_
	PostMessage(WM_COMMAND, IDOK, 0);
	*pResult = 0;
} // CFCDLgCrossSheet::OnRdblclkCstLsvLayer.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCDLgCrossSheet::OnRdblclkCstLsvSheet
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDfGiBfLiDgHiDiKiDfIiDgHiCmMiJeFiDfPiDhFiDiLiDeOiDiKiDgCiDeOiCmFiOmAiNhDiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.07.20 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void CFCDLgCrossSheet::OnRdblclkCstLsvSheet (NMHDR* pNMHDR, LRESULT* pResult)
{
	// OK_xZkqqHx_iCpAiDhMiDfIiDgHiClHiCoJiBeC_xHqqkZx_
	PostMessage(WM_COMMAND, IDOK, 0);
	*pResult = 0;
} // CFCDLgCrossSheet::OnRdblclkCstLsvSheet.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCDLgCrossSheet::OnItemchangedCstLsvSheet
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDfGiBfLiDgHiDiKiDfIiDgHiCkKjFmPiNfIiClDiCoKiClNiOjOiCmJiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pNMHDR
 *			pResult
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.01 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void CFCDLgCrossSheet::OnItemchangedCstLsvSheet (NMHDR* pNMHDR, LRESULT* pResult)
{
	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;

	CListCtrl* pSheetCtrl = (CListCtrl*)GetDlgItem(IDC_CST_LSV_SHEET);
	CListCtrl* pLayerCtrl = (CListCtrl*)GetDlgItem(IDC_CST_LSV_LAYER);
	// _xZkqqHx_jBfDiCmEiCmMiDeBiDeDiDgFiDiAiCpAiNoNiPjMiBeC_xHqqkZx_
	pLayerCtrl->DeleteAllItems();
	SheetID stid = pSheetCtrl->GetItemData(pNMListView->iItem);
	// _xZkqqHx_iDfOiBfLiDfBiDgCiDgHiDfGiBfLiDgHiCmMiDiMiDeDiDiEiBfLiDhNiDgMiBfLiDfHiDiDiCpAiOoGjDlOiBeC_xHqqkZx_
	FCLayerManager* pSheet = g_pDoc->GetSheetManager()->GetSheet(stid);
	WString wstrName;
	// _xZkqqHx_iDeKiDiMiDjDiDgHiDiMiDeDiDiEiBfLiCmMiDeBiDeDiDgFiDiAiDeDiDjDiDgGiDgCiDeOiDfIiBeC_xHqqkZx_
	const DWORD dwCurrent = pSheet->GetLayerSize() - 1 - pSheet->GetCurrentLayerIdx();
	for (DWORD dwIdx = 0; dwIdx < pSheet->GetLayerSize(); dwIdx++)
	{
		// _xZkqqHx_iDiMiDeDiDiEiBfLiDeDiDjDiDgGiDgCiDeOiDfIiBeC_xHqqkZx_
		const DWORD dwLayerIdx = pSheet->GetLayerSize() - 1 - dwIdx;
		// _xZkqqHx_iDiMiDeDiDiEiBfLjGlMiCpAiOoGjDlOiBeC_xHqqkZx_
		pSheet->GetLayerInfo(&wstrName, NULL, dwLayerIdx);
		WStrToTStr strName(wstrName);
		LV_ITEM	lvitem;
		lvitem.mask = LVIF_IMAGE|LVIF_TEXT;
		lvitem.iItem = dwIdx;
		lvitem.iSubItem = 0;
		lvitem.pszText = const_cast<_TCHAR*>((const _TCHAR*)strName);

		if (g_pDoc->GetCurrentSheetId() == stid)
		//----- _xZkqqHx_iDfOiBfLiDfBiDgCiDgHiDfGiBfLiDgHiCkKiDeKiDiMiDjDiDgHiDfGiBfLiDgHiCmMiPoKiNiH_xHqqkZx_ -----
		{
			if (dwIdx == dwCurrent)
			//----- _xZkqqHx_iDeKiDiMiDjDiDgHiDiMiDeDiDiEiBfLiCmMiPoKiNiH_xHqqkZx_ -----
			{
				// _xZkqqHx_jBeJjBpAjFjEjFgJiDiMiDeDiDiEiBfLiCkKiKnMiCnMiCoKiCoJiCkJiCmHiCkEiCkJiBeC_xHqqkZx_
				if (m_stLayer.find(dwLayerIdx) != m_stLayer.end())
					lvitem.iImage = 2;	// _xZkqqHx_iDeKiDiMiDjDiDgHiDhNiBfLiDeOiCmGiDgAiDeGiDgCiDeOiDhNiBfLiDeOiCmMiPgEiCmIiCoIiBeC_xHqqkZx_
				else
					lvitem.iImage = 0;	// _xZkqqHx_iDeKiDiMiDjDiDgHiDhNiBfLiDeOiCmMiCnNiBeC_xHqqkZx_
			} else
			//----- _xZkqqHx_iDeKiDiMiDjDiDgHiDiMiDeDiDiEiBfLiImIiKePiCmMiPoKiNiH_xHqqkZx_ -----
			{
				// _xZkqqHx_jBeJjBpAjFjEjFgJiDiMiDeDiDiEiBfLiCkKiKnMiCnMiCoKiCoJiCkJiCmHiCkEiCkJiBeC_xHqqkZx_
				if (m_stLayer.find(dwLayerIdx) != m_stLayer.end())
					lvitem.iImage = 1;	// _xZkqqHx_iDgAiDeGiDgCiDeOiDhNiBfLiDeOiCmMiCnNiBeC_xHqqkZx_
				else
					lvitem.iImage = 4;	// _xZkqqHx_iDhNiBfLiDeOjGlDiClFiBeC_xHqqkZx_
			}
		} else
		//----- _xZkqqHx_iDfOiBfLiDfBiDgCiDgHiDfGiBfLiDgHiCkKiDeKiDiMiDjDiDgHiDfGiBfLiDgHiImIiKePiCmMiPoKiNiH_xHqqkZx_ -----
		{
			if (dwIdx == dwCurrent)
			//----- _xZkqqHx_iDeKiDiMiDjDiDgHiDiMiDeDiDiEiBfLiCmMiPoKiNiH_xHqqkZx_ -----
			{
				lvitem.iImage = 0;	// _xZkqqHx_iDeKiDiMiDjDiDgHiDhNiBfLiDeOiCmMiCnNiBeC_xHqqkZx_
			} else
			//----- _xZkqqHx_iDeKiDiMiDjDiDgHiDiMiDeDiDiEiBfLiImIiKePiCmMiPoKiNiH_xHqqkZx_ -----
			{
				lvitem.iImage = 4;	// _xZkqqHx_iDhNiBfLiDeOjGlDiClFiBeC_xHqqkZx_
			}
		}
		pLayerCtrl->InsertItem(&lvitem);
	}

	//----- _xZkqqHx_iDeKiDiJiDiAiCmMjAnNjCoI_xHqqkZx_ -----
	CRect rect;
	pLayerCtrl->GetClientRect(rect);
	// _xZkqqHx_jClHiClDiCpAjAnNjCoIiBeCiClBiClBiCmFjAnNjCoIiClFiCmIiCkCiCmGiBeBiDfIiDeOiDiNiBfLiDiLiDgPiBfLjFjNiCpAiNgMjHlGiCmFiCkLiCmIiCkCiBeC_xHqqkZx_
	pLayerCtrl->SetColumnWidth(0, rect.Width());

	// _xZkqqHx_iDeKiDiMiDjDiDgHiDiMiDeDiDiEiBfLiCpAjBeJjBpAiPpDjBnEiCmJiBeC_xHqqkZx_
	pLayerCtrl->SetItemState(dwCurrent, LVIS_SELECTED, LVIS_SELECTED);

	//----- _xZkqqHx_iDeKiDiMiDjDiDgHiDiMiDeDiDiEiBfLiCkKiDiKiDfIiDgHiDfCiDjDiDgHiDiNiBfLiDiLjCiGiJjLiCmJjHiIiCoJiCoGiCkEiCmJiDfIiDeOiDiNiBfLiDiL_xHqqkZx_ -----
	CPoint point;
	pLayerCtrl->GetItemPosition(dwCurrent, &point);
	pLayerCtrl->Scroll(CSize(0, point.y - (rect.Height() / 2)));

	*pResult = 0;
} // CFCDLgCrossSheet::OnItemchangedCstLsvSheet.
