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.

88 lines
2.0 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: ScaleDlg.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of ScaleDlg.cpp
  13. //----------------------------------------------------------------------------
  14. // ScaleDlg.cpp : implementation file
  15. //
  16. #include "stdafx.h"
  17. #include "setuplgs.h"
  18. #include "ScaleDlg.h"
  19. #ifdef _DEBUG
  20. #define new DEBUG_NEW
  21. #undef THIS_FILE
  22. static char THIS_FILE[] = __FILE__;
  23. #endif
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CScaleDlg dialog
  26. CScaleDlg::CScaleDlg(CWnd* pParent /*=NULL*/)
  27. : CDialog(CScaleDlg::IDD, pParent)
  28. {
  29. //{{AFX_DATA_INIT(CScaleDlg)
  30. m_nSystem = 0;
  31. m_dDistance = 0.0;
  32. //}}AFX_DATA_INIT
  33. }
  34. void CScaleDlg::DoDataExchange(CDataExchange* pDX)
  35. {
  36. CDialog::DoDataExchange(pDX);
  37. //{{AFX_DATA_MAP(CScaleDlg)
  38. DDX_Radio(pDX, IDC_RADIO_METRIC_SYSTEM_METERS, m_nSystem);
  39. DDX_Text(pDX, IDC_EDIT_DISTANCE, m_dDistance);
  40. DDV_MinMaxDouble(pDX, m_dDistance, 0.1, 100000.);
  41. //}}AFX_DATA_MAP
  42. }
  43. BEGIN_MESSAGE_MAP(CScaleDlg, CDialog)
  44. //{{AFX_MSG_MAP(CScaleDlg)
  45. ON_BN_CLICKED(IDC_RADIO_METRIC_SYSTEM_FEET, OnRadioMetricSystem)
  46. ON_BN_CLICKED(IDC_RADIO_METRIC_SYSTEM_METERS, OnRadioMetricSystem)
  47. //}}AFX_MSG_MAP
  48. END_MESSAGE_MAP()
  49. /////////////////////////////////////////////////////////////////////////////
  50. // CScaleDlg message handlers
  51. void CScaleDlg::OnRadioMetricSystem()
  52. {
  53. INT nSystem = m_nSystem;
  54. UpdateData( TRUE );
  55. if( nSystem != m_nSystem )
  56. {
  57. switch( m_nSystem )
  58. {
  59. case 0: m_dDistance /= 3.048; break;
  60. case 1: m_dDistance *= 3.048; break;
  61. }
  62. UpdateData( FALSE );
  63. }
  64. }
  65. double CScaleDlg::GetDistance()
  66. {
  67. switch( m_nSystem )
  68. {
  69. case 0:
  70. return m_dDistance;
  71. case 1:
  72. // convert to metric and return
  73. return m_dDistance /= 3.048;
  74. }
  75. return 1.0;
  76. }