[BUG_FIXED] (Author: tns) Fix tab close button's color remains hovered while mouse leaves.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1150 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2013-11-20 10:40:29 +00:00
parent 35a496e519
commit ad9fac22a3

View File

@ -466,13 +466,7 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
// Get cursor position of "Screen"
// For using the function "WindowFromPoint" afterward!!!
::GetCursorPos(&_draggingPoint);
/*
HWND h = ::WindowFromPoint(_draggingPoint);
::SetFocus(h);
*/
draggingCursor(_draggingPoint);
//::SendMessage(h, NPPM_INTERNAL_ISDRAGGING, 0, 0);
return TRUE;
}
@ -481,31 +475,50 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
int xPos = LOWORD(lParam);
int yPos = HIWORD(lParam);
int index = getTabIndexAt(xPos, yPos);
int _currentHoverTabItemOld = _currentHoverTabItem;
RECT _currentHoverTabRectOld = _currentHoverTabRect;
bool _isCloseHoverOld = _isCloseHover;
if (index != -1)
_currentHoverTabItem = getTabIndexAt(xPos, yPos);
if (_currentHoverTabItem != -1)
{
// Reduce flicker by only redrawing needed tabs
bool oldVal = _isCloseHover;
int oldIndex = _currentHoverTabItem;
RECT oldRect;
::SendMessage(_hSelf, TCM_GETITEMRECT, index, (LPARAM)&_currentHoverTabRect);
::SendMessage(_hSelf, TCM_GETITEMRECT, oldIndex, (LPARAM)&oldRect);
_currentHoverTabItem = index;
::SendMessage(_hSelf, TCM_GETITEMRECT, _currentHoverTabItem, (LPARAM)&_currentHoverTabRect);
_isCloseHover = _closeButtonZone.isHit(xPos, yPos, _currentHoverTabRect);
if (oldVal != _isCloseHover)
}
else
{
InvalidateRect(hwnd, &oldRect, FALSE);
SetRectEmpty(&_currentHoverTabRect);
_isCloseHover = false;
}
if (_currentHoverTabItem != _currentHoverTabItemOld || _isCloseHover != _isCloseHoverOld)
{
if (_isCloseHoverOld && (_currentHoverTabItem != _currentHoverTabItemOld || !_isCloseHover))
InvalidateRect(hwnd, &_currentHoverTabRectOld, FALSE);
if (_isCloseHover)
InvalidateRect(hwnd, &_currentHoverTabRect, FALSE);
}
if (_isCloseHover)
{
TRACKMOUSEEVENT tme = {};
tme.cbSize = sizeof(tme);
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = hwnd;
TrackMouseEvent(&tme);
}
}
break;
}
case WM_MOUSELEAVE:
if (_isCloseHover)
InvalidateRect(hwnd, &_currentHoverTabRect, FALSE);
_currentHoverTabItem = -1;
SetRectEmpty(&_currentHoverTabRect);
_isCloseHover = false;
break;
case WM_LBUTTONUP :
{
int xPos = LOWORD(lParam);