diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-02 15:43:18 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-02 15:43:18 +0000 |
commit | b9342641f520a5418fb2a8b2993148a66ea8e33b (patch) | |
tree | e7b88518a6f0b3e73a8ac67f2a008b174bc6cfcd /plugins/Alarms/options.cpp | |
parent | 526bab64790186ca6d33a96d0bd14df683b5d184 (diff) |
64-bit compilation fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@263 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Alarms/options.cpp')
-rw-r--r-- | plugins/Alarms/options.cpp | 1347 |
1 files changed, 666 insertions, 681 deletions
diff --git a/plugins/Alarms/options.cpp b/plugins/Alarms/options.cpp index 0f22a57fb0..0013b7f39c 100644 --- a/plugins/Alarms/options.cpp +++ b/plugins/Alarms/options.cpp @@ -22,35 +22,36 @@ HANDLE hMainMenuItem = 0, hGroupMenuItem; // store options dialog window handle statically so it can be refreshed by non-modal add alarm dialog
HWND hwndOptionsDialog = 0;
-static BOOL CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
+static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ ALARM *add_edit_alarm = (ALARM *)GetWindowLong(hwndDlg, GWLP_USERDATA);
+ HWND hw;
switch ( msg ) {
- case WM_INITDIALOG: {
- TranslateDialogDefault( hwndDlg );
-
- SendDlgItemMessage(hwndDlg, IDC_DAY, CB_INSERTSTRING, 0, (LPARAM)Translate("Sunday"));
- SendDlgItemMessage(hwndDlg, IDC_DAY, CB_INSERTSTRING, 1, (LPARAM)Translate("Monday"));
- SendDlgItemMessage(hwndDlg, IDC_DAY, CB_INSERTSTRING, 2, (LPARAM)Translate("Tuesday"));
- SendDlgItemMessage(hwndDlg, IDC_DAY, CB_INSERTSTRING, 3, (LPARAM)Translate("Wednesday"));
- SendDlgItemMessage(hwndDlg, IDC_DAY, CB_INSERTSTRING, 4, (LPARAM)Translate("Thursday"));
- SendDlgItemMessage(hwndDlg, IDC_DAY, CB_INSERTSTRING, 5, (LPARAM)Translate("Friday"));
- SendDlgItemMessage(hwndDlg, IDC_DAY, CB_INSERTSTRING, 6, (LPARAM)Translate("Saturday"));
- SendDlgItemMessage(hwndDlg, IDC_DAY, CB_SETCURSEL, 0, 0);
+ case WM_INITDIALOG:
+ TranslateDialogDefault( hwndDlg );
+ SendDlgItemMessage(hwndDlg, IDC_DAY, CB_INSERTSTRING, 0, (LPARAM)Translate("Sunday"));
+ SendDlgItemMessage(hwndDlg, IDC_DAY, CB_INSERTSTRING, 1, (LPARAM)Translate("Monday"));
+ SendDlgItemMessage(hwndDlg, IDC_DAY, CB_INSERTSTRING, 2, (LPARAM)Translate("Tuesday"));
+ SendDlgItemMessage(hwndDlg, IDC_DAY, CB_INSERTSTRING, 3, (LPARAM)Translate("Wednesday"));
+ SendDlgItemMessage(hwndDlg, IDC_DAY, CB_INSERTSTRING, 4, (LPARAM)Translate("Thursday"));
+ SendDlgItemMessage(hwndDlg, IDC_DAY, CB_INSERTSTRING, 5, (LPARAM)Translate("Friday"));
+ SendDlgItemMessage(hwndDlg, IDC_DAY, CB_INSERTSTRING, 6, (LPARAM)Translate("Saturday"));
+ SendDlgItemMessage(hwndDlg, IDC_DAY, CB_SETCURSEL, 0, 0);
+ {
char buff[10];
for(int i = 1; i <= 31; i++) {
SendDlgItemMessage(hwndDlg, IDC_DAYNUM, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)itoa(i, buff, 10));
}
SendDlgItemMessage(hwndDlg, IDC_DAYNUM, CB_SETCURSEL, 0, 0);
-
{
HWND hw = GetDlgItem(hwndDlg, IDOK);
EnableWindow(hw, FALSE);
}
- if (!ServiceExists("Speak/Say")) {
+ if (!ServiceExists("Speak/Say"))
EnableWindow(GetDlgItem(hwndDlg, IDC_RAD_SPK), FALSE);
- }
AddEditParam *param = (AddEditParam *)lParam;
SendMessage(hwndDlg, WMU_OPTSETALARM, (WPARAM)param->edit, (LPARAM)param->alarm_ptr);
@@ -62,98 +63,99 @@ static BOOL CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA Utils_RestoreWindowPositionNoSize(hwndDlg, 0, MODULE, "AddEdit");
- if(GetDlgCtrlID((HWND)wParam) != IDC_TITLE) {
+ if (GetDlgCtrlID((HWND)wParam) != IDC_TITLE) {
SetFocus(GetDlgItem(hwndDlg, IDC_TITLE));
return FALSE;
- }
- return TRUE;
+ }
}
- case WMU_OPTSETALARM: {
+ return TRUE;
+
+ case WMU_OPTSETALARM:
+ {
BOOL edit = (BOOL)wParam;
- ALARM *add_edit_alarm = (ALARM *)lParam;
- SetWindowLong(hwndDlg, GWL_USERDATA, (LONG)add_edit_alarm);
+ add_edit_alarm = (ALARM *)lParam;
+ SetWindowLong(hwndDlg, GWLP_USERDATA, (LONG)add_edit_alarm);
- if(edit) {
+ if (edit) {
SetDlgItemText(hwndDlg, IDC_TITLE, add_edit_alarm->szTitle);
SetDlgItemText(hwndDlg, IDC_DESC, add_edit_alarm->szDesc);
switch(add_edit_alarm->occurrence) {
- case OC_DAILY: {
- CheckDlgButton(hwndDlg, IDC_RAD_DAILY, TRUE);
- HWND hw = GetDlgItem(hwndDlg, IDC_BTN_CAL);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_DATE);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_DAY);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
- EnableWindow(hw, TRUE);
- }
+ case OC_DAILY:
+ CheckDlgButton(hwndDlg, IDC_RAD_DAILY, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_BTN_CAL);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_DATE);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_DAY);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
+ EnableWindow(hw, TRUE);
break;
- case OC_WEEKDAYS: {
- CheckDlgButton(hwndDlg, IDC_RAD_WEEKDAYS, TRUE);
- HWND hw = GetDlgItem(hwndDlg, IDC_BTN_CAL);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_DATE);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_DAY);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_RELMIN);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
- EnableWindow(hw, TRUE);
- }
+
+ case OC_WEEKDAYS:
+ CheckDlgButton(hwndDlg, IDC_RAD_WEEKDAYS, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_BTN_CAL);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_DATE);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_DAY);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_RELMIN);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
+ EnableWindow(hw, TRUE);
break;
- case OC_ONCE: {
- CheckDlgButton(hwndDlg, IDC_RAD_ONCE, TRUE);
- HWND hw = GetDlgItem(hwndDlg, IDC_DAY);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
- EnableWindow(hw, FALSE);
- }
+
+ case OC_ONCE:
+ CheckDlgButton(hwndDlg, IDC_RAD_ONCE, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_DAY);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
+ EnableWindow(hw, FALSE);
break;
- case OC_WEEKLY: {
- CheckDlgButton(hwndDlg, IDC_RAD_WEEKLY, TRUE);
- HWND hw = GetDlgItem(hwndDlg, IDC_BTN_CAL);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_DATE);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_RELMIN);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
- EnableWindow(hw, TRUE);
- }
+
+ case OC_WEEKLY:
+ CheckDlgButton(hwndDlg, IDC_RAD_WEEKLY, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_BTN_CAL);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_DATE);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_RELMIN);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
+ EnableWindow(hw, TRUE);
break;
- case OC_MONTHLY: {
- CheckDlgButton(hwndDlg, IDC_RAD_MONTHLY, TRUE);
- HWND hw = GetDlgItem(hwndDlg, IDC_BTN_CAL);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_DATE);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_DAY);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_RELMIN);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
- EnableWindow(hw, TRUE);
- }
+
+ case OC_MONTHLY:
+ CheckDlgButton(hwndDlg, IDC_RAD_MONTHLY, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_BTN_CAL);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_DATE);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_DAY);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_RELMIN);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
+ EnableWindow(hw, TRUE);
break;
- case OC_YEARLY: {
- CheckDlgButton(hwndDlg, IDC_RAD_YEARLY, TRUE);
- HWND hw = GetDlgItem(hwndDlg, IDC_DAY);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
- EnableWindow(hw, TRUE);
- }
+
+ case OC_YEARLY:
+ CheckDlgButton(hwndDlg, IDC_RAD_YEARLY, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_DAY);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
+ EnableWindow(hw, TRUE);
break;
}
@@ -167,7 +169,7 @@ static BOOL CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA 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);
- if(add_edit_alarm->action & AAF_SOUND) {
+ if (add_edit_alarm->action & AAF_SOUND) {
CheckDlgButton(hwndDlg, IDC_CHK_ASOUND, TRUE);
switch(add_edit_alarm->sound_num) {
case 1:
@@ -187,8 +189,9 @@ static BOOL CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA CheckDlgButton(hwndDlg, IDC_RAD_SPK, TRUE);
break;
- };
- } else {
+ }
+ }
+ else {
HWND hw = GetDlgItem(hwndDlg, IDC_RAD_SND1);
EnableWindow(hw, FALSE);
hw = GetDlgItem(hwndDlg, IDC_RAD_SND2);
@@ -196,19 +199,21 @@ static BOOL CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA hw = GetDlgItem(hwndDlg, IDC_RAD_SND3);
EnableWindow(hw, FALSE);
}
- if(add_edit_alarm->action & AAF_POPUP) CheckDlgButton(hwndDlg, IDC_CHK_APOPUP, TRUE);
- if(add_edit_alarm->action & AAF_COMMAND) {
+ if (add_edit_alarm->action & AAF_POPUP)
+ CheckDlgButton(hwndDlg, IDC_CHK_APOPUP, TRUE);
+ if (add_edit_alarm->action & AAF_COMMAND) {
CheckDlgButton(hwndDlg, IDC_CHK_ACOMMAND, TRUE);
SetDlgItemText(hwndDlg, IDC_ED_COMMAND, add_edit_alarm->szCommand);
SetDlgItemText(hwndDlg, IDC_ED_PARAMS, add_edit_alarm->szCommandParams);
- } else {
+ }
+ else {
HWND hw = GetDlgItem(hwndDlg, IDC_ED_COMMAND);
EnableWindow(hw, FALSE);
hw = GetDlgItem(hwndDlg, IDC_ED_PARAMS);
EnableWindow(hw, FALSE);
}
-
- } else {
+ }
+ else {
SYSTEMTIME now;
GetPluginTime(&now);
@@ -237,434 +242,417 @@ static BOOL CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA hw = GetDlgItem(hwndDlg, IDC_ED_PARAMS);
EnableWindow(hw, FALSE);
}
- return TRUE;
}
+ return TRUE;
- case WMU_UPDATETIME: {
- ALARM *add_edit_alarm = (ALARM *)GetWindowLong(hwndDlg, GWL_USERDATA);
-
- if(IsDlgButtonChecked(hwndDlg, IDC_RAD_ONCE))
- 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_WEEKDAYS))
- add_edit_alarm->occurrence = OC_WEEKDAYS;
- else if(IsDlgButtonChecked(hwndDlg, IDC_RAD_WEEKLY))
- add_edit_alarm->occurrence = OC_WEEKLY;
- else if(IsDlgButtonChecked(hwndDlg, IDC_RAD_MONTHLY))
- add_edit_alarm->occurrence = OC_MONTHLY;
- else if(IsDlgButtonChecked(hwndDlg, IDC_RAD_YEARLY)) {
- add_edit_alarm->occurrence = OC_YEARLY;
+ case WMU_UPDATETIME:
+ if (IsDlgButtonChecked(hwndDlg, IDC_RAD_ONCE))
+ 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_WEEKDAYS))
+ add_edit_alarm->occurrence = OC_WEEKDAYS;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_RAD_WEEKLY))
+ add_edit_alarm->occurrence = OC_WEEKLY;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_RAD_MONTHLY))
+ add_edit_alarm->occurrence = OC_MONTHLY;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_RAD_YEARLY)) {
+ add_edit_alarm->occurrence = OC_YEARLY;
- // set date range to 1 year (now to 1 year in future)
- SYSTEMTIME r[2];
- GetPluginTime(&r[0]);
- TimeForMinutesInFuture(365 * 24 * 60, &r[1]);
- SendDlgItemMessage(hwndDlg, IDC_DATE, DTM_SETRANGE, (WPARAM)(GDTR_MIN | GDTR_MAX), (LPARAM)r);
- }
-
- 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);
- }
+ // set date range to 1 year (now to 1 year in future)
+ SYSTEMTIME r[2];
+ GetPluginTime(&r[0]);
+ TimeForMinutesInFuture(365 * 24 * 60, &r[1]);
+ SendDlgItemMessage(hwndDlg, IDC_DATE, DTM_SETRANGE, (WPARAM)(GDTR_MIN | GDTR_MAX), (LPARAM)r);
+ }
- if(add_edit_alarm->occurrence == OC_WEEKLY) {
- add_edit_alarm->time.wDayOfWeek = (unsigned short)SendDlgItemMessage(hwndDlg, IDC_DAY, CB_GETCURSEL, 0, 0);
- }
- if(add_edit_alarm->occurrence == OC_MONTHLY) {
- add_edit_alarm->time.wDay = (WORD)SendDlgItemMessage(hwndDlg, IDC_DAYNUM, CB_GETCURSEL, 0, 0) + 1;
- }
+ 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);
- SYSTEMTIME temp_time;
- SendDlgItemMessage(hwndDlg, IDC_TIME, DTM_GETSYSTEMTIME, 0, (LPARAM)&temp_time);
- add_edit_alarm->time.wHour = temp_time.wHour;
- add_edit_alarm->time.wMinute = temp_time.wMinute;
- add_edit_alarm->time.wSecond = temp_time.wSecond;
+ if (add_edit_alarm->occurrence == OC_WEEKLY)
+ add_edit_alarm->time.wDayOfWeek = (unsigned short)SendDlgItemMessage(hwndDlg, IDC_DAY, CB_GETCURSEL, 0, 0);
- UpdateAlarm(add_edit_alarm->time, add_edit_alarm->occurrence);
+ if (add_edit_alarm->occurrence == OC_MONTHLY)
+ add_edit_alarm->time.wDay = (WORD)SendDlgItemMessage(hwndDlg, IDC_DAYNUM, CB_GETCURSEL, 0, 0) + 1;
- return TRUE;
- }
+ SYSTEMTIME temp_time;
+ SendDlgItemMessage(hwndDlg, IDC_TIME, DTM_GETSYSTEMTIME, 0, (LPARAM)&temp_time);
+ add_edit_alarm->time.wHour = temp_time.wHour;
+ add_edit_alarm->time.wMinute = temp_time.wMinute;
+ add_edit_alarm->time.wSecond = temp_time.wSecond;
- case WMU_SETTIME: {
- ALARM *add_edit_alarm = (ALARM *)GetWindowLong(hwndDlg, GWL_USERDATA);
+ UpdateAlarm(add_edit_alarm->time, add_edit_alarm->occurrence);
+ return TRUE;
+ case WMU_SETTIME:
+ {
SYSTEMTIME temp_time;
SendDlgItemMessage(hwndDlg, IDC_DATE, MCM_GETCURSEL, 0, (LPARAM)&temp_time);
- if(memcmp(&temp_time, &add_edit_alarm->time, sizeof(SYSTEMTIME)) != 0)
+ if (memcmp(&temp_time, &add_edit_alarm->time, sizeof(SYSTEMTIME)) != 0)
SendDlgItemMessage(hwndDlg, IDC_DATE, MCM_SETCURSEL, 0, (LPARAM)&add_edit_alarm->time);
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);
-
- return TRUE;
}
- case WM_NOTIFY: {
- ALARM *add_edit_alarm = (ALARM *)GetWindowLong(hwndDlg, GWL_USERDATA);
-
- if ( ((LPNMHDR)lParam)->code == DTN_DATETIMECHANGE) {
- switch( ((LPNMHDR)lParam)->idFrom ) {
- case IDC_TIME:
- {
- HWND hw = GetDlgItem(hwndDlg, IDOK);
- EnableWindow(hw, TRUE);
-
- SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
- SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
- }
- break;
+ return TRUE;
- case IDC_DATE:
- {
- HWND hw = GetDlgItem(hwndDlg, IDOK);
- EnableWindow(hw, TRUE);
+ case WM_NOTIFY:
+ if ( ((LPNMHDR)lParam)->code == DTN_DATETIMECHANGE) {
+ switch( ((LPNMHDR)lParam)->idFrom ) {
+ case IDC_TIME:
+ hw = GetDlgItem(hwndDlg, IDOK);
+ EnableWindow(hw, TRUE);
- SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
- SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
- }
- break;
- }
- return TRUE;
+ SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
+ SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
+ break;
+
+ case IDC_DATE:
+ hw = GetDlgItem(hwndDlg, IDOK);
+ EnableWindow(hw, TRUE);
+
+ SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
+ SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
+ break;
}
+ return TRUE;
}
break;
- case WM_COMMAND: {
- ALARM *add_edit_alarm = (ALARM *)GetWindowLong(hwndDlg, GWL_USERDATA);
-
- if ( HIWORD(wParam) == CBN_SELCHANGE ) {
- switch( LOWORD(wParam) ) {
- case IDC_DAY:
- case IDC_DAYNUM: {
- HWND hw = GetDlgItem(hwndDlg, IDOK);
- EnableWindow(hw, TRUE);
+ case WM_COMMAND:
+ if ( HIWORD(wParam) == CBN_SELCHANGE ) {
+ switch( LOWORD(wParam) ) {
+ case IDC_DAY:
+ case IDC_DAYNUM:
+ hw = GetDlgItem(hwndDlg, IDOK);
+ EnableWindow(hw, TRUE);
- SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
- SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
- }
- break;
- }
- return TRUE;
+ SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
+ SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
+ break;
}
- if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus()) {
- switch( LOWORD( wParam )) {
- case IDC_RELMIN: {
- BOOL translated;
- int mins;
- mins = GetDlgItemInt(hwndDlg, IDC_RELMIN, &translated, FALSE);
- SYSTEMTIME newtime;
- TimeForMinutesInFuture(mins, &newtime);
-
- SendDlgItemMessage(hwndDlg, IDC_TIME, DTM_SETSYSTEMTIME, (WPARAM)GDT_VALID, (LPARAM)&newtime);
- SendDlgItemMessage(hwndDlg, IDC_DATE, DTM_SETSYSTEMTIME, (WPARAM)GDT_VALID, (LPARAM)&newtime);
- SendDlgItemMessage(hwndDlg, IDC_DAY, CB_SETCURSEL, newtime.wDayOfWeek, 0);
- SendDlgItemMessage(hwndDlg, IDC_DAYNUM, CB_SETCURSEL, newtime.wDay - 1, 0);
-
- add_edit_alarm->time = newtime;
+ return TRUE;
+ }
+ if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus()) {
+ switch( LOWORD( wParam )) {
+ case IDC_RELMIN:
+ {
+ BOOL translated;
+ int mins;
+ mins = GetDlgItemInt(hwndDlg, IDC_RELMIN, &translated, FALSE);
+ SYSTEMTIME newtime;
+ TimeForMinutesInFuture(mins, &newtime);
+
+ SendDlgItemMessage(hwndDlg, IDC_TIME, DTM_SETSYSTEMTIME, (WPARAM)GDT_VALID, (LPARAM)&newtime);
+ SendDlgItemMessage(hwndDlg, IDC_DATE, DTM_SETSYSTEMTIME, (WPARAM)GDT_VALID, (LPARAM)&newtime);
+ SendDlgItemMessage(hwndDlg, IDC_DAY, CB_SETCURSEL, newtime.wDayOfWeek, 0);
+ SendDlgItemMessage(hwndDlg, IDC_DAYNUM, CB_SETCURSEL, newtime.wDay - 1, 0);
+
+ add_edit_alarm->time = newtime;
- SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
- }
- // drop through
- case IDC_TITLE:
- case IDC_DESC:
- case IDC_ED_COMMAND:
- case IDC_ED_PARAMS: {
- HWND hw = GetDlgItem(hwndDlg, IDOK);
- EnableWindow(hw, TRUE);
- }
- break;
+ SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
}
- return TRUE;
- }
- if ( HIWORD( wParam ) == BN_CLICKED ) {
- switch( LOWORD( wParam )) {
- case IDC_RAD_ONCE: {
- HWND hw = GetDlgItem(hwndDlg, IDC_DAY);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_BTN_CAL);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_DATE);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDOK);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_RELMIN);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
- EnableWindow(hw, FALSE);
- SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
- SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
- }
- break;
- case IDC_RAD_DAILY: {
- HWND hw = GetDlgItem(hwndDlg, IDC_BTN_CAL);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_DAY);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_DATE);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDOK);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_RELMIN);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
- EnableWindow(hw, TRUE);
- SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
- SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
- }
- break;
- case IDC_RAD_WEEKLY: {
- HWND hw = GetDlgItem(hwndDlg, IDC_BTN_CAL);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_DATE);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_DAY);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDOK);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_RELMIN);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
- EnableWindow(hw, TRUE);
- SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
- SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
- }
- break;
- case IDC_RAD_WEEKDAYS: {
- HWND hw = GetDlgItem(hwndDlg, IDC_BTN_CAL);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_DATE);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_DAY);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDOK);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_RELMIN);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
- EnableWindow(hw, TRUE);
- SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
- SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
- }
- break;
- case IDC_RAD_MONTHLY: {
- HWND hw = GetDlgItem(hwndDlg, IDC_BTN_CAL);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_DATE);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_DAY);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDOK);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_RELMIN);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
- EnableWindow(hw, TRUE);
- SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
- SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
- }
- break;
- case IDC_RAD_YEARLY: {
- HWND hw = GetDlgItem(hwndDlg, IDC_DAY);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_BTN_CAL);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_DATE);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDOK);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_RELMIN);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
- EnableWindow(hw, TRUE);
- SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
- SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
- }
- break;
- case IDC_CHK_ACOMMAND: {
- if(IsDlgButtonChecked(hwndDlg, IDC_CHK_ACOMMAND)) {
- HWND hw = GetDlgItem(hwndDlg, IDC_ED_COMMAND);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_ED_PARAMS);
- EnableWindow(hw, TRUE);
- } else {
- HWND hw = GetDlgItem(hwndDlg, IDC_ED_COMMAND);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_ED_PARAMS);
- EnableWindow(hw, FALSE);
- }
- }
// drop through
- case IDC_CHK_ASOUND: {
- if(IsDlgButtonChecked(hwndDlg, IDC_CHK_ASOUND)) {
- HWND hw = GetDlgItem(hwndDlg, IDC_RAD_SND1);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_RAD_SND2);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_RAD_SND3);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_RAD_SPK);
- EnableWindow(hw, TRUE);
- } else {
- HWND hw = GetDlgItem(hwndDlg, IDC_RAD_SND1);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_RAD_SND2);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_RAD_SND3);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_RAD_SPK);
- EnableWindow(hw, FALSE);
- }
+ case IDC_TITLE:
+ case IDC_DESC:
+ case IDC_ED_COMMAND:
+ case IDC_ED_PARAMS:
+ HWND hw = GetDlgItem(hwndDlg, IDOK);
+ EnableWindow(hw, TRUE);
+ }
+ return TRUE;
+ }
+ if ( HIWORD( wParam ) == BN_CLICKED ) {
+ switch( LOWORD( wParam )) {
+ case IDC_RAD_ONCE:
+ hw = GetDlgItem(hwndDlg, IDC_DAY);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_BTN_CAL);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_DATE);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDOK);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_RELMIN);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
+ EnableWindow(hw, FALSE);
+ SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
+ SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
+ break;
- }
- // drop though
- case IDC_RAD_SND1:
- case IDC_RAD_SND2:
- case IDC_RAD_SND3:
- case IDC_RAD_SPK:
- case IDC_CHK_SUSPEND:
- case IDC_CHK_NOSTARTUP:
- case IDC_CHK_NOREMINDER:
- case IDC_CHK_APOPUP: {
- HWND hw = GetDlgItem(hwndDlg, IDOK);
- EnableWindow(hw, TRUE);
- }
- break;
- case IDOK: {
+ case IDC_RAD_DAILY:
+ hw = GetDlgItem(hwndDlg, IDC_BTN_CAL);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_DAY);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_DATE);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDOK);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_RELMIN);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
+ EnableWindow(hw, TRUE);
+ SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
+ SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
+ break;
- char buff[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_TITLE, buff, MAX_PATH);
- if(add_edit_alarm->szTitle) free(add_edit_alarm->szTitle);
- add_edit_alarm->szTitle = _strdup(buff);
+ case IDC_RAD_WEEKLY:
+ hw = GetDlgItem(hwndDlg, IDC_BTN_CAL);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_DATE);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_DAY);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDOK);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_RELMIN);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
+ EnableWindow(hw, TRUE);
+ SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
+ SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
+ break;
- GetDlgItemText(hwndDlg, IDC_DESC, buff, MAX_PATH);
- if(add_edit_alarm->szDesc) free(add_edit_alarm->szDesc);
- add_edit_alarm->szDesc = _strdup(buff);
+ case IDC_RAD_WEEKDAYS:
+ hw = GetDlgItem(hwndDlg, IDC_BTN_CAL);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_DATE);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_DAY);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDOK);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_RELMIN);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
+ EnableWindow(hw, TRUE);
+ SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
+ SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
+ break;
- if(add_edit_alarm->szTitle == 0 || strlen(add_edit_alarm->szTitle) == 0) {
- MessageBox(hwndDlg, Translate("Please enter a title for this alarm."), Translate("Error"), MB_OK | MB_ICONERROR);
- return TRUE;
- }
+ case IDC_RAD_MONTHLY:
+ hw = GetDlgItem(hwndDlg, IDC_BTN_CAL);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_DATE);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_DAY);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDOK);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_RELMIN);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
+ EnableWindow(hw, TRUE);
+ SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
+ SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
+ break;
+
+ case IDC_RAD_YEARLY:
+ hw = GetDlgItem(hwndDlg, IDC_DAY);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_BTN_CAL);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_DATE);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDOK);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_DAYNUM);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_RELMIN);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_CHK_SUSPEND);
+ EnableWindow(hw, TRUE);
+ SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
+ SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
+ break;
+
+ case IDC_CHK_ACOMMAND:
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHK_ACOMMAND)) {
+ HWND hw = GetDlgItem(hwndDlg, IDC_ED_COMMAND);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_ED_PARAMS);
+ EnableWindow(hw, TRUE);
+ } else {
+ HWND hw = GetDlgItem(hwndDlg, IDC_ED_COMMAND);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_ED_PARAMS);
+ EnableWindow(hw, FALSE);
+ }
- SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
+ // drop through
+ case IDC_CHK_ASOUND:
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHK_ASOUND)) {
+ hw = GetDlgItem(hwndDlg, IDC_RAD_SND1);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_RAD_SND2);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_RAD_SND3);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_RAD_SPK);
+ EnableWindow(hw, TRUE);
+ }
+ else {
+ hw = GetDlgItem(hwndDlg, IDC_RAD_SND1);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_RAD_SND2);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_RAD_SND3);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_RAD_SPK);
+ EnableWindow(hw, FALSE);
+ }
- if(!UpdateAlarm(add_edit_alarm->time, add_edit_alarm->occurrence)) {
- MessageBox(hwndDlg, Translate("The alarm time you have selected is in the past."), Translate("Error"), MB_OK | MB_ICONERROR);
- return TRUE;
- }
+ // drop though
+ case IDC_RAD_SND1:
+ case IDC_RAD_SND2:
+ case IDC_RAD_SND3:
+ case IDC_RAD_SPK:
+ case IDC_CHK_SUSPEND:
+ case IDC_CHK_NOSTARTUP:
+ case IDC_CHK_NOREMINDER:
+ case IDC_CHK_APOPUP:
+ hw = GetDlgItem(hwndDlg, IDOK);
+ EnableWindow(hw, TRUE);
+ break;
+
+ case IDOK:
+ {
+ char buff[MAX_PATH];
+ GetDlgItemText(hwndDlg, IDC_TITLE, buff, MAX_PATH);
+ if (add_edit_alarm->szTitle) free(add_edit_alarm->szTitle);
+ add_edit_alarm->szTitle = _strdup(buff);
+
+ GetDlgItemText(hwndDlg, IDC_DESC, buff, MAX_PATH);
+ if (add_edit_alarm->szDesc) free(add_edit_alarm->szDesc);
+ add_edit_alarm->szDesc = _strdup(buff);
+
+ if (add_edit_alarm->szTitle == 0 || strlen(add_edit_alarm->szTitle) == 0) {
+ MessageBox(hwndDlg, Translate("Please enter a title for this alarm."), Translate("Error"), MB_OK | MB_ICONERROR);
+ return TRUE;
+ }
- add_edit_alarm->action = (IsDlgButtonChecked(hwndDlg, IDC_CHK_ASOUND) ? AAF_SOUND : 0);
- add_edit_alarm->action |= (IsDlgButtonChecked(hwndDlg, IDC_CHK_APOPUP) ? AAF_POPUP : 0);
- add_edit_alarm->action |= (IsDlgButtonChecked(hwndDlg, IDC_CHK_ACOMMAND) ? AAF_COMMAND : 0);
+ SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
- add_edit_alarm->flags = add_edit_alarm->flags & ~(ALF_SUSPENDED | ALF_NOSTARTUP | ALF_NOREMINDER);
- if(add_edit_alarm->occurrence != OC_ONCE) {
- add_edit_alarm->flags |= IsDlgButtonChecked(hwndDlg, IDC_CHK_SUSPEND) ? ALF_SUSPENDED : 0;
- }
- 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, MAX_PATH);
- if(add_edit_alarm->szCommand) free(add_edit_alarm->szCommand);
- add_edit_alarm->szCommand = _strdup(buff);
- GetDlgItemText(hwndDlg, IDC_ED_PARAMS, buff, MAX_PATH);
- if(add_edit_alarm->szCommandParams) free(add_edit_alarm->szCommandParams);
- add_edit_alarm->szCommandParams = _strdup(buff);
- }
+ if (!UpdateAlarm(add_edit_alarm->time, add_edit_alarm->occurrence)) {
+ MessageBox(hwndDlg, Translate("The alarm time you have selected is in the past."), Translate("Error"), MB_OK | MB_ICONERROR);
+ return TRUE;
+ }
- if(add_edit_alarm->action & AAF_SOUND) {
- if(IsDlgButtonChecked(hwndDlg, IDC_RAD_SND1))
- add_edit_alarm->sound_num = 1;
- else if(IsDlgButtonChecked(hwndDlg, IDC_RAD_SND2))
- add_edit_alarm->sound_num = 2;
- else if(IsDlgButtonChecked(hwndDlg, IDC_RAD_SND3))
- add_edit_alarm->sound_num = 3;
- else if(IsDlgButtonChecked(hwndDlg, IDC_RAD_SPK))
- add_edit_alarm->sound_num = 4;
- } else
- add_edit_alarm->sound_num = 0;
-
-
- Utils_SaveWindowPosition(hwndDlg, 0, MODULE, "AddEdit");
-
- // self-add (setting stored in invisible checkbox - see comments in WM_INITDIALOG
- if(IsDlgButtonChecked(hwndDlg, IDC_CHK_INVIS)) {
- alter_alarm_list(add_edit_alarm);
- RefreshReminderFrame();
- if(hwndOptionsDialog) {
- // refresh options list
- PostMessage(hwndOptionsDialog, WMU_INITOPTLIST, 0, 0);
- }
- }
+ add_edit_alarm->action = (IsDlgButtonChecked(hwndDlg, IDC_CHK_ASOUND) ? AAF_SOUND : 0);
+ add_edit_alarm->action |= (IsDlgButtonChecked(hwndDlg, IDC_CHK_APOPUP) ? AAF_POPUP : 0);
+ add_edit_alarm->action |= (IsDlgButtonChecked(hwndDlg, IDC_CHK_ACOMMAND) ? AAF_COMMAND : 0);
- // self-add (setting stored in invisible checkbox - see comments in WM_INITDIALOG
- if(IsDlgButtonChecked(hwndDlg, IDC_CHK_INVIS)) {
- free_alarm_data(add_edit_alarm);
- delete add_edit_alarm;
- }
+ add_edit_alarm->flags = add_edit_alarm->flags & ~(ALF_SUSPENDED | ALF_NOSTARTUP | ALF_NOREMINDER);
+ if (add_edit_alarm->occurrence != OC_ONCE) {
+ add_edit_alarm->flags |= IsDlgButtonChecked(hwndDlg, IDC_CHK_SUSPEND) ? ALF_SUSPENDED : 0;
+ }
+ 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, MAX_PATH);
+ if (add_edit_alarm->szCommand) free(add_edit_alarm->szCommand);
+ add_edit_alarm->szCommand = _strdup(buff);
+ GetDlgItemText(hwndDlg, IDC_ED_PARAMS, buff, MAX_PATH);
+ if (add_edit_alarm->szCommandParams) free(add_edit_alarm->szCommandParams);
+ add_edit_alarm->szCommandParams = _strdup(buff);
+ }
- // inform options dialog of change
+ if (add_edit_alarm->action & AAF_SOUND) {
+ if (IsDlgButtonChecked(hwndDlg, IDC_RAD_SND1))
+ add_edit_alarm->sound_num = 1;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_RAD_SND2))
+ add_edit_alarm->sound_num = 2;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_RAD_SND3))
+ add_edit_alarm->sound_num = 3;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_RAD_SPK))
+ add_edit_alarm->sound_num = 4;
+ } else
+ add_edit_alarm->sound_num = 0;
+
+
+ Utils_SaveWindowPosition(hwndDlg, 0, MODULE, "AddEdit");
+
+ // self-add (setting stored in invisible checkbox - see comments in WM_INITDIALOG
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHK_INVIS)) {
+ alter_alarm_list(add_edit_alarm);
+ RefreshReminderFrame();
+ if (hwndOptionsDialog) {
+ // refresh options list
+ PostMessage(hwndOptionsDialog, WMU_INITOPTLIST, 0, 0);
+ }
+ }
- // deal with modal and non-modal modes
- PostMessage(hwndDlg, WMU_MYDESTROY, 0, 0);
- EndDialog(hwndDlg, IDOK);
+ // self-add (setting stored in invisible checkbox - see comments in WM_INITDIALOG
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHK_INVIS)) {
+ free_alarm_data(add_edit_alarm);
+ delete add_edit_alarm;
}
- break;
- case IDCANCEL: {
- // self-add (setting stored in invisible checkbox - see comments in WM_INITDIALOG
- if(IsDlgButtonChecked(hwndDlg, IDC_CHK_INVIS)) {
- ALARM *add_edit_alarm = (ALARM *)GetWindowLong(hwndDlg, GWL_USERDATA);
- free_alarm_data(add_edit_alarm);
- delete add_edit_alarm;
- }
+ // inform options dialog of change
+
+ // deal with modal and non-modal modes
+ PostMessage(hwndDlg, WMU_MYDESTROY, 0, 0);
+ EndDialog(hwndDlg, IDOK);
+ }
+ break;
+
+ case IDCANCEL:
+ // self-add (setting stored in invisible checkbox - see comments in WM_INITDIALOG
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHK_INVIS)) {
+ ALARM *add_edit_alarm = (ALARM *)GetWindowLong(hwndDlg, GWLP_USERDATA);
+ free_alarm_data(add_edit_alarm);
+ delete add_edit_alarm;
+ }
- Utils_SaveWindowPosition(hwndDlg, 0, MODULE, "AddEdit");
+ Utils_SaveWindowPosition(hwndDlg, 0, MODULE, "AddEdit");
- // deal with modal and non-modal modes
- PostMessage(hwndDlg, WMU_MYDESTROY, 0, 0);
- EndDialog(hwndDlg, IDCANCEL);
- }
- break;
+ // deal with modal and non-modal modes
+ PostMessage(hwndDlg, WMU_MYDESTROY, 0, 0);
+ EndDialog(hwndDlg, IDCANCEL);
+ break;
- default:
- return TRUE;
- }
+ default:
+ return TRUE;
}
- break;
}
- case WMU_MYDESTROY:
- DestroyWindow(hwndDlg);
- return TRUE;
+ break;
+
+ case WMU_MYDESTROY:
+ DestroyWindow(hwndDlg);
+ return TRUE;
}
return FALSE;
}
-BOOL Edit(HWND hwnd, ALARM &alarm, bool modal) {
+BOOL Edit(HWND hwnd, ALARM &alarm, bool modal)
+{
AddEditParam *param = new AddEditParam;
param->alarm_ptr = &alarm;
param->edit = TRUE;
- if(modal) {
+ if (modal) {
param->self_add = FALSE;
- if(DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DIALOG2), hwnd, DlgProcAddEdit, (LPARAM)param) == IDOK) {
+ if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DIALOG2), hwnd, DlgProcAddEdit, (LPARAM)param) == IDOK) {
return TRUE;
}
- } else {
+ }
+ else {
param->self_add = TRUE;
HWND hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DIALOG2), hwnd, DlgProcAddEdit, (LPARAM)param);
@@ -676,24 +664,25 @@ BOOL Edit(HWND hwnd, ALARM &alarm, bool modal) { return FALSE;
}
-BOOL New(HWND hwnd, ALARM &alarm, bool modal) {
+BOOL New(HWND hwnd, ALARM &alarm, bool modal)
+{
AddEditParam *param = new AddEditParam;
param->alarm_ptr = &alarm;
param->edit = FALSE;
- if(modal) {
+ if (modal) {
param->self_add = FALSE;
- if(DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DIALOG2), hwnd, DlgProcAddEdit, (LPARAM)param) == IDOK) {
+ if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DIALOG2), hwnd, DlgProcAddEdit, (LPARAM)param) == IDOK)
return TRUE;
- }
- } else {
+ }
+ else {
param->self_add = TRUE;
HWND hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DIALOG2), hwnd, DlgProcAddEdit, (LPARAM)param);
//SetActiveWindow(hwndDlg);
//SetWindowPos(hwndDlg,
SetForegroundWindow(hwndDlg);
- if(ServiceExists(MS_TTB_SETBUTTONSTATE)) {
+ if (ServiceExists(MS_TTB_SETBUTTONSTATE)) {
Sleep(100);
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTopToolbarButton, (LPARAM)TTBST_RELEASED);
}
@@ -703,8 +692,9 @@ BOOL New(HWND hwnd, ALARM &alarm, bool modal) { return FALSE;
}
-void AddMenuItem() {
- if(hMainMenuItem) return;
+void AddMenuItem()
+{
+ if (hMainMenuItem) return;
CLISTMENUITEM menu = {0};
@@ -715,32 +705,20 @@ void AddMenuItem() { menu.pszName = Translate("Set Alarm");
menu.pszService= MODULE "/NewAlarm";
menu.position = 500010000;
- if(!ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
+ if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
menu.pszPopupName = Translate("Alarms");
if (ServiceExists(MS_CLIST_ADDGROUPMENUITEM)) {
GroupMenuParam gmp = {0};
hGroupMenuItem = (HANDLE)CallService(MS_CLIST_ADDGROUPMENUITEM,(WPARAM)&gmp,(LPARAM)&menu);
}
hMainMenuItem = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&menu);
- /////////////////////
}
-/*
-void RemoveMenuItem() {
- if(!hMainMenuItem) return;
+///////////////////////
+// create menu item
- CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)hMainMenuItem, 0);
- if(ServiceExists(MS_CLIST_REMOVEGROUPMENUITEM)) {
- CallService(MS_CLIST_REMOVEGROUPMENUITEM, (WPARAM)hGroupMenuItem, 0);
- }
- hMainMenuItem = 0;
-
-}
-*/
-
-int OptionsModulesLoaded(WPARAM wParam, LPARAM lParam) {
- ///////////////////////
- // create menu item
+int OptionsModulesLoaded(WPARAM wParam, LPARAM lParam)
+{
CreateServiceFunction(MODULE "/NewAlarm", NewAlarmMenuFunc);
AddMenuItem();
@@ -785,10 +763,12 @@ protected: ShortList deleted_list; // same with deleted items
Options temp_options;
-static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
+static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ int sel;
switch ( msg ) {
- case WM_INITDIALOG: {
+ case WM_INITDIALOG:
hwndOptionsDialog = hwndDlg;
added_list.clear();
modified_list.clear();
@@ -800,78 +780,97 @@ static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l PostMessage(hwndDlg, WMU_INITOPTLIST, 0, 0);
return TRUE;
- }
- case WMU_INITOPTLIST: {
+
+ case WMU_INITOPTLIST:
copy_list(temp_list);
- // add added alarms, in case this is a list refresh from non-modal add alarm dialog
- ALARM *i, *j;
- for(added_list.reset(); i = added_list.current(); added_list.next()) {
- temp_list.push_back(i);
- }
- // modify modified alarms, in case this is a list refresh from non-modal add alarm dialog
- for(temp_list.reset(); i = temp_list.current(); temp_list.next()) {
- for(modified_list.reset(); j = modified_list.current(); modified_list.next()) {
- if(i->id == j->id) {
- copy_alarm_data(i, j);
- }
+ {
+ // add added alarms, in case this is a list refresh from non-modal add alarm dialog
+ ALARM *i, *j;
+ for(added_list.reset(); i = added_list.current(); added_list.next()) {
+ temp_list.push_back(i);
}
- }
- // remove deleted alarms, in case this is a list refresh from non-modal add alarm dialog
-
- ShortList::Node *k = deleted_list.get_head();
- while(k) {
+ // modify modified alarms, in case this is a list refresh from non-modal add alarm dialog
for(temp_list.reset(); i = temp_list.current(); temp_list.next()) {
- if(i->id == k->value) {
- temp_list.erase();
- break;
+ for(modified_list.reset(); j = modified_list.current(); modified_list.next()) {
+ if (i->id == j->id) {
+ copy_alarm_data(i, j);
+ }
}
}
- k = k->next;
- }
+ // remove deleted alarms, in case this is a list refresh from non-modal add alarm dialog
- SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_RESETCONTENT, 0, 0);
-
- if(temp_list.size() > 0) {
- int pos = -1;
- ALARM *i;
- for(temp_list.reset(); i = temp_list.current(); temp_list.next()) {
- if(!(i->flags & ALF_HIDDEN)) {
- pos = SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_ADDSTRING, 0, (LPARAM)i->szTitle);
- SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_SETITEMDATA, pos, (LPARAM)i->id);
+ ShortList::Node *k = deleted_list.get_head();
+ while(k) {
+ for(temp_list.reset(); i = temp_list.current(); temp_list.next()) {
+ if (i->id == k->value) {
+ temp_list.erase();
+ break;
+ }
}
+ k = k->next;
}
- SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_SETCURSEL, pos, 0);
- HWND hw;
- hw = GetDlgItem(hwndDlg, IDC_EDIT);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_DEL);
- EnableWindow(hw, TRUE);
- } else {
- HWND hw;
- hw = GetDlgItem(hwndDlg, IDC_EDIT);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_DEL);
- EnableWindow(hw, FALSE);
- }
- if(ServiceExists(MS_POPUP_ADDPOPUP)) {
- CheckDlgButton(hwndDlg, IDC_CHK_POPUPS, temp_options.use_popup_module ? TRUE : FALSE);
- if(options.use_popup_module) {
- HWND hw = GetDlgItem(hwndDlg, IDC_CHK_LOOPSOUND);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_CHK_AWROUND);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_CHK_AWNOACTIVATE);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_SPIN_TRANS);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_ED_TRANS);
+ SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_RESETCONTENT, 0, 0);
+
+ if (temp_list.size() > 0) {
+ int pos = -1;
+ ALARM *i;
+ for(temp_list.reset(); i = temp_list.current(); temp_list.next()) {
+ if (!(i->flags & ALF_HIDDEN)) {
+ pos = SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_ADDSTRING, 0, (LPARAM)i->szTitle);
+ SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_SETITEMDATA, pos, (LPARAM)i->id);
+ }
+ }
+ SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_SETCURSEL, pos, 0);
+ HWND hw;
+ hw = GetDlgItem(hwndDlg, IDC_EDIT);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_DEL);
+ EnableWindow(hw, TRUE);
+ } else {
+ HWND hw;
+ hw = GetDlgItem(hwndDlg, IDC_EDIT);
EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_BTN_PREVIEW);
+ hw = GetDlgItem(hwndDlg, IDC_DEL);
EnableWindow(hw, FALSE);
+ }
+
+ if (ServiceExists(MS_POPUP_ADDPOPUP)) {
+ CheckDlgButton(hwndDlg, IDC_CHK_POPUPS, temp_options.use_popup_module ? TRUE : FALSE);
+ if (options.use_popup_module) {
+ HWND hw = GetDlgItem(hwndDlg, IDC_CHK_LOOPSOUND);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_CHK_AWROUND);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_CHK_AWNOACTIVATE);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_SPIN_TRANS);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_ED_TRANS);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_BTN_PREVIEW);
+ EnableWindow(hw, FALSE);
+ } else {
+ CheckDlgButton(hwndDlg, IDC_CHK_LOOPSOUND, temp_options.loop_sound ? TRUE : FALSE);
+ HWND hw = GetDlgItem(hwndDlg, IDC_CHK_LOOPSOUND);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_CHK_AWROUND);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_CHK_AWNOACTIVATE);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_SPIN_TRANS);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_ED_TRANS);
+ EnableWindow(hw, TRUE);
+ hw = GetDlgItem(hwndDlg, IDC_BTN_PREVIEW);
+ EnableWindow(hw, TRUE);
+ }
} else {
+ HWND hw = GetDlgItem(hwndDlg, IDC_CHK_POPUPS);
+ EnableWindow(hw, FALSE);
CheckDlgButton(hwndDlg, IDC_CHK_LOOPSOUND, temp_options.loop_sound ? TRUE : FALSE);
- HWND hw = GetDlgItem(hwndDlg, IDC_CHK_LOOPSOUND);
+
+ hw = GetDlgItem(hwndDlg, IDC_CHK_LOOPSOUND);
EnableWindow(hw, TRUE);
hw = GetDlgItem(hwndDlg, IDC_CHK_AWROUND);
EnableWindow(hw, TRUE);
@@ -884,41 +883,24 @@ static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l hw = GetDlgItem(hwndDlg, IDC_BTN_PREVIEW);
EnableWindow(hw, TRUE);
}
- } else {
- HWND hw = GetDlgItem(hwndDlg, IDC_CHK_POPUPS);
- EnableWindow(hw, FALSE);
- CheckDlgButton(hwndDlg, IDC_CHK_LOOPSOUND, temp_options.loop_sound ? TRUE : FALSE);
-
- hw = GetDlgItem(hwndDlg, IDC_CHK_LOOPSOUND);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_CHK_AWROUND);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_CHK_AWNOACTIVATE);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_SPIN_TRANS);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_ED_TRANS);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_BTN_PREVIEW);
- EnableWindow(hw, TRUE);
- }
- SendMessage(GetDlgItem(hwndDlg, IDC_SPIN_SNOOZE), UDM_SETRANGE, 0, (LPARAM)MAKELONG(360, 0));
- SendMessage(GetDlgItem(hwndDlg, IDC_SPIN_SNOOZE), UDM_SETPOS, 0, temp_options.snooze_minutes);
+ SendMessage(GetDlgItem(hwndDlg, IDC_SPIN_SNOOZE), UDM_SETRANGE, 0, (LPARAM)MAKELONG(360, 0));
+ SendMessage(GetDlgItem(hwndDlg, IDC_SPIN_SNOOZE), UDM_SETPOS, 0, temp_options.snooze_minutes);
- SendMessage(GetDlgItem(hwndDlg, IDC_SPIN_ROWHEIGHT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(100, 5));
- SendMessage(GetDlgItem(hwndDlg, IDC_SPIN_ROWHEIGHT), UDM_SETPOS, 0, temp_options.row_height);
+ SendMessage(GetDlgItem(hwndDlg, IDC_SPIN_ROWHEIGHT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(100, 5));
+ SendMessage(GetDlgItem(hwndDlg, IDC_SPIN_ROWHEIGHT), UDM_SETPOS, 0, temp_options.row_height);
- SendMessage(GetDlgItem(hwndDlg, IDC_SPIN_INDENT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(100, 0));
- SendMessage(GetDlgItem(hwndDlg, IDC_SPIN_INDENT), UDM_SETPOS, 0, temp_options.indent);
+ SendMessage(GetDlgItem(hwndDlg, IDC_SPIN_INDENT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(100, 0));
+ SendMessage(GetDlgItem(hwndDlg, IDC_SPIN_INDENT), UDM_SETPOS, 0, temp_options.indent);
- SendMessage(GetDlgItem(hwndDlg, IDC_SPIN_TRANS), UDM_SETRANGE, 0, (LPARAM)MAKELONG(100, 0));
- SendMessage(GetDlgItem(hwndDlg, IDC_SPIN_TRANS), UDM_SETPOS, 0, temp_options.aw_trans);
- if(!TransparencyEnabled()) {
- HWND hw = GetDlgItem(hwndDlg, IDC_SPIN_TRANS);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_ED_TRANS);
- EnableWindow(hw, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_SPIN_TRANS), UDM_SETRANGE, 0, (LPARAM)MAKELONG(100, 0));
+ SendMessage(GetDlgItem(hwndDlg, IDC_SPIN_TRANS), UDM_SETPOS, 0, temp_options.aw_trans);
+ if (!TransparencyEnabled()) {
+ HWND hw = GetDlgItem(hwndDlg, IDC_SPIN_TRANS);
+ EnableWindow(hw, FALSE);
+ hw = GetDlgItem(hwndDlg, IDC_ED_TRANS);
+ EnableWindow(hw, FALSE);
+ }
}
CheckDlgButton(hwndDlg, IDC_SHOWHIDE, temp_options.auto_showhide ? TRUE : FALSE);
@@ -933,40 +915,41 @@ static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l SendMessage( GetParent( hwndDlg ), PSM_UNCHANGED, 0, 0 );
return TRUE;
- }
+
case WM_COMMAND:
- if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus()) {
+ if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus())
SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
- }
+
if ( HIWORD( wParam ) == BN_CLICKED ) {
switch( LOWORD( wParam )) {
- case IDC_BTN_PREVIEW:
- {
- HWND hwndDlgPrev = CreateDialog(hInst, MAKEINTRESOURCE(IDD_ALARM), GetDesktopWindow(), DlgProcAlarm);
- WindowList_Add(hAlarmWindowList, hwndDlgPrev, 0);
- SendMessage(hwndDlgPrev, WMU_FAKEALARM, 0, 0);
- SendMessage(hwndDlgPrev, WMU_SETOPT, 0, (LPARAM)&temp_options);
- ShowWindow(hwndDlgPrev, SW_SHOW);
- SetWindowPos(hwndDlgPrev, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
- }
- break;
- case IDC_SHOWHIDE:
- temp_options.auto_showhide = IsDlgButtonChecked(hwndDlg, IDC_SHOWHIDE) ? true : false;
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
- break;
- case IDC_SHOWHIDE2:
- temp_options.hide_with_clist = IsDlgButtonChecked(hwndDlg, IDC_SHOWHIDE2) ? true : false;
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
- break;
- case IDC_AUTOSIZEVERT:
- temp_options.auto_size_vert = IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEVERT) ? true : false;
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
- break;
- case IDC_NEW: {
+ case IDC_BTN_PREVIEW:
+ {
+ HWND hwndDlgPrev = CreateDialog(hInst, MAKEINTRESOURCE(IDD_ALARM), GetDesktopWindow(), DlgProcAlarm);
+ WindowList_Add(hAlarmWindowList, hwndDlgPrev, 0);
+ SendMessage(hwndDlgPrev, WMU_FAKEALARM, 0, 0);
+ SendMessage(hwndDlgPrev, WMU_SETOPT, 0, (LPARAM)&temp_options);
+ ShowWindow(hwndDlgPrev, SW_SHOW);
+ SetWindowPos(hwndDlgPrev, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ }
+ break;
+ case IDC_SHOWHIDE:
+ temp_options.auto_showhide = IsDlgButtonChecked(hwndDlg, IDC_SHOWHIDE) ? true : false;
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ break;
+ case IDC_SHOWHIDE2:
+ temp_options.hide_with_clist = IsDlgButtonChecked(hwndDlg, IDC_SHOWHIDE2) ? true : false;
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ break;
+ case IDC_AUTOSIZEVERT:
+ temp_options.auto_size_vert = IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEVERT) ? true : false;
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ break;
+ case IDC_NEW:
+ {
ALARM new_alarm = {0};
GetPluginTime(&new_alarm.time);
new_alarm.id = next_alarm_id++;
- if(New(hwndDlg, new_alarm, true)) {
+ if (New(hwndDlg, new_alarm, true)) {
new_alarm.id = next_alarm_id++;
temp_list.push_back(&new_alarm);
added_list.push_back(&new_alarm);
@@ -984,57 +967,52 @@ static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l }
}
break;
- case IDC_EDIT: {
- int sel = SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_GETCURSEL, 0, 0);
- if(sel != -1) {
- unsigned short id = (unsigned short)SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_GETITEMDATA, sel, 0);
- ALARM *i;
- for(temp_list.reset(); i = temp_list.current(); temp_list.next()) {
- if(i->id == id) {
- ALARM a = {0};
- copy_alarm_data(&a, i);
- if(Edit(hwndDlg, a, true)) {
- modified_list.push_back(&a);
- SendMessage(hwndDlg, WMU_INITOPTLIST, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_SETCURSEL, sel, 0);
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
- }
- free_alarm_data(&a);
- break;
+
+ case IDC_EDIT:
+ sel = SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_GETCURSEL, 0, 0);
+ if (sel != -1) {
+ unsigned short id = (unsigned short)SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_GETITEMDATA, sel, 0);
+ ALARM *i;
+ for(temp_list.reset(); i = temp_list.current(); temp_list.next()) {
+ if (i->id == id) {
+ ALARM a = {0};
+ copy_alarm_data(&a, i);
+ if (Edit(hwndDlg, a, true)) {
+ modified_list.push_back(&a);
+ SendMessage(hwndDlg, WMU_INITOPTLIST, 0, 0);
+ SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_SETCURSEL, sel, 0);
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
}
+ free_alarm_data(&a);
+ break;
}
}
}
break;
- case IDC_DEL: {
- int sel = SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_GETCURSEL, 0, 0);
- if(sel != -1) {
- unsigned short id = (unsigned short)SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_GETITEMDATA, sel, 0);
-
- ALARM *i;
- for(temp_list.reset(); i = temp_list.current(); temp_list.next()) {
- if(i->id == id) {
- deleted_list.push_back(i->id);
- //temp_list.erase();
- break;
- }
- }
-
- SendMessage(hwndDlg, WMU_INITOPTLIST, 0, 0);
- //HWND hw;
- //hw = GetDlgItem(hwndDlg, IDC_EDIT);
- //EnableWindow(hw, FALSE);
- //hw = GetDlgItem(hwndDlg, IDC_DEL);
- //EnableWindow(hw, FALSE);
+ case IDC_DEL:
+ sel = SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_GETCURSEL, 0, 0);
+ if (sel != -1) {
+ unsigned short id = (unsigned short)SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_GETITEMDATA, sel, 0);
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ ALARM *i;
+ for(temp_list.reset(); i = temp_list.current(); temp_list.next()) {
+ if (i->id == id) {
+ deleted_list.push_back(i->id);
+ //temp_list.erase();
+ break;
+ }
}
+
+ SendMessage( hwndDlg, WMU_INITOPTLIST, 0, 0 );
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
}
break;
- case IDC_CHK_POPUPS: {
+
+ case IDC_CHK_POPUPS:
+ {
BOOL chk = IsDlgButtonChecked(hwndDlg, IDC_CHK_POPUPS);
- if(chk) CheckDlgButton(hwndDlg, IDC_CHK_LOOPSOUND, FALSE);
+ if (chk) CheckDlgButton(hwndDlg, IDC_CHK_LOOPSOUND, FALSE);
else CheckDlgButton(hwndDlg, IDC_CHK_LOOPSOUND, temp_options.loop_sound);
HWND hw = GetDlgItem(hwndDlg, IDC_CHK_LOOPSOUND);
@@ -1054,24 +1032,25 @@ static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
}
break;
- case IDC_CHK_LOOPSOUND: {
- temp_options.loop_sound = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOOPSOUND) ? true : false;
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
- }
+
+ case IDC_CHK_LOOPSOUND:
+ temp_options.loop_sound = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOOPSOUND) ? true : false;
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
break;
- case IDC_CHK_AWROUND: {
- temp_options.aw_roundcorners = IsDlgButtonChecked(hwndDlg, IDC_CHK_AWROUND) ? true : false;
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
- }
+
+ case IDC_CHK_AWROUND:
+ temp_options.aw_roundcorners = IsDlgButtonChecked(hwndDlg, IDC_CHK_AWROUND) ? true : false;
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
break;
- case IDC_CHK_AWNOACTIVATE: {
- temp_options.aw_dontstealfocus = IsDlgButtonChecked(hwndDlg, IDC_CHK_AWNOACTIVATE) ? true : false;
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
- }
+
+ case IDC_CHK_AWNOACTIVATE:
+ temp_options.aw_dontstealfocus = IsDlgButtonChecked(hwndDlg, IDC_CHK_AWNOACTIVATE) ? true : false;
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
break;
}
return TRUE;
}
+
if (HIWORD( wParam ) == LBN_SELCHANGE) {
HWND hw;
hw = GetDlgItem(hwndDlg, IDC_EDIT);
@@ -1082,16 +1061,17 @@ static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l //SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
return TRUE;
}
+
if (HIWORD( wParam ) == LBN_DBLCLK) {
int sel = SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_GETCURSEL, 0, 0);
- if(sel != -1) {
+ if (sel != -1) {
unsigned short id = (unsigned short)SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_GETITEMDATA, sel, 0);
ALARM *i;
for(temp_list.reset(); i = temp_list.current(); temp_list.next()) {
- if(i->id == id) {
+ if (i->id == id) {
ALARM a = {0};
copy_alarm_data(&a, i);
- if(Edit(hwndDlg, a, true)) {
+ if (Edit(hwndDlg, a, true)) {
modified_list.push_back(&a);
SendMessage(hwndDlg, WMU_INITOPTLIST, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_SETCURSEL, sel, 0);
@@ -1106,10 +1086,10 @@ static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l break;
case WM_NOTIFY:
- if(((LPNMHDR)lParam)->code == UDN_DELTAPOS ) {
+ if (((LPNMHDR)lParam)->code == UDN_DELTAPOS ) {
BOOL translated;
int trans = GetDlgItemInt(hwndDlg, IDC_ED_TRANS, &translated, FALSE);
- if(translated) temp_options.aw_trans = trans;
+ if (translated) temp_options.aw_trans = trans;
SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
return TRUE;
}
@@ -1119,13 +1099,13 @@ static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l BOOL translated;
int snooze_mins = GetDlgItemInt(hwndDlg, IDC_ED_SNOOZE, &translated, FALSE);
- if(translated) temp_options.snooze_minutes = snooze_mins;
+ if (translated) temp_options.snooze_minutes = snooze_mins;
int row_height = GetDlgItemInt(hwndDlg, IDC_ED_ROWHEIGHT, &translated, FALSE);
- if(translated) temp_options.row_height = row_height;
+ if (translated) temp_options.row_height = row_height;
int indent = GetDlgItemInt(hwndDlg, IDC_ED_INDENT, &translated, FALSE);
- if(translated) temp_options.indent = indent;
+ if (translated) temp_options.indent = indent;
int trans = GetDlgItemInt(hwndDlg, IDC_ED_TRANS, &translated, FALSE);
- if(translated) temp_options.aw_trans = trans;
+ if (translated) temp_options.aw_trans = trans;
temp_options.use_popup_module = IsDlgButtonChecked(hwndDlg, IDC_CHK_POPUPS) ? true : false;
temp_options.auto_showhide = IsDlgButtonChecked(hwndDlg, IDC_SHOWHIDE) ? true : false;
@@ -1135,9 +1115,9 @@ static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l temp_options.aw_dontstealfocus = IsDlgButtonChecked(hwndDlg, IDC_CHK_AWNOACTIVATE) ? true : false;
int reminder_period = GetDlgItemInt(hwndDlg, IDC_ED_PERIOD, &translated, FALSE);
- if(translated) temp_options.reminder_period = reminder_period;
+ if (translated) temp_options.reminder_period = reminder_period;
- if(!ServiceExists(MS_POPUP_ADDPOPUP) || !options.use_popup_module)
+ if (!ServiceExists(MS_POPUP_ADDPOPUP) || !options.use_popup_module)
temp_options.loop_sound = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOOPSOUND) ? true : false;
options = temp_options;
@@ -1153,6 +1133,7 @@ static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l }
break;
+
case WM_DESTROY:
hwndOptionsDialog = 0;
added_list.clear();
@@ -1182,7 +1163,8 @@ int OptInit(WPARAM wParam,LPARAM lParam) return 0;
}
-void LoadOptions() {
+void LoadOptions()
+{
options.use_popup_module = (DBGetContactSettingByte(0, MODULE, "UsePopupModule", 0) == 1);
options.snooze_minutes = (int)DBGetContactSettingDword(0, MODULE, "SnoozeMinutes", 10);
options.row_height = (int)DBGetContactSettingDword(0, MODULE, "RowHeight", 20);
@@ -1199,7 +1181,8 @@ void LoadOptions() { HookEvent(ME_SYSTEM_MODULESLOADED, OptionsModulesLoaded);
}
-void SaveOptions() {
+void SaveOptions()
+{
DBWriteContactSettingByte(0, MODULE, "UsePopupModule", options.use_popup_module ? 1 : 0);
DBWriteContactSettingDword(0, MODULE, "SnoozeMinutes", options.snooze_minutes);
DBWriteContactSettingDword(0, MODULE, "RowHeight", options.row_height);
@@ -1214,7 +1197,8 @@ void SaveOptions() { DBWriteContactSettingDword(0, MODULE, "ReminderPeriod", options.reminder_period);
}
-int NewAlarmMenuFunc(WPARAM wParam, LPARAM lParam) {
+INT_PTR NewAlarmMenuFunc(WPARAM wParam, LPARAM lParam)
+{
ALARM *new_alarm = new ALARM;
memset(new_alarm, 0, sizeof(ALARM));
new_alarm->id = next_alarm_id++;
@@ -1226,7 +1210,8 @@ int NewAlarmMenuFunc(WPARAM wParam, LPARAM lParam) { return 0;
}
-void EditNonModal(ALARM &alarm) {
+void EditNonModal(ALARM &alarm)
+{
ALARM *new_alarm = new ALARM;
memset(new_alarm, 0, sizeof(ALARM));
copy_alarm_data(new_alarm, &alarm);
|