Fix wrong position of pin button while close disabled and pin enabled

After disable close button and enable pin button, relaunch Notepad++ will make wrong position of pin button on tab.
This commit fix the bug.
pull/15794/head
Don Ho 2 weeks ago
parent 5f4610293c
commit f607044da0

@ -268,8 +268,12 @@ LRESULT Notepad_plus::init(HWND hwnd)
_mainDocTab.dpiManager().setDpiWithParent(hwnd);
_subDocTab.dpiManager().setDpiWithParent(hwnd);
_mainDocTab.init(_pPublicInterface->getHinst(), hwnd, &_mainEditView, indexDocTabIcon);
_subDocTab.init(_pPublicInterface->getHinst(), hwnd, &_subEditView, indexDocTabIcon);
unsigned char buttonsStatus = 0;
buttonsStatus |= (tabBarStatus & TAB_CLOSEBUTTON) ? 1 : 0;
buttonsStatus |= (tabBarStatus & TAB_PINBUTTON) ? 2 : 0;
_mainDocTab.init(_pPublicInterface->getHinst(), hwnd, &_mainEditView, indexDocTabIcon, buttonsStatus);
_subDocTab.init(_pPublicInterface->getHinst(), hwnd, &_subEditView, indexDocTabIcon, buttonsStatus);
_mainEditView.display();

@ -32,9 +32,9 @@ int docTabIconIDs_alt[] = { IDI_SAVED_ALT_ICON, IDI_UNSAVED_ALT_ICON, IDI_READON
void DocTabView::init(HINSTANCE hInst, HWND parent, ScintillaEditView* pView, unsigned char indexChoice)
void DocTabView::init(HINSTANCE hInst, HWND parent, ScintillaEditView* pView, unsigned char indexChoice, unsigned char buttonsStatus)
{
TabBarPlus::init(hInst, parent);
TabBarPlus::init(hInst, parent, false, false, buttonsStatus);
_pView = pView;
createIconSets();

@ -35,7 +35,7 @@ public :
TabBarPlus::destroy();
};
void init(HINSTANCE hInst, HWND parent, ScintillaEditView * pView, unsigned char indexChoice);
void init(HINSTANCE hInst, HWND parent, ScintillaEditView * pView, unsigned char indexChoice, unsigned char buttonsStatus);
void createIconSets();

@ -288,13 +288,38 @@ void TabBarPlus::destroy()
}
void TabBarPlus::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isMultiLine)
void TabBarPlus::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isMultiLine, unsigned char buttonsStatus)
{
Window::init(hInst, parent);
const UINT dpi = DPIManagerV2::getDpiForWindow(_hParent);
_closeButtonZone.init(_hParent, 0);
_pinButtonZone.init(_hParent, 1);
int closeOrder = -1;
int pinOder = -1;
if (buttonsStatus == 0) // 0000: both buttons disabled
{
closeOrder = -1;
pinOder = -1;
}
else if (buttonsStatus == 1) // 0001: close enabled, pin disabled
{
closeOrder = 0;
pinOder = -1;
}
else if (buttonsStatus == 2) // 0010: close disabled, pin enabled
{
closeOrder = -1;
pinOder = 0;
}
else if (buttonsStatus == 3) // 0011: both buttons enabled
{
closeOrder = 0;
pinOder = 1;
}
_closeButtonZone.init(_hParent, closeOrder);
_pinButtonZone.init(_hParent, pinOder);
_dpiManager.setDpi(dpi);
int vertical = isVertical ? (TCS_VERTICAL | TCS_MULTILINE | TCS_RIGHTJUSTIFY) : 0;

@ -186,7 +186,7 @@ public :
_doDragNDrop = justDoIt;
};
void init(HINSTANCE hInst, HWND hwnd, bool isVertical = false, bool isMultiLine = false) override;
void init(HINSTANCE hInst, HWND hwnd, bool isVertical, bool isMultiLine, unsigned char buttonsStatus = 0);
void destroy() override;

Loading…
Cancel
Save