diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-02 14:11:01 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-02 14:11:01 +0000 |
commit | 75b1ff75c42644eb36552762652e4b0c9ff071bc (patch) | |
tree | 238f026ef373d30a395846f38c302a81961b14ac /plugins/MenuItemEx | |
parent | 2caba72d51b09368801f23dd8951d589ab4dc809 (diff) |
final switch to the typed icolib api
git-svn-id: http://svn.miranda-ng.org/main/trunk@2152 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MenuItemEx')
-rw-r--r-- | plugins/MenuItemEx/src/images.cpp | 32 | ||||
-rw-r--r-- | plugins/MenuItemEx/src/main.cpp | 26 |
2 files changed, 28 insertions, 30 deletions
diff --git a/plugins/MenuItemEx/src/images.cpp b/plugins/MenuItemEx/src/images.cpp index 51903294bb..61d7b7750f 100644 --- a/plugins/MenuItemEx/src/images.cpp +++ b/plugins/MenuItemEx/src/images.cpp @@ -27,7 +27,7 @@ void HalfBitmap32Alpha(HBITMAP hBitmap) for (y = 0; y < bmp.bmHeight; ++y) {
BYTE *px = p + bmp.bmWidth * 4 * y;
- for (x = 0; x < bmp.bmWidth; ++x)
+ for (x = 0; x < bmp.bmWidth; ++x)
{
px[3]>>=1;
px += 4;
@@ -90,9 +90,9 @@ void CorrectBitmap32Alpha(HBITMAP hBitmap, BOOL force) for (y = 0; fixIt && y < bmp.bmHeight; ++y) {
BYTE *px = p + bmp.bmWidth * 4 * y;
- for (x = 0; fixIt && x < bmp.bmWidth; ++x)
+ for (x = 0; fixIt && x < bmp.bmWidth; ++x)
{
- if (px[3] != 0 && !force)
+ if (px[3] != 0 && !force)
{
fixIt = FALSE;
}
@@ -115,7 +115,7 @@ void CorrectBitmap32Alpha(HBITMAP hBitmap, BOOL force) HBITMAP CopyBitmapTo32(HBITMAP hBitmap)
{
- BITMAPINFO RGB32BitsBITMAPINFO;
+ BITMAPINFO RGB32BitsBITMAPINFO;
BYTE * ptPixels;
HBITMAP hDirectBitmap;
@@ -138,10 +138,10 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap) RGB32BitsBITMAPINFO.bmiHeader.biPlanes = 1;
RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32;
- hDirectBitmap = CreateDIBSection(NULL,
- (BITMAPINFO *)&RGB32BitsBITMAPINFO,
+ hDirectBitmap = CreateDIBSection(NULL,
+ (BITMAPINFO *)&RGB32BitsBITMAPINFO,
DIB_RGB_COLORS,
- (void **)&ptPixels,
+ (void **)&ptPixels,
NULL, 0);
// Copy data
@@ -149,7 +149,7 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap) {
HDC hdcOrig, hdcDest;
HBITMAP oldOrig, oldDest;
-
+
hdcOrig = CreateCompatibleDC(NULL);
oldOrig = (HBITMAP) SelectObject(hdcOrig, hBitmap);
@@ -180,7 +180,7 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap) //HBITMAP CreateBitmap32(int cx, int cy)
//{
-// BITMAPINFO RGB32BitsBITMAPINFO;
+// BITMAPINFO RGB32BitsBITMAPINFO;
// UINT * ptPixels;
// HBITMAP DirectBitmap;
//
@@ -191,10 +191,10 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap) // RGB32BitsBITMAPINFO.bmiHeader.biPlanes=1;
// RGB32BitsBITMAPINFO.bmiHeader.biBitCount=32;
//
-// DirectBitmap = CreateDIBSection(NULL,
-// (BITMAPINFO *)&RGB32BitsBITMAPINFO,
+// DirectBitmap = CreateDIBSection(NULL,
+// (BITMAPINFO *)&RGB32BitsBITMAPINFO,
// DIB_RGB_COLORS,
-// (void **)&ptPixels,
+// (void **)&ptPixels,
// NULL, 0);
// return DirectBitmap;
//}
@@ -211,7 +211,7 @@ BOOL MakeBitmap32(HBITMAP *hBitmap) HBITMAP hBmpTmp = CopyBitmapTo32(*hBitmap);
DeleteObject(*hBitmap);
*hBitmap = hBmpTmp;
- }
+ }
return TRUE;
}
@@ -233,7 +233,7 @@ BOOL MakeBitmap32(HBITMAP *hBitmap) //
// dwLen = width * height * 4;
// p = (BYTE *)malloc(dwLen);
-// if (p == NULL)
+// if (p == NULL)
// {
// return FALSE;
// }
@@ -244,7 +244,7 @@ BOOL MakeBitmap32(HBITMAP *hBitmap) // HBITMAP hBmpTmp = CopyBitmapTo32(*hBitmap);
// DeleteObject(*hBitmap);
// *hBitmap = hBmpTmp;
-// }
+// }
// GetBitmapBits(*hBitmap, dwLen, p);
//
// // Make grayscale
@@ -323,7 +323,7 @@ HICON BindOverlayIcon(HICON SourceIcon,LPCSTR OverlayIconName) CorrectBitmap32Alpha(TargetIconInfo.hbmColor, FALSE);
GetObject(TargetIconInfo.hbmColor, sizeof(BITMAP), &TargetBitmapInfo);
- OverlayIcon = (HICON)CallService( MS_SKIN2_GETICON, 0, (LPARAM)OverlayIconName);
+ OverlayIcon = Skin_GetIcon(OverlayIconName);
if ( !GetIconInfo(OverlayIcon, &OverlayIconInfo) || !GetObject(OverlayIconInfo.hbmColor, sizeof(BITMAP), &OverlayBitmapInfo))
return NULL;
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 28efa1bea9..c96512f956 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -602,9 +602,7 @@ void ModifyInvisSet(CLISTMENUITEM *cli,int mode,BOOL alpha) void ModifyHidden(CLISTMENUITEM *cli,int mode)
{
cli->flags |= CMIM_ICON | CMIM_NAME;
- cli->hIcon = (mode) ?
- (HICON)CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_showil") :
- (HICON)CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_hidefl");
+ cli->hIcon = Skin_GetIcon((mode) ? "miex_showil" : "miex_hidefl");
cli->ptszName = mode ? LPGENT("Show in list") : LPGENT("Hide from list");
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hmenuHide, (LPARAM)cli);
}
@@ -1103,7 +1101,7 @@ static int TabsrmmButtonsInit(WPARAM wParam, LPARAM lParam) bbd.dwDefPos = 1000;
bbd.ptszTooltip = _T("Browse Received Files");
bbd.bbbFlags = BBBF_ISLSIDEBUTTON | BBBF_CANBEHIDDEN;
- bbd.hIcon = (HANDLE)CallService(MS_SKIN2_GETICONHANDLE, 0, (LPARAM)"miex_recfiles");
+ bbd.hIcon = Skin_GetIconHandle("miex_recfiles");
CallService (MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
return 0;
@@ -1250,7 +1248,7 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) mi.ptszName = LPGENT("Ignore");
mi.pszService = 0;
mi.flags |= CMIF_ROOTHANDLE;
- mi.hIcon = (HICON)CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_ignore" );
+ mi.hIcon = Skin_GetIcon("miex_ignore");
hmenuIgnore = Menu_AddContactMenuItem(&mi);
hIgnoreItem[0] = AddSubmenuItem(hmenuIgnore, ii[0].name, LoadSkinnedIcon(ii[0].icon), 0, MS_IGNORE, pos, ii[0].type );
@@ -1262,13 +1260,13 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) ood.cbSize = sizeof(ood);
ood.pszGroup = "Events";
ood.pszPage = "Ignore";
- AddSubmenuItem(hmenuIgnore, LPGENT("Open ignore settings"), (HICON)CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_ignore"), 0, "Opt/OpenOptions", pos, (int)&ood );
+ AddSubmenuItem(hmenuIgnore, LPGENT("Open ignore settings"), Skin_GetIcon("miex_ignore"), 0, "Opt/OpenOptions", pos, (int)&ood );
mi.pszPopupName = 0;
mi.position++;
mi.ptszName = LPGENT("Copy to Account");
mi.pszService = MS_PROTO;
- mi.hIcon = ( HICON )CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_protocol");
+ mi.hIcon = Skin_GetIcon("miex_protocol");
hmenuProto = Menu_AddContactMenuItem(&mi);
EnumProtoSubmenu(0, 0);
@@ -1278,13 +1276,13 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) mi.position++;
mi.ptszName = LPGENT("Send 'You were added'");
mi.pszService = MS_ADDED;
- mi.hIcon = ( HICON )CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_added");
+ mi.hIcon = Skin_GetIcon("miex_added");
hmenuAdded = Menu_AddContactMenuItem(&mi);
mi.position++;
mi.ptszName = LPGENT("Request authorization");
mi.pszService = MS_AUTHREQ;
- mi.hIcon = ( HICON )CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_authorization");
+ mi.hIcon = Skin_GetIcon("miex_authorization");
hmenuAuthReq = Menu_AddContactMenuItem(&mi);
mi.position++;
@@ -1295,13 +1293,13 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) mi.position++;
mi.ptszName = LPGENT("Browse Received Files");
mi.pszService = MS_RECVFILES;
- mi.hIcon = ( HICON )CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_recfiles");
+ mi.hIcon = Skin_GetIcon("miex_recfiles");
hmenuRecvFiles = Menu_AddContactMenuItem(&mi);
mi.position++;
mi.ptszName = LPGENT("Copy Status Message");
mi.pszService = MS_STATUSMSG;
- mi.hIcon = NULL;//LoadIcon(hinstance, MAKEINTRESOURCE(IDI_ICON5));
+ mi.hIcon = NULL;
hmenuStatusMsg = Menu_AddContactMenuItem(&mi);
mi.position++;
@@ -1314,9 +1312,9 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) mi.pszService = MS_COPYMIRVER;
hmenuCopyMirVer = Menu_AddContactMenuItem(&mi);
- hIcon[0] = ( HICON )CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_copymver");
- hIcon[1] = ( HICON )CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_vis");
- hIcon[2] = ( HICON )CallService( MS_SKIN2_GETICON, 0, (LPARAM)"miex_invis");
+ hIcon[0] = Skin_GetIcon("miex_copymver");
+ hIcon[1] = Skin_GetIcon("miex_vis");
+ hIcon[2] = Skin_GetIcon("miex_invis");
hIcon[3] = MakeHalfAlphaIcon(hIcon[1]);
hIcon[4] = MakeHalfAlphaIcon(hIcon[2]);
|