From 011c86b22aa67f25d751f731501eaaec9600f44c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 4 Mar 2013 19:57:20 +0000 Subject: fix for the smileys cleanup procedure git-svn-id: http://svn.miranda-ng.org/main/trunk@3887 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SmileyAdd/src/richcall.cpp | 68 ++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 39 deletions(-) (limited to 'plugins/SmileyAdd/src/richcall.cpp') diff --git a/plugins/SmileyAdd/src/richcall.cpp b/plugins/SmileyAdd/src/richcall.cpp index 463276baf4..23c1383f9f 100644 --- a/plugins/SmileyAdd/src/richcall.cpp +++ b/plugins/SmileyAdd/src/richcall.cpp @@ -217,7 +217,7 @@ static LRESULT CALLBACK RichEditSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LP switch(uMsg) { case WM_DESTROY: - CloseRichCallback(hwnd, false); + CloseRichCallback(hwnd); break; case WM_COPY: @@ -261,10 +261,6 @@ static LRESULT CALLBACK RichEditSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LP LRESULT result = mir_callNextSubclass(hwnd, RichEditSubclass, uMsg, wParam, lParam); switch(uMsg) { - case WM_DESTROY: - CloseRichCallback(hwnd, true); - break; - case WM_MOUSEMOVE: SetTooltip(LOWORD(lParam), HIWORD(lParam), hwnd, rdt); break; @@ -348,16 +344,14 @@ static LRESULT CALLBACK RichEditSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LP return result; } -void CloseRichCallback(HWND hwnd, bool force) +void CloseRichCallback(HWND hwnd) { int ind = g_RichEditList.getIndex((RichEditData*)&hwnd); if ( ind != -1 ) { RichEditData* rdt = g_RichEditList[ind]; - if (force) { - if (rdt->hToolTip) DestroyWindow(rdt->hToolTip); - delete rdt; - g_RichEditList.remove(ind); - } + if (rdt->hToolTip) DestroyWindow(rdt->hToolTip); + delete rdt; + g_RichEditList.remove(ind); } } @@ -400,6 +394,17 @@ static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wPara return 0; switch(uMsg) { + case WM_COMMAND: + if (LOWORD(wParam) == IDOK || LOWORD(wParam) == 1624) { + RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput); + if (rdt && (!rdt->inputarea || opt.InputSmileys)) { + rdt->dontReplace = true; + CHARRANGE sel = allsel; + ReplaceSmileysWithText(rdt->hwnd, sel, false); + } + } + break; + case WM_DESTROY: if ( !Miranda_Terminated()) { CHARRANGE sel = allsel; @@ -408,36 +413,21 @@ static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wPara if (rdto->hwndLog) ReplaceSmileysWithText(rdto->hwndLog, sel, false); } - else { - RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput); - if (rdt && (!rdt->inputarea || opt.InputSmileys)) { - CHARRANGE sel = allsel; - rdt->dontReplace = true; - ReplaceSmileysWithText(rdt->hwnd, sel, false); - } - } - CloseRichOwnerCallback(hwnd, false); - break; - case WM_COMMAND: - if (LOWORD(wParam) == IDOK || LOWORD(wParam) == 1624) { - RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput); - if (rdt && (!rdt->inputarea || opt.InputSmileys)) { - rdt->dontReplace = true; - CHARRANGE sel = allsel; - ReplaceSmileysWithText(rdt->hwnd, sel, false); - } + RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput); + if (rdt && (!rdt->inputarea || opt.InputSmileys)) { + CHARRANGE sel = allsel; + rdt->dontReplace = true; + ReplaceSmileysWithText(rdt->hwnd, sel, false); } + + CloseRichOwnerCallback(hwnd); break; } LRESULT result = mir_callNextSubclass(hwnd, RichEditOwnerSubclass, uMsg, wParam, lParam); switch(uMsg) { - case WM_DESTROY: - CloseRichOwnerCallback(hwnd, true); - break; - case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == 1624) { RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput); @@ -452,16 +442,16 @@ static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wPara return result; } -void CloseRichOwnerCallback(HWND hwnd, bool force) +void CloseRichOwnerCallback(HWND hwnd) { int ind = g_RichEditOwnerList.getIndex((RichEditOwnerData*)&hwnd); if (ind == -1) return; RichEditOwnerData* rdto = g_RichEditOwnerList[ind]; - if (rdto && force) { - CloseRichCallback(rdto->hwndInput, true); - CloseRichCallback(rdto->hwndLog, true); + if (rdto) { + CloseRichCallback(rdto->hwndInput); + CloseRichCallback(rdto->hwndLog); delete rdto; g_RichEditOwnerList.remove(ind); @@ -504,10 +494,10 @@ void RichEditData_Destroy(void) { int i; for (i=g_RichEditList.getCount(); i--; ) - CloseRichCallback(g_RichEditList[i]->hwnd, true); + CloseRichCallback(g_RichEditList[i]->hwnd); g_RichEditList.destroy(); for (i=g_RichEditOwnerList.getCount(); i--; ) - CloseRichOwnerCallback(g_RichEditOwnerList[i]->hwnd, true); + CloseRichOwnerCallback(g_RichEditOwnerList[i]->hwnd); g_RichEditOwnerList.destroy(); } -- cgit v1.2.3