diff options
author | George Hazan <ghazan@miranda.im> | 2016-12-27 19:06:23 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2016-12-27 19:06:23 +0300 |
commit | ec2b6465c9b6475b73f4a28cc658af3507765e80 (patch) | |
tree | 0a8ea58bef971ccedb66dbb1af067c8e20a44857 | |
parent | 955c6cd5ad96179f8fab08006027a2e0c0afb3b0 (diff) |
Alarms:
- warning fixes;
- code cleaning
-rw-r--r-- | plugins/Alarms/src/alarm_win.cpp | 59 | ||||
-rwxr-xr-x | plugins/Alarms/src/alarmlist.cpp | 247 | ||||
-rw-r--r-- | plugins/Alarms/src/alarms.cpp | 27 | ||||
-rwxr-xr-x | plugins/Alarms/src/frame.cpp | 83 | ||||
-rw-r--r-- | plugins/Alarms/src/icons.cpp | 12 | ||||
-rwxr-xr-x | plugins/Alarms/src/options.cpp | 9 | ||||
-rw-r--r-- | plugins/Alarms/src/time_utils.cpp | 14 |
7 files changed, 229 insertions, 222 deletions
diff --git a/plugins/Alarms/src/alarm_win.cpp b/plugins/Alarms/src/alarm_win.cpp index 451075796e..d419884193 100644 --- a/plugins/Alarms/src/alarm_win.cpp +++ b/plugins/Alarms/src/alarm_win.cpp @@ -17,12 +17,13 @@ HBRUSH hBackgroundBrush = 0; #define WMU_ADDSNOOZER (WM_USER + 63)
int win_num = 0;
-typedef struct WindowData_tag {
+struct WindowData
+{
ALARM *alarm;
POINT p;
bool moving;
int win_num;
-} WindowData;
+};
void SetAlarmWinOptions()
{
@@ -33,36 +34,34 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar {
WindowData *wd = (WindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch ( msg ) {
- case WM_INITDIALOG:
- TranslateDialogDefault( hwndDlg );
- {
- Utils_RestoreWindowPositionNoSize(hwndDlg, 0, MODULE, "Notify");
- SetFocus(GetDlgItem(hwndDlg, IDC_SNOOZE));
-
- wd = new WindowData;
- wd->moving = false;
- wd->alarm = 0;
- wd->win_num = win_num++;
+ switch (msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
- if (wd->win_num > 0) {
- RECT r;
- GetWindowRect(hwndDlg, &r);
- r.top += 20;
- r.left += 20;
+ Utils_RestoreWindowPositionNoSize(hwndDlg, 0, MODULE, "Notify");
+ SetFocus(GetDlgItem(hwndDlg, IDC_SNOOZE));
- SetWindowPos(hwndDlg, 0, r.left, r.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
- Utils_SaveWindowPosition(hwndDlg, 0, MODULE, "Notify");
- }
+ wd = new WindowData;
+ wd->moving = false;
+ wd->alarm = 0;
+ wd->win_num = win_num++;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)wd);
+ if (wd->win_num > 0) {
+ RECT r;
+ GetWindowRect(hwndDlg, &r);
+ r.top += 20;
+ r.left += 20;
- // options
- SendMessage(hwndDlg, WMU_SETOPT, 0, 0);
-
- // fonts
- SendMessage(hwndDlg, WMU_SETFONTS, 0, 0);
+ SetWindowPos(hwndDlg, 0, r.left, r.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
+ Utils_SaveWindowPosition(hwndDlg, 0, MODULE, "Notify");
}
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)wd);
+
+ // options
+ SendMessage(hwndDlg, WMU_SETOPT, 0, 0);
+
+ // fonts
+ SendMessage(hwndDlg, WMU_SETFONTS, 0, 0);
return FALSE;
case WMU_REFRESH:
@@ -119,7 +118,7 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar 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;
+ 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);
}
@@ -128,7 +127,7 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar RECT r;
int w = 10;
GetWindowRect(hwndDlg, &r);
- int h = (r.right - r.left)>(w * 2) ? w : (r.right - r.left);
+ 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));
@@ -204,7 +203,7 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar FILETIME ft;
GetLocalTime(&data->time);
SystemTimeToFileTime(&data->time, &ft);
-
+
ULARGE_INTEGER uli;
uli.LowPart = ft.dwLowDateTime;
uli.HighPart = ft.dwHighDateTime;
diff --git a/plugins/Alarms/src/alarmlist.cpp b/plugins/Alarms/src/alarmlist.cpp index 05154d5d46..6988f436f6 100755 --- a/plugins/Alarms/src/alarmlist.cpp +++ b/plugins/Alarms/src/alarmlist.cpp @@ -17,14 +17,16 @@ bool startup = true; bool is_idle = false;
-void free_alarm_data(ALARM *alarm) {
+void free_alarm_data(ALARM *alarm)
+{
mir_free(alarm->szTitle); alarm->szTitle = 0;
mir_free(alarm->szDesc); alarm->szDesc = 0;
mir_free(alarm->szCommand); alarm->szCommand = 0;
mir_free(alarm->szCommandParams); alarm->szCommandParams = 0;
}
-void copy_alarm_data(ALARM *dest, ALARM *src) {
+void copy_alarm_data(ALARM *dest, ALARM *src)
+{
dest->action = src->action;
dest->flags = src->flags;
dest->day_mask = src->day_mask;
@@ -41,13 +43,16 @@ void copy_alarm_data(ALARM *dest, ALARM *src) { dest->szCommandParams = mir_wstrdup(src->szCommandParams);
}
-void GetPluginTime(SYSTEMTIME *t) {
+void GetPluginTime(SYSTEMTIME *t)
+{
mir_cslock lck(alarm_cs);
*t = last_check;
}
-int MinutesInFuture(SYSTEMTIME time, Occurrence occ, int selected_days) {
- if (!UpdateAlarm(time, occ, selected_days)) return 0;
+int MinutesInFuture(SYSTEMTIME time, Occurrence occ, int selected_days)
+{
+ if (!UpdateAlarm(time, occ, selected_days))
+ return 0;
SYSTEMTIME now;
GetPluginTime(&now);
@@ -55,7 +60,7 @@ int MinutesInFuture(SYSTEMTIME time, Occurrence occ, int selected_days) { FILETIME ft_now, ft_then;
SystemTimeToFileTime(&now, &ft_now);
SystemTimeToFileTime(&time, &ft_then);
-
+
ULARGE_INTEGER uli_now, uli_then, diff;
uli_now.HighPart = ft_now.dwHighDateTime;
uli_now.LowPart = ft_now.dwLowDateTime;
@@ -69,10 +74,12 @@ int MinutesInFuture(SYSTEMTIME time, Occurrence occ, int selected_days) { return (int)(diff.QuadPart / mult.QuadPart + (inc ? 1 : 0));
}
-void TimeForMinutesInFuture(int mins, SYSTEMTIME *time) {
+void TimeForMinutesInFuture(int mins, SYSTEMTIME *time)
+{
SYSTEMTIME now;
- FILETIME ft_now;
GetPluginTime(&now);
+
+ FILETIME ft_now;
SystemTimeToFileTime(&now, &ft_now);
ULARGE_INTEGER uli_now;
@@ -91,42 +98,32 @@ void TimeForMinutesInFuture(int mins, SYSTEMTIME *time) { bool is_day_selected(int day, int selected_days)
{
- switch (day)
- {
+ switch (day) {
case 0:
- return selected_days & ALDF_7;
- break;
+ return (selected_days & ALDF_7) != 0;
case 1:
- return selected_days & ALDF_1;
- break;
+ return (selected_days & ALDF_1) != 0;
case 2:
- return selected_days & ALDF_2;
- break;
+ return (selected_days & ALDF_2) != 0;
case 3:
- return selected_days & ALDF_3;
- break;
+ return (selected_days & ALDF_3) != 0;
case 4:
- return selected_days & ALDF_4;
- break;
+ return (selected_days & ALDF_4) != 0;
case 5:
- return selected_days & ALDF_5;
- break;
+ return (selected_days & ALDF_5) != 0;
case 6:
- return selected_days & ALDF_6;
- break;
- default:
- return false;
+ return (selected_days & ALDF_6) != 0;
}
-// return false;
+ return false;
}
-bool UpdateAlarm(SYSTEMTIME &time, Occurrence occ, int selected_days) {
-
+bool UpdateAlarm(SYSTEMTIME &time, Occurrence occ, int selected_days)
+{
FILETIME ft_now, ft_then;
ULARGE_INTEGER uli_then;
- switch(occ) {
+ switch (occ) {
case OC_DAILY:
case OC_WEEKDAYS:
case OC_WEEKLY:
@@ -138,85 +135,88 @@ bool UpdateAlarm(SYSTEMTIME &time, Occurrence occ, int selected_days) { time.wYear = last_check.wYear;
case OC_ONCE:
break; // all fields valid
- };
+ }
SystemTimeToFileTime(&last_check, &ft_now); // consider 'now' to be last check time
SystemTimeToFileTime(&time, &ft_then);
-
- switch(occ) {
+
+ switch (occ) {
case OC_ONCE:
if (CompareFileTime(&ft_then, &ft_now) < 0)
return false;
break;
+
case OC_YEARLY:
- while(CompareFileTime(&ft_then, &ft_now) < 0) {
+ while (CompareFileTime(&ft_then, &ft_now) < 0) {
time.wYear++;
SystemTimeToFileTime(&time, &ft_then);
}
break;
+
case OC_MONTHLY:
- while(CompareFileTime(&ft_then, &ft_now) < 0) {
+ while (CompareFileTime(&ft_then, &ft_now) < 0) {
if (time.wMonth == 12) {
time.wMonth = 1;
time.wYear++;
- } else
+ }
+ else
time.wMonth++;
SystemTimeToFileTime(&time, &ft_then);
}
break;
+
case OC_WEEKLY:
- {
- SYSTEMTIME temp;
- uli_then.HighPart = ft_then.dwHighDateTime;
- uli_then.LowPart = ft_then.dwLowDateTime;
- FileTimeToSystemTime(&ft_then, &temp);
- do {
- if (temp.wDayOfWeek != time.wDayOfWeek || CompareFileTime(&ft_then, &ft_now) < 0) {
- uli_then.QuadPart += mult.QuadPart * (ULONGLONG)24 * (ULONGLONG)60;
- ft_then.dwHighDateTime = uli_then.HighPart;
- ft_then.dwLowDateTime = uli_then.LowPart;
- FileTimeToSystemTime(&ft_then, &temp);
- }
- } while(temp.wDayOfWeek != time.wDayOfWeek || CompareFileTime(&ft_then, &ft_now) < 0);
+ SYSTEMTIME temp;
+ uli_then.HighPart = ft_then.dwHighDateTime;
+ uli_then.LowPart = ft_then.dwLowDateTime;
+ FileTimeToSystemTime(&ft_then, &temp);
+ do {
+ if (temp.wDayOfWeek != time.wDayOfWeek || CompareFileTime(&ft_then, &ft_now) < 0) {
+ uli_then.QuadPart += mult.QuadPart * (ULONGLONG)24 * (ULONGLONG)60;
+ ft_then.dwHighDateTime = uli_then.HighPart;
+ ft_then.dwLowDateTime = uli_then.LowPart;
+ FileTimeToSystemTime(&ft_then, &temp);
+ }
}
+ while (temp.wDayOfWeek != time.wDayOfWeek || CompareFileTime(&ft_then, &ft_now) < 0);
break;
+
case OC_WEEKDAYS:
- {
- SYSTEMTIME temp;
- uli_then.HighPart = ft_then.dwHighDateTime;
- uli_then.LowPart = ft_then.dwLowDateTime;
- do {
- FileTimeToSystemTime(&ft_then, &temp);
- if (temp.wDayOfWeek == 0 || temp.wDayOfWeek == 6 || CompareFileTime(&ft_then, &ft_now) < 0) {
- uli_then.QuadPart += mult.QuadPart * (ULONGLONG)24 * (ULONGLONG)60;
- ft_then.dwHighDateTime = uli_then.HighPart;
- ft_then.dwLowDateTime = uli_then.LowPart;
- }
- } while(temp.wDayOfWeek == 0 || temp.wDayOfWeek == 6 || CompareFileTime(&ft_then, &ft_now) < 0);
+ uli_then.HighPart = ft_then.dwHighDateTime;
+ uli_then.LowPart = ft_then.dwLowDateTime;
+ do {
+ FileTimeToSystemTime(&ft_then, &temp);
+ if (temp.wDayOfWeek == 0 || temp.wDayOfWeek == 6 || CompareFileTime(&ft_then, &ft_now) < 0) {
+ uli_then.QuadPart += mult.QuadPart * (ULONGLONG)24 * (ULONGLONG)60;
+ ft_then.dwHighDateTime = uli_then.HighPart;
+ ft_then.dwLowDateTime = uli_then.LowPart;
+ }
}
+ while (temp.wDayOfWeek == 0 || temp.wDayOfWeek == 6 || CompareFileTime(&ft_then, &ft_now) < 0);
break;
+
case OC_SELECTED_DAYS: //////TODO:::::
- {
- SYSTEMTIME temp;
uli_then.HighPart = ft_then.dwHighDateTime;
uli_then.LowPart = ft_then.dwLowDateTime;
FileTimeToSystemTime(&ft_now, &temp);
- int day = temp.wDayOfWeek;
- while (CompareFileTime(&ft_then, &ft_now) < 0 || (selected_days && !is_day_selected(day, selected_days))) {
- uli_then.QuadPart += mult.QuadPart * (ULONGLONG)24 * (ULONGLONG)60;
- ft_then.dwHighDateTime = uli_then.HighPart;
- ft_then.dwLowDateTime = uli_then.LowPart;
- if (day < 7)
- day++;
- else
- day = 0;
+ {
+ int day = temp.wDayOfWeek;
+ while (CompareFileTime(&ft_then, &ft_now) < 0 || (selected_days && !is_day_selected(day, selected_days))) {
+ uli_then.QuadPart += mult.QuadPart * (ULONGLONG)24 * (ULONGLONG)60;
+ ft_then.dwHighDateTime = uli_then.HighPart;
+ ft_then.dwLowDateTime = uli_then.LowPart;
+ if (day < 7)
+ day++;
+ else
+ day = 0;
+ }
}
- }
break;
+
case OC_DAILY:
uli_then.HighPart = ft_then.dwHighDateTime;
uli_then.LowPart = ft_then.dwLowDateTime;
- while(CompareFileTime(&ft_then, &ft_now) < 0) {
+ while (CompareFileTime(&ft_then, &ft_now) < 0) {
uli_then.QuadPart += mult.QuadPart * (ULONGLONG)24 * (ULONGLONG)60;
ft_then.dwHighDateTime = uli_then.HighPart;
ft_then.dwLowDateTime = uli_then.LowPart;
@@ -228,7 +228,8 @@ bool UpdateAlarm(SYSTEMTIME &time, Occurrence occ, int selected_days) { return true;
}
-void LoadAlarms() {
+void LoadAlarms()
+{
int num_alarms = db_get_w(0, MODULE, "Count", 0);
char buff[256];
DBVARIANT dbv;
@@ -239,7 +240,7 @@ void LoadAlarms() { mir_cslock lck(alarm_cs);
alarms.clear();
- for(int i = 0; i < num_alarms; i++) {
+ for (int i = 0; i < num_alarms; i++) {
memset(&alarm, 0, sizeof(ALARM));
mir_snprintf(buff, "Title%d", i);
@@ -262,7 +263,7 @@ void LoadAlarms() { mir_snprintf(buff, "STSecond%d", i);
alarm.time.wSecond = db_get_w(0, MODULE, buff, 0);
- switch(alarm.occurrence) {
+ switch (alarm.occurrence) {
case OC_ONCE:
mir_snprintf(buff, "STYear%d", i);
@@ -336,14 +337,15 @@ void LoadAlarms() { }
}
-void SaveAlarms() {
+void SaveAlarms()
+{
int index = 0;
char buff[256];
mir_cslock lck(alarm_cs);
ALARM *i;
- for(alarms.reset(); i = alarms.current(); alarms.next(), index++) {
+ for (alarms.reset(); i = alarms.current(); alarms.next(), index++) {
mir_snprintf(buff, "Title%d", index);
db_set_ws(0, MODULE, buff, i->szTitle);
mir_snprintf(buff, "Desc%d", index);
@@ -358,7 +360,7 @@ void SaveAlarms() { mir_snprintf(buff, "STSecond%d", index);
db_set_w(0, MODULE, buff, i->time.wSecond);
- switch(i->occurrence) {
+ switch (i->occurrence) {
case OC_DAILY:
break;
case OC_WEEKDAYS:
@@ -391,7 +393,7 @@ void SaveAlarms() { }
}
}
-
+
mir_snprintf(buff, "SoundNum%d", index);
db_set_b(0, MODULE, buff, i->sound_num);
@@ -406,34 +408,38 @@ void SaveAlarms() { db_set_w(0, MODULE, "Count", index);
}
-void copy_list(AlarmList ©) {
+void copy_list(AlarmList ©)
+{
copy.clear();
ALARM *i;
mir_cslock lck(alarm_cs);
- for(alarms.reset(); i = alarms.current(); alarms.next())
+ for (alarms.reset(); i = alarms.current(); alarms.next())
copy.push_back(i);
}
-void copy_list(AlarmList ©, SYSTEMTIME &start, SYSTEMTIME &end) {
+void copy_list(AlarmList ©, SYSTEMTIME &start, SYSTEMTIME &end)
+{
copy.clear();
ALARM *i;
mir_cslock lck(alarm_cs);
- for(alarms.reset(); i = alarms.current(); alarms.next())
+ for (alarms.reset(); i = alarms.current(); alarms.next())
if (IsBetween(i->time, start, end))
copy.push_back(i);
}
-void set_list(AlarmList ©) {
+void set_list(AlarmList ©)
+{
mir_cslock lck(alarm_cs);
alarms.clear();
ALARM *i;
- for(copy.reset(); i = copy.current(); copy.next())
+ for (copy.reset(); i = copy.current(); copy.next())
alarms.push_back(i);
SaveAlarms();
}
-void append_to_list(ALARM *alarm) {
+void append_to_list(ALARM *alarm)
+{
mir_cslock lck(alarm_cs);
if (!alarm->id)
alarm->id = next_alarm_id++;
@@ -442,12 +448,13 @@ void append_to_list(ALARM *alarm) { SaveAlarms();
}
-void alter_alarm_list(ALARM *alarm) {
+void alter_alarm_list(ALARM *alarm)
+{
bool found = false;
mir_cslock lck(alarm_cs);
if (alarm->id != 0) {
ALARM *i;
- for(alarms.reset(); i = alarms.current(); alarms.next()) {
+ for (alarms.reset(); i = alarms.current(); alarms.next()) {
if (i->id == alarm->id) {
copy_alarm_data(i, alarm);
found = true;
@@ -464,10 +471,11 @@ void alter_alarm_list(ALARM *alarm) { SaveAlarms();
}
-void remove(unsigned short alarm_id) {
+void remove(unsigned short alarm_id)
+{
mir_cslock lck(alarm_cs);
ALARM *i;
- for(alarms.reset(); i = alarms.current(); alarms.next()) {
+ for (alarms.reset(); i = alarms.current(); alarms.next()) {
if (i->id == alarm_id) {
alarms.erase();
break;
@@ -477,10 +485,11 @@ void remove(unsigned short alarm_id) { SaveAlarms();
}
-void suspend(unsigned short alarm_id) {
+void suspend(unsigned short alarm_id)
+{
mir_cslock lck(alarm_cs);
ALARM *i;
- for(alarms.reset(); i = alarms.current(); alarms.next()) {
+ for (alarms.reset(); i = alarms.current(); alarms.next()) {
if (i->id == alarm_id && i->occurrence != OC_ONCE) {
i->flags |= ALF_SUSPENDED;
break;
@@ -492,7 +501,7 @@ void suspend(unsigned short alarm_id) { static LRESULT CALLBACK PopupAlarmDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- switch(message) {
+ switch (message) {
case WM_COMMAND: // snooze
if (HIWORD(wParam) == STN_CLICKED) { //It was a click on the Popup.
ALARM *mpd = (ALARM *)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, 0);
@@ -527,11 +536,11 @@ static LRESULT CALLBACK PopupAlarmDlgProc(HWND hWnd, UINT message, WPARAM wParam PUDeletePopup(hWnd);
return TRUE;
- case WM_CONTEXTMENU:
+ case WM_CONTEXTMENU:
PUDeletePopup(hWnd);
return TRUE;
- case UM_FREEPLUGINDATA:
+ case UM_FREEPLUGINDATA:
ALARM *mpd = (ALARM *)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, 0);
if (mpd > 0) {
free_alarm_data(mpd);
@@ -544,7 +553,7 @@ static LRESULT CALLBACK PopupAlarmDlgProc(HWND hWnd, UINT message, WPARAM wParam void ShowPopup(ALARM *alarm)
{
- if ( ServiceExists(MS_POPUP_ADDPOPUPT)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
ALARM *data = new ALARM;
memset(data, 0, sizeof(ALARM));
copy_alarm_data(data, alarm);
@@ -575,13 +584,13 @@ void DoAlarm(ALARM *alarm) alarminfo.sound_num = alarm->sound_num;
if (!NotifyEventHooks(hAlarmTriggeredEvent, 0, (LPARAM)&alarminfo)) {
-
if (alarm->action & AAF_SOUND) {
if (alarm->sound_num > 0 && alarm->sound_num <= 3) {
char buff[128];
mir_snprintf(buff, "Triggered%d", alarm->sound_num);
SkinPlaySound(buff);
- } else if (alarm->sound_num == 4) {
+ }
+ else if (alarm->sound_num == 4) {
if (alarm->szTitle != NULL && alarm->szTitle[0] != '\0') {
if (ServiceExists("Speak/Say")) {
CallService("Speak/Say", 0, (LPARAM)alarm->szTitle);
@@ -589,8 +598,9 @@ void DoAlarm(ALARM *alarm) }
}
}
+
if (alarm->action & AAF_POPUP) {
- if (options.use_popup_module && ServiceExists(MS_POPUP_ADDPOPUPT))
+ if (options.use_popup_module && ServiceExists(MS_POPUP_ADDPOPUPT))
ShowPopup(alarm);
else {
HWND hwndDlg = CreateDialog(hInst, MAKEINTRESOURCE(IDD_ALARM), GetDesktopWindow(), DlgProcAlarm);
@@ -611,8 +621,7 @@ void DoAlarm(ALARM *alarm) if (alarm->action & AAF_COMMAND)
ShellExecute(0, 0, alarm->szCommand, alarm->szCommandParams, 0, SW_NORMAL);
- if (alarm->action & AAF_SYSTRAY)
- {
+ if (alarm->action & AAF_SYSTRAY) {
CLISTEVENT cle = {};
cle.hIcon = hIconSystray;
cle.ptszTooltip = alarm->szTitle;
@@ -622,13 +631,15 @@ void DoAlarm(ALARM *alarm) }
}
-void WriteLastCheckTime() {
+void WriteLastCheckTime()
+{
// save last-check time
db_set_blob(NULL, MODULE, "LastCheck", &last_check, sizeof(SYSTEMTIME));
last_saved_check = last_check;
}
-void CheckAlarms() {
+void CheckAlarms()
+{
SYSTEMTIME time;
GetLocalTime(&time);
@@ -637,14 +648,14 @@ void CheckAlarms() { mir_cslock lck(alarm_cs);
ALARM *i;
- for(alarms.reset(); i = alarms.current(); alarms.next()) {
- if (!UpdateAlarm(i->time, i->occurrence, i->day_mask)) {
+ for (alarms.reset(); i = alarms.current(); alarms.next()) {
+ if (!UpdateAlarm(i->time, i->occurrence, i->day_mask)) {
// somehow an expired one-off alarm is in our list
remove_list.push_back(i);
continue;
}
- switch(i->occurrence) {
+ switch (i->occurrence) {
case OC_ONCE:
if (IsBetween(i->time, last_check, time)) {
if (!startup || !(i->flags & ALF_NOSTARTUP)) triggered_list.push_back(i);
@@ -652,6 +663,7 @@ void CheckAlarms() { remove_list.push_back(i);
}
break;
+
default:
if (IsBetween(i->time, last_check, time)) {
if (i->flags & ALF_SUSPENDED)
@@ -662,29 +674,27 @@ void CheckAlarms() { break;
}
}
-
+
last_check = time;
WriteLastCheckTime();
startup = false;
- for(triggered_list.reset(); i = triggered_list.current(); triggered_list.next())
+ for (triggered_list.reset(); i = triggered_list.current(); triggered_list.next())
DoAlarm(i);
- for(remove_list.reset(); i = remove_list.current(); remove_list.next())
+ for (remove_list.reset(); i = remove_list.current(); remove_list.next())
remove(i->id);
-
-
}
-VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) {
+VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD)
+{
CheckAlarms();
}
-
INT_PTR AddAlarmService(WPARAM, LPARAM lParam)
{
ALARMINFO *alarm_info = (ALARMINFO *)lParam;
- ALARM alarm = {0};
+ ALARM alarm = { 0 };
alarm.action = alarm_info->action;
alarm.flags = alarm_info->flags;
alarm.id = next_alarm_id++;
@@ -738,8 +748,8 @@ void InitList() }
-void DeinitList() {
-
+void DeinitList()
+{
DeinitAlarmWin();
// i don't think this should be necessary, but...
@@ -751,4 +761,3 @@ void DeinitList() { SaveAlarms(); // we may have erased some 'cause they were once-offs that were triggeredf
}
-
diff --git a/plugins/Alarms/src/alarms.cpp b/plugins/Alarms/src/alarms.cpp index 14b2fe39a6..dc7de3ca63 100644 --- a/plugins/Alarms/src/alarms.cpp +++ b/plugins/Alarms/src/alarms.cpp @@ -10,7 +10,6 @@ There is no warranty. #include "stdafx.h"
#include "alarms.h"
-
#define SERVICENAME L"mp"
#define COMMANDPREFIX L"/" SERVICENAME
@@ -52,13 +51,14 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- switch(message) {
+ switch (message) {
case WM_COMMAND:
if (HIWORD(wParam) == STN_CLICKED) { //It was a click on the Popup.
PUDeletePopup(hWnd);
return TRUE;
}
break;
+
case UM_FREEPLUGINDATA:
return TRUE;
}
@@ -73,44 +73,45 @@ void ShowPopup(MCONTACT hContact, const wchar_t *msg) POPUPDATAT ppd = { 0 };
ppd.lchContact = hContact; //Be sure to use a GOOD handle, since this will not be checked.
ppd.lchIcon = hIconList1;
- mir_wstrncpy(ppd.lptzContactName, lpzContactName,MAX_CONTACTNAME);
- mir_wstrncpy(ppd.lptzText, msg, MAX_SECONDLINE);
+ mir_wstrncpy(ppd.lptzContactName, lpzContactName, MAX_CONTACTNAME);
+ mir_wstrncpy(ppd.lptzText, msg, MAX_SECONDLINE);
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
- ppd.colorText = RGB(0,0,0);
+ ppd.colorText = RGB(0, 0, 0);
ppd.PluginWindowProc = PopupDlgProc;
ppd.PluginData = 0;
ppd.iSeconds = 3;
- //Now that every field has been filled, we want to see the popup.
+ // Now that every field has been filled, we want to see the popup.
PUAddPopupT(&ppd);
}
}
HBITMAP LoadBmpFromIcon(int IdRes)
{
- HICON hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IdRes));
-
- RECT rc;
- BITMAPINFOHEADER bih = {0};
+ HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IdRes));
- HBRUSH hBkgBrush = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
+ BITMAPINFOHEADER bih = { 0 };
bih.biSize = sizeof(bih);
bih.biBitCount = 24;
bih.biPlanes = 1;
bih.biCompression = BI_RGB;
bih.biHeight = 16;
bih.biWidth = 20;
+
+ RECT rc;
rc.top = rc.left = 0;
rc.right = bih.biWidth;
rc.bottom = bih.biHeight;
+
HDC hdc = GetDC(NULL);
HBITMAP hBmp = CreateCompatibleBitmap(hdc, bih.biWidth, bih.biHeight);
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp);
+
+ HBRUSH hBkgBrush = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
FillRect(hdcMem, &rc, hBkgBrush);
DrawIconEx(hdcMem, 2, 0, hIcon, 16, 16, 0, NULL, DI_NORMAL);
-
SelectObject(hdcMem, hoBmp);
DeleteDC(hdcMem);
ReleaseDC(NULL, hdc);
@@ -160,7 +161,7 @@ extern "C" int __declspec(dllexport) Load(void) ccx.dwICC = ICC_DATE_CLASSES;
InitCommonControlsEx(&ccx);
- HookEvent(ME_SYSTEM_MODULESLOADED,MainInit);
+ HookEvent(ME_SYSTEM_MODULESLOADED, MainInit);
HookEvent(ME_SYSTEM_PRESHUTDOWN, MainDeInit);
LoadOptions();
diff --git a/plugins/Alarms/src/frame.cpp b/plugins/Alarms/src/frame.cpp index 96d464ff8d..2d3fc23d8e 100755 --- a/plugins/Alarms/src/frame.cpp +++ b/plugins/Alarms/src/frame.cpp @@ -20,12 +20,12 @@ mir_cs list_cs; HGENMENU hMenuShowReminders = 0;
-#define ID_FRAME_UPDATE_TIMER 1011
-#define ID_FRAME_SHOWHIDE_TIMER 1012
+#define ID_FRAME_UPDATE_TIMER 1011
+#define ID_FRAME_SHOWHIDE_TIMER 1012
-#define WMU_FILL_LIST (WM_USER + 10)
-#define WMU_SIZE_LIST (WM_USER + 11)
-#define WMU_INITIALIZE (WM_USER + 12)
+#define WMU_FILL_LIST (WM_USER + 10)
+#define WMU_SIZE_LIST (WM_USER + 11)
+#define WMU_INITIALIZE (WM_USER + 12)
void FixMainMenu();
@@ -41,7 +41,7 @@ int height_client_to_frame(int client_height, LONG style, LONG ex_style) LRESULT CALLBACK FrameContainerWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg) {
+ switch (msg) {
case WM_CREATE:
return TRUE;
@@ -50,7 +50,8 @@ LRESULT CALLBACK FrameContainerWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LP db_set_b(0, MODULE, "ReminderFrameVisible", 1);
Utils_RestoreWindowPosition(hwnd, 0, MODULE, "reminders_window");
PostMessage(hwnd, WM_SIZE, 0, 0);
- } else {
+ }
+ else {
db_set_b(0, MODULE, "ReminderFrameVisible", 0);
Utils_SaveWindowPosition(hwnd, 0, MODULE, "reminders_window");
}
@@ -79,13 +80,13 @@ LRESULT CALLBACK FrameContainerWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LP bool FrameIsFloating()
{
- if (frame_id == -1)
+ if (frame_id == -1)
return true; // no frames, always floating
-
+
return CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLOATING, frame_id), 0) != 0;
}
-ALARM context_menu_alarm = {0};
+ALARM context_menu_alarm = { 0 };
LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
@@ -94,12 +95,12 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar SIZE textSize;
SIZE timeSize;
- switch(msg) {
+ switch (msg) {
- case WM_CREATE:
+ case WM_CREATE:
hwnd_list = CreateWindow(L"LISTBOX", L"",
(WS_VISIBLE | WS_CHILD | LBS_NOINTEGRALHEIGHT | LBS_STANDARD | LBS_NOTIFY | LBS_OWNERDRAWFIXED) & ~LBS_SORT
- & ~WS_BORDER, 0, 0, 0, 0, hwnd, NULL, hInst,0);
+ & ~WS_BORDER, 0, 0, 0, 0, hwnd, NULL, hInst, 0);
return FALSE;
case WMU_INITIALIZE:
@@ -116,7 +117,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case WM_DRAWITEM:
dis = (DRAWITEMSTRUCT *)lParam;
if (dis->itemID != (DWORD)-1) {
- ALARM alarm = {0};
+ ALARM alarm = { 0 };
mir_cslock lck(list_cs);
ALARM &list_alarm = alarm_list.at(dis->itemData);
copy_alarm_data(&alarm, &list_alarm);
@@ -134,9 +135,9 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar SetTextColor(dis->hDC, fontColour);
HICON hIcon = (min <= 5 ? hIconList2 : hIconList1);
- DrawIconEx(dis->hDC,dis->rcItem.left,(dis->rcItem.top + dis->rcItem.bottom - 16)>>1,hIcon,0, 0, 0, NULL, DI_NORMAL);
+ DrawIconEx(dis->hDC, dis->rcItem.left, (dis->rcItem.top + dis->rcItem.bottom - 16) >> 1, hIcon, 0, 0, 0, NULL, DI_NORMAL);
- GetTextExtentPoint32(dis->hDC,alarm.szTitle,(int)mir_wstrlen(alarm.szTitle),&textSize);
+ GetTextExtentPoint32(dis->hDC, alarm.szTitle, (int)mir_wstrlen(alarm.szTitle), &textSize);
wchar_t buff[100];
if (min >= 60)
@@ -144,26 +145,26 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar else
mir_snwprintf(buff, TranslateT("%dm"), min);
- GetTextExtentPoint32(dis->hDC,buff,(int)mir_wstrlen(buff),&timeSize);
+ GetTextExtentPoint32(dis->hDC, buff, (int)mir_wstrlen(buff), &timeSize);
if (textSize.cx > (dis->rcItem.right - dis->rcItem.left) - (GetSystemMetrics(SM_CXSMICON) + 4) - timeSize.cx - 2 - 4) {
// need elipsis
wchar_t titlebuff[512];
size_t len = mir_wstrlen(alarm.szTitle);
if (len > 511) len = 511;
- while(len > 0 && textSize.cx > (dis->rcItem.right - dis->rcItem.left) - (GetSystemMetrics(SM_CXSMICON) + 4) - timeSize.cx - 2 - 4) {
+ while (len > 0 && textSize.cx > (dis->rcItem.right - dis->rcItem.left) - (GetSystemMetrics(SM_CXSMICON) + 4) - timeSize.cx - 2 - 4) {
len--;
wcsncpy(titlebuff, alarm.szTitle, len);
titlebuff[len] = 0;
mir_wstrcat(titlebuff, L"...");
- GetTextExtentPoint32(dis->hDC,titlebuff,(int)mir_wstrlen(titlebuff),&textSize);
+ GetTextExtentPoint32(dis->hDC, titlebuff, (int)mir_wstrlen(titlebuff), &textSize);
}
- TextOut(dis->hDC,dis->rcItem.left + 16 + 4,(dis->rcItem.top + dis->rcItem.bottom - textSize.cy)>>1,titlebuff,(int)mir_wstrlen(titlebuff));
- TextOut(dis->hDC,dis->rcItem.right - timeSize.cx - 2,(dis->rcItem.top + dis->rcItem.bottom - timeSize.cy)>>1, buff,(int)mir_wstrlen(buff));
+ TextOut(dis->hDC, dis->rcItem.left + 16 + 4, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, titlebuff, (int)mir_wstrlen(titlebuff));
+ TextOut(dis->hDC, dis->rcItem.right - timeSize.cx - 2, (dis->rcItem.top + dis->rcItem.bottom - timeSize.cy) >> 1, buff, (int)mir_wstrlen(buff));
}
- else {
- TextOut(dis->hDC,dis->rcItem.left + 16 + 4,(dis->rcItem.top + dis->rcItem.bottom - textSize.cy)>>1,alarm.szTitle,(int)mir_wstrlen(alarm.szTitle));
- TextOut(dis->hDC,dis->rcItem.right - timeSize.cx - 2,(dis->rcItem.top + dis->rcItem.bottom - timeSize.cy)>>1, buff,(int)mir_wstrlen(buff));
+ else {
+ TextOut(dis->hDC, dis->rcItem.left + 16 + 4, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, alarm.szTitle, (int)mir_wstrlen(alarm.szTitle));
+ TextOut(dis->hDC, dis->rcItem.right - timeSize.cx - 2, (dis->rcItem.top + dis->rcItem.bottom - timeSize.cy) >> 1, buff, (int)mir_wstrlen(buff));
}
SetBkMode(dis->hDC, OPAQUE);
@@ -265,7 +266,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar else if (!IsWindowVisible(hwnd) && count > 0) {
// we have reminders - show if not linked to clist or if clist is visible
if ((!options.hide_with_clist && FrameIsFloating()) || IsWindowVisible(pcli->hwndContactList)) {
- CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)frame_id, 0);
+ CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)frame_id, 0);
CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)frame_id, FU_FMREDRAW | FU_FMPOS);
}
}
@@ -300,7 +301,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar alarm_list.sort();
int index = 0;
ALARM *i;
- for(alarm_list.reset(); i = alarm_list.current(); alarm_list.next(), index++) {
+ for (alarm_list.reset(); i = alarm_list.current(); alarm_list.next(), index++) {
if (i->flags & (ALF_HIDDEN | ALF_SUSPENDED | ALF_NOREMINDER))
continue;
SendMessage(hwnd_list, LB_ADDSTRING, 0, (LPARAM)index);
@@ -373,7 +374,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar //ClientToScreen(hwnd_list, &pt);
GetCursorPos(&pt);
- BOOL ret = TrackPopupMenu(submenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL);
+ BOOL ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL);
DestroyMenu(menu);
if (ret)
PostMessage(hwnd, WM_COMMAND, ret, 0);
@@ -381,7 +382,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar return TRUE;
case WM_COMMAND:
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case ID_REMINDERFRAMECONTEXT_OPTIONS:
Options_Open(L"Events", L"Alarms");
break;
@@ -411,7 +412,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case ID_REMINDERFRAMECONTEXT_NEWALARM:
NewAlarmMenuFunc(0, 0);
break;
- }
+ }
return TRUE;
case WM_DESTROY:
@@ -436,7 +437,6 @@ int ReloadFont(WPARAM, LPARAM) DeleteObject(bk_brush);
bk_brush = CreateSolidBrush(db_get_dw(0, "Alarm", "clFrameBack", GetSysColor(COLOR_3DFACE)));
RefreshReminderFrame();
-
return 0;
}
@@ -461,7 +461,7 @@ bool ReminderFrameVisible() void SetReminderFrameVisible(bool visible)
{
- if (frame_id == -1 && hwnd_frame != 0)
+ if (frame_id == -1 && hwnd_frame != 0)
ShowWindow(hwnd_frame, visible ? SW_SHOW : SW_HIDE);
}
@@ -488,9 +488,9 @@ int CreateFrame() RegisterClass(&wndclass);
if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
- hwnd_plugin = CreateWindow(L"AlarmsFrame", TranslateT("Alarms"),
- WS_CHILD | WS_CLIPCHILDREN,
- 0,0,10,10, pcli->hwndContactList, NULL,hInst,NULL);
+ hwnd_plugin = CreateWindow(L"AlarmsFrame", TranslateT("Alarms"),
+ WS_CHILD | WS_CLIPCHILDREN,
+ 0, 0, 10, 10, pcli->hwndContactList, NULL, hInst, NULL);
CLISTFrame Frame = { sizeof(CLISTFrame) };
Frame.tname = TranslateT("Alarms");
@@ -499,7 +499,7 @@ int CreateFrame() Frame.Flags = F_UNICODE | F_VISIBLE | F_SHOWTB | F_SHOWTBTIP;
Frame.height = 30;
Frame.hIcon = hIconMenuSet;
- frame_id = CallService(MS_CLIST_FRAMES_ADDFRAME,(WPARAM)&Frame,0);
+ frame_id = CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&Frame, 0);
}
else {
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
@@ -508,14 +508,13 @@ int CreateFrame() wndclass.lpszClassName = L"AlarmsFrameContainer";
RegisterClass(&wndclass);
- hwnd_frame = CreateWindowEx(WS_EX_TOOLWINDOW, L"AlarmsFrameContainer", TranslateT("Alarms"),
+ hwnd_frame = CreateWindowEx(WS_EX_TOOLWINDOW, L"AlarmsFrameContainer", TranslateT("Alarms"),
(WS_POPUPWINDOW | WS_THICKFRAME | WS_CAPTION | WS_SYSMENU | WS_CLIPCHILDREN) & ~WS_VISIBLE,
- 0,0,200,100, pcli->hwndContactList, NULL,hInst,NULL);
- //0,0,200,100, GetDesktopWindow(), NULL,hInst,NULL);
-
- hwnd_plugin = CreateWindow(L"AlarmsFrame", TranslateT("Alarms"),
+ 0, 0, 200, 100, pcli->hwndContactList, NULL, hInst, NULL);
+
+ hwnd_plugin = CreateWindow(L"AlarmsFrame", TranslateT("Alarms"),
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE,
- 0,0,10,10, hwnd_frame, NULL,hInst,NULL);
+ 0, 0, 10, 10, hwnd_frame, NULL, hInst, NULL);
SetWindowLongPtr(hwnd_frame, GWLP_USERDATA, (LONG_PTR)hwnd_plugin);
@@ -579,7 +578,7 @@ int CreateFrame() fontColour = Font_Get(font_id, &log_font);
hFont = CreateFontIndirectA(&log_font);
SendMessage(hwnd_list, WM_SETFONT, (WPARAM)hFont, TRUE);
-
+
HookEvent(ME_FONT_RELOAD, ReloadFont);
// create the brush used for the background in the absence of clist_modern skinning features - match clist
diff --git a/plugins/Alarms/src/icons.cpp b/plugins/Alarms/src/icons.cpp index 3848213ad1..45fa921ca4 100644 --- a/plugins/Alarms/src/icons.cpp +++ b/plugins/Alarms/src/icons.cpp @@ -3,12 +3,12 @@ HICON hIconMenuSet, hIconList1, hIconList2, hIconMenuShowHide, hIconSystray;
-static IconItem iconList[] =
+static IconItem iconList[] =
{
- { LPGEN("Menu: Set alarm"), "alarms_menu_set", IDI_MAINMENU },
- { LPGEN("Reminder: Soon"), "alarms_list1", IDI_LIST1 },
+ { LPGEN("Menu: Set alarm"), "alarms_menu_set", IDI_MAINMENU },
+ { LPGEN("Reminder: Soon"), "alarms_list1", IDI_LIST1 },
{ LPGEN("Reminder: Very soon"), "alarms_list2", IDI_LIST2 },
- { LPGEN("Alarm: System tray"), "alarms_systray", IDI_MAINMENU },
+ { LPGEN("Alarm: System tray"), "alarms_systray", IDI_MAINMENU },
{ LPGEN("Menu: Show/Hide reminders"), "alarms_menu_showhide", IDI_MAINMENU }
};
@@ -17,7 +17,7 @@ int ReloadIcons(WPARAM, LPARAM) hIconMenuSet = IcoLib_GetIcon("alarms_menu_set");
hIconList1 = IcoLib_GetIcon("alarms_list1");
hIconList2 = IcoLib_GetIcon("alarms_list2");
- if ( !ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
+ if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
hIconMenuShowHide = IcoLib_GetIcon("alarms_menu_showhide");
RefreshReminderFrame();
@@ -28,7 +28,7 @@ void InitIcons() {
Icon_Register(hInst, "Alarms", iconList, _countof(iconList));
- if ( !ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
+ if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
hIconMenuShowHide = IcoLib_GetIcon("alarms_menu_showhide");
ReloadIcons(0, 0);
diff --git a/plugins/Alarms/src/options.cpp b/plugins/Alarms/src/options.cpp index fd51a07bc6..381e38b674 100755 --- a/plugins/Alarms/src/options.cpp +++ b/plugins/Alarms/src/options.cpp @@ -11,11 +11,12 @@ Options options; // defined in header
//#define WMU_INITOPTLIST (WM_USER + 20)
-typedef struct AddEditParam_tag {
+struct AddEditParam
+{
ALARM *alarm_ptr;
BOOL edit;
BOOL self_add;
-} AddEditParam;
+};
HGENMENU hMainMenuItem = 0;
@@ -307,7 +308,7 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP add_edit_alarm->occurrence = OC_ONCE;
else if (IsDlgButtonChecked(hwndDlg, IDC_RAD_DAILY))
add_edit_alarm->occurrence = OC_DAILY;
- else if(IsDlgButtonChecked(hwndDlg, IDC_RAD_DAYS))
+ else if (IsDlgButtonChecked(hwndDlg, IDC_RAD_DAYS))
add_edit_alarm->occurrence = OC_SELECTED_DAYS;
else if (IsDlgButtonChecked(hwndDlg, IDC_RAD_WEEKDAYS))
add_edit_alarm->occurrence = OC_WEEKDAYS;
@@ -604,7 +605,7 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP 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:
diff --git a/plugins/Alarms/src/time_utils.cpp b/plugins/Alarms/src/time_utils.cpp index c25a281fe5..1960cf04f4 100644 --- a/plugins/Alarms/src/time_utils.cpp +++ b/plugins/Alarms/src/time_utils.cpp @@ -3,23 +3,21 @@ SYSTEMTIME last_check;
-bool IsBetween(SYSTEMTIME &time, SYSTEMTIME &start, SYSTEMTIME &end) {
-
+bool IsBetween(SYSTEMTIME &time, SYSTEMTIME &start, SYSTEMTIME &end)
+{
FILETIME ft_time, ft_start, ft_end;
-
SystemTimeToFileTime(&time, &ft_time);
SystemTimeToFileTime(&start, &ft_start);
SystemTimeToFileTime(&end, &ft_end);
- return (CompareFileTime(&ft_time, &ft_start) > 0 && CompareFileTime(&ft_time, &ft_end) <= 0);
+ return CompareFileTime(&ft_time, &ft_start) > 0 && CompareFileTime(&ft_time, &ft_end) <= 0;
}
-bool IsBefore(SYSTEMTIME &time, SYSTEMTIME &start) {
+bool IsBefore(SYSTEMTIME &time, SYSTEMTIME &start)
+{
FILETIME ft_time, ft_start;
-
SystemTimeToFileTime(&time, &ft_time);
SystemTimeToFileTime(&start, &ft_start);
- return (CompareFileTime(&ft_time, &ft_start) < 0);
+ return CompareFileTime(&ft_time, &ft_start) < 0;
}
-
|