#include "stdafx.h"
#include "MainFrame.h"		// For g_pFrame.
#include "IpFrame.h"		// For g_pInPlace.
//----- 06.04.05 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//#include "HistViewFrame.h"	// For FFHistViewFrame().
//#include "HistDrawFrame.h"	// For FFHistDrawFrame().
//#include "HTreeManager.h"	// For FTHTViewMode.
//----- 06.04.05 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----
#include "FrameWnd.h"		// This header.

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

static FCFrameWnd	s_FrameWnd;

////////////////////////////////////////////////////////////////////////////
// FCFrame_xZkqqHx_iDiBiDjDiDgPiKnGjAjEiBeC_xHqqkZx_

BOOL FCFrameWnd::IsAvailable () const
{
	return (g_pFrame != NULL) || (g_pInPlace != NULL);
} // FCFrameWnd::IsAvailable.

CFrameWnd* FCFrameWnd::GetWnd ()
{
	if (g_pInPlace != NULL)
		return g_pInPlace;
	else
	if (g_pFrame != NULL)
		return g_pFrame;
	else
		return NULL;
} // FCFrameWnd::GetWnd.

HWND FCFrameWnd::GetSafeHwnd () const
{
	if (g_pInPlace != NULL)
		return g_pInPlace->GetSafeHwnd();
	else
	if (g_pFrame != NULL)
		return g_pFrame->GetSafeHwnd();
	else
		return NULL;
} // FCFrameWnd::GetSafeHwnd.

//----- 05.11.13 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//void FCFrameWnd::MyLoadBarState (const wchar_t* wcpProfileName)
//{
//	if (g_pInPlace != NULL)
//		g_pInPlace->MyLoadBarState(wcpProfileName);
//	else
//		g_pFrame->MyLoadBarState(wcpProfileName);
//} // FCFrameWnd::MyLoadBarState.
//
//void FCFrameWnd::MySaveBarState (const wchar_t* wcpProfileName)
//{
//	if (g_pInPlace != NULL)
//		g_pInPlace->MySaveBarState(wcpProfileName);
//	else
//		g_pFrame->MySaveBarState(wcpProfileName);
//} // FCFrameWnd::MySaveBarState.
//----- 05.11.13 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

void FCFrameWnd::OnCloseDocument ()
{
	if (g_pInPlace != NULL)
		g_pInPlace->OnCloseDocument();
	else
		g_pFrame->OnCloseDocument();
} // FCFrameWnd::OnCloseDocument.

void FCFrameWnd::SetStatusBarText (const wchar_t* wcpText, DWORD dwId)
{
	if (g_pInPlace != NULL)
		g_pInPlace->SetStatusBarText(wcpText, dwId);
	else
		g_pFrame->SetStatusBarText(wcpText, dwId);
} // FCFrameWnd::SetStatusBarText.

BOOL FCFrameWnd::IsOvrMode () const
{
	if (g_pInPlace != NULL)
		return g_pInPlace->IsOvrMode();
	else
		return g_pFrame->IsOvrMode();
} // FCFrameWnd::IsOvrMode.

void FCFrameWnd::SetOvrMode (BOOL bIsOvr)
{
	if (g_pInPlace != NULL)
		g_pInPlace->SetOvrMode(bIsOvr);
	else
		g_pFrame->SetOvrMode(bIsOvr);
} // FCFrameWnd::SetOvrMode.

//----- 06.04.05 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//void FCFrameWnd::UpdateStatusBarDate ()
//{
//	if (g_pInPlace != NULL)
//	{
//	} else
//	{
//		if (FFHistViewFrame() != NULL)
//			FFHistViewFrame()->UpdateStatusBarDate();
//	}
//} // FCFrameWnd::UpdateStatusBarDate.
//----- 06.04.05 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

CFCCtlBrHRuler* FCFrameWnd::HRuler () const
{
	if (g_pInPlace != NULL)
		return g_pInPlace->HRuler();
	else
		return g_pFrame->HRuler();
} // FCFrameWnd::HRuler.

