From dc7168f28261e403569eba78cd9600a79e2f63c7 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 6 Nov 2012 18:32:33 +0000 Subject: massive update of everything in Alarms git-svn-id: http://svn.miranda-ng.org/main/trunk@2219 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Alarms/src/alarm_win.cpp | 70 ++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'plugins/Alarms/src/alarm_win.cpp') diff --git a/plugins/Alarms/src/alarm_win.cpp b/plugins/Alarms/src/alarm_win.cpp index 751ff21243..af93717105 100644 --- a/plugins/Alarms/src/alarm_win.cpp +++ b/plugins/Alarms/src/alarm_win.cpp @@ -28,11 +28,13 @@ typedef struct WindowData_tag { int win_num; } WindowData; -void SetAlarmWinOptions() { +void SetAlarmWinOptions() +{ WindowList_Broadcast(hAlarmWindowList, WMU_SETOPT, IDC_SNOOZE, 0); } -bool TransparencyEnabled() { +bool TransparencyEnabled() +{ return MySetLayeredWindowAttributes != 0; } @@ -125,7 +127,8 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar h=(halarm; - if (data && data->action & AAF_SOUND) { - if (data->sound_num <= 3) { - char buff[128]; - sprintf(buff, "Triggered%d", data->sound_num); - SkinPlaySound(buff); - } else if (data->sound_num == 4) { - if (data->szTitle != NULL && data->szTitle[0] != '\0') { - if (ServiceExists("Speak/Say")) { - CallService("Speak/Say", 0, (LPARAM)data->szTitle); - } + if (wParam == ID_TIMER_SOUND) { + WindowData *dw = (WindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + if (dw) { + ALARM *data = dw->alarm; + if (data && data->action & AAF_SOUND) { + if (data->sound_num <= 3) { + char buff[128]; + sprintf(buff, "Triggered%d", data->sound_num); + SkinPlaySound(buff); + } + else if (data->sound_num == 4) { + if (data->szTitle != NULL && data->szTitle[0] != '\0') { + if (ServiceExists("Speak/Say")) { + CallService("Speak/Say", 0, (LPARAM)data->szTitle); } } } @@ -204,11 +205,9 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar } } return TRUE; + case WM_MOVE: - { - //WindowData *wd = (WindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - Utils_SaveWindowPosition(hwndDlg, 0, MODULE, "Notify"); - } + Utils_SaveWindowPosition(hwndDlg, 0, MODULE, "Notify"); break; case WMU_ADDSNOOZER: @@ -243,9 +242,9 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar append_to_list(data); } } - } return TRUE; + case WM_COMMAND: if ( HIWORD( wParam ) == BN_CLICKED ) { switch( LOWORD( wParam )) { @@ -331,9 +330,9 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar ClientToScreen(hwndDlg, &newp); WindowData *window_data = (WindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - if (!window_data->moving) { + if (!window_data->moving) window_data->moving = true; - } else { + else { RECT r; GetWindowRect(hwndDlg, &r); @@ -341,7 +340,8 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar } window_data->p.x = newp.x; window_data->p.y = newp.y; - } else { + } + else { ReleaseCapture(); WindowData *window_data = (WindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); window_data->moving = false; @@ -352,7 +352,8 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar return FALSE; } -int ReloadFonts(WPARAM wParam, LPARAM lParam) { +int ReloadFonts(WPARAM wParam, LPARAM lParam) +{ LOGFONT log_font; title_font_colour = CallService(MS_FONT_GETT, (WPARAM)&title_font_id, (LPARAM)&log_font); DeleteObject(hTitleFont); @@ -410,20 +411,19 @@ int AlarmWinModulesLoaded(WPARAM wParam, LPARAM lParam) return 0; } -void InitAlarmWin() { +void InitAlarmWin() +{ hUserDll = LoadLibrary(_T("user32.dll")); - if (hUserDll) { + if (hUserDll) MySetLayeredWindowAttributes = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(hUserDll, "SetLayeredWindowAttributes"); - //MyAnimateWindow=(BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(hUserDll,"AnimateWindow"); - } hAlarmWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); HookEvent(ME_SYSTEM_MODULESLOADED, AlarmWinModulesLoaded); } -void DeinitAlarmWin() { - +void DeinitAlarmWin() +{ WindowList_Broadcast(hAlarmWindowList, WM_COMMAND, IDC_SNOOZE, 0); FreeLibrary(hUserDll); -- cgit v1.2.3