From 4fd0af75812a1dc4a275da315a173d93cb0b8e64 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Mon, 8 Apr 2013 04:55:16 +0000 Subject: MAX_REGS replaced on SIZEOF small cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@4382 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/hdr/modern_commonheaders.h | 17 ----------------- plugins/Clist_modern/src/modern_clc.cpp | 10 +++++----- plugins/Clist_modern/src/modern_clcpaint.cpp | 16 ++++++++-------- plugins/Clist_modern/src/modern_clui.cpp | 2 +- plugins/Clist_modern/src/modern_rowheight_funcs.cpp | 4 ++-- plugins/Clist_modern/src/modern_skineditor.cpp | 8 ++++---- 6 files changed, 20 insertions(+), 37 deletions(-) diff --git a/plugins/Clist_modern/src/hdr/modern_commonheaders.h b/plugins/Clist_modern/src/hdr/modern_commonheaders.h index 4d804a9aa0..e1e9461b3e 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonheaders.h +++ b/plugins/Clist_modern/src/hdr/modern_commonheaders.h @@ -121,11 +121,6 @@ extern char *g_szMetaModuleName; #define CLUI_FRAME_AUTOHIDENOTIFY 512 #define CLUI_FRAME_SHOWALWAYS 1024 - -//#define alloc(n) mir_alloc(n) - -#define MAX_REGS(_A_) (sizeof(_A_)/sizeof(_A_[0])) - #ifndef CS_DROPSHADOW #define CS_DROPSHADOW 0x00020000 #endif @@ -196,10 +191,6 @@ void MakeButtonSkinned(HWND hWnd); #define AC_SRC_ALPHA 0x01 #endif -//#ifdef _DEBUG -//#define DeleteObject(a) DebugDeleteObject(a) -//#endif - #define strsetA(a,b) {if (a) mir_free_and_nill(a); a=mir_strdup(b);} #define strsetT(a,b) {if (a) mir_free_and_nill(a); a=mir_tstrdup(b);} @@ -237,14 +228,6 @@ BOOL DestroyIcon_protect(HICON icon); #define ETDT_ENABLETAB (ETDT_ENABLE | ETDT_USETABTEXTURE) #endif - - -#define TreeView_InsertItemA(hwnd, lpis) \ - (HTREEITEM)SendMessageA((hwnd), TVM_INSERTITEMA, 0, (LPARAM)(LPTV_INSERTSTRUCTA)(lpis)) - -#define TreeView_GetItemA(hwnd, pitem) \ - (BOOL)SendMessageA((hwnd), TVM_GETITEMA, 0, (LPARAM)(TV_ITEM *)(pitem)) - enum { STATE_DLL_LOADING = 0, diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index e01d9be1bc..9c7a841b6e 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -107,7 +107,7 @@ static int clcHookModulesLoaded(WPARAM wParam, LPARAM lParam) Skin_AddIcon(&sid); sid.pszSection = LPGEN("Contact List") "/" LPGEN("Avatar Overlay"); - for (i=0; i < MAX_REGS(g_pAvatarOverlayIcons) ; i++) { + for (i=0; i < SIZEOF(g_pAvatarOverlayIcons) ; i++) { sid.pszDescription = g_pAvatarOverlayIcons[i].description; sid.pszName = g_pAvatarOverlayIcons[i].name; sid.iDefaultIndex = - g_pAvatarOverlayIcons[i].id; @@ -115,7 +115,7 @@ static int clcHookModulesLoaded(WPARAM wParam, LPARAM lParam) } sid.pszSection = LPGEN("Contact List") "/" LPGEN("Status Overlay"); - for (i=0; i < MAX_REGS(g_pStatusOverlayIcons); i++) { + for (i=0; i < SIZEOF(g_pStatusOverlayIcons); i++) { sid.pszDescription = g_pStatusOverlayIcons[i].description; sid.pszName = g_pStatusOverlayIcons[i].name; sid.iDefaultIndex = - g_pStatusOverlayIcons[i].id; @@ -169,14 +169,14 @@ static int clcHookIconsChanged(WPARAM wParam, LPARAM lParam) { int i; if (MirandaExiting()) return 0; - for (i=0 ; i < MAX_REGS(g_pAvatarOverlayIcons) ; i++) + for (i=0 ; i < SIZEOF(g_pAvatarOverlayIcons) ; i++) { g_pAvatarOverlayIcons[i].listID = -1; g_pStatusOverlayIcons[i].listID = -1; } if (hAvatarOverlays) ImageList_Destroy(hAvatarOverlays); - hAvatarOverlays = ImageList_Create(16,16,ILC_MASK|ILC_COLOR32,MAX_REGS(g_pAvatarOverlayIcons)*2,1); - for (i=0 ; i < MAX_REGS(g_pAvatarOverlayIcons) ; i++) + hAvatarOverlays = ImageList_Create(16, 16, ILC_MASK|ILC_COLOR32, SIZEOF(g_pAvatarOverlayIcons)*2, 1); + for (i=0 ; i < SIZEOF(g_pAvatarOverlayIcons) ; i++) { HICON hIcon = Skin_GetIcon(g_pAvatarOverlayIcons[i].name); g_pAvatarOverlayIcons[i].listID = ImageList_AddIcon(hAvatarOverlays,hIcon); diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index c2cc5583fb..766f7c6a99 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -1486,8 +1486,8 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact //TODO fix overlays // Draw overlay - if ( dat->avatars_draw_overlay && dat->avatars_maxheight_size >= ICON_HEIGHT + ( dat->avatars_draw_border ? 2 : 0 ) - && GetContactCachedStatus( Drawing->hContact ) - ID_STATUS_OFFLINE < MAX_REGS( g_pAvatarOverlayIcons )) + if (dat->avatars_draw_overlay && dat->avatars_maxheight_size >= ICON_HEIGHT + (dat->avatars_draw_border ? 2 : 0) + && GetContactCachedStatus(Drawing->hContact) - ID_STATUS_OFFLINE < SIZEOF(g_pAvatarOverlayIcons)) { p_rect.top = p_rect.bottom - ICON_HEIGHT; p_rect.left = p_rect.right - ICON_HEIGHT; @@ -2424,8 +2424,8 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact *D && ( !Drawing->image_is_special || !has_avatar || ( dat->avatars_draw_overlay - && dat->avatars_maxheight_size >= ICON_HEIGHT + ( dat->avatars_draw_border ? 2 : 0 ) - && GetContactCachedStatus( Drawing->hContact ) - ID_STATUS_OFFLINE < MAX_REGS( g_pAvatarOverlayIcons ) + && dat->avatars_maxheight_size >= ICON_HEIGHT + (dat->avatars_draw_border ? 2 : 0) + && GetContactCachedStatus(Drawing->hContact) - ID_STATUS_OFFLINE < SIZEOF(g_pAvatarOverlayIcons) && dat->avatars_overlay_type == SETTING_AVATAR_OVERLAY_TYPE_CONTACT ))) { @@ -2954,8 +2954,8 @@ void CLCPaint::_DrawContactAvatar( HDC hdcMem, ClcData *dat, ClcContact *Drawing { int overlayIdx = -1; int blendmode = 255; - if ( dat->avatars_draw_overlay && dat->avatars_maxheight_size >= ICON_HEIGHT + ( dat->avatars_draw_border ? 2 : 0 ) - && GetContactCachedStatus( Drawing->hContact ) - ID_STATUS_OFFLINE < MAX_REGS( g_pAvatarOverlayIcons )) + if (dat->avatars_draw_overlay && dat->avatars_maxheight_size >= ICON_HEIGHT + (dat->avatars_draw_border ? 2 : 0) + && GetContactCachedStatus(Drawing->hContact) - ID_STATUS_OFFLINE < SIZEOF(g_pAvatarOverlayIcons)) { switch( dat->avatars_overlay_type ) { @@ -3026,8 +3026,8 @@ void CLCPaint::_DrawContactAvatar( HDC hdcMem, ClcData *dat, ClcContact *Drawing SelectClipRgn( hdcMem, rgn ); DeleteObject( rgn ); // Draw overlays - if ( dat->avatars_draw_overlay && dat->avatars_maxheight_size >= ICON_HEIGHT + ( dat->avatars_draw_border ? 2 : 0 ) - && GetContactCachedStatus( Drawing->hContact ) - ID_STATUS_OFFLINE < MAX_REGS( g_pAvatarOverlayIcons )) + if (dat->avatars_draw_overlay && dat->avatars_maxheight_size >= ICON_HEIGHT + (dat->avatars_draw_border ? 2 : 0) + && GetContactCachedStatus(Drawing->hContact) - ID_STATUS_OFFLINE < SIZEOF(g_pAvatarOverlayIcons)) { POINT ptOverlay = { prcItem->right-ICON_HEIGHT, prcItem->bottom-ICON_HEIGHT }; if ( dat->avatars_draw_border ) diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index 3ab3bafa9e..0f0b1bef4b 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -427,7 +427,7 @@ HICON GetMainStatusOverlay(int STATUS) void UnloadAvatarOverlayIcon() { - for (int i=0 ; i < MAX_REGS(g_pAvatarOverlayIcons); i++) { + for (int i = 0; i < SIZEOF(g_pAvatarOverlayIcons); i++) { g_pAvatarOverlayIcons[i].listID = -1; g_pStatusOverlayIcons[i].listID = -1; } diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp index 8f684c53a9..02e786571d 100644 --- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp +++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp @@ -411,7 +411,7 @@ int RowHeights_GetMaxRowHeight(ClcData *dat, HWND hwnd) if ( !dat->text_ignore_size_for_row_height) { // Get contact font size tmp = 0; - for (i=0 ; i < MAX_REGS(contact_fonts) ; i++) + for (i = 0; i < SIZEOF(contact_fonts); i++) if (tmp < dat->fontModernInfo[contact_fonts[i]].fontHeight) tmp = dat->fontModernInfo[contact_fonts[i]].fontHeight; @@ -435,7 +435,7 @@ int RowHeights_GetMaxRowHeight(ClcData *dat, HWND hwnd) } // Get other font sizes - for (i=0 ; i < MAX_REGS(other_fonts) ; i++) + for (i = 0; i < SIZEOF(other_fonts); i++) if (max_height < dat->fontModernInfo[other_fonts[i]].fontHeight) max_height = dat->fontModernInfo[other_fonts[i]].fontHeight; } diff --git a/plugins/Clist_modern/src/modern_skineditor.cpp b/plugins/Clist_modern/src/modern_skineditor.cpp index 72450cedb1..02652af515 100644 --- a/plugins/Clist_modern/src/modern_skineditor.cpp +++ b/plugins/Clist_modern/src/modern_skineditor.cpp @@ -58,7 +58,7 @@ HTREEITEM FindChild(HWND hTree, HTREEITEM Parent, char * Caption) tvi.mask = TVIF_TEXT|TVIF_HANDLE; tvi.pszText = (LPSTR)&buf; tvi.cchTextMax = 254; - TreeView_GetItemA(hTree,&tvi); + TreeView_GetItem(hTree,&tvi); if (mir_bool_strcmpi(Caption,tvi.pszText)) return tmp; tmp = TreeView_GetNextSibling(hTree,tmp); @@ -101,7 +101,7 @@ int TreeAddObject(HWND hwndDlg, int ID, OPT_OBJECT_DATA * data) tvis.item.mask = TVIF_PARAM|TVIF_TEXT|TVIF_PARAM; tvis.item.pszText = ptr; tvis.item.lParam = 0; - cItem = TreeView_InsertItemA(GetDlgItem(hwndDlg,ID),&tvis); + cItem = TreeView_InsertItem(GetDlgItem(hwndDlg, ID), &tvis); } rootItem = cItem; @@ -119,7 +119,7 @@ int TreeAddObject(HWND hwndDlg, int ID, OPT_OBJECT_DATA * data) tvis.item.mask = TVIF_PARAM|TVIF_TEXT|TVIF_PARAM; tvis.item.pszText = ptr; tvis.item.lParam = (LPARAM)data; - TreeView_InsertItemA(GetDlgItem(hwndDlg,ID),&tvis); + TreeView_InsertItem(GetDlgItem(hwndDlg, ID), &tvis); } mir_free(path); return 0; @@ -480,7 +480,7 @@ void StoreTreeNode(HWND hTree, HTREEITEM node, char * section) tvi.mask = TVIF_TEXT|TVIF_HANDLE; tvi.pszText = (LPSTR)&buf; tvi.cchTextMax = 254; - TreeView_GetItemA(hTree,&tvi); + TreeView_GetItem(hTree, &tvi); if (tvi.lParam) { OPT_OBJECT_DATA * dat = (OPT_OBJECT_DATA*)(tvi.lParam); -- cgit v1.2.3