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.

131 lines
3.1 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: ParametersDlg.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of ParametersDlg.cpp
  13. //----------------------------------------------------------------------------
  14. // ParametersDlg.cpp : implementation file
  15. //
  16. #include "stdafx.h"
  17. #include "Calibration.h"
  18. #include "ParametersDlg.h"
  19. #ifdef _DEBUG
  20. #define new DEBUG_NEW
  21. #undef THIS_FILE
  22. static char THIS_FILE[] = __FILE__;
  23. #endif
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CParametersDlg dialog
  26. CParametersDlg::CParametersDlg(CWnd* pParent /*=NULL*/)
  27. : CDialog(CParametersDlg::IDD, pParent)
  28. {
  29. //{{AFX_DATA_INIT(CParametersDlg)
  30. // NOTE: the ClassWizard will add member initialization here
  31. //}}AFX_DATA_INIT
  32. m_pData = NULL;
  33. }
  34. void CParametersDlg::DoDataExchange(CDataExchange* pDX)
  35. {
  36. CDialog::DoDataExchange(pDX);
  37. //{{AFX_DATA_MAP(CParametersDlg)
  38. // NOTE: the ClassWizard will add DDX and DDV calls here
  39. //}}AFX_DATA_MAP
  40. }
  41. BEGIN_MESSAGE_MAP(CParametersDlg, CDialog)
  42. //{{AFX_MSG_MAP(CParametersDlg)
  43. //}}AFX_MSG_MAP
  44. END_MESSAGE_MAP()
  45. /////////////////////////////////////////////////////////////////////////////
  46. // CParametersDlg message handlers
  47. void CParametersDlg::SetCalibrationData(CCalibrationData *pData)
  48. {
  49. m_pData = pData;
  50. }
  51. BOOL CParametersDlg::OnInitDialog()
  52. {
  53. CDialog::OnInitDialog();
  54. ASSERT( m_pData );
  55. for( int i = 0; i < m_pData->GetParameterCount(); i++ )
  56. {
  57. PARAMETER *pParameter = m_pData->GetParameter(i);
  58. if( pParameter )
  59. {
  60. CEdit *pEdit = (CEdit*)GetDlgItem( pParameter->nEdit );
  61. if( pEdit )
  62. {
  63. TCHAR pBuffer[MAX_PATH];
  64. switch( pParameter->nType )
  65. {
  66. case PT_INTEGER:
  67. _stprintf( pBuffer, _T("%d"), pParameter->data_i );
  68. break;
  69. case PT_DOUBLE:
  70. _stprintf( pBuffer, _T("%f"), pParameter->data_d );
  71. break;
  72. case PT_STRING:
  73. _stprintf( pBuffer, _T("%s"), pParameter->data_s );
  74. break;
  75. }
  76. pEdit->SetWindowText( pBuffer );
  77. }
  78. }
  79. }
  80. return TRUE; // return TRUE unless you set the focus to a control
  81. // EXCEPTION: OCX Property Pages should return FALSE
  82. }
  83. void CParametersDlg::OnOK()
  84. {
  85. for( int i = 0; i < m_pData->GetParameterCount(); i++ )
  86. {
  87. PARAMETER *pParameter = m_pData->GetParameter(i);
  88. if( pParameter )
  89. {
  90. CEdit *pEdit = (CEdit*)GetDlgItem( pParameter->nEdit );
  91. if( pEdit )
  92. {
  93. TCHAR pBuffer[MAX_PATH];
  94. pEdit->GetWindowText( pBuffer, MAX_PATH );
  95. switch( pParameter->nType )
  96. {
  97. case PT_INTEGER:
  98. pParameter->data_i = atoi( pBuffer );
  99. pParameter->bInit = TRUE;
  100. break;
  101. case PT_DOUBLE:
  102. pParameter->data_d = atof( pBuffer );
  103. pParameter->bInit = TRUE;
  104. break;
  105. case PT_STRING:
  106. _tcscpy( pParameter->data_s, pBuffer );
  107. pParameter->bInit = TRUE;
  108. break;
  109. }
  110. }
  111. }
  112. }
  113. CDialog::OnOK();
  114. }