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/AddContactPlus/src/addcontact.cpp | 11 +- plugins/BasicHistory/src/HistoryWindow.cpp | 12 +- plugins/Clist_nicer/src/clistmenus.cpp | 2 +- plugins/CrashDumper/src/ui.cpp | 10 +- plugins/Db3x_mmap/src/ui.cpp | 2 +- plugins/FTPFileYM/src/dialog.cpp | 2 +- plugins/FTPFileYM/src/manager.cpp | 2 +- plugins/FTPFileYM/src/utils.cpp | 9 +- plugins/FTPFileYM/src/utils.h | 4 +- plugins/FileAsMessage/src/dialog.cpp | 11 +- plugins/FileAsMessage/src/main.cpp | 5 +- plugins/FileAsMessage/src/main.h | 1 + plugins/Import/src/wizard.cpp | 3 +- plugins/MyDetails/src/services.cpp | 178 ++++----- plugins/NewAwaySysMod/src/ReadAwayMsg.cpp | 7 +- plugins/NewAwaySysMod/src/SetAwayMsg.cpp | 10 +- plugins/NotesAndReminders/src/notes.cpp | 12 +- plugins/NotesAndReminders/src/reminders.cpp | 8 +- plugins/PluginUpdater/src/DlgListNew.cpp | 6 +- plugins/PluginUpdater/src/DlgUpdate.cpp | 5 +- plugins/Popup/src/history.cpp | 3 +- plugins/Quotes/src/CurrencyConverter.cpp | 9 +- plugins/SMS/src/senddlg.cpp | 2 +- plugins/SeenPlugin/src/history.cpp | 3 +- plugins/SeenPlugin/src/stdafx.h | 1 + plugins/SendScreenshotPlus/src/CSend.cpp | 2 +- plugins/SendScreenshotPlus/src/UAboutForm.cpp | 3 +- plugins/SendScreenshotPlus/src/UMainForm.cpp | 4 +- plugins/SimpleStatusMsg/src/awaymsg.cpp | 196 +++++---- plugins/SimpleStatusMsg/src/msgbox.cpp | 10 +- plugins/SpellChecker/src/ardialog.cpp | 4 +- plugins/TabSRMM/src/containeroptions.cpp | 548 +++++++++++++------------- plugins/TabSRMM/src/generic_msghandlers.cpp | 2 +- plugins/TabSRMM/src/utils.cpp | 3 +- plugins/UserInfoEx/src/dlg_propsheet.cpp | 4 +- plugins/Weather/src/weather_ini.cpp | 6 +- plugins/Weather/src/weather_userinfo.cpp | 12 +- plugins/WhenWasIt/src/dlg_handlers.cpp | 12 +- plugins/YAMN/src/browser/badconnect.cpp | 3 +- plugins/YAMN/src/browser/mailbrowser.cpp | 11 +- plugins/YAPP/src/yapp_history_dlg.cpp | 5 +- 41 files changed, 552 insertions(+), 591 deletions(-) (limited to 'plugins') diff --git a/plugins/AddContactPlus/src/addcontact.cpp b/plugins/AddContactPlus/src/addcontact.cpp index e4138f02ec..3acc9154e0 100644 --- a/plugins/AddContactPlus/src/addcontact.cpp +++ b/plugins/AddContactPlus/src/addcontact.cpp @@ -164,8 +164,8 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) Utils_RestoreWindowPositionNoSize(hdlg, NULL, "AddContact", ""); TranslateDialogDefault(hdlg); - SendMessage(hdlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(ICON_ADD,1)); - SendMessage(hdlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(ICON_ADD)); + Window_SetIcon_IcoLib(hdlg, IcoLib_GetIconHandle(ICON_ADD)); + HookEventMessage(ME_SKIN2_ICONSCHANGED, hdlg, DM_ADDCONTACT_CHANGEICONS); HookEventMessage(ME_PROTO_ACCLISTCHANGED, hdlg, DM_ADDCONTACT_CHANGEACCLIST); { @@ -324,8 +324,8 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) break; case DM_ADDCONTACT_CHANGEICONS: - IcoLib_ReleaseIcon((HICON)SendMessage(hdlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(ICON_ADD, 1))); - IcoLib_ReleaseIcon((HICON)SendMessage(hdlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(ICON_ADD))); + Window_FreeIcon_IcoLib(hdlg); + Window_SetIcon_IcoLib(hdlg, IcoLib_GetIconHandle(ICON_ADD)); break; case DM_ADDCONTACT_CHANGEACCLIST: @@ -334,8 +334,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) case WM_DESTROY: hAddDlg = NULL; - IcoLib_ReleaseIcon((HICON)SendMessage(hdlg, WM_SETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(hdlg, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(hdlg); ImageList_Destroy((HIMAGELIST)SendDlgItemMessage(hdlg, IDC_PROTO, CBEM_GETIMAGELIST, 0, 0)); if (acs) { db_set_s(NULL, "AddContact", "LastProto", acs->proto); diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index a1ad2df7d8..8cc82337da 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -1006,8 +1006,8 @@ void HistoryWindow::Initialise() ResetCList(m_hWnd); RestorePos(); - SendMessage(m_hWnd, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_HISTORY, true)); - SendMessage(m_hWnd, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_HISTORY)); + Window_SetSkinIcon_IcoLib(m_hWnd, SKINICON_OTHER_HISTORY); + SendMessage(editWindow, EM_AUTOURLDETECT, TRUE, 0); SendMessage(editWindow, EM_SETEVENTMASK, 0, ENM_LINK | ENM_SELCHANGE | ENM_KEYEVENTS | ENM_MOUSEEVENTS); SendMessage(editWindow, EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR); @@ -1098,13 +1098,9 @@ void HistoryWindow::Initialise() void HistoryWindow::Destroy() { - HICON hIcon = (HICON)SendMessage(m_hWnd, WM_SETICON, ICON_BIG, 0); - IcoLib_ReleaseIcon(hIcon); - - hIcon = (HICON)SendMessage(m_hWnd, WM_SETICON, ICON_SMALL, 0); - IcoLib_ReleaseIcon(hIcon); - + Window_FreeIcon_IcoLib(m_hWnd); isDestroyed = true; + HistoryWindow::Close(this); } diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp index 203f0faf2f..89b287527c 100644 --- a/plugins/Clist_nicer/src/clistmenus.cpp +++ b/plugins/Clist_nicer/src/clistmenus.cpp @@ -105,7 +105,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA mir_sntprintf(szTitle, TranslateT("Contact list display and ignore options for %s"), contact ? contact->szText : pcli->pfnGetContactDisplayName(hContact, 0)); SetWindowText(hWnd, szTitle); - SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_MIRANDA)); + Window_SetSkinIcon_IcoLib(hWnd, SKINICON_OTHER_MIRANDA); pCaps = CallProtoService(contact ? contact->proto : GetContactProto(hContact), PS_GETCAPS, PFLAGNUM_1, 0); Utils::enableDlgControl(hWnd, IDC_IGN_ALWAYSONLINE, pCaps & PF1_INVISLIST ? TRUE : FALSE); Utils::enableDlgControl(hWnd, IDC_IGN_ALWAYSOFFLINE, pCaps & PF1_VISLIST ? TRUE : FALSE); diff --git a/plugins/CrashDumper/src/ui.cpp b/plugins/CrashDumper/src/ui.cpp index 41cc0f34fb..34f82b15a3 100644 --- a/plugins/CrashDumper/src/ui.cpp +++ b/plugins/CrashDumper/src/ui.cpp @@ -64,10 +64,8 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); + Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_VI)); { - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx(IDI_VI, true)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx(IDI_VI)); - CHARFORMAT2 chf; chf.cbSize = sizeof(chf); SendDlgItemMessage(hwndDlg, IDC_VIEWVERSIONINFO, EM_GETCHARFORMAT, SCF_DEFAULT, (LPARAM)&chf); @@ -165,8 +163,7 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara case WM_DESTROY: hViewWnd = NULL; - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(hwndDlg); Utils_SaveWindowPosition(hwndDlg, NULL, PluginName, "ViewInfo_"); if (servicemode) PostQuitMessage(0); @@ -291,8 +288,7 @@ LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) break; case UM_FREEPLUGINDATA: - IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(hWnd); break; } diff --git a/plugins/Db3x_mmap/src/ui.cpp b/plugins/Db3x_mmap/src/ui.cpp index aab9ca348e..e29e8f0ec2 100644 --- a/plugins/Db3x_mmap/src/ui.cpp +++ b/plugins/Db3x_mmap/src/ui.cpp @@ -229,7 +229,7 @@ static INT_PTR CALLBACK sttChangePassword(HWND hwndDlg, UINT uMsg, WPARAM wParam case WM_DESTROY: KillTimer(hwndDlg, 1); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(hwndDlg); } return FALSE; 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); diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp index 5c2329fcc5..8092c804a8 100644 --- a/plugins/FileAsMessage/src/dialog.cpp +++ b/plugins/FileAsMessage/src/dialog.cpp @@ -994,12 +994,9 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) hwndStatus = CreateStatusWindow(WS_CHILD | WS_VISIBLE, "", hDlg, IDC_STATUS); SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)dat); WindowList_Add(hFileList, hDlg, dat->hContact); - SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcons[ICON_MAIN]); - SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcons[ICON_MAIN]); + Window_SetIcon_IcoLib(hDlg, iconList[ICON_MAIN].hIcolib); SendDlgItemMessage(hDlg, IDC_STOP, BUTTONADDTOOLTIP, (WPARAM)Translate(hint_controls[ICON_STOP]), 0); - //SetDlgItemText(hDlg, IDC_FILENAME, "C:\\!Developer\\!Miranda\\miranda\\bin\\release\\emo\\biggrin.gif"); - mir_subclassWindow(GetDlgItem(hDlg, IDC_PROGRESS), ProgressWndProc); SendDlgItemMessage(hDlg, IDC_PLAY, BUTTONSETASFLATBTN, 0, 0); @@ -1008,9 +1005,6 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) SendDlgItemMessage(hDlg, IDC_STOP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcons[ICON_STOP]); dat->setState(STATE_IDLE); - //ShowWindow(hDlg, SW_HIDE); - //UpdateWindow(hDlg); - if (dat->inSend) PostMessage(hDlg, WM_COMMAND, IDC_BROWSE, NULL); @@ -1024,8 +1018,7 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) return TRUE; } case WM_FE_SKINCHANGE: - SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcons[ICON_MAIN]); - SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcons[ICON_MAIN]); + Window_SetIcon_IcoLib(hDlg, iconList[ICON_MAIN].hIcolib); dat->setState(dat->iState); SendDlgItemMessage(hDlg, IDC_STOP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcons[ICON_STOP]); diff --git a/plugins/FileAsMessage/src/main.cpp b/plugins/FileAsMessage/src/main.cpp index 71adae048a..3345635863 100644 --- a/plugins/FileAsMessage/src/main.cpp +++ b/plugins/FileAsMessage/src/main.cpp @@ -26,7 +26,7 @@ HANDLE hHookDbSettingChange, hHookContactAdded, hHookSkinIconsChanged; HICON hIcons[5]; -static IconItem iconList[] = +IconItem iconList[] = { { LPGEN("Play"), "FePlay", IDI_PLAY }, { LPGEN("Pause"), "FePause", IDI_PAUSE }, @@ -47,7 +47,6 @@ int OnSkinIconsChanged(WPARAM wParam, LPARAM lParam) hIcons[indx] = IcoLib_GetIconByHandle(iconList[indx].hIcolib); WindowList_Broadcast(hFileList, WM_FE_SKINCHANGE, 0, 0); - return 0; } @@ -181,7 +180,7 @@ static int OnModulesLoaded(WPARAM wparam, LPARAM lparam) CMenuItem mi; SET_UID(mi, 0xe4a98d2a, 0xa54a, 0x4db1, 0x8d, 0x29, 0xd, 0x5c, 0xf1, 0x10, 0x69, 0x35); mi.position = 200011; - mi.hIcolibItem = hIcons[ICON_MAIN]; + mi.hIcolibItem = iconList[ICON_MAIN].hIcolib; mi.name.a = LPGEN("File As Message..."); mi.pszService = SERVICE_NAME "/FESendFile"; mi.flags = CMIF_NOTOFFLINE; diff --git a/plugins/FileAsMessage/src/main.h b/plugins/FileAsMessage/src/main.h index 1063fb8668..f828789264 100644 --- a/plugins/FileAsMessage/src/main.h +++ b/plugins/FileAsMessage/src/main.h @@ -45,6 +45,7 @@ extern MWindowList hFileList; extern HANDLE hEventNewFile; extern HICON hIcons[5]; +extern IconItem iconList[]; ulong memcrc32(uchar *ptr, int size, ulong crc); INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); diff --git a/plugins/Import/src/wizard.cpp b/plugins/Import/src/wizard.cpp index 2c22254df5..7232aec1fd 100644 --- a/plugins/Import/src/wizard.cpp +++ b/plugins/Import/src/wizard.cpp @@ -99,8 +99,7 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP SetWindowPos(hwndPage, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE); ShowWindow(hwndPage, SW_SHOW); ShowWindow(hdlg, SW_SHOW); - SendMessage(hdlg, WM_SETICON, ICON_SMALL, (LPARAM)GetIcon(IDI_IMPORT)); - SendMessage(hdlg, WM_SETICON, ICON_BIG, (LPARAM)GetIcon(IDI_IMPORT, true)); + Window_SetIcon_IcoLib(hdlg, GetIconHandle(IDI_IMPORT)); return TRUE; case WIZM_GOTOPAGE: diff --git a/plugins/MyDetails/src/services.cpp b/plugins/MyDetails/src/services.cpp index f4e3d4f616..16fcf7eb93 100644 --- a/plugins/MyDetails/src/services.cpp +++ b/plugins/MyDetails/src/services.cpp @@ -38,72 +38,72 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam return TRUE; case WMU_SETDATA: - { - int proto_num = (int)wParam; + { + int proto_num = (int)wParam; - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, proto_num); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, proto_num); - if (proto_num == -1) { - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_MIRANDA)); + if (proto_num == -1) { + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_MIRANDA); - // All protos have the same nick? - if (protocols->GetSize() > 0) { - TCHAR *nick = protocols->Get(0)->nickname; + // All protos have the same nick? + if (protocols->GetSize() > 0) { + TCHAR *nick = protocols->Get(0)->nickname; - bool foundDefNick = true; - for (int i = 1; foundDefNick && i < protocols->GetSize(); i++) { - if (mir_tstrcmpi(protocols->Get(i)->nickname, nick) != 0) { - foundDefNick = false; - break; + bool foundDefNick = true; + for (int i = 1; foundDefNick && i < protocols->GetSize(); i++) { + if (mir_tstrcmpi(protocols->Get(i)->nickname, nick) != 0) { + foundDefNick = false; + break; + } } + + if (foundDefNick) + if (mir_tstrcmpi(protocols->default_nick, nick) != 0) + mir_tstrcpy(protocols->default_nick, nick); } - if (foundDefNick) - if (mir_tstrcmpi(protocols->default_nick, nick) != 0) - mir_tstrcpy(protocols->default_nick, nick); + SetDlgItemText(hwndDlg, IDC_NICKNAME, protocols->default_nick); + SendDlgItemMessage(hwndDlg, IDC_NICKNAME, EM_LIMITTEXT, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE, 0); } + else { + Protocol *proto = protocols->Get(proto_num); - SetDlgItemText(hwndDlg, IDC_NICKNAME, protocols->default_nick); - SendDlgItemMessage(hwndDlg, IDC_NICKNAME, EM_LIMITTEXT, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE, 0); - } - else { - Protocol *proto = protocols->Get(proto_num); + TCHAR tmp[128]; + mir_sntprintf(tmp, TranslateT("Set my nickname for %s"), proto->description); - TCHAR tmp[128]; - mir_sntprintf(tmp, TranslateT("Set my nickname for %s"), proto->description); + SetWindowText(hwndDlg, tmp); - SetWindowText(hwndDlg, tmp); + HICON hIcon = (HICON)CallProtoService(proto->name, PS_LOADICON, PLI_PROTOCOL, 0); + if (hIcon != NULL) { + SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon); + DestroyIcon(hIcon); + } - HICON hIcon = (HICON)CallProtoService(proto->name, PS_LOADICON, PLI_PROTOCOL, 0); - if (hIcon != NULL) { - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon); - DestroyIcon(hIcon); + SetDlgItemText(hwndDlg, IDC_NICKNAME, proto->nickname); + SendDlgItemMessage(hwndDlg, IDC_NICKNAME, EM_LIMITTEXT, + min(MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE, proto->GetNickMaxLength()), 0); } - SetDlgItemText(hwndDlg, IDC_NICKNAME, proto->nickname); - SendDlgItemMessage(hwndDlg, IDC_NICKNAME, EM_LIMITTEXT, - min(MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE, proto->GetNickMaxLength()), 0); + return TRUE; } - return TRUE; - } - case WM_COMMAND: switch (wParam) { case IDOK: - { - TCHAR tmp[MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE]; - GetDlgItemText(hwndDlg, IDC_NICKNAME, tmp, _countof(tmp)); + { + TCHAR tmp[MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE]; + GetDlgItemText(hwndDlg, IDC_NICKNAME, tmp, _countof(tmp)); - LONG_PTR proto_num = GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - if (proto_num == -1) - protocols->SetNicks(tmp); - else - protocols->Get(proto_num)->SetNick(tmp); + LONG_PTR proto_num = GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + if (proto_num == -1) + protocols->SetNicks(tmp); + else + protocols->Get(proto_num)->SetNick(tmp); - DestroyWindow(hwndDlg); - break; - } + DestroyWindow(hwndDlg); + break; + } case IDCANCEL: DestroyWindow(hwndDlg); break; @@ -300,7 +300,8 @@ static LRESULT CALLBACK StatusMsgEditSubclassProc(HWND hwnd, UINT msg, WPARAM wP return mir_callNextSubclass(hwnd, StatusMsgEditSubclassProc, msg, wParam, lParam); } -struct SetStatusMessageData { +struct SetStatusMessageData +{ int status; int proto_num; }; @@ -315,64 +316,64 @@ static INT_PTR CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM w return TRUE; case WMU_SETDATA: - { - SetStatusMessageData *data = (SetStatusMessageData *)malloc(sizeof(SetStatusMessageData)); - data->status = (int)wParam; - data->proto_num = (int)lParam; + { + SetStatusMessageData *data = (SetStatusMessageData *)malloc(sizeof(SetStatusMessageData)); + data->status = (int)wParam; + data->proto_num = (int)lParam; - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)data); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)data); - if (data->proto_num >= 0) { - Protocol *proto = protocols->Get(data->proto_num); + if (data->proto_num >= 0) { + Protocol *proto = protocols->Get(data->proto_num); - HICON hIcon = (HICON)CallProtoService(proto->name, PS_LOADICON, PLI_PROTOCOL, 0); - if (hIcon != NULL) { - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon); - DestroyIcon(hIcon); - } + HICON hIcon = (HICON)CallProtoService(proto->name, PS_LOADICON, PLI_PROTOCOL, 0); + if (hIcon != NULL) { + SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon); + DestroyIcon(hIcon); + } - TCHAR title[256]; - mir_sntprintf(title, TranslateT("Set my status message for %s"), proto->description); - SetWindowText(hwndDlg, title); + TCHAR title[256]; + mir_sntprintf(title, TranslateT("Set my status message for %s"), proto->description); + SetWindowText(hwndDlg, title); - SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, proto->GetStatusMsg()); - } - else if (data->status != 0) { - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadProtoIcon(NULL, data->status)); + SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, proto->GetStatusMsg()); + } + else if (data->status != 0) { + Window_SetProtoIcon_IcoLib(hwndDlg, NULL, data->status); - TCHAR title[256]; - mir_sntprintf(title, TranslateT("Set my status message for %s"), pcli->pfnGetStatusModeDescription(data->status, 0)); - SetWindowText(hwndDlg, title); + TCHAR title[256]; + mir_sntprintf(title, TranslateT("Set my status message for %s"), pcli->pfnGetStatusModeDescription(data->status, 0)); + SetWindowText(hwndDlg, title); - SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, protocols->GetDefaultStatusMsg(data->status)); - } - else { - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_MIRANDA)); + SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, protocols->GetDefaultStatusMsg(data->status)); + } + else { + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_MIRANDA); - SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, protocols->GetDefaultStatusMsg()); + SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, protocols->GetDefaultStatusMsg()); + } } - return TRUE; - } + case WM_COMMAND: switch (wParam) { case IDOK: - { - TCHAR tmp[MS_MYDETAILS_GETMYSTATUSMESSAGE_BUFFER_SIZE]; - GetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, tmp, _countof(tmp)); + { + TCHAR tmp[MS_MYDETAILS_GETMYSTATUSMESSAGE_BUFFER_SIZE]; + GetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, tmp, _countof(tmp)); - SetStatusMessageData *data = (SetStatusMessageData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + SetStatusMessageData *data = (SetStatusMessageData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - if (data->proto_num >= 0) - protocols->Get(data->proto_num)->SetStatusMsg(tmp); - else if (data->status == 0) - protocols->SetStatusMsgs(tmp); - else - protocols->SetStatusMsgs(data->status, tmp); + if (data->proto_num >= 0) + protocols->Get(data->proto_num)->SetStatusMsg(tmp); + else if (data->status == 0) + protocols->SetStatusMsgs(tmp); + else + protocols->SetStatusMsgs(data->status, tmp); - DestroyWindow(hwndDlg); - } - break; + DestroyWindow(hwndDlg); + } + break; case IDCANCEL: DestroyWindow(hwndDlg); @@ -388,6 +389,7 @@ static INT_PTR CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM w SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), GWLP_WNDPROC, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), GWLP_USERDATA)); free((SetStatusMessageData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA)); + Window_FreeIcon_IcoLib(hwndDlg); InterlockedExchange(&status_msg_dialog_open, 0); break; } diff --git a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp index 6eb8f63e33..1be72fc1aa 100644 --- a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp @@ -52,12 +52,9 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_MIRANDA); + Utils_RestoreWindowPosition(hwndDlg, NULL, MOD_NAME, RAMDLGSIZESETTING); { - HICON hTitleIcon = Skin_LoadIcon(SKINICON_OTHER_MIRANDA); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hTitleIcon); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)hTitleIcon); - Utils_RestoreWindowPosition(hwndDlg, NULL, MOD_NAME, RAMDLGSIZESETTING); - READAWAYMSGDATA *awayData = new READAWAYMSGDATA; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)awayData); awayData->hContact = lParam; diff --git a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp index 08a1a30865..87d0a4f376 100644 --- a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp @@ -479,20 +479,12 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA g_SetAwayMsgPage.SetWnd(hwndDlg); g_SetAwayMsgPage.DBToMemToPage(); - HICON hTitleIconBigElse = Skin_LoadIcon(SKINICON_OTHER_MIRANDA, true); - char *szProto = dat->hInitContact ? GetContactProto(dat->hInitContact) : dat->szProtocol; int Status = 0; Status = g_ProtoStates[dat->szProtocol].m_status; - HICON hTitleIcon = Skin_LoadProtoIcon(szProto, Status); - HICON hTitleIconBig = Skin_LoadProtoIcon(szProto, Status, true); - if (hTitleIconBig == NULL || (HICON)CALLSERVICE_NOTFOUND == hTitleIconBig) - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hTitleIconBigElse); - else - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hTitleIconBig); + Window_SetProtoIcon_IcoLib(hwndDlg, szProto, Status); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)hTitleIcon); SendDlgItemMessage(hwndDlg, IDC_SAWAYMSG_MSGDATA, EM_LIMITTEXT, AWAY_MSGDATA_MAX, 0); SendDlgItemMessage(hwndDlg, IDC_SAWAYMSG_STATIC_IGNOREICON, STM_SETIMAGE, IMAGE_ICON, (LPARAM)GetIcon(IDI_IGNORE)); diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp index b017f04e94..06e3c87cc0 100644 --- a/plugins/NotesAndReminders/src/notes.cpp +++ b/plugins/NotesAndReminders/src/notes.cpp @@ -1921,12 +1921,7 @@ INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog,UINT Message,WPARAM wParam,LPARAM break; case WM_INITDIALOG: { - HWND H; - - HICON hIcon = IcoLib_GetIconByHandle(iconList[13].hIcolib, ICON_SMALL); - SendMessage(Dialog, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)hIcon); - hIcon = IcoLib_GetIconByHandle(iconList[13].hIcolib, ICON_BIG); - SendMessage(Dialog, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)hIcon); + Window_SetIcon_IcoLib(Dialog, iconList[13].hIcolib); SetWindowText(Dialog, LPGENT("Notes")); @@ -1934,7 +1929,7 @@ INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog,UINT Message,WPARAM wParam,LPARAM SetDlgItemText(Dialog,IDC_REMINDERDATA, _T("")); - H = GetDlgItem(Dialog,IDC_LISTREMINDERS); + HWND H = GetDlgItem(Dialog,IDC_LISTREMINDERS); lvCol.mask = LVCF_TEXT | LVCF_WIDTH; S = TranslateT("Note text"); @@ -1984,8 +1979,7 @@ INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog,UINT Message,WPARAM wParam,LPARAM case WM_DESTROY: ListNotesVisible = FALSE; - IcoLib_ReleaseIcon((HICON)SendMessage(Dialog, WM_SETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(Dialog, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(Dialog); return TRUE; case WM_NOTIFY: diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp index 42f011736e..ffea8e7052 100644 --- a/plugins/NotesAndReminders/src/reminders.cpp +++ b/plugins/NotesAndReminders/src/reminders.cpp @@ -2398,10 +2398,7 @@ INT_PTR CALLBACK DlgProcViewReminders(HWND Dialog,UINT Message,WPARAM wParam,LPA break; case WM_INITDIALOG: { - HICON hIcon = IcoLib_GetIconByHandle(iconList[6].hIcolib, ICON_SMALL); - SendMessage(Dialog, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)hIcon); - hIcon = IcoLib_GetIconByHandle(iconList[6].hIcolib, ICON_BIG); - SendMessage(Dialog, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)hIcon); + Window_SetIcon_IcoLib(Dialog, iconList[6].hIcolib); TranslateDialogDefault(Dialog); SetDlgItemText(Dialog,IDC_REMINDERDATA, _T("")); @@ -2542,8 +2539,7 @@ INT_PTR CALLBACK DlgProcViewReminders(HWND Dialog,UINT Message,WPARAM wParam,LPA } } case WM_DESTROY: - IcoLib_ReleaseIcon((HICON)SendMessage(Dialog, WM_SETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(Dialog, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(Dialog); break; } return FALSE; diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp index 0bd2dd9a0e..6f15fc8024 100644 --- a/plugins/PluginUpdater/src/DlgListNew.cpp +++ b/plugins/PluginUpdater/src/DlgListNew.cpp @@ -153,8 +153,7 @@ INT_PTR CALLBACK DlgList(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) TranslateDialogDefault( hDlg ); oldWndProc = (WNDPROC)SetWindowLongPtr(hwndList, GWLP_WNDPROC, (LONG_PTR)PluginListWndProc); - SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(iconList[2].hIcolib, 1)); - SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(iconList[2].hIcolib)); + Window_SetIcon_IcoLib(hDlg, iconList[2].hIcolib); { HIMAGELIST hIml = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 4, 0); ImageList_AddIconFromIconLib(hIml, 1); @@ -328,8 +327,7 @@ INT_PTR CALLBACK DlgList(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_DESTROY: Utils_SaveWindowPosition(hDlg, NULL, MODNAME, "ListWindow"); - IcoLib_ReleaseIcon((HICON)SendMessage(hDlg, WM_SETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(hDlg, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(hDlg); hwndDialog = NULL; delete (OBJLIST *)GetWindowLongPtr(hDlg, GWLP_USERDATA); SetWindowLongPtr(hDlg, GWLP_USERDATA, 0); diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 413c4bff83..f81db0c705 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -167,8 +167,7 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM TranslateDialogDefault(hDlg); SendMessage(hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES); #if MIRANDA_VER >= 0x0A00 - SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(iconList[0].hIcolib)); - SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(iconList[0].hIcolib, 1)); + Window_SetIcon_IcoLib(hDlg, iconList[0].hIcolib); #else SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon("check_update")); SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon("check_update",1)); @@ -349,7 +348,7 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM break; case WM_DESTROY: - IcoLib_ReleaseIcon((HICON)SendMessage(hDlg, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(hDlg); Utils_SaveWindowPosition(hDlg, NULL, MODNAME, "ConfirmWindow"); hwndDialog = NULL; delete (OBJLIST *)GetWindowLongPtr(hDlg, GWLP_USERDATA); diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp index 5f7c6cf14c..e341bc103b 100644 --- a/plugins/Popup/src/history.cpp +++ b/plugins/Popup/src/history.cpp @@ -130,8 +130,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara for (int i = 0; i < arPopupHistory.getCount(); ++i) ListBox_SetItemData(hwndList, ListBox_AddString(hwndList, _T("")), 0); - SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx(IDI_HISTORY, false)); - SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx(IDI_HISTORY, true)); + Window_SetIcon_IcoLib(hwnd, GetIconHandle(IDI_HISTORY)); if (gbHppInstalled && PopupOptions.UseHppHistoryLog) { logType = LOG_HPP; diff --git a/plugins/Quotes/src/CurrencyConverter.cpp b/plugins/Quotes/src/CurrencyConverter.cpp index 874eaa626b..9836b1e365 100644 --- a/plugins/Quotes/src/CurrencyConverter.cpp +++ b/plugins/Quotes/src/CurrencyConverter.cpp @@ -89,8 +89,7 @@ INT_PTR CALLBACK CurrencyConverterDlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM assert(hWL); WindowList_Add(hWL, hDlg, NULL); - ::SendMessage(hDlg, WM_SETICON, FALSE, LPARAM(Quotes_LoadIconEx(IDI_ICON_CURRENCY_CONVERTER))); - ::SendMessage(hDlg, WM_SETICON, TRUE, LPARAM(Quotes_LoadIconEx(IDI_ICON_CURRENCY_CONVERTER, true))); + Window_SetIcon_IcoLib(hDlg, Quotes_GetIconHandle(IDI_ICON_CURRENCY_CONVERTER)); HWND hcbxFrom = ::GetDlgItem(hDlg, IDC_COMBO_CONVERT_FROM); HWND hcbxTo = ::GetDlgItem(hDlg, IDC_COMBO_CONVERT_INTO); @@ -146,7 +145,11 @@ INT_PTR CALLBACK CurrencyConverterDlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM EndDialog(hDlg, 0); } return TRUE; - + + case WM_DESTROY: + Window_FreeIcon_IcoLib(hDlg); + break; + case WM_COMMAND: switch (LOWORD(wp)) { case IDC_COMBO_CONVERT_FROM: diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp index 0f9a499655..f43e280559 100644 --- a/plugins/SMS/src/senddlg.cpp +++ b/plugins/SMS/src/senddlg.cpp @@ -86,7 +86,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA mir_subclassWindow(GetDlgItem(hWndDlg, IDC_MESSAGE), MessageSubclassProc); - SendMessage(hWndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_SMS)); + Window_SetSkinIcon_IcoLib(hWndDlg, SKINICON_OTHER_SMS); SendDlgItemMessage(hWndDlg, IDC_HISTORY, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_HISTORY)); { HICON hIcon; diff --git a/plugins/SeenPlugin/src/history.cpp b/plugins/SeenPlugin/src/history.cpp index 2f22076d5d..fd214f674c 100644 --- a/plugins/SeenPlugin/src/history.cpp +++ b/plugins/SeenPlugin/src/history.cpp @@ -178,8 +178,7 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA pcli->pfnGetContactDisplayName(hContact, 0), TranslateT("last seen history")); SetWindowText(hwndDlg, sztemp); - SendMessage(hwndDlg, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_MIRANDA)); - SendMessage(hwndDlg, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_MIRANDA)); + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_MIRANDA); if (db_get_b(hContact, S_MOD, "OnlineAlert", 0)) CheckDlgButton(hwndDlg, IDC_STATUSCHANGE, BST_CHECKED); diff --git a/plugins/SeenPlugin/src/stdafx.h b/plugins/SeenPlugin/src/stdafx.h index 09aac51737..c1371e94ed 100644 --- a/plugins/SeenPlugin/src/stdafx.h +++ b/plugins/SeenPlugin/src/stdafx.h @@ -36,6 +36,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include #include #include #include diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index 4c35fd5a52..b2524bf315 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -91,8 +91,8 @@ INT_PTR CALLBACK CSend::ResultDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, switch (uMsg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); + Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(ICO_MAIN)); { - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)GetIcon(ICO_MAIN)); CSend* self = (CSend*)lParam; TCHAR* tmp = mir_tstrdup(TranslateT("Resulting URL from\n")); mir_tstradd(tmp, self->m_pszSendTyp); diff --git a/plugins/SendScreenshotPlus/src/UAboutForm.cpp b/plugins/SendScreenshotPlus/src/UAboutForm.cpp index aa9fb69f7f..f11938d868 100644 --- a/plugins/SendScreenshotPlus/src/UAboutForm.cpp +++ b/plugins/SendScreenshotPlus/src/UAboutForm.cpp @@ -123,8 +123,7 @@ LRESULT TfrmAbout::wmInitdialog(WPARAM, LPARAM) mir_free(pszText); } - SendMessage(m_hWnd, WM_SETICON, ICON_BIG, (LPARAM)GetIcon(ICO_MAIN)); - SendMessage(m_hWnd, WM_SETICON, ICON_SMALL, (LPARAM)GetIcon(ICO_MAINXS)); + Window_SetIcon_IcoLib(m_hWnd, GetIconHandle(ICO_MAIN)); //init controls btnPageClick(); diff --git a/plugins/SendScreenshotPlus/src/UMainForm.cpp b/plugins/SendScreenshotPlus/src/UMainForm.cpp index cca5519a55..2832444bef 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.cpp +++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp @@ -173,8 +173,8 @@ void TfrmMain::wmInitdialog(WPARAM, LPARAM) { HWND hCtrl; /// Taskbar and Window icon - SendMessage(m_hWnd, WM_SETICON, ICON_BIG, (LPARAM)GetIcon(ICO_MAIN)); - SendMessage(m_hWnd, WM_SETICON, ICON_SMALL, (LPARAM)GetIcon(ICO_MAINXS)); + Window_SetIcon_IcoLib(m_hWnd, GetIconHandle(ICO_MAIN)); + TCHAR *pt = mir_tstrdup(pcli->pfnGetContactDisplayName(m_hContact, 0)); if (pt && (m_hContact != 0)) { CMString string; diff --git a/plugins/SimpleStatusMsg/src/awaymsg.cpp b/plugins/SimpleStatusMsg/src/awaymsg.cpp index cb3d7eaf0c..1671584e39 100644 --- a/plugins/SimpleStatusMsg/src/awaymsg.cpp +++ b/plugins/SimpleStatusMsg/src/awaymsg.cpp @@ -69,42 +69,41 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP AwayMsgDlgData *dat = (AwayMsgDlgData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (message) { - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - dat = (AwayMsgDlgData *)mir_alloc(sizeof(AwayMsgDlgData)); - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + dat = (AwayMsgDlgData *)mir_alloc(sizeof(AwayMsgDlgData)); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); + + dat->hContact = lParam; + dat->hSeq = (HANDLE)CallContactService(dat->hContact, PSS_GETAWAYMSG, 0, 0); + dat->hAwayMsgEvent = dat->hSeq ? HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_AWAYMSG) : NULL; + WindowList_Add(hWindowList, hwndDlg, dat->hContact); + { + TCHAR str[256], format[128]; + TCHAR *contactName = (TCHAR *)pcli->pfnGetContactDisplayName(dat->hContact, 0); + char *szProto = GetContactProto(dat->hContact); + WORD dwStatus = db_get_w(dat->hContact, szProto, "Status", ID_STATUS_OFFLINE); + TCHAR *status = pcli->pfnGetStatusModeDescription(dwStatus, 0); - dat->hContact = lParam; - dat->hSeq = (HANDLE)CallContactService(dat->hContact, PSS_GETAWAYMSG, 0, 0); - dat->hAwayMsgEvent = dat->hSeq ? HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_AWAYMSG) : NULL; - WindowList_Add(hWindowList, hwndDlg, dat->hContact); - { - TCHAR str[256], format[128]; - TCHAR *contactName = (TCHAR *)pcli->pfnGetContactDisplayName(dat->hContact, 0); - char *szProto = GetContactProto(dat->hContact); - WORD dwStatus = db_get_w(dat->hContact, szProto, "Status", ID_STATUS_OFFLINE); - TCHAR *status = pcli->pfnGetStatusModeDescription(dwStatus, 0); - - GetWindowText(hwndDlg, format, _countof(format)); - mir_sntprintf(str, format, status, contactName); - SetWindowText(hwndDlg, str); - if (dat->hSeq) { - GetDlgItemText(hwndDlg, IDC_RETRIEVING, format, _countof(format)); - mir_sntprintf(str, format, status); - } - else { - mir_sntprintf(str, TranslateT("Failed to retrieve %s message."), status); - SetDlgItemText(hwndDlg, IDOK, TranslateT("&Close")); - } - SetDlgItemText(hwndDlg, IDC_RETRIEVING, str); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadProtoIcon(szProto, dwStatus)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadProtoIcon(szProto, dwStatus)); - EnableWindow(GetDlgItem(hwndDlg, IDC_COPY), FALSE); + GetWindowText(hwndDlg, format, _countof(format)); + mir_sntprintf(str, format, status, contactName); + SetWindowText(hwndDlg, str); + if (dat->hSeq) { + GetDlgItemText(hwndDlg, IDC_RETRIEVING, format, _countof(format)); + mir_sntprintf(str, format, status); + } + else { + mir_sntprintf(str, TranslateT("Failed to retrieve %s message."), status); + SetDlgItemText(hwndDlg, IDOK, TranslateT("&Close")); } - Utils_RestoreWindowPosition(hwndDlg, lParam, "SRAway", "AwayMsgDlg"); - return TRUE; + SetDlgItemText(hwndDlg, IDC_RETRIEVING, str); + Window_SetProtoIcon_IcoLib(hwndDlg, szProto, dwStatus); + EnableWindow(GetDlgItem(hwndDlg, IDC_COPY), FALSE); + } + Utils_RestoreWindowPosition(hwndDlg, lParam, "SRAway", "AwayMsgDlg"); + return TRUE; - case HM_AWAYMSG: + case HM_AWAYMSG: { ACKDATA *ack = (ACKDATA *)lParam; if (ack->hContact != dat->hContact || ack->type != ACKTYPE_AWAYMSG) @@ -128,53 +127,52 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP break; } - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDCANCEL: - case IDOK: - DestroyWindow(hwndDlg); - break; + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDCANCEL: + case IDOK: + DestroyWindow(hwndDlg); + break; - case IDC_COPY: - if (!OpenClipboard(hwndDlg)) + case IDC_COPY: + if (!OpenClipboard(hwndDlg)) + break; + if (EmptyClipboard()) { + TCHAR msg[1024]; + int len = GetDlgItemText(hwndDlg, IDC_MSG, msg, _countof(msg)); + if (len) { + LPTSTR lptstrCopy; + HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(TCHAR)); + if (hglbCopy == NULL) { + CloseClipboard(); break; - if (EmptyClipboard()) { - TCHAR msg[1024]; - int len = GetDlgItemText(hwndDlg, IDC_MSG, msg, _countof(msg)); - if (len) { - LPTSTR lptstrCopy; - HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(TCHAR)); - if (hglbCopy == NULL) { - CloseClipboard(); - break; - } - lptstrCopy = (LPTSTR)GlobalLock(hglbCopy); - memcpy(lptstrCopy, msg, len * sizeof(TCHAR)); - lptstrCopy[len] = (TCHAR)0; - GlobalUnlock(hglbCopy); - - SetClipboardData(CF_UNICODETEXT, hglbCopy); - - } } - CloseClipboard(); - break; - } - break; + lptstrCopy = (LPTSTR)GlobalLock(hglbCopy); + memcpy(lptstrCopy, msg, len * sizeof(TCHAR)); + lptstrCopy[len] = (TCHAR)0; + GlobalUnlock(hglbCopy); - case WM_CLOSE: - DestroyWindow(hwndDlg); - break; + SetClipboardData(CF_UNICODETEXT, hglbCopy); - case WM_DESTROY: - if (dat->hAwayMsgEvent) - UnhookEvent(dat->hAwayMsgEvent); - Utils_SaveWindowPosition(hwndDlg, dat->hContact, "SRAway", "AwayMsgDlg"); - WindowList_Remove(hWindowList, hwndDlg); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, NULL)); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, NULL)); - mir_free(dat); + } + } + CloseClipboard(); break; + } + break; + + case WM_CLOSE: + DestroyWindow(hwndDlg); + break; + + case WM_DESTROY: + if (dat->hAwayMsgEvent) + UnhookEvent(dat->hAwayMsgEvent); + Utils_SaveWindowPosition(hwndDlg, dat->hContact, "SRAway", "AwayMsgDlg"); + WindowList_Remove(hWindowList, hwndDlg); + Window_FreeIcon_IcoLib(hwndDlg); + mir_free(dat); + break; } return FALSE; } @@ -185,8 +183,7 @@ static INT_PTR GetMessageCommand(WPARAM wParam, LPARAM) SetForegroundWindow(hwnd); SetFocus(hwnd); } - else - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_READAWAYMSG), NULL, ReadAwayMsgDlgProc, wParam); + else CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_READAWAYMSG), NULL, ReadAwayMsgDlgProc, wParam); return 0; } @@ -195,12 +192,9 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP AwayMsgDlgData *dat = (AwayMsgDlgData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (message) { - case WM_INITDIALOG: + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); { - TCHAR str[256], format[128]; - TCHAR *contactName; - - TranslateDialogDefault(hwndDlg); dat = (AwayMsgDlgData *)mir_alloc(sizeof(AwayMsgDlgData)); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); @@ -208,16 +202,17 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP dat->hSeq = (HANDLE)CallContactService(dat->hContact, PSS_GETAWAYMSG, 0, 0); dat->hAwayMsgEvent = dat->hSeq ? HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_AWAYMSG) : NULL; WindowList_Add(hWindowList2, hwndDlg, dat->hContact); - contactName = (TCHAR *)pcli->pfnGetContactDisplayName(dat->hContact, 0); + TCHAR *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0); + TCHAR str[256], format[128]; GetWindowText(hwndDlg, format, _countof(format)); mir_sntprintf(str, format, contactName); SetWindowText(hwndDlg, str); if (!dat->hSeq) DestroyWindow(hwndDlg); - return TRUE; } + return TRUE; - case HM_AWAYMSG: + case HM_AWAYMSG: { ACKDATA *ack = (ACKDATA *)lParam; if (ack->hContact != dat->hContact || ack->type != ACKTYPE_AWAYMSG) { @@ -261,27 +256,27 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP } CloseClipboard(); DestroyWindow(hwndDlg); - break; } + break; - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDCANCEL: - case IDOK: - DestroyWindow(hwndDlg); - break; - } - break; - - case WM_CLOSE: + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDCANCEL: + case IDOK: DestroyWindow(hwndDlg); break; + } + break; - case WM_DESTROY: - if (dat->hAwayMsgEvent) UnhookEvent(dat->hAwayMsgEvent); - WindowList_Remove(hWindowList2, hwndDlg); - mir_free(dat); - break; + case WM_CLOSE: + DestroyWindow(hwndDlg); + break; + + case WM_DESTROY: + if (dat->hAwayMsgEvent) UnhookEvent(dat->hAwayMsgEvent); + WindowList_Remove(hWindowList2, hwndDlg); + mir_free(dat); + break; } return FALSE; } @@ -414,6 +409,5 @@ int LoadAwayMsgModule(void) hGoToURLMenuItem = Menu_AddContactMenuItem(&mi); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, AwayMsgPreBuildMenu); - return 0; } diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp index 2e92192c4b..13b3da336a 100644 --- a/plugins/SimpleStatusMsg/src/msgbox.cpp +++ b/plugins/SimpleStatusMsg/src/msgbox.cpp @@ -804,8 +804,8 @@ void ChangeDlgStatus(HWND hwndDlg, struct MsgBoxData *msgbox_data, int iStatus) else if (iStatus > ID_STATUS_CURRENT) iStatus = GetCurrentStatus(NULL); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadProtoIcon(msgbox_data->m_szProto, iStatus))); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadProtoIcon(msgbox_data->m_szProto, iStatus))); + Window_FreeIcon_IcoLib(hwndDlg); + Window_SetProtoIcon_IcoLib(hwndDlg, msgbox_data->m_szProto, iStatus); if (!bDisabled && ((Proto_Status2Flag(iStatus) & msgbox_data->m_iStatusMsgModes) || (iStatus == ID_STATUS_OFFLINE && (Proto_Status2Flag(ID_STATUS_INVISIBLE) & msgbox_data->m_iStatusMsgModes)))) @@ -923,8 +923,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA icoStatus = init_data->m_iStatus; if (icoStatus < ID_STATUS_OFFLINE) icoStatus = ID_STATUS_OFFLINE; - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadProtoIcon(init_data->m_szProto, icoStatus)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadProtoIcon(init_data->m_szProto, icoStatus)); + Window_SetProtoIcon_IcoLib(hwndDlg, init_data->m_szProto, icoStatus); copy_init_data = (struct MsgBoxData *)mir_alloc(sizeof(struct MsgBoxData)); @@ -1615,8 +1614,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA ReleaseIconEx("predef"); ReleaseIconEx("add"); ReleaseIconEx("clear"); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(hwndDlg); hwndSAMsgDialog = NULL; mir_free(msgbox_data); diff --git a/plugins/SpellChecker/src/ardialog.cpp b/plugins/SpellChecker/src/ardialog.cpp index ad468dcef2..3b1258508f 100644 --- a/plugins/SpellChecker/src/ardialog.cpp +++ b/plugins/SpellChecker/src/ardialog.cpp @@ -165,9 +165,7 @@ static INT_PTR CALLBACK AddReplacementDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_OLD), GWLP_USERDATA, (LONG_PTR)data); mir_subclassWindow(GetDlgItem(hwndDlg, IDC_OLD), OnlyCharsEditProc); - HICON hIcon = IcoLib_GetIcon("spellchecker_enabled"); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon); - IcoLib_ReleaseIcon(hIcon); + Window_SetIcon_IcoLib(hwndDlg, IcoLib_GetIconHandle("spellchecker_enabled")); SendDlgItemMessage(hwndDlg, IDC_OLD, EM_LIMITTEXT, 256, 0); SendDlgItemMessage(hwndDlg, IDC_NEW, EM_LIMITTEXT, 256, 0); diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp index de8422eaf1..3ada2917fa 100644 --- a/plugins/TabSRMM/src/containeroptions.cpp +++ b/plugins/TabSRMM/src/containeroptions.cpp @@ -99,7 +99,8 @@ void TSAPI ApplyContainerSetting(TContainerData *pContainer, DWORD flags, UINT m #define NR_O_PAGES 10 #define NR_O_OPTIONSPERPAGE 10 -static struct _tagPages { +static struct _tagPages +{ const TCHAR *szTitle, *szDesc; UINT uIds[10]; } o_pages[] = { @@ -140,98 +141,98 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, TContainerData *pContainer = (TContainerData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { - case WM_INITDIALOG: { - TVINSERTSTRUCT tvis = { 0 }; - int nr_layouts = 0; - const TSideBarLayout *sblayouts = CSideBar::getLayouts(nr_layouts); - - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); - pContainer = (TContainerData*)lParam; - pContainer->hWndOptions = hwndDlg; + case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - SetWindowText(hwndDlg, TranslateT("Container options")); - TCHAR szNewTitle[128]; - mir_sntprintf(szNewTitle, _T("%s"), !mir_tstrcmp(pContainer->szName, _T("default")) ? - TranslateT("Default container") : pContainer->szName); - SetDlgItemText(hwndDlg, IDC_HEADERBAR, szNewTitle); - Utils::enableDlgControl(hwndDlg, IDC_O_HIDETITLE, !CSkin::m_frameSkins); - CheckDlgButton(hwndDlg, IDC_CNTPRIVATE, pContainer->settings->fPrivate ? BST_CHECKED : BST_UNCHECKED); - - SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Tabs at the top")); - SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Tabs at the bottom")); - SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Switch bar on the left side")); - SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Switch bar on the right side")); - - SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Globally on")); - SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("On, if present")); - SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Globally OFF")); - SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("On, if present, always in bottom display")); - - SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("On, if present")); - SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Don't show them")); - - for (int i = 0; i < nr_layouts; i++) - SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_INSERTSTRING, -1, (LPARAM)TranslateTS(sblayouts[i].szName)); - - /* bits 24 - 31 of dwFlagsEx hold the side bar layout id */ - SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_SETCURSEL, (WPARAM)((pContainer->settings->dwFlagsEx & 0xff000000) >> 24), 0); - - - SendMessage(hwndDlg, DM_SC_INITDIALOG, 0, (LPARAM)pContainer->settings); - SendDlgItemMessage(hwndDlg, IDC_TITLEFORMAT, EM_LIMITTEXT, TITLE_FORMATLEN - 1, 0); - SetDlgItemText(hwndDlg, IDC_TITLEFORMAT, pContainer->settings->szTitleFormat); - SetDlgItemText(hwndDlg, IDC_THEME, pContainer->szRelThemeFile); - for (int i = 0; i < NR_O_PAGES; i++) { - tvis.hParent = NULL; - tvis.hInsertAfter = TVI_LAST; - tvis.item.mask = TVIF_TEXT | TVIF_PARAM; - tvis.item.pszText = TranslateTS(o_pages[i].szTitle); - tvis.item.lParam = i; - HTREEITEM hItem = TreeView_InsertItem(hwndTree, &tvis); - if (i == 0) - SendMessage(hwndTree, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem); - for (int j = 0; j < NR_O_OPTIONSPERPAGE && o_pages[i].uIds[j] != 0; j++) - Utils::showDlgControl(hwndDlg, o_pages[i].uIds[j], SW_HIDE); - ShowPage(hwndDlg, i, FALSE); - } - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadIcon(SKINICON_EVENT_MESSAGE)); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_EVENT_MESSAGE, true)); - ShowPage(hwndDlg, 0, TRUE); - SetFocus(hwndTree); - Utils::enableDlgControl(hwndDlg, IDC_APPLY, false); + { + TVINSERTSTRUCT tvis = { 0 }; + int nr_layouts = 0; + const TSideBarLayout *sblayouts = CSideBar::getLayouts(nr_layouts); + + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); + pContainer = (TContainerData*)lParam; + pContainer->hWndOptions = hwndDlg; + SetWindowText(hwndDlg, TranslateT("Container options")); + TCHAR szNewTitle[128]; + mir_sntprintf(szNewTitle, _T("%s"), !mir_tstrcmp(pContainer->szName, _T("default")) ? + TranslateT("Default container") : pContainer->szName); + SetDlgItemText(hwndDlg, IDC_HEADERBAR, szNewTitle); + Utils::enableDlgControl(hwndDlg, IDC_O_HIDETITLE, !CSkin::m_frameSkins); + CheckDlgButton(hwndDlg, IDC_CNTPRIVATE, pContainer->settings->fPrivate ? BST_CHECKED : BST_UNCHECKED); + + SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Tabs at the top")); + SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Tabs at the bottom")); + SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Switch bar on the left side")); + SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Switch bar on the right side")); + + SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Globally on")); + SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("On, if present")); + SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Globally OFF")); + SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("On, if present, always in bottom display")); + + SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("On, if present")); + SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Don't show them")); + + for (int i = 0; i < nr_layouts; i++) + SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_INSERTSTRING, -1, (LPARAM)TranslateTS(sblayouts[i].szName)); + + /* bits 24 - 31 of dwFlagsEx hold the side bar layout id */ + SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_SETCURSEL, (WPARAM)((pContainer->settings->dwFlagsEx & 0xff000000) >> 24), 0); + + + SendMessage(hwndDlg, DM_SC_INITDIALOG, 0, (LPARAM)pContainer->settings); + SendDlgItemMessage(hwndDlg, IDC_TITLEFORMAT, EM_LIMITTEXT, TITLE_FORMATLEN - 1, 0); + SetDlgItemText(hwndDlg, IDC_TITLEFORMAT, pContainer->settings->szTitleFormat); + SetDlgItemText(hwndDlg, IDC_THEME, pContainer->szRelThemeFile); + for (int i = 0; i < NR_O_PAGES; i++) { + tvis.hParent = NULL; + tvis.hInsertAfter = TVI_LAST; + tvis.item.mask = TVIF_TEXT | TVIF_PARAM; + tvis.item.pszText = TranslateTS(o_pages[i].szTitle); + tvis.item.lParam = i; + HTREEITEM hItem = TreeView_InsertItem(hwndTree, &tvis); + if (i == 0) + SendMessage(hwndTree, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem); + for (int j = 0; j < NR_O_OPTIONSPERPAGE && o_pages[i].uIds[j] != 0; j++) + Utils::showDlgControl(hwndDlg, o_pages[i].uIds[j], SW_HIDE); + ShowPage(hwndDlg, i, FALSE); + } + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_EVENT_MESSAGE); + ShowPage(hwndDlg, 0, TRUE); + SetFocus(hwndTree); + Utils::enableDlgControl(hwndDlg, IDC_APPLY, false); - HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_DESC, WM_GETFONT, 0, 0); - LOGFONT lf = { 0 }; + HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_DESC, WM_GETFONT, 0, 0); + LOGFONT lf = { 0 }; - GetObject(hFont, sizeof(lf), &lf); - lf.lfHeight = (int)(lf.lfHeight * 1.2); - hFont = CreateFontIndirect(&lf); + GetObject(hFont, sizeof(lf), &lf); + lf.lfHeight = (int)(lf.lfHeight * 1.2); + hFont = CreateFontIndirect(&lf); - SendDlgItemMessage(hwndDlg, IDC_TITLEBOX, WM_SETFONT, (WPARAM)hFont, TRUE); + SendDlgItemMessage(hwndDlg, IDC_TITLEBOX, WM_SETFONT, (WPARAM)hFont, TRUE); - if (pContainer->isCloned && pContainer->hContactFrom != 0) { - Utils::showDlgControl(hwndDlg, IDC_CNTPRIVATE, SW_HIDE); - Utils::showDlgControl(hwndDlg, IDC_O_CNTPRIVATE, SW_HIDE); + if (pContainer->isCloned && pContainer->hContactFrom != 0) { + Utils::showDlgControl(hwndDlg, IDC_CNTPRIVATE, SW_HIDE); + Utils::showDlgControl(hwndDlg, IDC_O_CNTPRIVATE, SW_HIDE); + } } return FALSE; - } case WM_CTLCOLOREDIT: case WM_CTLCOLORSTATIC: - { - HWND hwndChild = (HWND)lParam; - UINT id = GetDlgCtrlID(hwndChild); - - if (hwndChild == GetDlgItem(hwndDlg, IDC_TITLEBOX)) - ::SetTextColor((HDC)wParam, RGB(60, 60, 150)); - else if (hwndChild == GetDlgItem(hwndDlg, IDC_DESC)) - ::SetTextColor((HDC)wParam, RGB(160, 50, 50)); - - if (id == IDC_TSLABEL_REOPENWARN) - break; - SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW)); - return (INT_PTR)GetSysColorBrush(COLOR_WINDOW); - } + { + HWND hwndChild = (HWND)lParam; + UINT id = GetDlgCtrlID(hwndChild); + + if (hwndChild == GetDlgItem(hwndDlg, IDC_TITLEBOX)) + ::SetTextColor((HDC)wParam, RGB(60, 60, 150)); + else if (hwndChild == GetDlgItem(hwndDlg, IDC_DESC)) + ::SetTextColor((HDC)wParam, RGB(160, 50, 50)); + + if (id == IDC_TSLABEL_REOPENWARN) + break; + SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW)); + return (INT_PTR)GetSysColorBrush(COLOR_WINDOW); + } case WM_NOTIFY: if (wParam == IDC_SECTIONTREE && ((LPNMHDR)lParam)->code == TVN_SELCHANGED) { @@ -249,47 +250,50 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_COMMAND: switch (LOWORD(wParam)) { - case IDC_CNTPRIVATE: { + case IDC_CNTPRIVATE: + { - if (IsDlgButtonChecked(hwndDlg, IDC_CNTPRIVATE)) { - Utils::ReadPrivateContainerSettings(pContainer, true); - pContainer->settings->fPrivate = true; - } - else { - if (pContainer->settings != &PluginConfig.globalContainerSettings) { - char szCname[40]; - mir_snprintf(szCname, "%s%d_Blob", CNT_BASEKEYNAME, pContainer->iContainerIndex); + if (IsDlgButtonChecked(hwndDlg, IDC_CNTPRIVATE)) { + Utils::ReadPrivateContainerSettings(pContainer, true); + pContainer->settings->fPrivate = true; + } + else { + if (pContainer->settings != &PluginConfig.globalContainerSettings) { + char szCname[40]; + mir_snprintf(szCname, "%s%d_Blob", CNT_BASEKEYNAME, pContainer->iContainerIndex); + pContainer->settings->fPrivate = false; + db_set_blob(0, SRMSGMOD_T, szCname, pContainer->settings, sizeof(TContainerSettings)); + mir_free(pContainer->settings); + } + pContainer->settings = &PluginConfig.globalContainerSettings; pContainer->settings->fPrivate = false; - db_set_blob(0, SRMSGMOD_T, szCname, pContainer->settings, sizeof(TContainerSettings)); - mir_free(pContainer->settings); } - pContainer->settings = &PluginConfig.globalContainerSettings; - pContainer->settings->fPrivate = false; + SendMessage(hwndDlg, DM_SC_INITDIALOG, 0, (LPARAM)pContainer->settings); + goto do_apply; + } + case IDC_TRANSPARENCY: + { + bool isTrans = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) != 0; + Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_ACTIVE, isTrans); + Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_INACTIVE, isTrans); + goto do_apply; } - SendMessage(hwndDlg, DM_SC_INITDIALOG, 0, (LPARAM)pContainer->settings); - goto do_apply; - } - case IDC_TRANSPARENCY: { - bool isTrans = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) != 0; - Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_ACTIVE, isTrans); - Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_INACTIVE, isTrans); - goto do_apply; - } case IDC_SECTIONTREE: case IDC_DESC: return 0; - case IDC_SAVESIZEASGLOBAL: { - WINDOWPLACEMENT wp = { 0 }; - - wp.length = sizeof(wp); - if (GetWindowPlacement(pContainer->hwnd, &wp)) { - db_set_dw(0, SRMSGMOD_T, "splitx", wp.rcNormalPosition.left); - db_set_dw(0, SRMSGMOD_T, "splity", wp.rcNormalPosition.top); - db_set_dw(0, SRMSGMOD_T, "splitwidth", wp.rcNormalPosition.right - wp.rcNormalPosition.left); - db_set_dw(0, SRMSGMOD_T, "splitheight", wp.rcNormalPosition.bottom - wp.rcNormalPosition.top); + case IDC_SAVESIZEASGLOBAL: + { + WINDOWPLACEMENT wp = { 0 }; + + wp.length = sizeof(wp); + if (GetWindowPlacement(pContainer->hwnd, &wp)) { + db_set_dw(0, SRMSGMOD_T, "splitx", wp.rcNormalPosition.left); + db_set_dw(0, SRMSGMOD_T, "splity", wp.rcNormalPosition.top); + db_set_dw(0, SRMSGMOD_T, "splitwidth", wp.rcNormalPosition.right - wp.rcNormalPosition.left); + db_set_dw(0, SRMSGMOD_T, "splitheight", wp.rcNormalPosition.bottom - wp.rcNormalPosition.top); + } + break; } - break; - } case IDC_O_ENABLESOUNDS: SendMessage(hwndDlg, DM_SC_CONFIG, 0, 0); break; @@ -297,23 +301,23 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return TRUE; goto do_apply; - case IDC_SELECTTHEME: { - const wchar_t *szFileName = GetThemeFileName(0); + case IDC_SELECTTHEME: + { + const wchar_t *szFileName = GetThemeFileName(0); - if (PathFileExists(szFileName)) { - SetDlgItemText(hwndDlg, IDC_THEME, szFileName); - goto do_apply; + if (PathFileExists(szFileName)) { + SetDlgItemText(hwndDlg, IDC_THEME, szFileName); + goto do_apply; + } + break; } - break; - } case IDC_O_HELP_TITLEFORMAT: Utils_OpenUrl("http://wiki.miranda-ng.org/index.php?title=Plugin:TabSRMM/en/Title_bar_formatting"); break; case IDOK: - case IDC_APPLY: { - + case IDC_APPLY: SendMessage(hwndDlg, DM_SC_BUILDLIST, 0, (LPARAM)pContainer->settings); pContainer->settings->dwTransparency = MAKELONG((WORD)SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_GETPOS, 0, 0), @@ -364,7 +368,6 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, ShowWindow(pContainer->hwnd, SW_HIDE); { RECT rc; - GetWindowRect(pContainer->hwnd, &rc); SetWindowPos(pContainer->hwnd, 0, rc.left, rc.top, (rc.right - rc.left) - 1, (rc.bottom - rc.top) - 1, SWP_NOZORDER | SWP_DRAWFRAME | SWP_FRAMECHANGED); SetWindowPos(pContainer->hwnd, 0, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), SWP_NOZORDER | SWP_DRAWFRAME | SWP_SHOWWINDOW); @@ -376,174 +379,180 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, Utils::enableDlgControl(hwndDlg, IDC_APPLY, false); break; - } + case IDCANCEL: DestroyWindow(hwndDlg); return TRUE; default: - do_apply : Utils::enableDlgControl(hwndDlg, IDC_APPLY, true); +do_apply: Utils::enableDlgControl(hwndDlg, IDC_APPLY, true); break; } break; - case DM_SC_INITDIALOG: { - TContainerSettings* cs = (TContainerSettings *)lParam; - DWORD dwFlags = cs->dwFlags; - DWORD dwTransparency = cs->dwTransparency; - DWORD dwFlagsEx = cs->dwFlagsEx; - BOOL fAllowTrans = FALSE; + case DM_SC_INITDIALOG: + { + TContainerSettings* cs = (TContainerSettings *)lParam; - if (PluginConfig.m_WinVerMajor >= 6) - fAllowTrans = TRUE; - else - fAllowTrans = (!CSkin::m_skinEnabled); - - MY_CheckDlgButton(hwndDlg, IDC_O_HIDETITLE, dwFlags & CNT_NOTITLE); - MY_CheckDlgButton(hwndDlg, IDC_O_DONTREPORT, dwFlags & CNT_DONTREPORT); - MY_CheckDlgButton(hwndDlg, IDC_O_NOTABS, dwFlags & CNT_HIDETABS); - MY_CheckDlgButton(hwndDlg, IDC_O_STICKY, dwFlags & CNT_STICKY); - MY_CheckDlgButton(hwndDlg, IDC_O_FLASHNEVER, dwFlags & CNT_NOFLASH); - MY_CheckDlgButton(hwndDlg, IDC_O_FLASHALWAYS, dwFlags & CNT_FLASHALWAYS); - MY_CheckDlgButton(hwndDlg, IDC_O_FLASHDEFAULT, !((dwFlags & CNT_NOFLASH) || (dwFlags & CNT_FLASHALWAYS))); - MY_CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, dwFlags & CNT_TRANSPARENCY); - MY_CheckDlgButton(hwndDlg, IDC_DONTREPORTUNFOCUSED2, dwFlags & CNT_DONTREPORTUNFOCUSED); - MY_CheckDlgButton(hwndDlg, IDC_DONTREPORTFOCUSED2, dwFlags & CNT_DONTREPORTFOCUSED); - MY_CheckDlgButton(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE, dwFlags & CNT_ALWAYSREPORTINACTIVE); - MY_CheckDlgButton(hwndDlg, IDC_CNTNOSTATUSBAR, dwFlags & CNT_NOSTATUSBAR); - MY_CheckDlgButton(hwndDlg, IDC_HIDEMENUBAR, dwFlags & CNT_NOMENUBAR); - MY_CheckDlgButton(hwndDlg, IDC_HIDETOOLBAR, dwFlags & CNT_HIDETOOLBAR); - MY_CheckDlgButton(hwndDlg, IDC_BOTTOMTOOLBAR, dwFlags & CNT_BOTTOMTOOLBAR); - MY_CheckDlgButton(hwndDlg, IDC_UIDSTATUSBAR, dwFlags & CNT_UINSTATUSBAR); - MY_CheckDlgButton(hwndDlg, IDC_VERTICALMAX, dwFlags & CNT_VERTICALMAX); - MY_CheckDlgButton(hwndDlg, IDC_AUTOSPLITTER, dwFlags & CNT_AUTOSPLITTER); - MY_CheckDlgButton(hwndDlg, IDC_AVATARSONTASKBAR, dwFlags & CNT_AVATARSONTASKBAR); - MY_CheckDlgButton(hwndDlg, IDC_INFOPANEL, dwFlags & CNT_INFOPANEL); - MY_CheckDlgButton(hwndDlg, IDC_USEGLOBALSIZE, dwFlags & CNT_GLOBALSIZE); - - MY_CheckDlgButton(hwndDlg, IDC_FLASHICON, dwFlagsEx & TCF_FLASHICON); - MY_CheckDlgButton(hwndDlg, IDC_FLASHLABEL, dwFlagsEx & TCF_FLASHLABEL); - MY_CheckDlgButton(hwndDlg, IDC_CLOSEBUTTONONTABS, dwFlagsEx & TCF_CLOSEBUTTON); - - MY_CheckDlgButton(hwndDlg, IDC_SINGLEROWTAB, dwFlagsEx & TCF_SINGLEROWTABCONTROL); - MY_CheckDlgButton(hwndDlg, IDC_BUTTONTABS, dwFlagsEx & TCF_FLAT); - - MY_CheckDlgButton(hwndDlg, IDC_O_ENABLESOUNDS, !(dwFlags & CNT_NOSOUND)); - MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSMINIMIZED, dwFlagsEx & CNT_EX_SOUNDS_MINIMIZED); - MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSUNFOCUSED, dwFlagsEx & CNT_EX_SOUNDS_UNFOCUSED); - MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSINACTIVE, dwFlagsEx & CNT_EX_SOUNDS_INACTIVETABS); - MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSFOCUSED, dwFlagsEx & CNT_EX_SOUNDS_FOCUSED); - - SendMessage(hwndDlg, DM_SC_CONFIG, 0, 0); - - if (!(dwFlagsEx & (TCF_SBARLEFT | TCF_SBARRIGHT))) - SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_SETCURSEL, dwFlags & CNT_TABSBOTTOM ? 1 : 0, 0); - else - SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_SETCURSEL, dwFlagsEx & TCF_SBARLEFT ? 2 : 3, 0); + DWORD dwFlags = cs->dwFlags; + DWORD dwTransparency = cs->dwTransparency; + DWORD dwFlagsEx = cs->dwFlagsEx; + BOOL fAllowTrans = FALSE; - if (LOBYTE(LOWORD(GetVersion())) >= 5 && fAllowTrans) - CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, dwFlags & CNT_TRANSPARENCY ? BST_CHECKED : BST_UNCHECKED); - else - CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, BST_UNCHECKED); + if (PluginConfig.m_WinVerMajor >= 6) + fAllowTrans = TRUE; + else + fAllowTrans = (!CSkin::m_skinEnabled); + + MY_CheckDlgButton(hwndDlg, IDC_O_HIDETITLE, dwFlags & CNT_NOTITLE); + MY_CheckDlgButton(hwndDlg, IDC_O_DONTREPORT, dwFlags & CNT_DONTREPORT); + MY_CheckDlgButton(hwndDlg, IDC_O_NOTABS, dwFlags & CNT_HIDETABS); + MY_CheckDlgButton(hwndDlg, IDC_O_STICKY, dwFlags & CNT_STICKY); + MY_CheckDlgButton(hwndDlg, IDC_O_FLASHNEVER, dwFlags & CNT_NOFLASH); + MY_CheckDlgButton(hwndDlg, IDC_O_FLASHALWAYS, dwFlags & CNT_FLASHALWAYS); + MY_CheckDlgButton(hwndDlg, IDC_O_FLASHDEFAULT, !((dwFlags & CNT_NOFLASH) || (dwFlags & CNT_FLASHALWAYS))); + MY_CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, dwFlags & CNT_TRANSPARENCY); + MY_CheckDlgButton(hwndDlg, IDC_DONTREPORTUNFOCUSED2, dwFlags & CNT_DONTREPORTUNFOCUSED); + MY_CheckDlgButton(hwndDlg, IDC_DONTREPORTFOCUSED2, dwFlags & CNT_DONTREPORTFOCUSED); + MY_CheckDlgButton(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE, dwFlags & CNT_ALWAYSREPORTINACTIVE); + MY_CheckDlgButton(hwndDlg, IDC_CNTNOSTATUSBAR, dwFlags & CNT_NOSTATUSBAR); + MY_CheckDlgButton(hwndDlg, IDC_HIDEMENUBAR, dwFlags & CNT_NOMENUBAR); + MY_CheckDlgButton(hwndDlg, IDC_HIDETOOLBAR, dwFlags & CNT_HIDETOOLBAR); + MY_CheckDlgButton(hwndDlg, IDC_BOTTOMTOOLBAR, dwFlags & CNT_BOTTOMTOOLBAR); + MY_CheckDlgButton(hwndDlg, IDC_UIDSTATUSBAR, dwFlags & CNT_UINSTATUSBAR); + MY_CheckDlgButton(hwndDlg, IDC_VERTICALMAX, dwFlags & CNT_VERTICALMAX); + MY_CheckDlgButton(hwndDlg, IDC_AUTOSPLITTER, dwFlags & CNT_AUTOSPLITTER); + MY_CheckDlgButton(hwndDlg, IDC_AVATARSONTASKBAR, dwFlags & CNT_AVATARSONTASKBAR); + MY_CheckDlgButton(hwndDlg, IDC_INFOPANEL, dwFlags & CNT_INFOPANEL); + MY_CheckDlgButton(hwndDlg, IDC_USEGLOBALSIZE, dwFlags & CNT_GLOBALSIZE); + + MY_CheckDlgButton(hwndDlg, IDC_FLASHICON, dwFlagsEx & TCF_FLASHICON); + MY_CheckDlgButton(hwndDlg, IDC_FLASHLABEL, dwFlagsEx & TCF_FLASHLABEL); + MY_CheckDlgButton(hwndDlg, IDC_CLOSEBUTTONONTABS, dwFlagsEx & TCF_CLOSEBUTTON); + + MY_CheckDlgButton(hwndDlg, IDC_SINGLEROWTAB, dwFlagsEx & TCF_SINGLEROWTABCONTROL); + MY_CheckDlgButton(hwndDlg, IDC_BUTTONTABS, dwFlagsEx & TCF_FLAT); + + MY_CheckDlgButton(hwndDlg, IDC_O_ENABLESOUNDS, !(dwFlags & CNT_NOSOUND)); + MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSMINIMIZED, dwFlagsEx & CNT_EX_SOUNDS_MINIMIZED); + MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSUNFOCUSED, dwFlagsEx & CNT_EX_SOUNDS_UNFOCUSED); + MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSINACTIVE, dwFlagsEx & CNT_EX_SOUNDS_INACTIVETABS); + MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSFOCUSED, dwFlagsEx & CNT_EX_SOUNDS_FOCUSED); + + SendMessage(hwndDlg, DM_SC_CONFIG, 0, 0); + + if (!(dwFlagsEx & (TCF_SBARLEFT | TCF_SBARRIGHT))) + SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_SETCURSEL, dwFlags & CNT_TABSBOTTOM ? 1 : 0, 0); + else + SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_SETCURSEL, dwFlagsEx & TCF_SBARLEFT ? 2 : 3, 0); - Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY, PluginConfig.m_WinVerMajor >= 5 && fAllowTrans); + if (LOBYTE(LOWORD(GetVersion())) >= 5 && fAllowTrans) + CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, dwFlags & CNT_TRANSPARENCY ? BST_CHECKED : BST_UNCHECKED); + else + CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, BST_UNCHECKED); + + Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY, PluginConfig.m_WinVerMajor >= 5 && fAllowTrans); - bool isTrans = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) != 0; - Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_ACTIVE, isTrans); - Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_INACTIVE, isTrans); + bool isTrans = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) != 0; + Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_ACTIVE, isTrans); + Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_INACTIVE, isTrans); - SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_SETRANGE, 0, (LPARAM)MAKELONG(50, 255)); - SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_INACTIVE, TBM_SETRANGE, 0, (LPARAM)MAKELONG(50, 255)); + SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_SETRANGE, 0, (LPARAM)MAKELONG(50, 255)); + SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_INACTIVE, TBM_SETRANGE, 0, (LPARAM)MAKELONG(50, 255)); - SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_SETPOS, TRUE, (LPARAM)LOWORD(dwTransparency)); - SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_INACTIVE, TBM_SETPOS, TRUE, (LPARAM)HIWORD(dwTransparency)); + SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_SETPOS, TRUE, (LPARAM)LOWORD(dwTransparency)); + SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_INACTIVE, TBM_SETPOS, TRUE, (LPARAM)HIWORD(dwTransparency)); - Utils::enableDlgControl(hwndDlg, IDC_O_DONTREPORT, !nen_options.bWindowCheck); - Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTUNFOCUSED2, !nen_options.bWindowCheck); - Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTFOCUSED2, !nen_options.bWindowCheck); - Utils::enableDlgControl(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE, !nen_options.bWindowCheck); + Utils::enableDlgControl(hwndDlg, IDC_O_DONTREPORT, !nen_options.bWindowCheck); + Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTUNFOCUSED2, !nen_options.bWindowCheck); + Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTFOCUSED2, !nen_options.bWindowCheck); + Utils::enableDlgControl(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE, !nen_options.bWindowCheck); - SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_SETCURSEL, (WPARAM)cs->avatarMode, 0); - SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_SETCURSEL, (WPARAM)cs->ownAvatarMode, 0); + SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_SETCURSEL, (WPARAM)cs->avatarMode, 0); + SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_SETCURSEL, (WPARAM)cs->ownAvatarMode, 0); - Utils::showDlgControl(hwndDlg, IDC_O_EXPLAINGLOBALNOTIFY, nen_options.bWindowCheck ? SW_SHOW : SW_HIDE); + Utils::showDlgControl(hwndDlg, IDC_O_EXPLAINGLOBALNOTIFY, nen_options.bWindowCheck ? SW_SHOW : SW_HIDE); - SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_SETRANGE, 0, MAKELONG(1000, 0)); - SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_SETPOS, 0, (LPARAM)cs->autoCloseSeconds); + SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_SETRANGE, 0, MAKELONG(1000, 0)); + SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_SETPOS, 0, (LPARAM)cs->autoCloseSeconds); + } break; - } - case DM_SC_CONFIG: { - bool bEnable = IsDlgButtonChecked(hwndDlg, IDC_O_ENABLESOUNDS) != 0; - Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSINACTIVE, bEnable); - Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSUNFOCUSED, bEnable); - Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSMINIMIZED, bEnable); - Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSFOCUSED, bEnable); + case DM_SC_CONFIG: + { + bool bEnable = IsDlgButtonChecked(hwndDlg, IDC_O_ENABLESOUNDS) != 0; + Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSINACTIVE, bEnable); + Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSUNFOCUSED, bEnable); + Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSMINIMIZED, bEnable); + Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSFOCUSED, bEnable); + } return 0; - } - case DM_SC_BUILDLIST: { - DWORD dwNewFlags = 0, dwNewFlagsEx = 0; - TContainerSettings* cs = (TContainerSettings *)lParam; - - dwNewFlags = (IsDlgButtonChecked(hwndDlg, IDC_O_HIDETITLE) ? CNT_NOTITLE : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_O_DONTREPORT) ? CNT_DONTREPORT : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_O_NOTABS) ? CNT_HIDETABS : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_O_STICKY) ? CNT_STICKY : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHALWAYS) ? CNT_FLASHALWAYS : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHNEVER) ? CNT_NOFLASH : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) ? CNT_TRANSPARENCY : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_DONTREPORTUNFOCUSED2) ? CNT_DONTREPORTUNFOCUSED : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_DONTREPORTFOCUSED2) ? CNT_DONTREPORTFOCUSED : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE) ? CNT_ALWAYSREPORTINACTIVE : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_CNTNOSTATUSBAR) ? CNT_NOSTATUSBAR : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_HIDEMENUBAR) ? CNT_NOMENUBAR : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_HIDETOOLBAR) ? CNT_HIDETOOLBAR : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_BOTTOMTOOLBAR) ? CNT_BOTTOMTOOLBAR : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_UIDSTATUSBAR) ? CNT_UINSTATUSBAR : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_USEGLOBALSIZE) ? CNT_GLOBALSIZE : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_INFOPANEL) ? CNT_INFOPANEL : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_O_ENABLESOUNDS) ? 0 : CNT_NOSOUND) | - (IsDlgButtonChecked(hwndDlg, IDC_AVATARSONTASKBAR) ? CNT_AVATARSONTASKBAR : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_VERTICALMAX) ? CNT_VERTICALMAX : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_AUTOSPLITTER) ? CNT_AUTOSPLITTER : 0) | - (CNT_NEWCONTAINERFLAGS); - - LRESULT iTabMode = SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_GETCURSEL, 0, 0); - LRESULT iTabLayout = SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_GETCURSEL, 0, 0); - - dwNewFlagsEx = 0; - - if (iTabMode < 2) - dwNewFlags = ((iTabMode == 1) ? (dwNewFlags | CNT_TABSBOTTOM) : (dwNewFlags & ~CNT_TABSBOTTOM)); - else { - dwNewFlags &= ~CNT_TABSBOTTOM; - dwNewFlagsEx = iTabMode == 2 ? TCF_SBARLEFT : TCF_SBARRIGHT; - } + case DM_SC_BUILDLIST: + { + DWORD dwNewFlags = 0, dwNewFlagsEx = 0; + TContainerSettings* cs = (TContainerSettings *)lParam; + + dwNewFlags = (IsDlgButtonChecked(hwndDlg, IDC_O_HIDETITLE) ? CNT_NOTITLE : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_O_DONTREPORT) ? CNT_DONTREPORT : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_O_NOTABS) ? CNT_HIDETABS : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_O_STICKY) ? CNT_STICKY : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHALWAYS) ? CNT_FLASHALWAYS : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHNEVER) ? CNT_NOFLASH : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) ? CNT_TRANSPARENCY : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_DONTREPORTUNFOCUSED2) ? CNT_DONTREPORTUNFOCUSED : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_DONTREPORTFOCUSED2) ? CNT_DONTREPORTFOCUSED : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE) ? CNT_ALWAYSREPORTINACTIVE : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_CNTNOSTATUSBAR) ? CNT_NOSTATUSBAR : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_HIDEMENUBAR) ? CNT_NOMENUBAR : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_HIDETOOLBAR) ? CNT_HIDETOOLBAR : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_BOTTOMTOOLBAR) ? CNT_BOTTOMTOOLBAR : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_UIDSTATUSBAR) ? CNT_UINSTATUSBAR : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_USEGLOBALSIZE) ? CNT_GLOBALSIZE : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_INFOPANEL) ? CNT_INFOPANEL : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_O_ENABLESOUNDS) ? 0 : CNT_NOSOUND) | + (IsDlgButtonChecked(hwndDlg, IDC_AVATARSONTASKBAR) ? CNT_AVATARSONTASKBAR : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_VERTICALMAX) ? CNT_VERTICALMAX : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_AUTOSPLITTER) ? CNT_AUTOSPLITTER : 0) | + (CNT_NEWCONTAINERFLAGS); + + LRESULT iTabMode = SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_GETCURSEL, 0, 0); + LRESULT iTabLayout = SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_GETCURSEL, 0, 0); + + dwNewFlagsEx = 0; + + if (iTabMode < 2) + dwNewFlags = ((iTabMode == 1) ? (dwNewFlags | CNT_TABSBOTTOM) : (dwNewFlags & ~CNT_TABSBOTTOM)); + else { + dwNewFlags &= ~CNT_TABSBOTTOM; + dwNewFlagsEx = iTabMode == 2 ? TCF_SBARLEFT : TCF_SBARRIGHT; + } - dwNewFlagsEx |= ((IsDlgButtonChecked(hwndDlg, IDC_FLASHICON) ? TCF_FLASHICON : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_FLASHLABEL) ? TCF_FLASHLABEL : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_BUTTONTABS) ? TCF_FLAT : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_CLOSEBUTTONONTABS) ? TCF_CLOSEBUTTON : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_SINGLEROWTAB) ? TCF_SINGLEROWTABCONTROL : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSMINIMIZED) ? CNT_EX_SOUNDS_MINIMIZED : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSUNFOCUSED) ? CNT_EX_SOUNDS_UNFOCUSED : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSFOCUSED) ? CNT_EX_SOUNDS_FOCUSED : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSINACTIVE) ? CNT_EX_SOUNDS_INACTIVETABS : 0) - ); - - /* bits 24 - 31 of dwFlagsEx hold the sidebar layout id */ - dwNewFlagsEx |= ((int)((iTabLayout << 24) & 0xff000000)); - - if (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHDEFAULT)) - dwNewFlags &= ~(CNT_FLASHALWAYS | CNT_NOFLASH); - - cs->dwFlags = dwNewFlags; - cs->dwFlagsEx = dwNewFlagsEx; - cs->autoCloseSeconds = (WORD)SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_GETPOS, 0, 0); + dwNewFlagsEx |= ((IsDlgButtonChecked(hwndDlg, IDC_FLASHICON) ? TCF_FLASHICON : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_FLASHLABEL) ? TCF_FLASHLABEL : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_BUTTONTABS) ? TCF_FLAT : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_CLOSEBUTTONONTABS) ? TCF_CLOSEBUTTON : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_SINGLEROWTAB) ? TCF_SINGLEROWTABCONTROL : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSMINIMIZED) ? CNT_EX_SOUNDS_MINIMIZED : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSUNFOCUSED) ? CNT_EX_SOUNDS_UNFOCUSED : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSFOCUSED) ? CNT_EX_SOUNDS_FOCUSED : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSINACTIVE) ? CNT_EX_SOUNDS_INACTIVETABS : 0) + ); + + /* bits 24 - 31 of dwFlagsEx hold the sidebar layout id */ + dwNewFlagsEx |= ((int)((iTabLayout << 24) & 0xff000000)); + + if (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHDEFAULT)) + dwNewFlags &= ~(CNT_FLASHALWAYS | CNT_NOFLASH); + + cs->dwFlags = dwNewFlags; + cs->dwFlagsEx = dwNewFlagsEx; + cs->autoCloseSeconds = (WORD)SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_GETPOS, 0, 0); + } break; - } - case WM_DESTROY: { + + case WM_DESTROY: + Window_FreeIcon_IcoLib(hwndDlg); pContainer->hWndOptions = 0; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0); @@ -551,6 +560,5 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, DeleteObject(hFont); break; } - } return FALSE; } diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 141a1fbbd9..be944454c7 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -617,7 +617,7 @@ static INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR TranslateT("Version"), __MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM, v[3]); SetDlgItemText(hwndDlg, IDC_HEADERBAR, tStr); } - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_EVENT_MESSAGE, true)); + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_EVENT_MESSAGE); return TRUE; case WM_COMMAND: diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index 17e2680ba5..44f123e657 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -1175,8 +1175,7 @@ INT_PTR CALLBACK CWarning::dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP m_hwnd = hwnd; ::SetWindowTextW(hwnd, TranslateT("TabSRMM warning message")); - ::SendMessage(hwnd, WM_SETICON, ICON_BIG, LPARAM(::Skin_LoadIcon(SKINICON_OTHER_MIRANDA, true))); - ::SendMessage(hwnd, WM_SETICON, ICON_SMALL, LPARAM(::Skin_LoadIcon(SKINICON_OTHER_MIRANDA))); + ::Window_SetSkinIcon_IcoLib(hwnd, SKINICON_OTHER_MIRANDA); ::SendDlgItemMessage(hwnd, IDC_WARNTEXT, EM_AUTOURLDETECT, TRUE, 0); ::SendDlgItemMessage(hwnd, IDC_WARNTEXT, EM_SETEVENTMASK, 0, ENM_LINK); diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index 148d7dad7f..f5f6a127ba 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -711,8 +711,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar ShowWindow(GetDlgItem(hDlg, IDC_PAGETITLEBG2), !IsAeroMode()); // set icons - SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(ICO_COMMON_MAIN, false)); - SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(ICO_COMMON_MAIN, true)); + Window_SetIcon_IcoLib(hDlg, IcoLib_GetIconHandle(ICO_COMMON_MAIN)); DlgProc(hDlg, HM_RELOADICONS, NULL, NULL); // load basic protocol for current contact (for faster load later on and better handling for owner protocol) @@ -1611,6 +1610,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar ResetUpdateInfo(pPs); // avoid any further message processing for this dialog page + Window_FreeIcon_IcoLib(hDlg); WindowList_Remove(g_hWindowList, hDlg); SetUserData(hDlg, NULL); diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp index 31d3f28b6f..4bc8be70fe 100644 --- a/plugins/Weather/src/weather_ini.cpp +++ b/plugins/Weather/src/weather_ini.cpp @@ -163,8 +163,7 @@ static INT_PTR CALLBACK DlgProcSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SendDlgItemMessage(hwndDlg, IDC_STEP4, BUTTONSETASFLATBTN, TRUE, 0); // set icons - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx("main", TRUE)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx("main", FALSE)); + Window_SetIcon_IcoLib(hwndDlg, GetIconHandle("main")); WindowList_Add(hWindowList, hwndDlg, NULL); ShowWindow(hwndDlg, SW_SHOW); @@ -213,8 +212,7 @@ static INT_PTR CALLBACK DlgProcSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR break; case WM_DESTROY: - ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0)); - ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(hwndDlg); break; } return FALSE; diff --git a/plugins/Weather/src/weather_userinfo.cpp b/plugins/Weather/src/weather_userinfo.cpp index cc99987a51..22b185c261 100644 --- a/plugins/Weather/src/weather_userinfo.cpp +++ b/plugins/Weather/src/weather_userinfo.cpp @@ -130,11 +130,9 @@ static INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, L DBDataManage(hContact, WDBM_DETAILDISPLAY, (WPARAM)hwndDlg, 0); // set icons - { - WORD statusIcon = db_get_w(hContact, WEATHERPROTONAME, "StatusIcon", 0); - ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadProtoIcon(WEATHERPROTONAME, statusIcon, true))); - ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadProtoIcon(WEATHERPROTONAME, statusIcon))); - } + Window_FreeIcon_IcoLib(hwndDlg); + Window_SetProtoIcon_IcoLib(hwndDlg, WEATHERPROTONAME, db_get_w(hContact, WEATHERPROTONAME, "StatusIcon", 0)); + RedrawWindow(GetDlgItem(hwndDlg, IDC_HEADERBAR), NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); break; @@ -227,9 +225,7 @@ static INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, L break; case WM_DESTROY: - ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0)); - ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0)); - + Window_FreeIcon_IcoLib(hwndDlg); Utils_SaveWindowPosition(hwndDlg, NULL, WEATHERPROTONAME, "BriefInfo_"); WindowList_Remove(hDataWindowList, hwndDlg); break; diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp index 34b2f11524..f7f3945f39 100644 --- a/plugins/WhenWasIt/src/dlg_handlers.cpp +++ b/plugins/WhenWasIt/src/dlg_handlers.cpp @@ -403,7 +403,7 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l WindowList_Add(hAddBirthdayWndsList, hWnd, hContact); Utils_RestoreWindowPositionNoSize(hWnd, hContact, ModuleName, "BirthdayWnd"); - SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(hAddBirthdayContact, 1)); + Window_SetIcon_IcoLib(hWnd, hAddBirthdayContact); for (int i = 0; i < cSaveModule; i++) SendDlgItemMessage(hWnd, IDC_COMPATIBILITY, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szSaveModule[i])); @@ -473,7 +473,7 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l case WM_DESTROY: RefreshContactListIcons(hContact); //the birthday might be changed, refresh icon. - IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_GETICON, ICON_BIG, 0)); + Window_FreeIcon_IcoLib(hWnd); Utils_SaveWindowPosition(hWnd, hContact, ModuleName, "BirthdayWnd"); WindowList_Remove(hAddBirthdayWndsList, hWnd); break; @@ -716,7 +716,7 @@ INT_PTR CALLBACK DlgProcBirthdays(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hWnd); - SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(hListMenu)); + Window_SetIcon_IcoLib(hWnd, hListMenu); { HWND hList = GetDlgItem(hWnd, IDC_BIRTHDAYS_LIST); @@ -832,7 +832,7 @@ INT_PTR CALLBACK DlgProcBirthdays(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa case WM_DESTROY: hBirthdaysDlg = NULL; Utils_SaveWindowPosition(hWnd, NULL, ModuleName, "BirthdayList"); - IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_GETICON, ICON_BIG, 0)); + Window_FreeIcon_IcoLib(hWnd); lastColumn = -1; break; @@ -848,9 +848,9 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hWnd); + Window_SetIcon_IcoLib(hWnd, hListMenu); { timeout = commonData.cDlgTimeout; - SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(hListMenu)); HWND hList = GetDlgItem(hWnd, IDC_UPCOMING_LIST); mir_subclassWindow(hList, BirthdaysListSubclassProc); @@ -960,7 +960,7 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar case WM_DESTROY: hUpcomingDlg = NULL; Utils_SaveWindowPosition(hWnd, NULL, ModuleName, "BirthdayListUpcoming"); - IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_GETICON, ICON_BIG, 0)); + Window_FreeIcon_IcoLib(hWnd); KillTimer(hWnd, UPCOMING_TIMER_ID); break; } diff --git a/plugins/YAMN/src/browser/badconnect.cpp b/plugins/YAMN/src/browser/badconnect.cpp index 69274be795..6b86acf6d9 100644 --- a/plugins/YAMN/src/browser/badconnect.cpp +++ b/plugins/YAMN/src/browser/badconnect.cpp @@ -230,8 +230,7 @@ void __cdecl BadConnection(void *Param) __try { hBadConnect = CreateDialogParam(YAMNVar.hInst, MAKEINTRESOURCE(IDD_DLGBADCONNECT), NULL, DlgProcYAMNBadConnection, (LPARAM)&MyParam); - SendMessage(hBadConnect, WM_SETICON, ICON_BIG, (LPARAM)g_LoadIconEx(3)); - SendMessage(hBadConnect, WM_SETICON, ICON_SMALL, (LPARAM)g_LoadIconEx(3)); + Window_SetIcon_IcoLib(hBadConnect, g_GetIconHandle(3)); #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read wait\n"); diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index 498f96a54a..c9ec017cbc 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -1268,8 +1268,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR HWND hListView = GetDlgItem(hDlg, IDC_LISTHEADERS); mir_subclassWindow(GetDlgItem(hDlg, IDC_SPLITTER), SplitterSubclassProc); SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR)MailParam); - SendMessage(hDlg, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)g_LoadIconEx(2, true)); - SendMessage(hDlg, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)g_LoadIconEx(2)); + Window_SetIcon_IcoLib(hDlg, g_GetIconHandle(2)); ListView_SetUnicodeFormat(hListView, TRUE); ListView_SetExtendedListViewStyle(hListView, LVS_EX_FULLROWSELECT); @@ -1476,6 +1475,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR return (INT_PTR)GetSysColorBrush(COLOR_WINDOW); case WM_DESTROY: + Window_FreeIcon_IcoLib(hDlg); { RECT coord; if (GetWindowRect(hDlg, &coord)) { @@ -1706,6 +1706,8 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR LVCOLUMN ColInfo; HYAMNMAIL Parser; + Window_FreeIcon_IcoLib(hDlg); + struct CMailWinUserInfo *mwui = (struct CMailWinUserInfo *)GetWindowLongPtr(hDlg, DWLP_USER); if (NULL == (ActualAccount = GetWindowAccount(hDlg))) break; @@ -1783,6 +1785,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR PostQuitMessage(0); } break; + case WM_SHOWWINDOW: { struct CMailWinUserInfo *mwui = (struct CMailWinUserInfo *)GetWindowLongPtr(hDlg, DWLP_USER); @@ -1791,6 +1794,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR return 0; mwui->Seen = TRUE; } + case WM_YAMN_CHANGESTATUS: if (NULL == (ActualAccount = GetWindowAccount(hDlg))) break; @@ -2340,8 +2344,7 @@ void __cdecl MailBrowser(void *Param) WndFound = TRUE; if ((hMailBrowser == NULL) && ((MyParam.nflags & YAMN_ACC_MSG) || (MyParam.nflags & YAMN_ACC_ICO) || (MyParam.nnflags & YAMN_ACC_MSG))) { hMailBrowser = CreateDialogParamW(YAMNVar.hInst, MAKEINTRESOURCEW(IDD_DLGVIEWMESSAGES), NULL, DlgProcYAMNMailBrowser, (LPARAM)&MyParam); - SendMessage(hMailBrowser, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)g_LoadIconEx(2, true)); - SendMessage(hMailBrowser, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)g_LoadIconEx(2)); + Window_SetIcon_IcoLib(hMailBrowser, g_GetIconHandle(2)); MoveWindow(hMailBrowser, PosX, PosY, SizeX, SizeY, TRUE); } diff --git a/plugins/YAPP/src/yapp_history_dlg.cpp b/plugins/YAPP/src/yapp_history_dlg.cpp index b8173a6f67..33cb01c1a2 100644 --- a/plugins/YAPP/src/yapp_history_dlg.cpp +++ b/plugins/YAPP/src/yapp_history_dlg.cpp @@ -580,12 +580,9 @@ INT_PTR CALLBACK DlgProcHistLst(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara switch (msg) { case WM_INITDIALOG: bInitializing = 1; + Window_SetIcon_IcoLib(hWnd, IcoLib_GetIconHandle(ICO_HISTORY)); { int renderer = lstPopupHistory.GetRenderer(); - - SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(ICO_HISTORY,0)); - SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(ICO_HISTORY,1)); - LoadRenderer(hWnd, renderer); TranslateDialogDefault(hWnd); -- cgit v1.2.3