From e667e034f103a17e8cf37689ea2de762f49704c2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 31 Oct 2017 17:03:12 +0300 Subject: fix for drawing half-visible smileys --- plugins/SmileyAdd/src/AniSmileyObject.cpp | 3 ++- plugins/SmileyAdd/src/SmileyBase.cpp | 34 +++++++++++++++---------------- plugins/SmileyAdd/src/richcall.cpp | 17 +++++++--------- plugins/SmileyAdd/src/version.h | 2 +- 4 files changed, 27 insertions(+), 29 deletions(-) (limited to 'plugins/SmileyAdd/src') diff --git a/plugins/SmileyAdd/src/AniSmileyObject.cpp b/plugins/SmileyAdd/src/AniSmileyObject.cpp index 176d0760c3..c0c41f39c6 100644 --- a/plugins/SmileyAdd/src/AniSmileyObject.cpp +++ b/plugins/SmileyAdd/src/AniSmileyObject.cpp @@ -349,7 +349,8 @@ public: STDMETHOD(SetExtent)(DWORD dwDrawAspect, SIZEL *psizel) { HRESULT hr = ISmileyBase::SetExtent(dwDrawAspect, psizel); - if (hr == S_OK) m_rectExt = m_sizeExtent; + if (hr == S_OK) + m_rectExt = m_sizeExtent; return hr; } }; diff --git a/plugins/SmileyAdd/src/SmileyBase.cpp b/plugins/SmileyAdd/src/SmileyBase.cpp index 583396fbe7..2749923e6f 100644 --- a/plugins/SmileyAdd/src/SmileyBase.cpp +++ b/plugins/SmileyAdd/src/SmileyBase.cpp @@ -110,26 +110,26 @@ void ISmileyBase::SetHint(wchar_t *smltxt) void ISmileyBase::SetPosition(HWND hwnd, LPCRECT lpRect) { m_hwnd = hwnd; - if (lpRect == NULL || (lpRect->top == -1 && lpRect->bottom == -1)) { + if (lpRect == NULL || lpRect->top == -1 || lpRect->bottom == -1) { m_visible = false; + return; + } + + m_visible = true; + m_dirAniAllow = true; + m_orect.left = lpRect->left; + m_orect.right = lpRect->left + m_sizeExtent.cx; + if (lpRect->top == -1) { + m_orect.top = lpRect->bottom - m_sizeExtent.cy; + m_orect.bottom = lpRect->bottom; + } + else if (lpRect->bottom == -1) { + m_orect.top = lpRect->top; + m_orect.bottom = lpRect->top + m_sizeExtent.cy; } else { - m_visible = true; - m_dirAniAllow = true; - m_orect.left = lpRect->left; - m_orect.right = lpRect->left + m_sizeExtent.cx; - if (lpRect->top == -1) { - m_orect.top = lpRect->bottom - m_sizeExtent.cy; - m_orect.bottom = lpRect->bottom; - } - else if (lpRect->bottom == -1) { - m_orect.top = lpRect->top; - m_orect.bottom = lpRect->top + m_sizeExtent.cy; - } - else { - m_orect.top = lpRect->bottom - m_sizeExtent.cy; - m_orect.bottom = lpRect->bottom; - } + m_orect.top = lpRect->bottom - m_sizeExtent.cy; + m_orect.bottom = lpRect->bottom; } } diff --git a/plugins/SmileyAdd/src/richcall.cpp b/plugins/SmileyAdd/src/richcall.cpp index 631c70ee96..fcfcdac239 100644 --- a/plugins/SmileyAdd/src/richcall.cpp +++ b/plugins/SmileyAdd/src/richcall.cpp @@ -72,24 +72,21 @@ static void SetPosition(HWND hwnd) TextRange->SetRange(reObj.cp, reObj.cp); - BOOL res; - POINT pt; RECT rect; - hr = TextRange->GetPoint(tomStart | TA_BOTTOM | TA_RIGHT, &pt.x, &pt.y); - if (hr == S_OK) { - res = ScreenToClient(hwnd, &pt); + POINT pt; + if (S_OK == TextRange->GetPoint(tomStart | TA_BOTTOM | TA_RIGHT, &pt.x, &pt.y)) { + ScreenToClient(hwnd, &pt); rect.bottom = pt.y; rect.right = pt.x; } - else rect.right = rect.bottom = -1; + else rect.bottom = -1; - hr = TextRange->GetPoint(tomStart | TA_TOP | TA_LEFT, &pt.x, &pt.y); - if (hr == S_OK) { - res = ScreenToClient(hwnd, &pt); + if (S_OK == TextRange->GetPoint(tomStart | TA_TOP | TA_LEFT, &pt.x, &pt.y)) { + ScreenToClient(hwnd, &pt); rect.top = pt.y; rect.left = pt.x; } - else rect.left = rect.top = -1; + else rect.top = -1; igsc->SetPosition(hwnd, &rect); } diff --git a/plugins/SmileyAdd/src/version.h b/plugins/SmileyAdd/src/version.h index a4c025924d..2f660feaa1 100644 --- a/plugins/SmileyAdd/src/version.h +++ b/plugins/SmileyAdd/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 2 #define __RELEASE_NUM 4 -#define __BUILD_NUM 1 +#define __BUILD_NUM 2 #include -- cgit v1.2.3