mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-25 06:45:27 +02:00
parent
e94036114b
commit
5184880161
@ -596,20 +596,28 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
|
||||
if (wParam == 2)
|
||||
return TRUE;
|
||||
|
||||
if (_doDragNDrop && !isMultiLine())
|
||||
if (_doDragNDrop)
|
||||
{
|
||||
_nSrcTab = _nTabDragged = currentTabOn;
|
||||
// ::DragDetect does not work with TCS_BUTTONS
|
||||
if (::GetWindowLongPtr(_hSelf, GWL_STYLE) & TCS_BUTTONS)
|
||||
{
|
||||
_mightBeDragging = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_nSrcTab = _nTabDragged = currentTabOn;
|
||||
|
||||
POINT point;
|
||||
point.x = LOWORD(lParam);
|
||||
point.y = HIWORD(lParam);
|
||||
::ClientToScreen(hwnd, &point);
|
||||
if(::DragDetect(hwnd, point))
|
||||
{
|
||||
// Yes, we're beginning to drag, so capture the mouse...
|
||||
_isDragging = true;
|
||||
::SetCapture(hwnd);
|
||||
}
|
||||
POINT point;
|
||||
point.x = LOWORD(lParam);
|
||||
point.y = HIWORD(lParam);
|
||||
::ClientToScreen(hwnd, &point);
|
||||
if(::DragDetect(hwnd, point))
|
||||
{
|
||||
// Yes, we're beginning to drag, so capture the mouse...
|
||||
_isDragging = true;
|
||||
::SetCapture(hwnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
notify(NM_CLICK, currentTabOn);
|
||||
@ -626,6 +634,24 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
|
||||
//#define NPPM_INTERNAL_ISDRAGGING 40926
|
||||
case WM_MOUSEMOVE :
|
||||
{
|
||||
if (_mightBeDragging && !_isDragging)
|
||||
{
|
||||
if (++_dragCount > 2)
|
||||
{
|
||||
int tabFocused = static_cast<int32_t>(::SendMessage(_hSelf, TCM_GETCURFOCUS, 0, 0));
|
||||
int tabSelected = static_cast<int32_t>(::SendMessage(_hSelf, TCM_GETCURSEL, 0, 0));
|
||||
|
||||
// make sure the tab they are moving is active.
|
||||
if (tabFocused != tabSelected)
|
||||
{
|
||||
setActiveTab(tabFocused);
|
||||
}
|
||||
|
||||
_nSrcTab = _nTabDragged = tabFocused;
|
||||
_isDragging = true;
|
||||
}
|
||||
}
|
||||
|
||||
POINT p;
|
||||
p.x = LOWORD(lParam);
|
||||
p.y = HIWORD(lParam);
|
||||
@ -732,6 +758,9 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
|
||||
|
||||
case WM_LBUTTONUP :
|
||||
{
|
||||
_mightBeDragging = false;
|
||||
_dragCount = 0;
|
||||
|
||||
int xPos = LOWORD(lParam);
|
||||
int yPos = HIWORD(lParam);
|
||||
int currentTabOn = getTabIndexAt(xPos, yPos);
|
||||
|
@ -223,6 +223,8 @@ protected:
|
||||
// it's the boss to decide if we do the drag N drop
|
||||
static bool _doDragNDrop;
|
||||
// drag N drop members
|
||||
bool _mightBeDragging = false;
|
||||
int _dragCount = 0;
|
||||
bool _isDragging = false;
|
||||
bool _isDraggingInside = false;
|
||||
int _nSrcTab = -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user