diff options
author | George Hazan <george.hazan@gmail.com> | 2013-03-04 07:23:42 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-03-04 07:23:42 +0000 |
commit | 66cb770a982a2502456d10d73838df2b7239fd89 (patch) | |
tree | fc419dde94a9be3ebe8f2266ff46feb90d2bcbec /plugins/TabSRMM | |
parent | bc256df33a57e585367edffe33d3e58d53f82ce8 (diff) |
new subclassing functions applied to all plugins
git-svn-id: http://svn.miranda-ng.org/main/trunk@3880 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r-- | plugins/TabSRMM/src/chat/window.cpp | 383 | ||||
-rw-r--r-- | plugins/TabSRMM/src/container.cpp | 606 | ||||
-rw-r--r-- | plugins/TabSRMM/src/controls.cpp | 356 | ||||
-rw-r--r-- | plugins/TabSRMM/src/generic_msghandlers.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/include/controls.h | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/include/infopanel.h | 7 | ||||
-rw-r--r-- | plugins/TabSRMM/src/include/msgs.h | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/infopanel.cpp | 149 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 337 | ||||
-rw-r--r-- | plugins/TabSRMM/src/tabctrl.cpp | 794 | ||||
-rw-r--r-- | plugins/TabSRMM/src/templates.cpp | 325 | ||||
-rw-r--r-- | plugins/TabSRMM/src/themes.cpp | 15 |
12 files changed, 1455 insertions, 1521 deletions
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 7a2082e18e..20e6058a91 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -55,12 +55,7 @@ extern HBRUSH hListBkgBrush; extern HANDLE hSendEvent;
extern HICON hIcons[30];
extern HMENU g_hMenu;
-extern WNDPROC OldSplitterProc;
-static WNDPROC OldMessageProc;
-static WNDPROC OldNicklistProc;
-static WNDPROC OldFilterButtonProc;
-static WNDPROC OldLogProc;
static HKL hkl = NULL;
static HCURSOR hCurHyperlinkHand;
@@ -75,7 +70,6 @@ typedef struct } MESSAGESUBDATA;
static const CLSID IID_ITextDocument= { 0x8CC497C0,0xA1DF,0x11CE, { 0x80,0x98, 0x00,0xAA, 0x00,0x47,0xBE,0x5D} };
-extern WNDPROC OldIEViewProc;
static void Chat_SetMessageLog(TWindowData *dat)
{
@@ -356,8 +350,6 @@ static void Chat_UpdateWindowState(TWindowData *dat, UINT msg) if (dat->hwndIEView) {
if (M->GetByte("subclassIEView", 0) && dat->oldIEViewProc == 0) {
WNDPROC wndProc = (WNDPROC)SetWindowLongPtr(dat->hwndIEView, GWLP_WNDPROC, (LONG_PTR)IEViewSubclassProc);
- if (OldIEViewProc == 0)
- OldIEViewProc = wndProc;
dat->oldIEViewProc = wndProc;
}
}
@@ -589,10 +581,10 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, }
switch (msg) {
case WM_NCCALCSIZE:
- return(CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, OldMessageProc));
+ return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, MessageSubclassProc);
case WM_NCPAINT:
- return(CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, OldMessageProc));
+ return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, MessageSubclassProc);
case EM_SUBCLASSED:
dat = (MESSAGESUBDATA *) mir_calloc(sizeof(MESSAGESUBDATA));
@@ -1161,7 +1153,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return 0;
}
- return CallWindowProc(OldMessageProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, MessageSubclassProc, msg, wParam, lParam);
}
@@ -1320,7 +1312,7 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L break;
}
- return CallWindowProc(OldFilterButtonProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, ButtonSubclassProc, msg, wParam, lParam);
}
@@ -1335,13 +1327,13 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR switch (msg) {
case WM_NCCALCSIZE:
- return(CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, OldLogProc));
+ return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, LogSubclassProc);
case WM_NCPAINT:
- return(CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, OldLogProc));
+ return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, LogSubclassProc);
case WM_COPY:
- return(DM_WMCopyHandler(hwnd, OldLogProc, wParam, lParam));
+ return DM_WMCopyHandler(hwnd, LogSubclassProc, wParam, lParam);
case WM_SETCURSOR:
if (g_Settings.ClickableNicks && (LOWORD(lParam) == HTCLIENT)) {
@@ -1430,7 +1422,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break;
}
- return CallWindowProc(OldLogProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, LogSubclassProc, msg, wParam, lParam);
}
@@ -1520,22 +1512,23 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, switch (msg) {
//MAD: attemp to fix weird bug, when combobox with hidden vscroll
//can't be scrolled with mouse-wheel.
- case WM_NCCALCSIZE: {
- if (CSkin::m_DisableScrollbars) {
- RECT lpRect;
- LONG itemHeight;
- GetClientRect (hwnd, &lpRect);
- itemHeight = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0);
- g_cLinesPerPage = (lpRect.bottom - lpRect.top) /itemHeight ;
- }
- return(CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKUSERLIST, msg, wParam, lParam, OldNicklistProc));
+ case WM_NCCALCSIZE:
+ if (CSkin::m_DisableScrollbars) {
+ RECT lpRect;
+ LONG itemHeight;
+
+ GetClientRect (hwnd, &lpRect);
+ itemHeight = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0);
+ g_cLinesPerPage = (lpRect.bottom - lpRect.top) /itemHeight ;
}
- //
- case WM_NCPAINT:
- return(CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKUSERLIST, msg, wParam, lParam, OldNicklistProc));
+ return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKUSERLIST, msg, wParam, lParam, NicklistSubclassProc);
- case WM_ERASEBKGND: {
+ case WM_NCPAINT:
+ return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKUSERLIST, msg, wParam, lParam, NicklistSubclassProc);
+
+ case WM_ERASEBKGND:
+ {
HDC dc = (HDC)wParam;
struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
SESSION_INFO *parentdat = (SESSION_INFO *)dat->si;
@@ -1562,154 +1555,154 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, }
return 1;
- //MAD
- case WM_MOUSEWHEEL: {
- if (CSkin::m_DisableScrollbars) {
- UINT uScroll;
- int dLines;
- short zDelta=(short)HIWORD(wParam);
- if (!SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &uScroll, 0))
- uScroll = 3; /* default value */
-
- if (uScroll == WHEEL_PAGESCROLL)
- uScroll = g_cLinesPerPage;
- if (uScroll == 0)
- return 0;
+ case WM_MOUSEWHEEL:
+ if (CSkin::m_DisableScrollbars) {
+ UINT uScroll;
+ int dLines;
+ short zDelta=(short)HIWORD(wParam);
+ if (!SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &uScroll, 0))
+ uScroll = 3; /* default value */
+
+ if (uScroll == WHEEL_PAGESCROLL)
+ uScroll = g_cLinesPerPage;
+ if (uScroll == 0)
+ return 0;
- zDelta += g_iWheelCarryover; /* Accumulate wheel motion */
+ zDelta += g_iWheelCarryover; /* Accumulate wheel motion */
- dLines = zDelta * (int)uScroll / WHEEL_DELTA;
+ dLines = zDelta * (int)uScroll / WHEEL_DELTA;
- //Record the unused portion as the next carryover.
- g_iWheelCarryover = zDelta - dLines * WHEEL_DELTA / (int)uScroll;
+ //Record the unused portion as the next carryover.
+ g_iWheelCarryover = zDelta - dLines * WHEEL_DELTA / (int)uScroll;
- // scrolling.
- while (abs(dLines)) {
- if (dLines > 0) {
- SendMessage(hwnd, WM_VSCROLL, SB_LINEUP, 0);
- dLines--;
- } else {
- SendMessage(hwnd, WM_VSCROLL, SB_LINEDOWN, 0);
- dLines++;
- }
+ // scrolling.
+ while (abs(dLines)) {
+ if (dLines > 0) {
+ SendMessage(hwnd, WM_VSCROLL, SB_LINEUP, 0);
+ dLines--;
+ } else {
+ SendMessage(hwnd, WM_VSCROLL, SB_LINEDOWN, 0);
+ dLines++;
}
- return 0;
}
- break;
+ return 0;
}
-//MAD_
- case WM_KEYDOWN:
- if (wParam == 0x57 && GetKeyState(VK_CONTROL) & 0x8000) { // ctrl-w (close window)
- PostMessage(hwndParent, WM_CLOSE, 0, 1);
- return TRUE;
- }
- if (wParam == VK_ESCAPE || wParam == VK_UP || wParam == VK_DOWN || wParam == VK_NEXT ||
- wParam == VK_PRIOR || wParam == VK_TAB || wParam == VK_HOME || wParam == VK_END) {
- if (mwdat && mwdat->si) {
- SESSION_INFO *si = (SESSION_INFO *)mwdat->si;
- si->szSearch[0] = 0;
- si->iSearchItem = -1;
- }
- }
- break;
+ break;
- case WM_SETFOCUS:
- case WM_KILLFOCUS:
- if (mwdat && mwdat->si) { // set/kill focus invalidates incremental search status
+ case WM_KEYDOWN:
+ if (wParam == 0x57 && GetKeyState(VK_CONTROL) & 0x8000) { // ctrl-w (close window)
+ PostMessage(hwndParent, WM_CLOSE, 0, 1);
+ return TRUE;
+ }
+ if (wParam == VK_ESCAPE || wParam == VK_UP || wParam == VK_DOWN || wParam == VK_NEXT ||
+ wParam == VK_PRIOR || wParam == VK_TAB || wParam == VK_HOME || wParam == VK_END) {
+ if (mwdat && mwdat->si) {
SESSION_INFO *si = (SESSION_INFO *)mwdat->si;
si->szSearch[0] = 0;
si->iSearchItem = -1;
}
- break;
+ }
+ break;
- case WM_CHAR:
- case WM_UNICHAR: {
- /*
- * simple incremental search for the user (nick) - list control
- * typing esc or movement keys will clear the current search string
- */
+ case WM_SETFOCUS:
+ case WM_KILLFOCUS:
+ if (mwdat && mwdat->si) { // set/kill focus invalidates incremental search status
+ SESSION_INFO *si = (SESSION_INFO *)mwdat->si;
+ si->szSearch[0] = 0;
+ si->iSearchItem = -1;
+ }
+ break;
- if (mwdat && mwdat->si) {
- SESSION_INFO *si = (SESSION_INFO *)mwdat->si;
- if (wParam == 27 && si->szSearch[0]) { // escape - reset everything
- si->szSearch[0] = 0;
- si->iSearchItem = -1;
- break;
- } else if (wParam == '\b' && si->szSearch[0]) // backspace
- si->szSearch[lstrlen(si->szSearch) - 1] = '\0';
- else if (wParam < ' ')
+ case WM_CHAR:
+ case WM_UNICHAR:
+ /*
+ * simple incremental search for the user (nick) - list control
+ * typing esc or movement keys will clear the current search string
+ */
+ if (mwdat && mwdat->si) {
+ SESSION_INFO *si = (SESSION_INFO *)mwdat->si;
+ if (wParam == 27 && si->szSearch[0]) { // escape - reset everything
+ si->szSearch[0] = 0;
+ si->iSearchItem = -1;
+ break;
+ } else if (wParam == '\b' && si->szSearch[0]) // backspace
+ si->szSearch[lstrlen(si->szSearch) - 1] = '\0';
+ else if (wParam < ' ')
+ break;
+ else {
+ TCHAR szNew[2];
+ szNew[0] = (TCHAR) wParam;
+ szNew[1] = '\0';
+ if (lstrlen(si->szSearch) >= SIZEOF(si->szSearch) - 2) {
+ MessageBeep(MB_OK);
break;
- else {
- TCHAR szNew[2];
- szNew[0] = (TCHAR) wParam;
- szNew[1] = '\0';
- if (lstrlen(si->szSearch) >= SIZEOF(si->szSearch) - 2) {
- MessageBeep(MB_OK);
- break;
- }
- _tcscat(si->szSearch, szNew);
}
- if (si->szSearch[0]) {
- int iItems = SendMessage(hwnd, LB_GETCOUNT, 0, 0);
- int i;
- USERINFO *ui;
-
- /*
- * iterate over the (sorted) list of nicknames and search for the
- * string we have
- */
-
- for (i=0; i < iItems; i++) {
- ui = UM_FindUserFromIndex(si->pUsers, i);
- if (ui) {
- if (!_tcsnicmp(ui->pszNick, si->szSearch, lstrlen(si->szSearch))) {
- SendMessage(hwnd, LB_SETSEL, FALSE, -1);
- SendMessage(hwnd, LB_SETSEL, TRUE, i);
- si->iSearchItem = i;
- InvalidateRect(hwnd, NULL, FALSE);
- return 0;
- }
+ _tcscat(si->szSearch, szNew);
+ }
+ if (si->szSearch[0]) {
+ int iItems = SendMessage(hwnd, LB_GETCOUNT, 0, 0);
+ int i;
+ USERINFO *ui;
+
+ /*
+ * iterate over the (sorted) list of nicknames and search for the
+ * string we have
+ */
+
+ for (i=0; i < iItems; i++) {
+ ui = UM_FindUserFromIndex(si->pUsers, i);
+ if (ui) {
+ if (!_tcsnicmp(ui->pszNick, si->szSearch, lstrlen(si->szSearch))) {
+ SendMessage(hwnd, LB_SETSEL, FALSE, -1);
+ SendMessage(hwnd, LB_SETSEL, TRUE, i);
+ si->iSearchItem = i;
+ InvalidateRect(hwnd, NULL, FALSE);
+ return 0;
}
}
- if (i == iItems) {
- MessageBeep(MB_OK);
- si->szSearch[lstrlen(si->szSearch) - 1] = '\0';
- return 0;
- }
+ }
+ if (i == iItems) {
+ MessageBeep(MB_OK);
+ si->szSearch[lstrlen(si->szSearch) - 1] = '\0';
+ return 0;
}
}
- break;
}
+ break;
- case WM_RBUTTONDOWN: {
+ case WM_RBUTTONDOWN:
+ {
int iCounts = SendMessage(hwnd, LB_GETSELCOUNT, 0, 0);
-
if (iCounts != LB_ERR && iCounts > 1)
return 0;
SendMessage(hwnd, WM_LBUTTONDOWN, wParam, lParam);
- break;
}
+ break;
- case WM_RBUTTONUP:
- SendMessage(hwnd, WM_LBUTTONUP, wParam, lParam);
- break;
+ case WM_RBUTTONUP:
+ SendMessage(hwnd, WM_LBUTTONUP, wParam, lParam);
+ break;
- case WM_MEASUREITEM: {
+ case WM_MEASUREITEM:
+ {
MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *) lParam;
if (mis->CtlType == ODT_MENU)
return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
- return FALSE;
}
+ return FALSE;
- case WM_DRAWITEM: {
+ case WM_DRAWITEM:
+ {
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
if (dis->CtlType == ODT_MENU)
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
- return FALSE;
}
- case WM_CONTEXTMENU: {
+ return FALSE;
+
+ case WM_CONTEXTMENU:
+ {
TVHITTESTINFO hti;
int item;
int height;
@@ -1717,7 +1710,6 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
SESSION_INFO *parentdat = (SESSION_INFO *)dat->si;
-
hti.pt.x = (short) LOWORD(lParam);
hti.pt.y = (short) HIWORD(lParam);
if (hti.pt.x == -1 && hti.pt.y == -1) {
@@ -1749,55 +1741,55 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, uID = CreateGCMenu(hwnd, &hMenu, 0, hti.pt, parentdat, uinew.pszUID, NULL);
switch (uID) {
- case 0:
- break;
+ case 0:
+ break;
- case 20020: { // add to highlight...
- RECT rc, rcWnd;
- THighLightEdit the = {THighLightEdit::CMD_ADD, parentdat, ui};
+ case 20020: { // add to highlight...
+ RECT rc, rcWnd;
+ THighLightEdit the = {THighLightEdit::CMD_ADD, parentdat, ui};
- if (parentdat && ui) {
- HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_ADDHIGHLIGHT), parentdat->dat->pContainer->hwnd, CMUCHighlight::dlgProcAdd, (LPARAM)&the);
- TranslateDialogDefault(hwnd);
- GetClientRect(parentdat->pContainer->hwnd, &rcWnd);
- GetWindowRect(hwnd, &rc);
+ if (parentdat && ui) {
+ HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_ADDHIGHLIGHT), parentdat->dat->pContainer->hwnd, CMUCHighlight::dlgProcAdd, (LPARAM)&the);
+ TranslateDialogDefault(hwnd);
+ GetClientRect(parentdat->pContainer->hwnd, &rcWnd);
+ GetWindowRect(hwnd, &rc);
- SetWindowPos(hwnd, HWND_TOP, (rcWnd.right - (rc.right - rc.left)) / 2, (rcWnd.bottom - (rc.bottom - rc.top)) / 2 , 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
- }
- break;
+ SetWindowPos(hwnd, HWND_TOP, (rcWnd.right - (rc.right - rc.left)) / 2, (rcWnd.bottom - (rc.bottom - rc.top)) / 2 , 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
}
+ break;
+ }
- case ID_MESS:
- DoEventHookAsync(GetParent(hwnd), parentdat->ptszID, parentdat->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
- break;
+ case ID_MESS:
+ DoEventHookAsync(GetParent(hwnd), parentdat->ptszID, parentdat->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
+ break;
- default: {
- int iCount = SendMessage(hwnd, LB_GETCOUNT, 0, 0);
+ default: {
+ int iCount = SendMessage(hwnd, LB_GETCOUNT, 0, 0);
- if (iCount != LB_ERR) {
- int iSelectedItems = SendMessage(hwnd, LB_GETSELCOUNT, 0, 0);
+ if (iCount != LB_ERR) {
+ int iSelectedItems = SendMessage(hwnd, LB_GETSELCOUNT, 0, 0);
- if (iSelectedItems != LB_ERR) {
- int *pItems = (int *)malloc(sizeof(int) * (iSelectedItems + 1));
+ if (iSelectedItems != LB_ERR) {
+ int *pItems = (int *)malloc(sizeof(int) * (iSelectedItems + 1));
- if (pItems) {
- if (SendMessage(hwnd, LB_GETSELITEMS, (WPARAM)iSelectedItems, (LPARAM)pItems) != LB_ERR) {
- USERINFO *ui1 = NULL;
- int i;
+ if (pItems) {
+ if (SendMessage(hwnd, LB_GETSELITEMS, (WPARAM)iSelectedItems, (LPARAM)pItems) != LB_ERR) {
+ USERINFO *ui1 = NULL;
+ int i;
- for (i=0; i < iSelectedItems; i++) {
- ui1 = SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, pItems[i]);
- if (ui1)
- DoEventHookAsync(hwndParent, parentdat->ptszID, parentdat->pszModule, GC_USER_NICKLISTMENU, ui1->pszUID, NULL, (LPARAM)uID);
- }
+ for (i=0; i < iSelectedItems; i++) {
+ ui1 = SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, pItems[i]);
+ if (ui1)
+ DoEventHookAsync(hwndParent, parentdat->ptszID, parentdat->pszModule, GC_USER_NICKLISTMENU, ui1->pszUID, NULL, (LPARAM)uID);
}
- free(pItems);
}
+ free(pItems);
}
}
- //DoEventHookAsync(hwndParent, parentdat->ptszID, parentdat->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, (LPARAM)uID);
- break;
}
+ //DoEventHookAsync(hwndParent, parentdat->ptszID, parentdat->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, (LPARAM)uID);
+ break;
+ }
}
DestroyGCMenu(&hMenu, 1);
return TRUE;
@@ -1805,7 +1797,8 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, }
break;
- case WM_MOUSEMOVE: {
+ case WM_MOUSEMOVE:
+ {
POINT pt;
RECT clientRect;
pt.x = LOWORD(lParam);
@@ -1832,7 +1825,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, CallService("mToolTip/HideTip", 0, 0);
isToolTip = FALSE;
}
-
+
if (nItemUnderMouse != -1)
SetTimer(hwnd, 1, 450, 0);
}
@@ -1852,7 +1845,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, }
break;
- case WM_TIMER:
+ case WM_TIMER:
{
CLCINFOTIP ti = {0};
USERINFO *ui1 = NULL;
@@ -1875,9 +1868,8 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, KillTimer(hwnd, 1);
break;
}
-
- ui1 = SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, currentHovered);
+ ui1 = SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, currentHovered);
if (ui1) {
ti.cbSize = sizeof(ti);
mir_snprintf(serviceName, SIZEOF(serviceName), "%s"MS_GC_PROTO_GETTOOLTIPTEXT, parentdat->pszModule);
@@ -1886,9 +1878,9 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, mir_sntprintf(ptszBuf, SIZEOF(ptszBuf), _T("%s"), (TCHAR*)CallService(serviceName, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID));
else
mir_sntprintf(ptszBuf, SIZEOF(ptszBuf), _T("<b>%s:</b>\t%s\n<b>%s:</b>\t%s\n<b>%s:</b>\t%s"),
- TranslateT("Nick"), ui1->pszNick,
- TranslateT("Unique id"), ui1->pszUID,
- TranslateT("Status"), TM_WordToString(parentdat->pStatuses, ui1->Status));
+ TranslateT("Nick"), ui1->pszNick,
+ TranslateT("Unique id"), ui1->pszUID,
+ TranslateT("Status"), TM_WordToString(parentdat->pStatuses, ui1->Status));
if (ptszBuf != NULL)
if (CallService("mToolTip/ShowTipW", (WPARAM)mir_tstrdup(ptszBuf), (LPARAM)&ti))
@@ -1898,7 +1890,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, }
break;
}
- return CallWindowProc(OldNicklistProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, NicklistSubclassProc, msg, wParam, lParam);
}
/*
@@ -1957,8 +1949,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SESSION_INFO *psi = (SESSION_INFO*)newData->hdbEvent;
RECT rc;
- dat = (struct TWindowData *)malloc(sizeof(struct TWindowData));
- ZeroMemory(dat, sizeof(struct TWindowData));
+ dat = (TWindowData*)calloc( sizeof(TWindowData), 1);
si = psi;
dat->si = psi;
dat->hContact = psi->hContact;
@@ -2011,14 +2002,15 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SendMessage(GetDlgItem(hwndDlg,IDC_COLOR), BUTTONSETASPUSHBTN, TRUE, 0);
- OldSplitterProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTERX), GWLP_WNDPROC, (LONG_PTR)SplitterSubclassProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTERY), GWLP_WNDPROC, (LONG_PTR)SplitterSubclassProc);
- OldNicklistProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LIST), GWLP_WNDPROC, (LONG_PTR)NicklistSubclassProc);
- OldLogProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_LOG), GWLP_WNDPROC, (LONG_PTR)LogSubclassProc);
- OldFilterButtonProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FILTER), GWLP_WNDPROC, (LONG_PTR)ButtonSubclassProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_COLOR), GWLP_WNDPROC, (LONG_PTR)ButtonSubclassProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BKGCOLOR), GWLP_WNDPROC, (LONG_PTR)ButtonSubclassProc);
- OldMessageProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), GWLP_WNDPROC, (LONG_PTR)MessageSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_SPLITTERX), SplitterSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_SPLITTERY), SplitterSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_LIST), NicklistSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_CHAT_LOG), LogSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_FILTER), ButtonSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_COLOR), ButtonSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_BKGCOLOR), ButtonSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), MessageSubclassProc);
+
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SUBCLASSED, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_AUTOURLDETECT, 1, 0);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PANELSPLITTER), GWLP_WNDPROC, (LONG_PTR) SplitterSubclassProc);
@@ -3772,16 +3764,7 @@ LABEL_SHOWWINDOW: si->dat = 0;
si->pContainer = 0;
- //SetWindowLongPtr(hwndDlg,GWLP_USERDATA,0);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTERX), GWLP_WNDPROC, (LONG_PTR)OldSplitterProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTERY), GWLP_WNDPROC, (LONG_PTR)OldSplitterProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LIST), GWLP_WNDPROC, (LONG_PTR)OldNicklistProc);
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_UNSUBCLASSED, 0, 0);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), GWLP_WNDPROC, (LONG_PTR)OldMessageProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_LOG), GWLP_WNDPROC, (LONG_PTR)OldLogProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FILTER), GWLP_WNDPROC, (LONG_PTR)OldFilterButtonProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_COLOR), GWLP_WNDPROC, (LONG_PTR)OldFilterButtonProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BKGCOLOR), GWLP_WNDPROC, (LONG_PTR)OldFilterButtonProc);
TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSING, 0);
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 1f78880826..0cbfd39b5f 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -42,7 +42,6 @@ extern ButtonSet g_ButtonSet; TContainerData *pFirstContainer = 0; // the linked list of struct ContainerWindowData
TContainerData *pLastActiveContainer = NULL;
-static WNDPROC OldContainerWndProc = 0;
static bool fForceOverlayIcons = false;
static int ServiceParamsOK(ButtonItem *item, WPARAM *wParam, LPARAM *lParam, HANDLE hContact)
@@ -153,8 +152,8 @@ struct TContainerData* TSAPI CreateContainer(const TCHAR *name, int iTemp, HANDL if (M->GetByte("limittabs", 0) && !_tcscmp(name, _T("default")))
iTemp |= CNT_CREATEFLAG_CLONED;
/*
- * save container name to the db
- */
+ * save container name to the db
+ */
i = 0;
if (!M->GetByte("singlewinmode", 0)) {
do {
@@ -202,7 +201,7 @@ struct TContainerData* TSAPI CreateContainer(const TCHAR *name, int iTemp, HANDL return NULL;
}
-static BOOL CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
BOOL bSkinned;
@@ -210,101 +209,226 @@ static BOOL CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA bSkinned = CSkin::m_skinEnabled ? TRUE : FALSE;
switch (msg) {
- case WM_NCPAINT: {
- PAINTSTRUCT ps;
- HDC hdcReal;
- RECT rcClient;
- LONG width, height;
- HDC hdc;
- CSkinItem *item = &SkinItems[0], *item_normal, *item_pressed, *item_hot;
- HICON hIcon;
- HFONT hOldFont = 0;
- TEXTMETRIC tm;
-
- if (!pContainer || !bSkinned)
- break;
+ case WM_NCPAINT: {
+ PAINTSTRUCT ps;
+ HDC hdcReal;
+ RECT rcClient;
+ LONG width, height;
+ HDC hdc;
+ CSkinItem *item = &SkinItems[0], *item_normal, *item_pressed, *item_hot;
+ HICON hIcon;
+ HFONT hOldFont = 0;
+ TEXTMETRIC tm;
+
+ if (!pContainer || !bSkinned)
+ break;
- if (CSkin::m_frameSkins) {
- RECT rcWindow, rcClient;
- HDC dcFrame = GetDCEx(hwndDlg, 0, DCX_WINDOW|/*DCX_INTERSECTRGN|*/0x10000); // GetWindowDC(hwndDlg);
- POINT pt, pt1;
- LONG clip_top, clip_left;
- HRGN rgn = 0;
- CSkinItem *item;
- TCHAR szWindowText[512];
- RECT rcText;
- HDC dcMem = CreateCompatibleDC(pContainer->cachedDC ? pContainer->cachedDC : dcFrame);
- HBITMAP hbmMem, hbmOld;
- int i;
- DRAWITEMSTRUCT dis = {0};
+ if (CSkin::m_frameSkins) {
+ RECT rcWindow, rcClient;
+ HDC dcFrame = GetDCEx(hwndDlg, 0, DCX_WINDOW|/*DCX_INTERSECTRGN|*/0x10000); // GetWindowDC(hwndDlg);
+ POINT pt, pt1;
+ LONG clip_top, clip_left;
+ HRGN rgn = 0;
+ CSkinItem *item;
+ TCHAR szWindowText[512];
+ RECT rcText;
+ HDC dcMem = CreateCompatibleDC(pContainer->cachedDC ? pContainer->cachedDC : dcFrame);
+ HBITMAP hbmMem, hbmOld;
+ int i;
+ DRAWITEMSTRUCT dis = {0};
- GetWindowRect(hwndDlg, &rcWindow);
- GetClientRect(hwndDlg, &rcClient);
- pt.y = 0;
- pt.x = 0;
- ClientToScreen(hwndDlg, &pt);
- pt1.x = rcClient.right;
- pt1.y = rcClient.bottom;
- ClientToScreen(hwndDlg, &pt1);
- clip_top = pt.y - rcWindow.top;
- clip_left = pt.x - rcWindow.left;
-
- rcWindow.right = rcWindow.right - rcWindow.left;
- rcWindow.bottom = rcWindow.bottom - rcWindow.top;
- rcWindow.left = rcWindow.top = 0;
-
- hbmMem = CreateCompatibleBitmap(dcFrame, rcWindow.right, rcWindow.bottom);
- hbmOld = (HBITMAP)SelectObject(dcMem, hbmMem);
-
- ExcludeClipRect(dcFrame, clip_left, clip_top, clip_left + (pt1.x - pt.x), clip_top + (pt1.y - pt.y));
- ExcludeClipRect(dcMem, clip_left, clip_top, clip_left + (pt1.x - pt.x), clip_top + (pt1.y - pt.y));
- item = pContainer->ncActive ? &SkinItems[ID_EXTBKFRAME] : &SkinItems[ID_EXTBKFRAMEINACTIVE];
-
- CSkin::DrawItem(dcMem, &rcWindow, item);
-
- GetWindowText(hwndDlg, szWindowText, 512);
- szWindowText[511] = 0;
- hOldFont = (HFONT)SelectObject(dcMem, PluginConfig.hFontCaption);
- GetTextMetrics(dcMem, &tm);
- SetTextColor(dcMem, CInfoPanel::m_ipConfig.clrs[IPFONTCOUNT - 1]);
- SetBkMode(dcMem, TRANSPARENT);
- rcText.left =20 + CSkin::m_SkinnedFrame_left + CSkin::m_bClipBorder + CSkin::m_titleBarLeftOff;//26;
- rcText.right = rcWindow.right - 3 * CSkin::m_titleBarButtonSize.cx - 11 - CSkin::m_titleBarRightOff;
- rcText.top = CSkin::m_captionOffset + CSkin::m_bClipBorder;
- rcText.bottom = rcText.top + tm.tmHeight;
- rcText.left += CSkin::m_captionPadding;
- DrawText(dcMem, szWindowText, -1, &rcText, DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
- SelectObject(dcMem, hOldFont);
- /*
- * icon
- */
+ GetWindowRect(hwndDlg, &rcWindow);
+ GetClientRect(hwndDlg, &rcClient);
+ pt.y = 0;
+ pt.x = 0;
+ ClientToScreen(hwndDlg, &pt);
+ pt1.x = rcClient.right;
+ pt1.y = rcClient.bottom;
+ ClientToScreen(hwndDlg, &pt1);
+ clip_top = pt.y - rcWindow.top;
+ clip_left = pt.x - rcWindow.left;
+
+ rcWindow.right = rcWindow.right - rcWindow.left;
+ rcWindow.bottom = rcWindow.bottom - rcWindow.top;
+ rcWindow.left = rcWindow.top = 0;
+
+ hbmMem = CreateCompatibleBitmap(dcFrame, rcWindow.right, rcWindow.bottom);
+ hbmOld = (HBITMAP)SelectObject(dcMem, hbmMem);
+
+ ExcludeClipRect(dcFrame, clip_left, clip_top, clip_left + (pt1.x - pt.x), clip_top + (pt1.y - pt.y));
+ ExcludeClipRect(dcMem, clip_left, clip_top, clip_left + (pt1.x - pt.x), clip_top + (pt1.y - pt.y));
+ item = pContainer->ncActive ? &SkinItems[ID_EXTBKFRAME] : &SkinItems[ID_EXTBKFRAMEINACTIVE];
+
+ CSkin::DrawItem(dcMem, &rcWindow, item);
+
+ GetWindowText(hwndDlg, szWindowText, 512);
+ szWindowText[511] = 0;
+ hOldFont = (HFONT)SelectObject(dcMem, PluginConfig.hFontCaption);
+ GetTextMetrics(dcMem, &tm);
+ SetTextColor(dcMem, CInfoPanel::m_ipConfig.clrs[IPFONTCOUNT - 1]);
+ SetBkMode(dcMem, TRANSPARENT);
+ rcText.left =20 + CSkin::m_SkinnedFrame_left + CSkin::m_bClipBorder + CSkin::m_titleBarLeftOff;//26;
+ rcText.right = rcWindow.right - 3 * CSkin::m_titleBarButtonSize.cx - 11 - CSkin::m_titleBarRightOff;
+ rcText.top = CSkin::m_captionOffset + CSkin::m_bClipBorder;
+ rcText.bottom = rcText.top + tm.tmHeight;
+ rcText.left += CSkin::m_captionPadding;
+ DrawText(dcMem, szWindowText, -1, &rcText, DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
+ SelectObject(dcMem, hOldFont);
+ /*
+ * icon
+ */
+
+ hIcon = (HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0);
+ DrawIconEx(dcMem, 4 + CSkin::m_SkinnedFrame_left + CSkin::m_bClipBorder + CSkin::m_titleBarLeftOff, rcText.top + (rcText.bottom - rcText.top) / 2 - 8, hIcon, 16, 16, 0, 0, DI_NORMAL);
+
+ // title buttons;
+
+ pContainer->rcClose.top = pContainer->rcMin.top = pContainer->rcMax.top = CSkin::m_titleButtonTopOff;
+ pContainer->rcClose.bottom = pContainer->rcMin.bottom = pContainer->rcMax.bottom = CSkin::m_titleButtonTopOff + CSkin::m_titleBarButtonSize.cy;
+
+ pContainer->rcClose.right = rcWindow.right - 10 - CSkin::m_titleBarRightOff;
+ pContainer->rcClose.left = pContainer->rcClose.right - CSkin::m_titleBarButtonSize.cx;
+
+ pContainer->rcMax.right = pContainer->rcClose.left - 2;
+ pContainer->rcMax.left = pContainer->rcMax.right - CSkin::m_titleBarButtonSize.cx;
+
+ pContainer->rcMin.right = pContainer->rcMax.left - 2;
+ pContainer->rcMin.left = pContainer->rcMin.right - CSkin::m_titleBarButtonSize.cx;
+
+ item_normal = &SkinItems[ID_EXTBKTITLEBUTTON];
+ item_hot = &SkinItems[ID_EXTBKTITLEBUTTONMOUSEOVER];
+ item_pressed = &SkinItems[ID_EXTBKTITLEBUTTONPRESSED];
+
+ for (i=0; i < 3; i++) {
+ RECT *rc = 0;
+ HICON hIcon;
+
+ switch (i) {
+ case 0:
+ rc = &pContainer->rcMin;
+ hIcon = CSkin::m_minIcon;
+ break;
+ case 1:
+ rc = &pContainer->rcMax;
+ hIcon = CSkin::m_maxIcon;
+ break;
+ case 2:
+ rc = &pContainer->rcClose;
+ hIcon = CSkin::m_closeIcon;
+ break;
+ }
+ if (rc) {
+ item = pContainer->buttons[i].isPressed ? item_pressed : (pContainer->buttons[i].isHot ? item_hot : item_normal);
+ CSkin::DrawItem(dcMem, rc, item);
+ DrawIconEx(dcMem, rc->left + ((rc->right - rc->left) / 2 - 8), rc->top + ((rc->bottom - rc->top) / 2 - 8), hIcon, 16, 16, 0, 0, DI_NORMAL);
+ }
+ }
+ SetBkMode(dcMem, TRANSPARENT);
+ BitBlt(dcFrame, 0, 0, rcWindow.right, rcWindow.bottom, dcMem, 0, 0, SRCCOPY);
+ SelectObject(dcMem, hbmOld);
+ DeleteObject(hbmMem);
+ DeleteDC(dcMem);
+ ReleaseDC(hwndDlg, dcFrame);
+ }
+ else mir_callNextSubclass(hwndDlg, ContainerWndProc, msg, wParam, lParam);
+
+ hdcReal = BeginPaint(hwndDlg, &ps);
- hIcon = (HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0);
- DrawIconEx(dcMem, 4 + CSkin::m_SkinnedFrame_left + CSkin::m_bClipBorder + CSkin::m_titleBarLeftOff, rcText.top + (rcText.bottom - rcText.top) / 2 - 8, hIcon, 16, 16, 0, 0, DI_NORMAL);
+ GetClientRect(hwndDlg, &rcClient);
+ width = rcClient.right - rcClient.left;
+ height = rcClient.bottom - rcClient.top;
+ if (width != pContainer->oldDCSize.cx || height != pContainer->oldDCSize.cy) {
+ CSkinItem *sbaritem = &SkinItems[ID_EXTBKSTATUSBAR];
+ BOOL statusBarSkinnd = !(pContainer->dwFlags & CNT_NOSTATUSBAR) && !sbaritem->IGNORED;
+ LONG sbarDelta = statusBarSkinnd ? pContainer->statusBarHeight : 0;
- // title buttons;
+ pContainer->oldDCSize.cx = width;
+ pContainer->oldDCSize.cy = height;
- pContainer->rcClose.top = pContainer->rcMin.top = pContainer->rcMax.top = CSkin::m_titleButtonTopOff;
- pContainer->rcClose.bottom = pContainer->rcMin.bottom = pContainer->rcMax.bottom = CSkin::m_titleButtonTopOff + CSkin::m_titleBarButtonSize.cy;
+ if (pContainer->cachedDC) {
+ SelectObject(pContainer->cachedDC, pContainer->oldHBM);
+ DeleteObject(pContainer->cachedHBM);
+ DeleteDC(pContainer->cachedDC);
+ }
+ pContainer->cachedDC = CreateCompatibleDC(hdcReal);
+ pContainer->cachedHBM = CreateCompatibleBitmap(hdcReal, width, height);
+ pContainer->oldHBM = (HBITMAP)SelectObject(pContainer->cachedDC, pContainer->cachedHBM);
- pContainer->rcClose.right = rcWindow.right - 10 - CSkin::m_titleBarRightOff;
- pContainer->rcClose.left = pContainer->rcClose.right - CSkin::m_titleBarButtonSize.cx;
+ hdc = pContainer->cachedDC;
- pContainer->rcMax.right = pContainer->rcClose.left - 2;
- pContainer->rcMax.left = pContainer->rcMax.right - CSkin::m_titleBarButtonSize.cx;
+ if (!CSkin::DrawItem(hdc, &rcClient, item))
+ FillRect(hdc, &rcClient, GetSysColorBrush(COLOR_3DFACE));
- pContainer->rcMin.right = pContainer->rcMax.left - 2;
- pContainer->rcMin.left = pContainer->rcMin.right - CSkin::m_titleBarButtonSize.cx;
+ if (sbarDelta) {
+ rcClient.top = rcClient.bottom - sbarDelta;
+ CSkin::DrawItem(hdc, &rcClient, sbaritem);
+ }
+ }
+ BitBlt(hdcReal, 0, 0, width, height, pContainer->cachedDC, 0, 0, SRCCOPY);
+ EndPaint(hwndDlg, &ps);
+ return 0;
+ }
+ case WM_NCLBUTTONDOWN:
+ case WM_NCLBUTTONUP:
+ case WM_NCMOUSEHOVER:
+ case WM_NCMOUSEMOVE:
+ if (pContainer && CSkin::m_frameSkins) {
+ POINT pt;
+ RECT rcWindow;
+ BOOL isMin, isMax, isClose;
+ int i;
- item_normal = &SkinItems[ID_EXTBKTITLEBUTTON];
- item_hot = &SkinItems[ID_EXTBKTITLEBUTTONMOUSEOVER];
- item_pressed = &SkinItems[ID_EXTBKTITLEBUTTONPRESSED];
+ GetCursorPos(&pt);
+ GetWindowRect(hwndDlg, &rcWindow);
+ CopyMemory(&pContainer->oldbuttons[0], &pContainer->buttons[0], sizeof(struct TitleBtn) * 3);
+ ZeroMemory(&pContainer->buttons[0], sizeof(struct TitleBtn) * 3);
+ isMin = isMax = isClose = FALSE;
+
+ if (pt.x >= (rcWindow.left + pContainer->rcMin.left) && pt.x <= (rcWindow.left + pContainer->rcClose.right) && pt.y < rcWindow.top + 24 && wParam != HTTOPRIGHT) {
+ LRESULT result = 0; //DefWindowProc(hwndDlg, msg, wParam, lParam);
+ HDC hdc = GetWindowDC(hwndDlg);
+ LONG left = rcWindow.left;
+
+ pt.y = 10;
+ isMin = pt.x >= left + pContainer->rcMin.left && pt.x <= left + pContainer->rcMin.right;
+ isMax = pt.x >= left + pContainer->rcMax.left && pt.x <= left + pContainer->rcMax.right;
+ isClose = pt.x >= left + pContainer->rcClose.left && pt.x <= left + pContainer->rcClose.right;
+
+ if (msg == WM_NCMOUSEMOVE) {
+ if (isMax)
+ pContainer->buttons[BTN_MAX].isHot = TRUE;
+ else if (isMin)
+ pContainer->buttons[BTN_MIN].isHot = TRUE;
+ else if (isClose)
+ pContainer->buttons[BTN_CLOSE].isHot = TRUE;
+ }
+ else if (msg == WM_NCLBUTTONDOWN) {
+ if (isMax)
+ pContainer->buttons[BTN_MAX].isPressed = TRUE;
+ else if (isMin)
+ pContainer->buttons[BTN_MIN].isPressed = TRUE;
+ else if (isClose)
+ pContainer->buttons[BTN_CLOSE].isPressed = TRUE;
+ }
+ else if (msg == WM_NCLBUTTONUP) {
+ if (isMin)
+ SendMessage(hwndDlg, WM_SYSCOMMAND, SC_MINIMIZE, 0);
+ else if (isMax) {
+ if (IsZoomed(hwndDlg))
+ PostMessage(hwndDlg, WM_SYSCOMMAND, SC_RESTORE, 0);
+ else
+ PostMessage(hwndDlg, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
+ }
+ else if (isClose)
+ PostMessage(hwndDlg, WM_SYSCOMMAND, SC_CLOSE, 0);
+ }
for (i=0; i < 3; i++) {
- RECT *rc = 0;
- HICON hIcon;
+ if (pContainer->buttons[i].isHot != pContainer->oldbuttons[i].isHot) {
+ RECT *rc = 0;
+ HICON hIcon;
- switch (i) {
+ switch (i) {
case 0:
rc = &pContainer->rcMin;
hIcon = CSkin::m_minIcon;
@@ -317,243 +441,115 @@ static BOOL CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA rc = &pContainer->rcClose;
hIcon = CSkin::m_closeIcon;
break;
- }
- if (rc) {
- item = pContainer->buttons[i].isPressed ? item_pressed : (pContainer->buttons[i].isHot ? item_hot : item_normal);
- CSkin::DrawItem(dcMem, rc, item);
- DrawIconEx(dcMem, rc->left + ((rc->right - rc->left) / 2 - 8), rc->top + ((rc->bottom - rc->top) / 2 - 8), hIcon, 16, 16, 0, 0, DI_NORMAL);
+ }
+ if (rc) {
+ CSkinItem *item = &SkinItems[pContainer->buttons[i].isPressed ? ID_EXTBKTITLEBUTTONPRESSED : (pContainer->buttons[i].isHot ? ID_EXTBKTITLEBUTTONMOUSEOVER : ID_EXTBKTITLEBUTTON)];
+ CSkin::DrawItem(hdc, rc, item);
+ DrawIconEx(hdc, rc->left + ((rc->right - rc->left) / 2 - 8), rc->top + ((rc->bottom - rc->top) / 2 - 8), hIcon, 16, 16, 0, 0, DI_NORMAL);
+ }
}
}
- SetBkMode(dcMem, TRANSPARENT);
- BitBlt(dcFrame, 0, 0, rcWindow.right, rcWindow.bottom, dcMem, 0, 0, SRCCOPY);
- SelectObject(dcMem, hbmOld);
- DeleteObject(hbmMem);
- DeleteDC(dcMem);
- ReleaseDC(hwndDlg, dcFrame);
+ ReleaseDC(hwndDlg, hdc);
+ return result;
}
- else
- CallWindowProc(OldContainerWndProc, hwndDlg, msg, wParam, lParam);
-
- hdcReal = BeginPaint(hwndDlg, &ps);
+ else {
+ LRESULT result = DefWindowProc(hwndDlg, msg, wParam, lParam);
+ RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_NOCHILDREN);
+ return result;
+ }
+ }
+ break;
+ case WM_SETCURSOR:
+ if (CSkin::m_frameSkins && (HWND)wParam == hwndDlg) {
+ DefWindowProc(hwndDlg, msg, wParam, lParam);
+ RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_NOCHILDREN);
+ return 1;
+ }
+ break;
- GetClientRect(hwndDlg, &rcClient);
- width = rcClient.right - rcClient.left;
- height = rcClient.bottom - rcClient.top;
- if (width != pContainer->oldDCSize.cx || height != pContainer->oldDCSize.cy) {
- CSkinItem *sbaritem = &SkinItems[ID_EXTBKSTATUSBAR];
- BOOL statusBarSkinnd = !(pContainer->dwFlags & CNT_NOSTATUSBAR) && !sbaritem->IGNORED;
- LONG sbarDelta = statusBarSkinnd ? pContainer->statusBarHeight : 0;
-
- pContainer->oldDCSize.cx = width;
- pContainer->oldDCSize.cy = height;
-
- if (pContainer->cachedDC) {
- SelectObject(pContainer->cachedDC, pContainer->oldHBM);
- DeleteObject(pContainer->cachedHBM);
- DeleteDC(pContainer->cachedDC);
- }
- pContainer->cachedDC = CreateCompatibleDC(hdcReal);
- pContainer->cachedHBM = CreateCompatibleBitmap(hdcReal, width, height);
- pContainer->oldHBM = (HBITMAP)SelectObject(pContainer->cachedDC, pContainer->cachedHBM);
+ case WM_NCCALCSIZE:
+ if (!CSkin::m_frameSkins)
+ break;
- hdc = pContainer->cachedDC;
+ if (wParam) {
+ RECT *rc;
+ NCCALCSIZE_PARAMS *ncsp = (NCCALCSIZE_PARAMS *)lParam;
- if (!CSkin::DrawItem(hdc, &rcClient, item))
- FillRect(hdc, &rcClient, GetSysColorBrush(COLOR_3DFACE));
+ DefWindowProc(hwndDlg, msg, wParam, lParam);
+ rc = &ncsp->rgrc[0];
- if (sbarDelta) {
- rcClient.top = rcClient.bottom - sbarDelta;
- CSkin::DrawItem(hdc, &rcClient, sbaritem);
- }
- }
- BitBlt(hdcReal, 0, 0, width, height, pContainer->cachedDC, 0, 0, SRCCOPY);
- EndPaint(hwndDlg, &ps);
- return 0;
+ rc->left += CSkin::m_realSkinnedFrame_left;
+ rc->right -= CSkin::m_realSkinnedFrame_right;
+ rc->bottom -= CSkin::m_realSkinnedFrame_bottom;
+ rc->top += CSkin::m_realSkinnedFrame_caption;
+ return TRUE;
}
- case WM_NCLBUTTONDOWN:
- case WM_NCLBUTTONUP:
- case WM_NCMOUSEHOVER:
- case WM_NCMOUSEMOVE:
- if (pContainer && CSkin::m_frameSkins) {
- POINT pt;
- RECT rcWindow;
- BOOL isMin, isMax, isClose;
- int i;
- GetCursorPos(&pt);
- GetWindowRect(hwndDlg, &rcWindow);
+ return DefWindowProc(hwndDlg, msg, wParam, lParam);
- CopyMemory(&pContainer->oldbuttons[0], &pContainer->buttons[0], sizeof(struct TitleBtn) * 3);
- ZeroMemory(&pContainer->buttons[0], sizeof(struct TitleBtn) * 3);
- isMin = isMax = isClose = FALSE;
-
- if (pt.x >= (rcWindow.left + pContainer->rcMin.left) && pt.x <= (rcWindow.left + pContainer->rcClose.right) && pt.y < rcWindow.top + 24 && wParam != HTTOPRIGHT) {
- LRESULT result = 0; //DefWindowProc(hwndDlg, msg, wParam, lParam);
- HDC hdc = GetWindowDC(hwndDlg);
- LONG left = rcWindow.left;
-
- pt.y = 10;
- isMin = pt.x >= left + pContainer->rcMin.left && pt.x <= left + pContainer->rcMin.right;
- isMax = pt.x >= left + pContainer->rcMax.left && pt.x <= left + pContainer->rcMax.right;
- isClose = pt.x >= left + pContainer->rcClose.left && pt.x <= left + pContainer->rcClose.right;
-
- if (msg == WM_NCMOUSEMOVE) {
- if (isMax)
- pContainer->buttons[BTN_MAX].isHot = TRUE;
- else if (isMin)
- pContainer->buttons[BTN_MIN].isHot = TRUE;
- else if (isClose)
- pContainer->buttons[BTN_CLOSE].isHot = TRUE;
- }
- else if (msg == WM_NCLBUTTONDOWN) {
- if (isMax)
- pContainer->buttons[BTN_MAX].isPressed = TRUE;
- else if (isMin)
- pContainer->buttons[BTN_MIN].isPressed = TRUE;
- else if (isClose)
- pContainer->buttons[BTN_CLOSE].isPressed = TRUE;
- }
- else if (msg == WM_NCLBUTTONUP) {
- if (isMin)
- SendMessage(hwndDlg, WM_SYSCOMMAND, SC_MINIMIZE, 0);
- else if (isMax) {
- if (IsZoomed(hwndDlg))
- PostMessage(hwndDlg, WM_SYSCOMMAND, SC_RESTORE, 0);
- else
- PostMessage(hwndDlg, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
- }
- else if (isClose)
- PostMessage(hwndDlg, WM_SYSCOMMAND, SC_CLOSE, 0);
- }
- for (i=0; i < 3; i++) {
- if (pContainer->buttons[i].isHot != pContainer->oldbuttons[i].isHot) {
- RECT *rc = 0;
- HICON hIcon;
-
- switch (i) {
- case 0:
- rc = &pContainer->rcMin;
- hIcon = CSkin::m_minIcon;
- break;
- case 1:
- rc = &pContainer->rcMax;
- hIcon = CSkin::m_maxIcon;
- break;
- case 2:
- rc = &pContainer->rcClose;
- hIcon = CSkin::m_closeIcon;
- break;
- }
- if (rc) {
- CSkinItem *item = &SkinItems[pContainer->buttons[i].isPressed ? ID_EXTBKTITLEBUTTONPRESSED : (pContainer->buttons[i].isHot ? ID_EXTBKTITLEBUTTONMOUSEOVER : ID_EXTBKTITLEBUTTON)];
- CSkin::DrawItem(hdc, rc, item);
- DrawIconEx(hdc, rc->left + ((rc->right - rc->left) / 2 - 8), rc->top + ((rc->bottom - rc->top) / 2 - 8), hIcon, 16, 16, 0, 0, DI_NORMAL);
- }
- }
- }
- ReleaseDC(hwndDlg, hdc);
- return result;
- }
- else {
- LRESULT result = DefWindowProc(hwndDlg, msg, wParam, lParam);
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_NOCHILDREN);
- return result;
- }
- }
- break;
- case WM_SETCURSOR: {
- if (CSkin::m_frameSkins && (HWND)wParam == hwndDlg) {
- DefWindowProc(hwndDlg, msg, wParam, lParam);
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_NOCHILDREN);
+ case WM_NCACTIVATE:
+ if (pContainer) {
+ pContainer->ncActive = wParam;
+ if (bSkinned && CSkin::m_frameSkins) {
+ SendMessage(hwndDlg, WM_NCPAINT, 0, 0);
return 1;
}
- break;
}
- case WM_NCCALCSIZE: {
- if (!CSkin::m_frameSkins)
- break;
-
- if (wParam) {
- RECT *rc;
- NCCALCSIZE_PARAMS *ncsp = (NCCALCSIZE_PARAMS *)lParam;
-
- DefWindowProc(hwndDlg, msg, wParam, lParam);
- rc = &ncsp->rgrc[0];
-
- rc->left += CSkin::m_realSkinnedFrame_left;
- rc->right -= CSkin::m_realSkinnedFrame_right;
- rc->bottom -= CSkin::m_realSkinnedFrame_bottom;
- rc->top += CSkin::m_realSkinnedFrame_caption;
- return TRUE;
- }
- else {
- return DefWindowProc(hwndDlg, msg, wParam, lParam);
- }
+ break;
+ case WM_SETTEXT:
+ case WM_SETICON: {
+ if (CSkin::m_frameSkins) {
+ DefWindowProc(hwndDlg, msg, wParam, lParam);
+ RedrawWindow(hwndDlg, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN);
+ return 0;
}
- case WM_NCACTIVATE:
- if (pContainer) {
- pContainer->ncActive = wParam;
- if (bSkinned && CSkin::m_frameSkins) {
- SendMessage(hwndDlg, WM_NCPAINT, 0, 0);
- return 1;
- }
- }
+ break;
+ }
+ case WM_NCHITTEST: {
+ RECT r;
+ POINT pt;
+ int k = 0;
+ int clip = CSkin::m_bClipBorder;
+
+ if (!pContainer)
break;
- case WM_SETTEXT:
- case WM_SETICON: {
- if (CSkin::m_frameSkins) {
- DefWindowProc(hwndDlg, msg, wParam, lParam);
- RedrawWindow(hwndDlg, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN);
- return 0;
- }
- break;
- }
- case WM_NCHITTEST: {
- RECT r;
- POINT pt;
- int k = 0;
- int clip = CSkin::m_bClipBorder;
- if (!pContainer)
- break;
+ if (!(pContainer->dwFlags & CNT_NOTITLE))
+ break;
- if (!(pContainer->dwFlags & CNT_NOTITLE))
- break;
+ GetWindowRect(hwndDlg, &r);
+ GetCursorPos(&pt);
+ if (pt.y <= r.bottom && pt.y >= r.bottom - clip - 6) {
+ if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10)
+ return HTBOTTOM;
+ if (pt.x < r.left + clip + 10)
+ return HTBOTTOMLEFT;
+ if (pt.x > r.right - clip - 10)
+ return HTBOTTOMRIGHT;
- GetWindowRect(hwndDlg, &r);
- GetCursorPos(&pt);
- if (pt.y <= r.bottom && pt.y >= r.bottom - clip - 6) {
- if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10)
- return HTBOTTOM;
- if (pt.x < r.left + clip + 10)
- return HTBOTTOMLEFT;
- if (pt.x > r.right - clip - 10)
- return HTBOTTOMRIGHT;
-
- }
- else if (pt.y >= r.top && pt.y <= r.top + 6) {
- if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10)
- return HTTOP;
- if (pt.x < r.left + clip + 10)
- return HTTOPLEFT;
- if (pt.x > r.right - clip - 10)
- return HTTOPRIGHT;
- }
- else if (pt.x >= r.left && pt.x <= r.left + clip + 6)
- return HTLEFT;
- else if (pt.x >= r.right - clip - 6 && pt.x <= r.right)
- return HTRIGHT;
-
- return(DefWindowProc(hwndDlg, WM_NCHITTEST, wParam, lParam));
}
- case 0xae: // must be some undocumented message - seems it messes with the title bar...
- if (CSkin::m_frameSkins)
- return 0;
- default:
- break;
+ else if (pt.y >= r.top && pt.y <= r.top + 6) {
+ if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10)
+ return HTTOP;
+ if (pt.x < r.left + clip + 10)
+ return HTTOPLEFT;
+ if (pt.x > r.right - clip - 10)
+ return HTTOPRIGHT;
+ }
+ else if (pt.x >= r.left && pt.x <= r.left + clip + 6)
+ return HTLEFT;
+ else if (pt.x >= r.right - clip - 6 && pt.x <= r.right)
+ return HTRIGHT;
+
+ return(DefWindowProc(hwndDlg, WM_NCHITTEST, wParam, lParam));
+ }
+ case 0xae: // must be some undocumented message - seems it messes with the title bar...
+ if (CSkin::m_frameSkins)
+ return 0;
}
- return CallWindowProc(OldContainerWndProc, hwndDlg, msg, wParam, lParam);
+ return mir_callNextSubclass(hwndDlg, ContainerWndProc, msg, wParam, lParam);
}
+
/*
* container window procedure...
*/
@@ -588,8 +584,6 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, fHaveTipper = ServiceExists("mToolTip/ShowTip");
fForceOverlayIcons = M->GetByte("forceTaskBarStatusOverlays", 0) ? true : false;
- OldContainerWndProc = (WNDPROC)SetWindowLongPtr(hwndDlg, GWLP_WNDPROC, (LONG_PTR)ContainerWndProc);
-
pContainer = (struct TContainerData *) lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pContainer);
@@ -2055,7 +2049,6 @@ buttons_done: DeleteObject(pContainer->hbmToolbarBG);
DeleteDC(pContainer->cachedToolbarDC);
}
- SetWindowLongPtr(hwndDlg, GWLP_WNDPROC, (LONG_PTR)OldContainerWndProc);
return 0;
}
@@ -2069,6 +2062,7 @@ buttons_done: }
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
break;
+
case WM_CLOSE: {
//mad
if (PluginConfig.m_HideOnClose && !lParam) {
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index 7dd0e4a4dd..e68961c72e 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -33,17 +33,17 @@ */
#include "commonheaders.h"
-static WNDPROC OldStatusBarproc = 0;
+static WNDPROC OldStatusBarproc = 0;
-extern int status_icon_list_size;
-extern TStatusBarIconNode *status_icon_list;
+extern int status_icon_list_size;
+extern TStatusBarIconNode *status_icon_list;
-bool CMenuBar::m_buttonsInit = false;
-HHOOK CMenuBar::m_hHook = 0;
-TBBUTTON CMenuBar::m_TbButtons[8] = {0};
-CMenuBar* CMenuBar::m_Owner = 0;
-HBITMAP CMenuBar::m_MimIcon = 0;
-int CMenuBar::m_MimIconRefCount = 0;
+bool CMenuBar::m_buttonsInit = false;
+HHOOK CMenuBar::m_hHook = 0;
+TBBUTTON CMenuBar::m_TbButtons[8] = {0};
+CMenuBar *CMenuBar::m_Owner = 0;
+HBITMAP CMenuBar::m_MimIcon = 0;
+int CMenuBar::m_MimIconRefCount = 0;
static int resetLP(WPARAM, LPARAM, LPARAM obj)
{
@@ -89,14 +89,12 @@ CMenuBar::CMenuBar(HWND hwndParent, const TContainerData *pContainer) m_isContactMenu = m_isMainMenu = false;
m_hevHook = HookEventParam(ME_LANGPACK_CHANGED, &::resetLP, (LPARAM)this);
- m_oldWndProc = (WNDPROC)::GetWindowLongPtr(m_hwndToolbar, GWLP_WNDPROC);
::SetWindowLongPtr(m_hwndToolbar, GWLP_USERDATA, (UINT_PTR)this);
- ::SetWindowLongPtr(m_hwndToolbar, GWLP_WNDPROC, (UINT_PTR)wndProc);
+ mir_subclassWindow(m_hwndToolbar, wndProc);
}
CMenuBar::~CMenuBar()
{
- ::SetWindowLongPtr(m_hwndToolbar, GWLP_WNDPROC, (UINT_PTR)m_oldWndProc);
::SetWindowLongPtr(m_hwndToolbar, GWLP_USERDATA, 0);
::DestroyWindow(m_hwndToolbar);
::UnhookEvent(m_hevHook);
@@ -161,20 +159,20 @@ LONG_PTR CMenuBar::processMsg(const UINT msg, const WPARAM wParam, const LPARAM if (msg == WM_NOTIFY) {
NMHDR* pNMHDR = (NMHDR*)lParam;
switch(pNMHDR->code) {
- case NM_CUSTOMDRAW: {
+ case NM_CUSTOMDRAW:
+ {
NMCUSTOMDRAW *nm = (NMCUSTOMDRAW*)lParam;
- return(customDrawWorker(nm));
+ return customDrawWorker(nm);
}
- case TBN_DROPDOWN: {
+ case TBN_DROPDOWN:
+ {
NMTOOLBAR *mtb = (NMTOOLBAR *)lParam;
-
- LRESULT result = Handle(mtb);
- return(result);
+ return Handle(mtb);
}
- case TBN_HOTITEMCHANGE: {
+ case TBN_HOTITEMCHANGE:
+ {
NMTBHOTITEM *nmtb = (NMTBHOTITEM *)lParam;
-
if (nmtb->idNew != 0 && m_fTracking && nmtb->idNew != m_activeID && m_activeID != 0) {
cancel(0);
return 0;
@@ -185,14 +183,14 @@ LONG_PTR CMenuBar::processMsg(const UINT msg, const WPARAM wParam, const LPARAM }
break;
}
- default:
- return(-1);
+
+ default:
+ return -1;
}
}
else if (msg == WM_LBUTTONDOWN) {
if (m_pContainer->dwFlags & CNT_NOTITLE) {
POINT pt;
-
::GetCursorPos(&pt);
return ::SendMessage(m_pContainer->hwnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y));
}
@@ -210,17 +208,14 @@ LRESULT CALLBACK CMenuBar::wndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP CMenuBar *menuBar = reinterpret_cast<CMenuBar *>(::GetWindowLongPtr(hWnd, GWLP_USERDATA));
switch(msg) {
- case WM_SYSKEYUP: {
- if (wParam == VK_MENU) {
- menuBar->Cancel();
- return 0;
- }
- break;
+ case WM_SYSKEYUP:
+ if (wParam == VK_MENU) {
+ menuBar->Cancel();
+ return 0;
}
- default:
- break;
+ break;
}
- return(::CallWindowProc(menuBar->m_oldWndProc, hWnd, msg, wParam, lParam));
+ return ::mir_callNextSubclass(hWnd, CMenuBar::wndProc, msg, wParam, lParam);
}
/**
@@ -331,13 +326,13 @@ LONG_PTR CMenuBar::customDrawWorker(NMCUSTOMDRAW *nm) (PluginConfig.m_fillColor ? PluginConfig.m_genericTxtColor :
(uState & (CDIS_SELECTED | CDIS_HOT | CDIS_MARKED)) ? ::GetSysColor(COLOR_HIGHLIGHTTEXT) : ::GetSysColor(COLOR_BTNTEXT));
- ::SetBkMode(m_hdcDraw, TRANSPARENT);
- CSkin::RenderText(m_hdcDraw, m_hTheme, szText, &nmtb->nmcd.rc, DT_SINGLELINE | DT_VCENTER | DT_CENTER, CSkin::m_glowSize, clr);
+ ::SetBkMode(m_hdcDraw, TRANSPARENT);
+ CSkin::RenderText(m_hdcDraw, m_hTheme, szText, &nmtb->nmcd.rc, DT_SINGLELINE | DT_VCENTER | DT_CENTER, CSkin::m_glowSize, clr);
}
if (iIndex == 0)
::DrawIconEx(m_hdcDraw, (nmtb->nmcd.rc.left + nmtb->nmcd.rc.right) / 2 - 8,
- (nmtb->nmcd.rc.top + nmtb->nmcd.rc.bottom) / 2 - 8, LoadSkinnedIcon(SKINICON_OTHER_MIRANDA),
- 16, 16, 0, 0, DI_NORMAL);
+ (nmtb->nmcd.rc.top + nmtb->nmcd.rc.bottom) / 2 - 8, LoadSkinnedIcon(SKINICON_OTHER_MIRANDA),
+ 16, 16, 0, 0, DI_NORMAL);
return(CDRF_SKIPDEFAULT);
}
@@ -721,13 +716,14 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR OldStatusBarproc = wc.lpfnWndProc;
}
switch (msg) {
- case WM_CREATE: {
+ case WM_CREATE:
+ {
CREATESTRUCT *cs = (CREATESTRUCT *)lParam;
LRESULT ret;
HWND hwndParent = GetParent(hWnd);
/*
- * dirty trick to get rid of that annoying sizing gripper
- */
+ * dirty trick to get rid of that annoying sizing gripper
+ */
SetWindowLongPtr(hwndParent, GWL_STYLE, GetWindowLongPtr(hwndParent, GWL_STYLE) & ~WS_THICKFRAME);
SetWindowLongPtr(hwndParent, GWL_EXSTYLE, GetWindowLongPtr(hwndParent, GWL_EXSTYLE) & ~WS_EX_APPWINDOW);
cs->style &= ~SBARS_SIZEGRIP;
@@ -737,7 +733,8 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR return ret;
}
- case WM_NCHITTEST: {
+ case WM_NCHITTEST:
+ {
RECT r;
POINT pt;
LRESULT lr = SendMessage(GetParent(hWnd), WM_NCHITTEST, wParam, lParam);
@@ -750,15 +747,16 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR return HTBOTTOMRIGHT;
}
if (lr == HTLEFT || lr == HTRIGHT || lr == HTBOTTOM || lr == HTTOP || lr == HTTOPLEFT || lr == HTTOPRIGHT
- || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT)
+ || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT)
return HTTRANSPARENT;
- break;
}
+ break;
- case WM_ERASEBKGND:
- return 1;
+ case WM_ERASEBKGND:
+ return 1;
- case WM_PAINT: {
+ case WM_PAINT:
+ {
PAINTSTRUCT ps;
TCHAR szText[1024];
int i;
@@ -825,8 +823,8 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR itemRect.left += 2;
/*
- * draw visual message length indicator in the leftmost status bar field
- */
+ * draw visual message length indicator in the leftmost status bar field
+ */
if (PluginConfig.m_visualMessageSizeIndicator && i == 0) {
@@ -894,7 +892,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR }
itemRect.left += 20;
CSkin::RenderText(hdcMem, hTheme, szText, &itemRect, DT_VCENTER | DT_END_ELLIPSIS | DT_SINGLELINE | DT_NOPREFIX,
- CSkin::m_glowSize, clr);
+ CSkin::m_glowSize, clr);
}
else
DrawIconEx(hdcMem, itemRect.left + 3, (height / 2 - 8) + itemRect.top, hIcon, 16, 16, 0, 0, DI_NORMAL);
@@ -903,7 +901,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR itemRect.left += 2;
itemRect.right -= 2;
CSkin::RenderText(hdcMem, hTheme, szText, &itemRect, DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS | DT_NOPREFIX,
- CSkin::m_glowSize, clr);
+ CSkin::m_glowSize, clr);
}
}
}
@@ -921,14 +919,15 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR CMimAPI::m_pfnCloseThemeData(hTheme);
EndPaint(hWnd, &ps);
- return 0;
}
+ return 0;
- /*
- * tell status bar to update the part layout (re-calculate part widths)
- * needed when an icon is added to or removed from the icon area
- */
- case WM_USER + 101: {
+ /*
+ * tell status bar to update the part layout (re-calculate part widths)
+ * needed when an icon is added to or removed from the icon area
+ */
+ case WM_USER + 101:
+ {
struct TWindowData *dat = (struct TWindowData *)lParam;
RECT rcs;
int statwidths[5];
@@ -966,17 +965,18 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR statwidths[1] = (rcs.right - rcs.left) - (62 + ((list_icons) * (PluginConfig.m_smcxicon + 2)));
statwidths[2] = -1;
SendMessage(hWnd, SB_SETPARTS, 3, (LPARAM) statwidths);
- return 0;
}
+ return 0;
- case WM_SETCURSOR: {
+ case WM_SETCURSOR:
+ {
POINT pt;
GetCursorPos(&pt);
SendMessage(GetParent(hWnd), msg, wParam, lParam);
- if (pt.x == ptMouse.x && pt.y == ptMouse.y) {
+ if (pt.x == ptMouse.x && pt.y == ptMouse.y)
return 1;
- }
+
ptMouse = pt;
if (tooltip_active) {
KillTimer(hWnd, TIMERID_HOVER);
@@ -985,11 +985,12 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR }
KillTimer(hWnd, TIMERID_HOVER);
SetTimer(hWnd, TIMERID_HOVER, 450, 0);
- break;
}
+ break;
- case WM_LBUTTONDOWN:
- case WM_RBUTTONDOWN: {
+ case WM_LBUTTONDOWN:
+ case WM_RBUTTONDOWN:
+ {
POINT pt;
KillTimer(hWnd, TIMERID_HOVER);
@@ -1010,148 +1011,147 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR if (!PtInRect(&rcIconpart, pt1))
return SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y));
}
- break;
}
+ break;
- case WM_TIMER:
- if (wParam == TIMERID_HOVER) {
- POINT pt;
- char *szTTService = "mToolTip/ShowTipW";
- CLCINFOTIP ti = {0};
- ti.cbSize = sizeof(ti);
+ case WM_TIMER:
+ if (wParam == TIMERID_HOVER) {
+ POINT pt;
+ char *szTTService = "mToolTip/ShowTipW";
+ CLCINFOTIP ti = {0};
+ ti.cbSize = sizeof(ti);
- KillTimer(hWnd, TIMERID_HOVER);
- GetCursorPos(&pt);
- if (pt.x == ptMouse.x && pt.y == ptMouse.y) {
- RECT rc;
- struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
-//mad
- SIZE size;
- TCHAR szStatusBarText[512];
-//mad_
- ti.ptCursor = pt;
- ScreenToClient(hWnd, &pt);
- SendMessage(hWnd, SB_GETRECT, 2, (LPARAM)&rc);
- if (dat && PtInRect(&rc, pt)) {
- int gap = 2;
- TStatusBarIconNode *current = status_icon_list;
- TStatusBarIconNode *clicked = NULL;
- TStatusBarIconNode *currentSIN = NULL;
-
- unsigned int iconNum = (pt.x - rc.left) / (PluginConfig.m_smcxicon + gap);
- unsigned int list_icons = 0;
- char buff[100];
- DWORD flags;
-
- while (current) {
- if (current->sid.flags&MBF_OWNERSTATE&&dat->pSINod){
- TStatusBarIconNode *currentSIN = dat->pSINod;
- flags=current->sid.flags;
- while (currentSIN) {
- if (strcmp(currentSIN->sid.szModule, current->sid.szModule) == 0 && currentSIN->sid.dwId == current->sid.dwId) {
- flags=currentSIN->sid.flags;
- break;
- }
- currentSIN = currentSIN->next;
+ KillTimer(hWnd, TIMERID_HOVER);
+ GetCursorPos(&pt);
+ if (pt.x == ptMouse.x && pt.y == ptMouse.y) {
+ RECT rc;
+ struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ //mad
+ SIZE size;
+ TCHAR szStatusBarText[512];
+ //mad_
+ ti.ptCursor = pt;
+ ScreenToClient(hWnd, &pt);
+ SendMessage(hWnd, SB_GETRECT, 2, (LPARAM)&rc);
+ if (dat && PtInRect(&rc, pt)) {
+ int gap = 2;
+ TStatusBarIconNode *current = status_icon_list;
+ TStatusBarIconNode *clicked = NULL;
+ TStatusBarIconNode *currentSIN = NULL;
+
+ unsigned int iconNum = (pt.x - rc.left) / (PluginConfig.m_smcxicon + gap);
+ unsigned int list_icons = 0;
+ char buff[100];
+ DWORD flags;
+
+ while (current) {
+ if (current->sid.flags&MBF_OWNERSTATE&&dat->pSINod){
+ TStatusBarIconNode *currentSIN = dat->pSINod;
+ flags=current->sid.flags;
+ while (currentSIN) {
+ if (strcmp(currentSIN->sid.szModule, current->sid.szModule) == 0 && currentSIN->sid.dwId == current->sid.dwId) {
+ flags=currentSIN->sid.flags;
+ break;
}
+ currentSIN = currentSIN->next;
}
- else {
- sprintf(buff, "SRMMStatusIconFlags%d", (int)current->sid.dwId);
- flags = M->GetByte(dat->hContact, current->sid.szModule, buff, current->sid.flags);
- }
- if (!(flags & MBF_HIDDEN)) {
- if (list_icons++ == iconNum)
- clicked = current;
- }
- current = current->next;
}
-
- if (clicked&&clicked->sid.flags&MBF_OWNERSTATE) {
- currentSIN=dat->pSINod;
- while (currentSIN) {
- if (strcmp(currentSIN->sid.szModule, clicked->sid.szModule) == 0 && currentSIN->sid.dwId == clicked->sid.dwId) {
- clicked=currentSIN;
- break;
- }
- currentSIN = currentSIN->next;
- }
- }
-
- if ((int)iconNum == list_icons && pContainer) {
- TCHAR wBuf[512];
-
- mir_sntprintf(wBuf, safe_sizeof(wBuf), TranslateT("Sounds are %s. Click to toggle status, hold SHIFT and click to set for all open containers"),
- pContainer->dwFlags & CNT_NOSOUND ? TranslateT("disabled") : TranslateT("enabled"));
- CallService(szTTService, (WPARAM)wBuf, (LPARAM)&ti);
- tooltip_active = TRUE;
+ else {
+ sprintf(buff, "SRMMStatusIconFlags%d", (int)current->sid.dwId);
+ flags = M->GetByte(dat->hContact, current->sid.szModule, buff, current->sid.flags);
}
- else if ((int)iconNum == list_icons + 1 && dat && dat->bType == SESSIONTYPE_IM) {
- int mtnStatus = (int)M->GetByte(dat->hContact, SRMSGMOD, SRMSGSET_TYPING, M->GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW));
- TCHAR wBuf[512];
-
- mir_sntprintf(wBuf, safe_sizeof(wBuf), TranslateT("Sending typing notifications is %s."),
- mtnStatus ? TranslateT("enabled") : TranslateT("disabled"));
- CallService(szTTService, (WPARAM)wBuf, (LPARAM)&ti);
- tooltip_active = TRUE;
+ if (!(flags & MBF_HIDDEN)) {
+ if (list_icons++ == iconNum)
+ clicked = current;
}
- else if ((int)iconNum == list_icons + 2) {
- TCHAR wBuf[512];
-
- mir_sntprintf(wBuf, safe_sizeof(wBuf), _T("%s"), TranslateT("Session list.\nClick left for a list of open sessions.\nClick right to access favorites and quickly configure message window behavior"));
+ current = current->next;
+ }
- CallService(szTTService, (WPARAM)wBuf, (LPARAM)&ti);
- tooltip_active = TRUE;
- }
- else {
- if (clicked) {
- CallService("mToolTip/ShowTip", (WPARAM)clicked->sid.szTooltip, (LPARAM)&ti);
- tooltip_active = TRUE;
+ if (clicked&&clicked->sid.flags&MBF_OWNERSTATE) {
+ currentSIN=dat->pSINod;
+ while (currentSIN) {
+ if (strcmp(currentSIN->sid.szModule, clicked->sid.szModule) == 0 && currentSIN->sid.dwId == clicked->sid.dwId) {
+ clicked=currentSIN;
+ break;
}
+ currentSIN = currentSIN->next;
}
}
- SendMessage(hWnd, SB_GETRECT, 1, (LPARAM)&rc);
- if (dat && PtInRect(&rc, pt)) {
- int iLength = 0;
- GETTEXTLENGTHEX gtxl = {0};
- int iQueued = M->GetDword(dat->hContact, "SendLater", "count", 0);
- gtxl.codepage = CP_UTF8;
- gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMBYTES;
- iLength = SendDlgItemMessage(dat->hwnd, dat->bType == SESSIONTYPE_IM ? IDC_MESSAGE : IDC_CHAT_MESSAGE, EM_GETTEXTLENGTHEX, (WPARAM) & gtxl, 0);
- tooltip_active = TRUE;
+ if ((int)iconNum == list_icons && pContainer) {
TCHAR wBuf[512];
- const TCHAR *szFormat = TranslateT("There are %d pending send jobs. Message length: %d bytes, message length limit: %d bytes\n\n%d messages are queued for later delivery");
- mir_sntprintf(wBuf, safe_sizeof(wBuf), szFormat, dat->iOpenJobs, iLength, dat->nMax ? dat->nMax : 20000, iQueued);
+ mir_sntprintf(wBuf, safe_sizeof(wBuf), TranslateT("Sounds are %s. Click to toggle status, hold SHIFT and click to set for all open containers"),
+ pContainer->dwFlags & CNT_NOSOUND ? TranslateT("disabled") : TranslateT("enabled"));
CallService(szTTService, (WPARAM)wBuf, (LPARAM)&ti);
+ tooltip_active = TRUE;
}
- //MAD
- if (SendMessage(dat->pContainer->hwndStatus, SB_GETTEXT, 0, (LPARAM)szStatusBarText)) {
- HDC hdc;
- int iLen=SendMessage(dat->pContainer->hwndStatus,SB_GETTEXTLENGTH,0,0);
- SendMessage(hWnd, SB_GETRECT, 0, (LPARAM)&rc);
- GetTextExtentPoint32( hdc=GetDC( dat->pContainer->hwndStatus), szStatusBarText, iLen, &size );
- ReleaseDC (dat->pContainer->hwndStatus,hdc);
+ else if ((int)iconNum == list_icons + 1 && dat && dat->bType == SESSIONTYPE_IM) {
+ int mtnStatus = (int)M->GetByte(dat->hContact, SRMSGMOD, SRMSGSET_TYPING, M->GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW));
+ TCHAR wBuf[512];
- if (dat && PtInRect(&rc,pt)&&((rc.right-rc.left)<size.cx)) {
- DBVARIANT dbv={0};
+ mir_sntprintf(wBuf, safe_sizeof(wBuf), TranslateT("Sending typing notifications is %s."),
+ mtnStatus ? TranslateT("enabled") : TranslateT("disabled"));
+ CallService(szTTService, (WPARAM)wBuf, (LPARAM)&ti);
+ tooltip_active = TRUE;
+ }
+ else if ((int)iconNum == list_icons + 2) {
+ TCHAR wBuf[512];
- if (dat->bType == SESSIONTYPE_CHAT)
- M->GetTString(dat->hContact,dat->szProto,"Topic",&dbv);
+ mir_sntprintf(wBuf, safe_sizeof(wBuf), _T("%s"), TranslateT("Session list.\nClick left for a list of open sessions.\nClick right to access favorites and quickly configure message window behavior"));
+ CallService(szTTService, (WPARAM)wBuf, (LPARAM)&ti);
+ tooltip_active = TRUE;
+ }
+ else {
+ if (clicked) {
+ CallService("mToolTip/ShowTip", (WPARAM)clicked->sid.szTooltip, (LPARAM)&ti);
tooltip_active = TRUE;
- CallService(szTTService, (WPARAM)dbv.ptszVal, (LPARAM)&ti);
- if (dbv.pszVal)
- DBFreeVariant(&dbv);
}
}
- // MAD_
+ }
+ SendMessage(hWnd, SB_GETRECT, 1, (LPARAM)&rc);
+ if (dat && PtInRect(&rc, pt)) {
+ int iLength = 0;
+ GETTEXTLENGTHEX gtxl = {0};
+ int iQueued = M->GetDword(dat->hContact, "SendLater", "count", 0);
+ gtxl.codepage = CP_UTF8;
+ gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMBYTES;
+ iLength = SendDlgItemMessage(dat->hwnd, dat->bType == SESSIONTYPE_IM ? IDC_MESSAGE : IDC_CHAT_MESSAGE, EM_GETTEXTLENGTHEX, (WPARAM) & gtxl, 0);
+ tooltip_active = TRUE;
+
+ TCHAR wBuf[512];
+ const TCHAR *szFormat = TranslateT("There are %d pending send jobs. Message length: %d bytes, message length limit: %d bytes\n\n%d messages are queued for later delivery");
+
+ mir_sntprintf(wBuf, safe_sizeof(wBuf), szFormat, dat->iOpenJobs, iLength, dat->nMax ? dat->nMax : 20000, iQueued);
+ CallService(szTTService, (WPARAM)wBuf, (LPARAM)&ti);
+ }
+ //MAD
+ if (SendMessage(dat->pContainer->hwndStatus, SB_GETTEXT, 0, (LPARAM)szStatusBarText)) {
+ HDC hdc;
+ int iLen=SendMessage(dat->pContainer->hwndStatus,SB_GETTEXTLENGTH,0,0);
+ SendMessage(hWnd, SB_GETRECT, 0, (LPARAM)&rc);
+ GetTextExtentPoint32( hdc=GetDC( dat->pContainer->hwndStatus), szStatusBarText, iLen, &size );
+ ReleaseDC (dat->pContainer->hwndStatus,hdc);
+
+ if (dat && PtInRect(&rc,pt)&&((rc.right-rc.left)<size.cx)) {
+ DBVARIANT dbv={0};
+
+ if (dat->bType == SESSIONTYPE_CHAT)
+ M->GetTString(dat->hContact,dat->szProto,"Topic",&dbv);
+
+ tooltip_active = TRUE;
+ CallService(szTTService, (WPARAM)dbv.ptszVal, (LPARAM)&ti);
+ if (dbv.pszVal)
+ DBFreeVariant(&dbv);
+ }
}
}
- break;
+ }
+ break;
- case WM_DESTROY:
- KillTimer(hWnd, TIMERID_HOVER);
+ case WM_DESTROY:
+ KillTimer(hWnd, TIMERID_HOVER);
}
return CallWindowProc(OldStatusBarproc, hWnd, msg, wParam, lParam);
}
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 5472031de8..90c8d5dd04 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -1283,7 +1283,7 @@ LRESULT TSAPI DM_SaveLocale(TWindowData *dat, WPARAM wParam, LPARAM lParam) LRESULT TSAPI DM_WMCopyHandler(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam)
{
- LRESULT result = CallWindowProc(oldWndProc, hwnd, WM_COPY, wParam, lParam);
+ LRESULT result = mir_callNextSubclass(hwnd, oldWndProc, WM_COPY, wParam, lParam);
if (OpenClipboard(hwnd)) {
HANDLE hClip = GetClipboardData(CF_UNICODETEXT);
diff --git a/plugins/TabSRMM/src/include/controls.h b/plugins/TabSRMM/src/include/controls.h index 7c2560afe8..ac4c0a3374 100644 --- a/plugins/TabSRMM/src/include/controls.h +++ b/plugins/TabSRMM/src/include/controls.h @@ -108,7 +108,6 @@ private: bool m_isAero;
bool m_mustAutoHide;
LONG m_size_y;
- WNDPROC m_oldWndProc;
HANDLE m_hevHook;
/*
* for custom drawing
diff --git a/plugins/TabSRMM/src/include/infopanel.h b/plugins/TabSRMM/src/include/infopanel.h index f7513b8930..a7c64e469a 100644 --- a/plugins/TabSRMM/src/include/infopanel.h +++ b/plugins/TabSRMM/src/include/infopanel.h @@ -90,7 +90,7 @@ private: INT_PTR CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK WndProcStub(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK RichEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static LRESULT CALLBACK RichEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
HWND m_hwnd; // our window handle
HWND m_hRich; // handle of the rich edit child
@@ -104,9 +104,6 @@ private: int m_leftWidth;
const CInfoPanel *m_panel; // the info panel parent (if any)
-
-private:
- static WNDPROC m_OldMessageEditProc; // stores original richedit wnd proc
};
/**
@@ -182,7 +179,7 @@ public: public:
static TInfoPanelConfig m_ipConfig;
static int setPanelHandler(TWindowData *dat, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK avatarParentSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static LRESULT CALLBACK avatarParentSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
private:
void mapRealRect(const RECT& rcSrc, RECT& rcDest, const SIZE& sz);
diff --git a/plugins/TabSRMM/src/include/msgs.h b/plugins/TabSRMM/src/include/msgs.h index 3e95b494c0..13f64e33e2 100644 --- a/plugins/TabSRMM/src/include/msgs.h +++ b/plugins/TabSRMM/src/include/msgs.h @@ -346,7 +346,6 @@ struct TWindowData int nMax; // max message size
int textLen; // current text len
LONG ipFieldHeight;
- WNDPROC oldIEViewProc;
BOOL clr_added;
BOOL fIsReattach;
WPARAM wParam; // used for "delayed" actions like moved splitters in minimized windows
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index d90b48d121..7af941f3bb 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -43,7 +43,6 @@ TCHAR *xStatusDescr[] = { _T("Angry"), _T("Duck"), _T("Tired"), _T("Party"), _T( TInfoPanelConfig CInfoPanel::m_ipConfig = {0};
-WNDPROC CTip::m_OldMessageEditProc = 0;
int CInfoPanel::setPanelHandler(TWindowData *dat, WPARAM wParam, LPARAM lParam)
{
@@ -1021,7 +1020,7 @@ void CInfoPanel::hideTip(const HWND hwndNew) * native avatar rendering does not support animated images.
* To avoid clipping issues, this is done during WM_ERASEBKGND.
*/
-INT_PTR CALLBACK CInfoPanel::avatarParentSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK CInfoPanel::avatarParentSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
case WM_ERASEBKGND:
@@ -1407,7 +1406,7 @@ CTip::CTip(const HWND hwndParent, const HANDLE hContact, const TCHAR *pszText, c m_pszText = 0;
m_panel = panel;
m_hwndParent = hwndParent;
- m_OldMessageEditProc = (WNDPROC)SetWindowLongPtr(m_hRich, GWLP_WNDPROC, (LONG_PTR)RichEditProc);
+ mir_subclassWindow(m_hRich, RichEditProc);
}
/**
@@ -1518,26 +1517,26 @@ void CTip::registerClass() * subclass the rich edit control inside the tip. Needed to hide the blinking
* caret and prevent all scrolling actions.
*/
-INT_PTR CALLBACK CTip::RichEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK CTip::RichEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
- case WM_SETCURSOR:
- ::HideCaret(hwnd);
- break;
+ case WM_SETCURSOR:
+ ::HideCaret(hwnd);
+ break;
- case WM_ERASEBKGND:
- return 1;
+ case WM_ERASEBKGND:
+ return 1;
- case WM_NCCALCSIZE:
- SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~WS_VSCROLL);
- EnableScrollBar(hwnd, SB_VERT, ESB_DISABLE_BOTH);
- ShowScrollBar(hwnd, SB_VERT, FALSE);
- break;
+ case WM_NCCALCSIZE:
+ SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~WS_VSCROLL);
+ EnableScrollBar(hwnd, SB_VERT, ESB_DISABLE_BOTH);
+ ShowScrollBar(hwnd, SB_VERT, FALSE);
+ break;
- case WM_VSCROLL:
- return 0;
+ case WM_VSCROLL:
+ return 0;
}
- return(::CallWindowProc(m_OldMessageEditProc, hwnd, msg, wParam, lParam));
+ return ::mir_callNextSubclass(hwnd, CTip::RichEditProc, msg, wParam, lParam);
}
/**
@@ -1568,21 +1567,22 @@ INT_PTR CALLBACK CTip::WndProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP INT_PTR CALLBACK CTip::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
- case WM_ACTIVATE:
- case WM_SETCURSOR:
- ::KillTimer(hwnd, 1000);
- ::SetTimer(hwnd, 1000, 200, 0);
+ case WM_ACTIVATE:
+ case WM_SETCURSOR:
+ ::KillTimer(hwnd, 1000);
+ ::SetTimer(hwnd, 1000, 200, 0);
- if (msg == WM_ACTIVATE && LOWORD(wParam) == WA_INACTIVE)
- ::DestroyWindow(hwnd);
- break;
+ if (msg == WM_ACTIVATE && LOWORD(wParam) == WA_INACTIVE)
+ ::DestroyWindow(hwnd);
+ break;
- /* prevent resizing */
- case WM_NCHITTEST:
- return(HTCLIENT);
- break;
+ /* prevent resizing */
+ case WM_NCHITTEST:
+ return(HTCLIENT);
+ break;
- case WM_ERASEBKGND: {
+ case WM_ERASEBKGND:
+ {
HDC hdc = (HDC) wParam;
RECT rc;
TCHAR szTitle[128];
@@ -1602,7 +1602,6 @@ INT_PTR CALLBACK CTip::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam HBITMAP hbmOld = reinterpret_cast<HBITMAP>(::SelectObject(hdcMem, hbm));
HFONT hOldFont = reinterpret_cast<HFONT>(::SelectObject(hdcMem, CInfoPanel::m_ipConfig.hFonts[IPFONTID_NICK]));
-
::SetBkMode(hdcMem, TRANSPARENT);
rc.bottom += 2;
rc.left -= 4;rc.right += 4;
@@ -1623,7 +1622,7 @@ INT_PTR CALLBACK CTip::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam else {
::FillRect(hdcMem, &rc, br);
::DrawAlpha(hdcMem, &rcText, PluginConfig.m_ipBackgroundGradientHigh, 100, PluginConfig.m_ipBackgroundGradient,
- 0, GRADIENT_TB + 1, 0, 2, 0);
+ 0, GRADIENT_TB + 1, 0, 2, 0);
}
::DeleteObject(br);
rcText.left = 20;
@@ -1650,64 +1649,56 @@ INT_PTR CALLBACK CTip::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ::DeleteObject(hbm);
::DeleteDC(hdcMem);
}
- return 1;
}
-
- case WM_NOTIFY: {
- switch (((NMHDR *) lParam)->code) {
- case EN_LINK:
- ::SetFocus(m_hRich);
- switch (((ENLINK *) lParam)->msg) {
- case WM_LBUTTONUP: {
- ENLINK* e = reinterpret_cast<ENLINK *>(lParam);
-
- const TCHAR* tszUrl = Utils::extractURLFromRichEdit(e, m_hRich);
- if (tszUrl) {
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM)tszUrl);
- mir_free(const_cast<TCHAR *>(tszUrl));
- }
- ::DestroyWindow(hwnd);
- break;
- }
+ return 1;
+
+ case WM_NOTIFY:
+ switch (((NMHDR *) lParam)->code) {
+ case EN_LINK:
+ ::SetFocus(m_hRich);
+ switch (((ENLINK *) lParam)->msg) {
+ case WM_LBUTTONUP:
+ {
+ ENLINK *e = reinterpret_cast<ENLINK *>(lParam);
+ const TCHAR *tszUrl = Utils::extractURLFromRichEdit(e, m_hRich);
+ if (tszUrl) {
+ CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM)tszUrl);
+ mir_free(const_cast<TCHAR *>(tszUrl));
}
+ ::DestroyWindow(hwnd);
break;
- default:
- break;
+ }
}
break;
}
+ break;
- case WM_COMMAND: {
- if ((HWND)lParam == m_hRich && HIWORD(wParam) == EN_SETFOCUS)
- ::HideCaret(m_hRich);
- break;
- }
-
- case WM_TIMER:
- if (wParam == 1000) {
- POINT pt;
- RECT rc;
-
- ::KillTimer(hwnd, 1000);
- ::GetCursorPos(&pt);
- ::GetWindowRect(hwnd, &rc);
- if (!PtInRect(&rc, pt))
- ::DestroyWindow(hwnd);
- else
- break;
- if (::GetActiveWindow() != hwnd)
- ::DestroyWindow(hwnd);
- }
- break;
+ case WM_COMMAND:
+ if ((HWND)lParam == m_hRich && HIWORD(wParam) == EN_SETFOCUS)
+ ::HideCaret(m_hRich);
+ break;
- case WM_DESTROY:
- ::SetWindowLongPtr(m_hRich, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(m_OldMessageEditProc));
- break;
+ case WM_TIMER:
+ if (wParam == 1000) {
+ POINT pt;
+ RECT rc;
- case WM_NCDESTROY: {
- ::SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
- delete this;
+ ::KillTimer(hwnd, 1000);
+ ::GetCursorPos(&pt);
+ ::GetWindowRect(hwnd, &rc);
+ if (!PtInRect(&rc, pt))
+ ::DestroyWindow(hwnd);
+ else
+ break;
+ if (::GetActiveWindow() != hwnd)
+ ::DestroyWindow(hwnd);
}
+ break;
+
+ case WM_NCDESTROY:
+ ::SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
+ delete this;
}
+
return(::DefWindowProc(hwnd, msg, wParam, lParam));
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 119b7a078a..889c96f0c7 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -40,11 +40,6 @@ extern TTemplateSet RTL_Active, LTR_Active;
const TCHAR* pszIDCSAVE_close = 0, *pszIDCSAVE_save = 0;
-static WNDPROC OldMessageEditProc=0, OldAvatarWndProc=0, OldMessageLogProc=0, oldAvatarParentWndProc=0;
- WNDPROC OldIEViewProc = 0;
-
-WNDPROC OldSplitterProc = 0;
-
static const UINT sendControls[] = { IDC_MESSAGE, IDC_LOG };
static const UINT formatControls[] = { IDC_SMILEYBTN, IDC_FONTBOLD, IDC_FONTITALIC, IDC_FONTUNDERLINE, IDC_FONTFACE,IDC_FONTSTRIKEOUT };
static const UINT addControls[] = { IDC_ADD, IDC_CANCELADD };
@@ -276,11 +271,11 @@ LRESULT CALLBACK IEViewSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l switch (msg) {
case WM_NCCALCSIZE:
- return(CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, OldIEViewProc));
+ return(CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, IEViewSubclassProc));
case WM_NCPAINT:
- return(CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, OldIEViewProc));
+ return(CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, IEViewSubclassProc));
}
- return CallWindowProc(OldIEViewProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, IEViewSubclassProc, msg, wParam, lParam);
}
/*
@@ -289,7 +284,6 @@ LRESULT CALLBACK IEViewSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
-
struct TWindowData *mwdat = (struct TWindowData *)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
if (mwdat) {
BOOL isCtrl, isShift, isAlt;
@@ -297,9 +291,9 @@ LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP switch(msg) {
case WM_NCCALCSIZE:
- return(CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, mwdat->oldIEViewProc));
+ return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, HPPKFSubclassProc);
case WM_NCPAINT:
- return(CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, mwdat->oldIEViewProc));
+ return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, HPPKFSubclassProc);
case WM_KEYDOWN:
if (!isCtrl && !isAlt&&!isShift) {
@@ -318,7 +312,7 @@ LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP }
}
}
- return CallWindowProc(mwdat->oldIEViewProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, HPPKFSubclassProc, msg, wParam, lParam);
}
/*
@@ -431,11 +425,8 @@ static void MsgWindowUpdateState(TWindowData *dat, UINT msg) pt.x = rcRTF.left;
pt.y = rcRTF.top;
if (dat->hwndIEView) {
- if (M->GetByte("subclassIEView", 0) && dat->oldIEViewProc == 0) {
- WNDPROC wndProc = (WNDPROC)SetWindowLongPtr(dat->hwndIEView, GWLP_WNDPROC, (LONG_PTR)IEViewSubclassProc);
- if (OldIEViewProc == 0)
- OldIEViewProc = wndProc;
- dat->oldIEViewProc = wndProc;
+ if (M->GetByte("subclassIEView", 0)) {
+ mir_subclassWindow(dat->hwndIEView, IEViewSubclassProc);
SetWindowPos(dat->hwndIEView, 0, 0, 0, 0, 0, SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_DRAWFRAME);
RedrawWindow(dat->hwndIEView, 0, 0, RDW_FRAME|RDW_INVALIDATE|RDW_UPDATENOW);
}
@@ -596,40 +587,33 @@ static LRESULT CALLBACK MessageLogSubclassProc(HWND hwnd, UINT msg, WPARAM wPara break;
//MAD_
case WM_COPY:
- return(DM_WMCopyHandler(hwnd, OldMessageLogProc, wParam, lParam));
+ return DM_WMCopyHandler(hwnd, MessageLogSubclassProc, wParam, lParam);
case WM_NCCALCSIZE:
- return(CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, OldMessageLogProc));
+ return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, MessageLogSubclassProc);
case WM_NCPAINT:
- return(CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, OldMessageLogProc));
+ return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, MessageLogSubclassProc);
case WM_CONTEXTMENU:
- {
- POINT pt;
-
- if (lParam == 0xFFFFFFFF) {
- CHARRANGE sel;
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM) & sel);
- SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM) & pt, (LPARAM) sel.cpMax);
- ClientToScreen(hwnd, &pt);
- }
- else {
- pt.x = (short) LOWORD(lParam);
- pt.y = (short) HIWORD(lParam);
- }
+ POINT pt;
- ShowPopupMenu(mwdat, IDC_LOG, hwnd, pt);
+ if (lParam == 0xFFFFFFFF) {
+ CHARRANGE sel;
+ SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM) & sel);
+ SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM) & pt, (LPARAM) sel.cpMax);
+ ClientToScreen(hwnd, &pt);
+ }
+ else {
+ pt.x = (short) LOWORD(lParam);
+ pt.y = (short) HIWORD(lParam);
}
- return TRUE;
-
- case WM_NCDESTROY:
- if (OldMessageLogProc)
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) OldMessageLogProc);
- break;
+ ShowPopupMenu(mwdat, IDC_LOG, hwnd, pt);
+ return TRUE;
}
- return CallWindowProc(OldMessageLogProc, hwnd, msg, wParam, lParam);
+
+ return mir_callNextSubclass(hwnd, MessageLogSubclassProc, msg, wParam, lParam);
}
static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -639,9 +623,9 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar struct TWindowData *mwdat = (struct TWindowData *)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
/*
- * prevent the rich edit from switching text direction or keyboard layout when
- * using hotkeys with ctrl-shift or alt-shift modifiers
- */
+ * prevent the rich edit from switching text direction or keyboard layout when
+ * using hotkeys with ctrl-shift or alt-shift modifiers
+ */
if (mwdat->fkeyProcessed && (msg == WM_KEYUP)) {
GetKeyboardState(mwdat->kstate);
if (mwdat->kstate[VK_CONTROL] & 0x80 || mwdat->kstate[VK_SHIFT] & 0x80)
@@ -653,12 +637,15 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar }
switch (msg) {
case WM_NCCALCSIZE:
- return(CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, OldMessageEditProc));
+ return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, MessageEditSubclassProc);
+
case WM_NCPAINT:
- return(CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, OldMessageEditProc));
+ return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKINPUTAREA, msg, wParam, lParam, MessageEditSubclassProc);
+
case WM_DROPFILES:
SendMessage(hwndParent, WM_DROPFILES, (WPARAM)wParam, (LPARAM)lParam);
break;
+
case WM_CHAR:
{
BOOL isCtrl, isShift, isAlt;
@@ -728,7 +715,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar CloseClipboard();
}
- return CallWindowProc(OldMessageEditProc, hwnd, msg, wParam, lParam);
+ break;
case WM_KEYDOWN:
{
@@ -888,7 +875,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar case WM_USER + 100:
SetFocus(hwnd);
break;
- case WM_CONTEXTMENU: {
+ case WM_CONTEXTMENU:
POINT pt;
if (lParam == 0xFFFFFFFF) {
@@ -903,13 +890,8 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar ShowPopupMenu(mwdat, IDC_MESSAGE, hwnd, pt);
return TRUE;
- }
- case WM_NCDESTROY:
- if (OldMessageEditProc)
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) OldMessageEditProc);
- break;
}
- return CallWindowProc(OldMessageEditProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, MessageEditSubclassProc, msg, wParam, lParam);
}
/*
@@ -920,13 +902,12 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar static LRESULT CALLBACK AvatarSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
-
- case WM_ERASEBKGND:
- return TRUE;
- case WM_UPDATEUISTATE:
- return TRUE;
+ case WM_ERASEBKGND:
+ return TRUE;
+ case WM_UPDATEUISTATE:
+ return TRUE;
}
- return CallWindowProc(OldAvatarWndProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, AvatarSubclassProc, msg, wParam, lParam);
}
LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -935,43 +916,48 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM TWindowData *dat = (TWindowData *)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
switch (msg) {
- case WM_NCHITTEST:
- return HTCLIENT;
- case WM_SETCURSOR: {
+ case WM_NCHITTEST:
+ return HTCLIENT;
+ case WM_SETCURSOR:
+ {
RECT rc;
GetClientRect(hwnd, &rc);
SetCursor(rc.right > rc.bottom ? PluginConfig.hCurSplitNS : PluginConfig.hCurSplitWE);
- return TRUE;
}
- case WM_LBUTTONDOWN: {
- if (hwnd == GetDlgItem(hwndParent, IDC_SPLITTER) || hwnd == GetDlgItem(hwndParent, IDC_SPLITTERY)) {
- RECT rc;
+ return TRUE;
- if (dat) {
- GetClientRect(hwnd, &rc);
- dat->savedSplitter = rc.right > rc.bottom ? (short) HIWORD(GetMessagePos()) + rc.bottom / 2 : (short) LOWORD(GetMessagePos()) + rc.right / 2;
- if (dat->bType == SESSIONTYPE_IM)
- dat->savedSplitY = dat->splitterY;
- else {
- SESSION_INFO *si = (SESSION_INFO *)dat->si;
- dat->savedSplitY = si->iSplitterY;
- }
- dat->savedDynaSplit = dat->dynaSplitter;
+ case WM_LBUTTONDOWN:
+ if (hwnd == GetDlgItem(hwndParent, IDC_SPLITTER) || hwnd == GetDlgItem(hwndParent, IDC_SPLITTERY)) {
+ RECT rc;
+
+ if (dat) {
+ GetClientRect(hwnd, &rc);
+ dat->savedSplitter = rc.right > rc.bottom ? (short) HIWORD(GetMessagePos()) + rc.bottom / 2 : (short) LOWORD(GetMessagePos()) + rc.right / 2;
+ if (dat->bType == SESSIONTYPE_IM)
+ dat->savedSplitY = dat->splitterY;
+ else {
+ SESSION_INFO *si = (SESSION_INFO *)dat->si;
+ dat->savedSplitY = si->iSplitterY;
}
+ dat->savedDynaSplit = dat->dynaSplitter;
}
- SetCapture(hwnd);
- return 0;
}
- case WM_MOUSEMOVE:
- if (GetCapture() == hwnd) {
- RECT rc;
- GetClientRect(hwnd, &rc);
- SendMessage(hwndParent, DM_SPLITTERMOVED, rc.right > rc.bottom ? (short) HIWORD(GetMessagePos()) + rc.bottom / 2 : (short) LOWORD(GetMessagePos()) + rc.right / 2, (LPARAM) hwnd);
- }
- return 0;
- case WM_ERASEBKGND:
- return 1;
- case WM_PAINT: {
+ SetCapture(hwnd);
+ return 0;
+
+ case WM_MOUSEMOVE:
+ if (GetCapture() == hwnd) {
+ RECT rc;
+ GetClientRect(hwnd, &rc);
+ SendMessage(hwndParent, DM_SPLITTERMOVED, rc.right > rc.bottom ? (short) HIWORD(GetMessagePos()) + rc.bottom / 2 : (short) LOWORD(GetMessagePos()) + rc.right / 2, (LPARAM) hwnd);
+ }
+ return 0;
+
+ case WM_ERASEBKGND:
+ return 1;
+
+ case WM_PAINT:
+ {
RECT rc;
PAINTSTRUCT ps;
HDC dc = BeginPaint(hwnd, &ps);
@@ -991,20 +977,21 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM else
CSkin::FillBack(dc, &rc);
EndPaint(hwnd, &ps);
- return 0;
}
+ return 0;
- case WM_LBUTTONUP: {
- HWND hwndCapture = GetCapture();
+ case WM_LBUTTONUP: {
+ HWND hwndCapture = GetCapture();
- ReleaseCapture();
- DM_ScrollToBottom(dat, 0, 1);
- if (dat && dat->bType == SESSIONTYPE_IM && hwnd == GetDlgItem(hwndParent, IDC_PANELSPLITTER)) {
- SendMessage(hwndParent, WM_SIZE, 0, 0);
- dat->panelWidth = -1;
- RedrawWindow(hwndParent, NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW);
- } else if ((dat && dat->bType == SESSIONTYPE_IM && hwnd == GetDlgItem(hwndParent, IDC_SPLITTER)) ||
- (dat && dat->bType == SESSIONTYPE_CHAT && hwnd == GetDlgItem(hwndParent, IDC_SPLITTERY))) {
+ ReleaseCapture();
+ DM_ScrollToBottom(dat, 0, 1);
+ if (dat && dat->bType == SESSIONTYPE_IM && hwnd == GetDlgItem(hwndParent, IDC_PANELSPLITTER)) {
+ SendMessage(hwndParent, WM_SIZE, 0, 0);
+ dat->panelWidth = -1;
+ RedrawWindow(hwndParent, NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW);
+ }
+ else if ((dat && dat->bType == SESSIONTYPE_IM && hwnd == GetDlgItem(hwndParent, IDC_SPLITTER)) ||
+ (dat && dat->bType == SESSIONTYPE_CHAT && hwnd == GetDlgItem(hwndParent, IDC_SPLITTERY))) {
RECT rc;
POINT pt;
int selection;
@@ -1024,26 +1011,29 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM selection = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndParent, NULL);
#endif
switch (selection) {
- case ID_SPLITTERCONTEXT_SAVEFORTHISCONTACTONLY: {
+ case ID_SPLITTERCONTEXT_SAVEFORTHISCONTACTONLY:
+ {
HWND hwndParent = GetParent(hwnd);
dat->dwFlagsEx |= MWF_SHOW_SPLITTEROVERRIDE;
M->WriteByte(dat->hContact, SRMSGMOD_T, "splitoverride", 1);
if (dat->bType == SESSIONTYPE_IM)
SaveSplitter(dat);
- break;
}
- case ID_SPLITTERCONTEXT_SETPOSITIONFORTHISSESSION:
+ break;
+
+ case ID_SPLITTERCONTEXT_SETPOSITIONFORTHISSESSION:
#if defined(__FEAT_EXP_AUTOSPLITTER)
- if (dat->fIsAutosizingInput) {
- RECT rc;
- GetWindowRect(GetDlgItem(dat->hwnd, IDC_MESSAGE), &rc);
- dat->iInputAreaHeight = 0;
- }
+ if (dat->fIsAutosizingInput) {
+ RECT rc;
+ GetWindowRect(GetDlgItem(dat->hwnd, IDC_MESSAGE), &rc);
+ dat->iInputAreaHeight = 0;
+ }
#endif
- break;
- case ID_SPLITTERCONTEXT_SAVEGLOBALFORALLSESSIONS: {
+ break;
+ case ID_SPLITTERCONTEXT_SAVEGLOBALFORALLSESSIONS:
+ {
RECT rcWin;
BYTE bSync = M->GetByte("Chat", "SyncSplitter", 0);
DWORD dwOff_IM = 0, dwOff_CHAT = 0;
@@ -1062,27 +1052,28 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM PluginConfig.lastSPlitterPos.bSync = bSync;
SendMessage(dat->hwnd, DM_SPLITTERGLOBALEVENT, 0, 0);
M->BroadcastMessage(DM_SPLITTERGLOBALEVENT, 0, 0);
- break;
}
- default:
- dat->splitterY = dat->savedSplitY;
- dat->dynaSplitter = dat->savedDynaSplit;
- DM_RecalcPictureSize(dat);
- if (dat->bType == SESSIONTYPE_CHAT) {
- SESSION_INFO *si = (SESSION_INFO *)dat->si;
- si->iSplitterY = dat->savedSplitY;
- dat->splitterY =si->iSplitterY + DPISCALEY_S(22);
- }
- CSkin::UpdateToolbarBG(dat);
- SendMessage(hwndParent, WM_SIZE, 0, 0);
- DM_ScrollToBottom(dat, 0, 1);
- break;
+ break;
+
+ default:
+ dat->splitterY = dat->savedSplitY;
+ dat->dynaSplitter = dat->savedDynaSplit;
+ DM_RecalcPictureSize(dat);
+ if (dat->bType == SESSIONTYPE_CHAT) {
+ SESSION_INFO *si = (SESSION_INFO *)dat->si;
+ si->iSplitterY = dat->savedSplitY;
+ dat->splitterY =si->iSplitterY + DPISCALEY_S(22);
+ }
+ CSkin::UpdateToolbarBG(dat);
+ SendMessage(hwndParent, WM_SIZE, 0, 0);
+ DM_ScrollToBottom(dat, 0, 1);
+ break;
}
- }
- return 0;
+ }
+ return 0;
}
}
- return CallWindowProc(OldSplitterProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam);
}
/*
@@ -1301,8 +1292,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP struct TNewWindowData *newData = (struct TNewWindowData *) lParam;
- dat = (struct TWindowData *) malloc(sizeof(struct TWindowData));
- ZeroMemory((void*) dat, sizeof(struct TWindowData));
+ dat = (TWindowData *)calloc(sizeof(TWindowData), 1);
if (newData->iTabID >= 0) {
dat->pContainer = newData->pContainer;
m_pContainer = dat->pContainer;
@@ -1357,14 +1347,14 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP CreateWindowEx(0, _T("TSButtonClass"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 6, DPISCALEY_S(20),
hwndDlg, (HMENU)IDC_TOGGLESIDEBAR, g_hInst, NULL);
dat->hwndPanelPicParent = CreateWindowEx(WS_EX_TOPMOST, _T("Static"), _T(""), SS_OWNERDRAW | WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, hwndDlg, (HMENU)6000, NULL, NULL);
- oldAvatarParentWndProc = (WNDPROC)SetWindowLongPtr(dat->hwndPanelPicParent, GWLP_WNDPROC, (INT_PTR)CInfoPanel::avatarParentSubclass);
+ mir_subclassWindow(dat->hwndPanelPicParent, CInfoPanel::avatarParentSubclass);
dat->showUIElements = m_pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1;
dat->sendMode |= M->GetByte(dat->hContact, "forceansi", 0) ? SMODE_FORCEANSI : 0;
dat->sendMode |= dat->hContact == 0 ? SMODE_MULTIPLE : 0;
dat->sendMode |= M->GetByte(dat->hContact, "no_ack", 0) ? SMODE_NOACK : 0;
- dat->hQueuedEvents = (HANDLE *)malloc(sizeof(HANDLE) * EVENT_QUEUE_SIZE);
+ dat->hQueuedEvents = (HANDLE*)calloc(sizeof(HANDLE), EVENT_QUEUE_SIZE);
dat->iEventQueueSize = EVENT_QUEUE_SIZE;
dat->iCurrentQueueError = -1;
@@ -1507,11 +1497,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP * subclassing stuff
*/
- OldMessageEditProc = (WNDPROC) SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MESSAGE), GWLP_WNDPROC, (LONG_PTR) MessageEditSubclassProc);
- OldAvatarWndProc = (WNDPROC) SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CONTACTPIC), GWLP_WNDPROC, (LONG_PTR) AvatarSubclassProc);
- OldSplitterProc = (WNDPROC) SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTER), GWLP_WNDPROC, (LONG_PTR) SplitterSubclassProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MULTISPLITTER), GWLP_WNDPROC, (LONG_PTR) SplitterSubclassProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PANELSPLITTER), GWLP_WNDPROC, (LONG_PTR) SplitterSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_MESSAGE), MessageEditSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_CONTACTPIC), AvatarSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_SPLITTER), SplitterSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_MULTISPLITTER), SplitterSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_PANELSPLITTER), SplitterSubclassProc);
/*
* load old messages from history (if wanted...)
@@ -1576,8 +1566,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP ZeroMemory(&wndClass, sizeof(wndClass));
GetClassInfoA(g_hInst, "RichEdit20A", &wndClass);
- OldMessageLogProc = wndClass.lpfnWndProc;
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG), GWLP_WNDPROC, (LONG_PTR) MessageLogSubclassProc);
+ mir_subclassWindowFull( GetDlgItem(hwndDlg, IDC_LOG), MessageLogSubclassProc, wndClass.lpfnWndProc);
}
SetWindowPos(hwndDlg, 0, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), newData->iActivate ? 0 : SWP_NOZORDER | SWP_NOACTIVATE);
LoadSplitter(dat);
@@ -1616,10 +1605,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dat->dwLastActivity = GetTickCount() - 1000;
m_pContainer->dwLastActivity = dat->dwLastActivity;
- if (dat->hwndHPP) {
- WNDPROC wndProc = (WNDPROC)SetWindowLongPtr(dat->hwndHPP, GWLP_WNDPROC, (LONG_PTR)HPPKFSubclassProc);
- dat->oldIEViewProc = wndProc;
- }
+ if (dat->hwndHPP)
+ mir_subclassWindow(dat->hwndHPP, HPPKFSubclassProc);
dat->dwFlags &= ~MWF_INITMODE;
TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_OPEN, 0);
@@ -3352,18 +3339,19 @@ quote_from_last: case DM_UINTOCLIPBOARD:
Utils::CopyToClipBoard(const_cast<TCHAR *>(dat->cache->getUIN()), hwndDlg);
return 0;
- /*
- * broadcasted when GLOBAL info panel setting changes
- */
+
+ /*
+ * broadcasted when GLOBAL info panel setting changes
+ */
case DM_SETINFOPANEL:
CInfoPanel::setPanelHandler(dat, wParam, lParam);
return 0;
- /*
- * show the balloon tooltip control.
- * wParam == id of the "anchor" element, defaults to the panel status field (for away msg retrieval)
- * lParam == new text to show
- */
+ /*
+ * show the balloon tooltip control.
+ * wParam == id of the "anchor" element, defaults to the panel status field (for away msg retrieval)
+ * lParam == new text to show
+ */
case DM_ACTIVATETOOLTIP: {
if (IsIconic(hwndContainer) || m_pContainer->hwndActive != hwndDlg)
@@ -3677,11 +3665,8 @@ quote_from_last: if (dat->hClientIcon)
DestroyIcon(dat->hClientIcon);
- if (dat->hwndPanelPicParent) {
- if (oldAvatarParentWndProc)
- SetWindowLongPtr(dat->hwndPanelPicParent, GWLP_WNDPROC, (LONG_PTR)oldAvatarParentWndProc);
+ if (dat->hwndPanelPicParent)
DestroyWindow(dat->hwndPanelPicParent);
- }
if (dat->cache->isValid()) { // not valid means the contact was deleted
TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSING, 0);
@@ -3711,15 +3696,15 @@ quote_from_last: free(dat->sendBuffer);
if (dat->hHistoryEvents)
free(dat->hHistoryEvents);
+
+ /*
+ * search the sendqueue for unfinished send jobs and free them. Leave unsent
+ * messages in the queue as they can be acked later
+ */
{
- int i;
- /*
- * search the sendqueue for unfinished send jobs and free them. Leave unsent
- * messages in the queue as they can be acked later
- */
SendJob *jobs = sendQueue->getJobByIndex(0);
- for (i=0; i < SendQueue::NR_SENDJOBS; i++) {
+ for (int i=0; i < SendQueue::NR_SENDJOBS; i++) {
if (jobs[i].hOwner == dat->hContact) {
if (jobs[i].iStatus > (unsigned)SendQueue::SQ_INPROGRESS)
sendQueue->clearJob(i);
@@ -3732,10 +3717,11 @@ quote_from_last: jobs[i].hwndOwner = 0;
}
}
- if (dat->hQueuedEvents)
- free(dat->hQueuedEvents);
}
+ if (dat->hQueuedEvents)
+ free(dat->hQueuedEvents);
+
if (dat->hSmileyIcon)
DestroyIcon(dat->hSmileyIcon);
@@ -3757,26 +3743,15 @@ quote_from_last: M->WriteDword(SRMSGMOD, "multisplit", dat->multiSplitterX);
WriteStatsOnClose(dat);
}
-
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MULTISPLITTER), GWLP_WNDPROC, (LONG_PTR) OldSplitterProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PANELSPLITTER), GWLP_WNDPROC, (LONG_PTR) OldSplitterProc);
-
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTER), GWLP_WNDPROC, (LONG_PTR) OldSplitterProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CONTACTPIC), GWLP_WNDPROC, (LONG_PTR) OldAvatarWndProc);
-
{
- HFONT hFont;
- TCITEM item;
- int i;
-
- hFont = (HFONT) SendDlgItemMessage(hwndDlg, IDC_MESSAGE, WM_GETFONT, 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))
DeleteObject(hFont);
- ZeroMemory((void*)&item, sizeof(item));
+ TCITEM item = { 0 };
item.mask = TCIF_PARAM;
- i = GetTabIndexFromHWND(hwndTab, hwndDlg);
+ int i = GetTabIndexFromHWND(hwndTab, hwndDlg);
if (i >= 0) {
SendMessage(hwndTab, WM_USER + 100, 0, 0); // remove tooltip
TabCtrl_DeleteItem(hwndTab, i);
@@ -3784,6 +3759,7 @@ quote_from_last: dat->iTabID = -1;
}
}
+
TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSE, 0);
/*
@@ -3795,10 +3771,6 @@ quote_from_last: ieWindow.cbSize = sizeof(IEVIEWWINDOW);
ieWindow.iType = IEW_DESTROY;
ieWindow.hwnd = dat->hwndIEView;
- if (dat->oldIEViewProc) {
- SetWindowLongPtr(dat->hwndIEView, GWLP_WNDPROC, (LONG_PTR)dat->oldIEViewProc);
- dat->oldIEViewProc = 0;
- }
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
}
if (dat->hwndHPP) {
@@ -3806,10 +3778,6 @@ quote_from_last: ieWindow.cbSize = sizeof(IEVIEWWINDOW);
ieWindow.iType = IEW_DESTROY;
ieWindow.hwnd = dat->hwndHPP;
- if (dat->oldIEViewProc) {
- SetWindowLongPtr(dat->hwndHPP, GWLP_WNDPROC, (LONG_PTR)dat->oldIEViewProc);
- dat->oldIEViewProc = 0;
- }
CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
}
if (dat->pWnd) {
@@ -3817,6 +3785,7 @@ quote_from_last: dat->pWnd = 0;
}
break;
+
case WM_DWMCOMPOSITIONCHANGED:
BB_RefreshTheme(dat);
memset((void*)&dat->pContainer->mOld, -1000, sizeof(MARGINS));
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp index 156c4d4ba7..d5c9b5a9f4 100644 --- a/plugins/TabSRMM/src/tabctrl.cpp +++ b/plugins/TabSRMM/src/tabctrl.cpp @@ -681,21 +681,22 @@ static POINT ptMouseT = {0}; static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct TabControlData *tabdat = 0;
-
- tabdat = (struct TabControlData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ TabControlData *tabdat = (TabControlData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (tabdat) {
if (tabdat->pContainer == NULL)
tabdat->pContainer = (TContainerData *)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
tabdat->dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
}
+ POINT pt;
+
switch (msg) {
- case WM_NCCREATE: {
+ case WM_NCCREATE:
+ {
WNDCLASSEXA wcl = {0};
-
wcl.cbSize = sizeof(wcl);
GetClassInfoExA(g_hInst, "SysTabControl32", &wcl);
+ OldTabControlClassProc = wcl.lpfnWndProc;
tabdat = (struct TabControlData *)mir_alloc(sizeof(struct TabControlData));
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)tabdat);
@@ -706,116 +707,117 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara tabdat->fTipActive = FALSE;
tabdat->iHoveredCloseIcon = -1;
SendMessage(hwnd, EM_THEMECHANGED, 0, 0);
- OldTabControlClassProc = wcl.lpfnWndProc;
- return TRUE;
}
- case EM_THEMECHANGED:
- tabdat->m_xpad = M->GetByte("x-pad", 3);
- tabdat->m_VisualStyles = FALSE;
- if (PluginConfig.m_bIsXP && M->isVSAPIState()) {
- if (CMimAPI::m_pfnIsThemeActive != 0)
- if (CMimAPI::m_pfnIsThemeActive()) {
- tabdat->m_VisualStyles = TRUE;
- if (tabdat->hTheme != 0 && CMimAPI::m_pfnCloseThemeData != 0) {
- CMimAPI::m_pfnCloseThemeData(tabdat->hTheme);
- CMimAPI::m_pfnCloseThemeData(tabdat->hThemeButton);
- }
- if (CMimAPI::m_pfnOpenThemeData != 0) {
- if ((tabdat->hTheme = CMimAPI::m_pfnOpenThemeData(hwnd, L"TAB")) == 0 || (tabdat->hThemeButton = CMimAPI::m_pfnOpenThemeData(hwnd, L"BUTTON")) == 0)
- tabdat->m_VisualStyles = FALSE;
- }
+ return TRUE;
+
+ case EM_THEMECHANGED:
+ tabdat->m_xpad = M->GetByte("x-pad", 3);
+ tabdat->m_VisualStyles = FALSE;
+ if (PluginConfig.m_bIsXP && M->isVSAPIState()) {
+ if (CMimAPI::m_pfnIsThemeActive != 0)
+ if (CMimAPI::m_pfnIsThemeActive()) {
+ tabdat->m_VisualStyles = TRUE;
+ if (tabdat->hTheme != 0 && CMimAPI::m_pfnCloseThemeData != 0) {
+ CMimAPI::m_pfnCloseThemeData(tabdat->hTheme);
+ CMimAPI::m_pfnCloseThemeData(tabdat->hThemeButton);
}
- }
- return 0;
- case EM_SEARCHSCROLLER: {
+ if (CMimAPI::m_pfnOpenThemeData != 0) {
+ if ((tabdat->hTheme = CMimAPI::m_pfnOpenThemeData(hwnd, L"TAB")) == 0 || (tabdat->hThemeButton = CMimAPI::m_pfnOpenThemeData(hwnd, L"BUTTON")) == 0)
+ tabdat->m_VisualStyles = FALSE;
+ }
+ }
+ }
+ return 0;
+
+ case EM_SEARCHSCROLLER:
+ {
HWND hwndChild;
/*
- * search the updown control (scroll arrows) to subclass it...
- * the control is dynamically created and may not exist as long as it is
- * not needed. So we have to search it everytime we need to paint. However,
- * it is sufficient to search it once. So this message is called, whenever
- * a new tab is inserted
- */
+ * search the updown control (scroll arrows) to subclass it...
+ * the control is dynamically created and may not exist as long as it is
+ * not needed. So we have to search it everytime we need to paint. However,
+ * it is sufficient to search it once. So this message is called, whenever
+ * a new tab is inserted
+ */
if ((hwndChild = FindWindowEx(hwnd, 0, _T("msctls_updown32"), NULL)) != 0)
DestroyWindow(hwndChild);
- return 0;
}
- case EM_VALIDATEBOTTOM: {
+ return 0;
+
+ case EM_VALIDATEBOTTOM:
+ {
BOOL bClassicDraw = (tabdat->m_VisualStyles == FALSE);
if ((tabdat->dwStyle & TCS_BOTTOM) && !bClassicDraw && PluginConfig.tabConfig.m_bottomAdjust != 0)
InvalidateRect(hwnd, NULL, FALSE);
- break;
}
- case EM_REFRESHWITHOUTCLIP:
- if (TabCtrl_GetItemCount(hwnd) > 1)
- return 0;
- else {
- tabdat->bRefreshWithoutClip = TRUE;
- RedrawWindow(hwnd, NULL, NULL, RDW_UPDATENOW | RDW_NOCHILDREN | RDW_INVALIDATE);
- tabdat->bRefreshWithoutClip = FALSE;
- return 0;
- }
- case TCM_INSERTITEM:
- case TCM_DELETEITEM:
- tabdat->iHoveredCloseIcon = -1;
- if (!(tabdat->dwStyle & TCS_MULTILINE) || tabdat->dwStyle & TCS_BUTTONS) {
- LRESULT result;
- RECT rc;
- int iTabs = TabCtrl_GetItemCount(hwnd);
- if (iTabs >= 1 && msg == TCM_INSERTITEM) {
- TabCtrl_GetItemRect(hwnd, 0, &rc);
- TabCtrl_SetItemSize(hwnd, 10, rc.bottom - rc.top);
- }
- result = CallWindowProc(OldTabControlClassProc, hwnd, msg, wParam, lParam);
+ break;
+
+ case EM_REFRESHWITHOUTCLIP:
+ if (TabCtrl_GetItemCount(hwnd) > 1)
+ return 0;
+
+ tabdat->bRefreshWithoutClip = TRUE;
+ RedrawWindow(hwnd, NULL, NULL, RDW_UPDATENOW | RDW_NOCHILDREN | RDW_INVALIDATE);
+ tabdat->bRefreshWithoutClip = FALSE;
+ return 0;
+
+ case TCM_INSERTITEM:
+ case TCM_DELETEITEM:
+ tabdat->iHoveredCloseIcon = -1;
+ if (!(tabdat->dwStyle & TCS_MULTILINE) || tabdat->dwStyle & TCS_BUTTONS) {
+ LRESULT result;
+ RECT rc;
+ int iTabs = TabCtrl_GetItemCount(hwnd);
+ if (iTabs >= 1 && msg == TCM_INSERTITEM) {
TabCtrl_GetItemRect(hwnd, 0, &rc);
- SendMessage(hwnd, WM_SIZE, 0, 0);
- return result;
+ TabCtrl_SetItemSize(hwnd, 10, rc.bottom - rc.top);
}
- break;
- case WM_DESTROY:
- if (tabdat) {
- if (tabdat->hTheme != 0 && CMimAPI::m_pfnCloseThemeData != 0) {
- CMimAPI::m_pfnCloseThemeData(tabdat->hTheme);
- CMimAPI::m_pfnCloseThemeData(tabdat->hThemeButton);
- }
- }
- break;
- case WM_NCDESTROY:
- if (tabdat) {
- mir_free(tabdat);
- SetWindowLongPtr(hwnd, GWLP_USERDATA, 0L);
- }
- break;
- case WM_MBUTTONDOWN: {
- POINT pt;
- GetCursorPos(&pt);
- SendMessage(GetParent(hwnd), DM_CLOSETABATMOUSE, 0, (LPARAM)&pt);
- return 1;
+ result = CallWindowProc(OldTabControlClassProc, hwnd, msg, wParam, lParam);
+ TabCtrl_GetItemRect(hwnd, 0, &rc);
+ SendMessage(hwnd, WM_SIZE, 0, 0);
+ return result;
}
- case WM_SETCURSOR: {
- POINT pt;
+ break;
- GetCursorPos(&pt);
- SendMessage(GetParent(hwnd), msg, wParam, lParam);
- if (abs(pt.x - ptMouseT.x) < 4 && abs(pt.y - ptMouseT.y) < 4)
- return 1;
- ptMouseT = pt;
- if (tabdat->fTipActive) {
- KillTimer(hwnd, TIMERID_HOVER_T);
- CallService("mToolTip/HideTip", 0, 0);
- tabdat->fTipActive = FALSE;
+ case WM_DESTROY:
+ if (tabdat) {
+ if (tabdat->hTheme != 0 && CMimAPI::m_pfnCloseThemeData != 0) {
+ CMimAPI::m_pfnCloseThemeData(tabdat->hTheme);
+ CMimAPI::m_pfnCloseThemeData(tabdat->hThemeButton);
}
+ }
+ break;
+ case WM_NCDESTROY:
+ if (tabdat) {
+ mir_free(tabdat);
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, 0L);
+ }
+ break;
+ case WM_MBUTTONDOWN:
+ GetCursorPos(&pt);
+ SendMessage(GetParent(hwnd), DM_CLOSETABATMOUSE, 0, (LPARAM)&pt);
+ return 1;
+
+ case WM_SETCURSOR:
+ GetCursorPos(&pt);
+ SendMessage(GetParent(hwnd), msg, wParam, lParam);
+ if (abs(pt.x - ptMouseT.x) < 4 && abs(pt.y - ptMouseT.y) < 4)
+ return 1;
+ ptMouseT = pt;
+ if (tabdat->fTipActive) {
KillTimer(hwnd, TIMERID_HOVER_T);
- if (tabdat->pContainer && (!tabdat->pContainer->SideBar->isActive() && (TabCtrl_GetItemCount(hwnd) > 1 || !(tabdat->pContainer->dwFlags & CNT_HIDETABS))))
- SetTimer(hwnd, TIMERID_HOVER_T, 750, 0);
- break;
+ CallService("mToolTip/HideTip", 0, 0);
+ tabdat->fTipActive = FALSE;
}
- case WM_SIZE: {
- int iTabs = TabCtrl_GetItemCount(hwnd);
+ KillTimer(hwnd, TIMERID_HOVER_T);
+ if (tabdat->pContainer && (!tabdat->pContainer->SideBar->isActive() && (TabCtrl_GetItemCount(hwnd) > 1 || !(tabdat->pContainer->dwFlags & CNT_HIDETABS))))
+ SetTimer(hwnd, TIMERID_HOVER_T, 750, 0);
+ break;
- if (!tabdat->pContainer)
- break;
+ case WM_SIZE:
+ if (tabdat->pContainer) {
+ int iTabs = TabCtrl_GetItemCount(hwnd);
if (!(tabdat->dwStyle & TCS_MULTILINE)) {
RECT rcClient, rc;
@@ -825,11 +827,11 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara TabCtrl_GetItemRect(hwnd, iTabs - 1, &rc);
newItemSize = (rcClient.right - 6) - (tabdat->dwStyle & TCS_BUTTONS ? (iTabs) * 10 : 0);
newItemSize = newItemSize / iTabs;
- if (newItemSize < PluginConfig.tabConfig.m_fixedwidth) {
+ if (newItemSize < PluginConfig.tabConfig.m_fixedwidth)
TabCtrl_SetItemSize(hwnd, newItemSize, rc.bottom - rc.top);
- } else {
+ else
TabCtrl_SetItemSize(hwnd, PluginConfig.tabConfig.m_fixedwidth, rc.bottom - rc.top);
- }
+
SendMessage(hwnd, EM_SEARCHSCROLLER, 0, 0);
}
} else if (tabdat->dwStyle & TCS_BUTTONS && iTabs > 0) {
@@ -843,174 +845,171 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara else
TabCtrl_SetItemSize(hwnd, PluginConfig.tabConfig.m_fixedwidth, rcItem.bottom - rcItem.top);
}
- break;
}
- case WM_LBUTTONDBLCLK: {
- POINT pt;
- GetCursorPos(&pt);
- SendMessage(GetParent(hwnd), DM_CLOSETABATMOUSE, 0, (LPARAM)&pt);
- break;
- }
- case WM_RBUTTONDOWN:
- KillTimer(hwnd, TIMERID_HOVER_T);
- CallService("mToolTip/HideTip", 0, 0);
- tabdat->fTipActive = FALSE;
- break;
+ break;
- case WM_LBUTTONDOWN: {
- TCHITTESTINFO tci = {0};
+ case WM_LBUTTONDBLCLK:
+ GetCursorPos(&pt);
+ SendMessage(GetParent(hwnd), DM_CLOSETABATMOUSE, 0, (LPARAM)&pt);
+ break;
- KillTimer(hwnd, TIMERID_HOVER_T);
- CallService("mToolTip/HideTip", 0, 0);
- tabdat->fTipActive = FALSE;
+ case WM_RBUTTONDOWN:
+ KillTimer(hwnd, TIMERID_HOVER_T);
+ CallService("mToolTip/HideTip", 0, 0);
+ tabdat->fTipActive = FALSE;
+ break;
- if (GetKeyState(VK_CONTROL) & 0x8000) {
- tci.pt.x = (short)LOWORD(GetMessagePos());
- tci.pt.y = (short)HIWORD(GetMessagePos());
- if (DragDetect(hwnd, tci.pt) && TabCtrl_GetItemCount(hwnd) > 1) {
- int i;
- tci.flags = TCHT_ONITEM;
-
- ScreenToClient(hwnd, &tci.pt);
- i = TabCtrl_HitTest(hwnd, &tci);
- if (i != -1) {
- TCITEM tc;
- struct TWindowData *dat = NULL;
-
- tc.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwnd, i, &tc);
- dat = (struct TWindowData *)GetWindowLongPtr((HWND)tc.lParam, GWLP_USERDATA);
- if (dat) {
- tabdat->bDragging = TRUE;
- tabdat->iBeginIndex = i;
- tabdat->hwndDrag = (HWND)tc.lParam;
- tabdat->dragDat = dat;
- tabdat->fSavePos = TRUE;
- tabdat->himlDrag = ImageList_Create(16, 16, ILC_MASK | (PluginConfig.m_bIsXP ? ILC_COLOR32 : ILC_COLOR16), 1, 0);
- ImageList_AddIcon(tabdat->himlDrag, dat->hTabIcon);
- ImageList_BeginDrag(tabdat->himlDrag, 0, 8, 8);
- ImageList_DragEnter(hwnd, tci.pt.x, tci.pt.y);
- SetCapture(hwnd);
- }
- return TRUE;
+ case WM_LBUTTONDOWN:
+ KillTimer(hwnd, TIMERID_HOVER_T);
+ CallService("mToolTip/HideTip", 0, 0);
+ tabdat->fTipActive = FALSE;
+
+ if (GetKeyState(VK_CONTROL) & 0x8000) {
+ TCHITTESTINFO tci = {0};
+ tci.pt.x = (short)LOWORD(GetMessagePos());
+ tci.pt.y = (short)HIWORD(GetMessagePos());
+ if (DragDetect(hwnd, tci.pt) && TabCtrl_GetItemCount(hwnd) > 1) {
+ int i;
+ tci.flags = TCHT_ONITEM;
+
+ ScreenToClient(hwnd, &tci.pt);
+ i = TabCtrl_HitTest(hwnd, &tci);
+ if (i != -1) {
+ TCITEM tc;
+ struct TWindowData *dat = NULL;
+
+ tc.mask = TCIF_PARAM;
+ TabCtrl_GetItem(hwnd, i, &tc);
+ dat = (struct TWindowData *)GetWindowLongPtr((HWND)tc.lParam, GWLP_USERDATA);
+ if (dat) {
+ tabdat->bDragging = TRUE;
+ tabdat->iBeginIndex = i;
+ tabdat->hwndDrag = (HWND)tc.lParam;
+ tabdat->dragDat = dat;
+ tabdat->fSavePos = TRUE;
+ tabdat->himlDrag = ImageList_Create(16, 16, ILC_MASK | (PluginConfig.m_bIsXP ? ILC_COLOR32 : ILC_COLOR16), 1, 0);
+ ImageList_AddIcon(tabdat->himlDrag, dat->hTabIcon);
+ ImageList_BeginDrag(tabdat->himlDrag, 0, 8, 8);
+ ImageList_DragEnter(hwnd, tci.pt.x, tci.pt.y);
+ SetCapture(hwnd);
}
+ return TRUE;
}
}
+ }
- if (GetKeyState(VK_MENU) & 0x8000) {
- tci.pt.x = (short)LOWORD(GetMessagePos());
- tci.pt.y = (short)HIWORD(GetMessagePos());
- if (DragDetect(hwnd, tci.pt) && TabCtrl_GetItemCount(hwnd) > 1) {
- int i;
- tci.flags = TCHT_ONITEM;
-
- ScreenToClient(hwnd, &tci.pt);
- i = TabCtrl_HitTest(hwnd, &tci);
- if (i != -1) {
- TCITEM tc;
- TWindowData *dat = NULL;
-
- tc.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwnd, i, &tc);
- dat = (TWindowData *)GetWindowLongPtr((HWND)tc.lParam, GWLP_USERDATA);
- if (dat) {
- tabdat->bDragging = TRUE;
- tabdat->iBeginIndex = i;
- tabdat->hwndDrag = (HWND)tc.lParam;
- tabdat->dragDat = dat;
- tabdat->himlDrag = ImageList_Create(16, 16, ILC_MASK | (PluginConfig.m_bIsXP ? ILC_COLOR32 : ILC_COLOR16), 1, 0);
- tabdat->fSavePos = FALSE;
- ImageList_AddIcon(tabdat->himlDrag, dat->hTabIcon);
- ImageList_BeginDrag(tabdat->himlDrag, 0, 8, 8);
- ImageList_DragEnter(hwnd, tci.pt.x, tci.pt.y);
- SetCapture(hwnd);
- }
- return TRUE;
+ if (GetKeyState(VK_MENU) & 0x8000) {
+ TCHITTESTINFO tci = {0};
+ tci.pt.x = (short)LOWORD(GetMessagePos());
+ tci.pt.y = (short)HIWORD(GetMessagePos());
+ if (DragDetect(hwnd, tci.pt) && TabCtrl_GetItemCount(hwnd) > 1) {
+ int i;
+ tci.flags = TCHT_ONITEM;
+
+ ScreenToClient(hwnd, &tci.pt);
+ i = TabCtrl_HitTest(hwnd, &tci);
+ if (i != -1) {
+ TCITEM tc;
+ TWindowData *dat = NULL;
+
+ tc.mask = TCIF_PARAM;
+ TabCtrl_GetItem(hwnd, i, &tc);
+ dat = (TWindowData *)GetWindowLongPtr((HWND)tc.lParam, GWLP_USERDATA);
+ if (dat) {
+ tabdat->bDragging = TRUE;
+ tabdat->iBeginIndex = i;
+ tabdat->hwndDrag = (HWND)tc.lParam;
+ tabdat->dragDat = dat;
+ tabdat->himlDrag = ImageList_Create(16, 16, ILC_MASK | (PluginConfig.m_bIsXP ? ILC_COLOR32 : ILC_COLOR16), 1, 0);
+ tabdat->fSavePos = FALSE;
+ ImageList_AddIcon(tabdat->himlDrag, dat->hTabIcon);
+ ImageList_BeginDrag(tabdat->himlDrag, 0, 8, 8);
+ ImageList_DragEnter(hwnd, tci.pt.x, tci.pt.y);
+ SetCapture(hwnd);
}
+ return TRUE;
}
}
- if (tabdat->fCloseButton) {
- POINT pt;
- GetCursorPos(&pt);
+ }
+
+ if (tabdat->fCloseButton) {
+ GetCursorPos(&pt);
+ if (TabCtrl_TestForCloseButton(tabdat, hwnd, pt) != -1)
+ return(TRUE);
+ }
+ break;
- if (TabCtrl_TestForCloseButton(tabdat, hwnd, pt) != -1)
- return(TRUE);
- }
+ case WM_CAPTURECHANGED:
+ tabdat->bDragging = FALSE;
+ ImageList_DragLeave(hwnd);
+ ImageList_EndDrag();
+ if (tabdat->himlDrag) {
+ ImageList_RemoveAll(tabdat->himlDrag);
+ ImageList_Destroy(tabdat->himlDrag);
+ tabdat->himlDrag = 0;
}
break;
- case WM_CAPTURECHANGED: {
+ case WM_MOUSEMOVE:
+ if (tabdat->bDragging) {
+ TCHITTESTINFO tci = {0};
+ tci.pt.x = (short)LOWORD(GetMessagePos());
+ tci.pt.y = (short)HIWORD(GetMessagePos());
+ ScreenToClient(hwnd, &tci.pt);
+ ImageList_DragMove(tci.pt.x, tci.pt.y);
+ }
+ if (tabdat->fCloseButton) {
+ POINT pt;
+
+ GetCursorPos(&pt);
+ int iOldHovered = tabdat->iHoveredCloseIcon;
+ tabdat->iHoveredCloseIcon = TabCtrl_TestForCloseButton(tabdat, hwnd, pt);
+ if (tabdat->iHoveredCloseIcon != iOldHovered)
+ InvalidateRect(hwnd, NULL, FALSE);
+ }
+ break;
+
+ case WM_LBUTTONUP:
+ CallWindowProc(OldTabControlClassProc, hwnd, msg, wParam, lParam);
+ if (tabdat->bDragging && ReleaseCapture()) {
+ TCHITTESTINFO tci = {0};
+ int i;
+ tci.pt.x = (short)LOWORD(GetMessagePos());
+ tci.pt.y = (short)HIWORD(GetMessagePos());
+ tci.flags = TCHT_ONITEM;
tabdat->bDragging = FALSE;
ImageList_DragLeave(hwnd);
ImageList_EndDrag();
+
+ ScreenToClient(hwnd, &tci.pt);
+ i = TabCtrl_HitTest(hwnd, &tci);
+ if (i != -1 && i != tabdat->iBeginIndex)
+ RearrangeTab(tabdat->hwndDrag, tabdat->dragDat, MAKELONG(i, 0xffff), tabdat->fSavePos);
+ tabdat->hwndDrag = (HWND) - 1;
+ tabdat->dragDat = NULL;
if (tabdat->himlDrag) {
ImageList_RemoveAll(tabdat->himlDrag);
ImageList_Destroy(tabdat->himlDrag);
tabdat->himlDrag = 0;
}
}
- break;
-
- case WM_MOUSEMOVE: {
- if (tabdat->bDragging) {
- TCHITTESTINFO tci = {0};
- tci.pt.x = (short)LOWORD(GetMessagePos());
- tci.pt.y = (short)HIWORD(GetMessagePos());
- ScreenToClient(hwnd, &tci.pt);
- ImageList_DragMove(tci.pt.x, tci.pt.y);
- }
- if (tabdat->fCloseButton) {
- POINT pt;
+ if (tabdat->fCloseButton) {
+ POINT pt;
- GetCursorPos(&pt);
- int iOldHovered = tabdat->iHoveredCloseIcon;
- tabdat->iHoveredCloseIcon = TabCtrl_TestForCloseButton(tabdat, hwnd, pt);
- if (tabdat->iHoveredCloseIcon != iOldHovered)
- InvalidateRect(hwnd, NULL, FALSE);
- }
+ GetCursorPos(&pt);
+ int iItem = TabCtrl_TestForCloseButton(tabdat, hwnd, pt);
+ if (iItem != -1)
+ SendMessage(GetParent(hwnd), DM_CLOSETABATMOUSE, 0, (LPARAM)&pt);
}
break;
- case WM_LBUTTONUP: {
- CallWindowProc(OldTabControlClassProc, hwnd, msg, wParam, lParam);
- if (tabdat->bDragging && ReleaseCapture()) {
- TCHITTESTINFO tci = {0};
- int i;
- tci.pt.x = (short)LOWORD(GetMessagePos());
- tci.pt.y = (short)HIWORD(GetMessagePos());
- tci.flags = TCHT_ONITEM;
- tabdat->bDragging = FALSE;
- ImageList_DragLeave(hwnd);
- ImageList_EndDrag();
-
- ScreenToClient(hwnd, &tci.pt);
- i = TabCtrl_HitTest(hwnd, &tci);
- if (i != -1 && i != tabdat->iBeginIndex)
- RearrangeTab(tabdat->hwndDrag, tabdat->dragDat, MAKELONG(i, 0xffff), tabdat->fSavePos);
- tabdat->hwndDrag = (HWND) - 1;
- tabdat->dragDat = NULL;
- if (tabdat->himlDrag) {
- ImageList_RemoveAll(tabdat->himlDrag);
- ImageList_Destroy(tabdat->himlDrag);
- tabdat->himlDrag = 0;
- }
- }
- if (tabdat->fCloseButton) {
- POINT pt;
-
- GetCursorPos(&pt);
- int iItem = TabCtrl_TestForCloseButton(tabdat, hwnd, pt);
- if (iItem != -1)
- SendMessage(GetParent(hwnd), DM_CLOSETABATMOUSE, 0, (LPARAM)&pt);
- }
- }
- break;
+ case WM_ERASEBKGND:
+ if (tabdat->pContainer && (CSkin::m_skinEnabled || M->isAero()))
+ return TRUE;
+ return 0;
- case WM_ERASEBKGND:
- if (tabdat->pContainer && (CSkin::m_skinEnabled || M->isAero()))
- return TRUE;
- return 0;
- case WM_PAINT: {
+ case WM_PAINT:
+ {
PAINTSTRUCT ps;
HDC hdcreal, hdc;
RECT rectTemp, rctPage, rctActive, rcItem, rctClip, rctOrig;
@@ -1056,10 +1055,10 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara hdcreal = BeginPaint(hwnd, &ps);
/*
- * switchbar is active, don't paint a single pixel, the tab control won't be visible at all
- * same when we have only ONE tab and do not want it to be visible because of the container
- * option "Show tab bar only when needed".
- */
+ * switchbar is active, don't paint a single pixel, the tab control won't be visible at all
+ * same when we have only ONE tab and do not want it to be visible because of the container
+ * option "Show tab bar only when needed".
+ */
if ((tabdat->pContainer->dwFlags & CNT_SIDEBAR) || (nCount == 1 && tabdat->pContainer->dwFlags & CNT_HIDETABS)) {
if (nCount == 0)
@@ -1076,8 +1075,8 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara cy = rctPage.bottom - rctPage.top;
/*
- * draw everything to a memory dc to avoid flickering
- */
+ * draw everything to a memory dc to avoid flickering
+ */
if (CMimAPI::m_haveBufferedPaint)
hpb = tabdat->hbp = CSkin::InitiateBufferedPaint(hdcreal, rctPage, hdc);
@@ -1124,8 +1123,8 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara hPenOld = (HPEN)SelectObject(hdc, PluginConfig.tabConfig.m_hPenLight);
/*
- * visual style support
- */
+ * visual style support
+ */
CopyRect(&rcTabPage, &rctPage);
if (!tabdat->bRefreshWithoutClip)
@@ -1152,7 +1151,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara if (!item->IGNORED) {
DrawAlpha(hdc, &rctPage, item->COLOR, item->ALPHA, item->COLOR2, item->COLOR2_TRANSPARENT,
- item->GRADIENT, item->CORNER, item->BORDERSTYLE, item->imageItem);
+ item->GRADIENT, item->CORNER, item->BORDERSTYLE, item->imageItem);
goto page_done;
}
}
@@ -1233,9 +1232,9 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara }
page_done:
/*
- * if aero is active _and_ the infopanel is visible in the current window, we "flatten" out the top area
- * of the tab page by overpainting it black (thus it will appear transparent)
- */
+ * if aero is active _and_ the infopanel is visible in the current window, we "flatten" out the top area
+ * of the tab page by overpainting it black (thus it will appear transparent)
+ */
if (isAero && tabdat->helperDat) {
RECT rcLog, rcPage;
POINT pt;
@@ -1260,8 +1259,8 @@ page_done: uiFlags = 0;
/*
- * figure out hottracked item (if any)
- */
+ * figure out hottracked item (if any)
+ */
if (tabdat->bRefreshWithoutClip)
goto skip_tabs;
@@ -1298,8 +1297,8 @@ page_done: }
}
/*
- * draw the active item
- */
+ * draw the active item
+ */
if (!bClassicDraw && uiBottom) {
rctActive.top -= PluginConfig.tabConfig.m_bottomAdjust;
rctActive.bottom -= PluginConfig.tabConfig.m_bottomAdjust;
@@ -1342,15 +1341,15 @@ skip_tabs: SelectObject(hdc, hPenOld);
/*
- * finally, bitblt the contents of the memory dc to the real dc
- */
+ * finally, bitblt the contents of the memory dc to the real dc
+ */
//if (!tabdat->pContainer->bSkinned)
if (!tabdat->bRefreshWithoutClip)
ExcludeClipRect(hdcreal, rctClip.left, rctClip.top, rctClip.right, rctClip.bottom);
if (hpb)
CSkin::FinalizeBufferedPaint(hpb, &rctOrig);
- //CMimAPI::m_pfnEndBufferedPaint(hpb, TRUE);
+ //CMimAPI::m_pfnEndBufferedPaint(hpb, TRUE);
else {
BitBlt(hdcreal, 0, 0, cx, cy, hdc, 0, 0, SRCCOPY);
SelectObject(hdc, bmpOld);
@@ -1358,47 +1357,49 @@ skip_tabs: DeleteDC(hdc);
}
EndPaint(hwnd, &ps);
- return 0;
}
- case WM_TIMER: {
- if (wParam == TIMERID_HOVER_T && M->GetByte("d_tooltips", 0)) {
- POINT pt;
- CLCINFOTIP ti = {0};
- ti.cbSize = sizeof(ti);
-
- KillTimer(hwnd, TIMERID_HOVER_T);
- GetCursorPos(&pt);
- if (abs(pt.x - ptMouseT.x) < 5 && abs(pt.y - ptMouseT.y) < 5) {
- TCITEM item = {0};
- int nItem = 0;
- struct TWindowData *dat = 0;
-
- ti.ptCursor = pt;
- //ScreenToClient(hwnd, &pt);
-
- item.mask = TCIF_PARAM;
- nItem = GetTabItemFromMouse(hwnd, &pt);
- if (nItem >= 0 && nItem < TabCtrl_GetItemCount(hwnd)) {
- TabCtrl_GetItem(hwnd, nItem, &item);
- /*
- * get the message window data for the session to which this tab item belongs
- */
-
- if (IsWindow((HWND)item.lParam) && item.lParam != 0)
- dat = (struct TWindowData *)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
- if (dat) {
- tabdat->fTipActive = TRUE;
- ti.isGroup = 0;
- ti.hItem = dat->hContact;
- ti.isTreeFocused = 0;
- CallService("mToolTip/ShowTip", 0, (LPARAM)&ti);
- }
+ return 0;
+
+ case WM_TIMER:
+ if (wParam == TIMERID_HOVER_T && M->GetByte("d_tooltips", 0)) {
+ POINT pt;
+ CLCINFOTIP ti = {0};
+ ti.cbSize = sizeof(ti);
+
+ KillTimer(hwnd, TIMERID_HOVER_T);
+ GetCursorPos(&pt);
+ if (abs(pt.x - ptMouseT.x) < 5 && abs(pt.y - ptMouseT.y) < 5) {
+ TCITEM item = {0};
+ int nItem = 0;
+ struct TWindowData *dat = 0;
+
+ ti.ptCursor = pt;
+ //ScreenToClient(hwnd, &pt);
+
+ item.mask = TCIF_PARAM;
+ nItem = GetTabItemFromMouse(hwnd, &pt);
+ if (nItem >= 0 && nItem < TabCtrl_GetItemCount(hwnd)) {
+ TabCtrl_GetItem(hwnd, nItem, &item);
+ /*
+ * get the message window data for the session to which this tab item belongs
+ */
+
+ if (IsWindow((HWND)item.lParam) && item.lParam != 0)
+ dat = (struct TWindowData *)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
+ if (dat) {
+ tabdat->fTipActive = TRUE;
+ ti.isGroup = 0;
+ ti.hItem = dat->hContact;
+ ti.isTreeFocused = 0;
+ CallService("mToolTip/ShowTip", 0, (LPARAM)&ti);
}
}
}
- break;
}
- case WM_MOUSEWHEEL: {
+ break;
+
+ case WM_MOUSEWHEEL:
+ {
short amount = (short)(HIWORD(wParam));
if (lParam != -1)
break;
@@ -1407,21 +1408,21 @@ skip_tabs: else if (amount < 0)
SendMessage(GetParent(hwnd), DM_SELECTTAB, DM_SELECT_NEXT, 0);
InvalidateRect(hwnd, NULL, FALSE);
- break;
}
- case WM_USER + 100: {
- if (tabdat->fTipActive) {
- tabdat->fTipActive = FALSE;
- CallService("mToolTip/HideTip", 0, 0);
- }
+ break;
+
+ case WM_USER + 100:
+ if (tabdat->fTipActive) {
+ tabdat->fTipActive = FALSE;
+ CallService("mToolTip/HideTip", 0, 0);
}
}
return CallWindowProc(OldTabControlClassProc, hwnd, msg, wParam, lParam);
}
/*
- * load the tab control configuration data (colors, fonts, flags...
- */
+* load the tab control configuration data (colors, fonts, flags...
+*/
void TSAPI ReloadTabConfig()
{
@@ -1475,116 +1476,113 @@ void TSAPI FreeTabConfig() }
/*
- * options dialog for setting up tab options
- */
+* options dialog for setting up tab options
+*/
static bool tconfig_init = false;
INT_PTR CALLBACK DlgProcTabConfig(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
- case WM_INITDIALOG: {
- tconfig_init = false;
- TranslateDialogDefault(hwndDlg);
- SendMessage(hwndDlg, WM_USER + 100, 0, 0);
- tconfig_init = true;
- return TRUE;
- }
- case WM_USER + 100: {
- DWORD dwFlags = M->GetDword("tabconfig", TCF_DEFAULT);
- int i = 0;
-
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPIN, UDM_SETRANGE, 0, MAKELONG(10, 0));
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPIN, UDM_SETPOS, 0, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder" : "tborder", 2));
- SetDlgItemInt(hwndDlg, IDC_TABBORDER, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder" : "tborder", 2), FALSE);;
-
- SendDlgItemMessage(hwndDlg, IDC_BOTTOMTABADJUSTSPIN, UDM_SETRANGE, 0, MAKELONG(3, -3));
- SendDlgItemMessage(hwndDlg, IDC_BOTTOMTABADJUSTSPIN, UDM_SETPOS, 0, PluginConfig.tabConfig.m_bottomAdjust);
- SetDlgItemInt(hwndDlg, IDC_BOTTOMTABADJUST, PluginConfig.tabConfig.m_bottomAdjust, TRUE);
-
- SendDlgItemMessage(hwndDlg, IDC_TABWIDTHSPIN, UDM_SETRANGE, 0, MAKELONG(400, 50));
- SendDlgItemMessage(hwndDlg, IDC_TABWIDTHSPIN, UDM_SETPOS, 0, PluginConfig.tabConfig.m_fixedwidth);
- SetDlgItemInt(hwndDlg, IDC_TABWIDTH, PluginConfig.tabConfig.m_fixedwidth, TRUE);
-
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTER, UDM_SETRANGE, 0, MAKELONG(50, 0));
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERRIGHT, UDM_SETRANGE, 0, MAKELONG(50, 0));
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERTOP, UDM_SETRANGE, 0, MAKELONG(40, 0));
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERBOTTOM, UDM_SETRANGE, 0, MAKELONG(40, 0));
-
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTER, UDM_SETPOS, 0, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_left" : "tborder_outer_left", 2));
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERRIGHT, UDM_SETPOS, 0, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_right" : "tborder_outer_right", 2));
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERTOP, UDM_SETPOS, 0, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_top" : "tborder_outer_top", 2));
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERBOTTOM, UDM_SETPOS, 0, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_bottom" : "tborder_outer_bottom", 2));
-
- SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETRANGE, 0, MAKELONG(10, 1));
- SendDlgItemMessage(hwndDlg, IDC_SPIN3, UDM_SETRANGE, 0, MAKELONG(10, 1));
- SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETPOS, 0, (LPARAM)M->GetByte("y-pad", 3));
- SendDlgItemMessage(hwndDlg, IDC_SPIN3, UDM_SETPOS, 0, (LPARAM)M->GetByte("x-pad", 4));
- SetDlgItemInt(hwndDlg, IDC_TABPADDING, (int)M->GetByte("y-pad", 3), FALSE);;
- SetDlgItemInt(hwndDlg, IDC_HTABPADDING, (int)M->GetByte("x-pad", 4), FALSE);;
- return 0;
- }
- case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY: {
- int i = 0;
- BOOL translated;
- int fixedWidth;
-
- struct TContainerData *pContainer = pFirstContainer;
-
- M->WriteByte(SRMSGMOD_T, "y-pad", (BYTE)(GetDlgItemInt(hwndDlg, IDC_TABPADDING, NULL, FALSE)));
- M->WriteByte(SRMSGMOD_T, "x-pad", (BYTE)(GetDlgItemInt(hwndDlg, IDC_HTABPADDING, NULL, FALSE)));
- M->WriteByte(SRMSGMOD_T, "tborder", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDER, &translated, FALSE));
- M->WriteByte(SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_left" : "tborder_outer_left", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTER, &translated, FALSE));
- M->WriteByte(SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_right" : "tborder_outer_right", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERRIGHT, &translated, FALSE));
- M->WriteByte(SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_top" : "tborder_outer_top", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERTOP, &translated, FALSE));
- M->WriteByte(SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_bottom" : "tborder_outer_bottom", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERBOTTOM, &translated, FALSE));
- M->WriteDword(SRMSGMOD_T, "bottomadjust", GetDlgItemInt(hwndDlg, IDC_BOTTOMTABADJUST, &translated, TRUE));
-
- fixedWidth = GetDlgItemInt(hwndDlg, IDC_TABWIDTH, &translated, FALSE);
- fixedWidth = (fixedWidth < 60 ? 60 : fixedWidth);
- M->WriteDword(SRMSGMOD_T, "fixedwidth", fixedWidth);
- FreeTabConfig();
- ReloadTabConfig();
- while (pContainer) {
- TabCtrl_SetPadding(GetDlgItem(pContainer->hwnd, IDC_MSGTABS), GetDlgItemInt(hwndDlg, IDC_HTABPADDING, NULL, FALSE), GetDlgItemInt(hwndDlg, IDC_TABPADDING, NULL, FALSE));
- RedrawWindow(GetDlgItem(pContainer->hwnd, IDC_MSGTABS), NULL, NULL, RDW_INVALIDATE | RDW_ERASE);
- pContainer = pContainer->pNextContainer;
- }
- return TRUE;
- }
+ case WM_INITDIALOG:
+ tconfig_init = false;
+ TranslateDialogDefault(hwndDlg);
+ SendMessage(hwndDlg, WM_USER + 100, 0, 0);
+ tconfig_init = true;
+ return TRUE;
+
+ case WM_USER + 100:
+ SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPIN, UDM_SETRANGE, 0, MAKELONG(10, 0));
+ SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPIN, UDM_SETPOS, 0, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder" : "tborder", 2));
+ SetDlgItemInt(hwndDlg, IDC_TABBORDER, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder" : "tborder", 2), FALSE);;
+
+ SendDlgItemMessage(hwndDlg, IDC_BOTTOMTABADJUSTSPIN, UDM_SETRANGE, 0, MAKELONG(3, -3));
+ SendDlgItemMessage(hwndDlg, IDC_BOTTOMTABADJUSTSPIN, UDM_SETPOS, 0, PluginConfig.tabConfig.m_bottomAdjust);
+ SetDlgItemInt(hwndDlg, IDC_BOTTOMTABADJUST, PluginConfig.tabConfig.m_bottomAdjust, TRUE);
+
+ SendDlgItemMessage(hwndDlg, IDC_TABWIDTHSPIN, UDM_SETRANGE, 0, MAKELONG(400, 50));
+ SendDlgItemMessage(hwndDlg, IDC_TABWIDTHSPIN, UDM_SETPOS, 0, PluginConfig.tabConfig.m_fixedwidth);
+ SetDlgItemInt(hwndDlg, IDC_TABWIDTH, PluginConfig.tabConfig.m_fixedwidth, TRUE);
+
+ SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTER, UDM_SETRANGE, 0, MAKELONG(50, 0));
+ SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERRIGHT, UDM_SETRANGE, 0, MAKELONG(50, 0));
+ SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERTOP, UDM_SETRANGE, 0, MAKELONG(40, 0));
+ SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERBOTTOM, UDM_SETRANGE, 0, MAKELONG(40, 0));
+
+ SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTER, UDM_SETPOS, 0, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_left" : "tborder_outer_left", 2));
+ SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERRIGHT, UDM_SETPOS, 0, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_right" : "tborder_outer_right", 2));
+ SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERTOP, UDM_SETPOS, 0, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_top" : "tborder_outer_top", 2));
+ SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERBOTTOM, UDM_SETPOS, 0, (int)M->GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_bottom" : "tborder_outer_bottom", 2));
+
+ SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETRANGE, 0, MAKELONG(10, 1));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN3, UDM_SETRANGE, 0, MAKELONG(10, 1));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETPOS, 0, (LPARAM)M->GetByte("y-pad", 3));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN3, UDM_SETPOS, 0, (LPARAM)M->GetByte("x-pad", 4));
+ SetDlgItemInt(hwndDlg, IDC_TABPADDING, (int)M->GetByte("y-pad", 3), FALSE);;
+ SetDlgItemInt(hwndDlg, IDC_HTABPADDING, (int)M->GetByte("x-pad", 4), FALSE);;
+ return 0;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR) lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR) lParam)->code) {
+ case PSN_APPLY:
+ {
+ BOOL translated;
+ int fixedWidth;
+
+ struct TContainerData *pContainer = pFirstContainer;
+
+ M->WriteByte(SRMSGMOD_T, "y-pad", (BYTE)(GetDlgItemInt(hwndDlg, IDC_TABPADDING, NULL, FALSE)));
+ M->WriteByte(SRMSGMOD_T, "x-pad", (BYTE)(GetDlgItemInt(hwndDlg, IDC_HTABPADDING, NULL, FALSE)));
+ M->WriteByte(SRMSGMOD_T, "tborder", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDER, &translated, FALSE));
+ M->WriteByte(SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_left" : "tborder_outer_left", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTER, &translated, FALSE));
+ M->WriteByte(SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_right" : "tborder_outer_right", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERRIGHT, &translated, FALSE));
+ M->WriteByte(SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_top" : "tborder_outer_top", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERTOP, &translated, FALSE));
+ M->WriteByte(SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_bottom" : "tborder_outer_bottom", (BYTE) GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERBOTTOM, &translated, FALSE));
+ M->WriteDword(SRMSGMOD_T, "bottomadjust", GetDlgItemInt(hwndDlg, IDC_BOTTOMTABADJUST, &translated, TRUE));
+
+ fixedWidth = GetDlgItemInt(hwndDlg, IDC_TABWIDTH, &translated, FALSE);
+ fixedWidth = (fixedWidth < 60 ? 60 : fixedWidth);
+ M->WriteDword(SRMSGMOD_T, "fixedwidth", fixedWidth);
+ FreeTabConfig();
+ ReloadTabConfig();
+ while (pContainer) {
+ TabCtrl_SetPadding(GetDlgItem(pContainer->hwnd, IDC_MSGTABS), GetDlgItemInt(hwndDlg, IDC_HTABPADDING, NULL, FALSE), GetDlgItemInt(hwndDlg, IDC_TABPADDING, NULL, FALSE));
+ RedrawWindow(GetDlgItem(pContainer->hwnd, IDC_MSGTABS), NULL, NULL, RDW_INVALIDATE | RDW_ERASE);
+ pContainer = pContainer->pNextContainer;
}
- break;
+ return TRUE;
+ }
}
break;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_TABWIDTH:
- case IDC_TABPADDING:
- case IDC_HTABPADDING:
- case IDC_TABBORDER:
- case IDC_TABBORDEROUTER:
- case IDC_TABBORDEROUTERBOTTOM:
- case IDC_TABBORDEROUTERRIGHT:
- case IDC_TABBORDEROUTERTOP:
- if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
- return TRUE;
- break;
-
- default:
- break;
+ }
+ break;
- }
- if (tconfig_init)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_TABWIDTH:
+ case IDC_TABPADDING:
+ case IDC_HTABPADDING:
+ case IDC_TABBORDER:
+ case IDC_TABBORDEROUTER:
+ case IDC_TABBORDEROUTERBOTTOM:
+ case IDC_TABBORDEROUTERRIGHT:
+ case IDC_TABBORDEROUTERTOP:
+ if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
+ return TRUE;
+ break;
+
+ default:
break;
- case WM_DESTROY:
- tconfig_init = false;
+ }
+ if (tconfig_init)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case WM_DESTROY:
+ tconfig_init = false;
}
return FALSE;
}
-
diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp index 24880019a5..e98e222075 100644 --- a/plugins/TabSRMM/src/templates.cpp +++ b/plugins/TabSRMM/src/templates.cpp @@ -136,13 +136,13 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
switch (msg) {
- case WM_INITDIALOG: {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ {
TemplateEditorNew *teNew = (TemplateEditorNew *)lParam;
COLORREF url_visited = RGB(128, 0, 128);
COLORREF url_unvisited = RGB(0, 0, 255);
- dat = (struct TWindowData *) malloc(sizeof(struct TWindowData));
-
- TranslateDialogDefault(hwndDlg);
+ dat = (TWindowData*)calloc( sizeof(TWindowData), 1);
ZeroMemory((void*) dat, sizeof(struct TWindowData));
dat->pContainer = (struct TContainerData *)malloc(sizeof(struct TContainerData));
@@ -197,120 +197,128 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_COLOR4, CPM_SETCOLOUR, 0, M->GetDword("cc4", SRMSGDEFSET_BKGCOLOUR));
SendDlgItemMessage(hwndDlg, IDC_COLOR5, CPM_SETCOLOUR, 0, M->GetDword("cc5", SRMSGDEFSET_BKGCOLOUR));
SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, TRUE, 0);
- return(TRUE);
}
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDCANCEL:
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDCANCEL:
+ DestroyWindow(hwndDlg);
+ break;
+
+ case IDC_RESETALLTEMPLATES:
+ if (MessageBox(0, TranslateT("This will reset the template set to the default built-in templates. Are you sure you want to do this?"),
+ TranslateT("Template Set Editor"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
+ M->WriteByte(teInfo->rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, "setup", 0);
+ LoadDefaultTemplates();
+ MessageBox(0, TranslateT("Template set was successfully reset, please close and reopen all message windows. This template editor window will now close."),
+ TranslateT("Template Set Editor"), MB_OK);
DestroyWindow(hwndDlg);
- break;
- case IDC_RESETALLTEMPLATES:
- if (MessageBox(0, TranslateT("This will reset the template set to the default built-in templates. Are you sure you want to do this?"),
- TranslateT("Template Set Editor"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
- M->WriteByte(teInfo->rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, "setup", 0);
- LoadDefaultTemplates();
- MessageBox(0, TranslateT("Template set was successfully reset, please close and reopen all message windows. This template editor window will now close."),
- TranslateT("Template Set Editor"), MB_OK);
- DestroyWindow(hwndDlg);
- }
- break;
- case IDC_TEMPLATELIST:
- switch (HIWORD(wParam)) {
- case LBN_DBLCLK: {
- LRESULT iIndex = SendDlgItemMessage(hwndDlg, IDC_TEMPLATELIST, LB_GETCURSEL, 0, 0);
- if (iIndex != LB_ERR) {
- SetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[iIndex]);
- teInfo->inEdit = iIndex;
- teInfo->changed = FALSE;
- teInfo->selchanging = FALSE;
- SetFocus(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE));
- SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, FALSE, 0);
- }
- break;
- }
- case LBN_SELCHANGE: {
- LRESULT iIndex = SendDlgItemMessage(hwndDlg, IDC_TEMPLATELIST, LB_GETCURSEL, 0, 0);
- teInfo->selchanging = TRUE;
- if (iIndex != LB_ERR) {
- SetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[iIndex]);
- teInfo->inEdit = iIndex;
- teInfo->changed = FALSE;
- }
- SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, TRUE, 0);
- break;
- }
- }
- break;
- case IDC_VARIABLESHELP:
- CallService(MS_UTILS_OPENURL, 0, (LPARAM)"http://wiki.miranda.or.at/TabSRMM/Templates");
- break;
- case IDC_EDITTEMPLATE:
- if (HIWORD(wParam) == EN_CHANGE) {
- if (!teInfo->selchanging) {
- teInfo->changed = TRUE;
- teInfo->updateInfo[teInfo->inEdit] = TRUE;
- Utils::enableDlgControl(hwndDlg, IDC_SAVETEMPLATE, TRUE);
- Utils::enableDlgControl(hwndDlg, IDC_FORGET, TRUE);
- Utils::enableDlgControl(hwndDlg, IDC_TEMPLATELIST, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_REVERT, TRUE);
- }
- InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE);
- }
- break;
- case IDC_SAVETEMPLATE: {
- TCHAR newTemplate[TEMPLATE_LENGTH + 2];
-
- GetWindowText(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), newTemplate, TEMPLATE_LENGTH);
- CopyMemory(tSet->szTemplates[teInfo->inEdit], newTemplate, sizeof(TCHAR) * TEMPLATE_LENGTH);
- teInfo->changed = FALSE;
- teInfo->updateInfo[teInfo->inEdit] = FALSE;
- Utils::enableDlgControl(hwndDlg, IDC_SAVETEMPLATE, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_FORGET, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_TEMPLATELIST, TRUE);
- Utils::enableDlgControl(hwndDlg, IDC_REVERT, FALSE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE);
- M->WriteTString(teInfo->hContact, teInfo->rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, TemplateNames[teInfo->inEdit], newTemplate);
- SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, TRUE, 0);
- break;
- }
- case IDC_FORGET: {
+ }
+ break;
+
+ case IDC_TEMPLATELIST:
+ switch (HIWORD(wParam)) {
+ LRESULT iIndex;
+ case LBN_DBLCLK:
+ iIndex = SendDlgItemMessage(hwndDlg, IDC_TEMPLATELIST, LB_GETCURSEL, 0, 0);
+ if (iIndex != LB_ERR) {
+ SetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[iIndex]);
+ teInfo->inEdit = iIndex;
teInfo->changed = FALSE;
- teInfo->updateInfo[teInfo->inEdit] = FALSE;
- teInfo->selchanging = TRUE;
- SetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[teInfo->inEdit]);
- SetFocus(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE));
- InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_SAVETEMPLATE, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_FORGET, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_TEMPLATELIST, TRUE);
- Utils::enableDlgControl(hwndDlg, IDC_REVERT, FALSE);
teInfo->selchanging = FALSE;
- SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, TRUE, 0);
- break;
+ SetFocus(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE));
+ SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, FALSE, 0);
}
- case IDC_REVERT: {
+ break;
+
+ case LBN_SELCHANGE:
+ iIndex = SendDlgItemMessage(hwndDlg, IDC_TEMPLATELIST, LB_GETCURSEL, 0, 0);
+ teInfo->selchanging = TRUE;
+ if (iIndex != LB_ERR) {
+ SetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[iIndex]);
+ teInfo->inEdit = iIndex;
teInfo->changed = FALSE;
- teInfo->updateInfo[teInfo->inEdit] = FALSE;
- teInfo->selchanging = TRUE;
- CopyMemory(tSet->szTemplates[teInfo->inEdit], LTR_Default.szTemplates[teInfo->inEdit], sizeof(TCHAR) * TEMPLATE_LENGTH);
- SetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[teInfo->inEdit]);
- DBDeleteContactSetting(teInfo->hContact, teInfo->rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, TemplateNames[teInfo->inEdit]);
- SetFocus(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE));
- InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE);
- teInfo->selchanging = FALSE;
- Utils::enableDlgControl(hwndDlg, IDC_SAVETEMPLATE, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_REVERT, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_FORGET, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_TEMPLATELIST, TRUE);
- SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, TRUE, 0);
- break;
}
- case IDC_UPDATEPREVIEW:
- SendMessage(hwndDlg, DM_UPDATETEMPLATEPREVIEW, 0, 0);
- break;
+ SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, TRUE, 0);
+ }
+ break;
+
+ case IDC_VARIABLESHELP:
+ CallService(MS_UTILS_OPENURL, 0, (LPARAM)"http://wiki.miranda.or.at/TabSRMM/Templates");
+ break;
+
+ case IDC_EDITTEMPLATE:
+ if (HIWORD(wParam) == EN_CHANGE) {
+ if (!teInfo->selchanging) {
+ teInfo->changed = TRUE;
+ teInfo->updateInfo[teInfo->inEdit] = TRUE;
+ Utils::enableDlgControl(hwndDlg, IDC_SAVETEMPLATE, TRUE);
+ Utils::enableDlgControl(hwndDlg, IDC_FORGET, TRUE);
+ Utils::enableDlgControl(hwndDlg, IDC_TEMPLATELIST, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_REVERT, TRUE);
+ }
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE);
+ }
+ break;
+ case IDC_SAVETEMPLATE:
+ {
+ TCHAR newTemplate[TEMPLATE_LENGTH + 2];
+
+ GetWindowText(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), newTemplate, TEMPLATE_LENGTH);
+ CopyMemory(tSet->szTemplates[teInfo->inEdit], newTemplate, sizeof(TCHAR) * TEMPLATE_LENGTH);
+ teInfo->changed = FALSE;
+ teInfo->updateInfo[teInfo->inEdit] = FALSE;
+ Utils::enableDlgControl(hwndDlg, IDC_SAVETEMPLATE, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_FORGET, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_TEMPLATELIST, TRUE);
+ Utils::enableDlgControl(hwndDlg, IDC_REVERT, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE);
+ M->WriteTString(teInfo->hContact, teInfo->rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, TemplateNames[teInfo->inEdit], newTemplate);
+ SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, TRUE, 0);
}
break;
- case WM_DRAWITEM: {
+
+ case IDC_FORGET:
+ teInfo->changed = FALSE;
+ teInfo->updateInfo[teInfo->inEdit] = FALSE;
+ teInfo->selchanging = TRUE;
+ SetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[teInfo->inEdit]);
+ SetFocus(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE));
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_SAVETEMPLATE, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_FORGET, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_TEMPLATELIST, TRUE);
+ Utils::enableDlgControl(hwndDlg, IDC_REVERT, FALSE);
+ teInfo->selchanging = FALSE;
+ SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, TRUE, 0);
+ break;
+
+ case IDC_REVERT:
+ teInfo->changed = FALSE;
+ teInfo->updateInfo[teInfo->inEdit] = FALSE;
+ teInfo->selchanging = TRUE;
+ CopyMemory(tSet->szTemplates[teInfo->inEdit], LTR_Default.szTemplates[teInfo->inEdit], sizeof(TCHAR) * TEMPLATE_LENGTH);
+ SetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[teInfo->inEdit]);
+ DBDeleteContactSetting(teInfo->hContact, teInfo->rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, TemplateNames[teInfo->inEdit]);
+ SetFocus(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE));
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE);
+ teInfo->selchanging = FALSE;
+ Utils::enableDlgControl(hwndDlg, IDC_SAVETEMPLATE, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_REVERT, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_FORGET, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_TEMPLATELIST, TRUE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), EM_SETREADONLY, TRUE, 0);
+ break;
+
+ case IDC_UPDATEPREVIEW:
+ SendMessage(hwndDlg, DM_UPDATETEMPLATEPREVIEW, 0, 0);
+ break;
+ }
+ break;
+
+ case WM_DRAWITEM:
+ {
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
int iItem = dis->itemData;
HBRUSH bkg, oldBkg;
@@ -335,57 +343,58 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
char *pszName = Translate(TemplateNames[iItem]);
TextOutA(dis->hDC, dis->rcItem.left, dis->rcItem.top, pszName, lstrlenA(pszName));
- return(TRUE);
}
- case DM_UPDATETEMPLATEPREVIEW: {
- DBEVENTINFO dbei = {0};
- int iIndex = SendDlgItemMessage(hwndDlg, IDC_TEMPLATELIST, LB_GETCURSEL, 0, 0);
- TCHAR szTemp[TEMPLATE_LENGTH + 2];
-
- if (teInfo->changed) {
- CopyMemory(szTemp, tSet->szTemplates[teInfo->inEdit], TEMPLATE_LENGTH * sizeof(TCHAR));
- GetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[teInfo->inEdit], TEMPLATE_LENGTH);
- }
- dbei.szModule = dat->szProto;
- dbei.timestamp = time(NULL);
- dbei.eventType = (iIndex == 6) ? EVENTTYPE_STATUSCHANGE : EVENTTYPE_MESSAGE;
- dbei.eventType = (iIndex == 7) ? EVENTTYPE_ERRMSG : dbei.eventType;
- if (dbei.eventType == EVENTTYPE_ERRMSG)
- dbei.szModule = "Sample error message";
- dbei.cbSize = sizeof(dbei);
- dbei.pBlob = (iIndex == 6) ? (BYTE *)"is now offline (was online)" : (BYTE *)"The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.";
- dbei.cbBlob = lstrlenA((char *)dbei.pBlob) + 1;
- dbei.flags = (iIndex == 1 || iIndex == 3 || iIndex == 5) ? DBEF_SENT : 0;
- dbei.flags |= (teInfo->rtl ? DBEF_RTL : 0);
- dat->lastEventTime = (iIndex == 4 || iIndex == 5) ? time(NULL) - 1 : 0;
- dat->iLastEventType = MAKELONG(dbei.flags, dbei.eventType);
- SetWindowText(GetDlgItem(hwndDlg, IDC_PREVIEW), _T(""));
- dat->dwFlags = MWF_LOG_ALL;
- dat->dwFlags = (teInfo->rtl ? dat->dwFlags | MWF_LOG_RTL : dat->dwFlags & ~MWF_LOG_RTL);
- dat->dwFlags = (iIndex == 0 || iIndex == 1) ? dat->dwFlags & ~MWF_LOG_GROUPMODE : dat->dwFlags | MWF_LOG_GROUPMODE;
- mir_sntprintf(dat->szMyNickname, safe_sizeof(dat->szMyNickname), _T("My Nickname"));
- StreamInEvents(hwndDlg, 0, 1, 1, &dbei);
- SendDlgItemMessage(hwndDlg, IDC_PREVIEW, EM_SETSEL, -1, -1);
- if (teInfo->changed)
- CopyMemory(tSet->szTemplates[teInfo->inEdit], szTemp, TEMPLATE_LENGTH * sizeof(TCHAR));
- break;
+ return(TRUE);
+
+ case DM_UPDATETEMPLATEPREVIEW: {
+ DBEVENTINFO dbei = {0};
+ int iIndex = SendDlgItemMessage(hwndDlg, IDC_TEMPLATELIST, LB_GETCURSEL, 0, 0);
+ TCHAR szTemp[TEMPLATE_LENGTH + 2];
+
+ if (teInfo->changed) {
+ CopyMemory(szTemp, tSet->szTemplates[teInfo->inEdit], TEMPLATE_LENGTH * sizeof(TCHAR));
+ GetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[teInfo->inEdit], TEMPLATE_LENGTH);
}
- case WM_DESTROY:
- Utils::enableDlgControl(teInfo->hwndParent, IDC_MODIFY, TRUE);
- Utils::enableDlgControl(teInfo->hwndParent, IDC_RTLMODIFY, TRUE);
- if (dat->pContainer)
- free(dat->pContainer);
- if (dat)
- free(dat);
-
- M->WriteDword(SRMSGMOD_T, "cc1", SendDlgItemMessage(hwndDlg, IDC_COLOR1, CPM_GETCOLOUR, 0, 0));
- M->WriteDword(SRMSGMOD_T, "cc2", SendDlgItemMessage(hwndDlg, IDC_COLOR2, CPM_GETCOLOUR, 0, 0));
- M->WriteDword(SRMSGMOD_T, "cc3", SendDlgItemMessage(hwndDlg, IDC_COLOR3, CPM_GETCOLOUR, 0, 0));
- M->WriteDword(SRMSGMOD_T, "cc4", SendDlgItemMessage(hwndDlg, IDC_COLOR4, CPM_GETCOLOUR, 0, 0));
- M->WriteDword(SRMSGMOD_T, "cc5", SendDlgItemMessage(hwndDlg, IDC_COLOR5, CPM_GETCOLOUR, 0, 0));
-
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
- break;
+ dbei.szModule = dat->szProto;
+ dbei.timestamp = time(NULL);
+ dbei.eventType = (iIndex == 6) ? EVENTTYPE_STATUSCHANGE : EVENTTYPE_MESSAGE;
+ dbei.eventType = (iIndex == 7) ? EVENTTYPE_ERRMSG : dbei.eventType;
+ if (dbei.eventType == EVENTTYPE_ERRMSG)
+ dbei.szModule = "Sample error message";
+ dbei.cbSize = sizeof(dbei);
+ dbei.pBlob = (iIndex == 6) ? (BYTE *)"is now offline (was online)" : (BYTE *)"The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.";
+ dbei.cbBlob = lstrlenA((char *)dbei.pBlob) + 1;
+ dbei.flags = (iIndex == 1 || iIndex == 3 || iIndex == 5) ? DBEF_SENT : 0;
+ dbei.flags |= (teInfo->rtl ? DBEF_RTL : 0);
+ dat->lastEventTime = (iIndex == 4 || iIndex == 5) ? time(NULL) - 1 : 0;
+ dat->iLastEventType = MAKELONG(dbei.flags, dbei.eventType);
+ SetWindowText(GetDlgItem(hwndDlg, IDC_PREVIEW), _T(""));
+ dat->dwFlags = MWF_LOG_ALL;
+ dat->dwFlags = (teInfo->rtl ? dat->dwFlags | MWF_LOG_RTL : dat->dwFlags & ~MWF_LOG_RTL);
+ dat->dwFlags = (iIndex == 0 || iIndex == 1) ? dat->dwFlags & ~MWF_LOG_GROUPMODE : dat->dwFlags | MWF_LOG_GROUPMODE;
+ mir_sntprintf(dat->szMyNickname, safe_sizeof(dat->szMyNickname), _T("My Nickname"));
+ StreamInEvents(hwndDlg, 0, 1, 1, &dbei);
+ SendDlgItemMessage(hwndDlg, IDC_PREVIEW, EM_SETSEL, -1, -1);
+ if (teInfo->changed)
+ CopyMemory(tSet->szTemplates[teInfo->inEdit], szTemp, TEMPLATE_LENGTH * sizeof(TCHAR));
+ break;
+ }
+ case WM_DESTROY:
+ Utils::enableDlgControl(teInfo->hwndParent, IDC_MODIFY, TRUE);
+ Utils::enableDlgControl(teInfo->hwndParent, IDC_RTLMODIFY, TRUE);
+ if (dat->pContainer)
+ free(dat->pContainer);
+ if (dat)
+ free(dat);
+
+ M->WriteDword(SRMSGMOD_T, "cc1", SendDlgItemMessage(hwndDlg, IDC_COLOR1, CPM_GETCOLOUR, 0, 0));
+ M->WriteDword(SRMSGMOD_T, "cc2", SendDlgItemMessage(hwndDlg, IDC_COLOR2, CPM_GETCOLOUR, 0, 0));
+ M->WriteDword(SRMSGMOD_T, "cc3", SendDlgItemMessage(hwndDlg, IDC_COLOR3, CPM_GETCOLOUR, 0, 0));
+ M->WriteDword(SRMSGMOD_T, "cc4", SendDlgItemMessage(hwndDlg, IDC_COLOR4, CPM_GETCOLOUR, 0, 0));
+ M->WriteDword(SRMSGMOD_T, "cc5", SendDlgItemMessage(hwndDlg, IDC_COLOR5, CPM_GETCOLOUR, 0, 0));
+
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
+ break;
}
return(FALSE);
}
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index 05b5631bfd..9afa313492 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -2260,9 +2260,8 @@ void CSkin::DrawDimmedIcon(HDC hdc, LONG left, LONG top, LONG dx, LONG dy, HICON DeleteDC(dcMem);
}
-UINT CSkin::NcCalcRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID, UINT msg, WPARAM wParam, LPARAM lParam, WNDPROC OldWndProc)
+UINT CSkin::NcCalcRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID, UINT msg, WPARAM wParam, LPARAM lParam, WNDPROC MyWndProc)
{
- LRESULT orig = 0;
NCCALCSIZE_PARAMS *nccp = (NCCALCSIZE_PARAMS *)lParam;
BOOL bReturn = FALSE;
@@ -2271,8 +2270,8 @@ UINT CSkin::NcCalcRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID EnableScrollBar(hwnd, SB_VERT, ESB_DISABLE_BOTH);
ShowScrollBar(hwnd, SB_VERT, FALSE);
}
- if (OldWndProc)
- orig = CallWindowProc(OldWndProc, hwnd, msg, wParam, lParam);
+
+ LRESULT orig = mir_callNextSubclass(hwnd, MyWndProc, msg, wParam, lParam);
if (0 == mwdat)
return(orig);
@@ -2313,12 +2312,7 @@ UINT CSkin::NcCalcRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID UINT CSkin::DrawRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID, UINT msg, WPARAM wParam, LPARAM lParam, WNDPROC OldWndProc)
{
- CSkinItem *item = &SkinItems[skinID];
- LRESULT result = 0;
-
- if (OldWndProc)
- result = CallWindowProc(OldWndProc, hwnd, msg, wParam, lParam); // do default processing (otherwise, NO scrollbar as it is painted in NC_PAINT)
-
+ LRESULT result = mir_callNextSubclass(hwnd, OldWndProc, msg, wParam, lParam); // do default processing (otherwise, NO scrollbar as it is painted in NC_PAINT)
if (0 == mwdat)
return result;
@@ -2341,6 +2335,7 @@ UINT CSkin::DrawRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID, left_off -= PluginConfig.m_ncm.iScrollWidth;
top_off = pt.y - rcWindow.top;
+ CSkinItem *item = &SkinItems[skinID];
if (CSkin::m_skinEnabled && !item->IGNORED) {
right_off = item->MARGIN_RIGHT;
bottom_off = item->MARGIN_BOTTOM;
|