diff options
author | George Hazan <george.hazan@gmail.com> | 2013-03-19 20:50:49 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-03-19 20:50:49 +0000 |
commit | d8348065cbeb4c23f5594e4cabed7094a8e2e430 (patch) | |
tree | 55cb282c8450eb02ba918c05233d4370bae0af4b /plugins/SmileyAdd/src/richcall.cpp | |
parent | b9c6f2f3a368274a21cee17d4e3ffe2f9980ec7d (diff) |
- mir_unsubclassWindow introduced for the explicit window unsubclassing;
- fix for subclassing in SRMM event handlers
git-svn-id: http://svn.miranda-ng.org/main/trunk@4117 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SmileyAdd/src/richcall.cpp')
-rw-r--r-- | plugins/SmileyAdd/src/richcall.cpp | 77 |
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--; ) {
|