summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/AVS/src/poll.cpp5
-rw-r--r--plugins/Alarms/src/alarm_win.cpp110
-rw-r--r--plugins/Alarms/src/options.cpp697
3 files changed, 325 insertions, 487 deletions
diff --git a/plugins/AVS/src/poll.cpp b/plugins/AVS/src/poll.cpp
index f0e237bfef..16fdf87465 100644
--- a/plugins/AVS/src/poll.cpp
+++ b/plugins/AVS/src/poll.cpp
@@ -61,12 +61,9 @@ static int QueueSortItems(const QueueItem *p1, const QueueItem *p2)
static OBJLIST<QueueItem> queue(20, QueueSortItems);
static mir_cs cs;
-static int waitTime;
void InitPolls()
{
- waitTime = REQUEST_WAIT_TIME;
-
// Init request queue
mir_forkthread(RequestThread, NULL);
}
@@ -137,7 +134,7 @@ static void QueueAdd(MCONTACT hContact, int waitTime)
// Add an contact to a queue
void QueueAdd(MCONTACT hContact)
{
- QueueAdd(hContact, waitTime);
+ QueueAdd(hContact, REQUEST_WAIT_TIME);
}
void ProcessAvatarInfo(MCONTACT hContact, int type, PROTO_AVATAR_INFORMATION *pai, const char *szProto)
diff --git a/plugins/Alarms/src/alarm_win.cpp b/plugins/Alarms/src/alarm_win.cpp
index f4f4708fe2..6ba0aba565 100644
--- a/plugins/Alarms/src/alarm_win.cpp
+++ b/plugins/Alarms/src/alarm_win.cpp
@@ -79,14 +79,16 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
SetTextColor(hdc, window_font_colour);
SetBkMode(hdc, TRANSPARENT);
- return (BOOL)hBackgroundBrush;
+ return hBackgroundBrush != NULL;
}
}
break;
+
case WM_CTLCOLORDLG:
if (hBackgroundBrush)
- return (BOOL)hBackgroundBrush;
+ return hBackgroundBrush != NULL;
break;
+
case WMU_SETFONTS:
// fonts
if (hWindowFont)
@@ -95,7 +97,7 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
SendDlgItemMessage(hwndDlg, IDC_TITLE, WM_SETFONT, (WPARAM)hTitleFont, TRUE);
if (hBackgroundBrush) {
- SetClassLong(hwndDlg, GCLP_HBRBACKGROUND, (LONG)hBackgroundBrush);
+ SetClassLongPtr(hwndDlg, GCLP_HBRBACKGROUND, (LONG_PTR)hBackgroundBrush);
InvalidateRect(hwndDlg, 0, TRUE);
}
return TRUE;
@@ -103,42 +105,42 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
case WMU_SETOPT:
{
Options *opt;
- if (lParam) opt = (Options *)lParam;
- else opt = &options;
-
+ if (lParam)
+ opt = (Options*)lParam;
+ else
+ opt = &options;
+
// round corners
if (opt->aw_roundcorners) {
HRGN hRgn1;
RECT r;
- int v,h;
- int w=10;
- GetWindowRect(hwndDlg,&r);
- h=(r.right-r.left)>(w*2)?w:(r.right-r.left);
- v=(r.bottom-r.top)>(w*2)?w:(r.bottom-r.top);
- h=(h<v)?h:v;
- hRgn1=CreateRoundRectRgn(0,0,(r.right-r.left+1),(r.bottom-r.top+1),h,h);
- SetWindowRgn(hwndDlg,hRgn1,1);
+ int w = 10;
+ GetWindowRect(hwndDlg, &r);
+ int h = (r.right - r.left) > (w * 2) ? w : (r.right - r.left);
+ int v = (r.bottom - r.top) > (w * 2) ? w : (r.bottom - r.top);
+ h = (h<v) ? h : v;
+ hRgn1 = CreateRoundRectRgn(0, 0, (r.right - r.left + 1), (r.bottom - r.top + 1), h, h);
+ SetWindowRgn(hwndDlg, hRgn1, 1);
}
else {
HRGN hRgn1;
RECT r;
- int v,h;
- int w=10;
- GetWindowRect(hwndDlg,&r);
- h=(r.right-r.left)>(w*2)?w:(r.right-r.left);
- v=(r.bottom-r.top)>(w*2)?w:(r.bottom-r.top);
- h=(h<v)?h:v;
- hRgn1=CreateRectRgn(0,0,(r.right-r.left+1),(r.bottom-r.top+1));
- SetWindowRgn(hwndDlg,hRgn1,1);
+ int w = 10;
+ GetWindowRect(hwndDlg, &r);
+ int h = (r.right - r.left)>(w * 2) ? w : (r.right - r.left);
+ int v = (r.bottom - r.top) > (w * 2) ? w : (r.bottom - r.top);
+ h = (h < v) ? h : v;
+ hRgn1 = CreateRectRgn(0, 0, (r.right - r.left + 1), (r.bottom - r.top + 1));
+ SetWindowRgn(hwndDlg, hRgn1, 1);
}
// transparency
-
-#ifdef WS_EX_LAYERED
- SetWindowLongPtr(hwndDlg, GWL_EXSTYLE, GetWindowLongPtr(hwndDlg, GWL_EXSTYLE) | WS_EX_LAYERED);
-#endif
-#ifdef LWA_ALPHA
- SetLayeredWindowAttributes(hwndDlg, RGB(0,0,0), (int)((100 - opt->aw_trans) / 100.0 * 255), LWA_ALPHA);
-#endif
+
+ #ifdef WS_EX_LAYERED
+ SetWindowLongPtr(hwndDlg, GWL_EXSTYLE, GetWindowLongPtr(hwndDlg, GWL_EXSTYLE) | WS_EX_LAYERED);
+ #endif
+ #ifdef LWA_ALPHA
+ SetLayeredWindowAttributes(hwndDlg, RGB(0, 0, 0), (int)((100 - opt->aw_trans) / 100.0 * 255), LWA_ALPHA);
+ #endif
}
return TRUE;
@@ -154,9 +156,9 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
if (data->action & AAF_SOUND && options.loop_sound) {
if (data->sound_num <= 3)
- SetTimer(hwndDlg, ID_TIMER_SOUND, SOUND_REPEAT_PERIOD, 0);
- else if (data->sound_num == 4)
- SetTimer(hwndDlg, ID_TIMER_SOUND, SPEACH_REPEAT_PERIOD, 0);
+ SetTimer(hwndDlg, ID_TIMER_SOUND, SOUND_REPEAT_PERIOD, 0);
+ else if (data->sound_num == 4)
+ SetTimer(hwndDlg, ID_TIMER_SOUND, SPEACH_REPEAT_PERIOD, 0);
}
hw = GetDlgItem(hwndDlg, IDC_SNOOZE);
@@ -173,7 +175,7 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
}
return TRUE;
- case WM_TIMER:
+ case WM_TIMER:
if (wParam == ID_TIMER_SOUND) {
WindowData *dw = (WindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (dw) {
@@ -236,13 +238,14 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
return TRUE;
case WM_COMMAND:
- if ( HIWORD( wParam ) == BN_CLICKED ) {
- switch( LOWORD( wParam )) {
+ if (HIWORD(wParam) == BN_CLICKED) {
+ switch (LOWORD(wParam)) {
case IDCANCEL: // no button - esc pressed
case IDOK: // space?
case IDC_SNOOZE:
SendMessage(hwndDlg, WMU_ADDSNOOZER, (WPARAM)options.snooze_minutes, 0);
//drop through
+
case IDC_DISMISS:
{
WindowData *window_data = (WindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@@ -262,23 +265,24 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
DestroyWindow(hwndDlg);
}
break;
+
case IDC_SNOOZELIST:
{
POINT pt, pt_rel;
- GetCursorPos(&pt);
+ GetCursorPos(&pt);
pt_rel = pt;
- ScreenToClient(hwndDlg,&pt_rel);
+ ScreenToClient(hwndDlg, &pt_rel);
HMENU hMenu = CreatePopupMenu();
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_STRING;
-#define AddItem(x) \
- mii.wID++; \
- mii.dwTypeData = TranslateT(x); \
- mii.cch = ( UINT )mir_tstrlen(mii.dwTypeData); \
- InsertMenuItem(hMenu, mii.wID, FALSE, &mii);
+ #define AddItem(x) \
+ mii.wID++; \
+ mii.dwTypeData = TranslateT(x); \
+ mii.cch = ( UINT )mir_tstrlen(mii.dwTypeData); \
+ InsertMenuItem(hMenu, mii.wID, FALSE, &mii);
AddItem(LPGEN("5 mins"));
AddItem(LPGEN("15 mins"));
@@ -287,10 +291,10 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
AddItem(LPGEN("1 day"));
AddItem(LPGEN("1 week"));
- TPMPARAMS tpmp = {0};
- tpmp.cbSize = sizeof(tpmp);
+ TPMPARAMS tpmp = { 0 };
+ tpmp.cbSize = sizeof(tpmp);
LRESULT ret = (LRESULT)TrackPopupMenuEx(hMenu, TPM_RETURNCMD, pt.x, pt.y, hwndDlg, &tpmp);
- switch(ret) {
+ switch (ret) {
case 0: DestroyMenu(hMenu); return 0; // dismis menu
case 1: SendMessage(hwndDlg, WMU_ADDSNOOZER, (WPARAM)5, 0); break;
case 2: SendMessage(hwndDlg, WMU_ADDSNOOZER, (WPARAM)15, 0); break;
@@ -316,7 +320,6 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
POINT newp;
newp.x = (short)LOWORD(lParam);
newp.y = (short)HIWORD(lParam);
-
ClientToScreen(hwndDlg, &newp);
WindowData *window_data = (WindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@@ -325,11 +328,11 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
else {
RECT r;
GetWindowRect(hwndDlg, &r);
-
+
SetWindowPos(hwndDlg, 0, r.left + (newp.x - window_data->p.x), r.top + (newp.y - window_data->p.y), 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
window_data->p.x = newp.x;
- window_data->p.y = newp.y;
+ window_data->p.y = newp.y;
}
else {
ReleaseCapture();
@@ -368,8 +371,8 @@ int AlarmWinModulesLoaded(WPARAM, LPARAM)
mir_tstrcpy(title_font_id.name, LPGENT("Title"));
mir_strcpy(title_font_id.dbSettingsGroup, MODULE);
mir_strcpy(title_font_id.prefix, "FontTitle");
- mir_tstrcpy(title_font_id.backgroundGroup,LPGENT("Alarms"));
- mir_tstrcpy(title_font_id.backgroundName,LPGENT("Background"));
+ mir_tstrcpy(title_font_id.backgroundGroup, LPGENT("Alarms"));
+ mir_tstrcpy(title_font_id.backgroundName, LPGENT("Background"));
title_font_id.flags = 0;
title_font_id.order = 0;
FontRegisterT(&title_font_id);
@@ -379,8 +382,8 @@ int AlarmWinModulesLoaded(WPARAM, LPARAM)
mir_tstrcpy(window_font_id.name, LPGENT("Window"));
mir_strcpy(window_font_id.dbSettingsGroup, MODULE);
mir_strcpy(window_font_id.prefix, "FontWindow");
- mir_tstrcpy(window_font_id.backgroundGroup,LPGENT("Alarms"));
- mir_tstrcpy(window_font_id.backgroundName,LPGENT("Background"));
+ mir_tstrcpy(window_font_id.backgroundGroup, LPGENT("Alarms"));
+ mir_tstrcpy(window_font_id.backgroundName, LPGENT("Background"));
window_font_id.flags = 0;
window_font_id.order = 1;
FontRegisterT(&window_font_id);
@@ -409,7 +412,7 @@ void InitAlarmWin()
}
void DeinitAlarmWin()
-{
+{
WindowList_Broadcast(hAlarmWindowList, WM_COMMAND, IDC_SNOOZE, 0);
WindowList_Destroy(hAlarmWindowList);
@@ -417,4 +420,3 @@ void DeinitAlarmWin()
if (hTitleFont) DeleteObject(hTitleFont);
if (hWindowFont) DeleteObject(hWindowFont);
}
-
diff --git a/plugins/Alarms/src/options.cpp b/plugins/Alarms/src/options.cpp
index af14fdceaa..cf52391945 100644
--- a/plugins/Alarms/src/options.cpp
+++ b/plugins/Alarms/src/options.cpp
@@ -25,11 +25,13 @@ HWND hwndOptionsDialog = 0;
static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
ALARM *add_edit_alarm = (ALARM *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- HWND hw;
+ SYSTEMTIME temp_time;
+ TCHAR buff[MAX_PATH];
+ BOOL bChecked;
- switch ( msg ) {
+ switch (msg) {
case WM_INITDIALOG:
- TranslateDialogDefault( hwndDlg );
+ TranslateDialogDefault(hwndDlg);
SendDlgItemMessage(hwndDlg, IDC_DAY, CB_INSERTSTRING, 0, (LPARAM)TranslateT("Sunday"));
SendDlgItemMessage(hwndDlg, IDC_DAY, CB_INSERTSTRING, 1, (LPARAM)TranslateT("Monday"));
@@ -39,20 +41,17 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP
SendDlgItemMessage(hwndDlg, IDC_DAY, CB_INSERTSTRING, 5, (LPARAM)TranslateT("Friday"));
SendDlgItemMessage(hwndDlg, IDC_DAY, CB_INSERTSTRING, 6, (LPARAM)TranslateT("Saturday"));
SendDlgItemMessage(hwndDlg, IDC_DAY, CB_SETCURSEL, 0, 0);
- {
- TCHAR buff[10];
- for(int i = 1; i <= 31; i++)
- SendDlgItemMessage(hwndDlg, IDC_DAYNUM, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)_itot(i, buff, 10));
-
- SendDlgItemMessage(hwndDlg, IDC_DAYNUM, CB_SETCURSEL, 0, 0);
- {
- HWND hw = GetDlgItem(hwndDlg, IDOK);
- EnableWindow(hw, FALSE);
- }
- if (!ServiceExists("Speak/Say"))
- EnableWindow(GetDlgItem(hwndDlg, IDC_RAD_SPK), FALSE);
+ for (int i = 1; i <= 31; i++)
+ SendDlgItemMessage(hwndDlg, IDC_DAYNUM, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)_itot(i, buff, 10));
+
+ SendDlgItemMessage(hwndDlg, IDC_DAYNUM, CB_SETCURSEL, 0, 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
+
+ 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);
@@ -63,9 +62,9 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP
Utils_RestoreWindowPositionNoSize(hwndDlg, 0, MODULE, "AddEdit");
- if (GetDlgCtrlID((HWND)wParam) != IDC_TITLE) {
- SetFocus(GetDlgItem(hwndDlg, IDC_TITLE));
- return FALSE;
+ if (GetDlgCtrlID((HWND)wParam) != IDC_TITLE) {
+ SetFocus(GetDlgItem(hwndDlg, IDC_TITLE));
+ return FALSE;
}
}
return TRUE;
@@ -79,90 +78,63 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (edit) {
SetDlgItemText(hwndDlg, IDC_TITLE, add_edit_alarm->szTitle);
SetDlgItemText(hwndDlg, IDC_DESC, add_edit_alarm->szDesc);
- switch(add_edit_alarm->occurrence) {
+ switch (add_edit_alarm->occurrence) {
case OC_DAILY:
CheckDlgButton(hwndDlg, IDC_RAD_DAILY, BST_CHECKED);
- 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);
+ 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_CHK_SUSPEND), TRUE);
break;
case OC_WEEKDAYS:
CheckDlgButton(hwndDlg, IDC_RAD_WEEKDAYS, BST_CHECKED);
- 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);
+ 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);
break;
-
+
case OC_ONCE:
CheckDlgButton(hwndDlg, IDC_RAD_ONCE, BST_CHECKED);
- 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);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DAY), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DAYNUM), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), FALSE);
break;
-
+
case OC_WEEKLY:
CheckDlgButton(hwndDlg, IDC_RAD_WEEKLY, BST_CHECKED);
- 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);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CAL), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DATE), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DAYNUM), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RELMIN), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), TRUE);
break;
-
+
case OC_MONTHLY:
CheckDlgButton(hwndDlg, IDC_RAD_MONTHLY, BST_CHECKED);
- 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);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CAL), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DATE), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DAY), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RELMIN), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), TRUE);
break;
-
+
case OC_YEARLY:
CheckDlgButton(hwndDlg, IDC_RAD_YEARLY, BST_CHECKED);
- 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);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DAY), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DAYNUM), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), TRUE);
break;
}
-
+
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);
CheckDlgButton(hwndDlg, IDC_CHK_NOREMINDER, (add_edit_alarm->flags & ALF_NOREMINDER) ? BST_CHECKED : BST_UNCHECKED);
-
+
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_DATE, DTM_SETSYSTEMTIME, (WPARAM)GDT_VALID, (LPARAM)&add_edit_alarm->time);
@@ -171,33 +143,29 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (add_edit_alarm->action & AAF_SOUND) {
CheckDlgButton(hwndDlg, IDC_CHK_ASOUND, BST_CHECKED);
- switch(add_edit_alarm->sound_num) {
- case 1:
+ switch (add_edit_alarm->sound_num) {
+ case 1:
+ CheckDlgButton(hwndDlg, IDC_RAD_SND1, BST_CHECKED);
+ break;
+ case 2:
+ CheckDlgButton(hwndDlg, IDC_RAD_SND2, BST_CHECKED);
+ break;
+ case 3:
+ CheckDlgButton(hwndDlg, IDC_RAD_SND3, BST_CHECKED);
+ break;
+ case 4:
+ if (!ServiceExists("Speak/Say")) {
+ add_edit_alarm->sound_num = 1;
CheckDlgButton(hwndDlg, IDC_RAD_SND1, BST_CHECKED);
- break;
- case 2:
- CheckDlgButton(hwndDlg, IDC_RAD_SND2, BST_CHECKED);
- break;
- case 3:
- CheckDlgButton(hwndDlg, IDC_RAD_SND3, BST_CHECKED);
- break;
- case 4:
- if (!ServiceExists("Speak/Say")) {
- add_edit_alarm->sound_num = 1;
- CheckDlgButton(hwndDlg, IDC_RAD_SND1, BST_CHECKED);
- } else
- CheckDlgButton(hwndDlg, IDC_RAD_SPK, BST_CHECKED);
-
- break;
+ }
+ else CheckDlgButton(hwndDlg, IDC_RAD_SPK, BST_CHECKED);
+ break;
}
- }
+ }
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);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RAD_SND1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RAD_SND2), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RAD_SND3), FALSE);
}
if (add_edit_alarm->action & AAF_POPUP)
CheckDlgButton(hwndDlg, IDC_CHK_APOPUP, BST_CHECKED);
@@ -207,26 +175,21 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP
SetDlgItemText(hwndDlg, IDC_ED_PARAMS, add_edit_alarm->szCommandParams);
}
else {
- HWND hw = GetDlgItem(hwndDlg, IDC_ED_COMMAND);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_ED_PARAMS);
- EnableWindow(hw, FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_COMMAND), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_PARAMS), FALSE);
}
}
else {
SYSTEMTIME now;
GetPluginTime(&now);
-
+
// set time to 10 mins in future to help prevent 'alarm in past' error
TimeForMinutesInFuture(10, &now);
-
+
CheckDlgButton(hwndDlg, IDC_RAD_ONCE, BST_CHECKED);
- 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);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DAY), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DAYNUM), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), FALSE);
SendDlgItemMessage(hwndDlg, IDC_DAY, CB_SETCURSEL, now.wDayOfWeek, 0);
SendDlgItemMessage(hwndDlg, IDC_TIME, DTM_SETSYSTEMTIME, (WPARAM)GDT_VALID, (LPARAM)&now);
SendDlgItemMessage(hwndDlg, IDC_DATE, DTM_SETSYSTEMTIME, (WPARAM)GDT_VALID, (LPARAM)&now);
@@ -237,15 +200,13 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP
CheckDlgButton(hwndDlg, IDC_RAD_SND1, BST_CHECKED);
CheckDlgButton(hwndDlg, IDC_CHK_APOPUP, BST_CHECKED);
- hw = GetDlgItem(hwndDlg, IDC_ED_COMMAND);
- EnableWindow(hw, FALSE);
- hw = GetDlgItem(hwndDlg, IDC_ED_PARAMS);
- EnableWindow(hw, FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_COMMAND), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_PARAMS), FALSE);
}
}
return TRUE;
- case WMU_UPDATETIME:
+ case WMU_UPDATETIME:
if (IsDlgButtonChecked(hwndDlg, IDC_RAD_ONCE))
add_edit_alarm->occurrence = OC_ONCE;
else if (IsDlgButtonChecked(hwndDlg, IDC_RAD_DAILY))
@@ -258,7 +219,7 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP
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]);
@@ -275,7 +236,6 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (add_edit_alarm->occurrence == OC_MONTHLY)
add_edit_alarm->time.wDay = (WORD)SendDlgItemMessage(hwndDlg, IDC_DAYNUM, CB_GETCURSEL, 0, 0) + 1;
- 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;
@@ -285,34 +245,27 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP
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)
- 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);
- }
+ SendDlgItemMessage(hwndDlg, IDC_DATE, MCM_GETCURSEL, 0, (LPARAM)&temp_time);
+ 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:
- if ( ((LPNMHDR)lParam)->code == DTN_DATETIMECHANGE) {
- switch( ((LPNMHDR)lParam)->idFrom ) {
- case IDC_TIME:
- hw = GetDlgItem(hwndDlg, IDOK);
- EnableWindow(hw, TRUE);
-
+ if (((LPNMHDR)lParam)->code == DTN_DATETIMECHANGE) {
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case IDC_TIME:
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE);
SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
break;
- case IDC_DATE:
- hw = GetDlgItem(hwndDlg, IDOK);
- EnableWindow(hw, TRUE);
-
+ case IDC_DATE:
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE);
SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
break;
@@ -322,26 +275,24 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP
break;
case WM_COMMAND:
- if ( HIWORD(wParam) == CBN_SELCHANGE ) {
- switch( LOWORD(wParam)) {
- case IDC_DAY:
+ if (HIWORD(wParam) == CBN_SELCHANGE) {
+ switch (LOWORD(wParam)) {
+ case IDC_DAY:
case IDC_DAYNUM:
- hw = GetDlgItem(hwndDlg, IDOK);
- EnableWindow(hw, TRUE);
-
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE);
SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
break;
}
return TRUE;
}
- if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus()) {
- switch( LOWORD( wParam )) {
- case IDC_RELMIN:
+
+ 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);
+ int mins = GetDlgItemInt(hwndDlg, IDC_RELMIN, &translated, FALSE);
SYSTEMTIME newtime;
TimeForMinutesInFuture(mins, &newtime);
@@ -351,172 +302,107 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP
SendDlgItemMessage(hwndDlg, IDC_DAYNUM, CB_SETCURSEL, newtime.wDay - 1, 0);
add_edit_alarm->time = newtime;
-
+
SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
}
- // drop through
+ // drop through
case IDC_TITLE:
case IDC_DESC:
case IDC_ED_COMMAND:
case IDC_ED_PARAMS:
- HWND hw = GetDlgItem(hwndDlg, IDOK);
- EnableWindow(hw, TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE);
}
return TRUE;
}
- if ( HIWORD( wParam ) == BN_CLICKED ) {
- switch( LOWORD( wParam )) {
+
+ 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);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DAY), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CAL), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DATE), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DAYNUM), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RELMIN), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), FALSE);
SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
break;
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);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CAL), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DAY), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DATE), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DAYNUM), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RELMIN), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), TRUE);
SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
break;
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);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CAL), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DATE), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DAY), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DAYNUM), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RELMIN), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), TRUE);
SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
break;
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);
+ 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);
SendMessage(hwndDlg, WMU_UPDATETIME, 0, 0);
SendMessage(hwndDlg, WMU_SETTIME, 0, 0);
break;
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);
+ 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), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RELMIN), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), 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);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DAY), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CAL), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DATE), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DAYNUM), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RELMIN), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_SUSPEND), 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);
- }
+ bChecked = IsDlgButtonChecked(hwndDlg, IDC_CHK_ACOMMAND) != 0;
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_COMMAND), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_PARAMS), bChecked);
+ // drop through
- // 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);
- }
-
- // drop though
+ bChecked = IsDlgButtonChecked(hwndDlg, IDC_CHK_ASOUND) != 0;
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RAD_SND1), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RAD_SND2), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RAD_SND3), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RAD_SPK), bChecked);
+ // drop though
+
case IDC_RAD_SND1:
case IDC_RAD_SND2:
case IDC_RAD_SND3:
@@ -525,13 +411,11 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case IDC_CHK_NOSTARTUP:
case IDC_CHK_NOREMINDER:
case IDC_CHK_APOPUP:
- hw = GetDlgItem(hwndDlg, IDOK);
- EnableWindow(hw, TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE);
break;
-
- case IDOK:
+
+ case IDOK:
{
- TCHAR buff[MAX_PATH];
GetDlgItemText(hwndDlg, IDC_TITLE, buff, _countof(buff));
replaceStrT(add_edit_alarm->szTitle, buff);
@@ -555,11 +439,11 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP
add_edit_alarm->action |= (IsDlgButtonChecked(hwndDlg, IDC_CHK_ACOMMAND) ? AAF_COMMAND : 0);
add_edit_alarm->flags = add_edit_alarm->flags & ~(ALF_SUSPENDED | ALF_NOSTARTUP | ALF_NOREMINDER);
- if (add_edit_alarm->occurrence != OC_ONCE) {
+ 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;
+ 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));
@@ -577,9 +461,8 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP
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;
-
+ }
+ else add_edit_alarm->sound_num = 0;
Utils_SaveWindowPosition(hwndDlg, 0, MODULE, "AddEdit");
@@ -606,22 +489,21 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP
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 *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
free_alarm_data(add_edit_alarm);
delete add_edit_alarm;
}
-
+
Utils_SaveWindowPosition(hwndDlg, 0, MODULE, "AddEdit");
-
+
// deal with modal and non-modal modes
PostMessage(hwndDlg, WMU_MYDESTROY, 0, 0);
EndDialog(hwndDlg, IDCANCEL);
break;
-
+
default:
return TRUE;
}
@@ -717,31 +599,34 @@ int OptionsModulesLoaded(WPARAM, LPARAM)
AlarmList temp_list, added_list, modified_list; // we need to keep track of added and modified alarms, since if the non-modal dialog
// refreshes the list before changes are applied, we loose them
-class ShortList {
+class ShortList
+{
public:
- class Node {
+ class Node
+ {
public:
- Node(): next(0) {}
+ Node() : next(0) {}
unsigned short value;
Node *next;
};
- ShortList(): head(0) {}
- virtual ~ShortList() {clear();}
+ ShortList() : head(0) {}
+ virtual ~ShortList() { clear(); }
- void clear() {
+ void clear()
+ {
Node *current;
- while(head) {
+ while (head) {
current = head;
head = head->next;
delete current;
}
}
- void push_back(unsigned short s) {Node *n = new Node; n->value = s; n->next = head; head = n;}
+ void push_back(unsigned short s) { Node *n = new Node; n->value = s; n->next = head; head = n; }
- Node *get_head() {return head;}
+ Node *get_head() { return head; }
protected:
@@ -754,15 +639,16 @@ Options temp_options;
static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
int sel;
+ BOOL bChecked;
- switch ( msg ) {
+ switch (msg) {
case WM_INITDIALOG:
hwndOptionsDialog = hwndDlg;
added_list.clear();
modified_list.clear();
deleted_list.clear();
- TranslateDialogDefault( hwndDlg );
+ TranslateDialogDefault(hwndDlg);
temp_options = options;
@@ -774,22 +660,19 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
{
// 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()) {
+ 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) {
+ 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);
- }
- }
- }
- // remove deleted alarms, in case this is a list refresh from non-modal add alarm dialog
+ // 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) {
- for(temp_list.reset(); i = temp_list.current(); temp_list.next()) {
+ while (k) {
+ for (temp_list.reset(); i = temp_list.current(); temp_list.next()) {
if (i->id == k->value) {
temp_list.erase();
break;
@@ -802,76 +685,43 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
if (temp_list.size() > 0) {
int pos = -1;
- ALARM *i;
- for(temp_list.reset(); i = temp_list.current(); temp_list.next()) {
+ 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_DEL);
- EnableWindow(hw, FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DEL), TRUE);
+ }
+ else {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DEL), FALSE);
}
- if ( ServiceExists(MS_POPUP_ADDPOPUPT)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
CheckDlgButton(hwndDlg, IDC_CHK_POPUPS, temp_options.use_popup_module ? BST_CHECKED : BST_UNCHECKED);
- 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 {
+ if (options.use_popup_module)
+ bChecked = FALSE;
+ else {
CheckDlgButton(hwndDlg, IDC_CHK_LOOPSOUND, temp_options.loop_sound ? BST_CHECKED : BST_UNCHECKED);
- 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);
+ bChecked = TRUE;
}
- } else {
- HWND hw = GetDlgItem(hwndDlg, IDC_CHK_POPUPS);
- EnableWindow(hw, FALSE);
+ }
+ else {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_POPUPS), FALSE);
CheckDlgButton(hwndDlg, IDC_CHK_LOOPSOUND, temp_options.loop_sound ? BST_CHECKED : BST_UNCHECKED);
-
- 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);
+ bChecked = TRUE;
}
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TRANS), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SPIN_TRANS), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_AWROUND), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_PREVIEW), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_LOOPSOUND), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_AWNOACTIVATE), bChecked);
+
SendDlgItemMessage(hwndDlg, IDC_SPIN_SNOOZE, UDM_SETRANGE, 0, (LPARAM)MAKELONG(360, 0));
SendDlgItemMessage(hwndDlg, IDC_SPIN_SNOOZE, UDM_SETPOS, 0, temp_options.snooze_minutes);
@@ -895,15 +745,15 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
SendDlgItemMessage(hwndDlg, IDC_SPIN_PERIOD, UDM_SETRANGE, 0, (LPARAM)MAKELONG(72, 1));
SendDlgItemMessage(hwndDlg, IDC_SPIN_PERIOD, UDM_SETPOS, 0, temp_options.reminder_period);
- SendMessage( GetParent( hwndDlg ), PSM_UNCHANGED, 0, 0 );
+ SendMessage(GetParent(hwndDlg), PSM_UNCHANGED, 0, 0);
return TRUE;
case WM_COMMAND:
- if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus())
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- if ( HIWORD( wParam ) == BN_CLICKED ) {
- switch( LOWORD( wParam )) {
+ if (HIWORD(wParam) == BN_CLICKED) {
+ switch (LOWORD(wParam)) {
case IDC_BTN_PREVIEW:
{
HWND hwndDlgPrev = CreateDialog(hInst, MAKEINTRESOURCE(IDD_ALARM), GetDesktopWindow(), DlgProcAlarm);
@@ -916,19 +766,19 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
break;
case IDC_SHOWHIDE:
temp_options.auto_showhide = IsDlgButtonChecked(hwndDlg, IDC_SHOWHIDE) ? true : false;
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ 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 );
+ 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 );
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
- case IDC_NEW:
+ case IDC_NEW:
{
- ALARM new_alarm = {0};
+ ALARM new_alarm = { 0 };
GetPluginTime(&new_alarm.time);
new_alarm.id = next_alarm_id++;
if (New(hwndDlg, new_alarm, true)) {
@@ -943,27 +793,27 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
EnableWindow(hw, TRUE);
hw = GetDlgItem(hwndDlg, IDC_DEL);
EnableWindow(hw, TRUE);
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
free_alarm_data(&new_alarm);
}
}
break;
- case IDC_EDIT:
+ 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()) {
+ for (temp_list.reset(); i = temp_list.current(); temp_list.next()) {
if (i->id == id) {
- ALARM a = {0};
+ 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 );
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
free_alarm_data(&a);
break;
@@ -978,86 +828,75 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
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()) {
+ 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 );
+
+ 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, BST_UNCHECKED);
else CheckDlgButton(hwndDlg, IDC_CHK_LOOPSOUND, temp_options.loop_sound ? BST_CHECKED : BST_UNCHECKED);
- HWND hw = GetDlgItem(hwndDlg, IDC_CHK_LOOPSOUND);
- EnableWindow(hw, !chk);
- hw = GetDlgItem(hwndDlg, IDC_CHK_AWROUND);
- EnableWindow(hw, !chk);
- hw = GetDlgItem(hwndDlg, IDC_CHK_AWNOACTIVATE);
- EnableWindow(hw, !chk);
- hw = GetDlgItem(hwndDlg, IDC_SPIN_TRANS);
- EnableWindow(hw, !chk);
- hw = GetDlgItem(hwndDlg, IDC_ED_TRANS);
- EnableWindow(hw, !chk);
- hw = GetDlgItem(hwndDlg, IDC_BTN_PREVIEW);
- EnableWindow(hw, !chk);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TRANS), !chk);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SPIN_TRANS), !chk);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_PREVIEW), !chk);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_AWROUND), !chk);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_LOOPSOUND), !chk);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_AWNOACTIVATE), !chk);
temp_options.use_popup_module = IsDlgButtonChecked(hwndDlg, IDC_CHK_POPUPS) ? true : false;
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ 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 );
+ 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 );
+ 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 );
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}
return TRUE;
}
- if (HIWORD( wParam ) == LBN_SELCHANGE) {
- HWND hw;
- hw = GetDlgItem(hwndDlg, IDC_EDIT);
- EnableWindow(hw, TRUE);
- hw = GetDlgItem(hwndDlg, IDC_DEL);
- EnableWindow(hw, TRUE);
-
- //SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ if (HIWORD(wParam) == LBN_SELCHANGE) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DEL), TRUE);
return TRUE;
}
- if (HIWORD( wParam ) == LBN_DBLCLK) {
- int sel = SendDlgItemMessage(hwndDlg, IDC_ALIST, LB_GETCURSEL, 0, 0);
+ if (HIWORD(wParam) == LBN_DBLCLK) {
+ 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()) {
+ for (temp_list.reset(); i = temp_list.current(); temp_list.next()) {
if (i->id == id) {
- ALARM a = {0};
+ 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 );
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
free_alarm_data(&a);
break;
@@ -1068,14 +907,14 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
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;
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
return TRUE;
}
- if ((int)((LPNMHDR)lParam)->code == PSN_APPLY ) {
+ if ((int)((LPNMHDR)lParam)->code == PSN_APPLY) {
set_list(temp_list);
SaveAlarms();
@@ -1099,7 +938,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
int reminder_period = GetDlgItemInt(hwndDlg, IDC_ED_PERIOD, &translated, FALSE);
if (translated) temp_options.reminder_period = reminder_period;
- if ( !ServiceExists(MS_POPUP_ADDPOPUPT) || !options.use_popup_module)
+ if (!ServiceExists(MS_POPUP_ADDPOPUPT) || !options.use_popup_module)
temp_options.loop_sound = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOOPSOUND) ? true : false;
options = temp_options;