From 758762fbc91f2002a9e41957ca34a5d772d575f4 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Mon, 19 Dec 2016 06:04:51 +0300 Subject: plugins: alarms: added days of week. closes #318 --- plugins/Alarms/src/options.cpp | 242 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 238 insertions(+), 4 deletions(-) mode change 100644 => 100755 plugins/Alarms/src/options.cpp (limited to 'plugins/Alarms/src/options.cpp') diff --git a/plugins/Alarms/src/options.cpp b/plugins/Alarms/src/options.cpp old mode 100644 new mode 100755 index f7cdda24b8..fd51a07bc6 --- a/plugins/Alarms/src/options.cpp +++ b/plugins/Alarms/src/options.cpp @@ -45,6 +45,14 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP for (int i = 1; i <= 31; i++) SendDlgItemMessage(hwndDlg, IDC_DAYNUM, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)_itow(i, buff, 10)); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY1), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY2), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY3), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY4), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY5), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY6), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY7), FALSE); + SendDlgItemMessage(hwndDlg, IDC_DAYNUM, CB_SETCURSEL, 0, 0); EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE); @@ -86,6 +94,34 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP EnableWindow(GetDlgItem(hwndDlg, IDC_DAY), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_DAYNUM), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), TRUE); + + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY1), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY2), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY3), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY4), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY5), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY6), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY7), FALSE); + + break; + + case OC_SELECTED_DAYS: + CheckDlgButton(hwndDlg, IDC_RAD_DAYS, BST_CHECKED); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CAL), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_DATE), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_DAY), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_DAYNUM), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_RELMIN), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), TRUE); + + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY1), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY2), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY3), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY4), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY5), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY6), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY7), TRUE); + break; case OC_WEEKDAYS: @@ -96,6 +132,15 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP EnableWindow(GetDlgItem(hwndDlg, IDC_DAYNUM), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_RELMIN), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), TRUE); + + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY1), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY2), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY3), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY4), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY5), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY6), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY7), FALSE); + break; case OC_ONCE: @@ -103,6 +148,15 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP EnableWindow(GetDlgItem(hwndDlg, IDC_DAY), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_DAYNUM), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), FALSE); + + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY1), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY2), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY3), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY4), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY5), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY6), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY7), FALSE); + break; case OC_WEEKLY: @@ -112,6 +166,15 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP EnableWindow(GetDlgItem(hwndDlg, IDC_DAYNUM), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_RELMIN), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), TRUE); + + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY1), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY2), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY3), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY4), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY5), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY6), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY7), FALSE); + break; case OC_MONTHLY: @@ -121,6 +184,15 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP EnableWindow(GetDlgItem(hwndDlg, IDC_DAY), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_RELMIN), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), TRUE); + + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY1), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY2), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY3), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY4), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY5), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY6), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY7), FALSE); + break; case OC_YEARLY: @@ -128,8 +200,32 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP EnableWindow(GetDlgItem(hwndDlg, IDC_DAY), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_DAYNUM), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), TRUE); + + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY1), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY2), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY3), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY4), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY5), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY6), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY7), FALSE); + break; } + if (add_edit_alarm->day_mask & ALDF_1) + CheckDlgButton(hwndDlg, IDC_CHK_DAY1, TRUE); + if (add_edit_alarm->day_mask & ALDF_2) + CheckDlgButton(hwndDlg, IDC_CHK_DAY2, TRUE); + if (add_edit_alarm->day_mask & ALDF_3) + CheckDlgButton(hwndDlg, IDC_CHK_DAY3, TRUE); + if (add_edit_alarm->day_mask & ALDF_4) + CheckDlgButton(hwndDlg, IDC_CHK_DAY4, TRUE); + if (add_edit_alarm->day_mask & ALDF_5) + CheckDlgButton(hwndDlg, IDC_CHK_DAY5, TRUE); + if (add_edit_alarm->day_mask & ALDF_6) + CheckDlgButton(hwndDlg, IDC_CHK_DAY6, TRUE); + if (add_edit_alarm->day_mask & ALDF_7) + CheckDlgButton(hwndDlg, IDC_CHK_DAY7, TRUE); + CheckDlgButton(hwndDlg, IDC_CHK_SUSPEND, (add_edit_alarm->flags & ALF_SUSPENDED) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CHK_NOSTARTUP, (add_edit_alarm->flags & ALF_NOSTARTUP) ? BST_CHECKED : BST_UNCHECKED); @@ -139,7 +235,7 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_TIME, DTM_SETSYSTEMTIME, (WPARAM)GDT_VALID, (LPARAM)&add_edit_alarm->time); SendDlgItemMessage(hwndDlg, IDC_DATE, DTM_SETSYSTEMTIME, (WPARAM)GDT_VALID, (LPARAM)&add_edit_alarm->time); SendDlgItemMessage(hwndDlg, IDC_DAYNUM, CB_SETCURSEL, add_edit_alarm->time.wDay - 1, 0); - SetDlgItemInt(hwndDlg, IDC_RELMIN, MinutesInFuture(add_edit_alarm->time, add_edit_alarm->occurrence), FALSE); + SetDlgItemInt(hwndDlg, IDC_RELMIN, MinutesInFuture(add_edit_alarm->time, add_edit_alarm->occurrence, add_edit_alarm->day_mask), FALSE); if (add_edit_alarm->action & AAF_SOUND) { CheckDlgButton(hwndDlg, IDC_CHK_ASOUND, BST_CHECKED); @@ -211,6 +307,8 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP add_edit_alarm->occurrence = OC_ONCE; else if (IsDlgButtonChecked(hwndDlg, IDC_RAD_DAILY)) add_edit_alarm->occurrence = OC_DAILY; + else if(IsDlgButtonChecked(hwndDlg, IDC_RAD_DAYS)) + add_edit_alarm->occurrence = OC_SELECTED_DAYS; else if (IsDlgButtonChecked(hwndDlg, IDC_RAD_WEEKDAYS)) add_edit_alarm->occurrence = OC_WEEKDAYS; else if (IsDlgButtonChecked(hwndDlg, IDC_RAD_WEEKLY)) @@ -227,6 +325,35 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_DATE, DTM_SETRANGE, (WPARAM)(GDTR_MIN | GDTR_MAX), (LPARAM)r); } + if (IsDlgButtonChecked(hwndDlg, IDC_CHK_DAY1)) + add_edit_alarm->day_mask |= ALDF_1; + else + add_edit_alarm->day_mask &= ~ALDF_1; + if (IsDlgButtonChecked(hwndDlg, IDC_CHK_DAY2)) + add_edit_alarm->day_mask |= ALDF_2; + else + add_edit_alarm->day_mask &= ~ALDF_2; + if (IsDlgButtonChecked(hwndDlg, IDC_CHK_DAY3)) + add_edit_alarm->day_mask |= ALDF_3; + else + add_edit_alarm->day_mask &= ~ALDF_3; + if (IsDlgButtonChecked(hwndDlg, IDC_CHK_DAY4)) + add_edit_alarm->day_mask |= ALDF_4; + else + add_edit_alarm->day_mask &= ~ALDF_4; + if (IsDlgButtonChecked(hwndDlg, IDC_CHK_DAY5)) + add_edit_alarm->day_mask |= ALDF_5; + else + add_edit_alarm->day_mask &= ~ALDF_5; + if (IsDlgButtonChecked(hwndDlg, IDC_CHK_DAY6)) + add_edit_alarm->day_mask |= ALDF_6; + else + add_edit_alarm->day_mask &= ~ALDF_6; + if (IsDlgButtonChecked(hwndDlg, IDC_CHK_DAY7)) + add_edit_alarm->day_mask |= ALDF_7; + else + add_edit_alarm->day_mask &= ~ALDF_7; + if (add_edit_alarm->occurrence == OC_ONCE || add_edit_alarm->occurrence == OC_YEARLY) SendDlgItemMessage(hwndDlg, IDC_DATE, DTM_GETSYSTEMTIME, 0, (LPARAM)&add_edit_alarm->time); @@ -241,7 +368,7 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP add_edit_alarm->time.wMinute = temp_time.wMinute; add_edit_alarm->time.wSecond = temp_time.wSecond; - UpdateAlarm(add_edit_alarm->time, add_edit_alarm->occurrence); + UpdateAlarm(add_edit_alarm->time, add_edit_alarm->occurrence, add_edit_alarm->day_mask); return TRUE; case WMU_SETTIME: @@ -252,7 +379,7 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_DAY, CB_SETCURSEL, add_edit_alarm->time.wDayOfWeek, 0); SendDlgItemMessage(hwndDlg, IDC_TIME, DTM_SETSYSTEMTIME, (WPARAM)GDT_VALID, (LPARAM)&add_edit_alarm->time); SendDlgItemMessage(hwndDlg, IDC_DAYNUM, CB_SETCURSEL, add_edit_alarm->time.wDay - 1, 0); - SetDlgItemInt(hwndDlg, IDC_RELMIN, MinutesInFuture(add_edit_alarm->time, add_edit_alarm->occurrence), FALSE); + SetDlgItemInt(hwndDlg, IDC_RELMIN, MinutesInFuture(add_edit_alarm->time, add_edit_alarm->occurrence, add_edit_alarm->day_mask), FALSE); return TRUE; case WM_NOTIFY: @@ -325,6 +452,15 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP EnableWindow(GetDlgItem(hwndDlg, IDC_DAYNUM), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_RELMIN), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), FALSE); + + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY1), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY2), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY3), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY4), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY5), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY6), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY7), FALSE); + SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0); SendMessage(hwndDlg, WMU_SETTIME, 0, 0); break; @@ -337,6 +473,15 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP EnableWindow(GetDlgItem(hwndDlg, IDC_DAYNUM), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_RELMIN), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), TRUE); + + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY1), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY2), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY3), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY4), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY5), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY6), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY7), FALSE); + SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0); SendMessage(hwndDlg, WMU_SETTIME, 0, 0); break; @@ -349,6 +494,15 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP EnableWindow(GetDlgItem(hwndDlg, IDC_DAYNUM), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_RELMIN), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), TRUE); + + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY1), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY2), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY3), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY4), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY5), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY6), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY7), FALSE); + SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0); SendMessage(hwndDlg, WMU_SETTIME, 0, 0); break; @@ -361,6 +515,15 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP EnableWindow(GetDlgItem(hwndDlg, IDC_DAYNUM), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_RELMIN), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), TRUE); + + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY1), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY2), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY3), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY4), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY5), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY6), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY7), FALSE); + SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0); SendMessage(hwndDlg, WMU_SETTIME, 0, 0); break; @@ -373,6 +536,15 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP EnableWindow(GetDlgItem(hwndDlg, IDC_DAYNUM), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_RELMIN), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), TRUE); + + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY1), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY2), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY3), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY4), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY5), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY6), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY7), FALSE); + SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0); SendMessage(hwndDlg, WMU_SETTIME, 0, 0); break; @@ -385,6 +557,36 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP EnableWindow(GetDlgItem(hwndDlg, IDC_DAYNUM), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_RELMIN), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), TRUE); + + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY1), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY2), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY3), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY4), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY5), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY6), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY7), FALSE); + + SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0); + SendMessage(hwndDlg, WMU_SETTIME, 0, 0); + break; + + case IDC_RAD_DAYS: + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CAL), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_DATE), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_DAY), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_DAYNUM), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_RELMIN), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), TRUE); + + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY1), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY2), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY3), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY4), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY5), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY6), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DAY7), TRUE); + SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0); SendMessage(hwndDlg, WMU_SETTIME, 0, 0); break; @@ -429,7 +631,38 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0); - if (!UpdateAlarm(add_edit_alarm->time, add_edit_alarm->occurrence)) { + if (IsDlgButtonChecked(hwndDlg, IDC_CHK_DAY1)) + add_edit_alarm->day_mask |= ALDF_1; + else + add_edit_alarm->day_mask &= ~ALDF_1; + if (IsDlgButtonChecked(hwndDlg, IDC_CHK_DAY2)) + add_edit_alarm->day_mask |= ALDF_2; + else + add_edit_alarm->day_mask &= ~ALDF_2; + if (IsDlgButtonChecked(hwndDlg, IDC_CHK_DAY3)) + add_edit_alarm->day_mask |= ALDF_3; + else + add_edit_alarm->day_mask &= ~ALDF_3; + if (IsDlgButtonChecked(hwndDlg, IDC_CHK_DAY4)) + add_edit_alarm->day_mask |= ALDF_4; + else + add_edit_alarm->day_mask &= ~ALDF_4; + if (IsDlgButtonChecked(hwndDlg, IDC_CHK_DAY5)) + add_edit_alarm->day_mask |= ALDF_5; + else + add_edit_alarm->day_mask &= ~ALDF_5; + if (IsDlgButtonChecked(hwndDlg, IDC_CHK_DAY6)) + add_edit_alarm->day_mask |= ALDF_6; + else + add_edit_alarm->day_mask &= ~ALDF_6; + if (IsDlgButtonChecked(hwndDlg, IDC_CHK_DAY7)) + add_edit_alarm->day_mask |= ALDF_7; + else + add_edit_alarm->day_mask &= ~ALDF_7; + + + + if (!UpdateAlarm(add_edit_alarm->time, add_edit_alarm->occurrence, add_edit_alarm->day_mask)) { MessageBox(hwndDlg, TranslateT("The alarm time you have selected is in the past."), TranslateT("Error"), MB_OK | MB_ICONERROR); return TRUE; } @@ -445,6 +678,7 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP add_edit_alarm->flags |= IsDlgButtonChecked(hwndDlg, IDC_CHK_NOSTARTUP) ? ALF_NOSTARTUP : 0; add_edit_alarm->flags |= IsDlgButtonChecked(hwndDlg, IDC_CHK_NOREMINDER) ? ALF_NOREMINDER : 0; + if (add_edit_alarm->action & AAF_COMMAND) { GetDlgItemText(hwndDlg, IDC_ED_COMMAND, buff, _countof(buff)); replaceStrW(add_edit_alarm->szCommand, buff); -- cgit v1.2.3