summaryrefslogtreecommitdiff
path: root/plugins/SmileyAdd
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-10-31 17:03:12 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-10-31 17:03:12 +0300
commite667e034f103a17e8cf37689ea2de762f49704c2 (patch)
treeb39eba4e89914f2a451a37652db6a4637f4ea9bb /plugins/SmileyAdd
parent4d9bf8032dd659e091394d688b6a2c59bf222240 (diff)
fix for drawing half-visible smileys
Diffstat (limited to 'plugins/SmileyAdd')
-rw-r--r--plugins/SmileyAdd/src/AniSmileyObject.cpp3
-rw-r--r--plugins/SmileyAdd/src/SmileyBase.cpp34
-rw-r--r--plugins/SmileyAdd/src/richcall.cpp17
-rw-r--r--plugins/SmileyAdd/src/version.h2
4 files changed, 27 insertions, 29 deletions
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 <stdver.h>