// IADDgStp.hpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"

#include "IADDgStp.hpp"

#include "IADWCBt.hpp"
#include "IADLnkMt.hpp"

#define IAD_C_BUTTON_SPACING					3

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

/////////////////////////////////////////////////////////////////////////////
// TID_Dialog_Setup dialog

BEGIN_MESSAGE_MAP(TID_Dialog_Setup, CDialog)
	//{{AFX_MSG_MAP(TID_Dialog_Setup)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


//***************************************************************************
TID_Dialog_Setup::TID_Dialog_Setup(CWnd* pParent /*=NULL*/)
	: CDialog(TID_Dialog_Setup::IDD, pParent)
{
	//{{AFX_DATA_INIT(TID_Dialog_Setup)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


//***************************************************************************
void TID_Dialog_Setup::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(TID_Dialog_Setup)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

/////////////////////////////////////////////////////////////////////////////
// TID_Dialog_Setup message handlers

#define IAD_M_ADD_BUTTON(Name, String)	\
	pclButton = new IAD_Color_Button(&g_a_colrefTypeColor[AIDebug_E_SecTyp_##Name], String, (long)AIDebug_E_SecTyp_##Name);	\
	csReturnedSize = pclButton->m_pub_fn_csCreate(this, crCurrentRect);																								\
	crCurrentRect.OffsetRect(0, csReturnedSize.cy + IAD_C_BUTTON_SPACING);																						\
	lMaxX = max(lMaxX, crCurrentRect.left + csReturnedSize.cx);																												\
	if ( crCurrentRect.bottom > crStaticRect.bottom - IAD_C_BUTTON_SPACING )																					\
	{																																																									\
		crCurrentRect.top = crStaticRect.top + IAD_C_BUTTON_SPACING;																										\
		crCurrentRect.bottom = crCurrentRect.top + csReturnedSize.cy;																										\
		crCurrentRect.left = lMaxX + IAD_C_BUTTON_SPACING;																															\
	}

//***************************************************************************
BOOL TID_Dialog_Setup::OnInitDialog() 
{
	// CG PB DEBUGGER 23/06/98 {
	#ifdef ACTIVE_AIDEBUG
	
		CDialog::OnInitDialog();
		
		CSize csReturnedSize;
		IAD_Color_Button *pclButton;
		long lMaxX = 0;
		CRect crStaticRect;
		GetDlgItem(IDC_STATIC_COLORS_USED)->GetWindowRect(crStaticRect);
		ScreenToClient(crStaticRect);
		crStaticRect.InflateRect(-10, -15);
		CRect crCurrentRect(crStaticRect.left + IAD_C_BUTTON_SPACING,
												crStaticRect.top + IAD_C_BUTTON_SPACING,
												10,10);	//Bidon
	
		//Constructs buttons
		IAD_M_ADD_BUTTON(EngineLoop, "Engine Loop")
		IAD_M_ADD_BUTTON(ReflexOrAI, "Reflex Or AI")
		IAD_M_ADD_BUTTON(CurrentComport, "Current Comport")
		IAD_M_ADD_BUTTON(Field, "Field")
		IAD_M_ADD_BUTTON(Constant, "Constant")
		IAD_M_ADD_BUTTON(DsgVarId, "Dsg Var Id")
		IAD_M_ADD_BUTTON(DsgVar, "Dsg Var")
		IAD_M_ADD_BUTTON(Button, "Button")
		IAD_M_ADD_BUTTON(EnvRef, "Environement ")
		IAD_M_ADD_BUTTON(SectorRef, "Sector")
		IAD_M_ADD_BUTTON(SurfaceRef, "Surface")
		IAD_M_ADD_BUTTON(PersoRef, "Actor")
		IAD_M_ADD_BUTTON(ActionRef, "State")
		IAD_M_ADD_BUTTON(Real, "Real")
		IAD_M_ADD_BUTTON(Vector, "Vector")
		IAD_M_ADD_BUTTON(ConstantVector, "Constant Vector")
		//	IAD_M_ADD_BUTTON(Way, "Way")
		IAD_M_ADD_BUTTON(WayPoint, "WayPoint")
		IAD_M_ADD_BUTTON(Module, "Module")
		//	IAD_M_ADD_BUTTON(ChannelNumber, "Channel Number")
		IAD_M_ADD_BUTTON(Mask, "Mask")
		IAD_M_ADD_BUTTON(String, "String")
		IAD_M_ADD_BUTTON(LipsSynchroRef, "Lips Synchro")
		IAD_M_ADD_BUTTON(SoundEventRef, "Sound Event")
		IAD_M_ADD_BUTTON(FamilyRef, "Family")
		IAD_M_ADD_BUTTON(BeginMacro, "Begin Macro")
		IAD_M_ADD_BUTTON(EndMacro, "End Macro")
		IAD_M_ADD_BUTTON(Comport, "Comport")
		IAD_M_ADD_BUTTON(KeyWord, "KeyWord")
		IAD_M_ADD_BUTTON(Condition, "Condition")
		IAD_M_ADD_BUTTON(Function, "Function")
		IAD_M_ADD_BUTTON(Operator, "Operator")
		IAD_M_ADD_BUTTON(Procedure, "Procedure")
		IAD_M_ADD_BUTTON(MetaAction, "MetaAction")
		IAD_M_ADD_BUTTON(BeginMetaAction, "Begin MetaAction")
#endif // CG PB DEBUGGER }

	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