CFCCtlBrVRuler* FCFrameWnd::VRuler () const
{
	if (g_pInPlace != NULL)
		return g_pInPlace->VRuler();
	else
		return g_pFrame->VRuler();
} // FCFrameWnd::VRuler.

HACCEL FCFrameWnd::GetUserAccelerator () const
{
	if (g_pInPlace != NULL)
		return g_pInPlace->GetUserAccelerator();
	else
		return g_pFrame->GetUserAccelerator();
} // FCFrameWnd::GetUserAccelerator.

void FCFrameWnd::SetRulerMMKVisible (short nIndex, BOOL bIsVisible)
{
	if (g_pInPlace != NULL)
		g_pInPlace->SetRulerMMKVisible(nIndex, bIsVisible);
	else
		g_pFrame->SetRulerMMKVisible(nIndex, bIsVisible);
} // FCFrameWnd::SetRulerMMKVisible.

void FCFrameWnd::MoveRulerMMK (short nIndex, const DBLPoint& mmpt, const wchar_t* tcpAddText)
{
	if (g_pInPlace != NULL)
		g_pInPlace->MoveRulerMMK(nIndex, mmpt, tcpAddText);
	else
		g_pFrame->MoveRulerMMK(nIndex, mmpt, tcpAddText);
} // FCFrameWnd::MoveRulerMMK.

void FCFrameWnd::MoveRulerMMK (const DBLPoint& mmpt0, const DBLPoint& mmpt1, const wchar_t* tcpAddText)
{
	if (g_pInPlace != NULL)
		g_pInPlace->MoveRulerMMK(mmpt0, mmpt1, tcpAddText);
	else
		g_pFrame->MoveRulerMMK(mmpt0, mmpt1, tcpAddText);
} // FCFrameWnd::MoveRulerMMK.

void FCFrameWnd::AddAutoAltWindow (HWND hWnd)
{
	if (g_pInPlace != NULL)
		g_pInPlace->AddAutoAltWindow(hWnd);
	else
		g_pFrame->AddAutoAltWindow(hWnd);
} // FCFrameWnd::AddAutoAltWindow.

void FCFrameWnd::DeleteAutoAltWindow (HWND hWnd)
{
	if (g_pInPlace != NULL)
		g_pInPlace->DeleteAutoAltWindow(hWnd);
	else
		g_pFrame->DeleteAutoAltWindow(hWnd);
} // FCFrameWnd::DeleteAutoAltWindow.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCFrameWnd::IsAutoAltWindow
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iOkJjDkO_xHqqkZx_ALT_xZkqqHx_iCmMjBmOiPnLiCkJiCmHiCkEiCkJiCpAjClCiCnHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	hwnd	:_xZkqqHx_jClCiCnHiCoJiDeFiDeCiDjDiDgIiDeFiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_iOkJjDkO_xHqqkZx_ALT_xZkqqHx_iCmMjBmOiPnLiCmMiPoKiNiHiCmN_xHqqkZx_TRUE_xZkqqHx_iBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.01.20 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
BOOL FCFrameWnd::IsAutoAltWindow (HWND hWnd) const
{
	if (g_pInPlace != NULL)
		return g_pInPlace->IsAutoAltWindow(hWnd);
	else
		return g_pFrame->IsAutoAltWindow(hWnd);
} // FCFrameWnd::IsAutoAltWindow.

void FCFrameWnd::SetIgnoreAccelTable (BOOL bIgnore)
{
	if (g_pInPlace != NULL)
		g_pInPlace->SetIgnoreAccelTable(bIgnore);
	else
		g_pFrame->SetIgnoreAccelTable(bIgnore);
} // FCFrameWnd::SetIgnoreAccelTable.

