summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r--plugins/TabSRMM/src/commonheaders.h1
-rw-r--r--plugins/TabSRMM/src/container.cpp79
-rw-r--r--plugins/TabSRMM/src/functions.h4
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp8
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp7
-rw-r--r--plugins/TabSRMM/src/msgs.cpp4
-rw-r--r--plugins/TabSRMM/src/srmm.cpp27
-rw-r--r--plugins/TabSRMM/src/tabctrl.cpp431
-rw-r--r--plugins/TabSRMM/src/themes.h3
9 files changed, 266 insertions, 298 deletions
diff --git a/plugins/TabSRMM/src/commonheaders.h b/plugins/TabSRMM/src/commonheaders.h
index 6270ea6e5e..25ad68af2f 100644
--- a/plugins/TabSRMM/src/commonheaders.h
+++ b/plugins/TabSRMM/src/commonheaders.h
@@ -34,6 +34,7 @@
#define _WIN32_IE 0x0501
#include <windows.h>
+#include <windowsx.h>
#include <commdlg.h>
#include <shellapi.h>
#include <uxtheme.h>
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index de77b7330f..ff57ba13d4 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -532,8 +532,8 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
// make the tab control the controlling parent window for all message dialogs
- ws = GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSGTABS), GWL_EXSTYLE);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSGTABS), GWL_EXSTYLE, ws | WS_EX_CONTROLPARENT);
+ ws = GetWindowLongPtr(hwndTab, GWL_EXSTYLE);
+ SetWindowLongPtr(hwndTab, GWL_EXSTYLE, ws | WS_EX_CONTROLPARENT);
LONG x_pad = M.GetByte("x-pad", 3) + (pContainer->dwFlagsEx & TCF_CLOSEBUTTON ? 7 : 0);
LONG y_pad = M.GetByte("y-pad", 3) + ((pContainer->dwFlags & CNT_TABSBOTTOM) ? 1 : 0);
@@ -541,9 +541,9 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
if (pContainer->dwFlagsEx & TCF_FLAT)
y_pad++; //(pContainer->dwFlags & CNT_TABSBOTTOM ? 1 : 2);
- TabCtrl_SetPadding(GetDlgItem(hwndDlg, IDC_MSGTABS), x_pad, y_pad);
+ TabCtrl_SetPadding(hwndTab, x_pad, y_pad);
- TabCtrl_SetImageList(GetDlgItem(hwndDlg, IDC_MSGTABS), PluginConfig.g_hImageList);
+ TabCtrl_SetImageList(hwndTab, PluginConfig.g_hImageList);
SendMessage(hwndDlg, DM_CONFIGURECONTAINER, 0, 10);
@@ -557,7 +557,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
if (pContainer->hwndTip) {
SetWindowPos(pContainer->hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
- TabCtrl_SetToolTips(GetDlgItem(hwndDlg, IDC_MSGTABS), pContainer->hwndTip);
+ TabCtrl_SetToolTips(hwndTab, pContainer->hwndTip);
}
}
else pContainer->hwndTip = 0;
@@ -801,9 +801,8 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
TCITEM item = { 0 };
TWindowData *dat = 0;
- POINT pt, pt1;
+ POINT pt;
GetCursorPos(&pt);
- pt1 = pt;
HMENU subMenu = GetSubMenu(pContainer->hMenuContext, 0);
if (((LPNMHDR)lParam)->idFrom == IDC_MSGTABS) {
@@ -825,7 +824,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
if (dat)
MsgWindowUpdateMenu(dat, subMenu, MENU_TABCONTEXT);
- int iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt1.x, pt1.y, 0, hwndDlg, NULL);
+ int iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
if (iSelection >= IDM_CONTAINERMENU) {
char szIndex[10];
itoa(iSelection - IDM_CONTAINERMENU, szIndex, 10);
@@ -841,7 +840,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
if (fFromSidebar)
SendMessage(dat->hwnd, WM_CLOSE, 1, 0);
else
- SendMessage(hwndDlg, DM_CLOSETABATMOUSE, 0, (LPARAM)&pt1);
+ SendMessage(hwndDlg, DM_CLOSETABATMOUSE, 0, (LPARAM)&pt);
break;
case ID_TABMENU_CLOSEOTHERTABS:
CloseOtherTabs(hwndTab, *dat);
@@ -863,7 +862,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
}
break;
case ID_TABMENU_ATTACHTOCONTAINER:
- if ((iItem = GetTabItemFromMouse(hwndTab, &pt1)) == -1)
+ if ((iItem = GetTabItemFromMouse(hwndTab, &pt)) == -1)
break;
memset(&item, 0, sizeof(item));
item.mask = TCIF_PARAM;
@@ -951,7 +950,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
case WM_ENTERSIZEMOVE:
{
RECT rc;
- GetClientRect(GetDlgItem(hwndDlg, IDC_MSGTABS), &rc);
+ GetClientRect(hwndTab, &rc);
SIZE sz;
sz.cx = rc.right - rc.left;
@@ -964,7 +963,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
case WM_EXITSIZEMOVE:
{
RECT rc;
- GetClientRect(GetDlgItem(hwndDlg, IDC_MSGTABS), &rc);
+ GetClientRect(hwndTab, &rc);
if (!((rc.right - rc.left) == pContainer->oldSize.cx && (rc.bottom - rc.top) == pContainer->oldSize.cy)) {
TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
DM_ScrollToBottom(dat, 0, 0);
@@ -987,12 +986,12 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
MINMAXINFO *mmi = (MINMAXINFO *)lParam;
mmi->ptMinTrackSize.x = 275;
mmi->ptMinTrackSize.y = 130;
- GetClientRect(GetDlgItem(hwndDlg, IDC_MSGTABS), &rc);
+ GetClientRect(hwndTab, &rc);
if (pContainer->hwndActive) // at container creation time, there is no hwndActive yet..
GetClientRect(pContainer->hwndActive, &rcClient);
GetWindowRect(hwndDlg, &rcWindow);
pt.y = rc.top;
- TabCtrl_AdjustRect(GetDlgItem(hwndDlg, IDC_MSGTABS), FALSE, &rc);
+ TabCtrl_AdjustRect(hwndTab, FALSE, &rc);
// uChildMinHeight holds the min height for the client window only
// so let's add the container's vertical padding (title bar, tab bar,
// window border, status bar) to this value
@@ -1278,6 +1277,15 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
}
break;
+ case WM_MOUSEMOVE:
+ { /* wine: fix for erase/paint tab on mouse enter/leave tab. */
+ POINT pt;
+ GetCursorPos(&pt);
+ ScreenToClient(hwndTab, &pt);
+ SendMessage(hwndTab, WM_MOUSEMOVE, wParam, (LPARAM)&pt);
+ }
+ break;
+
case DM_CLOSETABATMOUSE:
{
HWND hwndCurrent = pContainer->hwndActive;
@@ -1455,14 +1463,14 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
pContainer->SideBar->Init();
- ws = wsold = GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSGTABS), GWL_STYLE);
+ ws = wsold = GetWindowLongPtr(hwndTab, GWL_STYLE);
if (pContainer->dwFlags & CNT_TABSBOTTOM)
ws |= (TCS_BOTTOM);
else
ws &= ~(TCS_BOTTOM);
if ((ws & (TCS_BOTTOM | TCS_MULTILINE)) != (wsold & (TCS_BOTTOM | TCS_MULTILINE))) {
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSGTABS), GWL_STYLE, ws);
- RedrawWindow(GetDlgItem(hwndDlg, IDC_MSGTABS), NULL, NULL, RDW_INVALIDATE);
+ SetWindowLongPtr(hwndTab, GWL_STYLE, ws);
+ RedrawWindow(hwndTab, NULL, NULL, RDW_INVALIDATE);
}
if (pContainer->dwFlags & CNT_NOSTATUSBAR) {
@@ -1695,7 +1703,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
}
// dont ask if container is empty (no tabs)
- if (lParam == 0 && TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_MSGTABS)) > 0) {
+ if (lParam == 0 && TabCtrl_GetItemCount(hwndTab) > 0) {
int clients = TabCtrl_GetItemCount(hwndTab), iOpenJobs = 0;
TCITEM item = { 0 };
@@ -1879,29 +1887,12 @@ int TSAPI GetTabIndexFromHWND(HWND hwndTab, HWND hwnd)
return -1;
}
-// search the list of tabs and return the tab (by index) which "belongs" to the given
-// hwnd. The hwnd is the handle of a message dialog childwindow. At creation,
-// the dialog handle is stored in the TCITEM.lParam field, because we need
-// to know the owner of the tab.
-//
-// hwndTab: handle of the tab control itself.
-// hwnd: handle of a message dialog.
-//
-// returns the tab index (zero based), -1 if no tab is found (which SHOULD not
-// really happen, but who knows... ;))
-
HWND TSAPI GetHWNDFromTabIndex(HWND hwndTab, int idx)
{
- int iItems = TabCtrl_GetItemCount(hwndTab);
-
TCITEM item = { 0 };
item.mask = TCIF_PARAM;
- for (int i = 0; i < iItems; i++) {
- TabCtrl_GetItem(hwndTab, i, &item);
- if (i == idx)
- return (HWND)item.lParam;
- }
- return NULL;
+ TabCtrl_GetItem(hwndTab, idx, &item);
+ return (HWND)item.lParam;
}
// activates the tab belonging to the given client HWND (handle of the actual
@@ -1921,20 +1912,6 @@ int TSAPI ActivateTabFromHWND(HWND hwndTab, HWND hwnd)
return -1;
}
-// returns the index of the tab under the mouse pointer. Used for
-// context menu popup and tooltips
-// pt: mouse coordinates, obtained from GetCursorPos()
-
-int TSAPI GetTabItemFromMouse(HWND hwndTab, POINT *pt)
-{
- ScreenToClient(hwndTab, pt);
-
- TCHITTESTINFO tch;
- tch.pt = *pt;
- tch.flags = 0;
- return TabCtrl_HitTest(hwndTab, &tch);
-}
-
// enumerates tabs and closes all of them, but the one in dat
void TSAPI CloseOtherTabs(HWND hwndTab, TWindowData &dat)
{
diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h
index 062db0a300..d4d3057920 100644
--- a/plugins/TabSRMM/src/functions.h
+++ b/plugins/TabSRMM/src/functions.h
@@ -139,7 +139,9 @@ int TSAPI UnloadTSButtonModule();
/*
* debugging support
*/
-
+#if defined(__LOGDEBUG_)
+int _DebugTraceW(const wchar_t *fmt, ...);
+#endif
int _DebugPopup(MCONTACT hContact, const TCHAR *fmt, ...);
int _DebugMessage(HWND hwndDlg, TWindowData *dat, const char *fmt, ...);
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index a5d59698ad..4cdb399389 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -1166,11 +1166,11 @@ HWND TSAPI DM_CreateClist(TWindowData *dat)
LRESULT TSAPI DM_MouseWheelHandler(HWND hwnd, HWND hwndParent, TWindowData *mwdat, WPARAM wParam, LPARAM lParam)
{
+ POINT pt;
RECT rc, rc1;
UINT uID = mwdat->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_CHAT_LOG;
UINT uIDMsg = mwdat->bType == SESSIONTYPE_IM ? IDC_MESSAGE : IDC_CHAT_MESSAGE;
- POINT pt;
GetCursorPos(&pt);
GetWindowRect(hwnd, &rc);
if (PtInRect(&rc, pt))
@@ -1218,11 +1218,7 @@ LRESULT TSAPI DM_MouseWheelHandler(HWND hwnd, HWND hwndParent, TWindowData *mwda
}
HWND hwndTab = GetDlgItem(mwdat->pContainer->hwnd, IDC_MSGTABS);
- TCHITTESTINFO hti;
- GetCursorPos(&hti.pt);
- ScreenToClient(hwndTab, &hti.pt);
- hti.flags = 0;
- if (TabCtrl_HitTest(hwndTab, &hti) != -1) {
+ if (GetTabItemFromMouse(hwndTab, &pt) != -1) {
SendMessage(hwndTab, WM_MOUSEWHEEL, wParam, -1);
return 0;
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 8945853bd9..6e992dacb1 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -2334,8 +2334,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
StreamInEvents(hwndDlg, wParam, 1, 1, NULL);
return 0;
- // replays queued events after the message log has been frozen for a while
- case DM_REPLAYQUEUE:
+ case DM_REPLAYQUEUE: // replays queued events after the message log has been frozen for a while
for (int i = 0; i < dat->iNextQueuedEvent; i++)
if (dat->hQueuedEvents[i] != 0)
StreamInEvents(hwndDlg, dat->hQueuedEvents[i], 1, 1, NULL);
@@ -2384,7 +2383,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
// for single message sends: basevalue (TIMERID_MSGSEND) + send queue index
if (wParam >= TIMERID_MSGSEND) {
int iIndex = wParam - TIMERID_MSGSEND;
- if (iIndex < SendQueue::NR_SENDJOBS) { // single sendjob timer
+ if (iIndex < SendQueue::NR_SENDJOBS) { // single sendjob timer
SendJob *job = sendQueue->getJobByIndex(iIndex);
KillTimer(hwndDlg, wParam);
mir_sntprintf(job->szErrorMsg, SIZEOF(job->szErrorMsg), TranslateT("Delivery failure: %s"),
@@ -2415,7 +2414,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (dat->dwFlags & MWF_ERRORSTATE) {
dat->cache->saveHistory(0, 0);
if (wParam == MSGERROR_SENDLATER)
- sendQueue->doSendLater(dat->iCurrentQueueError, dat); // to be implemented at a later time
+ sendQueue->doSendLater(dat->iCurrentQueueError, dat); // to be implemented at a later time
dat->iOpenJobs--;
sendQueue->dec();
if (dat->iCurrentQueueError >= 0 && dat->iCurrentQueueError < SendQueue::NR_SENDJOBS)
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index ddc593297d..fc4d66b153 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -526,7 +526,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact,
int newItem = TabCtrl_InsertItem(hwndTab, pContainer->iTabIndex, &newData.item);
SendMessage(hwndTab, EM_REFRESHWITHOUTCLIP, 0, 0);
if (bActivateTab)
- TabCtrl_SetCurSel(GetDlgItem(pContainer->hwnd, IDC_MSGTABS), newItem);
+ TabCtrl_SetCurSel(hwndTab, newItem);
newData.iTabID = newItem;
newData.iTabImage = newData.item.iImage;
newData.pContainer = pContainer;
@@ -534,7 +534,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact,
pContainer->iChilds++;
newData.bWantPopup = bWantPopup;
newData.hdbEvent = hdbEvent;
- HWND hwndNew = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGSPLITNEW), GetDlgItem(pContainer->hwnd, IDC_MSGTABS), DlgProcMessage, (LPARAM)&newData);
+ HWND hwndNew = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGSPLITNEW), hwndTab, DlgProcMessage, (LPARAM)&newData);
// switchbar support
if (pContainer->dwFlags & CNT_SIDEBAR) {
diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp
index 1e307ff698..afe680f635 100644
--- a/plugins/TabSRMM/src/srmm.cpp
+++ b/plugins/TabSRMM/src/srmm.cpp
@@ -142,33 +142,6 @@ int _DebugTraceW(const wchar_t *fmt, ...)
return 0;
}
-int _DebugTraceA(const char *fmt, ...)
-{
- char debug[2048];
- int ibsize = 2047;
- va_list va;
- va_start(va, fmt);
-
- mir_strcpy(debug, "TABSRMM: ");
- mir_vsnprintf(&debug[9], ibsize - 10, fmt, va);
-#ifdef _DEBUG
- OutputDebugStringA(debug);
-#else
- {
- char szLogFileName[MAX_PATH], szDataPath[MAX_PATH];
- CallService(MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM)szDataPath);
- mir_snprintf(szLogFileName, SIZEOF(szLogFileName), "%s\\tabsrmm_debug.log", szDataPath);
- FILE *f = fopen(szLogFileName, "a+");
- if (f) {
- fputs(debug, f);
- fputs("\n", f);
- fclose(f);
- }
- }
-#endif
- return 0;
-}
-
/*
* output a notification message.
* may accept a hContact to include the contacts nickname in the notification message...
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp
index e200dd0bda..da55d7f0da 100644
--- a/plugins/TabSRMM/src/tabctrl.cpp
+++ b/plugins/TabSRMM/src/tabctrl.cpp
@@ -33,35 +33,46 @@ static WNDPROC OldTabControlClassProc;
#define FIXED_TAB_SIZE 100
-static int TabCtrl_TestForCloseButton(const TabControlData *tabdat, HWND hwnd, POINT& pt)
+// returns the index of the tab under the mouse pointer. Used for
+// context menu popup and tooltips
+// pt: mouse coordinates, obtained from GetCursorPos()
+
+int TSAPI GetTabItemFromMouse(HWND hwndTab, POINT *pt)
+{
+ TCHITTESTINFO tch;
+ tch.pt = (*pt);
+ tch.flags = 0;
+ ScreenToClient(hwndTab, &tch.pt);
+
+ return TabCtrl_HitTest(hwndTab, &tch);
+}
+
+static int TabCtrl_TestForCloseButton(const TabControlData *tabdat, HWND hwnd, POINT *pt)
{
- TCHITTESTINFO tci = { 0 };
- tci.pt.x = pt.x;
- tci.pt.y = pt.y;
int iTab;
+ RECT rcTab;
+ TCHITTESTINFO tci;
+ tci.pt = (*pt);
+ tci.flags = 0;
ScreenToClient(hwnd, &tci.pt);
iTab = TabCtrl_HitTest(hwnd, &tci);
- if (iTab != -1) {
- RECT rcTab;
+ if (iTab == -1 || (tci.flags & TCHT_NOWHERE))
+ return -1;
- if (tci.flags & TCHT_NOWHERE)
- return -1;
-
- TabCtrl_GetItemRect(hwnd, iTab, &rcTab);
- if (tabdat->dwStyle & TCS_BUTTONS) {
- rcTab.right -= 1;
- rcTab.left = rcTab.right - 18;
- }
- else {
- rcTab.left = rcTab.right - 18;
- rcTab.right -= 5;
- }
- rcTab.bottom -= 4;
- rcTab.top += 4;
- if (PtInRect(&rcTab, tci.pt))
- return(iTab);
+ TabCtrl_GetItemRect(hwnd, iTab, &rcTab);
+ if (tabdat->dwStyle & TCS_BUTTONS) {
+ rcTab.right -= 1;
+ rcTab.left = rcTab.right - 18;
+ }
+ else {
+ rcTab.left = rcTab.right - 18;
+ rcTab.right -= 5;
}
+ rcTab.bottom -= 4;
+ rcTab.top += 4;
+ if (PtInRect(&rcTab, tci.pt))
+ return (iTab);
return -1;
}
@@ -231,146 +242,146 @@ static void DrawItemRect(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint
DWORD dwStyle = tabdat->dwStyle;
rcItem->bottom -= 1;
- if (rcItem->left >= 0) {
+ if (rcItem->left < 0)
+ return;
- // draw "button style" tabs... raised edge for hottracked, sunken edge for active (pushed)
- // otherwise, they get a normal border
- if (dwStyle & TCS_BUTTONS) {
- BOOL bClassicDraw = (tabdat->m_VisualStyles == FALSE);
+ // draw "button style" tabs... raised edge for hottracked, sunken edge for active (pushed)
+ // otherwise, they get a normal border
+ if (dwStyle & TCS_BUTTONS) {
+ BOOL bClassicDraw = (tabdat->m_VisualStyles == FALSE);
- // draw frame controls for button or bottom tabs
- if (dwStyle & TCS_BOTTOM)
- rcItem->top++;
+ // draw frame controls for button or bottom tabs
+ if (dwStyle & TCS_BOTTOM)
+ rcItem->top++;
- rcItem->right += 6;
- if (tabdat->fAeroTabs) {
- if (M.isAero()) {
- InflateRect(rcItem, 2, 0);
- FillRect(dc, rcItem, CSkin::m_BrushBack);
- }
- else if (dat) {
- int iStateId = (nHint & HINT_ACTIVE_ITEM ? PBS_PRESSED : 0) | (nHint & HINT_HOTTRACK ? PBS_HOT : 0);
+ rcItem->right += 6;
+ if (tabdat->fAeroTabs) {
+ if (M.isAero()) {
+ InflateRect(rcItem, 2, 0);
+ FillRect(dc, rcItem, CSkin::m_BrushBack);
+ }
+ else if (dat) {
+ int iStateId = (nHint & HINT_ACTIVE_ITEM ? PBS_PRESSED : 0) | (nHint & HINT_HOTTRACK ? PBS_HOT : 0);
- InflateRect(rcItem, 1, 0);
- FillTabBackground(dc, iStateId, dat, rcItem);
- }
- CSkin::m_switchBarItem->setAlphaFormat(AC_SRC_ALPHA, nHint & HINT_ACTIVE_ITEM ? 255 : 200);
- CSkin::m_switchBarItem->Render(dc, rcItem, true);
+ InflateRect(rcItem, 1, 0);
+ FillTabBackground(dc, iStateId, dat, rcItem);
+ }
+ CSkin::m_switchBarItem->setAlphaFormat(AC_SRC_ALPHA, nHint & HINT_ACTIVE_ITEM ? 255 : 200);
+ CSkin::m_switchBarItem->Render(dc, rcItem, true);
- if (nHint & HINT_ACTIVE_ITEM || nHint & HINT_HOTTRACK) {
- RECT rcGlow = *rcItem;
+ if (nHint & HINT_ACTIVE_ITEM || nHint & HINT_HOTTRACK) {
+ RECT rcGlow = *rcItem;
- if (dwStyle & TCS_BOTTOM)
- rcGlow.top++;
- else
- rcGlow.bottom--;
+ if (dwStyle & TCS_BOTTOM)
+ rcGlow.top++;
+ else
+ rcGlow.bottom--;
- tabdat->helperGlowItem->setAlphaFormat(AC_SRC_ALPHA, nHint & HINT_ACTIVE_ITEM ? 200 : 150);
- tabdat->helperGlowItem->Render(dc, &rcGlow, true);
- }
+ tabdat->helperGlowItem->setAlphaFormat(AC_SRC_ALPHA, nHint & HINT_ACTIVE_ITEM ? 200 : 150);
+ tabdat->helperGlowItem->Render(dc, &rcGlow, true);
}
- else if (bClassicDraw) {
- if (CSkin::m_skinEnabled) {
- CSkinItem *item = nHint & HINT_ACTIVE_ITEM ? &SkinItems[ID_EXTBKBUTTONSPRESSED] : (nHint & HINT_HOTTRACK ? &SkinItems[ID_EXTBKBUTTONSMOUSEOVER] : &SkinItems[ID_EXTBKBUTTONSNPRESSED]);
+ }
+ else if (bClassicDraw) {
+ if (CSkin::m_skinEnabled) {
+ CSkinItem *item = nHint & HINT_ACTIVE_ITEM ? &SkinItems[ID_EXTBKBUTTONSPRESSED] : (nHint & HINT_HOTTRACK ? &SkinItems[ID_EXTBKBUTTONSMOUSEOVER] : &SkinItems[ID_EXTBKBUTTONSNPRESSED]);
- if (!item->IGNORED) {
- CSkin::SkinDrawBG(tabdat->hwnd, tabdat->pContainer->hwnd, tabdat->pContainer, rcItem, dc);
- CSkin::DrawItem(dc, rcItem, item);
- }
- else
- goto b_nonskinned;
- }
- else {
- b_nonskinned:
- if (nHint & HINT_ACTIVE_ITEM)
- DrawEdge(dc, rcItem, EDGE_ETCHED, BF_RECT | BF_SOFT);
- else if (nHint & HINT_HOTTRACK)
- DrawEdge(dc, rcItem, EDGE_BUMP, BF_RECT | BF_MONO | BF_SOFT);
- else
- DrawEdge(dc, rcItem, EDGE_RAISED, BF_RECT | BF_SOFT);
+ if (!item->IGNORED) {
+ CSkin::SkinDrawBG(tabdat->hwnd, tabdat->pContainer->hwnd, tabdat->pContainer, rcItem, dc);
+ CSkin::DrawItem(dc, rcItem, item);
}
+ else
+ goto b_nonskinned;
}
else {
- if (M.isAero() && !(dwStyle & TCS_BOTTOM))
- FillRect(dc, rcItem, CSkin::m_BrushBack);
+ b_nonskinned:
+ if (nHint & HINT_ACTIVE_ITEM)
+ DrawEdge(dc, rcItem, EDGE_ETCHED, BF_RECT | BF_SOFT);
+ else if (nHint & HINT_HOTTRACK)
+ DrawEdge(dc, rcItem, EDGE_BUMP, BF_RECT | BF_MONO | BF_SOFT);
else
- CSkin::FillBack(dc, rcItem);
- DrawThemeBackground(tabdat->hThemeButton, dc, 1, nHint & HINT_ACTIVE_ITEM ? 3 : (nHint & HINT_HOTTRACK ? 2 : 1), rcItem, rcItem);
+ DrawEdge(dc, rcItem, EDGE_RAISED, BF_RECT | BF_SOFT);
}
- return;
}
- SelectObject(dc, PluginConfig.tabConfig.m_hPenLight);
+ else {
+ if (M.isAero() && !(dwStyle & TCS_BOTTOM))
+ FillRect(dc, rcItem, CSkin::m_BrushBack);
+ else
+ CSkin::FillBack(dc, rcItem);
+ DrawThemeBackground(tabdat->hThemeButton, dc, 1, nHint & HINT_ACTIVE_ITEM ? 3 : (nHint & HINT_HOTTRACK ? 2 : 1), rcItem, rcItem);
+ }
+ return;
+ }
+ SelectObject(dc, PluginConfig.tabConfig.m_hPenLight);
- if (nHint & HINT_ACTIVE_ITEM) {
- if (dwStyle & TCS_BOTTOM) {
- if (!CSkin::m_skinEnabled)
- CSkin::FillBack(dc, rcItem);
- rcItem->bottom += 2;
- }
- else {
- rcItem->bottom += 2;
- if (!CSkin::m_skinEnabled)
- CSkin::FillBack(dc, rcItem);
- rcItem->bottom--;
- rcItem->top -= 2;
- }
- if (CSkin::m_skinEnabled) {
- CSkinItem *item = &SkinItems[dwStyle & TCS_BOTTOM ? ID_EXTBKTABITEMACTIVEBOTTOM : ID_EXTBKTABITEMACTIVE];
- if (!item->IGNORED) {
- rcItem->left += item->MARGIN_LEFT;
- rcItem->right -= item->MARGIN_RIGHT;
- rcItem->top += item->MARGIN_TOP;
- rcItem->bottom -= item->MARGIN_BOTTOM;
- CSkin::DrawItem(dc, rcItem, item);
- return;
- }
- }
+ if (nHint & HINT_ACTIVE_ITEM) {
+ if (dwStyle & TCS_BOTTOM) {
+ if (!CSkin::m_skinEnabled)
+ CSkin::FillBack(dc, rcItem);
+ rcItem->bottom += 2;
+ }
+ else {
+ rcItem->bottom += 2;
+ if (!CSkin::m_skinEnabled)
+ CSkin::FillBack(dc, rcItem);
+ rcItem->bottom--;
+ rcItem->top -= 2;
}
if (CSkin::m_skinEnabled) {
- CSkinItem *item = &SkinItems[dwStyle & TCS_BOTTOM ? (nHint & HINT_HOTTRACK ? ID_EXTBKTABITEMHOTTRACKBOTTOM : ID_EXTBKTABITEMBOTTOM) :
- (nHint & HINT_HOTTRACK ? ID_EXTBKTABITEMHOTTRACK : ID_EXTBKTABITEM)];
+ CSkinItem *item = &SkinItems[dwStyle & TCS_BOTTOM ? ID_EXTBKTABITEMACTIVEBOTTOM : ID_EXTBKTABITEMACTIVE];
if (!item->IGNORED) {
- if (dwStyle & TCS_BOTTOM)
- rcItem->top = (rcItem->top > rcTabPage.bottom + 5) ? --rcItem->top : rcItem->top;
- else
- rcItem->bottom++;
-
rcItem->left += item->MARGIN_LEFT;
rcItem->right -= item->MARGIN_RIGHT;
+ rcItem->top += item->MARGIN_TOP;
+ rcItem->bottom -= item->MARGIN_BOTTOM;
CSkin::DrawItem(dc, rcItem, item);
return;
}
}
- if (dwStyle & TCS_BOTTOM) {
- MoveToEx(dc, rcItem->left, rcItem->top - (nHint & HINT_ACTIVE_ITEM ? 1 : 0), &pt);
- LineTo(dc, rcItem->left, rcItem->bottom - 2);
- LineTo(dc, rcItem->left + 2, rcItem->bottom);
- SelectObject(dc, PluginConfig.tabConfig.m_hPenShadow);
- LineTo(dc, rcItem->right - 3, rcItem->bottom);
-
- LineTo(dc, rcItem->right - 1, rcItem->bottom - 2);
- LineTo(dc, rcItem->right - 1, rcItem->top - 1);
- MoveToEx(dc, rcItem->right - 2, rcItem->top, &pt);
- SelectObject(dc, PluginConfig.tabConfig.m_hPenItemShadow);
- LineTo(dc, rcItem->right - 2, rcItem->bottom - 1);
- MoveToEx(dc, rcItem->right - 3, rcItem->bottom - 1, &pt);
- LineTo(dc, rcItem->left + 2, rcItem->bottom - 1);
- }
- else {
- MoveToEx(dc, rcItem->left, rcItem->bottom, &pt);
- LineTo(dc, rcItem->left, rcItem->top + 2);
- LineTo(dc, rcItem->left + 2, rcItem->top);
- LineTo(dc, rcItem->right - 2, rcItem->top);
- SelectObject(dc, PluginConfig.tabConfig.m_hPenItemShadow);
-
- MoveToEx(dc, rcItem->right - 2, rcItem->top + 1, &pt);
- LineTo(dc, rcItem->right - 2, rcItem->bottom + 1);
- SelectObject(dc, PluginConfig.tabConfig.m_hPenShadow);
- MoveToEx(dc, rcItem->right - 1, rcItem->top + 2, &pt);
- LineTo(dc, rcItem->right - 1, rcItem->bottom + 1);
+ }
+ if (CSkin::m_skinEnabled) {
+ CSkinItem *item = &SkinItems[dwStyle & TCS_BOTTOM ? (nHint & HINT_HOTTRACK ? ID_EXTBKTABITEMHOTTRACKBOTTOM : ID_EXTBKTABITEMBOTTOM) :
+ (nHint & HINT_HOTTRACK ? ID_EXTBKTABITEMHOTTRACK : ID_EXTBKTABITEM)];
+ if (!item->IGNORED) {
+ if (dwStyle & TCS_BOTTOM)
+ rcItem->top = (rcItem->top > rcTabPage.bottom + 5) ? --rcItem->top : rcItem->top;
+ else
+ rcItem->bottom++;
+
+ rcItem->left += item->MARGIN_LEFT;
+ rcItem->right -= item->MARGIN_RIGHT;
+ CSkin::DrawItem(dc, rcItem, item);
+ return;
}
}
+ if (dwStyle & TCS_BOTTOM) {
+ MoveToEx(dc, rcItem->left, rcItem->top - (nHint & HINT_ACTIVE_ITEM ? 1 : 0), &pt);
+ LineTo(dc, rcItem->left, rcItem->bottom - 2);
+ LineTo(dc, rcItem->left + 2, rcItem->bottom);
+ SelectObject(dc, PluginConfig.tabConfig.m_hPenShadow);
+ LineTo(dc, rcItem->right - 3, rcItem->bottom);
+
+ LineTo(dc, rcItem->right - 1, rcItem->bottom - 2);
+ LineTo(dc, rcItem->right - 1, rcItem->top - 1);
+ MoveToEx(dc, rcItem->right - 2, rcItem->top, &pt);
+ SelectObject(dc, PluginConfig.tabConfig.m_hPenItemShadow);
+ LineTo(dc, rcItem->right - 2, rcItem->bottom - 1);
+ MoveToEx(dc, rcItem->right - 3, rcItem->bottom - 1, &pt);
+ LineTo(dc, rcItem->left + 2, rcItem->bottom - 1);
+ }
+ else {
+ MoveToEx(dc, rcItem->left, rcItem->bottom, &pt);
+ LineTo(dc, rcItem->left, rcItem->top + 2);
+ LineTo(dc, rcItem->left + 2, rcItem->top);
+ LineTo(dc, rcItem->right - 2, rcItem->top);
+ SelectObject(dc, PluginConfig.tabConfig.m_hPenItemShadow);
+
+ MoveToEx(dc, rcItem->right - 2, rcItem->top + 1, &pt);
+ LineTo(dc, rcItem->right - 2, rcItem->bottom + 1);
+ SelectObject(dc, PluginConfig.tabConfig.m_hPenShadow);
+ MoveToEx(dc, rcItem->right - 1, rcItem->top + 2, &pt);
+ LineTo(dc, rcItem->right - 1, rcItem->bottom + 1);
+ }
}
static int DWordAlign(int n)
@@ -588,13 +599,19 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat)
DWORD dwStyle = tabdat->dwStyle;
UINT uiFlags = 1;
UINT uiBottom = 0;
- TCHITTESTINFO hti;
bool isAero = M.isAero();
HANDLE hpb = 0;
BOOL bClassicDraw = !isAero && (tabdat->m_VisualStyles == FALSE || CSkin::m_skinEnabled);
+
if (GetUpdateRect(hwnd, NULL, TRUE) == 0)
return;
+ GetCursorPos(&pt);
+ hotItem = GetTabItemFromMouse(hwnd, &pt);
+ if (tabdat->iHoveredTabIndex != hotItem)
+ InvalidateRect(hwnd, NULL, FALSE);
+ tabdat->iHoveredTabIndex = hotItem;
+
item.mask = TCIF_PARAM;
tabdat->fAeroTabs = (CSkin::m_fAeroSkinsValid && (isAero || PluginConfig.m_fillColor)) ? TRUE : FALSE;
@@ -606,7 +623,7 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat)
if (dat)
tabdat->helperDat = dat;
else
- tabdat->fAeroTabs = 0;
+ tabdat->fAeroTabs = FALSE;
tabdat->helperItem = (dwStyle & TCS_BOTTOM) ? CSkin::m_tabBottom : CSkin::m_tabTop;
tabdat->helperGlowItem = (dwStyle & TCS_BOTTOM) ? CSkin::m_tabGlowBottom : CSkin::m_tabGlowTop;
@@ -807,7 +824,6 @@ page_done:
}
GetWindowRect(GetDlgItem(tabdat->helperDat->hwnd, tabdat->helperDat->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_CHAT_LOG), &rcLog);
- POINT pt;
pt.y = rcLog.top;
pt.x = rcLog.left;
ScreenToClient(hwnd, &pt);
@@ -821,35 +837,31 @@ page_done:
if (tabdat->bRefreshWithoutClip)
goto skip_tabs;
- GetCursorPos(&hti.pt);
- ScreenToClient(hwnd, &hti.pt);
- hti.flags = 0;
- hotItem = TabCtrl_HitTest(hwnd, &hti);
for (i = 0; i < nCount; i++) {
TWindowData *dat = 0;
- if (i != iActive) {
- TabCtrl_GetItem(hwnd, i, &item);
- if (item.lParam)
- dat = (TWindowData*)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
- TabCtrl_GetItemRect(hwnd, i, &rcItem);
- if (!bClassicDraw && uiBottom) {
- rcItem.top -= PluginConfig.tabConfig.m_bottomAdjust;
- rcItem.bottom -= PluginConfig.tabConfig.m_bottomAdjust;
+ if (i == iActive)
+ continue;
+ TabCtrl_GetItem(hwnd, i, &item);
+ if (item.lParam)
+ dat = (TWindowData*)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
+ TabCtrl_GetItemRect(hwnd, i, &rcItem);
+ if (!bClassicDraw && uiBottom) {
+ rcItem.top -= PluginConfig.tabConfig.m_bottomAdjust;
+ rcItem.bottom -= PluginConfig.tabConfig.m_bottomAdjust;
+ }
+ if (IntersectRect(&rectTemp, &rcItem, &ps.rcPaint) || bClassicDraw) {
+ int nHint = 0;
+ if (!bClassicDraw && !(dwStyle & TCS_BUTTONS)) {
+ DrawThemesXpTabItem(hdc, &rcItem, uiFlags | uiBottom | (i == hotItem ? 4 : 0), tabdat, dat);
+ DrawItem(tabdat, hdc, &rcItem, nHint | (i == hotItem ? HINT_HOTTRACK : 0), i, dat);
}
- if (IntersectRect(&rectTemp, &rcItem, &ps.rcPaint) || bClassicDraw) {
- int nHint = 0;
- if (!bClassicDraw && !(dwStyle & TCS_BUTTONS)) {
- DrawThemesXpTabItem(hdc, &rcItem, uiFlags | uiBottom | (i == hotItem ? 4 : 0), tabdat, dat);
- DrawItem(tabdat, hdc, &rcItem, nHint | (i == hotItem ? HINT_HOTTRACK : 0), i, dat);
- }
- else {
- if (tabdat->fAeroTabs && !CSkin::m_skinEnabled && !(dwStyle & TCS_BUTTONS))
- DrawThemesPartWithAero(tabdat, hdc, 0, (i == hotItem ? PBS_HOT : PBS_NORMAL), &rcItem, dat);
- else
- DrawItemRect(tabdat, hdc, &rcItem, nHint | (i == hotItem ? HINT_HOTTRACK : 0), dat);
- DrawItem(tabdat, hdc, &rcItem, nHint | (i == hotItem ? HINT_HOTTRACK : 0), i, dat);
- }
+ else {
+ if (tabdat->fAeroTabs && !CSkin::m_skinEnabled && !(dwStyle & TCS_BUTTONS))
+ DrawThemesPartWithAero(tabdat, hdc, 0, (i == hotItem ? PBS_HOT : PBS_NORMAL), &rcItem, dat);
+ else
+ DrawItemRect(tabdat, hdc, &rcItem, nHint | (i == hotItem ? HINT_HOTTRACK : 0), dat);
+ DrawItem(tabdat, hdc, &rcItem, nHint | (i == hotItem ? HINT_HOTTRACK : 0), i, dat);
}
}
}
@@ -914,6 +926,7 @@ skip_tabs:
static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ POINT pt;
TabControlData *tabdat = (TabControlData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (tabdat) {
if (tabdat->pContainer == NULL)
@@ -921,8 +934,6 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
tabdat->dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
}
- POINT pt;
-
switch (msg) {
case WM_NCCREATE:
{
@@ -937,6 +948,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
tabdat->cx = GetSystemMetrics(SM_CXSMICON);
tabdat->cy = GetSystemMetrics(SM_CYSMICON);
tabdat->fTipActive = FALSE;
+ tabdat->iHoveredTabIndex = -1;
tabdat->iHoveredCloseIcon = -1;
SendMessage(hwnd, EM_THEMECHANGED, 0, 0);
}
@@ -984,6 +996,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
case TCM_INSERTITEM:
case TCM_DELETEITEM:
+ tabdat->iHoveredTabIndex = -1;
tabdat->iHoveredCloseIcon = -1;
if (!(tabdat->dwStyle & TCS_MULTILINE) || (tabdat->dwStyle & TCS_BUTTONS)) {
int iTabs = TabCtrl_GetItemCount(hwnd);
@@ -1021,6 +1034,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
case WM_SETCURSOR:
GetCursorPos(&pt);
+ InvalidateRect(hwnd, NULL, FALSE); /* wine: fix for erase/paint tab on mouse enter/leave tab. */
SendMessage(GetParent(hwnd), msg, wParam, lParam);
if (abs(pt.x - ptMouseT.x) < 4 && abs(pt.y - ptMouseT.y) < 4)
return 1;
@@ -1086,14 +1100,10 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
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) {
- tci.flags = TCHT_ONITEM;
-
- ScreenToClient(hwnd, &tci.pt);
- int i = TabCtrl_HitTest(hwnd, &tci);
+ pt.x = (short)LOWORD(GetMessagePos());
+ pt.y = (short)HIWORD(GetMessagePos());
+ if (DragDetect(hwnd, pt) && TabCtrl_GetItemCount(hwnd) > 1) {
+ int i = GetTabItemFromMouse(hwnd, &pt);
if (i != -1) {
TCITEM tc;
TWindowData *dat = NULL;
@@ -1110,7 +1120,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
tabdat->himlDrag = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 1, 0);
ImageList_AddIcon(tabdat->himlDrag, dat->hTabIcon);
ImageList_BeginDrag(tabdat->himlDrag, 0, 8, 8);
- ImageList_DragEnter(hwnd, tci.pt.x, tci.pt.y);
+ ImageList_DragEnter(hwnd, pt.x, pt.y);
SetCapture(hwnd);
}
return TRUE;
@@ -1119,15 +1129,10 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
}
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);
+ pt.x = (short)LOWORD(GetMessagePos());
+ pt.y = (short)HIWORD(GetMessagePos());
+ if (DragDetect(hwnd, pt) && TabCtrl_GetItemCount(hwnd) > 1) {
+ int i = GetTabItemFromMouse(hwnd, &pt);
if (i != -1) {
TCITEM tc;
tc.mask = TCIF_PARAM;
@@ -1143,7 +1148,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
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);
+ ImageList_DragEnter(hwnd, pt.x, pt.y);
SetCapture(hwnd);
}
return TRUE;
@@ -1153,7 +1158,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
if (tabdat->fCloseButton) {
GetCursorPos(&pt);
- if (TabCtrl_TestForCloseButton(tabdat, hwnd, pt) != -1)
+ if (TabCtrl_TestForCloseButton(tabdat, hwnd, &pt) != -1)
return TRUE;
}
break;
@@ -1171,37 +1176,46 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
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);
+ pt.x = GET_X_LPARAM(lParam);
+ pt.y = GET_Y_LPARAM(lParam);
+ ImageList_DragMove(pt.x, pt.y);
}
- if (tabdat->fCloseButton) {
- POINT pt;
+ {
GetCursorPos(&pt);
- int iOldHovered = tabdat->iHoveredCloseIcon;
- tabdat->iHoveredCloseIcon = TabCtrl_TestForCloseButton(tabdat, hwnd, pt);
- if (tabdat->iHoveredCloseIcon != iOldHovered)
+ int iOld = tabdat->iHoveredTabIndex;
+ tabdat->iHoveredTabIndex = GetTabItemFromMouse(hwnd, &pt);
+ if (tabdat->iHoveredTabIndex != iOld)
+ InvalidateRect(hwnd, NULL, FALSE);
+ if (tabdat->fCloseButton && tabdat->iHoveredTabIndex != -1) {
+ iOld = tabdat->iHoveredCloseIcon;
+ tabdat->iHoveredCloseIcon = TabCtrl_TestForCloseButton(tabdat, hwnd, &pt);
+ if (tabdat->iHoveredCloseIcon != iOld)
+ InvalidateRect(hwnd, NULL, FALSE);
+ }
+ }
+ break;
+
+ case WM_NCHITTEST: /* wine: fix for erase/paint tab on mouse enter/leave tab. */
+ {
+ LRESULT res = CallWindowProc(OldTabControlClassProc, hwnd, msg, wParam, lParam);
+ if (res != HTCLIENT)
InvalidateRect(hwnd, NULL, FALSE);
+ return (res);
}
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;
+ pt.x = (short)LOWORD(GetMessagePos());
+ pt.y = (short)HIWORD(GetMessagePos());
tabdat->bDragging = FALSE;
ImageList_DragLeave(hwnd);
ImageList_EndDrag();
- ScreenToClient(hwnd, &tci.pt);
- i = TabCtrl_HitTest(hwnd, &tci);
+ i = GetTabItemFromMouse(hwnd, &pt);
if (i != -1 && i != tabdat->iBeginIndex)
RearrangeTab(tabdat->hwndDrag, tabdat->dragDat, MAKELONG(i, 0xffff), tabdat->fSavePos);
tabdat->hwndDrag = (HWND)-1;
@@ -1213,9 +1227,8 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
}
}
if (tabdat->fCloseButton) {
- POINT pt;
GetCursorPos(&pt);
- int iItem = TabCtrl_TestForCloseButton(tabdat, hwnd, pt);
+ int iItem = TabCtrl_TestForCloseButton(tabdat, hwnd, &pt);
if (iItem != -1)
SendMessage(GetParent(hwnd), DM_CLOSETABATMOUSE, 0, (LPARAM)&pt);
}
@@ -1231,10 +1244,10 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
return 0;
case WM_TIMER:
+ InvalidateRect(hwnd, NULL, FALSE); /* wine: fix for erase/paint tab on mouse enter/leave tab. */
if (wParam == TIMERID_HOVER_T && M.GetByte("d_tooltips", 0)) {
KillTimer(hwnd, TIMERID_HOVER_T);
- POINT pt;
GetCursorPos(&pt);
if (abs(pt.x - ptMouseT.x) < 5 && abs(pt.y - ptMouseT.y) < 5) {
CLCINFOTIP ti = { 0 };
@@ -1276,12 +1289,17 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
}
break;
- case WM_USER + 100:
+ case WM_USER + 100:
if (tabdat->fTipActive) {
tabdat->fTipActive = FALSE;
CallService("mToolTip/HideTip", 0, 0);
}
+ break;
}
+
+#if defined(__LOGDEBUG_)
+ _DebugTraceW(L"msg: %hu", msg);
+#endif
return CallWindowProc(OldTabControlClassProc, hwnd, msg, wParam, lParam);
}
@@ -1403,8 +1421,9 @@ INT_PTR CALLBACK DlgProcTabConfig(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
ReloadTabConfig();
for (TContainerData *p = pFirstContainer; p; p = p->pNext) {
- TabCtrl_SetPadding(GetDlgItem(p->hwnd, IDC_MSGTABS), GetDlgItemInt(hwndDlg, IDC_HTABPADDING, NULL, FALSE), GetDlgItemInt(hwndDlg, IDC_TABPADDING, NULL, FALSE));
- RedrawWindow(GetDlgItem(p->hwnd, IDC_MSGTABS), NULL, NULL, RDW_INVALIDATE | RDW_ERASE);
+ HWND hwndTab = GetDlgItem(p->hwnd, IDC_MSGTABS);
+ TabCtrl_SetPadding(hwndTab, GetDlgItemInt(hwndDlg, IDC_HTABPADDING, NULL, FALSE), GetDlgItemInt(hwndDlg, IDC_TABPADDING, NULL, FALSE));
+ RedrawWindow(hwndTab, NULL, NULL, RDW_INVALIDATE | RDW_ERASE);
}
return TRUE;
}
diff --git a/plugins/TabSRMM/src/themes.h b/plugins/TabSRMM/src/themes.h
index 18433a6a4e..eadcd8239e 100644
--- a/plugins/TabSRMM/src/themes.h
+++ b/plugins/TabSRMM/src/themes.h
@@ -379,7 +379,8 @@ struct TabControlData
TContainerData *pContainer;
BOOL bDragging;
int iBeginIndex;
- int iHoveredCloseIcon;
+ int iHoveredTabIndex;
+ int iHoveredCloseIcon;
HWND hwndDrag;
TWindowData *dragDat;
HIMAGELIST himlDrag;