1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
#include "Mra.h"
#include "MraIcons.h"
void AddIcoLibItems(LPWSTR lpwszRootSectionName,LPWSTR lpwszSubSectionName,const GUI_DISPLAY_ITEM *pgdiItems,SIZE_T dwCount,HANDLE *hResult)
{
char szBuff[MAX_PATH];
WCHAR wszSection[MAX_PATH],wszPath[MAX_FILEPATH];
SKINICONDESC sid={0};
sid.cbSize=SKINICONDESC_SIZE;
sid.pwszSection=wszSection;
sid.pwszDefaultFile=wszPath;
sid.cx=sid.cy=16;
sid.flags=SIDF_ALL_UNICODE;
if (lpwszSubSectionName==NULL) lpwszSubSectionName=L"";
GetModuleFileName(masMraSettings.hInstance,wszPath,SIZEOF(wszPath));
mir_sntprintf(wszSection,SIZEOF(wszSection),L"%s%s%s",lpwszRootSectionName,PROTOCOL_NAMEW,lpwszSubSectionName);
for (SIZE_T i=0;i<dwCount;i++)
{
mir_snprintf(szBuff,SIZEOF(szBuff),"%s_%s",PROTOCOL_NAMEA,pgdiItems[i].lpszName);
sid.pszName=szBuff;
sid.pwszDescription=pgdiItems[i].lpwszDescr;
sid.iDefaultIndex=-pgdiItems[i].defIcon;
sid.hDefaultIcon=(HICON)LoadImage(masMraSettings.hInstance,MAKEINTRESOURCE(pgdiItems[i].defIcon),IMAGE_ICON,0,0,LR_SHARED);
if (sid.hDefaultIcon==NULL) sid.hDefaultIcon=(HICON)LoadImage(NULL,MAKEINTRESOURCE(pgdiItems[i].defIcon),IMAGE_ICON,0,0,LR_SHARED);
hResult[i]=(HANDLE)CallService(MS_SKIN2_ADDICON,0,(LPARAM)&sid);
}
}
void RemoveIcoLibItems(const GUI_DISPLAY_ITEM *pgdiItems,SIZE_T dwCount)
{
char szBuff[MAX_PATH];
for (SIZE_T i=0;i<dwCount;i++)
{
mir_snprintf(szBuff,SIZEOF(szBuff),"%s_%s",PROTOCOL_NAMEA,pgdiItems[i].lpszName);
//***deb until 08 release
//CallService(MS_SKIN2_REMOVEICON,0,(LPARAM)szBuff);
}
}
HICON IconLibGetIcon(HANDLE hIcon)
{
return(IconLibGetIconEx(hIcon,LR_SHARED));
}
HICON IconLibGetIconEx(HANDLE hIcon,DWORD dwFlags)
{
HICON hiIcon=NULL;
if (hIcon)
{
hiIcon=(HICON)CallService(MS_SKIN2_GETICONBYHANDLE,0,(LPARAM)hIcon);
if ((dwFlags&LR_SHARED)==0)
{
hiIcon=CopyIcon(hiIcon);
}
}
return(hiIcon);
}
//////////////////////////////////////////////////////////////////////////////////////
void IconsLoad()
{
AddIcoLibItems(L"Protocols/",L"/MainMenu",gdiMenuItems,SIZEOF(gdiMenuItems),masMraSettings.hMainMenuIcons);
AddIcoLibItems(L"Protocols/",L"/ContactMenu",gdiContactMenuItems,SIZEOF(gdiContactMenuItems),masMraSettings.hContactMenuIcons);
// Advanced Status Icons initialization
AddIcoLibItems(L"Protocols/",L"/Extra status",gdiExtraStatusIconsItems,SIZEOF(gdiExtraStatusIconsItems),masMraSettings.hAdvancedStatusIcons);
}
void IconsUnLoad()
{
RemoveIcoLibItems(gdiMenuItems,SIZEOF(gdiMenuItems));
bzero(masMraSettings.hMainMenuIcons,sizeof(masMraSettings.hMainMenuIcons));
RemoveIcoLibItems(gdiContactMenuItems,SIZEOF(gdiContactMenuItems));
bzero(masMraSettings.hContactMenuIcons,sizeof(masMraSettings.hContactMenuIcons));
// Advanced Status Icons initialization
RemoveIcoLibItems(gdiExtraStatusIconsItems,SIZEOF(gdiExtraStatusIconsItems));
bzero(masMraSettings.hAdvancedStatusIcons,sizeof(masMraSettings.hAdvancedStatusIcons));
bzero(masMraSettings.hAdvancedStatusItems,sizeof(masMraSettings.hAdvancedStatusItems));
}
void InitXStatusIcons()
{
int iCurIndex;
char szBuff[MAX_PATH];
WCHAR wszSection[MAX_PATH],wszPath[MAX_FILEPATH];
SKINICONDESC sid={0};
sid.cbSize=SKINICONDESC_SIZE;
sid.pwszSection=wszSection;
sid.pwszDefaultFile=wszPath;
sid.cx=sid.cy=16;
sid.flags=SIDF_ALL_UNICODE;
if (masMraSettings.hDLLXStatusIcons)
{
GetModuleFileName(masMraSettings.hDLLXStatusIcons,wszPath,SIZEOF(wszPath));
}else{
bzero(wszPath,sizeof(wszPath));
}
mir_sntprintf(wszSection,SIZEOF(wszSection),L"Status Icons/%s/Custom Status",PROTOCOL_NAMEW);
masMraSettings.hXStatusAdvancedStatusIcons[0]=NULL;
for (SIZE_T i=1;i<(MRA_XSTATUS_COUNT+1);i++)
{
mir_snprintf(szBuff,SIZEOF(szBuff),"%s_xstatus%ld",PROTOCOL_NAMEA,i);
iCurIndex=(IDI_XSTATUS1-1+i);
sid.pszName=szBuff;
sid.pwszDescription=lpcszXStatusNameDef[i];
sid.iDefaultIndex=-iCurIndex;
if (masMraSettings.hDLLXStatusIcons)
{
sid.hDefaultIcon=(HICON)LoadImage(masMraSettings.hDLLXStatusIcons,MAKEINTRESOURCE(iCurIndex),IMAGE_ICON,0,0,LR_SHARED);
}else{
sid.hDefaultIcon=NULL;
}
masMraSettings.hXStatusAdvancedStatusIcons[i]=(HANDLE)CallService(MS_SKIN2_ADDICON,0,(LPARAM)&sid);
}
}
void DestroyXStatusIcons()
{
char szBuff[MAX_PATH];
for (SIZE_T i=1;i<(MRA_XSTATUS_COUNT+1);i++)
{
mir_snprintf(szBuff,SIZEOF(szBuff),"xstatus%ld",i);
//***deb until 08 release
//CallService(MS_SKIN2_REMOVEICON,0,(LPARAM)szBuff);
}
bzero(masMraSettings.hXStatusAdvancedStatusIcons,sizeof(masMraSettings.hXStatusAdvancedStatusIcons));
bzero(masMraSettings.hXStatusAdvancedStatusItems,sizeof(masMraSettings.hXStatusAdvancedStatusItems));
}
|