From eec361608fde60d63fe4511e26e3b95c7f72be13 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 5 Jun 2016 16:11:08 +0000 Subject: - fix for #1059; - direct unsafe work with icons replaces with Window_SetIcon_IcoLib / Window_SetSkinIcon_IcoLib; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@16917 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/FTPFileYM/src/dialog.cpp | 2 +- plugins/FTPFileYM/src/manager.cpp | 2 +- plugins/FTPFileYM/src/utils.cpp | 9 ++++++++- plugins/FTPFileYM/src/utils.h | 4 +++- 4 files changed, 13 insertions(+), 4 deletions(-) (limited to 'plugins/FTPFileYM') diff --git a/plugins/FTPFileYM/src/dialog.cpp b/plugins/FTPFileYM/src/dialog.cpp index e6eda61bd5..3e6fc46699 100644 --- a/plugins/FTPFileYM/src/dialog.cpp +++ b/plugins/FTPFileYM/src/dialog.cpp @@ -170,7 +170,7 @@ INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Utils::loadIconEx("main")); + Window_SetIcon_IcoLib(hwndDlg, Utils::getIconHandle("main")); mir_subclassWindow(GetDlgItem(hwndDlg, IDC_TAB), TabControlProc); { diff --git a/plugins/FTPFileYM/src/manager.cpp b/plugins/FTPFileYM/src/manager.cpp index ebe4755682..8d68a8f1c6 100644 --- a/plugins/FTPFileYM/src/manager.cpp +++ b/plugins/FTPFileYM/src/manager.cpp @@ -223,8 +223,8 @@ INT_PTR CALLBACK Manager::ManagerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); + Window_SetIcon_IcoLib(hwndDlg, Utils::getIconHandle("main")); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Utils::loadIconEx("main")); SendDlgItemMessage(hwndDlg, IDC_BTN_SELECTALL, BUTTONSETASFLATBTN, 0, 0); SendDlgItemMessage(hwndDlg, IDC_BTN_SELECTALL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_TICK)); SendDlgItemMessage(hwndDlg, IDC_BTN_SELECTALL, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Select All"), BATF_TCHAR); diff --git a/plugins/FTPFileYM/src/utils.cpp b/plugins/FTPFileYM/src/utils.cpp index ad47a3badf..896445784c 100644 --- a/plugins/FTPFileYM/src/utils.cpp +++ b/plugins/FTPFileYM/src/utils.cpp @@ -44,13 +44,20 @@ int Utils::msgBoxA(char *szMsg, UINT uType) return MessageBoxA(hwnd, szMsg, Translate("FTP File"), uType); } -HICON Utils::loadIconEx(char *szName) +HICON Utils::loadIconEx(const char *szName) { char buff[100]; mir_snprintf(buff, "%s_%s", MODULE, szName); return IcoLib_GetIcon(buff); } +HANDLE Utils::getIconHandle(const char *szName) +{ + char buff[100]; + mir_snprintf(buff, "%s_%s", MODULE, szName); + return IcoLib_GetIconHandle(buff); +} + TCHAR* Utils::getFileNameFromPath(TCHAR *stzPath) { TCHAR *pch = _tcsrchr(stzPath, '\\'); diff --git a/plugins/FTPFileYM/src/utils.h b/plugins/FTPFileYM/src/utils.h index 10a0031a09..7c83869ade 100644 --- a/plugins/FTPFileYM/src/utils.h +++ b/plugins/FTPFileYM/src/utils.h @@ -30,7 +30,9 @@ public: static int msgBox(TCHAR *szMsg, UINT uType); static int msgBoxA(char *szMsg, UINT uType); static int getDeleteTimeMin(); - static HICON loadIconEx(char *szName); + + static HICON loadIconEx(const char *szName); + static HANDLE getIconHandle(const char *szName); static TCHAR *getFileNameFromPath(TCHAR *stzPath); static TCHAR *getTextFragment(TCHAR *stzText, size_t length, TCHAR *buff); -- cgit v1.2.3