diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml
index 10695f327..bebcc31e6 100644
--- a/PowerEditor/installer/nativeLang/english.xml
+++ b/PowerEditor/installer/nativeLang/english.xml
@@ -422,6 +422,7 @@ Translation note:
+
diff --git a/PowerEditor/installer/nativeLang/english_customizable.xml b/PowerEditor/installer/nativeLang/english_customizable.xml
index 843030ba5..7beece443 100644
--- a/PowerEditor/installer/nativeLang/english_customizable.xml
+++ b/PowerEditor/installer/nativeLang/english_customizable.xml
@@ -422,6 +422,7 @@ Translation note:
+
diff --git a/PowerEditor/installer/nativeLang/french.xml b/PowerEditor/installer/nativeLang/french.xml
index 03bfa9e66..431196c47 100644
--- a/PowerEditor/installer/nativeLang/french.xml
+++ b/PowerEditor/installer/nativeLang/french.xml
@@ -422,6 +422,7 @@ Translation note:
+
diff --git a/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml b/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml
index c3fb763c8..c6d47429b 100644
--- a/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml
+++ b/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml
@@ -394,6 +394,7 @@
+
diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp
index f7a820304..6883538ff 100644
--- a/PowerEditor/src/NppCommands.cpp
+++ b/PowerEditor/src/NppCommands.cpp
@@ -3978,6 +3978,18 @@ void Notepad_plus::command(int id)
}
break;
+ case IDM_PINTAB:
+ {
+ TBHDR nmhdr{};
+ nmhdr._hdr.hwndFrom = _pDocTab->getHSelf();
+ nmhdr._hdr.code = TCN_TABPINNED;
+ nmhdr._hdr.idFrom = reinterpret_cast(this);
+ nmhdr._tabOrigin = _pDocTab->getCurrentTabIndex();
+ ::SendMessage(_pPublicInterface->getHSelf(), WM_NOTIFY, 0, reinterpret_cast(&nmhdr));
+ ::SendMessage(_pPublicInterface->getHSelf(), NPPM_INTERNAL_REFRESHTABAR, 0, 0);
+ }
+ break;
+
default :
if (id > IDM_FILEMENU_LASTONE && id < (IDM_FILEMENU_LASTONE + _lastRecentFileList.getMaxNbLRF() + 1))
{
diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp
index bd7bd1010..1931783f4 100644
--- a/PowerEditor/src/NppNotification.cpp
+++ b/PowerEditor/src/NppNotification.cpp
@@ -574,6 +574,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_CLOSEALL_TOLEFT, L"Close All to the Left", L"Close Multiple Tabs"));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_CLOSEALL_TORIGHT, L"Close All to the Right", L"Close Multiple Tabs"));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_CLOSEALL_UNCHANGED, L"Close All Unchanged", L"Close Multiple Tabs"));
+ itemUnitArray.push_back(MenuItemUnit(IDM_PINTAB, L"Pin Tab"));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_SAVE, L"Save"));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_SAVEAS, L"Save As..."));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_OPEN_FOLDER, L"Open Containing Folder in Explorer", L"Open into"));
@@ -623,7 +624,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
bool isEnable = ((::GetMenuState(_mainMenuHandle, IDM_FILE_SAVE, MF_BYCOMMAND)&MF_DISABLED) == 0);
_tabPopupMenu.enableItem(IDM_FILE_SAVE, isEnable);
- Buffer * buf = _pEditView->getCurrentBuffer();
+ Buffer* buf = _pEditView->getCurrentBuffer();
bool isUserReadOnly = buf->getUserReadOnly();
_tabPopupMenu.checkItem(IDM_EDIT_SETREADONLY, isUserReadOnly);
@@ -653,6 +654,33 @@ BOOL Notepad_plus::notify(SCNotification *notification)
_tabPopupMenu.enableItem(IDM_FILE_SAVEAS, !isInaccessible);
_tabPopupMenu.enableItem(IDM_FILE_RENAME, !isInaccessible);
+ bool isTabPinEnabled = TabBarPlus::drawTabPinButton();
+ wstring newName;
+ if (isTabPinEnabled)
+ {
+ wstring defaultName;
+ bool isAlternative;
+ if (buf->isPinned())
+ {
+ defaultName = L"Unpin Tab";
+ isAlternative = true;
+ }
+ else
+ {
+ defaultName = L"Pin Tab";
+ isAlternative = false;
+ }
+ _nativeLangSpeaker.getAlternativeNameFromTabContextMenu(newName, IDM_PINTAB, isAlternative, defaultName);
+ ::ModifyMenu(_tabPopupMenu.getMenuHandle(), IDM_PINTAB, MF_BYCOMMAND, IDM_PINTAB, newName.c_str());
+ }
+ else
+ {
+ _nativeLangSpeaker.getAlternativeNameFromTabContextMenu(newName, IDM_PINTAB, false, L"Pin Tab");
+ ::ModifyMenu(_tabPopupMenu.getMenuHandle(), IDM_PINTAB, MF_BYCOMMAND, IDM_PINTAB, newName.c_str());
+ }
+
+ _tabPopupMenu.enableItem(IDM_PINTAB, isTabPinEnabled);
+
_tabPopupMenu.display(p);
return TRUE;
}
diff --git a/PowerEditor/src/localization.cpp b/PowerEditor/src/localization.cpp
index b81f0efa1..2eca67831 100644
--- a/PowerEditor/src/localization.cpp
+++ b/PowerEditor/src/localization.cpp
@@ -491,14 +491,14 @@ static const int tabCmSubMenuEntryPos[] =
// | |
// | |
1, // 0 Close Multiple Tabs
- 4, // 1 Open into
- 13, // 2 Copy to Clipboard
- 14, // 3 Move Document
- 15, // 4 Apply Color to Tab
+ 5, // 1 Open into
+ 14, // 2 Copy to Clipboard
+ 15, // 3 Move Document
+ 16, // 4 Apply Color to Tab
};
-void NativeLangSpeaker::changeLangTabContextMenu(HMENU hCM)
+void NativeLangSpeaker::changeLangTabContextMenu(HMENU hCM) const
{
if (_nativeLangA != nullptr)
{
@@ -548,6 +548,42 @@ void NativeLangSpeaker::changeLangTabContextMenu(HMENU hCM)
}
}
+void NativeLangSpeaker::getAlternativeNameFromTabContextMenu(wstring& output, int cmdID, bool isAlternative, const wstring& defaultValue) const
+{
+ if (_nativeLangA != nullptr)
+ {
+ TiXmlNodeA* tabBarMenu = _nativeLangA->FirstChild("Menu");
+ if (tabBarMenu)
+ {
+ tabBarMenu = tabBarMenu->FirstChild("TabBar");
+ if (tabBarMenu)
+ {
+ WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
+
+ for (TiXmlNodeA* childNode = tabBarMenu->FirstChildElement("Item");
+ childNode;
+ childNode = childNode->NextSibling("Item"))
+ {
+ TiXmlElementA* element = childNode->ToElement();
+ int cmd;
+ element->Attribute("CMDID", &cmd);
+
+ if (cmd == cmdID) // menu item CMD
+ {
+ const char* pName = element->Attribute(isAlternative ? "alternativeName" : "name");
+ if (pName)
+ {
+ output = wmc.char2wchar(pName, _nativeLangEncoding);
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
+ output = defaultValue;
+}
+
void NativeLangSpeaker::changeLangTabDropContextMenu(HMENU hCM)
{
const int POS_GO2VIEW = 0;
diff --git a/PowerEditor/src/localization.h b/PowerEditor/src/localization.h
index fac7a8860..e087ebb49 100644
--- a/PowerEditor/src/localization.h
+++ b/PowerEditor/src/localization.h
@@ -41,7 +41,8 @@ class NativeLangSpeaker {
public:
void init(TiXmlDocumentA *nativeLangDocRootA, bool loadIfEnglish = false);
void changeConfigLang(HWND hDlg);
- void changeLangTabContextMenu(HMENU hCM);
+ void changeLangTabContextMenu(HMENU hCM) const;
+ void getAlternativeNameFromTabContextMenu(std::wstring& output, int cmdID, bool isAlternative, const std::wstring& defaultValue) const;
TiXmlNodeA * searchDlgNode(TiXmlNodeA *node, const char *dlgTagName);
bool changeDlgLang(HWND hDlg, const char *dlgTagName, char *title = NULL, size_t titleMaxSize = 0);
void changeLangTabDropContextMenu(HMENU hCM);
diff --git a/PowerEditor/src/menuCmdID.h b/PowerEditor/src/menuCmdID.h
index 2d824f299..af743643f 100644
--- a/PowerEditor/src/menuCmdID.h
+++ b/PowerEditor/src/menuCmdID.h
@@ -320,7 +320,7 @@
//#define IDM_VIEW_DOCCHANGEMARGIN (IDM_VIEW + 45)
//#define IDM_VIEW_LWDEF (IDM_VIEW + 46)
//#define IDM_VIEW_LWALIGN (IDM_VIEW + 47)
- //#define IDM_VIEW_LWINDENT (IDM_VIEW + 48)
+ #define IDM_PINTAB (IDM_VIEW + 48)
#define IDM_VIEW_SUMMARY (IDM_VIEW + 49)
#define IDM_VIEW_FOLD (IDM_VIEW + 50)