From f7884726cffbcaa4fa270740fe821308a2852a15 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Fri, 28 Mar 2025 04:12:33 +0100 Subject: [PATCH] Add "Show only pinned button" option to prevent from inacurate click Fix #15963, close #16334 --- PowerEditor/src/NppBigSwitch.cpp | 2 +- PowerEditor/src/Parameters.cpp | 16 +++- PowerEditor/src/Parameters.h | 1 + .../src/WinControls/Preference/preference.rc | 27 +++--- .../WinControls/Preference/preferenceDlg.cpp | 29 ++++++- .../WinControls/Preference/preference_rc.h | 1 + PowerEditor/src/WinControls/TabBar/TabBar.cpp | 83 ++++++++++++------- PowerEditor/src/WinControls/TabBar/TabBar.h | 1 + PowerEditor/src/resource.h | 2 +- 9 files changed, 113 insertions(+), 49 deletions(-) diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 6c41af0ac..70fffead7 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -4087,7 +4087,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa return TRUE; } - case NPPM_INTERNAL_DRAWINACTIVETABBARBUTTON: + case NPPM_INTERNAL_REFRESHTABBAR: { ::SendMessage(_mainDocTab.getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0); ::SendMessage(_subDocTab.getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0); diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index ae4beb356..6d7a0d9b1 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -4952,6 +4952,17 @@ void NppParameters::feedGUIParameters(TiXmlNode *node) _nppGUI._tabStatus |= TAB_PINBUTTON; } + val = element->Attribute(L"showOnlyPinnedButton"); + if (val) + { + if (!lstrcmp(val, L"yes")) + _nppGUI._tabStatus |= TAB_SHOWONLYPINNEDBUTTON; + else if (!lstrcmp(val, L"no")) + _nppGUI._tabStatus |= 0; + else + isFailed = true; + } + val = element->Attribute(L"buttonsOninactiveTabs"); if (val) { @@ -7297,7 +7308,7 @@ void NppParameters::createXmlTreeFromGUIParams() GUIConfigElement->InsertEndChild(TiXmlText(pStr)); } - // + // { TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(L"GUIConfig")))->ToElement(); GUIConfigElement->SetAttribute(L"name", L"TabBar"); @@ -7320,6 +7331,9 @@ void NppParameters::createXmlTreeFromGUIParams() pStr = (_nppGUI._tabStatus & TAB_PINBUTTON) ? L"yes" : L"no"; GUIConfigElement->SetAttribute(L"pinButton", pStr); + pStr = (_nppGUI._tabStatus & TAB_SHOWONLYPINNEDBUTTON) ? L"yes" : L"no"; + GUIConfigElement->SetAttribute(L"showOnlyPinnedButton", pStr); + pStr = (_nppGUI._tabStatus & TAB_INACTIVETABSHOWBUTTON) ? L"yes" : L"no"; GUIConfigElement->SetAttribute(L"buttonsOninactiveTabs", pStr); diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 89a2a90f1..08797c990 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -77,6 +77,7 @@ const int TAB_QUITONEMPTY = 512; // 0000 0010 0000 0000 const int TAB_ALTICONS = 1024; // 0000 0100 0000 0000 const int TAB_PINBUTTON = 2048; // 0000 1000 0000 0000 const int TAB_INACTIVETABSHOWBUTTON = 4096; // 0001 0000 0000 0000 +const int TAB_SHOWONLYPINNEDBUTTON = 8192; // 0010 0000 0000 0000 const bool activeText = true; const bool activeNumeric = false; diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc index e598afafa..64e844ef0 100644 --- a/PowerEditor/src/WinControls/Preference/preference.rc +++ b/PowerEditor/src/WinControls/Preference/preference.rc @@ -57,19 +57,20 @@ BEGIN CONTROL "Hide",IDC_CHECK_HIDESTATUSBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,179,174,10 GROUPBOX "Tab Bar",IDC_TABBAR_GB_STATIC,235,0,177,195,BS_CENTER - CONTROL "Hide",IDC_CHECK_TAB_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,15,100,10 - CONTROL "Multi-line",IDC_CHECK_TAB_MULTILINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,28,164,10 - CONTROL "Vertical",IDC_CHECK_TAB_VERTICAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,41,164,10 - CONTROL "Reduce",IDC_CHECK_REDUCE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,54,164,10 - CONTROL "Alternate icons",IDC_CHECK_TAB_ALTICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,67,164,10 - CONTROL "Lock (no drag and drop)",IDC_CHECK_LOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,80,164,10 - CONTROL "Change inactive tab color",IDC_CHECK_DRAWINACTIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,93,164,10 - CONTROL "Draw a coloured bar on active tab",IDC_CHECK_ORANGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,106,164,10 - CONTROL "Show close button",IDC_CHECK_ENABLETABCLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,119,164,10 - CONTROL "Enable pin tab feature",IDC_CHECK_ENABLETABPIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,132,164,10 - CONTROL "Show buttons on inactive tabs",IDC_CHECK_INACTTABDRAWBUTTON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,145,164,10 - CONTROL "Double click to close document",IDC_CHECK_DBCLICK2CLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,158,164,10 - CONTROL "Exit on close the last tab",IDC_CHECK_TAB_LAST_EXIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,171,164,10 + CONTROL "Hide",IDC_CHECK_TAB_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,10,100,10 + CONTROL "Multi-line",IDC_CHECK_TAB_MULTILINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,23,164,10 + CONTROL "Vertical",IDC_CHECK_TAB_VERTICAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,36,164,10 + CONTROL "Reduce",IDC_CHECK_REDUCE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,49,164,10 + CONTROL "Alternate icons",IDC_CHECK_TAB_ALTICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,62,164,10 + CONTROL "Lock (no drag and drop)",IDC_CHECK_LOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,75,164,10 + CONTROL "Change inactive tab color",IDC_CHECK_DRAWINACTIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,88,164,10 + CONTROL "Draw a coloured bar on active tab",IDC_CHECK_ORANGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,101,164,10 + CONTROL "Show close button",IDC_CHECK_ENABLETABCLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,114,164,10 + CONTROL "Enable pin tab feature",IDC_CHECK_ENABLETABPIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,127,164,10 + CONTROL "Show only pinned button",IDC_CHECK_SHOWONLYPINNEDBUTTON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,140,164,10 + CONTROL "Show buttons on inactive tabs",IDC_CHECK_INACTTABDRAWBUTTON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,153,164,10 + CONTROL "Double click to close document",IDC_CHECK_DBCLICK2CLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,166,164,10 + CONTROL "Exit on close the last tab",IDC_CHECK_TAB_LAST_EXIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,179,164,10 END IDD_PREFERENCE_SUB_EDITING DIALOGEX 115, 10, 460, 205 diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 4211f7935..4d4ec5171 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -604,10 +604,12 @@ intptr_t CALLBACK GeneralSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM bool showCloseButton = tabBarStatus & TAB_CLOSEBUTTON; bool enablePinButton = tabBarStatus & TAB_PINBUTTON; + bool showOnlyPinnedButton = tabBarStatus & TAB_SHOWONLYPINNEDBUTTON; bool showButtonOnInactiveTabs = tabBarStatus & TAB_INACTIVETABSHOWBUTTON; ::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLETABCLOSE, BM_SETCHECK, showCloseButton, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLETABPIN, BM_SETCHECK, enablePinButton, 0); + ::SendDlgItemMessage(_hSelf, IDC_CHECK_SHOWONLYPINNEDBUTTON, BM_SETCHECK, showOnlyPinnedButton, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_INACTTABDRAWBUTTON, BM_SETCHECK, showButtonOnInactiveTabs, 0); if (!(showCloseButton || enablePinButton)) @@ -617,6 +619,11 @@ intptr_t CALLBACK GeneralSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_INACTTABDRAWBUTTON), FALSE); } + if (!enablePinButton) + { + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SHOWONLYPINNEDBUTTON), FALSE); + } + ::SendDlgItemMessage(_hSelf, IDC_CHECK_DBCLICK2CLOSE, BM_SETCHECK, tabBarStatus & TAB_DBCLK2CLOSE, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_TAB_VERTICAL, BM_SETCHECK, tabBarStatus & TAB_VERTICAL, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_TAB_MULTILINE, BM_SETCHECK, tabBarStatus & TAB_MULTILINE, 0); @@ -727,6 +734,7 @@ intptr_t CALLBACK GeneralSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_DRAWINACTIVE), !toBeHidden); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_ENABLETABCLOSE), !toBeHidden); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_ENABLETABPIN), !toBeHidden); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SHOWONLYPINNEDBUTTON), !toBeHidden); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_INACTTABDRAWBUTTON), !toBeHidden); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_DBCLICK2CLOSE), !toBeHidden); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_TAB_LAST_EXIT), !toBeHidden); @@ -862,9 +870,14 @@ intptr_t CALLBACK GeneralSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM { nppGUI._tabStatus &= ~TAB_INACTIVETABSHOWBUTTON; ::SendDlgItemMessage(_hSelf, IDC_CHECK_INACTTABDRAWBUTTON, BM_SETCHECK, FALSE, 0); - ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_DRAWINACTIVETABBARBUTTON, 0, 0); + ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_REFRESHTABBAR, 0, 0); } ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_INACTTABDRAWBUTTON), showCloseButton || enablePinButton); + + if (wParam == IDC_CHECK_ENABLETABPIN) + { + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SHOWONLYPINNEDBUTTON), enablePinButton); + } return TRUE; } @@ -877,7 +890,19 @@ intptr_t CALLBACK GeneralSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM else nppGUI._tabStatus &= ~TAB_INACTIVETABSHOWBUTTON; - ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_DRAWINACTIVETABBARBUTTON, 0, 0); + ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_REFRESHTABBAR, 0, 0); + return TRUE; + } + + case IDC_CHECK_SHOWONLYPINNEDBUTTON: + { + const bool isChecked = isCheckedOrNot(IDC_CHECK_SHOWONLYPINNEDBUTTON); + if (isChecked) + nppGUI._tabStatus |= TAB_SHOWONLYPINNEDBUTTON; + else + nppGUI._tabStatus &= ~TAB_SHOWONLYPINNEDBUTTON; + + ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_REFRESHTABBAR, 0, 0); return TRUE; } diff --git a/PowerEditor/src/WinControls/Preference/preference_rc.h b/PowerEditor/src/WinControls/Preference/preference_rc.h index f3d3fdf77..76a34d515 100644 --- a/PowerEditor/src/WinControls/Preference/preference_rc.h +++ b/PowerEditor/src/WinControls/Preference/preference_rc.h @@ -54,6 +54,7 @@ #define IDC_CHECK_HIDERIGHTSHORTCUTSOFMENUBAR (IDD_PREFERENCE_SUB_GENRAL + 32) #define IDC_STATUSBAR_GB_STATIC (IDD_PREFERENCE_SUB_GENRAL + 33) #define IDC_CHECK_HIDESTATUSBAR (IDD_PREFERENCE_SUB_GENRAL + 34) + #define IDC_CHECK_SHOWONLYPINNEDBUTTON (IDD_PREFERENCE_SUB_GENRAL + 35) #define IDD_PREFERENCE_SUB_MULTIINSTANCE 6150 //(IDD_PREFERENCE_BOX + 150) #define IDC_MULTIINST_GB_STATIC (IDD_PREFERENCE_SUB_MULTIINSTANCE + 1) diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.cpp b/PowerEditor/src/WinControls/TabBar/TabBar.cpp index dcb01fb45..2f0d817a5 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.cpp +++ b/PowerEditor/src/WinControls/TabBar/TabBar.cpp @@ -25,8 +25,6 @@ #define IDC_DRAG_PLUS_TAB 1406 #define IDC_DRAG_OUT_TAB 1407 - - COLORREF TabBarPlus::_activeTextColour = ::GetSysColor(COLOR_BTNTEXT); COLORREF TabBarPlus::_activeTopBarFocusedColour = RGB(250, 170, 60); COLORREF TabBarPlus::_activeTopBarUnfocusedColour = RGB(250, 210, 150); @@ -570,18 +568,18 @@ void TabBarPlus::setPinBtnImageList() iconSize = g_TabPinBtnSize_DM; if (showInactiveTabButtons) - ids = { IDR_PINTAB_DM, IDR_PINTAB_INACT_DM, IDR_PINTAB_HOVERIN_DM, IDR_PINTAB_HOVERONTAB_DM, IDR_PINTAB_PINNED_DM, IDR_PINTAB_PINNEDHOVERIN_DM }; + ids = { IDR_PINTAB_DM, IDR_PINTAB_INACT_DM, IDR_PINTAB_HOVERIN_DM, IDR_PINTAB_HOVERONTAB_DM, IDR_PINTAB_PINNED_DM, IDR_PINTAB_PINNEDHOVERIN_DM, IDR_PINTAB_INACT_EMPTY_DM }; else - ids = { IDR_PINTAB_DM, IDR_PINTAB_INACT_EMPTY_DM, IDR_PINTAB_HOVERIN_DM, IDR_PINTAB_HOVERONTAB_DM, IDR_PINTAB_PINNED_DM, IDR_PINTAB_PINNEDHOVERIN_DM }; + ids = { IDR_PINTAB_DM, IDR_PINTAB_INACT_EMPTY_DM, IDR_PINTAB_HOVERIN_DM, IDR_PINTAB_HOVERONTAB_DM, IDR_PINTAB_PINNED_DM, IDR_PINTAB_PINNEDHOVERIN_DM, IDR_PINTAB_INACT_EMPTY_DM }; } else { iconSize = g_TabPinBtnSize; if (showInactiveTabButtons) - ids = { IDR_PINTAB, IDR_PINTAB_INACT, IDR_PINTAB_HOVERIN, IDR_PINTAB_HOVERONTAB, IDR_PINTAB_PINNED, IDR_PINTAB_PINNEDHOVERIN }; + ids = { IDR_PINTAB, IDR_PINTAB_INACT, IDR_PINTAB_HOVERIN, IDR_PINTAB_HOVERONTAB, IDR_PINTAB_PINNED, IDR_PINTAB_PINNEDHOVERIN, IDR_PINTAB_INACT_EMPTY }; else - ids = { IDR_PINTAB, IDR_PINTAB_INACT_EMPTY, IDR_PINTAB_HOVERIN, IDR_PINTAB_HOVERONTAB, IDR_PINTAB_PINNED, IDR_PINTAB_PINNEDHOVERIN }; + ids = { IDR_PINTAB, IDR_PINTAB_INACT_EMPTY, IDR_PINTAB_HOVERIN, IDR_PINTAB_HOVERONTAB, IDR_PINTAB_PINNED, IDR_PINTAB_PINNEDHOVERIN, IDR_PINTAB_INACT_EMPTY }; } if (_hPinBtnImgLst != nullptr) @@ -795,9 +793,9 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara int xPos = LOWORD(lParam); int yPos = HIWORD(lParam); + int nTab = getTabIndexAt(xPos, yPos); if (::GetWindowLongPtr(_hSelf, GWL_STYLE) & TCS_BUTTONS) { - int nTab = getTabIndexAt(xPos, yPos); if (nTab != -1 && nTab != static_cast(::SendMessage(_hSelf, TCM_GETCURSEL, 0, 0))) { setActiveTab(nTab); @@ -808,6 +806,7 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara bool isVertical = nppGUI._tabStatus & TAB_VERTICAL; bool drawTabCloseButton = nppGUI._tabStatus & TAB_CLOSEBUTTON; bool drawTabPinButton = nppGUI._tabStatus & TAB_PINBUTTON; + bool isPinSimplest = nppGUI._tabStatus & TAB_SHOWONLYPINNEDBUTTON; if (drawTabCloseButton) { @@ -819,9 +818,15 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara } } + TCITEM tci{}; + tci.mask = TCIF_PARAM; + ::SendMessage(_hSelf, TCM_GETITEM, nTab, reinterpret_cast(&tci)); + Buffer* buf = reinterpret_cast(tci.lParam); + if (drawTabPinButton) { - if (_pinButtonZone.isHit(xPos, yPos, _currentHoverTabRect, isVertical)) + if (_pinButtonZone.isHit(xPos, yPos, _currentHoverTabRect, isVertical) && + ((isPinSimplest && buf->isPinned()) || !isPinSimplest)) { _whichPinClickDown = getTabIndexAt(xPos, yPos); ::SendMessage(_hParent, WM_SIZE, 0, 0); @@ -1078,6 +1083,7 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara bool isVertical = nppGUI._tabStatus & TAB_VERTICAL; bool drawTabCloseButton = nppGUI._tabStatus & TAB_CLOSEBUTTON; bool drawTabPinButton = nppGUI._tabStatus & TAB_PINBUTTON; + bool isPinSimplest = nppGUI._tabStatus & TAB_SHOWONLYPINNEDBUTTON; if (drawTabCloseButton) { @@ -1103,7 +1109,14 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara if (drawTabPinButton) { - if ((_whichPinClickDown == currentTabOn) && _pinButtonZone.isHit(xPos, yPos, _currentHoverTabRect, isVertical)) + int nTab = getTabIndexAt(xPos, yPos); + TCITEM tci{}; + tci.mask = TCIF_PARAM; + ::SendMessage(_hSelf, TCM_GETITEM, nTab, reinterpret_cast(&tci)); + Buffer* buf = reinterpret_cast(tci.lParam); + + if ((_whichPinClickDown == currentTabOn) && _pinButtonZone.isHit(xPos, yPos, _currentHoverTabRect, isVertical) && + ((isPinSimplest && buf->isPinned()) || !isPinSimplest)) { notify(TCN_TABPINNED, currentTabOn); _whichPinClickDown = -1; @@ -1608,31 +1621,39 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT* pDrawItemStruct, bool isDarkMode) } else // unpinned { - if (!isSelected) // inactive + bool isPinSimplest = nppGUI._tabStatus & TAB_SHOWONLYPINNEDBUTTON; + if (isPinSimplest) { - if (_isPinHover && (_currentHoverTabItem == nTab)) - { - if (_whichPinClickDown == -1) // hover - { - idxPinImg = _unpinnedHoverInIdx; - } - else if (_whichPinClickDown == _currentHoverTabItem) // pushed - { - idxPinImg = _pinnedIdx; - } - - } - else // unpinned inactive - { - idxPinImg = (_currentHoverTabItem == nTab) ? _unpinnedHoverOnTabIdx : _unpinnedInactIdx; - } + idxPinImg = _unpinnedEmptyIdx; } - else // current + else { - if (_isPinHover && (_currentHoverTabItem == nTab)) // hover - idxPinImg = _unpinnedHoverInIdx; - else - idxPinImg = _unpinnedIdx; + if (!isSelected) // inactive + { + if (_isPinHover && (_currentHoverTabItem == nTab)) + { + if (_whichPinClickDown == -1) // hover + { + idxPinImg = _unpinnedHoverInIdx; + } + else if (_whichPinClickDown == _currentHoverTabItem) // pushed + { + idxPinImg = _pinnedIdx; + } + + } + else // unpinned inactive + { + idxPinImg = (_currentHoverTabItem == nTab) ? _unpinnedHoverOnTabIdx : _unpinnedInactIdx; + } + } + else // current + { + if (_isPinHover && (_currentHoverTabItem == nTab)) // hover + idxPinImg = _unpinnedHoverInIdx; + else + idxPinImg = _unpinnedIdx; + } } } diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.h b/PowerEditor/src/WinControls/TabBar/TabBar.h index bc444cedf..cdc7dfe46 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.h +++ b/PowerEditor/src/WinControls/TabBar/TabBar.h @@ -243,6 +243,7 @@ protected: const int _unpinnedHoverOnTabIdx = 3; // hover on the tab, but outside of box const int _pinnedIdx = 4; const int _pinnedHoverIdx = 5; + const int _unpinnedEmptyIdx = 6; bool _isCloseHover = false; bool _isPinHover = false; diff --git a/PowerEditor/src/resource.h b/PowerEditor/src/resource.h index 952fe504c..9fc569554 100644 --- a/PowerEditor/src/resource.h +++ b/PowerEditor/src/resource.h @@ -720,7 +720,7 @@ #define NPPM_INTERNAL_DOCMODIFIEDBYREPLACEALL (NOTEPADPLUS_USER_INTERNAL + 79) #define NPPM_INTERNAL_DRAWTABBARPINBUTTON (NOTEPADPLUS_USER_INTERNAL + 80) #define NPPM_INTERNAL_DRAWTABBARCLOSEBUTTON (NOTEPADPLUS_USER_INTERNAL + 81) - #define NPPM_INTERNAL_DRAWINACTIVETABBARBUTTON (NOTEPADPLUS_USER_INTERNAL + 82) + #define NPPM_INTERNAL_REFRESHTABBAR (NOTEPADPLUS_USER_INTERNAL + 82) #define NPPM_INTERNAL_REDUCETABBAR (NOTEPADPLUS_USER_INTERNAL + 83) //#define NPPM_INTERNAL_LOCKTABBAR (NOTEPADPLUS_USER_INTERNAL + 84) #define NPPM_INTERNAL_DRAWINACIVETAB (NOTEPADPLUS_USER_INTERNAL + 85)