diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2013-01-28 21:38:30 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2013-01-28 21:38:30 +0000 |
commit | 57b1f6cd941da1d60b56742231505fb258c1cb82 (patch) | |
tree | e7ea69163fdae89b226f6ea54cd9678d84d7b423 /plugins | |
parent | 705f46a1f1201ad4a6fbcbb163db373c2b29f0d3 (diff) |
-added frame icon
-fixed possible crash
-minor fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@3325 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Alarms/src/alarmlist.cpp | 10 | ||||
-rw-r--r-- | plugins/Alarms/src/alarms.cpp | 38 | ||||
-rw-r--r-- | plugins/Alarms/src/frame.cpp | 5 |
3 files changed, 23 insertions, 30 deletions
diff --git a/plugins/Alarms/src/alarmlist.cpp b/plugins/Alarms/src/alarmlist.cpp index 0057cad393..825f754aa1 100644 --- a/plugins/Alarms/src/alarmlist.cpp +++ b/plugins/Alarms/src/alarmlist.cpp @@ -470,7 +470,7 @@ void suspend(unsigned short alarm_id) { SaveAlarms();
}
-static int CALLBACK PopupAlarmDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK PopupAlarmDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message) {
case WM_COMMAND: // snooze
@@ -535,14 +535,14 @@ void ShowPopup(ALARM *alarm) { POPUPDATAT ppd = { 0 };
ppd.lchIcon = hIconMenuSet;
- lstrcpy(ppd.lptzContactName, data->szTitle);
- lstrcpy(ppd.lptzText, data->szDesc);
- ppd.PluginWindowProc = (WNDPROC)PopupAlarmDlgProc;
+ lstrcpyn(ppd.lptzContactName, data->szTitle, MAX_CONTACTNAME);
+ lstrcpy,(ppd.lptzText, data->szDesc, MAX_SECONDLINE);
+ ppd.PluginWindowProc = PopupAlarmDlgProc;
ppd.PluginData = data;
ppd.iSeconds = -1;
//Now that every field has been filled, we want to see the popup.
- CallService(MS_POPUP_ADDPOPUPEX, (WPARAM)&ppd, 0);
+ PUAddPopUpT(&ppd);
}
}
diff --git a/plugins/Alarms/src/alarms.cpp b/plugins/Alarms/src/alarms.cpp index b5f60c0098..0935a0527c 100644 --- a/plugins/Alarms/src/alarms.cpp +++ b/plugins/Alarms/src/alarms.cpp @@ -71,14 +71,14 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA void ShowPopup(HANDLE hContact, const TCHAR *msg)
{
- if (ServiceExists(MS_POPUP_ADDPOPUP)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
TCHAR *lpzContactName = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR);
POPUPDATAT ppd = { 0 };
ppd.lchContact = hContact; //Be sure to use a GOOD handle, since this will not be checked.
- ppd.lchIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
- lstrcpy(ppd.lptzContactName, lpzContactName);
- lstrcpy(ppd.lptzText, msg);
+ ppd.lchIcon = hIconList1;
+ lstrcpyn(ppd.lptzContactName, lpzContactName,MAX_CONTACTNAME);
+ lstrcpyn(ppd.lptzText, msg, MAX_SECONDLINE);
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
ppd.colorText = RGB(0,0,0);
ppd.PluginWindowProc = PopupDlgProc;
@@ -100,8 +100,6 @@ static int PluginMessageReceived(WPARAM wParam,LPARAM lParam) {
CCSDATA *pccsd = (CCSDATA *)lParam;
PROTORECVEVENT *ppre = ( PROTORECVEVENT * )pccsd->lParam;
- TCHAR *savedMsg;
- HWND hWnd;
TCHAR response[256];
TCHAR msg[1024], buff[1024];
@@ -109,21 +107,21 @@ static int PluginMessageReceived(WPARAM wParam,LPARAM lParam) if (_tcsncmp(ppre->tszMessage, szGamePrefix, _tcslen(szGamePrefix)))
return CallService( MS_PROTO_CHAINRECV, wParam, lParam );
- _tcscpy(msg, ppre->tszMessage + _tcslen(szGamePrefix));
+ _tcsncpy(msg, ppre->tszMessage + _tcslen(szGamePrefix),SIZEOF(msg));
- savedMsg = ppre->tszMessage;
+ TCHAR *savedMsg = ppre->tszMessage;
if (!_tcscmp(msg, _T(" ffw"))) {
mir_sntprintf(buff, SIZEOF(buff), _T("%s"), _T("Fast forward!"));
- hWnd = FindWindow(0, _T("Windows Media Player"));
+ HWND hWnd = FindWindow(0, _T("Windows Media Player"));
PostMessage(hWnd, WM_COMMAND, WMP_NEXT, 0);
}
else mir_sntprintf(buff, SIZEOF(buff), TranslateT("Unknown command issued: \"%s\""), msg);
ShowPopup(pccsd->hContact, buff);
- _tcscpy(response, buff);
+ _tcsncpy(response, buff,SIZEOF(response));
PluginSendMessage((WPARAM)pccsd->hContact, (LPARAM)response);
return 0;
@@ -131,32 +129,26 @@ static int PluginMessageReceived(WPARAM wParam,LPARAM lParam) HBITMAP LoadBmpFromIcon(int IdRes)
{
- HBITMAP hBmp, hoBmp;
- HDC hdc, hdcMem;
- HBRUSH hBkgBrush;
- HICON hIcon;
-
- hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IdRes));
+ HICON hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IdRes));
RECT rc;
BITMAPINFOHEADER bih = {0};
- int widthBytes;
- hBkgBrush = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
+ HBRUSH hBkgBrush = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
bih.biSize = sizeof(bih);
bih.biBitCount = 24;
bih.biPlanes = 1;
bih.biCompression = BI_RGB;
bih.biHeight = 16;
bih.biWidth = 20;
- widthBytes = ((bih.biWidth*bih.biBitCount + 31) >> 5) * 4;
+ int widthBytes = ((bih.biWidth*bih.biBitCount + 31) >> 5) * 4;
rc.top = rc.left = 0;
rc.right = bih.biWidth;
rc.bottom = bih.biHeight;
- hdc = GetDC(NULL);
- hBmp = CreateCompatibleBitmap(hdc, bih.biWidth, bih.biHeight);
- hdcMem = CreateCompatibleDC(hdc);
- hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp);
+ HDC hdc = GetDC(NULL);
+ HBITMAP hBmp = CreateCompatibleBitmap(hdc, bih.biWidth, bih.biHeight);
+ HDC hdcMem = CreateCompatibleDC(hdc);
+ HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp);
FillRect(hdcMem, &rc, hBkgBrush);
DrawIconEx(hdcMem, 2, 0, hIcon, 16, 16, 0, NULL, DI_NORMAL);
diff --git a/plugins/Alarms/src/frame.cpp b/plugins/Alarms/src/frame.cpp index 06ad5d2b5c..9f168a6bad 100644 --- a/plugins/Alarms/src/frame.cpp +++ b/plugins/Alarms/src/frame.cpp @@ -391,8 +391,8 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar {
OPENOPTIONSDIALOG oop;
oop.cbSize = sizeof(oop);
- oop.pszGroup = Translate("Events");
- oop.pszPage = Translate("Alarms");
+ oop.pszGroup = "Events";
+ oop.pszPage = "Alarms";
oop.pszTab = 0;
Options_Open(&oop);
}
@@ -522,6 +522,7 @@ int CreateFrame() Frame.align = alBottom;
Frame.Flags = F_TCHAR | F_VISIBLE | F_SHOWTB | F_SHOWTBTIP;
Frame.height = 30;
+ Frame.hIcon = hIconMenuSet;
frame_id = CallService(MS_CLIST_FRAMES_ADDFRAME,(WPARAM)&Frame,0);
}
else {
|