diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index eb82b3decc4a..722e11af5dcc 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -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(); diff --git a/PowerEditor/src/ScintillaComponent/DocTabView.cpp b/PowerEditor/src/ScintillaComponent/DocTabView.cpp index 52826230a974..4aff0d42aa13 100644 --- a/PowerEditor/src/ScintillaComponent/DocTabView.cpp +++ b/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; createIconSets(); diff --git a/PowerEditor/src/ScintillaComponent/DocTabView.h b/PowerEditor/src/ScintillaComponent/DocTabView.h index ffe35cc75762..c8c59d2a4468 100644 --- a/PowerEditor/src/ScintillaComponent/DocTabView.h +++ b/PowerEditor/src/ScintillaComponent/DocTabView.h @@ -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(); diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.cpp b/PowerEditor/src/WinControls/TabBar/TabBar.cpp index 88714101fdca..f041c464dc3d 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.cpp +++ b/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); 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; diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.h b/PowerEditor/src/WinControls/TabBar/TabBar.h index 95abfbba83d6..9f16368f1b44 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.h +++ b/PowerEditor/src/WinControls/TabBar/TabBar.h @@ -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;