diff options
author | George Hazan <george.hazan@gmail.com> | 2015-05-07 22:07:22 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-05-07 22:07:22 +0000 |
commit | 033e0683934e31341a9a28ae1a7fac17fba9215f (patch) | |
tree | d0bf3a05c7a23241ba013b4f5df8aede2b2f1ec3 /plugins/Clist_modern | |
parent | 8726be3602d129ce335752d5fe036c6872d695a6 (diff) |
suddenly © clist modern contained code to process avatars manually, besides AVS
git-svn-id: http://svn.miranda-ng.org/main/trunk@13483 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern')
-rw-r--r-- | plugins/Clist_modern/src/hdr/modern_clc.h | 1 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_cachefuncs.cpp | 114 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clc.cpp | 174 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clcpaint.cpp | 45 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_rowheight_funcs.cpp | 29 |
5 files changed, 121 insertions, 242 deletions
diff --git a/plugins/Clist_modern/src/hdr/modern_clc.h b/plugins/Clist_modern/src/hdr/modern_clc.h index 6301cc1f9d..36ad9ecff1 100644 --- a/plugins/Clist_modern/src/hdr/modern_clc.h +++ b/plugins/Clist_modern/src/hdr/modern_clc.h @@ -272,7 +272,6 @@ struct ClcData : public ClcDataBase int row_heights_allocated;
// Avatar cache
- int use_avatar_service;
IMAGE_ARRAY_DATA avatar_cache;
// Row
diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index 0a6bf05fed..fc827e024a 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -723,13 +723,9 @@ void Cache_ProceedAvatarInList(ClcData *dat, ClcContact *contact) } else if (contact->avatar_data->hbmPic != NULL) //Lets Add it { - // Make bounds -> keep aspect radio - LONG width_clip; - LONG height_clip; - // Clipping width and height - width_clip = dat->avatars_maxwidth_size ? dat->avatars_maxwidth_size : dat->avatars_maxheight_size; - height_clip = dat->avatars_maxheight_size; + LONG width_clip = dat->avatars_maxwidth_size ? dat->avatars_maxwidth_size : dat->avatars_maxheight_size; + LONG height_clip = dat->avatars_maxheight_size; if (height_clip * ace->bmWidth / ace->bmHeight <= width_clip) width_clip = height_clip * ace->bmWidth / ace->bmHeight; @@ -778,108 +774,22 @@ void Cache_ProceedAvatarInList(ClcData *dat, ClcContact *contact) void Cache_GetAvatar(ClcData *dat, ClcContact *contact) { - int old_pos = contact->avatar_pos; - // workaround for avatar service and other wich destroys service on OK_TOEXIT - if (g_CluiData.bSTATE != STATE_NORMAL || (dat->use_avatar_service && !ServiceExists(MS_AV_GETAVATARBITMAP))) { + // workaround for avatar service + if (g_CluiData.bSTATE != STATE_NORMAL) { contact->avatar_pos = AVATAR_POS_DONT_HAVE; contact->avatar_data = NULL; return; } - if (dat->use_avatar_service && ServiceExists(MS_AV_GETAVATARBITMAP)) { - if (dat->avatars_show && !db_get_b(contact->hContact, "CList", "HideContactAvatar", 0)) { - contact->avatar_data = (struct avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)contact->hContact, 0); - if (contact->avatar_data == NULL || contact->avatar_data->cbSize != sizeof(struct avatarCacheEntry) || contact->avatar_data->dwFlags == AVS_BITMAP_EXPIRED) - contact->avatar_data = NULL; - - if (contact->avatar_data != NULL) - contact->avatar_data->t_lastAccess = (DWORD)time(NULL); - } - else contact->avatar_data = NULL; + if (dat->avatars_show && !db_get_b(contact->hContact, "CList", "HideContactAvatar", 0)) { + contact->avatar_data = (struct avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)contact->hContact, 0); + if (contact->avatar_data == NULL || contact->avatar_data->cbSize != sizeof(struct avatarCacheEntry) || contact->avatar_data->dwFlags == AVS_BITMAP_EXPIRED) + contact->avatar_data = NULL; - Cache_ProceedAvatarInList(dat, contact); + if (contact->avatar_data != NULL) + contact->avatar_data->t_lastAccess = (DWORD)time(NULL); } - else { - contact->avatar_pos = AVATAR_POS_DONT_HAVE; - if (dat->avatars_show && !db_get_b(contact->hContact, "CList", "HideContactAvatar", 0)) { - DBVARIANT dbv; - if (!db_get_ts(contact->hContact, "ContactPhoto", "File", &dbv)) { - HBITMAP hBmp = (HBITMAP)CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)dbv.ptszVal); - if (hBmp != NULL) { - // Make bounds - BITMAP bm; - if (GetObject(hBmp, sizeof(BITMAP), &bm)) { - // Create data... - HDC hdc; - HBITMAP hDrawBmp, oldBmp; - - // Make bounds -> keep aspect radio - LONG width_clip; - LONG height_clip; - RECT rc = { 0 }; - - // Clipping width and height - width_clip = dat->avatars_maxheight_size; - height_clip = dat->avatars_maxheight_size; - - if (height_clip * bm.bmWidth / bm.bmHeight <= width_clip) - width_clip = height_clip * bm.bmWidth / bm.bmHeight; - else - height_clip = width_clip * bm.bmHeight / bm.bmWidth; - - // Create objs - hdc = CreateCompatibleDC(dat->avatar_cache.hdc); - hDrawBmp = ske_CreateDIB32(width_clip, height_clip); - oldBmp = (HBITMAP)SelectObject(hdc, hDrawBmp); - SetBkMode(hdc, TRANSPARENT); - - POINT org; - GetBrushOrgEx(hdc, &org); - SetStretchBltMode(hdc, HALFTONE); - SetBrushOrgEx(hdc, org.x, org.y, NULL); - - rc.right = width_clip - 1; - rc.bottom = height_clip - 1; - - // Draw bitmap 8//8 - HDC dcMem = CreateCompatibleDC(hdc); - HBITMAP obmp = (HBITMAP)SelectObject(dcMem, hBmp); - StretchBlt(hdc, 0, 0, width_clip, height_clip, dcMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); - SelectObject(dcMem, obmp); - DeleteDC(dcMem); - - RECT rtr = { 0 }; - rtr.right = width_clip + 1; - rtr.bottom = height_clip + 1; - ske_SetRectOpaque(hdc, &rtr); - - hDrawBmp = (HBITMAP)GetCurrentObject(hdc, OBJ_BITMAP); - SelectObject(hdc, oldBmp); - DeleteDC(hdc); - - // Add to list - if (old_pos >= 0) { - ImageArray_ChangeImage(&dat->avatar_cache, hDrawBmp, old_pos); - contact->avatar_pos = old_pos; - } - else contact->avatar_pos = ImageArray_AddImage(&dat->avatar_cache, hDrawBmp, -1); - - DeleteObject(hDrawBmp); - } // if (GetObject(hBmp,sizeof(BITMAP),&bm)) - DeleteObject(hBmp); - } //if (hBmp != NULL) - db_free(&dbv); - } - } + else contact->avatar_data = NULL; - // Remove avatar if needed - if (old_pos >= 0 && contact->avatar_pos == AVATAR_POS_DONT_HAVE) { - ImageArray_RemoveImage(&dat->avatar_cache, old_pos); - // Update all items - ExecuteOnAllContacts(dat, ReduceAvatarPosition, (void *)&old_pos); - } - - if (old_pos == AVATAR_POS_ANIMATED && contact->avatar_pos != AVATAR_POS_ANIMATED) - AniAva_RemoveAvatar(contact->hContact); - } + Cache_ProceedAvatarInList(dat, contact); } diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 5d03e2e199..e1ecd0152b 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -48,8 +48,6 @@ static BOOL fMouseUpped; static BYTE IsDragToScrollMode = 0; static int StartDragPos = 0; static int StartScrollPos = 0; -HANDLE hAckHook = NULL; -HANDLE hAvatarChanged = NULL; static BOOL g_bSortTimerIsSet = FALSE; static ClcContact *hitcontact = NULL; HANDLE hSkinFolder; @@ -68,79 +66,6 @@ int ReloadSkinFolder(WPARAM, LPARAM) return 0; } -static int clcHookModulesLoaded(WPARAM, LPARAM) -{ - if (MirandaExiting()) - return 0; - - HookEvent(ME_MODERNOPT_INITIALIZE, ModernOptInit); - HookEvent(ME_MODERNOPT_INITIALIZE, ModernSkinOptInit); - - HookEvent(ME_FOLDERS_PATH_CHANGED, ReloadSkinFolder); - hSkinFolder = FoldersRegisterCustomPathT(LPGEN("Skins"), LPGEN("Modern contact list"), MIRANDA_PATHT _T("\\") _T(DEFAULT_SKIN_FOLDER)); - FoldersGetCustomPathT(hSkinFolder, SkinsFolder, SIZEOF(SkinsFolder), _T(DEFAULT_SKIN_FOLDER)); - - // Get icons - TCHAR szMyPath[MAX_PATH]; - GetModuleFileName(g_hInst, szMyPath, SIZEOF(szMyPath)); - - SKINICONDESC sid = { sizeof(sid) }; - sid.cx = sid.cy = 16; - sid.ptszDefaultFile = szMyPath; - sid.flags = SIDF_PATH_TCHAR; - - sid.pszSection = LPGEN("Contact list"); - sid.pszDescription = LPGEN("Listening to"); - sid.pszName = "LISTENING_TO_ICON"; - sid.iDefaultIndex = -IDI_LISTENING_TO; - Skin_AddIcon(&sid); - - sid.pszSection = LPGEN("Contact list") "/" LPGEN("Avatar overlay"); - for (int 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; - Skin_AddIcon(&sid); - } - - sid.pszSection = LPGEN("Contact list") "/" LPGEN("Status overlay"); - for (int 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; - Skin_AddIcon(&sid); - } - - clcHookIconsChanged(0, 0); - - HookEvent(ME_SKIN2_ICONSCHANGED, clcHookIconsChanged); - - // Register smiley category - if (ServiceExists(MS_SMILEYADD_REGISTERCATEGORY)) { - SMADD_REGCAT rc; - rc.cbSize = sizeof(rc); - rc.name = "clist"; - rc.dispname = Translate("Contact list smileys"); - - CallService(MS_SMILEYADD_REGISTERCATEGORY, 0, (LPARAM)&rc); - - HookEvent(ME_SMILEYADD_OPTIONSCHANGED, clcHookSmileyAddOptionsChanged); - } - - CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("List background")"/CLC"), 0); - CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Menu background")"/Menu"), 0); - CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Status bar background")"/StatusBar"), 0); - CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Frames title bar background")"/FrameTitleBar"), 0); - - HookEvent(ME_BACKGROUNDCONFIG_CHANGED, clcHookBkgndConfigChanged); - HookEvent(ME_BACKGROUNDCONFIG_CHANGED, BgStatusBarChange); - HookEvent(ME_BACKGROUNDCONFIG_CHANGED, OnFrameTitleBarBackgroundChange); - HookEvent(ME_COLOUR_RELOAD, OnFrameTitleBarBackgroundChange); - - AniAva_UpdateOptions(); - return 0; -} - static int clcHookSmileyAddOptionsChanged(WPARAM, LPARAM) { if (MirandaExiting()) return 0; @@ -378,10 +303,6 @@ static LRESULT clcOnCreate(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPA dat->hCheckBoxTheme = xpt_AddThemeHandle(hwnd, L"BUTTON"); dat->m_paintCouter = 0; dat->hWnd = hwnd; - dat->use_avatar_service = ServiceExists(MS_AV_GETAVATARBITMAP); - if (dat->use_avatar_service) - if (!hAvatarChanged) - hAvatarChanged = HookEvent(ME_AV_AVATARCHANGED, clcHookAvatarChanged); ImageArray_Initialize(&dat->avatar_cache, FALSE, 20); //this array will be used to keep small avatars too @@ -1549,12 +1470,12 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT, WPARAM wParam return 0; } -static LRESULT clcOnIntmAvatarChanged(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM) +static LRESULT clcOnIntmAvatarChanged(ClcData *dat, HWND hwnd, UINT, WPARAM hContact, LPARAM) { ClcContact *contact; - if (FindItem(hwnd, dat, wParam, &contact, NULL, NULL, FALSE)) + if (FindItem(hwnd, dat, hContact, &contact, NULL, NULL, FALSE)) Cache_GetAvatar(dat, contact); - else if (dat->use_avatar_service && !wParam) + else if (hContact == 0) UpdateAllAvatars(dat); CLUI__cliInvalidateRect(hwnd, NULL, FALSE); @@ -1693,6 +1614,86 @@ static LRESULT clcOnIntmReloadOptions(ClcData *dat, HWND hwnd, UINT msg, WPARAM return TRUE; } +static int clcHookModulesLoaded(WPARAM, LPARAM) +{ + if (MirandaExiting()) + return 0; + + if (!ServiceExists(MS_AV_GETAVATARBITMAP)) + MessageBox(NULL, + TranslateT("Clist Modern requires AVS plugin to be present. Install it using PluginUpdater or download from http://miranda-ng.org"), + TranslateT("Error loading plugin"), MB_ICONERROR | MB_OK); + + HookEvent(ME_AV_AVATARCHANGED, clcHookAvatarChanged); + + HookEvent(ME_MODERNOPT_INITIALIZE, ModernOptInit); + HookEvent(ME_MODERNOPT_INITIALIZE, ModernSkinOptInit); + + HookEvent(ME_FOLDERS_PATH_CHANGED, ReloadSkinFolder); + hSkinFolder = FoldersRegisterCustomPathT(LPGEN("Skins"), LPGEN("Modern contact list"), MIRANDA_PATHT _T("\\") _T(DEFAULT_SKIN_FOLDER)); + FoldersGetCustomPathT(hSkinFolder, SkinsFolder, SIZEOF(SkinsFolder), _T(DEFAULT_SKIN_FOLDER)); + + // Get icons + TCHAR szMyPath[MAX_PATH]; + GetModuleFileName(g_hInst, szMyPath, SIZEOF(szMyPath)); + + SKINICONDESC sid = { sizeof(sid) }; + sid.cx = sid.cy = 16; + sid.ptszDefaultFile = szMyPath; + sid.flags = SIDF_PATH_TCHAR; + + sid.pszSection = LPGEN("Contact list"); + sid.pszDescription = LPGEN("Listening to"); + sid.pszName = "LISTENING_TO_ICON"; + sid.iDefaultIndex = -IDI_LISTENING_TO; + Skin_AddIcon(&sid); + + sid.pszSection = LPGEN("Contact list") "/" LPGEN("Avatar overlay"); + for (int 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; + Skin_AddIcon(&sid); + } + + sid.pszSection = LPGEN("Contact list") "/" LPGEN("Status overlay"); + for (int 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; + Skin_AddIcon(&sid); + } + + clcHookIconsChanged(0, 0); + + HookEvent(ME_SKIN2_ICONSCHANGED, clcHookIconsChanged); + + // Register smiley category + if (ServiceExists(MS_SMILEYADD_REGISTERCATEGORY)) { + SMADD_REGCAT rc; + rc.cbSize = sizeof(rc); + rc.name = "clist"; + rc.dispname = Translate("Contact list smileys"); + + CallService(MS_SMILEYADD_REGISTERCATEGORY, 0, (LPARAM)&rc); + + HookEvent(ME_SMILEYADD_OPTIONSCHANGED, clcHookSmileyAddOptionsChanged); + } + + CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("List background")"/CLC"), 0); + CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Menu background")"/Menu"), 0); + CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Status bar background")"/StatusBar"), 0); + CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Frames title bar background")"/FrameTitleBar"), 0); + + HookEvent(ME_BACKGROUNDCONFIG_CHANGED, clcHookBkgndConfigChanged); + HookEvent(ME_BACKGROUNDCONFIG_CHANGED, BgStatusBarChange); + HookEvent(ME_BACKGROUNDCONFIG_CHANGED, OnFrameTitleBarBackgroundChange); + HookEvent(ME_COLOUR_RELOAD, OnFrameTitleBarBackgroundChange); + + AniAva_UpdateOptions(); + return 0; +} + HRESULT ClcLoadModule() { g_himlCListClc = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0); @@ -1701,7 +1702,7 @@ HRESULT ClcLoadModule() HookEvent(ME_MC_ENABLED, clcMetaModeChanged); HookEvent(ME_DB_CONTACT_SETTINGCHANGED, clcHookSettingChanged); HookEvent(ME_OPT_INITIALISE, ClcOptInit); - hAckHook = (HANDLE)HookEvent(ME_PROTO_ACK, clcHookProtoAck); + HookEvent(ME_PROTO_ACK, clcHookProtoAck); HookEvent(ME_SYSTEM_MODULESLOADED, clcHookModulesLoaded); HookEvent(ME_DB_EVENT_ADDED, clcHookDbEventAdded); return S_OK; @@ -1734,7 +1735,6 @@ int ClcDoProtoAck(MCONTACT, ACKDATA * ack) } else if (ack->type == ACKTYPE_AWAYMSG) { if (ack->result == ACKRESULT_SUCCESS && ack->lParam) { - //Do not change DB if it is IRC protocol if (ack->szModule != NULL) if (db_get_b(ack->hContact, ack->szModule, "ChatRoom", 0) != 0) return 0; @@ -1743,9 +1743,6 @@ int ClcDoProtoAck(MCONTACT, ACKDATA * ack) gtaRenewText(ack->hContact); } else { - //db_unset(ack->hContact,"CList","StatusMsg"); - //char a = '\0'; - //Do not change DB if it is IRC protocol if (ack->szModule != NULL) if (db_get_b(ack->hContact, ack->szModule, "ChatRoom", 0) != 0) return 0; @@ -1760,7 +1757,6 @@ int ClcDoProtoAck(MCONTACT, ACKDATA * ack) mir_free(val); } } - //pcli->pfnClcBroadcast(INTM_STATUSMSGCHANGED,(WPARAM)ack->hContact,&a); } } else if (ack->type == ACKTYPE_AVATAR) { @@ -1786,6 +1782,7 @@ int ClcGetShortData(ClcData* pData, SHORTDATA *pShortData) pShortData->text_smiley_height = pData->text_smiley_height; pShortData->text_use_protocol_smileys = pData->text_use_protocol_smileys; pShortData->contact_time_show_only_if_different = pData->contact_time_show_only_if_different; + // Second line pShortData->second_line_show = pData->second_line_show; pShortData->second_line_draw_smileys = pData->second_line_draw_smileys; @@ -1798,6 +1795,7 @@ int ClcGetShortData(ClcData* pData, SHORTDATA *pShortData) pShortData->second_line_show_listening_if_no_away = pData->second_line_show_listening_if_no_away; pShortData->second_line_use_name_and_message_for_xstatus = pData->second_line_use_name_and_message_for_xstatus; + // Third line pShortData->third_line_show = pData->third_line_show; pShortData->third_line_draw_smileys = pData->third_line_draw_smileys; pShortData->third_line_type = pData->third_line_type; diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index b4594aa7e7..6280bda195 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -1181,9 +1181,7 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact case TC_STATUS:
if ((Drawing->type == CLCIT_GROUP && !dat->row_hide_group_icon) || (Drawing->type == CLCIT_CONTACT && Drawing->iImage != -1
- && !(dat->icon_hide_on_avatar && dat->avatars_show
- && ((dat->use_avatar_service && Drawing->avatar_data != NULL) || (!dat->use_avatar_service && Drawing->avatar_pos != AVATAR_POS_DONT_HAVE))
- && !Drawing->image_is_special))) {
+ && !(dat->icon_hide_on_avatar && dat->avatars_show && Drawing->avatar_data != NULL && !Drawing->image_is_special))) {
int iImage = -1;
// Get image
if (Drawing->type == CLCIT_GROUP) {
@@ -1223,15 +1221,15 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact case TC_AVATAR:
{
- BOOL hasAvatar = (dat->use_avatar_service && Drawing->avatar_data != NULL) || (!dat->use_avatar_service && Drawing->avatar_pos != AVATAR_POS_DONT_HAVE);
+ BOOL hasAvatar = Drawing->avatar_data != NULL;
BYTE blendmode = 255;
if (hottrack)
blendmode = 255;
- else if (Drawing->type == CLCIT_CONTACT && Drawing->flags&CONTACTF_NOTONLIST)
+ else if (Drawing->type == CLCIT_CONTACT && Drawing->flags & CONTACTF_NOTONLIST)
blendmode = 128;
if (Drawing->type == CLCIT_CONTACT && dat->showIdle && (Drawing->flags&CONTACTF_IDLE) &&
- _GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
- blendmode = 128;
+ _GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+ blendmode = 128;
if (!hasAvatar) { // if no avatar then paint icon image
int iImage = Drawing->iImage;
if (iImage != -1) {
@@ -1243,7 +1241,7 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact colourFg = dat->hotTextColour;
mode = ILD_NORMAL;
}
- else if (Drawing->type == CLCIT_CONTACT && Drawing->flags&CONTACTF_NOTONLIST) {
+ else if (Drawing->type == CLCIT_CONTACT && Drawing->flags & CONTACTF_NOTONLIST) {
colourFg = dat->fontModernInfo[FONTID_NOTONLIST].colour;
mode = ILD_BLEND50;
}
@@ -1252,8 +1250,8 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact mode = ILD_NORMAL;
}
- if (Drawing->type == CLCIT_CONTACT && dat->showIdle && (Drawing->flags&CONTACTF_IDLE) &&
- _GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
+ if (Drawing->type == CLCIT_CONTACT && dat->showIdle && (Drawing->flags & CONTACTF_IDLE) &&
+ _GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
mode = ILD_SELECTED;
}
@@ -1279,9 +1277,8 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact else
round_radius = min(width, height) / 5;
}
- else {
- round_radius = 0;
- }
+ else round_radius = 0;
+
if (dat->avatars_draw_border) {
HBRUSH hBrush = CreateSolidBrush(dat->avatars_border_color);
HBRUSH hOldBrush = (HBRUSH)SelectObject(hdcMem, hBrush);
@@ -1304,10 +1301,7 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact }
// Draw avatar
- if (dat->use_avatar_service)
- _DrawContactAvatar(hdcMem, dat, Drawing, &row_rc, selected, hottrack, &p_rect);
- else
- ImageArray_DrawImage(&dat->avatar_cache, Drawing->avatar_pos, hdcMem, p_rect.left, p_rect.top, 255);
+ _DrawContactAvatar(hdcMem, dat, Drawing, &row_rc, selected, hottrack, &p_rect);
// Restore region
if (dat->avatars_round_corners || dat->avatars_draw_border)
@@ -1321,7 +1315,7 @@ 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 < SIZEOF(g_pAvatarOverlayIcons)) {
+ && 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;
@@ -1530,11 +1524,8 @@ BOOL CLCPaint::_DrawNonEnginedBackground(HDC hdcMem, RECT *rcPaint, RECT clRect, else {
destw = clRect.right;
desth = bmp.bmHeight;
- if (dat->backgroundBmpUse&CLBF_TILEVTOROWHEIGHT)
- {
+ if (dat->backgroundBmpUse & CLBF_TILEVTOROWHEIGHT)
desth = dat->row_min_heigh;
- }
-
}
break;
@@ -1553,9 +1544,7 @@ BOOL CLCPaint::_DrawNonEnginedBackground(HDC hdcMem, RECT *rcPaint, RECT clRect, destw = bmp.bmWidth;
desth = bmp.bmHeight;
if (dat->backgroundBmpUse&CLBF_TILEVTOROWHEIGHT)
- {
desth = dat->row_min_heigh;
- }
break;
}
@@ -2081,9 +2070,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT max_width = dat->avatars_maxheight_size;
// Has to draw?
- if ((dat->use_avatar_service && Drawing->avatar_data == NULL)
- || (!dat->use_avatar_service && Drawing->avatar_pos == AVATAR_POS_DONT_HAVE)
- || miniMode) {
+ if (Drawing->avatar_data == NULL || miniMode) {
// Don't have to draw avatar
// Has to draw icon instead?
@@ -2149,9 +2136,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT {
RECT rc;
int iImage = -1;
- BOOL has_avatar = ((dat->use_avatar_service && Drawing->avatar_data != NULL) ||
- (!dat->use_avatar_service && Drawing->avatar_pos != AVATAR_POS_DONT_HAVE))
- && !(CheckMiniMode(dat, selected));
+ BOOL has_avatar = Drawing->avatar_data != NULL && !CheckMiniMode(dat, selected);
if (Drawing->type == CLCIT_CONTACT
&& dat->icon_hide_on_avatar
diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp index 8a6e7b5eab..f6a450aa27 100644 --- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp +++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp @@ -114,7 +114,7 @@ int mod_CalcRowHeight_worker(ClcData *dat, HWND hwnd, ClcContact *contact, int i return tmp;
}
- hasAvatar = (dat->use_avatar_service && contact->avatar_data != NULL) || (!dat->use_avatar_service && contact->avatar_pos != AVATAR_POS_DONT_HAVE);
+ hasAvatar = contact->avatar_data != NULL;
while (gl_RowTabAccess[i] != NULL) {
if (gl_RowTabAccess[i]->type != TC_SPACE) {
gl_RowTabAccess[i]->h = 0;
@@ -226,16 +226,11 @@ int mod_CalcRowHeight_worker(ClcData *dat, HWND hwnd, ClcContact *contact, int i (hasAvatar || (dat->icon_hide_on_avatar && dat->icon_draw_on_avatar_space && contact->iImage != -1)))
{
int iW = 0, iH = 0;
- if (dat->use_avatar_service) {
- if (contact->avatar_data) {
- iH = contact->avatar_data->bmHeight;
- iW = contact->avatar_data->bmWidth;
- }
- }
- else if (dat->avatar_cache.nodes) {
- iW = dat->avatar_cache.nodes[contact->avatar_pos].width;
- iH = dat->avatar_cache.nodes[contact->avatar_pos].height;
+ if (contact->avatar_data) {
+ iH = contact->avatar_data->bmHeight;
+ iW = contact->avatar_data->bmWidth;
}
+
SIZE sz = GetAvatarSize(iW, iH, dat->avatars_maxwidth_size, dat->avatars_maxheight_size);
if ((sz.cx == 0 || sz.cy == 0) && dat->icon_hide_on_avatar && dat->icon_draw_on_avatar_space && contact->iImage != -1)
sz.cx = ICON_HEIGHT, sz.cy = ICON_HEIGHT;
@@ -581,12 +576,8 @@ int RowHeights_GetRowHeight_worker(ClcData *dat, HWND hwnd, ClcContact *contact, }
// Avatar size
- if (dat->avatars_show && !dat->avatars_ignore_size_for_row_height &&
- contact->type == CLCIT_CONTACT &&
- ((dat->use_avatar_service && contact->avatar_data != NULL) || (!dat->use_avatar_service && contact->avatar_pos != AVATAR_POS_DONT_HAVE)) && !minimalistic)
- {
+ if (dat->avatars_show && !dat->avatars_ignore_size_for_row_height && contact->type == CLCIT_CONTACT && contact->avatar_data != NULL && !minimalistic)
height = max(height, dat->avatars_maxheight_size);
- }
// Checkbox size
if ((style & CLS_CHECKBOXES && contact->type == CLCIT_CONTACT) ||
@@ -598,12 +589,8 @@ int RowHeights_GetRowHeight_worker(ClcData *dat, HWND hwnd, ClcContact *contact, // Icon size
if (!dat->icon_ignore_size_for_row_height) {
- if (contact->type == CLCIT_GROUP
- || (contact->type == CLCIT_CONTACT && contact->iImage != -1
- && !(dat->icon_hide_on_avatar && dat->avatars_show
- && ((dat->use_avatar_service && contact->avatar_data != NULL) ||
- (!dat->use_avatar_service && contact->avatar_pos != AVATAR_POS_DONT_HAVE))
- && !contact->image_is_special)))
+ if (contact->type == CLCIT_GROUP ||
+ (contact->type == CLCIT_CONTACT && contact->iImage != -1 && !(dat->icon_hide_on_avatar && dat->avatars_show && contact->avatar_data != NULL && !contact->image_is_special)))
{
height = max(height, ICON_HEIGHT);
}
|