//----- 05.07.03 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//void FCFrameWnd::OnUpdateSelected ()
//{
//	if (g_pInPlace != NULL)
//		g_pInPlace->OnUpdateSelected();
//	else
//		g_pFrame->OnUpdateSelected();
//} // FCFrameWnd::OnUpdateSelected.
//----- 05.07.03 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

void FCFrameWnd::InitContents ()
{
	if (g_pInPlace != NULL)
		g_pInPlace->InitContents();
	else
		g_pFrame->InitContents();
} // FCFrameWnd::InitContents.

void FCFrameWnd::DeleteContents ()
{
	if (g_pInPlace != NULL)
		g_pInPlace->DeleteContents();
	else
		g_pFrame->DeleteContents();
} // FCFrameWnd::DeleteContents.

//----- 06.02.27 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//void FCFrameWnd::SendDataMessage (HWND hWnd, DWORD dwMessage, DWORD dwDataSz, void* pData)
//{
//	if (g_pInPlace != NULL)
//		g_pInPlace->SendDataMessage(hWnd, dwMessage, dwDataSz, pData);
//	else
//		g_pFrame->SendDataMessage(hWnd, dwMessage, dwDataSz, pData);
//} // FCFrameWnd::SendDataMessage.
//----- 06.02.27 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

void FCFrameWnd::OnBeginPrintPreview ()
{
	if (g_pInPlace != NULL)
		g_pInPlace->OnBeginPrintPreview();
	else
		g_pFrame->OnBeginPrintPreview();
} // FCFrameWnd::OnBeginPrintPreview.

void FCFrameWnd::OnEndPrintPreview ()
{
	if (g_pInPlace != NULL)
		g_pInPlace->OnEndPrintPreview();
	else
		g_pFrame->OnEndPrintPreview();
} // FCFrameWnd::OnEndPrintPreview.

LRESULT FCFrameWnd::SendMessage (UINT message, WPARAM wParam, LPARAM lParam)
{
	if (g_pInPlace != NULL)
		return g_pInPlace->SendMessage(message, wParam, lParam);
	else
	if (g_pFrame != NULL)
		return g_pFrame->SendMessage(message, wParam, lParam);
	else
		return 0;
} // FCFrameWnd::SendMessage.

BOOL FCFrameWnd::PostMessage (UINT message, WPARAM wParam, LPARAM lParam)
{
	if (g_pInPlace != NULL)
		return g_pInPlace->PostMessage(message, wParam, lParam);
	else
	if (g_pFrame != NULL)
		return g_pFrame->PostMessage(message, wParam, lParam);
	else
		return 0;
} // FCFrameWnd::PostMessage.

void FCFrameWnd::SetCurCursor (const CWnd* pWnd, HCURSOR hCursor)
{
//----- 03.07.25 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
//	CRect rt;
//	pWnd->GetClientRect(rt);
//	pWnd->ClientToScreen(rt);
//	SetCurCursor(DWORD(pWnd->m_hWnd), rt, hCursor);
//----- 03.07.25 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
	if (g_pInPlace != NULL)
		g_pInPlace->SetCurCursor(pWnd->m_hWnd, hCursor);
	else
		g_pFrame->SetCurCursor(pWnd->m_hWnd, hCursor);
//----- 03.07.25 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----
} // FCFrameWnd::SetCurCursor.

//----- 03.07.25 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//void FCFrameWnd::SetCurCursor (DWORD dwId, const CRect& dvrt, HCURSOR hCursor)
//{
//	if (g_pInPlace != NULL)
//		g_pInPlace->SetCurCursor(dwId, dvrt, hCursor);
//	else
//		g_pFrame->SetCurCursor(dwId, dvrt, hCursor);
//} // FCFrameWnd::SetCurCursor.
//----- 03.07.25 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

