From 3c72455b7d519952846c2e57b5541741eb163dce Mon Sep 17 00:00:00 2001 From: beru Date: Sun, 24 Nov 2019 16:26:53 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=89=E3=83=A9=E3=83=83=E3=82=B0=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E3=81=A7=E3=82=BF=E3=83=96=E3=81=AE=E4=B8=A6=E3=81=B3?= =?UTF-8?q?=E6=9B=BF=E3=81=88=E3=80=81=E6=9C=80=E5=BE=8C=E3=81=AE=E3=82=BF?= =?UTF-8?q?=E3=83=96=E3=82=88=E3=82=8A=E5=8F=B3=E3=81=AE=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E3=81=AB=E3=83=89=E3=83=A9=E3=83=83=E3=82=B0=E3=81=97=E3=81=9F?= =?UTF-8?q?=E5=A0=B4=E5=90=88=E3=81=AB=E6=9C=80=E5=BE=8C=E3=81=AE=E3=82=BF?= =?UTF-8?q?=E3=83=96=E3=81=AE=E4=BD=8D=E7=BD=AE=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sakura_core/window/CTabWnd.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/sakura_core/window/CTabWnd.cpp b/sakura_core/window/CTabWnd.cpp index b6cf3180ea..6c9ecac715 100644 --- a/sakura_core/window/CTabWnd.cpp +++ b/sakura_core/window/CTabWnd.cpp @@ -52,6 +52,7 @@ #include "util/module.h" #include "util/string_ex2.h" #include "sakura_rc.h" +#include //#if(WINVER >= 0x0500) #ifndef SPI_GETFOREGROUNDLOCKTIMEOUT @@ -312,11 +313,22 @@ LRESULT CTabWnd::OnTabMouseMove( WPARAM wParam, LPARAM lParam ) { TCHITTESTINFO hitinfo; int i; - int nTabCount; - hitinfo.pt.x = LOWORD( (DWORD)lParam ); - hitinfo.pt.y = HIWORD( (DWORD)lParam ); + int nTabCount = TabCtrl_GetItemCount(m_hwndTab); + hitinfo.pt.x = GET_X_LPARAM( lParam ); + hitinfo.pt.y = GET_Y_LPARAM( lParam ); int nDstTab = TabCtrl_HitTest( m_hwndTab, (LPARAM)&hitinfo ); + // 最後のタブより右の位置にドラッグした場合に最後のタブの位置にする + if (nDstTab == -1 && m_nTabBorderArray) { + if (hitinfo.pt.x >= m_nTabBorderArray[nTabCount - 1]) { + RECT rc; + GetClientRect(m_hwndTab, &rc); + if (hitinfo.pt.y >= rc.top && hitinfo.pt.y < rc.bottom) { + nDstTab = nTabCount - 1; + } + } + } + // 各タブの閉じるボタン描画用処理 EDispTabClose bDispTabClose = m_pShareData->m_Common.m_sTabBar.m_bDispTabClose; if( bDispTabClose && ::GetCapture() != m_hwndTab ){ @@ -393,8 +405,8 @@ LRESULT CTabWnd::OnTabMouseMove( WPARAM wParam, LPARAM lParam ) if( m_nTabBorderArray ){ delete[] m_nTabBorderArray; } - m_nTabBorderArray = new LONG[nTabCount]; - for (i = 0 ; i < nTabCount-1; i++) { + m_nTabBorderArray = new LONG[nTabCount + 1]; + for (i = 0 ; i < nTabCount; i++) { RECT rc; TabCtrl_GetItemRect(m_hwndTab, i, &rc); m_nTabBorderArray[ i ] = rc.right; @@ -418,6 +430,8 @@ LRESULT CTabWnd::OnTabMouseMove( WPARAM wParam, LPARAM lParam ) break; } } + if (nDstTab >= nTabCount) + nDstTab = nTabCount - 1; // ドラッグ中に即時移動 if( m_nSrcTab != nDstTab )