diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-14 13:17:26 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-14 13:17:26 +0000 |
commit | 02ed4455c23e3562d71bfc80a0e2c4fede8708f1 (patch) | |
tree | 115a3d24e4a3877cd28bd4ff2d9d4011b790cc5f /src | |
parent | c72584d6b934b37dbd18d5f15ffb24a140e1e3f2 (diff) |
- all icolib services removed;
- IcoLib_* functions are bound directly to the code
git-svn-id: http://svn.miranda-ng.org/main/trunk@14161 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
25 files changed, 119 insertions, 168 deletions
diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index 84b1fc6fb4..fc04aca7c2 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -310,7 +310,7 @@ HICON LoadIconEx(char* pszIcoLibName, BOOL big) {
char szTemp[256];
mir_snprintf(szTemp, "chat_%s", pszIcoLibName);
- return Skin_GetIcon(szTemp, big);
+ return IcoLib_GetIcon(szTemp, big);
}
static void InitSetting(TCHAR** ppPointer, char* pszSetting, TCHAR* pszDefault)
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 1f86aba0ec..fe5f689eb2 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -1314,7 +1314,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if ((g_dat.flags & SMF_SHOWTYPINGWIN) && GetForegroundWindow() != hwndDlg) {
HICON hIcon = (HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0);
SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)hTyping);
- Skin_ReleaseIcon(hIcon);
+ IcoLib_ReleaseIcon(hIcon);
}
dat->showTyping = 1;
}
@@ -1352,7 +1352,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
else DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
- Skin_ReleaseIcon(hIcon);
+ IcoLib_ReleaseIcon(hIcon);
return TRUE;
}
}
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index 4852cf91d1..22fd62bf67 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -530,14 +530,14 @@ void LoadMsgLogIcons(void) PBYTE pBmpBits = (PBYTE)mir_alloc(widthBytes * bih.biHeight);
for (int i = 0; i < SIZEOF(pLogIconBmpBits); i++) {
- HICON hIcon = Skin_GetIconByHandle(iconList[i].hIcolib);
+ HICON hIcon = IcoLib_GetIconByHandle(iconList[i].hIcolib);
size_t size = RTFPICTHEADERMAXSIZE + (bih.biSize + widthBytes * bih.biHeight) * 2;
pLogIconBmpBits[i] = (char*)mir_alloc(size);
size_t rtfHeaderSize = mir_snprintf(pLogIconBmpBits[i], size, "{\\pict\\dibitmap0\\wbmbitspixel%u\\wbmplanes1\\wbmwidthbytes%u\\picw%u\\pich%u ", bih.biBitCount, widthBytes, bih.biWidth, bih.biHeight);
HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp);
FillRect(hdcMem, &rc, hBkgBrush);
DrawIconEx(hdcMem, 0, 0, hIcon, bih.biWidth, bih.biHeight, 0, NULL, DI_NORMAL);
- Skin_ReleaseIcon(hIcon);
+ IcoLib_ReleaseIcon(hIcon);
SelectObject(hdcMem, hoBmp);
GetDIBits(hdc, hBmp, 0, bih.biHeight, pBmpBits, (BITMAPINFO*)&bih, DIB_RGB_COLORS);
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 80c55f5a4f..b152ed7bb7 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -186,7 +186,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) cle.ptszTooltip = szTip;
CallServiceSync(MS_CLIST_REMOVEEVENT, hContact, 1);
CallServiceSync(MS_CLIST_ADDEVENT, hContact, (LPARAM)&cle);
- Skin_ReleaseIcon(cle.hIcon);
+ IcoLib_ReleaseIcon(cle.hIcon);
}
}
return 0;
diff --git a/src/mir_app/src/DefaultExtraIcons.cpp b/src/mir_app/src/DefaultExtraIcons.cpp index 0b41f377e3..38b19bc5d1 100644 --- a/src/mir_app/src/DefaultExtraIcons.cpp +++ b/src/mir_app/src/DefaultExtraIcons.cpp @@ -51,7 +51,7 @@ static void SetVisibility(MCONTACT hContact, int apparentMode, bool clear) // Is chat
hExtraIcon = hExtraChat;
if (apparentMode == ID_STATUS_OFFLINE)
- hIcolib = Skin_GetIconHandle("ChatActivity");
+ hIcolib = IcoLib_GetIconHandle("ChatActivity");
}
else {
// Not chat
diff --git a/src/mir_app/src/IcoLib.h b/src/mir_app/src/IcoLib.h index e8bd131b1d..2253ec963e 100644 --- a/src/mir_app/src/IcoLib.h +++ b/src/mir_app/src/IcoLib.h @@ -94,8 +94,6 @@ IconSourceItem* GetIconSourceItem(const TCHAR* file, int indx, int cxIcon, int c IcolibItem* IcoLib_FindHIcon(HICON hIcon, bool &big);
IcolibItem* IcoLib_FindIcon(const char* pszIconName);
-HICON IconItem_GetIcon(IcolibItem* item, bool big);
-
int SkinOptionsInit(WPARAM, LPARAM);
extern mir_cs csIconList;
diff --git a/src/mir_app/src/button.cpp b/src/mir_app/src/button.cpp index 6b69ff1e2d..0c8648f485 100644 --- a/src/mir_app/src/button.cpp +++ b/src/mir_app/src/button.cpp @@ -295,7 +295,8 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR bct->hwndToolTips = NULL;
}
}
- if (bct->arrow) IcoLib_ReleaseIcon(bct->arrow, 0);
+ if (bct->arrow)
+ IcoLib_ReleaseIcon(bct->arrow);
DestroyTheme(bct);
}
break;
@@ -430,7 +431,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR }
else {
if (bct->arrow) {
- IcoLib_ReleaseIcon(bct->arrow, 0);
+ IcoLib_ReleaseIcon(bct->arrow);
bct->arrow = NULL;
SetHwndPropInt(bct, OBJID_CLIENT, CHILDID_SELF, PROPID_ACC_ROLE, ROLE_SYSTEM_PUSHBUTTON);
}
diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h index a84ed5cf54..26bd0710de 100644 --- a/src/mir_app/src/chat.h +++ b/src/mir_app/src/chat.h @@ -76,7 +76,7 @@ int OptionsInit(void); int OptionsUnInit(void);
void LoadMsgDlgFont(int i, LOGFONT * lf, COLORREF * colour);
void LoadGlobalSettings(void);
-HICON LoadIconEx(char* pszIcoLibName, BOOL big);
+HICON LoadIconEx(char* pszIcoLibName, bool big);
void LoadLogFonts(void);
void SetIndentSize(void);
void RegisterFonts(void);
diff --git a/src/mir_app/src/chat_opts.cpp b/src/mir_app/src/chat_opts.cpp index 3497d5b22b..3a5252e959 100644 --- a/src/mir_app/src/chat_opts.cpp +++ b/src/mir_app/src/chat_opts.cpp @@ -182,11 +182,11 @@ void RegisterFonts(void) // load icons from the skinning module if available
-HICON LoadIconEx(char* pszIcoLibName, BOOL big)
+HICON LoadIconEx(char* pszIcoLibName, bool big)
{
char szTemp[256];
mir_snprintf(szTemp, "chat_%s", pszIcoLibName);
- return Skin_GetIcon(szTemp, big);
+ return IcoLib_GetIcon(szTemp, big);
}
static void InitSetting(TCHAR** ppPointer, char* pszSetting, TCHAR* pszDefault)
diff --git a/src/mir_app/src/clistmenus.cpp b/src/mir_app/src/clistmenus.cpp index 78eb3a8433..9581c128c3 100644 --- a/src/mir_app/src/clistmenus.cpp +++ b/src/mir_app/src/clistmenus.cpp @@ -518,7 +518,7 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) DestroyIcon(timi->mi.hIcon);
timi->mi.hIcon = NULL;
}
- else IcoLib_ReleaseIcon(timi->mi.hIcon, 0);
+ else IcoLib_ReleaseIcon(timi->mi.hIcon);
}
}
@@ -939,7 +939,7 @@ void RebuildMenuOrder(void) mir_snprintf(buf, "ProtocolIcon_%s_%s", pa->szModuleName, tmi.pszName);
MO_SetOptionsMenuItem(hStatusMenuHandles[i].menuhandle[j], OPT_MENUITEMSETUNIQNAME, (INT_PTR)buf);
- IcoLib_ReleaseIcon(tmi.hIcon, 0);
+ IcoLib_ReleaseIcon(tmi.hIcon);
}
}
@@ -985,7 +985,7 @@ void RebuildMenuOrder(void) mir_snprintf(buf, "Root2ProtocolIcon_%s_%s", pa->szModuleName, tmi.pszName);
MO_SetOptionsMenuItem(hStatusMainMenuHandles[j], OPT_MENUITEMSETUNIQNAME, (INT_PTR)buf);
- IcoLib_ReleaseIcon(tmi.hIcon, 0);
+ IcoLib_ReleaseIcon(tmi.hIcon);
break;
}
}
diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index 0d4443782b..42f231e425 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -985,13 +985,13 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM HICON hIcon = LoadSkinProtoIcon(szProto, status);
DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - g_IconHeight) >> 1, hIcon,
g_IconWidth, g_IconHeight, 0, NULL, DI_NORMAL);
- IcoLib_ReleaseIcon(hIcon, 0);
+ IcoLib_ReleaseIcon(hIcon);
if (Proto_IsAccountLocked(Proto_GetAccount(szProto))) {
hIcon = LoadSkinnedIcon(SKINICON_OTHER_STATUS_LOCKED);
if (hIcon != NULL) {
DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - g_IconHeight) >> 1, hIcon,
g_IconWidth, g_IconHeight, 0, NULL, DI_NORMAL);
- IcoLib_ReleaseIcon(hIcon, 0);
+ IcoLib_ReleaseIcon(hIcon);
}
}
@@ -1023,7 +1023,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (dis->itemData == MENU_MIRANDAMENU) {
HICON hIcon = LoadSkinnedIcon(SKINICON_OTHER_MAINMENU);
fnDrawMenuItem(dis, CopyIcon(hIcon), NULL);
- IcoLib_ReleaseIcon(hIcon, NULL);
+ IcoLib_ReleaseIcon(hIcon);
return TRUE;
}
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
diff --git a/src/mir_app/src/dbutils.cpp b/src/mir_app/src/dbutils.cpp index 3de2bfb8a2..02a6821b7d 100644 --- a/src/mir_app/src/dbutils.cpp +++ b/src/mir_app/src/dbutils.cpp @@ -213,11 +213,11 @@ static INT_PTR DbEventGetIcon(WPARAM wParam, LPARAM lParam) return (INT_PTR)icon;
}
if (et && et->eventIcon)
- icon = Skin_GetIconByHandle(et->eventIcon);
+ icon = IcoLib_GetIconByHandle(et->eventIcon);
if (!icon) {
char szName[100];
mir_snprintf(szName, SIZEOF(szName), "eventicon_%s%d", dbei->szModule, dbei->eventType);
- icon = Skin_GetIcon(szName);
+ icon = IcoLib_GetIcon(szName);
}
if (!icon) {
diff --git a/src/mir_app/src/genmenu.cpp b/src/mir_app/src/genmenu.cpp index eac64d523e..41ecec5c04 100644 --- a/src/mir_app/src/genmenu.cpp +++ b/src/mir_app/src/genmenu.cpp @@ -335,7 +335,7 @@ int MO_ModifyMenuItem(PMO_IntMenuItem menuHandle, PMO_MenuItem pmi) if (hIcon != NULL) {
pimi->hIcolibItem = hIcolibItem;
pimi->iconId = ImageList_ReplaceIcon(pimi->parent->m_hMenuIcons, pimi->iconId, hIcon);
- IcoLib_ReleaseIcon(hIcon, 0);
+ IcoLib_ReleaseIcon(hIcon);
}
else pimi->iconId = -1, pimi->hIcolibItem = NULL;
}
@@ -668,7 +668,7 @@ PMO_IntMenuItem MO_AddNewMenuItem(HANDLE menuobjecthandle, PMO_MenuItem pmi) HICON hIcon = IcoLib_GetIconByHandle(hIcolibItem, false);
p->iconId = ImageList_AddIcon(pmo->m_hMenuIcons, hIcon);
p->hIcolibItem = hIcolibItem;
- IcoLib_ReleaseIcon(hIcon, 0);
+ IcoLib_ReleaseIcon(hIcon);
}
else p->iconId = ImageList_AddIcon(pmo->m_hMenuIcons, pmi->hIcon);
}
@@ -1027,7 +1027,7 @@ static int MO_ReloadIcon(PMO_IntMenuItem pmi, void*) if (newIcon)
ImageList_ReplaceIcon(pmi->parent->m_hMenuIcons, pmi->iconId, newIcon);
- IcoLib_ReleaseIcon(newIcon, 0);
+ IcoLib_ReleaseIcon(newIcon);
}
return FALSE;
@@ -1085,12 +1085,12 @@ static int MO_RegisterIcon(PMO_IntMenuItem pmi, void*) sid.pszName = iconame;
sid.description.t = descr;
sid.hDefaultIcon = hIcon;
- pmi->hIcolibItem = IcoLib_AddNewIcon(0, &sid);
+ pmi->hIcolibItem = IcoLib_AddIcon(&sid, 0);
Safe_DestroyIcon(hIcon);
- if (hIcon = Skin_GetIcon(iconame)) {
+ if (hIcon = IcoLib_GetIcon(iconame)) {
ImageList_ReplaceIcon(pmi->parent->m_hMenuIcons, pmi->iconId, hIcon);
- IcoLib_ReleaseIcon(hIcon, 0);
+ IcoLib_ReleaseIcon(hIcon);
}
}
diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp index f477997d99..eb85a2ebd9 100644 --- a/src/mir_app/src/icolib.cpp +++ b/src/mir_app/src/icolib.cpp @@ -31,10 +31,6 @@ HANDLE hIcons2ChangedEvent, hIconsChangedEvent; HICON hIconBlank = NULL;
-static HANDLE
- hIcoLib_AddNewIcon, hIcoLib_RemoveIcon, hIcoLib_GetIcon, hIcoLib_GetIcon2,
- hIcoLib_GetIconHandle, hIcoLib_IsManaged, hIcoLib_AddRef, hIcoLib_ReleaseIcon;
-
int iconEventActive = 0;
BOOL bNeedRebuild = FALSE;
@@ -496,9 +492,9 @@ static void IcoLib_FreeIcon(IcolibItem* icon) }
/////////////////////////////////////////////////////////////////////////////////////////
-// IcoLib_AddNewIcon
+// IcoLib_AddIcon
-MIR_APP_DLL(HANDLE) IcoLib_AddNewIcon(int hLangpack, SKINICONDESC *sid)
+MIR_APP_DLL(HANDLE) IcoLib_AddIcon(SKINICONDESC *sid, int hLangpack)
{
bool utf = (sid->flags & SIDF_UNICODE) != 0;
bool utf_path = (sid->flags & SIDF_PATH_UNICODE) != 0;
@@ -568,6 +564,44 @@ MIR_APP_DLL(HANDLE) IcoLib_AddNewIcon(int hLangpack, SKINICONDESC *sid) }
/////////////////////////////////////////////////////////////////////////////////////////
+// IcoLib_ReleaseIcon
+
+static int ReleaseIconInternal(IcolibItem *item, bool big)
+{
+ if (item == NULL)
+ return 1;
+
+ IconSourceItem *source = big && !item->cx ? item->source_big : item->source_small;
+ if (source && source->icon_ref_count) {
+ if (iconEventActive)
+ source->icon_ref_count--;
+ else
+ IconSourceItem_ReleaseIcon(source);
+ return 0;
+ }
+
+ return 1;
+}
+
+MIR_APP_DLL(int) IcoLib_ReleaseIcon(HICON hIcon, bool big)
+{
+ if (hIcon == NULL)
+ return 1;
+
+ mir_cslock lck(csIconList);
+ return ReleaseIconInternal(IcoLib_FindHIcon(hIcon, big), big);
+}
+
+MIR_APP_DLL(int) IcoLib_Release(const char *szIconName, bool big)
+{
+ if (szIconName == NULL)
+ return 1;
+
+ mir_cslock lck(csIconList);
+ return ReleaseIconInternal(IcoLib_FindIcon(szIconName), big);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
// IcoLib_RemoveIcon
static int IcoLib_RemoveIcon_Internal(int i)
@@ -579,24 +613,22 @@ static int IcoLib_RemoveIcon_Internal(int i) return 0;
}
-static INT_PTR IcoLib_RemoveIcon(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(void) IcoLib_RemoveIcon(const char *pszIconName)
{
- if (wParam) {
- mir_cslock lck(csIconList);
+ mir_cslock lck(csIconList);
- int i = iconList.indexOf((IcolibItem*)wParam);
- if (i != -1)
- return IcoLib_RemoveIcon_Internal(i);
- }
+ int i = iconList.indexOf((IcolibItem*)&pszIconName);
+ if (i != -1)
+ IcoLib_RemoveIcon_Internal(i);
+}
- if (lParam) {
- mir_cslock lck(csIconList);
+MIR_APP_DLL(void) IcoLib_RemoveIconByHandle(HANDLE hIcoLib)
+{
+ mir_cslock lck(csIconList);
- int i = iconList.getIndex((IcolibItem*)&lParam);
- if (i != -1)
- return IcoLib_RemoveIcon_Internal(i);
- }
- return 1; // Failed
+ int i = iconList.getIndex((IcolibItem*)hIcoLib);
+ if (i != -1)
+ IcoLib_RemoveIcon_Internal(i);
}
void KillModuleIcons(int hLangpack)
@@ -666,14 +698,16 @@ HICON IconItem_GetDefaultIcon(IcolibItem* item, bool big) /////////////////////////////////////////////////////////////////////////////////////////
// IconItem_GetIcon
-HICON IconItem_GetIcon(IcolibItem* item, bool big)
+HICON IconItem_GetIcon(HANDLE hIcoLib, bool big)
{
- DBVARIANT dbv = { 0 };
- HICON hIcon = NULL;
+ IcolibItem *item = (IcolibItem*)hIcoLib;
+ if (item == NULL)
+ return NULL;
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);
@@ -683,6 +717,7 @@ HICON IconItem_GetIcon(IcolibItem* item, bool big) db_free(&dbv);
}
+ HICON hIcon = NULL;
if (source)
hIcon = IconSourceItem_GetIcon(source);
@@ -763,23 +798,21 @@ MIR_APP_DLL(HANDLE) IcoLib_IsManaged(HICON hIcon) // lParam: NULL
// wParam: HICON
-static INT_PTR IcoLib_AddRef(WPARAM wParam, LPARAM)
+MIR_APP_DLL(int) IcoLib_AddRef(HICON hIcon)
{
mir_cslock lck(csIconList);
bool big;
- IcolibItem *item = IcoLib_FindHIcon((HICON)wParam, big);
-
- INT_PTR res = 1;
+ IcolibItem *item = IcoLib_FindHIcon(hIcon, big);
if (item) {
IconSourceItem* source = big && !item->cx ? item->source_big : item->source_small;
if (source->icon_ref_count) {
source->icon_ref_count++;
- res = 0;
+ return 0;
}
}
- return res;
+ return 1;
}
static int SkinSystemModulesLoaded(WPARAM, LPARAM)
@@ -791,57 +824,12 @@ static int SkinSystemModulesLoaded(WPARAM, LPARAM) /////////////////////////////////////////////////////////////////////////////////////////
// Module initialization and finalization procedure
-static INT_PTR sttIcoLib_AddNewIcon(WPARAM wParam, LPARAM lParam)
-{
- return (INT_PTR)IcoLib_AddNewIcon((int)wParam, (SKINICONDESC*)lParam);
-}
-
-static INT_PTR sttIcoLib_GetIcon(WPARAM wParam, LPARAM lParam)
-{
- return (INT_PTR)IcoLib_GetIcon((const char*)lParam, wParam != 0);
-}
-
-static INT_PTR sttIcoLib_GetIconHandle(WPARAM, LPARAM lParam)
-{
- return (INT_PTR)IcoLib_GetIconHandle((const char*)lParam);
-}
-
-static INT_PTR sttIcoLib_GetIconByHandle(WPARAM wParam, LPARAM lParam)
-{
- return (INT_PTR)IcoLib_GetIconByHandle((HANDLE)lParam, wParam != 0);
-}
-
-static INT_PTR sttIcoLib_ReleaseIcon(WPARAM wParam, LPARAM lParam)
-{
- return (INT_PTR)IcoLib_ReleaseIcon((HICON)wParam, (char*)lParam, false);
-}
-
-static INT_PTR sttIcoLib_ReleaseIconBig(WPARAM wParam, LPARAM lParam)
-{
- return (INT_PTR)IcoLib_ReleaseIcon((HICON)wParam, (char*)lParam, true);
-}
-
-static INT_PTR sttIcoLib_IsManaged(WPARAM wParam, LPARAM)
-{
- return (INT_PTR)IcoLib_IsManaged((HICON)wParam);
-}
-
int LoadIcoLibModule(void)
{
bModuleInitialized = TRUE;
hIconBlank = LoadIconEx(g_hInst, MAKEINTRESOURCE(IDI_BLANK), 0);
- hIcoLib_AddNewIcon = CreateServiceFunction("Skin2/Icons/AddIcon", sttIcoLib_AddNewIcon);
- hIcoLib_RemoveIcon = CreateServiceFunction(MS_SKIN2_REMOVEICON, IcoLib_RemoveIcon);
- hIcoLib_GetIcon = CreateServiceFunction(MS_SKIN2_GETICON, sttIcoLib_GetIcon);
- hIcoLib_GetIconHandle = CreateServiceFunction(MS_SKIN2_GETICONHANDLE, sttIcoLib_GetIconHandle);
- hIcoLib_GetIcon2 = CreateServiceFunction(MS_SKIN2_GETICONBYHANDLE, sttIcoLib_GetIconByHandle);
- hIcoLib_IsManaged = CreateServiceFunction(MS_SKIN2_ISMANAGEDICON, sttIcoLib_IsManaged);
- hIcoLib_AddRef = CreateServiceFunction(MS_SKIN2_ADDREFICON, IcoLib_AddRef);
- hIcoLib_ReleaseIcon = CreateServiceFunction(MS_SKIN2_RELEASEICON, sttIcoLib_ReleaseIcon);
- hIcoLib_ReleaseIcon = CreateServiceFunction(MS_SKIN2_RELEASEICONBIG, sttIcoLib_ReleaseIconBig);
-
hIcons2ChangedEvent = CreateHookableEvent(ME_SKIN2_ICONSCHANGED);
hIconsChangedEvent = CreateHookableEvent(ME_SKIN_ICONSCHANGED);
@@ -858,15 +846,6 @@ void UnloadIcoLibModule(void) DestroyHookableEvent(hIconsChangedEvent);
DestroyHookableEvent(hIcons2ChangedEvent);
- DestroyServiceFunction(hIcoLib_AddNewIcon);
- DestroyServiceFunction(hIcoLib_RemoveIcon);
- DestroyServiceFunction(hIcoLib_GetIcon);
- DestroyServiceFunction(hIcoLib_GetIconHandle);
- DestroyServiceFunction(hIcoLib_GetIcon2);
- DestroyServiceFunction(hIcoLib_IsManaged);
- DestroyServiceFunction(hIcoLib_AddRef);
- DestroyServiceFunction(hIcoLib_ReleaseIcon);
-
for (int i = iconList.getCount() - 1; i >= 0; i--) {
IcolibItem* p = iconList[i];
iconList.remove(i);
diff --git a/src/mir_app/src/meta_addto.cpp b/src/mir_app/src/meta_addto.cpp index d66c173d7f..0d48ea2c34 100644 --- a/src/mir_app/src/meta_addto.cpp +++ b/src/mir_app/src/meta_addto.cpp @@ -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);
- Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0));
+ IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0));
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 85e8154aaa..70f0944e59 100644 --- a/src/mir_app/src/meta_edit.cpp +++ b/src/mir_app/src/meta_edit.cpp @@ -428,7 +428,7 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara return TRUE;
case WM_DESTROY:
- Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0));
+ IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0));
EndDialog(hwndDlg, IDCANCEL);
break;
}
diff --git a/src/mir_app/src/meta_main.cpp b/src/mir_app/src/meta_main.cpp index b13c607e64..3add80aee5 100644 --- a/src/mir_app/src/meta_main.cpp +++ b/src/mir_app/src/meta_main.cpp @@ -44,7 +44,7 @@ HANDLE GetIconHandle(IconIndex i) HICON LoadIconEx(IconIndex i)
{
- return Skin_GetIcon(iconList[i].szName);
+ return IcoLib_GetIcon(iconList[i].szName);
}
void UnloadMetacontacts(void)
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index c713745838..b23236d6d4 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -8,7 +8,7 @@ LoadSkinIcon @5 Button_FreeIcon_IcoLib @6
Button_SetIcon_IcoLib @7
GetSkinIconHandle @8
-IcoLib_AddNewIcon @9
+IcoLib_AddIcon @9
IcoLib_GetIcon @10
IcoLib_GetIconByHandle @11
IcoLib_GetIconHandle @12
@@ -19,3 +19,7 @@ Window_SetIcon_IcoLib @16 Window_SetProtoIcon_IcoLib @17
ProtoServiceExists @18
mir_main @19
+IcoLib_RemoveIcon @20
+IcoLib_RemoveIconByHandle @21
+IcoLib_Release @22
+IcoLib_AddRef @23
diff --git a/src/mir_app/src/options_ei.cpp b/src/mir_app/src/options_ei.cpp index dbac3f75c2..54c2d4fb25 100644 --- a/src/mir_app/src/options_ei.cpp +++ b/src/mir_app/src/options_ei.cpp @@ -267,12 +267,12 @@ public: for (int i = 0; i < registeredExtraIcons.getCount(); i++) {
ExtraIcon *extra = registeredExtraIcons[i];
- HICON hIcon = Skin_GetIcon(extra->getDescIcon());
+ HICON hIcon = IcoLib_GetIcon(extra->getDescIcon());
if (hIcon == NULL)
ImageList_AddIcon(hImageList, hBlankIcon);
else {
ImageList_AddIcon(hImageList, hIcon);
- Skin_ReleaseIcon(hIcon);
+ IcoLib_ReleaseIcon(hIcon);
}
}
m_tree.SetImageList(hImageList, TVSIL_NORMAL);
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp index 2d18d58757..a61a45f930 100644 --- a/src/mir_app/src/protocols.cpp +++ b/src/mir_app/src/protocols.cpp @@ -286,12 +286,12 @@ HICON Proto_GetIcon(PROTO_INTERFACE *ppro, int iconIndex) return (HICON)ppro->m_hProtoIcon;
bool big = (iconIndex & PLIF_SMALL) == 0;
- HICON hIcon = Skin_GetIconByHandle(ppro->m_hProtoIcon, big);
+ HICON hIcon = IcoLib_GetIconByHandle(ppro->m_hProtoIcon, big);
if (iconIndex & PLIF_ICOLIB)
return hIcon;
HICON hIcon2 = CopyIcon(hIcon);
- Skin_ReleaseIcon(hIcon);
+ IcoLib_ReleaseIcon(hIcon);
return hIcon2;
}
diff --git a/src/mir_app/src/protoopts.cpp b/src/mir_app/src/protoopts.cpp index 8e072db725..8a5d0e7a15 100644 --- a/src/mir_app/src/protoopts.cpp +++ b/src/mir_app/src/protoopts.cpp @@ -592,14 +592,14 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM HICON hIcon = LoadSkinnedIcon(tmp);
DrawIconEx(lps->hDC, lps->rcItem.left, lps->rcItem.top, hIcon, cxIcon, cyIcon, 0, hbrBack, DI_NORMAL);
- IcoLib_ReleaseIcon(hIcon, 0);
+ IcoLib_ReleaseIcon(hIcon);
lps->rcItem.left += cxIcon + 2;
if (acc->ppro) {
- hIcon = Skin_GetIconByHandle(acc->ppro->m_hProtoIcon);
+ hIcon = IcoLib_GetIconByHandle(acc->ppro->m_hProtoIcon);
DrawIconEx(lps->hDC, lps->rcItem.left, lps->rcItem.top, hIcon, cxIcon, cyIcon, 0, hbrBack, DI_NORMAL);
- Skin_ReleaseIcon(hIcon);
+ IcoLib_ReleaseIcon(hIcon);
}
lps->rcItem.left += cxIcon + 2;
diff --git a/src/mir_app/src/skin2opts.cpp b/src/mir_app/src/skin2opts.cpp index c5645c5008..ace1b18781 100644 --- a/src/mir_app/src/skin2opts.cpp +++ b/src/mir_app/src/skin2opts.cpp @@ -66,37 +66,6 @@ static HICON ExtractIconFromPath(const TCHAR *path, int cxIcon, int cyIcon) }
/////////////////////////////////////////////////////////////////////////////////////////
-// IcoLib_ReleaseIcon
-// lParam: pszIconName or NULL
-// wParam: HICON or NULL
-
-MIR_APP_DLL(int) IcoLib_ReleaseIcon(HICON hIcon, char* szIconName, bool big)
-{
- mir_cslock lck(csIconList);
-
- IcolibItem *item = NULL;
- if (szIconName)
- item = IcoLib_FindIcon(szIconName);
-
- if (!item && hIcon) // find by HICON
- item = IcoLib_FindHIcon(hIcon, big);
-
- int res = 1;
- if (item) {
- IconSourceItem* source = big && !item->cx ? item->source_big : item->source_small;
- if (source && source->icon_ref_count) {
- if (iconEventActive)
- source->icon_ref_count--;
- else
- IconSourceItem_ReleaseIcon(source);
- res = 0;
- }
- }
-
- return res;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
// IconItem_GetIcon_Preview
HICON IconItem_GetIcon_Preview(IcolibItem* item)
@@ -104,7 +73,7 @@ HICON IconItem_GetIcon_Preview(IcolibItem* item) HICON hIcon = NULL;
if (!item->temp_reset) {
- HICON hRefIcon = IconItem_GetIcon(item, false);
+ HICON hRefIcon = IcoLib_GetIconByHandle(item, false);
hIcon = CopyIcon(hRefIcon);
if (item->source_small && item->source_small->icon == hRefIcon)
IconSourceItem_ReleaseIcon(item->source_small);
diff --git a/src/mir_app/src/skinicons.cpp b/src/mir_app/src/skinicons.cpp index 75703b1b52..63ba1b81d3 100644 --- a/src/mir_app/src/skinicons.cpp +++ b/src/mir_app/src/skinicons.cpp @@ -160,7 +160,7 @@ int ImageList_AddIcon_IconLibLoaded(HIMAGELIST hIml, int iconId) {
HICON hIcon = LoadSkinIcon(iconId);
int res = ImageList_AddIcon(hIml, hIcon);
- IcoLib_ReleaseIcon(hIcon, 0);
+ IcoLib_ReleaseIcon(hIcon);
return res;
}
@@ -168,7 +168,7 @@ int ImageList_AddIcon_ProtoIconLibLoaded(HIMAGELIST hIml, const char *szProto, i {
HICON hIcon = LoadSkinProtoIcon(szProto, iconId);
int res = ImageList_AddIcon(hIml, hIcon);
- IcoLib_ReleaseIcon(hIcon, 0);
+ IcoLib_ReleaseIcon(hIcon);
return res;
}
@@ -183,7 +183,7 @@ int ImageList_ReplaceIcon_NotShared(HIMAGELIST hIml, int iIndex, HINSTANCE hInst int ImageList_ReplaceIcon_IconLibLoaded(HIMAGELIST hIml, int nIndex, HICON hIcon)
{
int res = ImageList_ReplaceIcon(hIml, nIndex, hIcon);
- IcoLib_ReleaseIcon(hIcon, 0);
+ IcoLib_ReleaseIcon(hIcon);
return res;
}
@@ -201,8 +201,8 @@ MIR_APP_DLL(void) Window_SetProtoIcon_IcoLib(HWND hWnd, const char *szProto, int MIR_APP_DLL(void) Window_FreeIcon_IcoLib(HWND hWnd)
{
- IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_BIG, 0), NULL);
- IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_SMALL, 0), NULL);
+ IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_BIG, 0));
+ IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_SMALL, 0));
}
MIR_APP_DLL(void) Button_SetIcon_IcoLib(HWND hwndDlg, int itemId, int iconId, const char *tooltip)
@@ -216,7 +216,7 @@ MIR_APP_DLL(void) Button_SetIcon_IcoLib(HWND hwndDlg, int itemId, int iconId, co MIR_APP_DLL(void) Button_FreeIcon_IcoLib(HWND hwndDlg, int itemId)
{
HICON hIcon = (HICON)SendDlgItemMessage(hwndDlg, itemId, BM_SETIMAGE, IMAGE_ICON, 0);
- IcoLib_ReleaseIcon(hIcon, 0);
+ IcoLib_ReleaseIcon(hIcon);
}
MIR_APP_DLL(HICON) LoadSkinProtoIcon(const char *szProto, int status, bool big)
@@ -317,7 +317,7 @@ MIR_APP_DLL(HICON) LoadSkinProtoIcon(const char *szProto, int status, bool big) sid.pszName = iconName;
sid.description.t = cli.pfnGetStatusModeDescription(statusIcons[i].id, 0);
sid.iDefaultIndex = statusIcons[i].resource_id;
- IcoLib_AddNewIcon(0, &sid);
+ IcoLib_AddIcon(&sid, 0);
}
}
@@ -417,7 +417,7 @@ int LoadSkinIcons(void) sid.section.a = mainIcons[i].section == NULL ? LPGEN("Main icons") : (char*)mainIcons[i].section;
sid.description.a = (char*)mainIcons[i].description;
sid.iDefaultIndex = mainIcons[i].resource_id;
- mainIcons[i].hIcolib = IcoLib_AddNewIcon(0, &sid);
+ mainIcons[i].hIcolib = IcoLib_AddIcon(&sid, 0);
}
// Add global icons to list
@@ -430,7 +430,7 @@ int LoadSkinIcons(void) sid.pszName = iconName;
sid.description.a = (char*)statusIcons[i].description;
sid.iDefaultIndex = statusIcons[i].resource_id;
- statusIcons[i].hIcolib = IcoLib_AddNewIcon(0, &sid);
+ statusIcons[i].hIcolib = IcoLib_AddIcon(&sid, 0);
}
return 0;
}
diff --git a/src/mir_app/src/usedIcons.cpp b/src/mir_app/src/usedIcons.cpp index 5592e01f82..843f6dd77d 100644 --- a/src/mir_app/src/usedIcons.cpp +++ b/src/mir_app/src/usedIcons.cpp @@ -53,10 +53,10 @@ static Icon* FindIcon(const char *icolibName) usedIcons.insert(icon = new Icon(icolibName));
if (icon->hImage == INVALID_HANDLE_VALUE) {
- HICON hIcon = Skin_GetIcon(icon->name);
+ HICON hIcon = IcoLib_GetIcon(icon->name);
if (hIcon != NULL) {
icon->hImage = ExtraIcon_Add(hIcon);
- Skin_ReleaseIcon(hIcon);
+ IcoLib_ReleaseIcon(hIcon);
}
}
diff --git a/src/mir_core/src/ui_utils.cpp b/src/mir_core/src/ui_utils.cpp index e80ac05897..fae4fb3f3e 100644 --- a/src/mir_core/src/ui_utils.cpp +++ b/src/mir_core/src/ui_utils.cpp @@ -648,7 +648,7 @@ CCtrlMButton::CCtrlMButton(CDlgBase* dlg, int ctrlId, int iCoreIcon, const char* CCtrlMButton::~CCtrlMButton()
{
- ::Skin_ReleaseIcon(m_hIcon);
+ ::IcoLib_ReleaseIcon(m_hIcon);
}
void CCtrlMButton::OnInit()
@@ -2564,8 +2564,8 @@ INT_PTR CProtoIntDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) return result;
case WM_DESTROY:
- Skin_ReleaseIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_BIG, 0));
- Skin_ReleaseIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, 0));
+ IcoLib_ReleaseIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_BIG, 0));
+ IcoLib_ReleaseIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, 0));
m_proto_interface->WindowUnsubscribe(m_hwnd);
break;
|