//----- 04.05.18 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//void FCFrameWnd::SetPursuerTextOn (HWND hWnd, const wchar_t* wcpText)
//{
//	if (g_pInPlace != NULL)
//		g_pInPlace->SetPursuerTextOn(hWnd, wcpText);
//	else
//		g_pFrame->SetPursuerTextOn(hWnd, wcpText);
//} // FCFrameWnd::SetPursuerTextOn.
//
//void FCFrameWnd::SetPursuerTextOff ()
//{
//	if (g_pInPlace != NULL)
//		g_pInPlace->SetPursuerTextOff();
//	else
//		g_pFrame->SetPursuerTextOff();
//} // FCFrameWnd::SetPursuerTextOff.
//----- 04.05.18 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

//----- 04.06.30 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
//long FCFrameWnd::GetZoomListValue (long lIndex) const
//{
//	if (g_pInPlace != NULL)
//		return g_pInPlace->GetZoomListValue(lIndex);
//	else
//		return g_pFrame->GetZoomListValue(lIndex);
//} // FCFrameWnd::GetZoomListValue.
//----- 04.06.30 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
//----- 04.11.05 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//long FCFrameWnd::GetZoomListValue (DWORD dwCtrlId, long lIndex) const
//{
//	if (g_pInPlace != NULL)
//		return g_pInPlace->GetZoomListValue(dwCtrlId, lIndex);
//	else
//		return g_pFrame->GetZoomListValue(dwCtrlId, lIndex);
//} // FCFrameWnd::GetZoomListValue.
//----- 04.11.05 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----
//----- 04.06.30 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----

//----- 06.04.05 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//void FCFrameWnd::SetHiviewTempMark (short nForkOrLabel,
//									const wchar_t* wcpProjectPath,
//									long lDocumentId,
//									flint fliSessionIndex)
//{
//	if (g_pInPlace != NULL)
//	{
//	} else
//	{
//		if (FFHistViewFrame() != NULL)
//			FFHistViewFrame()->SetHiviewTempMark(nForkOrLabel, wcpProjectPath, lDocumentId, fliSessionIndex);
//		else
//		if (FFHistDrawFrame() != NULL)
//			FFHistDrawFrame()->SetHiviewTempMark(nForkOrLabel, wcpProjectPath, lDocumentId, fliSessionIndex);
//	}
//} // FCFrameWnd::SetHiviewTempMark.
//
//void FCFrameWnd::SetHiviewMarkUpHidocument (	const wchar_t* wcpProjectPath,
//										const longSet& stDocId)
//{
//	if (g_pInPlace != NULL)
//	{
//	} else
//	{
//		if (FFHistViewFrame() != NULL)
//			FFHistViewFrame()->SetHiviewMarkUpHidocument(wcpProjectPath, stDocId);
//		else
//		if (FFHistDrawFrame() != NULL)
//			FFHistDrawFrame()->SetHiviewMarkUpHidocument(wcpProjectPath, stDocId);
//	}
//} // FCFrameWnd::SetHiviewMarkUpHidocument.
//
//long FCFrameWnd::GetHiMoveOperation (long& lOpeValue) const
//{
//	if (g_pInPlace != NULL)
//	{
//	} else
//	{
//		if (FFHistViewFrame() != NULL)
//			return FFHistViewFrame()->GetHiMoveOperation(lOpeValue);
//	}
//	return 0;
//} // FCFrameWnd::GetHiMoveOperation.
//
//BOOL FCFrameWnd::SyncHiviewToDocument (	FTHTViewMode viewMode,
//										const wchar_t* wcpProjectPath,
//										long lDocumentId,
//										flint fliSessionIndex,
//										BOOL bIsSelect,
//										BOOL bIsMark,
//										BOOL bIsFitHtreeViewZoom,
//										BOOL bScrollTo,
//										const WStringVector* vProjectPath,
//										const longVector* vDocumentId)
//{
//	if (g_pInPlace != NULL)
//	{
//	} else
//	{
//		if (FFHistViewFrame() != NULL)
//			return FFHistViewFrame()->SyncHiviewToDocument(
//										viewMode,
//										wcpProjectPath,
//										lDocumentId,
//										fliSessionIndex,
//										bIsSelect,
//										bIsMark,
//										bIsFitHtreeViewZoom,
//										bScrollTo,
//										vProjectPath,
//										vDocumentId);
//		else
//		if (FFHistDrawFrame() != NULL)
//			return FFHistDrawFrame()->SyncHiviewToDocument(
//										viewMode,
//										wcpProjectPath,
//										lDocumentId,
//										fliSessionIndex,
//										bIsSelect,
//										bIsMark,
//										bIsFitHtreeViewZoom,
//										bScrollTo,
//										vProjectPath,
//										vDocumentId);
//	}
//	return TRUE;
//} // FCFrameWnd::SyncHiviewToDocument.
//
//void FCFrameWnd::SetHiviewFontZoom (double dZoom)
//{
//	if (g_pInPlace != NULL)
//	{
//	} else
//	{
//		if (FFHistViewFrame() != NULL)
//			FFHistViewFrame()->SetHiviewFontZoom(dZoom);
//		else
//		if (FFHistDrawFrame() != NULL)
//			FFHistDrawFrame()->SetHiviewFontZoom(dZoom);
//	}
//} // FCFrameWnd::SetHiviewFontZoom.
//
//void FCFrameWnd::ChangeHiviewViewMode (FTHTViewMode viewMode)
//{
//	if (g_pInPlace != NULL)
//	{
//	} else
//	{
//		if (FFHistViewFrame() != NULL)
//			FFHistViewFrame()->ChangeHiviewViewMode(viewMode);
//		else
//		if (FFHistDrawFrame() != NULL)
//			FFHistDrawFrame()->ChangeHiviewViewMode(viewMode);
//	}
//} // FCFrameWnd::ChangeHiviewViewMode.
//
//void FCFrameWnd::SetHiviewZoom256 (long lZoom256)
//{
//	if (g_pInPlace != NULL)
//	{
//	} else
//	{
//		if (FFHistViewFrame() != NULL)
//			FFHistViewFrame()->SetHiviewZoom256(lZoom256);
//		else
//		if (FFHistDrawFrame() != NULL)
//			FFHistDrawFrame()->SetHiviewZoom256(lZoom256);
//	}
//} // FCFrameWnd::SetHiviewZoom256.
//----- 06.04.05 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

