mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-23 13:54:54 +02:00
Fix "Reduce Tabbar" option on/off not changing to needed tab width
Fix: https://community.notepad-plus-plus.org/topic/26388/notepad-v8-7-2-release-candidate/17?_=1732420272946
This commit is contained in:
parent
7af3c104d5
commit
ae56752472
@ -235,7 +235,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
|
|||||||
const ScintillaViewParams & svp = nppParam.getSVP();
|
const ScintillaViewParams & svp = nppParam.getSVP();
|
||||||
|
|
||||||
int tabBarStatus = nppGUI._tabStatus;
|
int tabBarStatus = nppGUI._tabStatus;
|
||||||
TabBarPlus::setReduced((tabBarStatus & TAB_REDUCE) != 0);
|
TabBarPlus::setReduced((tabBarStatus & TAB_REDUCE) != 0, &_mainDocTab);
|
||||||
|
|
||||||
const int tabIconSet = NppDarkMode::getTabIconSet(NppDarkMode::isEnabled());
|
const int tabIconSet = NppDarkMode::getTabIconSet(NppDarkMode::isEnabled());
|
||||||
unsigned char indexDocTabIcon = 0;
|
unsigned char indexDocTabIcon = 0;
|
||||||
@ -394,10 +394,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int tabDpiDynamicalHeight = _mainDocTab.dpiManager().scale(TabBarPlus::isReduced() ? g_TabHeight : g_TabHeightLarge);
|
int tabDpiDynamicalHeight = _mainDocTab.dpiManager().scale(TabBarPlus::isReduced() ? g_TabHeight : g_TabHeightLarge);
|
||||||
int tabDpiDynamicalWidth = _mainDocTab.dpiManager().scale(TabBarPlus::drawTabCloseButton() ? g_TabWidthCloseBtn : g_TabWidth);
|
int tabDpiDynamicalWidth = _mainDocTab.dpiManager().scale(TabBarPlus::drawTabCloseButton() ? g_TabWidthButton : g_TabWidth);
|
||||||
|
|
||||||
TabCtrl_SetPadding(_mainDocTab.getHSelf(), _mainDocTab.dpiManager().scale(TabBarPlus::drawTabCloseButton() ? 10 : 6), 0);
|
|
||||||
TabCtrl_SetPadding(_subDocTab.getHSelf(), _subDocTab.dpiManager().scale(TabBarPlus::drawTabCloseButton() ? 10 : 6), 0);
|
|
||||||
|
|
||||||
TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
|
TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
|
||||||
TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
|
TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
|
||||||
|
@ -3894,32 +3894,6 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NPPM_INTERNAL_REDUCETABBAR:
|
|
||||||
{
|
|
||||||
bool isReduceed = TabBarPlus::isReduced();
|
|
||||||
|
|
||||||
//Resize the tab height
|
|
||||||
int tabDpiDynamicalWidth = _mainDocTab.dpiManager().scale(TabBarPlus::drawTabCloseButton() ? g_TabWidthCloseBtn : g_TabWidth);
|
|
||||||
int tabDpiDynamicalHeight = _mainDocTab.dpiManager().scale(isReduceed ? g_TabHeight : g_TabHeightLarge);
|
|
||||||
|
|
||||||
TabCtrl_SetPadding(_mainDocTab.getHSelf(), _mainDocTab.dpiManager().scale(TabBarPlus::drawTabCloseButton() ? 10 : 6), 0);
|
|
||||||
TabCtrl_SetPadding(_subDocTab.getHSelf(), _subDocTab.dpiManager().scale(TabBarPlus::drawTabCloseButton() ? 10 : 6), 0);
|
|
||||||
|
|
||||||
TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
|
|
||||||
TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
|
|
||||||
|
|
||||||
//change the font
|
|
||||||
const auto& hf = _mainDocTab.getFont(isReduceed);
|
|
||||||
if (hf)
|
|
||||||
{
|
|
||||||
::SendMessage(_mainDocTab.getHSelf(), WM_SETFONT, reinterpret_cast<WPARAM>(hf), MAKELPARAM(TRUE, 0));
|
|
||||||
::SendMessage(_subDocTab.getHSelf(), WM_SETFONT, reinterpret_cast<WPARAM>(hf), MAKELPARAM(TRUE, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case NPPM_INTERNAL_REFRESHTABAR:
|
case NPPM_INTERNAL_REFRESHTABAR:
|
||||||
{
|
{
|
||||||
::InvalidateRect(_mainDocTab.getHSelf(), NULL, TRUE);
|
::InvalidateRect(_mainDocTab.getHSelf(), NULL, TRUE);
|
||||||
@ -3966,6 +3940,33 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case NPPM_INTERNAL_REDUCETABBAR:
|
||||||
|
{
|
||||||
|
TabBarPlus::setReduced(!TabBarPlus::isReduced(), &_mainDocTab);
|
||||||
|
bool isReduceed = TabBarPlus::isReduced();
|
||||||
|
|
||||||
|
//Resize the tab height
|
||||||
|
int tabDpiDynamicalWidth = _mainDocTab.dpiManager().scale((TabBarPlus::drawTabCloseButton() || TabBarPlus::drawTabPinButton()) ? g_TabWidthButton : g_TabWidth);
|
||||||
|
int tabDpiDynamicalHeight = _mainDocTab.dpiManager().scale(isReduceed ? g_TabHeight : g_TabHeightLarge);
|
||||||
|
|
||||||
|
TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
|
||||||
|
TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
|
||||||
|
|
||||||
|
//change the font
|
||||||
|
const auto& hf = _mainDocTab.getFont(isReduceed);
|
||||||
|
if (hf)
|
||||||
|
{
|
||||||
|
::SendMessage(_mainDocTab.getHSelf(), WM_SETFONT, reinterpret_cast<WPARAM>(hf), MAKELPARAM(TRUE, 0));
|
||||||
|
::SendMessage(_subDocTab.getHSelf(), WM_SETFONT, reinterpret_cast<WPARAM>(hf), MAKELPARAM(TRUE, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
::SendMessage(_pPublicInterface->getHSelf(), NPPM_INTERNAL_REFRESHTABAR, 0, 0);
|
||||||
|
|
||||||
|
_mainDocTab.refresh();
|
||||||
|
_subDocTab.refresh();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case NPPM_INTERNAL_DRAWTABBARCLOSEBUTTON:
|
case NPPM_INTERNAL_DRAWTABBARCLOSEBUTTON:
|
||||||
{
|
{
|
||||||
TabBarPlus::setDrawTabCloseButton(!TabBarPlus::drawTabCloseButton(), &_mainDocTab);
|
TabBarPlus::setDrawTabCloseButton(!TabBarPlus::drawTabCloseButton(), &_mainDocTab);
|
||||||
@ -4004,7 +4005,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
// This part is just for updating (redraw) the tabs
|
// This part is just for updating (redraw) the tabs
|
||||||
int tabDpiDynamicalHeight = _mainDocTab.dpiManager().scale(TabBarPlus::isReduced() ? g_TabHeight : g_TabHeightLarge);
|
int tabDpiDynamicalHeight = _mainDocTab.dpiManager().scale(TabBarPlus::isReduced() ? g_TabHeight : g_TabHeightLarge);
|
||||||
int tabDpiDynamicalWidth = _mainDocTab.dpiManager().scale(TabBarPlus::drawTabCloseButton() ? g_TabWidthCloseBtn : g_TabWidth);
|
int tabDpiDynamicalWidth = _mainDocTab.dpiManager().scale(TabBarPlus::drawTabCloseButton() ? g_TabWidthButton : g_TabWidth);
|
||||||
TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
|
TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
|
||||||
TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
|
TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
|
||||||
|
|
||||||
@ -4058,7 +4059,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
// This part is just for updating (redraw) the tabs
|
// This part is just for updating (redraw) the tabs
|
||||||
int tabDpiDynamicalHeight = _mainDocTab.dpiManager().scale(TabBarPlus::isReduced() ? g_TabHeight : g_TabHeightLarge);
|
int tabDpiDynamicalHeight = _mainDocTab.dpiManager().scale(TabBarPlus::isReduced() ? g_TabHeight : g_TabHeightLarge);
|
||||||
int tabDpiDynamicalWidth = _mainDocTab.dpiManager().scale(TabBarPlus::drawTabPinButton() ? g_TabWidthCloseBtn : g_TabWidth);
|
int tabDpiDynamicalWidth = _mainDocTab.dpiManager().scale(TabBarPlus::drawTabPinButton() ? g_TabWidthButton : g_TabWidth);
|
||||||
TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
|
TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
|
||||||
TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
|
TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
|
||||||
|
|
||||||
|
@ -737,8 +737,6 @@ intptr_t CALLBACK GeneralSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
|
|
||||||
case IDC_CHECK_REDUCE:
|
case IDC_CHECK_REDUCE:
|
||||||
{
|
{
|
||||||
const bool isChecked = isCheckedOrNot(IDC_CHECK_REDUCE);
|
|
||||||
TabBarPlus::setReduced(isChecked);
|
|
||||||
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_REDUCETABBAR, 0, 0);
|
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_REDUCETABBAR, 0, 0);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ constexpr int g_TabIconSize = 16;
|
|||||||
constexpr int g_TabHeight = 22;
|
constexpr int g_TabHeight = 22;
|
||||||
constexpr int g_TabHeightLarge = 25;
|
constexpr int g_TabHeightLarge = 25;
|
||||||
constexpr int g_TabWidth = 45;
|
constexpr int g_TabWidth = 45;
|
||||||
constexpr int g_TabWidthCloseBtn = 60;
|
constexpr int g_TabWidthButton = 60;
|
||||||
constexpr int g_TabCloseBtnSize = 11;
|
constexpr int g_TabCloseBtnSize = 11;
|
||||||
constexpr int g_TabPinBtnSize = 11;
|
constexpr int g_TabPinBtnSize = 11;
|
||||||
constexpr int g_TabCloseBtnSize_DM = 16;
|
constexpr int g_TabCloseBtnSize_DM = 16;
|
||||||
@ -249,8 +249,9 @@ public :
|
|||||||
doMultiLine();
|
doMultiLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setReduced(bool b) {
|
static void setReduced(bool b, TabBarPlus* tbpObj) {
|
||||||
_isReduced = b;
|
_isReduced = b;
|
||||||
|
doOwnerDrawTab(tbpObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setColour(COLORREF colour2Set, tabColourIndex i, TabBarPlus* tbpObj);
|
static void setColour(COLORREF colour2Set, tabColourIndex i, TabBarPlus* tbpObj);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user