summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-03-30 21:02:15 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-03-30 21:02:15 +0000
commitf2e1643ee2763008bda8992b31ac3e4410ed28d1 (patch)
treef0b91ea02c618ad4048ead0eae528f1f38f4d513
parent37028d5330f51ca51fbbe75730125dbbb3b09e68 (diff)
Scriver: fix for unsubclassing problems
git-svn-id: http://svn.miranda-ng.org/main/trunk@8798 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Scriver/src/Version.h14
-rw-r--r--plugins/Scriver/src/chat/window.cpp3
-rw-r--r--plugins/Scriver/src/infobar.cpp4
-rw-r--r--plugins/Scriver/src/infobar.h2
-rw-r--r--plugins/Scriver/src/msgdialog.cpp51
-rw-r--r--plugins/Scriver/src/msglog.cpp12
-rw-r--r--plugins/Scriver/src/msgs.h2
-rw-r--r--plugins/Scriver/src/utils.cpp2
-rw-r--r--plugins/Scriver/src/utils.h2
9 files changed, 42 insertions, 50 deletions
diff --git a/plugins/Scriver/src/Version.h b/plugins/Scriver/src/Version.h
index a3fcff5e84..d5861dfb39 100644
--- a/plugins/Scriver/src/Version.h
+++ b/plugins/Scriver/src/Version.h
@@ -1,14 +1,14 @@
-#define __MAJOR_VERSION 2
-#define __MINOR_VERSION 11
+#define __MAJOR_VERSION 2
+#define __MINOR_VERSION 11
#define __RELEASE_NUM 0
-#define __BUILD_NUM 0
+#define __BUILD_NUM 1
#include <stdver.h>
#define __PLUGIN_NAME "Scriver"
#define __FILENAME "Scriver.dll"
-#define __DESCRIPTION "Scriver - send and receive instant messages."
-#define __AUTHOR "Miranda NG Development Team"
+#define __DESCRIPTION "Scriver - send and receive instant messages."
+#define __AUTHOR "Miranda NG Development Team"
#define __AUTHOREMAIL "the_leech@users.berlios.de"
-#define __AUTHORWEB "http://miranda-ng.org/p/Scriver/"
-#define __COPYRIGHT "© 2000-2012 Miranda IM Project, 2012-14 Miranda NG project"
+#define __AUTHORWEB "http://miranda-ng.org/p/Scriver/"
+#define __COPYRIGHT "© 2000-2012 Miranda IM Project, 2012-14 Miranda NG project"
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp
index 764e658d81..31bf4117c3 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -539,7 +539,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
}
break;
- case EM_UNSUBCLASSED:
+ case WM_DESTROY:
mir_free(dat->szSearchQuery);
mir_free(dat->szSearchResult);
mir_free(dat);
@@ -2013,7 +2013,6 @@ LABEL_SHOWWINDOW:
NotifyLocalWinEvent(si->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSING);
si->hWnd = NULL;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_UNSUBCLASSED, 0, 0);
SendMessage(GetParent(hwndDlg), CM_REMOVECHILD, 0, (LPARAM)hwndDlg);
if (si->windowData.hwndLog != NULL) {
diff --git a/plugins/Scriver/src/infobar.cpp b/plugins/Scriver/src/infobar.cpp
index d4c7caee6d..22e006550b 100644
--- a/plugins/Scriver/src/infobar.cpp
+++ b/plugins/Scriver/src/infobar.cpp
@@ -70,7 +70,7 @@ static HICON GetExtraStatusIcon(InfobarWindowData* idat)
void RefreshInfobar(InfobarWindowData* idat)
{
HWND hwnd = idat->hWnd;
- struct SrmmWindowData *dat = idat->mwd;
+ SrmmWindowData *dat = idat->mwd;
TCHAR *szContactName = GetNickname(dat->windowData.hContact, dat->szProto);
TCHAR *szContactStatusMsg = db_get_tsa(dat->windowData.hContact, "CList", "StatusMsg");
TCHAR *szXStatusName = db_get_tsa(idat->mwd->windowData.hContact, idat->mwd->szProto, "XStatusName");
@@ -280,7 +280,7 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
return FALSE;
}
-InfobarWindowData *CreateInfobar(HWND hParent, struct SrmmWindowData *dat)
+InfobarWindowData *CreateInfobar(HWND hParent, SrmmWindowData *dat)
{
InfobarWindowData *idat = (InfobarWindowData *) mir_alloc(sizeof(InfobarWindowData));
idat->mwd = dat;
diff --git a/plugins/Scriver/src/infobar.h b/plugins/Scriver/src/infobar.h
index 4b81334844..2da8737212 100644
--- a/plugins/Scriver/src/infobar.h
+++ b/plugins/Scriver/src/infobar.h
@@ -30,7 +30,7 @@ typedef struct InfobarWindowDataStruct
HWND hXStatusTip;
} InfobarWindowData;
-InfobarWindowData *CreateInfobar(HWND hParent, struct SrmmWindowData *dat);
+InfobarWindowData *CreateInfobar(HWND hParent, SrmmWindowData *dat);
void SetupInfobar(InfobarWindowData* idat);
void RefreshInfobar(InfobarWindowData* idat);
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp
index 7257c4f69d..2a1e787b1a 100644
--- a/plugins/Scriver/src/msgdialog.cpp
+++ b/plugins/Scriver/src/msgdialog.cpp
@@ -33,7 +33,7 @@ extern HANDLE hHookWinPopup;
extern CREOleCallback reOleCallback;
extern CREOleCallback2 reOleCallback2;
-static void UpdateReadChars(HWND hwndDlg, struct SrmmWindowData * dat);
+static void UpdateReadChars(HWND hwndDlg, SrmmWindowData * dat);
static ToolbarButton toolbarButtons[] = {
{LPGENT("Quote"), IDC_QUOTE, 0, 4, 24},
@@ -56,7 +56,7 @@ static DWORD CALLBACK StreamOutCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG
return 0;
}
-static TCHAR *GetIEViewSelection(struct SrmmWindowData *dat)
+static TCHAR *GetIEViewSelection(SrmmWindowData *dat)
{
IEVIEWEVENT evt = { sizeof(evt) };
evt.codepage = dat->windowData.codePage;
@@ -218,7 +218,7 @@ static void AddToFileList(TCHAR ***pppFiles,int *totalCount,const TCHAR* szFilen
static void SetDialogToType(HWND hwndDlg)
{
BOOL showToolbar = SendMessage(GetParent(hwndDlg), CM_GETTOOLBARSTATUS, 0, 0);
- struct SrmmWindowData *dat = (struct SrmmWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ SrmmWindowData *dat = (SrmmWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
ParentWindowData *pdat = dat->parent;
if (pdat->flags2 & SMF2_SHOWINFOBAR)
@@ -249,7 +249,7 @@ static void SetDialogToType(HWND hwndDlg)
SendMessage(hwndDlg, WM_SIZE, 0, 0);
}
-void SetStatusIcon(struct SrmmWindowData *dat)
+void SetStatusIcon(SrmmWindowData *dat)
{
if (dat->szProto == NULL)
return;
@@ -280,7 +280,7 @@ void SetStatusIcon(struct SrmmWindowData *dat)
dat->statusIconOverlay = ImageList_GetIcon(g_dat.hHelperIconList, index, ILD_TRANSPARENT|INDEXTOOVERLAYMASK(1));
}
-void GetTitlebarIcon(struct SrmmWindowData *dat, TitleBarData *tbd)
+void GetTitlebarIcon(SrmmWindowData *dat, TitleBarData *tbd)
{
if (dat->showTyping && (g_dat.flags2 & SMF2_SHOWTYPINGWIN))
tbd->hIconNot = tbd->hIcon = GetCachedIcon("scriver_TYPING");
@@ -295,7 +295,7 @@ void GetTitlebarIcon(struct SrmmWindowData *dat, TitleBarData *tbd)
tbd->hIconBig = (g_dat.flags & SMF_STATUSICON) ? dat->statusIconBig : g_dat.hMsgIconBig;
}
-HICON GetTabIcon(struct SrmmWindowData *dat)
+HICON GetTabIcon(SrmmWindowData *dat)
{
if (dat->showTyping)
return GetCachedIcon("scriver_TYPING");
@@ -306,11 +306,6 @@ HICON GetTabIcon(struct SrmmWindowData *dat)
return dat->statusIcon;
}
-struct MsgEditSubclassData
-{
- DWORD lastEnterTime;
-};
-
static LRESULT CALLBACK LogEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static BOOL inMenu = FALSE;
@@ -397,10 +392,17 @@ static LRESULT CALLBACK LogEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
return mir_callNextSubclass(hwnd, LogEditSubclassProc, msg, wParam, lParam);
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct MsgEditSubclassData
+{
+ DWORD lastEnterTime;
+};
+
static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct MsgEditSubclassData *dat = (MsgEditSubclassData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- struct SrmmWindowData *pdat = (SrmmWindowData*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
+ MsgEditSubclassData *dat = (MsgEditSubclassData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ SrmmWindowData *pdat = (SrmmWindowData*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
CommonWindowData *windowData = &pdat->windowData;
int result = InputAreaShortcuts(hwnd, msg, wParam, lParam, windowData);
@@ -412,7 +414,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar
switch (msg) {
case EM_SUBCLASSED:
- dat = (struct MsgEditSubclassData *) mir_alloc(sizeof(struct MsgEditSubclassData));
+ dat = (MsgEditSubclassData*)mir_alloc(sizeof(MsgEditSubclassData));
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) dat);
DragAcceptFiles(hwnd, TRUE);
dat->lastEnterTime = 0;
@@ -483,34 +485,27 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar
InputAreaContextMenu(hwnd, wParam, lParam, pdat->windowData.hContact);
return TRUE;
- case EM_UNSUBCLASSED:
+ case WM_DESTROY:
mir_free(dat);
return 0;
}
return mir_callNextSubclass(hwnd, MessageEditSubclassProc, msg, wParam, lParam);
}
-static void SubclassMessageEdit(HWND hwnd) {
+static void SubclassMessageEdit(HWND hwnd)
+{
RichUtil_SubClass(hwnd);
mir_subclassWindow(hwnd, MessageEditSubclassProc);
SendMessage(hwnd, EM_SUBCLASSED, 0, 0);
}
-static void UnsubclassMessageEdit(HWND hwnd) {
- SendMessage(hwnd, EM_UNSUBCLASSED, 0, 0);
-}
-
static void SubclassLogEdit(HWND hwnd) {
RichUtil_SubClass(hwnd);
mir_subclassWindow(hwnd, LogEditSubclassProc);
SendMessage(hwnd, EM_SUBCLASSED, 0, 0);
}
-static void UnsubclassLogEdit(HWND hwnd) {
- SendMessage(hwnd, EM_UNSUBCLASSED, 0, 0);
-}
-
-static void MessageDialogResize(HWND hwndDlg, struct SrmmWindowData *dat, int w, int h)
+static void MessageDialogResize(HWND hwndDlg, SrmmWindowData *dat, int w, int h)
{
ParentWindowData *pdat = dat->parent;
int hSplitterPos = dat->splitterPos, toolbarHeight = pdat->flags2&SMF2_SHOWTOOLBAR ? IsToolbarVisible(SIZEOF(toolbarButtons), g_dat.buttonVisibility) ? dat->toolbarSize.cy : dat->toolbarSize.cy / 3 : 0;
@@ -670,7 +665,7 @@ static BOOL IsTypingNotificationEnabled(SrmmWindowData *dat)
// Don't send to protocols that are offline
// Don't send to users who are not visible and
// Don't send to users who are not on the visible list when you are in invisible mode.
-static void NotifyTyping(struct SrmmWindowData *dat, int mode)
+static void NotifyTyping(SrmmWindowData *dat, int mode)
{
if (!IsTypingNotificationSupported(dat))
return;
@@ -733,7 +728,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
int len = 0;
RECT minEditInit;
NewMessageWindowLParam *newData = (NewMessageWindowLParam*)lParam;
- dat = (SrmmWindowData*)mir_calloc(sizeof(struct SrmmWindowData));
+ dat = (SrmmWindowData*)mir_calloc(sizeof(SrmmWindowData));
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dat);
dat->windowData.hContact = newData->hContact;
NotifyLocalWinEvent(dat->windowData.hContact, hwndDlg, MSG_WINDOW_EVT_OPENING);
@@ -1962,8 +1957,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
tcmdlist_free(dat->windowData.cmdList);
WindowList_Remove(g_dat.hMessageWindowList, hwndDlg);
- UnsubclassMessageEdit(GetDlgItem(hwndDlg, IDC_MESSAGE));
- UnsubclassLogEdit(GetDlgItem(hwndDlg, IDC_LOG));
HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0);
if (hFont != NULL && hFont != (HFONT) SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0))
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp
index d04744ad01..efedaa061e 100644
--- a/plugins/Scriver/src/msglog.cpp
+++ b/plugins/Scriver/src/msglog.cpp
@@ -133,7 +133,7 @@ int DbEventIsMessageOrCustom(DBEVENTINFO* dbei)
return dbei->eventType == EVENTTYPE_MESSAGE || DbEventIsCustomForMsgWindow(dbei);
}
-int DbEventIsShown(DBEVENTINFO * dbei, struct SrmmWindowData *dat)
+int DbEventIsShown(DBEVENTINFO * dbei, SrmmWindowData *dat)
{
switch (dbei->eventType) {
case EVENTTYPE_MESSAGE:
@@ -151,7 +151,7 @@ int DbEventIsShown(DBEVENTINFO * dbei, struct SrmmWindowData *dat)
return DbEventIsCustomForMsgWindow(dbei);
}
-EventData* getEventFromDB(struct SrmmWindowData *dat, MCONTACT hContact, HANDLE hDbEvent)
+EventData* getEventFromDB(SrmmWindowData *dat, MCONTACT hContact, HANDLE hDbEvent)
{
DBEVENTINFO dbei = { sizeof(dbei) };
dbei.cbBlob = db_event_getBlobSize(hDbEvent);
@@ -343,7 +343,7 @@ static int AppendTToBuffer(char **buffer, int *cbBufferEnd, int *cbBufferAlloced
}
//mir_free() the return value
-static char *CreateRTFHeader(struct SrmmWindowData *dat, struct GlobalMessageData *gdat)
+static char *CreateRTFHeader(SrmmWindowData *dat, struct GlobalMessageData *gdat)
{
char *buffer;
int bufferAlloced, bufferEnd;
@@ -563,7 +563,7 @@ static void AppendWithCustomLinks(EventData *evt, int style, char **buffer, int
}
//mir_free() the return value
-static char* CreateRTFFromEvent(struct SrmmWindowData *dat, EventData *evt, struct GlobalMessageData *gdat, struct LogStreamData *streamData)
+static char* CreateRTFFromEvent(SrmmWindowData *dat, EventData *evt, struct GlobalMessageData *gdat, struct LogStreamData *streamData)
{
char *buffer;
int bufferAlloced, bufferEnd;
@@ -826,7 +826,7 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG
void StreamInTestEvents(HWND hEditWnd, struct GlobalMessageData *gdat)
{
- struct SrmmWindowData dat = { 0 };
+ SrmmWindowData dat = { 0 };
struct LogStreamData streamData = { 0 };
streamData.isFirst = TRUE;
streamData.events = GetTestEvents();
@@ -845,7 +845,7 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend)
FINDTEXTEXA fi;
EDITSTREAM stream = { 0 };
struct LogStreamData streamData = { 0 };
- struct SrmmWindowData *dat = (struct SrmmWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ SrmmWindowData *dat = (SrmmWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
CHARRANGE oldSel, sel;
// IEVIew MOD Begin
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h
index 055d65b742..1eda0b84f3 100644
--- a/plugins/Scriver/src/msgs.h
+++ b/plugins/Scriver/src/msgs.h
@@ -223,7 +223,7 @@ struct CREOleCallback2 : public CREOleCallback
INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-int DbEventIsShown(DBEVENTINFO * dbei, struct SrmmWindowData *dat);
+int DbEventIsShown(DBEVENTINFO * dbei, SrmmWindowData *dat);
int DbEventIsCustomForMsgWindow(DBEVENTINFO *dbei);
int DbEventIsMessageOrCustom(DBEVENTINFO *dbei);
int safe_wcslen(wchar_t *msg, int maxLen);
diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp
index 77b2b2e2af..26e516f921 100644
--- a/plugins/Scriver/src/utils.cpp
+++ b/plugins/Scriver/src/utils.cpp
@@ -429,7 +429,7 @@ void SetSearchEngineIcons(HMENU hMenu, HIMAGELIST hImageList)
}
}
-void GetContactUniqueId(struct SrmmWindowData *dat, char *buf, int maxlen)
+void GetContactUniqueId(SrmmWindowData *dat, char *buf, int maxlen)
{
CONTACTINFO ci;
ZeroMemory(&ci, sizeof(ci));
diff --git a/plugins/Scriver/src/utils.h b/plugins/Scriver/src/utils.h
index dc741c42ab..612c8c77b6 100644
--- a/plugins/Scriver/src/utils.h
+++ b/plugins/Scriver/src/utils.h
@@ -54,7 +54,7 @@ void AppendToBuffer(char **buffer, int *cbBufferEnd, int *cbBufferAlloced, const
int MeasureMenuItem(WPARAM wParam, LPARAM lParam);
int DrawMenuItem(WPARAM wParam, LPARAM lParam);
void SetSearchEngineIcons(HMENU hMenu, HIMAGELIST hImageList);
-void GetContactUniqueId(struct SrmmWindowData *dat, char *buf, int maxlen);
+void GetContactUniqueId(SrmmWindowData *dat, char *buf, int maxlen);
HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle, RECT *rect);
void SetToolTipText(HWND hwndParent, HWND hwndTT, LPTSTR ptszText, LPTSTR ptszTitle);
void SetToolTipRect(HWND hwndParent, HWND hwndTT, RECT* rect);