summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-01-16 19:18:08 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-01-16 19:18:08 +0000
commit0913be329035e7bd360f59071b3504ccef31295b (patch)
tree5f0c29b66ff4224bdf557d867946e6729f413a75 /plugins
parentd96f8c25bdab08f82e99913f1a46e0b7eb88a316 (diff)
GDI leak fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@3121 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/SeenPlugin/res/resource.rc6
-rw-r--r--plugins/SeenPlugin/src/history.cpp69
-rw-r--r--plugins/SeenPlugin/src/seen.h1
3 files changed, 25 insertions, 51 deletions
diff --git a/plugins/SeenPlugin/res/resource.rc b/plugins/SeenPlugin/res/resource.rc
index e44bb1a046..a7477f6c0e 100644
--- a/plugins/SeenPlugin/res/resource.rc
+++ b/plugins/SeenPlugin/res/resource.rc
@@ -164,9 +164,9 @@ EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,75,101,50,14
- PUSHBUTTON "",IDC_USERMENU,146,5,15,13,BS_ICON | WS_TABSTOP
- PUSHBUTTON "",IDC_DETAILS,163,5,15,13,BS_ICON | WS_TABSTOP
- PUSHBUTTON "",IDC_SENDMSG,180,5,15,13,BS_ICON | WS_TABSTOP
+ PUSHBUTTON "MButtonClass",IDC_USERMENU,146,5,15,13,BS_ICON | WS_TABSTOP
+ PUSHBUTTON "MButtonClass",IDC_DETAILS,163,5,15,13,BS_ICON | WS_TABSTOP
+ PUSHBUTTON "MButtonClass",IDC_SENDMSG,180,5,15,13,BS_ICON | WS_TABSTOP
LISTBOX IDC_HISTORYLIST,5,20,190,59,LBS_NOINTEGRALHEIGHT |
WS_VSCROLL | WS_TABSTOP
CONTROL "Alert when user status changes",IDC_STATUSCHANGE,"Button",
diff --git a/plugins/SeenPlugin/src/history.cpp b/plugins/SeenPlugin/src/history.cpp
index 46c8122555..4b45473620 100644
--- a/plugins/SeenPlugin/src/history.cpp
+++ b/plugins/SeenPlugin/src/history.cpp
@@ -163,7 +163,6 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA
{
HANDLE hContact;
TCHAR sztemp[1024];
- static HIMAGELIST hIml=NULL;
switch(Message) {
case WM_INITDIALOG:
@@ -174,40 +173,24 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA
CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,GCDNF_TCHAR),
TranslateT("last seen history"));
SendMessage(hwndDlg, WM_SETTEXT, 0, (LPARAM)sztemp);
- SendMessage(hwndDlg, WM_SETICON, (WPARAM) ICON_BIG, (LPARAM) LoadSkinnedIcon(SKINICON_OTHER_MIRANDA));
- SendMessage(hwndDlg, WM_SETICON, (WPARAM) ICON_SMALL, (LPARAM) LoadSkinnedIcon(SKINICON_OTHER_MIRANDA));
+ SendMessage(hwndDlg, WM_SETICON, (WPARAM) ICON_BIG, (LPARAM)LoadSkinnedIcon(SKINICON_OTHER_MIRANDA));
+ SendMessage(hwndDlg, WM_SETICON, (WPARAM) ICON_SMALL, (LPARAM)LoadSkinnedIcon(SKINICON_OTHER_MIRANDA));
if ( db_get_b(hContact,S_MOD,"OnlineAlert",0))
SendDlgItemMessage(hwndDlg, IDC_STATUSCHANGE, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
- hIml = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,3,3);
- ImageList_AddIcon(hIml,LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_USERDETAILS)));
- ImageList_AddIcon(hIml,LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_DOWNARROW)));
- ImageList_AddIcon(hIml,LoadSkinnedIcon(SKINICON_EVENT_MESSAGE));
- SendDlgItemMessage(hwndDlg,IDC_DETAILS,BM_SETIMAGE,IMAGE_ICON,(WPARAM)ImageList_GetIcon(hIml,0,ILD_NORMAL));
- SendDlgItemMessage(hwndDlg,IDC_USERMENU,BM_SETIMAGE,IMAGE_ICON,(WPARAM)ImageList_GetIcon(hIml,1,ILD_NORMAL));
- SendDlgItemMessage(hwndDlg,IDC_SENDMSG,BM_SETIMAGE,IMAGE_ICON,(WPARAM)ImageList_GetIcon(hIml,2,ILD_NORMAL));
+ SendDlgItemMessage(hwndDlg, IDC_DETAILS, BM_SETIMAGE, IMAGE_ICON, (WPARAM)LoadSkinnedIcon(SKINICON_OTHER_USERDETAILS));
+ SendDlgItemMessage(hwndDlg, IDC_USERMENU, BM_SETIMAGE, IMAGE_ICON, (WPARAM)LoadSkinnedIcon(SKINICON_OTHER_DOWNARROW));
+ SendDlgItemMessage(hwndDlg, IDC_SENDMSG, BM_SETIMAGE, IMAGE_ICON, (WPARAM)LoadSkinnedIcon(SKINICON_EVENT_MESSAGE));
//set-up tooltips
- {
- HWND hwndDlgToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, _T(""), WS_POPUP, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL);
-
- TOOLINFO ti = { sizeof(ti) };
- ti.uFlags=TTF_IDISHWND|TTF_SUBCLASS;
- ti.uId = (UINT)GetDlgItem(hwndDlg,IDC_USERMENU);
- ti.lpszText = TranslateT("User Menu");
- SendMessage(hwndDlgToolTips,TTM_ADDTOOL,0,(LPARAM)&ti);
- ti.uId = (UINT)GetDlgItem(hwndDlg,IDC_DETAILS);
- ti.lpszText = TranslateT("View User's Details");
- SendMessage(hwndDlgToolTips,TTM_ADDTOOL,0,(LPARAM)&ti);
- ti.uId = (UINT)GetDlgItem(hwndDlg,IDC_SENDMSG);
- ti.lpszText = TranslateT("Send Instant Message");
- SendMessage(hwndDlgToolTips,TTM_ADDTOOL,0,(LPARAM)&ti);
- }
+ SendDlgItemMessage(hwndDlg, IDC_DETAILS, BUTTONADDTOOLTIP, (WPARAM)LPGEN("User Menu"), 0);
+ SendDlgItemMessage(hwndDlg, IDC_USERMENU, BUTTONADDTOOLTIP, (WPARAM)LPGEN("View User's Details"), 0);
+ SendDlgItemMessage(hwndDlg, IDC_SENDMSG, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Send Instant Message"), 0);
Utils_RestoreWindowPositionNoMove(hwndDlg,NULL,S_MOD,"History_");
ShowWindow(hwndDlg, SW_SHOW);
- break;
+ return TRUE;
case WM_MEASUREITEM:
return CallService(MS_CLIST_MENUMEASUREITEM,wparam,lparam);
@@ -251,26 +234,18 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA
break;
}
break;
+
case WM_SIZE:
{
int dx, dy;
- HDWP hDwp;
-
- hDwp = BeginDeferWindowPos(6);
- MyResizeGetOffset(hwndDlg, GetDlgItem(hwndDlg, IDC_HISTORYLIST),
- LOWORD(lparam)-15, HIWORD(lparam)-99, &dx, &dy);
- hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_USERMENU),
- dx, 0, 0, 0);
- hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_DETAILS),
- dx, 0, 0, 0);
- hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_SENDMSG),
- dx, 0, 0, 0);
- hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_HISTORYLIST),
- 0, 0, dx, dy);
- hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_STATUSCHANGE),
- 0, dy, dx, 0);
- hDwp = MyHorizCenterWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDOK),
- LOWORD(lparam), dy, 0);
+ HDWP hDwp = BeginDeferWindowPos(6);
+ MyResizeGetOffset(hwndDlg, GetDlgItem(hwndDlg, IDC_HISTORYLIST), LOWORD(lparam)-15, HIWORD(lparam)-99, &dx, &dy);
+ hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_USERMENU), dx, 0, 0, 0);
+ hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_DETAILS), dx, 0, 0, 0);
+ hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_SENDMSG), dx, 0, 0, 0);
+ hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_HISTORYLIST), 0, 0, dx, dy);
+ hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_STATUSCHANGE), 0, dy, dx, 0);
+ hDwp = MyHorizCenterWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDOK), LOWORD(lparam), dy, 0);
EndDeferWindowPos(hDwp);
}
break;
@@ -296,13 +271,11 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA
case WM_DESTROY:
Utils_SaveWindowPosition(hwndDlg,NULL,S_MOD,"History_");
- ImageList_Destroy(hIml);
+ DestroyIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0));
+ DestroyIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0));
break;
-
- default:
- return FALSE;
}
- return TRUE;
+ return FALSE;
}
void ShowHistory(HANDLE hContact, BYTE isAlert)
diff --git a/plugins/SeenPlugin/src/seen.h b/plugins/SeenPlugin/src/seen.h
index fda47a609f..692bc2ea38 100644
--- a/plugins/SeenPlugin/src/seen.h
+++ b/plugins/SeenPlugin/src/seen.h
@@ -54,6 +54,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_protocols.h>
#include <m_popup.h>
#include <m_ignore.h>
+#include <m_button.h>
#include "m_tipper.h"