![]() |
The Machine Perception Toolbox |
|
00001 // DeviceList.cpp : implementation file 00002 // 00003 00004 #include "stdafx.h" 00005 #include "VideoDemo.h" 00006 #include "DeviceList.h" 00007 #include "MPDirectShow.h" 00008 00009 #ifdef _DEBUG 00010 #define new DEBUG_NEW 00011 #undef THIS_FILE 00012 static char THIS_FILE[] = __FILE__; 00013 #endif 00014 00016 // DeviceList dialog 00017 00018 00019 DeviceList::DeviceList(CWnd* pParent /*=NULL*/) 00020 : CDialog(DeviceList::IDD, pParent) 00021 { 00022 //{{AFX_DATA_INIT(DeviceList) 00023 // NOTE: the ClassWizard will add member initialization here 00024 //}}AFX_DATA_INIT 00025 } 00026 00027 00028 void DeviceList::DoDataExchange(CDataExchange* pDX) 00029 { 00030 CDialog::DoDataExchange(pDX); 00031 //{{AFX_DATA_MAP(DeviceList) 00032 DDX_Control(pDX, IDC_STATIC_Text, m_deviceText); 00033 DDX_Control(pDX, IDC_COMBO_List, m_deviceList); 00034 //}}AFX_DATA_MAP 00035 00036 for (int i = 0; i < m_totalDevices; i++) { 00037 m_deviceList.InsertString(i, m_directShow->m_deviceNames[i]); 00038 } 00039 00040 switch (m_deviceType) { 00041 case dl_capture: 00042 SetDlgItemText(IDC_STATIC_Text,"Select Capture Device"); 00043 break; 00044 case dl_compressor: 00045 SetDlgItemText(IDC_STATIC_Text,"Select Video Compressor"); 00046 m_deviceList.InsertString(i, "None"); 00047 break; 00048 } 00049 00050 } 00051 00052 void DeviceList::setDirectShow(MPDirectShow* directShow, int totalDevices, dl_deviceType deviceType) 00053 { 00054 m_directShow = directShow; 00055 m_totalDevices = totalDevices; 00056 m_deviceType = deviceType; 00057 } 00058 00059 00060 BEGIN_MESSAGE_MAP(DeviceList, CDialog) 00061 //{{AFX_MSG_MAP(DeviceList) 00062 ON_CBN_SELCHANGE(IDC_COMBO_List, OnSelchangeCOMBOList) 00063 //}}AFX_MSG_MAP 00064 END_MESSAGE_MAP() 00065 00067 // DeviceList message handlers 00068 00069 int DeviceList::DoModal() 00070 { 00071 if (m_deviceType == dl_capture) 00072 m_directShow->m_devicePos = 0; 00073 else 00074 m_directShow->m_devicePos = m_totalDevices; 00075 00076 return CDialog::DoModal(); 00077 } 00078 00079 void DeviceList::OnSelchangeCOMBOList() 00080 { 00081 int pos = m_deviceList.GetCurSel(); 00082 m_directShow->m_devicePos = pos; 00083 }