// SignalListViewDlg.cpp : ±¸Çö ÆÄÀÏÀÔ´Ï´Ù. // #include "stdafx.h" #include "EtActionTool.h" #include "SignalListViewDlg.h" #include "GlobalValue.h" #include "ActionElement.h" #include "ActionObject.h" // SignalListViewDlg ´ëÈ­ »óÀÚÀÔ´Ï´Ù. #ifdef _EXPORT_EXCEL_ACTION_SIGNAL IMPLEMENT_DYNAMIC(SignalListViewDlg, CDialog) SignalListViewDlg::SignalListViewDlg(CWnd* pParent /*=NULL*/) : CDialog(SignalListViewDlg::IDD, pParent) , m_EditCtrl_SignalCount(_T("")) { } SignalListViewDlg::~SignalListViewDlg() { int c = 10; } void SignalListViewDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Control(pDX, IDC_COMBO1, m_SignalListComboBox); DDX_Text(pDX, IDC_EDIT1, m_EditCtrl_SignalCount); } BEGIN_MESSAGE_MAP(SignalListViewDlg, CDialog) ON_CBN_SELCHANGE(IDC_COMBO1, &SignalListViewDlg::OnSignalList) END_MESSAGE_MAP() // SignalListViewDlg ¸Þ½ÃÁö 󸮱âÀÔ´Ï´Ù. void SignalListViewDlg::OnSignalList() { // TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù. int nSelectedSel = m_SignalListComboBox.GetCurSel(); if( nSelectedSel < 0 ) { ::MessageBox(NULL, "½Ã±×³ÎÀ» ¼±ÅÃÇØÁÖ¼¼¿ä", "°æ°í", MB_OK); return; } CActionObject* pActionObject = NULL; CActionElement* pActionElement = NULL; pActionObject = dynamic_cast ( CGlobalValue::GetInstance().GetControlObject() ); DWORD i, j, n, nCount; i = j = n = nCount = 0; char buf[_MAX_PATH] = {0,}; char szSelecteditem[_MAX_PATH] = {0,}; m_EditCtrl_SignalCount.Empty(); m_SignalListComboBox.GetLBText( nSelectedSel, szSelecteditem ) ; m_strSignalTypeName = szSelecteditem; // ¾×¼Ç Æú´õ¸¦ ¼±Åà ÇßÀ» ¶§ if( pActionObject ) { for( i = 0; i < pActionObject->GetChildCount(); i++ ) { pActionElement= dynamic_cast( pActionObject->GetChild( i ) ); if( ! pActionElement ) continue; for( j = 0; j < pActionElement->GetChildCount(); j++ ) { if( m_strSignalTypeName.Compare( pActionElement->GetChild( j )->GetProperty( 0 )->GetCategory() ) == 0 ) nCount++; } } } // ¾×¼Ç ÆÄÀÏÀ» ¼±ÅÃÇßÀ» ¶§ else { pActionElement= dynamic_cast( CGlobalValue::GetInstance().GetControlObject() ); if( pActionElement == NULL ) return; for( i = 0; i < pActionElement->GetChildCount(); i++ ) { if( m_strSignalTypeName.Compare( pActionElement->GetChild( i )->GetProperty( 0 )->GetCategory() ) == 0 ) nCount++; } } m_EditCtrl_SignalCount.Format("%d", nCount ); UpdateData( FALSE ); } BOOL SignalListViewDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: ¿©±â¿¡ Ãß°¡ ÃʱâÈ­ ÀÛ¾÷À» Ãß°¡ÇÕ´Ï´Ù. CActionObject* pActionObject = NULL; CActionElement* pActionElement = NULL; CActionSignal* pSignal = NULL; pActionObject = dynamic_cast ( CGlobalValue::GetInstance().GetControlObject() ); DWORD i, j, n; i = j = n = 0; char sComboboxlist[_MAX_PATH] = {0,}; bool bFlag = TRUE; if( pActionObject ) { for( i = 0; i < pActionObject->GetChildCount(); i++ ) { pActionElement= dynamic_cast( pActionObject->GetChild( i ) ); if( ! pActionElement ) continue; for( j = 0; j < pActionElement->GetChildCount(); j ++ ) { pSignal = dynamic_cast( pActionElement->GetChild( j ) ); if( ! pSignal ) continue; for( n = 0; n < m_SignalListComboBox.GetCount(); n++ ) { m_SignalListComboBox.GetLBText( n, sComboboxlist ); if( strcmp( pSignal->GetProperty( 0 )->GetCategory(), sComboboxlist ) == 0) { bFlag = FALSE; break; } } if( bFlag ) { m_SignalListComboBox.AddString( pSignal->GetProperty( 0 )->GetCategory() ); } bFlag = TRUE; } } } else { pActionElement= dynamic_cast( CGlobalValue::GetInstance().GetControlObject() ); if( pActionElement == NULL ) return FALSE; for( j = 0; j < pActionElement->GetChildCount(); j ++ ) { pSignal = dynamic_cast( pActionElement->GetChild( j ) ); if( ! pSignal ) continue; for( n = 0; n < m_SignalListComboBox.GetCount(); n++ ) { m_SignalListComboBox.GetLBText( n, sComboboxlist ); if( strcmp( pSignal->GetProperty( 0 )->GetCategory(), sComboboxlist ) == 0 ) { bFlag = FALSE; break; } } if( bFlag ) { m_SignalListComboBox.AddString( pSignal->GetProperty( 0 )->GetCategory() ); } bFlag = TRUE; } } return TRUE; // return TRUE unless you set the focus to a control // ¿¹¿Ü: OCX ¼Ó¼º ÆäÀÌÁö´Â FALSE¸¦ ¹ÝÈ¯ÇØ¾ß ÇÕ´Ï´Ù. } #endif