// CustomTagDlg.cpp : implementation file
//

#include "stdafx.h"
#include "mw4gameed2.h"
#include "CustomTagDlg.h"
#include "GlobalFlags.h"


/////////////////////////////////////////////////////////////////////////////
// CCustomTagDlg dialog


CCustomTagDlg::CCustomTagDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CCustomTagDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCustomTagDlg)
	m_ShowTags = FALSE;
	//}}AFX_DATA_INIT
}


void CCustomTagDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCustomTagDlg)
	DDX_Control(pDX, IDC_TAGLIST, m_TagList);
	DDX_Check(pDX, IDC_SHOWTAGS, m_ShowTags);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// CCustomTagDlg message handlers

BOOL CCustomTagDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
int itm;

itm=m_TagList.AddString("Name");
m_TagList.SetItemData(itm,TAG_NAME);
itm=m_TagList.AddString("Hover Height");
m_TagList.SetItemData(itm,TAG_HOVER_ELEVATION);
itm=m_TagList.AddString("Modified");
m_TagList.SetItemData(itm,TAG_MODIFIED);
itm=m_TagList.AddString("Type");
m_TagList.SetItemData(itm,TAG_TYPE);
itm=m_TagList.AddString("Alignment");
m_TagList.SetItemData(itm,TAG_ALIGNMENT);
itm=m_TagList.AddString("AI Name");
m_TagList.SetItemData(itm,TAG_AINAME);
itm=m_TagList.AddString("AI Type");
m_TagList.SetItemData(itm,TAG_AITYPE);
itm=m_TagList.AddString("Script");
m_TagList.SetItemData(itm,TAG_SCRIPT);
itm=m_TagList.AddString("Skin Type");
m_TagList.SetItemData(itm,TAG_SKINTYPE);

DWORD flag;
for(int i=0;i<m_TagList.GetCount();i++)
{
flag=m_TagList.GetItemData(i);
m_TagList.SetSel(i,TagFlag&flag);
}

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

void CCustomTagDlg::OnOK() 
{
	// TODO: Add extra validation here
	DWORD flag;
TagFlag=0;

for(int i=0;i<m_TagList.GetCount();i++)
{
flag=m_TagList.GetItemData(i);
if(m_TagList.GetSel(i))
	TagFlag|=flag;

}

	CDialog::OnOK();
}
