Source code of Windows XP (NT5)
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.

128 lines
3.2 KiB

  1. // ScheduleTimeInfo.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "evtview.h"
  5. #include "TInfoDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CScheduleTimeInfo dialog
  13. CScheduleTimeInfo::CScheduleTimeInfo(CWnd* pParent /*=NULL*/)
  14. : CDialog(CScheduleTimeInfo::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(CScheduleTimeInfo)
  17. m_bFriday = FALSE;
  18. m_bMonday = FALSE;
  19. m_bSaturday = FALSE;
  20. m_bSunday = FALSE;
  21. m_bThursday = FALSE;
  22. m_bTuesday = FALSE;
  23. m_bWednesday = FALSE;
  24. //}}AFX_DATA_INIT
  25. }
  26. void CScheduleTimeInfo::DoDataExchange(CDataExchange* pDX)
  27. {
  28. CDialog::DoDataExchange(pDX);
  29. //{{AFX_DATA_MAP(CScheduleTimeInfo)
  30. DDX_Control(pDX, IDC_SECOND, m_ctrlSecond);
  31. DDX_Control(pDX, IDC_MINUTE, m_ctrlMinute);
  32. DDX_Control(pDX, IDC_HOUR, m_ctrlHour);
  33. DDX_Control(pDX, IDC_YEAR, m_ctrlYear);
  34. DDX_Control(pDX, IDC_MONTH, m_ctrlMonth);
  35. DDX_Control(pDX, IDC_DAY, m_ctrlDay);
  36. DDX_Check(pDX, IDC_FRIDAY, m_bFriday);
  37. DDX_Check(pDX, IDC_MONDAY, m_bMonday);
  38. DDX_Check(pDX, IDC_SATURDAY, m_bSaturday);
  39. DDX_Check(pDX, IDC_SUNDAY, m_bSunday);
  40. DDX_Check(pDX, IDC_THURSDAY, m_bThursday);
  41. DDX_Check(pDX, IDC_TUESDAY, m_bTuesday);
  42. DDX_Check(pDX, IDC_WEDNESDAY, m_bWednesday);
  43. //}}AFX_DATA_MAP
  44. }
  45. BEGIN_MESSAGE_MAP(CScheduleTimeInfo, CDialog)
  46. //{{AFX_MSG_MAP(CScheduleTimeInfo)
  47. //}}AFX_MSG_MAP
  48. END_MESSAGE_MAP()
  49. /////////////////////////////////////////////////////////////////////////////
  50. // CScheduleTimeInfo message handlers
  51. struct {
  52. LPCWSTR pszYear ;
  53. int iYear ;
  54. } aYear [] =
  55. {
  56. {L"ANY", -1 },
  57. {L"1996", 1996 },
  58. {L"1997", 1997 },
  59. {NULL, 0 },
  60. } ;
  61. BOOL CScheduleTimeInfo::OnInitDialog()
  62. {
  63. CDialog::OnInitDialog();
  64. int i = 0 ;
  65. while (aYear[i].pszYear)
  66. {
  67. m_ctrlYear.AddString (aYear[i].pszYear) ;
  68. m_ctrlYear.SetItemData (i, aYear[i].iYear) ;
  69. i++ ;
  70. }
  71. m_ctrlMonth.SetCurSel (0) ;
  72. m_ctrlYear.SetCurSel (0) ;
  73. m_ctrlDay.SetCurSel (0) ;
  74. m_ctrlHour.SetCurSel (0) ;
  75. m_ctrlMinute.SetCurSel (0) ;
  76. m_ctrlSecond.SetCurSel (0) ;
  77. return TRUE; // return TRUE unless you set the focus to a control
  78. // EXCEPTION: OCX Property Pages should return FALSE
  79. }
  80. void CScheduleTimeInfo::OnOK()
  81. {
  82. UpdateData (TRUE) ;
  83. int iIndex ;
  84. sTimeInfo.iYear = (int)m_ctrlYear.GetItemData (m_ctrlYear.GetCurSel()) ;
  85. sTimeInfo.iMonth = ((iIndex = m_ctrlMonth.GetCurSel()) == CB_ERR|| (iIndex == 0))?-1:iIndex ;
  86. sTimeInfo.iDay = ((iIndex = m_ctrlDay.GetCurSel()) == CB_ERR|| (iIndex == 0))?-1:iIndex ;
  87. sTimeInfo.iHour = ((iIndex = m_ctrlHour.GetCurSel()) == CB_ERR|| (iIndex == 0))?-1:iIndex-1 ;
  88. sTimeInfo.iMin = ((iIndex = m_ctrlMinute.GetCurSel()) == CB_ERR|| (iIndex == 0))?-1:iIndex-1 ;
  89. sTimeInfo.iSec = ((iIndex = m_ctrlSecond.GetCurSel()) == CB_ERR|| (iIndex == 0))?-1:iIndex-1 ;
  90. sTimeInfo.iWeekDay = 0 ;
  91. if (m_bSunday)
  92. sTimeInfo.iWeekDay |= SCHEDULE_SUNDAY ;
  93. if (m_bMonday)
  94. sTimeInfo.iWeekDay |= SCHEDULE_MONDAY ;
  95. if (m_bTuesday)
  96. sTimeInfo.iWeekDay |= SCHEDULE_TUESDAY ;
  97. if (m_bWednesday)
  98. sTimeInfo.iWeekDay |= SCHEDULE_WEDNESDAY ;
  99. if (m_bThursday)
  100. sTimeInfo.iWeekDay |= SCHEDULE_THURSDAY ;
  101. if (m_bFriday)
  102. sTimeInfo.iWeekDay |= SCHEDULE_FRIDAY ;
  103. if (m_bSaturday)
  104. sTimeInfo.iWeekDay |= SCHEDULE_SATURDAY ;
  105. CDialog::OnOK();
  106. }