summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-03-30 21:18:59 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-03-30 21:18:59 +0000
commite72bfde5e74dbaea2d6871558e5e3959d8deee9a (patch)
treee1e423f231146b7e2969f1cde14f83aa74530506 /src/core
parentff1ad9039c8f8f825d7453ca63d261d879d95391 (diff)
unsubclassing in StdChat/StdMsg
git-svn-id: http://svn.miranda-ng.org/main/trunk@8801 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/core')
-rw-r--r--src/core/miranda.cpp6
-rw-r--r--src/core/stdchat/src/chat.h3
-rw-r--r--src/core/stdchat/src/window.cpp66
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp4
4 files changed, 37 insertions, 42 deletions
diff --git a/src/core/miranda.cpp b/src/core/miranda.cpp
index ff0536c310..e814704e9e 100644
--- a/src/core/miranda.cpp
+++ b/src/core/miranda.cpp
@@ -199,7 +199,7 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR cmdLine, int)
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
- if ( IsWinVerVistaPlus()) {
+ if (IsWinVerVistaPlus()) {
HINSTANCE hDwmApi = LoadLibraryA("dwmapi.dll");
if (hDwmApi) {
dwmExtendFrameIntoClientArea = (pfnDwmExtendFrameIntoClientArea)GetProcAddress(hDwmApi, "DwmExtendFrameIntoClientArea");
@@ -222,11 +222,11 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR cmdLine, int)
OleInitialize(NULL);
- if ( IsWinVer7Plus())
+ if (IsWinVer7Plus())
CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_ALL, IID_ITaskbarList3, (void**)&pTaskbarInterface);
int result = 0;
- if ( LoadDefaultModules()) {
+ if (LoadDefaultModules()) {
SetEvent(hMirandaShutdown);
NotifyEventHooks(hPreShutdownEvent, 0, 0);
NotifyEventHooks(hShutdownEvent, 0, 0);
diff --git a/src/core/stdchat/src/chat.h b/src/core/stdchat/src/chat.h
index 5bee654fae..3507e8f5c5 100644
--- a/src/core/stdchat/src/chat.h
+++ b/src/core/stdchat/src/chat.h
@@ -70,8 +70,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "richutil.h"
#define EM_SUBCLASSED (WM_USER+200)
-#define EM_UNSUBCLASSED (WM_USER+201)
-#define EM_ACTIVATE (WM_USER+202)
+#define EM_ACTIVATE (WM_USER+201)
struct TABLIST
{
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp
index 321affafcd..c868446d7a 100644
--- a/src/core/stdchat/src/window.cpp
+++ b/src/core/stdchat/src/window.cpp
@@ -706,7 +706,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
}
break;
- case EM_UNSUBCLASSED:
+ case WM_DESTROY:
mir_free(dat);
return 0;
}
@@ -2343,7 +2343,7 @@ LABEL_SHOWWINDOW:
break;
case IDC_SHOWNICKLIST:
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_SHOWNICKLIST)))
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_SHOWNICKLIST)))
break;
if (si->iType == GCW_SERVER)
break;
@@ -2370,8 +2370,8 @@ LABEL_SHOWWINDOW:
smaddInfo.targetWParam = TRUE;
smaddInfo.Protocolname = si->pszModule;
smaddInfo.Direction = 3;
- smaddInfo.xPosition = rc.left+3;
- smaddInfo.yPosition = rc.top-1;
+ smaddInfo.xPosition = rc.left + 3;
+ smaddInfo.yPosition = rc.top - 1;
smaddInfo.hContact = si->hContact;
smaddInfo.hwndParent = hwndDlg;
@@ -2403,17 +2403,17 @@ LABEL_SHOWWINDOW:
break;
case IDC_CHANMGR:
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHANMGR)))
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHANMGR)))
break;
pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_CHANMGR, NULL, NULL, 0);
break;
case IDC_FILTER:
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_FILTER)))
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_FILTER)))
break;
si->bFilterEnabled = !si->bFilterEnabled;
- SendDlgItemMessage(hwndDlg,IDC_FILTER,BM_SETIMAGE,IMAGE_ICON,(LPARAM)LoadIconEx( si->bFilterEnabled ? "filter" : "filter2", FALSE ));
+ SendDlgItemMessage(hwndDlg, IDC_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(si->bFilterEnabled ? "filter" : "filter2", FALSE));
if (si->bFilterEnabled && db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0) {
SendMessage(hwndDlg, GC_SHOWFILTERMENU, 0, 0);
break;
@@ -2470,27 +2470,26 @@ LABEL_SHOWWINDOW:
case IDC_BOLD:
case IDC_ITALICS:
case IDC_UNDERLINE:
- {
- CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwMask = CFM_BOLD|CFM_ITALIC|CFM_UNDERLINE;
- cf.dwEffects = 0;
+ CHARFORMAT2 cf;
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE;
+ cf.dwEffects = 0;
- if (LOWORD(wParam) == IDC_BOLD && !IsWindowEnabled(GetDlgItem(hwndDlg,IDC_BOLD)))
- break;
- if (LOWORD(wParam) == IDC_ITALICS && !IsWindowEnabled(GetDlgItem(hwndDlg,IDC_ITALICS)))
- break;
- if (LOWORD(wParam) == IDC_UNDERLINE && !IsWindowEnabled(GetDlgItem(hwndDlg,IDC_UNDERLINE)))
- break;
- if (IsDlgButtonChecked(hwndDlg, IDC_BOLD))
- cf.dwEffects |= CFE_BOLD;
- if (IsDlgButtonChecked(hwndDlg, IDC_ITALICS))
- cf.dwEffects |= CFE_ITALIC;
- if (IsDlgButtonChecked(hwndDlg, IDC_UNDERLINE))
- cf.dwEffects |= CFE_UNDERLINE;
-
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- } }
+ if (LOWORD(wParam) == IDC_BOLD && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_BOLD)))
+ break;
+ if (LOWORD(wParam) == IDC_ITALICS && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ITALICS)))
+ break;
+ if (LOWORD(wParam) == IDC_UNDERLINE && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_UNDERLINE)))
+ break;
+ if (IsDlgButtonChecked(hwndDlg, IDC_BOLD))
+ cf.dwEffects |= CFE_BOLD;
+ if (IsDlgButtonChecked(hwndDlg, IDC_ITALICS))
+ cf.dwEffects |= CFE_ITALIC;
+ if (IsDlgButtonChecked(hwndDlg, IDC_UNDERLINE))
+ cf.dwEffects |= CFE_UNDERLINE;
+
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+ }
break;
case WM_KEYDOWN:
@@ -2498,7 +2497,7 @@ LABEL_SHOWWINDOW:
break;
case WM_MOVE:
- SendMessage(hwndDlg,GC_SAVEWNDPOS,0,1);
+ SendMessage(hwndDlg, GC_SAVEWNDPOS, 0, 1);
break;
case WM_GETMINMAXINFO:
@@ -2540,7 +2539,7 @@ LABEL_SHOWWINDOW:
break;
case WM_DESTROY:
- SendMessage(hwndDlg,GC_SAVEWNDPOS,0,0);
+ SendMessage(hwndDlg, GC_SAVEWNDPOS, 0, 0);
si->hWnd = NULL;
si->wState &= ~STATE_TALK;
@@ -2548,18 +2547,17 @@ LABEL_SHOWWINDOW:
si->hwndStatus = NULL;
if (si->hwndTooltip != NULL) {
- HWND hNickList = GetDlgItem(hwndDlg,IDC_LIST);
+ HWND hNickList = GetDlgItem(hwndDlg, IDC_LIST);
TOOLINFO ti = { 0 };
ti.cbSize = sizeof(TOOLINFO);
ti.uId = (UINT_PTR)hNickList;
ti.hwnd = hNickList;
- SendMessage( si->hwndTooltip, TTM_DELTOOL, 0, (LPARAM)(LPTOOLINFO)&ti );
+ SendMessage(si->hwndTooltip, TTM_DELTOOL, 0, (LPARAM)(LPTOOLINFO)&ti);
}
- DestroyWindow( si->hwndTooltip );
+ DestroyWindow(si->hwndTooltip);
si->hwndTooltip = NULL;
if (si->pAccPropServicesForNickList) si->pAccPropServicesForNickList->Release();
- SetWindowLongPtr(hwndDlg,GWLP_USERDATA,0);
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_UNSUBCLASSED, 0, 0);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
break;
}
return FALSE;
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index 9cddd03f4a..f58357338c 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -264,7 +264,6 @@ static void SetEditorText(HWND hwnd, const TCHAR* txt)
}
#define EM_SUBCLASSED (WM_USER+0x101)
-#define EM_UNSUBCLASSED (WM_USER+0x102)
#define ENTERCLICKTIME 1000 //max time in ms during which a double-tap on enter will cause a send
static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -485,7 +484,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar
else SendMessage(hwnd, EM_PASTESPECIAL, CF_TEXT, 0);
return 0;
- case EM_UNSUBCLASSED:
+ case WM_DESTROY:
mir_free(dat);
return 0;
}
@@ -1745,7 +1744,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
WindowList_Remove(g_dat.hMessageWindowList, hwndDlg);
db_set_dw(db_get_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT) ? dat->hContact : NULL, SRMMMOD, "splitterPos", dat->splitterPos);
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_UNSUBCLASSED, 0, 0);
HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0);
if (hFont != NULL && hFont != (HFONT)SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0))