diff options
author | George Hazan <george.hazan@gmail.com> | 2016-06-05 16:11:08 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-06-05 16:11:08 +0000 |
commit | eec361608fde60d63fe4511e26e3b95c7f72be13 (patch) | |
tree | 0263d1829438c7778a713ee2ae6bbda27c0d260a /src | |
parent | 7e822f45eccd034e7acd8d868ce5dc8c55458ff0 (diff) |
- 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
Diffstat (limited to 'src')
28 files changed, 73 insertions, 62 deletions
diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index a3abd05109..b5ddfdc7d4 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -313,6 +313,13 @@ HICON LoadIconEx(const char *pszIcoLibName, bool big) return IcoLib_GetIcon(szTemp, big);
}
+HANDLE GetIconHandle(const char *pszIcoLibName)
+{
+ char szTemp[256];
+ mir_snprintf(szTemp, "chat_%s", pszIcoLibName);
+ return IcoLib_GetIconHandle(szTemp);
+}
+
static void InitSetting(TCHAR** ppPointer, char* pszSetting, TCHAR* pszDefault)
{
DBVARIANT dbv;
diff --git a/src/core/stdchat/src/stdafx.h b/src/core/stdchat/src/stdafx.h index ec6be80973..5acc72626b 100644 --- a/src/core/stdchat/src/stdafx.h +++ b/src/core/stdchat/src/stdafx.h @@ -149,6 +149,7 @@ SESSION_INFO* SM_GetNextWindow(SESSION_INFO *si); int OptionsInitialize(WPARAM wParam, LPARAM lParam);
void AddIcons(void);
HICON LoadIconEx(const char *pszIcoLibName, bool big);
+HANDLE GetIconHandle(const char *pszIcolibName);
// services.c
void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground);
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index 00abe9297a..eff7d1c9bd 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -1268,8 +1268,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SendMessage(hwndDlg, GC_FIXTABICONS, 0, 0);
SendMessage(si->hwndStatus, SB_SETICON, 0, (LPARAM)hIcon);
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx("window", TRUE));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx("window", FALSE));
+ Window_SetIcon_IcoLib(hwndDlg, GetIconHandle("window"));
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETBKGNDCOLOR, 0, g_Settings.crLogBackground);
diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp index 47254f5499..cbed678e37 100644 --- a/src/core/stdfile/src/filerecvdlg.cpp +++ b/src/core/stdfile/src/filerecvdlg.cpp @@ -197,7 +197,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l EnumChildWindows(hwndDlg, ClipSiblingsChildEnumProc, 0);
- Window_SetIcon_IcoLib(hwndDlg, SKINICON_EVENT_FILE);
+ Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_EVENT_FILE);
Button_SetIcon_IcoLib(hwndDlg, IDC_ADD, SKINICON_OTHER_ADDCONTACT, LPGEN("Add contact permanently to list"));
Button_SetIcon_IcoLib(hwndDlg, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGEN("View user's details"));
Button_SetIcon_IcoLib(hwndDlg, IDC_HISTORY, SKINICON_OTHER_HISTORY, LPGEN("View user's history"));
diff --git a/src/core/stdfile/src/filesenddlg.cpp b/src/core/stdfile/src/filesenddlg.cpp index 2a5d28c7ef..54c6a9a786 100644 --- a/src/core/stdfile/src/filesenddlg.cpp +++ b/src/core/stdfile/src/filesenddlg.cpp @@ -218,7 +218,7 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l EnumChildWindows(hwndDlg, ClipSiblingsChildEnumProc, 0);
mir_subclassWindow(GetDlgItem(hwndDlg, IDC_MSG), SendEditSubclassProc);
- Window_SetIcon_IcoLib(hwndDlg, SKINICON_EVENT_FILE);
+ Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_EVENT_FILE);
Button_SetIcon_IcoLib(hwndDlg, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGEN("View user's details"));
Button_SetIcon_IcoLib(hwndDlg, IDC_HISTORY, SKINICON_OTHER_HISTORY, LPGEN("View user's history"));
Button_SetIcon_IcoLib(hwndDlg, IDC_USERMENU, SKINICON_OTHER_DOWNARROW, LPGEN("User menu"));
diff --git a/src/core/stdfile/src/ftmanager.cpp b/src/core/stdfile/src/ftmanager.cpp index f5e42cb3d9..12548bab1e 100644 --- a/src/core/stdfile/src/ftmanager.cpp +++ b/src/core/stdfile/src/ftmanager.cpp @@ -268,7 +268,7 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM HWND hwndTab = GetDlgItem(hwnd, IDC_TABS);
TranslateDialogDefault(hwnd);
- Window_SetIcon_IcoLib(hwnd, SKINICON_EVENT_FILE);
+ Window_SetSkinIcon_IcoLib(hwnd, SKINICON_EVENT_FILE);
dat = (struct TFtMgrData *)mir_calloc(sizeof(struct TFtMgrData));
diff --git a/src/core/stdhelp/src/about.cpp b/src/core/stdhelp/src/about.cpp index 1f96c32d13..d7f21012bf 100644 --- a/src/core/stdhelp/src/about.cpp +++ b/src/core/stdhelp/src/about.cpp @@ -77,7 +77,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar }
FreeResource(hRes);
}
- Window_SetIcon_IcoLib(hwndDlg, SKINICON_OTHER_MIRANDA);
+ Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_MIRANDA);
return TRUE;
case WM_COMMAND:
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 22bf436713..9e43d2cf48 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -909,13 +909,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (dat->szProto) {
WORD wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadProtoIcon(dat->szProto, wStatus, true));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadProtoIcon(dat->szProto, wStatus));
+ Window_SetProtoIcon_IcoLib(hwndDlg, dat->szProto, wStatus);
break;
}
}
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_EVENT_MESSAGE, true));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadIcon(SKINICON_EVENT_MESSAGE));
+ Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_EVENT_MESSAGE);
break;
case DM_USERNAMETOCLIP:
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 31a1c643cf..ac5c99a003 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -127,6 +127,7 @@ int DbEventIsForMsgWindow(DBEVENTINFO *dbei); int DbEventIsShown(DBEVENTINFO *dbei);
void StreamInEvents(HWND hwndDlg, MEVENT hDbEventFirst, int count, int fAppend);
int SendMessageDirect(const TCHAR *szMsg, MCONTACT hContact, char *szProto);
+INT_PTR SendMessageCmd(MCONTACT hContact, char *msg, int isWchar);
void LoadMsgLogIcons(void);
void FreeMsgLogIcons(void);
diff --git a/src/core/stdmsg/src/msgtimedout.cpp b/src/core/stdmsg/src/msgtimedout.cpp index 187bc43f41..0f3d4ac508 100644 --- a/src/core/stdmsg/src/msgtimedout.cpp +++ b/src/core/stdmsg/src/msgtimedout.cpp @@ -28,9 +28,7 @@ struct ErrorDlgParam TMsgQueue *item;
};
-INT_PTR SendMessageCmd(MCONTACT hContact, char* msg, int isWchar);
-
-static INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
TMsgQueue *item = (TMsgQueue*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp index 16d78a9144..f1e6b26602 100644 --- a/src/core/stduihist/src/history.cpp +++ b/src/core/stduihist/src/history.cpp @@ -211,7 +211,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP mir_sntprintf(str, TranslateT("History for %s"), contactName);
SetWindowText(hwndDlg, str);
}
- Window_SetIcon_IcoLib(hwndDlg, SKINICON_OTHER_HISTORY);
+ Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_HISTORY);
SendMessage(hwndDlg, DM_HREBUILD, 0, 0);
return TRUE;
diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index 947112d355..23009dcaa5 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -238,7 +238,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- Window_SetIcon_IcoLib(hwndDlg, SKINICON_OTHER_USERDETAILS);
+ Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_USERDETAILS);
{
PROPSHEETHEADER *psh = (PROPSHEETHEADER*)lParam;
dat = (DetailsData*)mir_calloc(sizeof(DetailsData));
diff --git a/src/mir_app/src/addcontact.cpp b/src/mir_app/src/addcontact.cpp index 24aff743ff..0a712d6833 100644 --- a/src/mir_app/src/addcontact.cpp +++ b/src/mir_app/src/addcontact.cpp @@ -65,7 +65,7 @@ public: void OnInitDialog()
{
char szUin[10];
- Window_SetIcon_IcoLib(m_hwnd, SKINICON_OTHER_ADDCONTACT);
+ Window_SetSkinIcon_IcoLib(m_hwnd, SKINICON_OTHER_ADDCONTACT);
if (m_acs.handleType == HANDLE_EVENT) {
DWORD dwUin;
DBEVENTINFO dbei = { sizeof(dbei) };
diff --git a/src/mir_app/src/enterstring.cpp b/src/mir_app/src/enterstring.cpp index 144cfae239..1a54815172 100644 --- a/src/mir_app/src/enterstring.cpp +++ b/src/mir_app/src/enterstring.cpp @@ -94,8 +94,7 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_RENAME, true));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_RENAME, false));
+ Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_RENAME);
params = (EnterStringFormParam *)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)params);
SetWindowText(hwndDlg, params->caption);
diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp index 6c6523b2d9..a2177c7a27 100644 --- a/src/mir_app/src/findadd.cpp +++ b/src/mir_app/src/findadd.cpp @@ -319,7 +319,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - Window_SetIcon_IcoLib(hwndDlg, SKINICON_OTHER_FINDUSER); + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_FINDUSER); dat = (FindAddDlgData*)mir_calloc(sizeof(FindAddDlgData)); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); dat->notSearchedYet = 1; diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp index ed0177275b..e77cc58a59 100644 --- a/src/mir_app/src/icolib.cpp +++ b/src/mir_app/src/icolib.cpp @@ -662,15 +662,15 @@ HICON IconItem_GetIcon(HANDLE hIcoLib, bool big) big = big && !item->cx;
IconSourceItem* &source = big ? item->source_big : item->source_small;
-
- DBVARIANT dbv = { 0 };
- if (!source && !db_get_ts(NULL, "SkinIcons", item->name, &dbv)) {
- TCHAR tszFullPath[MAX_PATH];
- PathToAbsoluteT(dbv.ptszVal, tszFullPath);
- int cx = item->cx ? item->cx : (big ? g_iIconX : g_iIconSX);
- int cy = item->cy ? item->cy : (big ? g_iIconY : g_iIconSY);
- source = GetIconSourceItemFromPath(tszFullPath, cx, cy);
- db_free(&dbv);
+ if (source == NULL) {
+ ptrT tszCustomPath(db_get_tsa(NULL, "SkinIcons", item->name));
+ if (tszCustomPath != NULL) {
+ TCHAR tszFullPath[MAX_PATH];
+ PathToAbsoluteT(tszCustomPath, tszFullPath);
+ int cx = item->cx ? item->cx : (big ? g_iIconX : g_iIconSX);
+ int cy = item->cy ? item->cy : (big ? g_iIconY : g_iIconSY);
+ source = GetIconSourceItemFromPath(tszFullPath, cx, cy);
+ }
}
HICON hIcon = NULL;
diff --git a/src/mir_app/src/meta_addto.cpp b/src/mir_app/src/meta_addto.cpp index 6b461e3a82..e51af79104 100644 --- a/src/mir_app/src/meta_addto.cpp +++ b/src/mir_app/src/meta_addto.cpp @@ -135,7 +135,7 @@ static INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wPa SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); // user data is contact handle
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx(I_ADD));
+ Window_SetIcon_IcoLib(hwndDlg, Meta_GetIconHandle(I_ADD));
// Initialize the graphical part
CheckDlgButton(hwndDlg, IDC_ONLYAVAIL, BST_CHECKED); // Initially checked; display all metacontacts is only an option
@@ -199,7 +199,7 @@ static INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wPa case WM_DESTROY:
// Free all allocated memory and return the focus to the CList
HWND clist = GetParent(hwndDlg);
- IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0));
+ Window_FreeIcon_IcoLib(hwndDlg);
EndDialog(hwndDlg, TRUE);
SetFocus(clist);
return TRUE;
diff --git a/src/mir_app/src/meta_edit.cpp b/src/mir_app/src/meta_edit.cpp index 74380b78d6..87dc0aa609 100644 --- a/src/mir_app/src/meta_edit.cpp +++ b/src/mir_app/src/meta_edit.cpp @@ -32,7 +32,7 @@ struct MCONTACT hDefaultContact; // HANDLE of the new default contact
MCONTACT hOfflineContact;
int num_deleted, // DWORD number of deleted contacts
- num_contacts; // DWORD number of contacts
+ num_contacts; // DWORD number of contacts
MCONTACT hDeletedContacts[MAX_CONTACTS]; // HANDLEs of the subcontacts to be removed from this metacontact
MCONTACT hContact[MAX_CONTACTS]; // HANDLEs of the subcontacts, in the order they should be in
}
@@ -197,7 +197,7 @@ LRESULT ProcessCustomDraw(LPARAM lParam) *
* @param hwndDlg : HANDLE to the <b>'Edit'</b> Dialog.
* @param uMsg : Specifies the message received by this dialog.
-* @param wParam : Specifies additional message-specific information.
+* @param wParam : Specifies additional message-specific information.
* @param lParam : Specifies additional message-specific information (handle of MetaContact to edit)
*
* @return TRUE if the dialog processed the message, FALSE if it did not.
@@ -213,7 +213,7 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx(I_EDIT));
+ Window_SetIcon_IcoLib(hwndDlg, Meta_GetIconHandle(I_EDIT));
{
DBCachedContact *cc = currDb->m_cache->GetCachedContact(lParam);
if (cc == NULL) {
@@ -287,7 +287,7 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara // enable buttons
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_REM), sel != -1);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_SETDEFAULT), sel != -1 && g_data.hContact[sel] != g_data.hDefaultContact);
-
+
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UP), sel > 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DOWN), (sel != -1 && sel < g_data.num_contacts - 1));
@@ -428,7 +428,7 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara return TRUE;
case WM_DESTROY:
- IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0));
+ Window_FreeIcon_IcoLib(hwndDlg);
EndDialog(hwndDlg, IDCANCEL);
break;
}
diff --git a/src/mir_app/src/meta_main.cpp b/src/mir_app/src/meta_main.cpp index 2b49613832..352e3d3ffc 100644 --- a/src/mir_app/src/meta_main.cpp +++ b/src/mir_app/src/meta_main.cpp @@ -37,14 +37,14 @@ static IconItem iconList[] = { { LPGEN("Remove"), "remove", IDI_MCREMOVE },
};
-HANDLE GetIconHandle(IconIndex i)
+HANDLE Meta_GetIconHandle(IconIndex i)
{
return iconList[i].hIcolib;
}
-HICON LoadIconEx(IconIndex i)
+HICON Meta_LoadIconEx(IconIndex i, bool big)
{
- return IcoLib_GetIcon(iconList[i].szName);
+ return IcoLib_GetIcon(iconList[i].szName, big);
}
void UnloadMetacontacts(void)
diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp index 7c6cf58832..b2ded22f38 100644 --- a/src/mir_app/src/meta_menu.cpp +++ b/src/mir_app/src/meta_menu.cpp @@ -342,9 +342,9 @@ INT_PTR Meta_OnOff(WPARAM, LPARAM) bool bToggled = !db_mc_isEnabled();
db_set_b(0, META_PROTO, "Enabled", bToggled);
if (bToggled)
- Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts off"), GetIconHandle(I_MENU));
+ Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts off"), Meta_GetIconHandle(I_MENU));
else
- Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts on"), GetIconHandle(I_MENUOFF));
+ Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts on"), Meta_GetIconHandle(I_MENUOFF));
db_mc_enable(bToggled);
Meta_HideMetaContacts(!bToggled);
@@ -360,7 +360,7 @@ void InitMenus() // main menu item
SET_UID(mi, 0x8999a6ca, 0x9c66, 0x49c1, 0xad, 0xe1, 0x48, 0x17, 0x28, 0xb, 0x94, 0x86);
- mi.hIcolibItem = GetIconHandle(I_MENU);
+ mi.hIcolibItem = Meta_GetIconHandle(I_MENU);
mi.name.a = LPGEN("Toggle metacontacts off");
mi.pszService = "MetaContacts/OnOff";
mi.position = 500010000;
@@ -368,35 +368,35 @@ void InitMenus() // contact menu items
SET_UID(mi, 0x48cdb295, 0x858f, 0x4f4f, 0x80, 0xc7, 0x50, 0x49, 0x91, 0x75, 0xa6, 0x63);
- mi.hIcolibItem = GetIconHandle(I_CONVERT);
+ mi.hIcolibItem = Meta_GetIconHandle(I_CONVERT);
mi.position = -200010;
mi.name.a = LPGEN("Convert to metacontact");
mi.pszService = "MetaContacts/Convert";
hMenuConvert = Menu_AddContactMenuItem(&mi);
SET_UID(mi, 0xf1437693, 0x69f5, 0x48b0, 0x89, 0xed, 0x29, 0x2c, 0x20, 0x1f, 0xed, 0x3e);
- mi.hIcolibItem = GetIconHandle(I_ADD);
+ mi.hIcolibItem = Meta_GetIconHandle(I_ADD);
mi.position = -200009;
mi.name.a = LPGEN("Add to existing metacontact...");
mi.pszService = "MetaContacts/AddTo";
hMenuAdd = Menu_AddContactMenuItem(&mi);
SET_UID(mi, 0x1673fd9e, 0x8d30, 0x4e07, 0x9f, 0x1b, 0xec, 0x92, 0xc0, 0x10, 0x90, 0x64);
- mi.hIcolibItem = GetIconHandle(I_EDIT);
+ mi.hIcolibItem = Meta_GetIconHandle(I_EDIT);
mi.position = -200010;
mi.name.a = LPGEN("Edit metacontact...");
mi.pszService = "MetaContacts/Edit";
hMenuEdit = Menu_AddContactMenuItem(&mi);
SET_UID(mi, 0x38b7400, 0x685a, 0x497d, 0xbc, 0x15, 0x99, 0x45, 0xcc, 0x1d, 0x9d, 0xaf);
- mi.hIcolibItem = GetIconHandle(I_SETDEFAULT);
+ mi.hIcolibItem = Meta_GetIconHandle(I_SETDEFAULT);
mi.position = -200009;
mi.name.a = LPGEN("Set as metacontact default");
mi.pszService = "MetaContacts/Default";
hMenuDefault = Menu_AddContactMenuItem(&mi);
SET_UID(mi, 0x102849ca, 0x9d2f, 0x4265, 0x81, 0xdc, 0x5d, 0xc8, 0x82, 0xb7, 0x70, 0xe5);
- mi.hIcolibItem = GetIconHandle(I_REMOVE);
+ mi.hIcolibItem = Meta_GetIconHandle(I_REMOVE);
mi.position = -200008;
mi.name.a = LPGEN("Delete metacontact");
mi.pszService = "MetaContacts/Delete";
@@ -427,7 +427,7 @@ void InitMenus() if (!db_mc_isEnabled()) {
// modify main menu item
- Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts on"), GetIconHandle(I_MENUOFF));
+ Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts on"), Meta_GetIconHandle(I_MENUOFF));
Meta_HideMetaContacts(true);
}
else {
diff --git a/src/mir_app/src/metacontacts.h b/src/mir_app/src/metacontacts.h index 2c4ff0715c..e0a3210c2e 100644 --- a/src/mir_app/src/metacontacts.h +++ b/src/mir_app/src/metacontacts.h @@ -104,8 +104,8 @@ int Meta_ReadOptions(); void CreateApiServices();
typedef enum {I_MENUOFF, I_MENU, I_CONVERT, I_ADD, I_EDIT, I_SETDEFAULT, I_REMOVE} IconIndex;
-HICON LoadIconEx(IconIndex i);
-HANDLE GetIconHandle(IconIndex i);
+HICON Meta_LoadIconEx(IconIndex i, bool big = false);
+HANDLE Meta_GetIconHandle(IconIndex i);
extern HANDLE hEventForceSend, hEventUnforceSend, hSubcontactsChanged;
extern POINT menuMousePoint;
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 07184f4596..613e3436c9 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -15,7 +15,7 @@ IcoLib_GetIconHandle @12 IcoLib_IsManaged @13
IcoLib_ReleaseIcon @14
Window_FreeIcon_IcoLib @15
-Window_SetIcon_IcoLib @16
+Window_SetSkinIcon_IcoLib @16
Window_SetProtoIcon_IcoLib @17
ProtoServiceExists @18
mir_main @19
@@ -262,3 +262,4 @@ Clist_GroupAdded @260 Contact_GetInfo @261
Clist_ContactToHItem @262
Clist_ContactToItemHandle @263
+Window_SetSkinIcon_IcoLib @264
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 962847263d..d5a9fc3bc0 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -15,7 +15,7 @@ IcoLib_GetIconHandle @12 IcoLib_IsManaged @13
IcoLib_ReleaseIcon @14
Window_FreeIcon_IcoLib @15
-Window_SetIcon_IcoLib @16
+Window_SetSkinIcon_IcoLib @16
Window_SetProtoIcon_IcoLib @17
ProtoServiceExists @18
mir_main @19
@@ -262,3 +262,4 @@ Clist_GroupAdded @260 Contact_GetInfo @261
Clist_ContactToHItem @262
Clist_ContactToItemHandle @263
+Window_SetSkinIcon_IcoLib @264
diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index 3650a76fe3..bb41ab3100 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -769,7 +769,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L SetWindowLongPtr(hdlg, GWLP_USERDATA, (LONG_PTR)dat);
Utils_RestoreWindowPositionNoSize(hdlg, NULL, "Options", "");
- Window_SetIcon_IcoLib(hdlg, SKINICON_OTHER_OPTIONS);
+ Window_SetSkinIcon_IcoLib(hdlg, SKINICON_OTHER_OPTIONS);
EnableWindow(GetDlgItem(hdlg, IDC_APPLY), FALSE);
{
COMBOBOXINFO cbi;
diff --git a/src/mir_app/src/profilemanager.cpp b/src/mir_app/src/profilemanager.cpp index a04f18ae16..8828a2de55 100644 --- a/src/mir_app/src/profilemanager.cpp +++ b/src/mir_app/src/profilemanager.cpp @@ -597,6 +597,7 @@ public: virtual void OnInitDialog() { + // MUST NOT be replaced with Window_SetIcon_IcoLib!!! SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_DETAILSLOGO), IMAGE_ICON, g_iIconSX, g_iIconSY, 0)); SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_DETAILSLOGO), IMAGE_ICON, g_iIconX, g_iIconY, 0)); diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp index f7a72e5d70..43178651aa 100644 --- a/src/mir_app/src/proto_opts.cpp +++ b/src/mir_app/src/proto_opts.cpp @@ -481,7 +481,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM switch (message) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- Window_SetIcon_IcoLib(hwndDlg, SKINICON_OTHER_ACCMGR);
+ Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_ACCMGR);
dat = (TAccMgrData *)mir_alloc(sizeof(TAccMgrData));
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
diff --git a/src/mir_app/src/proto_ui.cpp b/src/mir_app/src/proto_ui.cpp index 2e3f0cb564..7d54485e58 100644 --- a/src/mir_app/src/proto_ui.cpp +++ b/src/mir_app/src/proto_ui.cpp @@ -80,8 +80,7 @@ INT_PTR CProtoIntDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) return result;
case WM_DESTROY:
- IcoLib_ReleaseIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_BIG, 0));
- IcoLib_ReleaseIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, 0));
+ Window_FreeIcon_IcoLib(m_hwnd);
m_proto_interface->WindowUnsubscribe(m_hwnd);
break;
diff --git a/src/mir_app/src/skinicons.cpp b/src/mir_app/src/skinicons.cpp index daea186017..b1639ae6a2 100644 --- a/src/mir_app/src/skinicons.cpp +++ b/src/mir_app/src/skinicons.cpp @@ -188,28 +188,34 @@ int ImageList_ReplaceIcon_IconLibLoaded(HIMAGELIST hIml, int nIndex, HICON hIcon return res;
}
-MIR_APP_DLL(void) Window_SetIcon_IcoLib(HWND hWnd, int iconId)
+MIR_APP_DLL(void) Window_SetIcon_IcoLib(HWND hWnd, HANDLE hIcolib)
{
- SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(iconId, true));
- SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadIcon(iconId));
+ SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(hIcolib, true));
+ SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(hIcolib, false));
+}
+
+MIR_APP_DLL(void) Window_SetSkinIcon_IcoLib(HWND hWnd, int iconId)
+{
+ SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(iconId, true));
+ SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadIcon(iconId, false));
}
MIR_APP_DLL(void) Window_SetProtoIcon_IcoLib(HWND hWnd, const char *szProto, int iconId)
{
- SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadProtoIcon(szProto, iconId, true));
- SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadProtoIcon(szProto, iconId));
+ SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadProtoIcon(szProto, iconId, true));
+ SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadProtoIcon(szProto, iconId, false));
}
MIR_APP_DLL(void) Window_FreeIcon_IcoLib(HWND hWnd)
{
IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_BIG, 0), true);
- IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_SMALL, 0));
+ IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_SMALL, 0), false);
}
MIR_APP_DLL(void) Button_SetIcon_IcoLib(HWND hwndDlg, int itemId, int iconId, const char *tooltip)
{
HWND hWnd = GetDlgItem(hwndDlg, itemId);
- SendMessage(hWnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(iconId));
+ SendMessage(hWnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(iconId, false));
SendMessage(hWnd, BUTTONSETASFLATBTN, TRUE, 0);
SendMessage(hWnd, BUTTONADDTOOLTIP, (WPARAM)tooltip, 0);
}
|