Old fashion design for PC-104
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
2.7 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 08/10/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: OptionsDlg.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of OptionsDlg.cpp
  13. //----------------------------------------------------------------------------
  14. // OptionsDlg.cpp : implementation file
  15. //
  16. #include "stdafx.h"
  17. #include "Calibration.h"
  18. #include "OptionsDlg.h"
  19. #ifdef _DEBUG
  20. #define new DEBUG_NEW
  21. #undef THIS_FILE
  22. static char THIS_FILE[] = __FILE__;
  23. #endif
  24. /////////////////////////////////////////////////////////////////////////////
  25. // COptionsDlg dialog
  26. COptionsDlg::COptionsDlg(CWnd* pParent /*=NULL*/)
  27. : CDialog(COptionsDlg::IDD, pParent)
  28. {
  29. //{{AFX_DATA_INIT(COptionsDlg)
  30. // NOTE: the ClassWizard will add member initialization here
  31. //}}AFX_DATA_INIT
  32. }
  33. void COptionsDlg::DoDataExchange(CDataExchange* pDX)
  34. {
  35. CDialog::DoDataExchange(pDX);
  36. //{{AFX_DATA_MAP(COptionsDlg)
  37. // NOTE: the ClassWizard will add DDX and DDV calls here
  38. //}}AFX_DATA_MAP
  39. }
  40. BEGIN_MESSAGE_MAP(COptionsDlg, CDialog)
  41. //{{AFX_MSG_MAP(COptionsDlg)
  42. ON_BN_CLICKED(IDAPPLY, OnApply)
  43. //}}AFX_MSG_MAP
  44. END_MESSAGE_MAP()
  45. /////////////////////////////////////////////////////////////////////////////
  46. // COptionsDlg message handlers
  47. BOOL COptionsDlg::OnInitDialog()
  48. {
  49. CDialog::OnInitDialog();
  50. DWORD cbNeeded, cReturned;
  51. ::EnumPorts( NULL, 1, NULL, 0UL, &cbNeeded, &cReturned );
  52. LPPORT_INFO_1 pPI = (LPPORT_INFO_1)new BYTE[ cbNeeded ];
  53. ::EnumPorts( NULL, 1, (LPBYTE)pPI, cbNeeded, &cbNeeded, &cReturned );
  54. for( DWORD i = 0; i < cReturned; i++ )
  55. {
  56. ::SendDlgItemMessage( m_hWnd, IDC_COMBO_CAMERA_PORT, CB_ADDSTRING, 0, (LONG)pPI[i].pName );
  57. ::SendDlgItemMessage( m_hWnd, IDC_COMBO_LGS_PORT, CB_ADDSTRING, 0, (LONG)pPI[i].pName );
  58. }
  59. ::SendDlgItemMessage( m_hWnd, IDC_COMBO_CAMERA_PORT, CB_SELECTSTRING, -1, (LONG)(LPCTSTR)m_pData->strCameraPortName );
  60. ::SendDlgItemMessage( m_hWnd, IDC_COMBO_LGS_PORT, CB_SELECTSTRING, -1, (LONG)(LPCTSTR)m_pData->strLgsPortName );
  61. delete pPI;
  62. return TRUE;
  63. }
  64. void COptionsDlg::SetData(OPTIONS *pData)
  65. {
  66. m_pData = pData;
  67. }
  68. void COptionsDlg::OnApply()
  69. {
  70. TCHAR pText[MAX_PATH];
  71. ::SendDlgItemMessage( m_hWnd, IDC_COMBO_LGS_PORT, WM_GETTEXT, MAX_PATH, (LONG)pText );
  72. m_pData->strLgsPortName = pText;
  73. ::SendDlgItemMessage( m_hWnd, IDC_COMBO_CAMERA_PORT, WM_GETTEXT, MAX_PATH, (LONG)pText );
  74. m_pData->strCameraPortName = pText;
  75. GetParent()->SendMessage( WM_OPTIONS_CHANGED );
  76. }