// CPAMDgSp.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"

#include "IADDgSp.hpp"

#include "_IADItrf.hpp"

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

//Colors for the fields' static				
//extern COLORREF g_colref_FieldInstanceTextColor;
//extern COLORREF g_colref_FieldInstanceBackgroundColor;

/////////////////////////////////////////////////////////////////////////////
// IAD_EditorSetupDialog dialog
BEGIN_MESSAGE_MAP(IAD_EditorSetupDialog, CDialog)
	//{{AFX_MSG_MAP(IAD_EditorSetupDialog)
	ON_WM_PAINT()
	ON_WM_LBUTTONUP()
	//}}AFX_MSG_MAP
	ON_MESSAGE(WM_HELP, OnMyHelp)
END_MESSAGE_MAP()


//***************************************************************************
IAD_EditorSetupDialog::IAD_EditorSetupDialog(CWnd* pParent /*=NULL*/)
	: CDialog(IAD_EditorSetupDialog::IDD, pParent)
{
	//{{AFX_DATA_INIT(IAD_EditorSetupDialog)
	//}}AFX_DATA_INIT
}

//***************************************************************************
void IAD_EditorSetupDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(IAD_EditorSetupDialog)
	//}}AFX_DATA_MAP
}

/////////////////////////////////////////////////////////////////////////////
// IAD_EditorSetupDialog message handlers

//***************************************************************************
void IAD_EditorSetupDialog::OnOK() 
{
	UpdateData(TRUE);				   

	CDialog::OnOK();
}								   

//***************************************************************************
void IAD_EditorSetupDialog::OnLButtonUp(UINT nFlags, CPoint point) 
{
/*	CWnd *pclWnd;
	CRect crClientRect;

	pclWnd = GetDlgItem(IDC_RECT_TEXT_FIELD_INST);
	pclWnd->GetWindowRect(crClientRect);
	ScreenToClient(crClientRect);
	if ( crClientRect.PtInRect(point) )
		if ( m_fn_bEditColor(g_colref_FieldInstanceTextColor) )
			InvalidateRect(NULL);
	
	pclWnd = GetDlgItem(IDC_RECT_BG_FIELD_INST);
	pclWnd->GetWindowRect(crClientRect);
	ScreenToClient(crClientRect);
	if ( crClientRect.PtInRect(point) )
		if ( m_fn_bEditColor(g_colref_FieldInstanceBackgroundColor) )
			InvalidateRect(NULL);
*/
	CDialog::OnLButtonUp(nFlags, point);
}

//***************************************************************************
BOOL IAD_EditorSetupDialog::m_fn_bEditColor(COLORREF &r_Color)
{
	CColorDialog dial(r_Color, CC_FULLOPEN, this);

	if ( dial.DoModal() == IDOK )
	{
		r_Color	= dial.GetColor();
		return TRUE;
	}
	else
		return FALSE;
}

//***************************************************************************
void IAD_EditorSetupDialog::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
/*	CRect crClientRect;
	CWnd *pclWnd;

	pclWnd = GetDlgItem(IDC_RECT_TEXT_FIELD_INST);
	pclWnd->GetClientRect(crClientRect);
	crClientRect.InflateRect(-2,-2);
	CClientDC dc3(pclWnd);
	dc3.FillSolidRect(crClientRect, g_colref_FieldInstanceTextColor);

	pclWnd = GetDlgItem(IDC_RECT_BG_FIELD_INST);
	pclWnd->GetClientRect(crClientRect);
	crClientRect.InflateRect(-2,-2);
	CClientDC dc4(pclWnd);
	dc4.FillSolidRect(crClientRect, g_colref_FieldInstanceBackgroundColor);
*/
	// Do not call CDialog::OnPaint() for painting messages
}

//***************************************************************************
long IAD_EditorSetupDialog::OnMyHelp(UINT, long lParam)
{
	LPHELPINFO lphi = (LPHELPINFO)lParam;
	
	::WinHelp(	m_hWnd,
				"c:\\acp\\dllbibli\\object\\actors\\help\\actors.hlp",
				HELP_CONTEXTPOPUP,
				lphi->dwContextId);

	return TRUE;
}

