summaryrefslogtreecommitdiff
path: root/plugins/SmileyAdd/src/richcall.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/SmileyAdd/src/richcall.cpp')
-rw-r--r--plugins/SmileyAdd/src/richcall.cpp77
1 files changed, 34 insertions, 43 deletions
diff --git a/plugins/SmileyAdd/src/richcall.cpp b/plugins/SmileyAdd/src/richcall.cpp
index 2127211b6e..afee5fca8f 100644
--- a/plugins/SmileyAdd/src/richcall.cpp
+++ b/plugins/SmileyAdd/src/richcall.cpp
@@ -199,19 +199,15 @@ static void SmileyToTextCutRest(RichEditData* rdt)
RedrawWindow(rdt->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
}
-
static LRESULT CALLBACK RichEditSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
RichEditData* rdt = g_RichEditList.find((RichEditData*)&hwnd);
- if (rdt == NULL) return 0;
+ if (rdt == NULL)
+ return 0;
CHARRANGE sel;
switch(uMsg) {
- case WM_DESTROY:
- CloseRichCallback(hwnd);
- break;
-
case WM_COPY:
case WM_CUT:
SmileyToTextCutPrep(rdt);
@@ -336,17 +332,6 @@ static LRESULT CALLBACK RichEditSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LP
return result;
}
-void CloseRichCallback(HWND hwnd)
-{
- int ind = g_RichEditList.getIndex((RichEditData*)&hwnd);
- if ( ind != -1 ) {
- RichEditData* rdt = g_RichEditList[ind];
- if (rdt->hToolTip) DestroyWindow(rdt->hToolTip);
- delete rdt;
- g_RichEditList.remove(ind);
- }
-}
-
bool SetRichCallback(HWND hwnd, HANDLE hContact, bool subany, bool subnew)
{
RichEditData* rdt = g_RichEditList.find((RichEditData*)&hwnd);
@@ -379,6 +364,22 @@ bool SetRichCallback(HWND hwnd, HANDLE hContact, bool subany, bool subnew)
return true;
}
+void CloseRichCallback(HWND hwnd)
+{
+ int ind = g_RichEditList.getIndex((RichEditData*)&hwnd);
+ if (ind == -1 )
+ return;
+
+ RichEditData* rdt = g_RichEditList[ind];
+ if (rdt->hToolTip)
+ DestroyWindow(rdt->hToolTip);
+ delete rdt;
+ g_RichEditList.remove(ind);
+ mir_unsubclassWindow(hwnd, RichEditSubclass);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
RichEditOwnerData* rdto = g_RichEditOwnerList.find((RichEditOwnerData*)&hwnd);
@@ -398,22 +399,12 @@ static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wPara
break;
case WM_DESTROY:
- if ( !Miranda_Terminated()) {
- CHARRANGE sel = allsel;
- if (rdto->hwndInput)
- ReplaceSmileysWithText(rdto->hwndInput, sel, false);
- if (rdto->hwndLog)
- ReplaceSmileysWithText(rdto->hwndLog, 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;
}
@@ -434,22 +425,6 @@ static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wPara
return result;
}
-void CloseRichOwnerCallback(HWND hwnd)
-{
- int ind = g_RichEditOwnerList.getIndex((RichEditOwnerData*)&hwnd);
- if (ind == -1)
- return;
-
- RichEditOwnerData* rdto = g_RichEditOwnerList[ind];
- if (rdto) {
- CloseRichCallback(rdto->hwndInput);
- CloseRichCallback(rdto->hwndLog);
-
- delete rdto;
- g_RichEditOwnerList.remove(ind);
- }
-}
-
void SetRichOwnerCallback(HWND hwnd, HWND hwndInput, HWND hwndLog)
{
RichEditOwnerData* rdto = g_RichEditOwnerList.find((RichEditOwnerData*)&hwnd);
@@ -471,6 +446,22 @@ void SetRichOwnerCallback(HWND hwnd, HWND hwndInput, HWND hwndLog)
}
}
+void CloseRichOwnerCallback(HWND hwnd)
+{
+ int ind = g_RichEditOwnerList.getIndex((RichEditOwnerData*)&hwnd);
+ if (ind == -1)
+ return;
+
+ RichEditOwnerData* rdto = g_RichEditOwnerList[ind];
+ CloseRichCallback(rdto->hwndInput);
+ CloseRichCallback(rdto->hwndLog);
+
+ delete rdto;
+ g_RichEditOwnerList.remove(ind);
+
+ mir_unsubclassWindow(hwnd, RichEditOwnerSubclass);
+}
+
void ProcessAllInputAreas(bool restoreText)
{
for (int i=g_RichEditList.getCount(); i--; ) {