/*******************************************************************************
  Function Name  : OnInitDialog
  Input(s)       : -
  Output         : FALSE - If focus is set to Any UI control explicitly
  Functionality  : Initialises dialog's UI components
  Member of      : CMsgFilterConfigPage
  Author(s)      : Raja N
  Date Created   : 8.7.2005
  Modifications  :
*******************************************************************************/
BOOL CMsgFilterConfigPage::OnInitDialog()
{
    CPropertyPage::OnInitDialog();
    // Create Image List
    bCreateImageList();
    // Create Filter List UI
    vCreateFilterUIList();

    // Init data list
    //vInitFilterDataList();
    // Populate Filter List
    vInitFilterUIList();
    // Update Title
    SetWindowText( _(defSTR_WINDOW_TITLE) );

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
/**
 * \return FALSE - If focus is set to Any UI control explicitly
 *
 * Initialises dialog's UI components
 */
BOOL CReplayFileConfigDlg::OnInitDialog()
{
    CDialog::OnInitDialog();
    // Create Image List used in UI List
    bCreateImageList();
    // Create Replay Files UI List
    vCreateReplayFileList();
    // To Create Replay Components
    vCreateReplayCopms();
    // Init Replay Components
    vInitReplayCopms();
    // Init Replay List
    vInitReplayFileList();
    // Update Button Status
    vEnableDisableButtons();

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
/*******************************************************************************
  Function Name  : OnInitDialog
  Input(s)       : -
  Output         : FALSE - If focus is set to Any UI control explicitly
  Functionality  : Initialises dialog's UI components
  Member of      : CMsgFilterConfigPage
  Author(s)      : Raja N
  Date Created   : 8.7.2005
  Modifications  :
*******************************************************************************/
BOOL CMsgFilterConfigPage::OnInitDialog()
{
    CPropertyPage::OnInitDialog();
    // Create Image List
    bCreateImageList();
    // Create Filter List UI
    vCreateFilterUIList();
    //Get Filter apploed from MsgFrmtWnd
    m_sFilterAppliedCan.vClear();
    ::SendMessage(m_hMsgWnd, WM_GET_FILTER_DETAILS, (WPARAM)&m_sFilterAppliedCan, (LPARAM)CAN);
    // Init data list
    //vInitFilterDataList();
    // Populate Filter List
    vInitFilterUIList();
    // Update Title
    SetWindowText( defSTR_WINDOW_TITLE );
    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CMsgSignalSelect::OnInitDialog()
{
	CDialog::OnInitDialog();
	//m_omImageList1 = new CImageList();
	bCreateImageList();
	// use the initial dialog size as the default minimum
	if ((m_szMinimum.cx == 0) && (m_szMinimum.cy == 0))
	{
		CRect rcWindow;
		GetWindowRect(rcWindow);
		m_szMinimum = rcWindow.Size();
	}
	AutoMove(IDC_TREE_LIN, 0, 0, 100.0, 100.0); 
	AutoMove(IDOK, 100.0, 100.0, 0.0, 0.0); 
	AutoMove(IDCANCEL, 100.0, 100.0, 0.0, 0.0); 
	// keep the initial size of the client area as a baseline for moving/sizing controls
	CRect rcClient;
	GetClientRect(rcClient);
	m_szInitial = rcClient.Size();

	pTreeStruct = (CTreeCtrl*)GetDlgItem(IDC_TREE_LIN);

	/* Remove the style */
	pTreeStruct->ModifyStyle( TVS_CHECKBOXES, 0 );
	/* Now explicitly set it */
	pTreeStruct->ModifyStyle( 0, TVS_CHECKBOXES ); 
	if( NULL == pTreeStruct )
	{

		return FALSE;
	}

	HTREEITEM hNumofChannel,hmsg,sig;
	for(int i=0;i < m_ouCluster.m_nChannelsConfigured;i++)
	{
		hNumofChannel=pTreeStruct->InsertItem("Channel 1");	
		pTreeStruct->SetItemImage(hNumofChannel, 4, 4);
		list<FRAME_STRUCT> lstNumofFrames;
		m_ouCluster.m_ouFlexChannelConfig[0].m_ouClusterInfo.GetFrames(lstNumofFrames);
		pTreeStruct->SetImageList(&m_omImageList, TVSIL_NORMAL);

		list<FRAME_STRUCT>::iterator itr= lstNumofFrames.begin();
		while(itr != lstNumofFrames.end())
		{
			hmsg=pTreeStruct->InsertItem(itr->m_strFrameName.c_str(),hNumofChannel);
			pTreeStruct->SetItemImage(hmsg, 3, 3);

			int selkey = -1;
			if ( m_mapMsgIDtoSignallst[i].find(itr->m_nSlotId) != m_mapMsgIDtoSignallst[i].end() )
			{
				selkey=m_mapMsgIDtoSignallst[i].find(itr->m_nSlotId)->first;
			}

			if(selkey == itr->m_nSlotId)
			{
				pTreeStruct->SetCheck(hNumofChannel);
				pTreeStruct->SetCheck(hmsg);
			}

			pTreeStruct->SetItemData(hmsg,itr->m_nSlotId);
			list<SIGNAL_STRUCT> ouSignalList;
			itr->GetSignalList(ouSignalList);
			list<SIGNAL_STRUCT>:: iterator itr_sig=ouSignalList.begin();
			while(itr_sig != ouSignalList.end())
			{ 
				sig=pTreeStruct->InsertItem(itr_sig->m_strSignalName.c_str(),hmsg);

				pTreeStruct->SetItemImage(sig, 0, 0);
				if(selkey == itr->m_nSlotId)
				{
					if ( m_mapMsgIDtoSignallst[i].find(itr->m_nSlotId) != m_mapMsgIDtoSignallst[i].end() )
					{
						list<string> lstSignals=m_mapMsgIDtoSignallst[i].find(itr->m_nSlotId)->second;
						list<string>:: iterator itrselSignals= lstSignals.begin();

						while(itrselSignals != lstSignals.end())
						{
							string signame=pTreeStruct->GetItemText(sig);
							if(strcmpi(pTreeStruct->GetItemText(sig),(*itrselSignals).c_str())== 0)
							{
								pTreeStruct->SetCheck(sig);
							}
							itrselSignals++;
						}
					}
				}

				itr_sig++;
			}

			itr++;
		}

	}
	pTreeStruct->Expand(hNumofChannel,TVE_EXPAND);
	//vTest(pTreeStruct);
	return TRUE;

	// CTree message handlers
}