Browse Source

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 1 week ago
parent
commit
f607044da0
  1. 8
      PowerEditor/src/Notepad_plus.cpp
  2. 4
      PowerEditor/src/ScintillaComponent/DocTabView.cpp
  3. 2
      PowerEditor/src/ScintillaComponent/DocTabView.h
  4. 31
      PowerEditor/src/WinControls/TabBar/TabBar.cpp
  5. 2
      PowerEditor/src/WinControls/TabBar/TabBar.h

8
PowerEditor/src/Notepad_plus.cpp

@ -268,8 +268,12 @@ LRESULT Notepad_plus::init(HWND hwnd)
_mainDocTab.dpiManager().setDpiWithParent(hwnd); _mainDocTab.dpiManager().setDpiWithParent(hwnd);
_subDocTab.dpiManager().setDpiWithParent(hwnd); _subDocTab.dpiManager().setDpiWithParent(hwnd);
_mainDocTab.init(_pPublicInterface->getHinst(), hwnd, &_mainEditView, indexDocTabIcon); unsigned char buttonsStatus = 0;
_subDocTab.init(_pPublicInterface->getHinst(), hwnd, &_subEditView, indexDocTabIcon); 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(); _mainEditView.display();

4
PowerEditor/src/ScintillaComponent/DocTabView.cpp

@ -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; _pView = pView;
createIconSets(); createIconSets();

2
PowerEditor/src/ScintillaComponent/DocTabView.h

@ -35,7 +35,7 @@ public :
TabBarPlus::destroy(); 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(); void createIconSets();

31
PowerEditor/src/WinControls/TabBar/TabBar.cpp

@ -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); Window::init(hInst, parent);
const UINT dpi = DPIManagerV2::getDpiForWindow(_hParent); 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); _dpiManager.setDpi(dpi);
int vertical = isVertical ? (TCS_VERTICAL | TCS_MULTILINE | TCS_RIGHTJUSTIFY) : 0; int vertical = isVertical ? (TCS_VERTICAL | TCS_MULTILINE | TCS_RIGHTJUSTIFY) : 0;

2
PowerEditor/src/WinControls/TabBar/TabBar.h

@ -186,7 +186,7 @@ public :
_doDragNDrop = justDoIt; _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; void destroy() override;

Loading…
Cancel
Save