CurveDlg.cpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. // CurvePage.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "IDE.h"
  5. #include "CurveDlg.h"
  6. #include "SelectVariantDlg.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. extern void DrawColorButton(LPDRAWITEMSTRUCT lpDIS,COLORREF clrButton);
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CCurveDlg dialog
  15. IMPLEMENT_DYNCREATE(CurvePage, CPropertyPage)
  16. CurvePage::CurvePage(): CPropertyPage(CurvePage::IDD)
  17. {
  18. //{{AFX_DATA_INIT(CurvePage)
  19. m_strVar1 = _T("");
  20. m_strVar2 = _T("");
  21. m_strVar3 = _T("");
  22. m_nLowwer = 0;
  23. m_nUpper = 0;
  24. //}}AFX_DATA_INIT
  25. }
  26. CurvePage::~CurvePage()
  27. {
  28. }
  29. void CurvePage::DoDataExchange(CDataExchange* pDX)
  30. {
  31. CPropertyPage::DoDataExchange(pDX);
  32. //{{AFX_DATA_MAP(CurvePage)
  33. DDX_Text(pDX, IDC_VAR1, m_strVar1);
  34. DDX_Text(pDX, IDC_VAR2, m_strVar2);
  35. DDX_Text(pDX, IDC_VAR3, m_strVar3);
  36. DDX_Text(pDX, IDC_LOWWER, m_nLowwer);
  37. DDX_Text(pDX, IDC_UPPER, m_nUpper);
  38. //}}AFX_DATA_MAP
  39. }
  40. BEGIN_MESSAGE_MAP(CurvePage, CPropertyPage)
  41. //{{AFX_MSG_MAP(CurvePage)
  42. ON_WM_DRAWITEM()
  43. ON_BN_CLICKED(IDC_CURVE1COLOR, OnCurve1color)
  44. ON_BN_CLICKED(IDC_CURVE2COLOR, OnCurve2color)
  45. ON_BN_CLICKED(IDC_CURVE3COLOR, OnCurve3color)
  46. ON_BN_CLICKED(IDC_SELVAR1, OnSelvar1)
  47. ON_BN_CLICKED(IDC_SELVAR2, OnSelvar2)
  48. ON_BN_CLICKED(IDC_SELVAR3, OnSelvar3)
  49. //}}AFX_MSG_MAP
  50. END_MESSAGE_MAP()
  51. /////////////////////////////////////////////////////////////////////////////
  52. // CurvePage message handlers
  53. void CurvePage::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
  54. {
  55. switch(nIDCtl)
  56. {
  57. case IDC_CURVE1COLOR:
  58. DrawColorButton(lpDrawItemStruct,m_clrCurve1);
  59. break;
  60. case IDC_CURVE2COLOR:
  61. DrawColorButton(lpDrawItemStruct,m_clrCurve2);
  62. break;
  63. case IDC_CURVE3COLOR:
  64. DrawColorButton(lpDrawItemStruct,m_clrCurve3);
  65. break;
  66. }
  67. CPropertyPage::OnDrawItem(nIDCtl, lpDrawItemStruct);
  68. }
  69. void CurvePage::OnCurve1color()
  70. {
  71. CColorDialog dlg(m_clrCurve1);
  72. if(dlg.DoModal()==IDOK)
  73. {
  74. m_clrCurve1 = dlg.GetColor();
  75. CButton* pButton = (CButton *)GetDlgItem(IDC_CURVE1COLOR);
  76. pButton->ShowWindow(SW_HIDE);
  77. pButton->ShowWindow(SW_SHOW);
  78. }
  79. }
  80. void CurvePage::OnCurve2color()
  81. {
  82. CColorDialog dlg(m_clrCurve2);
  83. if(dlg.DoModal()==IDOK)
  84. {
  85. m_clrCurve2 = dlg.GetColor();
  86. CButton* pButton = (CButton *)GetDlgItem(IDC_CURVE2COLOR);
  87. pButton->ShowWindow(SW_HIDE);
  88. pButton->ShowWindow(SW_SHOW);
  89. }
  90. }
  91. void CurvePage::OnCurve3color()
  92. {
  93. CColorDialog dlg(m_clrCurve3);
  94. if(dlg.DoModal()==IDOK)
  95. {
  96. m_clrCurve3 = dlg.GetColor();
  97. CButton* pButton = (CButton *)GetDlgItem(IDC_CURVE3COLOR);
  98. pButton->ShowWindow(SW_HIDE);
  99. pButton->ShowWindow(SW_SHOW);
  100. }
  101. }
  102. void CurvePage::OnSelvar1()
  103. {
  104. CSelectVariantDlg dlg;
  105. if ( dlg.DoModal() == IDOK )
  106. {
  107. m_strVar1 = dlg.m_strVar;
  108. UpdateData(false);
  109. }
  110. }
  111. void CurvePage::OnSelvar2()
  112. {
  113. CSelectVariantDlg dlg;
  114. if ( dlg.DoModal() == IDOK )
  115. {
  116. m_strVar2 = dlg.m_strVar;
  117. UpdateData(false);
  118. }
  119. }
  120. void CurvePage::OnSelvar3()
  121. {
  122. CSelectVariantDlg dlg;
  123. if ( dlg.DoModal() == IDOK )
  124. {
  125. m_strVar3 = dlg.m_strVar;
  126. UpdateData(false);
  127. }
  128. }