From 56eab17c447514113ec49d7b5ab4e6db8acbee38 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 8 May 2015 21:58:33 +0000 Subject: old pieces of avatar processing code removed git-svn-id: http://svn.miranda-ng.org/main/trunk@13487 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/hdr/modern_clc.h | 2 +- plugins/Clist_modern/src/init.cpp | 3 +- plugins/Clist_modern/src/modern_aniavatars.cpp | 6 ++-- plugins/Clist_modern/src/modern_cachefuncs.cpp | 38 +++++++++++-------------- plugins/Clist_modern/src/modern_clc.cpp | 9 +----- plugins/Clist_modern/src/modern_clistevents.cpp | 12 ++++---- plugins/Clist_modern/src/modern_clistopts.cpp | 9 ++---- plugins/Clist_modern/src/modern_clui.cpp | 14 --------- plugins/Clist_modern/src/modern_viewmodebar.cpp | 2 -- 9 files changed, 30 insertions(+), 65 deletions(-) (limited to 'plugins/Clist_modern') diff --git a/plugins/Clist_modern/src/hdr/modern_clc.h b/plugins/Clist_modern/src/hdr/modern_clc.h index 36ad9ecff1..7f6c2cb894 100644 --- a/plugins/Clist_modern/src/hdr/modern_clc.h +++ b/plugins/Clist_modern/src/hdr/modern_clc.h @@ -215,7 +215,7 @@ struct ClcContact : public ClcContactBase // int status; BOOL image_is_special; int avatar_pos; - struct avatarCacheEntry *avatar_data; + avatarCacheEntry *avatar_data; SIZE avatar_size; CSmileyString ssText; diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp index a7c156fb27..870ac56431 100644 --- a/plugins/Clist_modern/src/init.cpp +++ b/plugins/Clist_modern/src/init.cpp @@ -106,7 +106,8 @@ extern "C" __declspec(dllexport) int Unload(void) { TRACE("Unloading Clist Modern\r\n"); - if (IsWindow(pcli->hwndContactList)) DestroyWindow(pcli->hwndContactList); + if (IsWindow(pcli->hwndContactList)) + DestroyWindow(pcli->hwndContactList); pcli->hwndContactList = NULL; ToolbarButtonUnloadModule(); diff --git a/plugins/Clist_modern/src/modern_aniavatars.cpp b/plugins/Clist_modern/src/modern_aniavatars.cpp index bd2c81c38b..4981ac56d4 100644 --- a/plugins/Clist_modern/src/modern_aniavatars.cpp +++ b/plugins/Clist_modern/src/modern_aniavatars.cpp @@ -946,8 +946,7 @@ int AniAva_SetAvatarPos(MCONTACT hContact, RECT *rc, int overlayIdx, BYTE bAlpha int AniAva_UpdateOptions() { BOOL bReloadAvatars = FALSE; - BOOL bBeEnabled = (db_get_b(NULL, "CList", "AvatarsAnimated", ServiceExists(MS_AV_GETAVATARBITMAP)) && - db_get_b(NULL, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT)); + BOOL bBeEnabled = db_get_b(NULL, "CList", "AvatarsAnimated", db_get_b(NULL, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT)); if (bBeEnabled && !s_bModuleStarted) { AniAva_InitModule(); bReloadAvatars = TRUE; @@ -988,8 +987,7 @@ void AniAva_UpdateParent() int AniAva_InitModule() { - if (!(db_get_b(NULL, "CList", "AvatarsAnimated", ServiceExists(MS_AV_GETAVATARBITMAP)) && - db_get_b(NULL, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT))) + if (!db_get_b(NULL, "CList", "AvatarsAnimated", db_get_b(NULL, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT))) return 0; WNDCLASSEX wc = { sizeof(wc) }; diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index fc827e024a..d586363953 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -406,7 +406,6 @@ int Cache_GetLineText( BOOL show_status_if_no_away, BOOL show_listening_if_no_away, BOOL use_name_and_message_for_xstatus, BOOL pdnce_time_show_only_if_different) { - if (text == NULL) return TEXT_EMPTY; text[0] = '\0'; @@ -485,13 +484,13 @@ int Cache_GetLineText( return TEXT_LISTENING_TO; case TEXT_TEXT: - { - TCHAR *tmp = variables_parsedup(variable_text, pdnce->tszName, pdnce->hContact); - mir_tstrncpy(text, tmp, text_size); - mir_free(tmp); - CopySkipUnprintableChars(text, text, text_size - 1); - } - return TEXT_TEXT; + { + TCHAR *tmp = variables_parsedup(variable_text, pdnce->tszName, pdnce->hContact); + mir_tstrncpy(text, tmp, text_size); + mir_free(tmp); + CopySkipUnprintableChars(text, text, text_size - 1); + } + return TEXT_TEXT; case TEXT_CONTACT_TIME: if (pdnce->hTimeZone) { @@ -654,9 +653,7 @@ static int CopySkipUnprintableChars(TCHAR *to, TCHAR * buf, DWORD size) // Return TRUE if finished, FALSE if was stoped static BOOL ExecuteOnAllContacts(ClcData *dat, ExecuteOnAllContactsFuncPtr func, void *param) { - BOOL res; - res = ExecuteOnAllContactsOfGroup(&dat->list, func, param); - return res; + return ExecuteOnAllContactsOfGroup(&dat->list, func, param); } static BOOL ExecuteOnAllContactsOfGroup(ClcGroup *group, ExecuteOnAllContactsFuncPtr func, void *param) @@ -708,13 +705,14 @@ BOOL ReduceAvatarPosition(ClcContact *contact, BOOL, void *param) void Cache_ProceedAvatarInList(ClcData *dat, ClcContact *contact) { - struct avatarCacheEntry * ace = contact->avatar_data; + avatarCacheEntry * ace = contact->avatar_data; int old_pos = contact->avatar_pos; if (ace == NULL || ace->dwFlags == AVS_BITMAP_EXPIRED || ace->hbmPic == NULL) { - //Avatar was not ready or removed - need to remove it from cache + // Avatar was not ready or removed - need to remove it from cache if (old_pos >= 0) { ImageArray_RemoveImage(&dat->avatar_cache, old_pos); + // Update all items ExecuteOnAllContacts(dat, ReduceAvatarPosition, (void *)&old_pos); contact->avatar_pos = AVATAR_POS_DONT_HAVE; @@ -750,14 +748,12 @@ void Cache_ProceedAvatarInList(ClcData *dat, ClcContact *contact) HDC hdc = CreateCompatibleDC(dat->avatar_cache.hdc); HBITMAP hDrawBmp = ske_CreateDIB32Point(width_clip, height_clip, &pt); HBITMAP oldBmp = (HBITMAP)SelectObject(hdc, hDrawBmp); - //need to draw avatar bitmap here - { - int w = width_clip; - int h = height_clip; - DrawAvatarImageWithGDIp(hdc, 0, 0, w, h, ace->hbmPic, 0, 0, ace->bmWidth, ace->bmHeight, ace->dwFlags, 255); - } + + // need to draw avatar bitmap here + DrawAvatarImageWithGDIp(hdc, 0, 0, width_clip, height_clip, ace->hbmPic, 0, 0, ace->bmWidth, ace->bmHeight, ace->dwFlags, 255); SelectObject(hdc, oldBmp); DeleteDC(hdc); + // Add to list if (old_pos >= 0) { ImageArray_ChangeImage(&dat->avatar_cache, hDrawBmp, old_pos); @@ -782,8 +778,8 @@ void Cache_GetAvatar(ClcData *dat, ClcContact *contact) } 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 = (avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, contact->hContact, 0); + if (contact->avatar_data == NULL || contact->avatar_data->cbSize != sizeof(avatarCacheEntry) || contact->avatar_data->dwFlags == AVS_BITMAP_EXPIRED) contact->avatar_data = NULL; if (contact->avatar_data != NULL) diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index e1ecd0152b..6c43dfb1d3 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1718,7 +1718,7 @@ int ClcUnloadModule() return 0; } -int ClcDoProtoAck(MCONTACT, ACKDATA * ack) +int ClcDoProtoAck(MCONTACT, ACKDATA *ack) { if (MirandaExiting()) return 0; if (ack->type == ACKTYPE_STATUS) { @@ -1759,13 +1759,6 @@ int ClcDoProtoAck(MCONTACT, ACKDATA * ack) } } } - else if (ack->type == ACKTYPE_AVATAR) { - if (ack->result == ACKRESULT_SUCCESS) { - PROTO_AVATAR_INFORMATIONT *pai = (PROTO_AVATAR_INFORMATIONT*)ack->hProcess; - if (pai != NULL && pai->hContact != NULL) - pcli->pfnClcBroadcast(INTM_AVATARCHANGED, (WPARAM)pai->hContact, 0); - } - } else if (ack->type == ACKTYPE_EMAIL) { CLUIUnreadEmailCountChanged(0, 0); } diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp index 85a278a7ad..c03ed3b766 100644 --- a/plugins/Clist_modern/src/modern_clistevents.cpp +++ b/plugins/Clist_modern/src/modern_clistevents.cpp @@ -57,7 +57,7 @@ struct CListEvent { int imlIconOverlayIndex; }; -static struct CListEvent *event; +static CListEvent *event; static int eventCount; static int disableTrayFlash; static int disableIconFlash; @@ -83,10 +83,8 @@ struct NotifyMenuItemExData { static CLISTEVENT* MyGetEvent(int iSelection) { - int i; - - for (i = 0; i < pcli->events.count; i++) { - struct CListEvent* p = pcli->events.items[i]; + for (int i = 0; i < pcli->events.count; i++) { + CListEvent *p = pcli->events.items[i]; if (p->menuId == iSelection) return &p->cle; } @@ -100,9 +98,9 @@ CListEvent* cliCreateEvent(void) return p; } -struct CListEvent* cli_AddEvent(CLISTEVENT *cle) +CListEvent* cli_AddEvent(CLISTEVENT *cle) { - struct CListEvent* p = corecli.pfnAddEvent(cle); + CListEvent* p = corecli.pfnAddEvent(cle); if (p == NULL) return NULL; diff --git a/plugins/Clist_modern/src/modern_clistopts.cpp b/plugins/Clist_modern/src/modern_clistopts.cpp index 6bac4ae659..0f317ee373 100644 --- a/plugins/Clist_modern/src/modern_clistopts.cpp +++ b/plugins/Clist_modern/src/modern_clistopts.cpp @@ -228,7 +228,7 @@ static INT_PTR CALLBACK DlgProcItemAvatarOpts(HWND hwndDlg, UINT msg, WPARAM wPa case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); CheckDlgButton(hwndDlg, IDC_SHOW_AVATARS, db_get_b(NULL, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SHOW_ANIAVATARS, db_get_b(NULL, "CList", "AvatarsAnimated", ServiceExists(MS_AV_GETAVATARBITMAP)) == 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOW_ANIAVATARS, db_get_b(NULL, "CList", "AvatarsAnimated", BST_CHECKED)); CheckDlgButton(hwndDlg, IDC_AVATAR_FASTDRAW, db_get_b(NULL, "CList", "AvatarsInSeparateWnd", SETTINGS_AVATARINSEPARATE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_AVATAR_DRAW_BORDER, db_get_b(NULL, "CList", "AvatarsDrawBorders", SETTINGS_AVATARDRAWBORDER_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_AVATAR_ROUND_CORNERS, db_get_b(NULL, "CList", "AvatarsRoundCorners", SETTINGS_AVATARROUNDCORNERS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); @@ -308,11 +308,6 @@ static INT_PTR CALLBACK DlgProcItemAvatarOpts(HWND hwndDlg, UINT msg, WPARAM wPa EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_OVERLAY_ICON_PROTOCOL), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_OVERLAY_ICON_CONTACT), FALSE); } - - if (!ServiceExists(MS_AV_GETAVATARBITMAP)) { - EnableWindow(GetDlgItem(hwndDlg, IDC_SHOW_ANIAVATARS), FALSE); - SetDlgItemText(hwndDlg, IDC_SHOW_ANIAVATARS, TranslateT("Animate avatars (GDI+ and Avatar service module (avs.dll) are required)")); - } break; case WM_COMMAND: @@ -332,7 +327,7 @@ static INT_PTR CALLBACK DlgProcItemAvatarOpts(HWND hwndDlg, UINT msg, WPARAM wPa EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_SIZE), enabled); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_SIZE_SPIN), enabled); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_SIZE_PIXELS3), enabled); - EnableWindow(GetDlgItem(hwndDlg, IDC_SHOW_ANIAVATARS), enabled && ServiceExists(MS_AV_GETAVATARBITMAP)); + EnableWindow(GetDlgItem(hwndDlg, IDC_SHOW_ANIAVATARS), enabled); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_WIDTH), enabled); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_WIDTH_SPIN), enabled); diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index ed66adfadf..4e160f4ad0 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -203,20 +203,6 @@ int CLUI::OnEvent_ContactMenuPreBuild(WPARAM, LPARAM) Menu_ShowItem(hHideAvatarMenuItem, false); } else { - int has_avatar; - - if (ServiceExists(MS_AV_GETAVATARBITMAP)) - has_avatar = CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hItem, 0); - else { - DBVARIANT dbv; - if (db_get_ts(hItem, "ContactPhoto", "File", &dbv)) - has_avatar = 0; - else { - has_avatar = 1; - db_free(&dbv); - } - } - bool bHideAvatar = db_get_b(hItem, "CList", "HideContactAvatar", 0) != 0; Menu_ShowItem(hShowAvatarMenuItem, bHideAvatar); Menu_ShowItem(hHideAvatarMenuItem, !bHideAvatar); diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index 57ae8d4969..56767b068b 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -720,8 +720,6 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP ShowWindow(GetDlgItem(hwndDlg, _page2Controls[i++]), SW_HIDE); ShowWindow(hwndDlg, SW_SHOWNORMAL); EnableWindow(GetDlgItem(hwndDlg, IDC_APPLY), FALSE); - //EnableWindow(GetDlgItem(hwndDlg, IDC_VARIABLES), FALSE); - //EnableWindow(GetDlgItem(hwndDlg, IDC_VARIABLES), ServiceExists(MS_VARS_FORMATSTRING)); SendDlgItemMessage(hwndDlg, IDC_AUTOCLEARSPIN, UDM_SETRANGE, 0, MAKELONG(1000, 0)); SetWindowText(hwndDlg, TranslateT("Configure view modes")); } -- cgit v1.2.3