void FCFrameWnd::SetOnCmdMsgWnd (HWND hWnd)
{
	if (g_pInPlace != NULL)
		g_pInPlace->SetOnCmdMsgWnd(hWnd);
	else
	if (g_pFrame != NULL)
		g_pFrame->SetOnCmdMsgWnd(hWnd);
} // FCFrameWnd::SetOnCmdMsgWnd.

//----- 06.02.25 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//void FCFrameWnd::ResetOnCmdMsgWnd (CWnd* pWnd)
//{
//	if (g_pInPlace != NULL)
//		g_pInPlace->ResetOnCmdMsgWnd(pWnd);
//	else
//	if (g_pFrame != NULL)
//		g_pFrame->ResetOnCmdMsgWnd(pWnd);
//} // FCFrameWnd::ResetOnCmdMsgWnd.
//----- 06.02.25 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

void FCFrameWnd::RegisterScrollWindow (HWND hWnd)
{
	if (g_pInPlace != NULL)
		g_pInPlace->RegisterScrollWindow(hWnd);
	else
	if (g_pFrame != NULL)
		g_pFrame->RegisterScrollWindow(hWnd);
} // FCFrameWnd::RegisterScrollWindow.

void FCFrameWnd::UnregisterScrollWindow (HWND hWnd)
{
	if (g_pInPlace != NULL)
		g_pInPlace->UnregisterScrollWindow(hWnd);
	else
	if (g_pFrame != NULL)
		g_pFrame->UnregisterScrollWindow(hWnd);
} // FCFrameWnd::UnregisterScrollWindow.

FCFrameWnd* FFGetMainWnd ()
{
	return &s_FrameWnd;
} // FFGetMainWnd.

