Add 'Open Plugins Folder...' command

Closes #5224, closees #5225
This commit is contained in:
Pavel Nedev 2019-01-11 16:36:01 +02:00 committed by Don HO
parent c3f96d6b9c
commit 1dfa92c4b7
3 changed files with 32 additions and 19 deletions

View File

@ -477,31 +477,33 @@ void PluginsManager::addInMenuFromPMIndex(int i)
HMENU PluginsManager::setMenu(HMENU hMenu, const TCHAR *menuName, bool enablePluginAdmin) HMENU PluginsManager::setMenu(HMENU hMenu, const TCHAR *menuName, bool enablePluginAdmin)
{ {
if (hasPlugins() || enablePluginAdmin) const TCHAR *nom_menu = (menuName && menuName[0])?menuName:TEXT("&Plugins");
size_t nbPlugin = _pluginInfos.size();
if (!_hPluginsMenu)
{ {
const TCHAR *nom_menu = (menuName && menuName[0])?menuName:TEXT("&Plugins"); _hPluginsMenu = ::CreateMenu();
size_t nbPlugin = _pluginInfos.size(); ::InsertMenu(hMenu, MENUINDEX_PLUGINS, MF_BYPOSITION | MF_POPUP, (UINT_PTR)_hPluginsMenu, nom_menu);
if (!_hPluginsMenu) int i = 1;
{
_hPluginsMenu = ::CreateMenu();
::InsertMenu(hMenu, MENUINDEX_PLUGINS, MF_BYPOSITION | MF_POPUP, (UINT_PTR)_hPluginsMenu, nom_menu);
if (enablePluginAdmin) if (nbPlugin > 0)
{ ::InsertMenu(_hPluginsMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, TEXT(""));
if (nbPlugin > 0)
::InsertMenu(_hPluginsMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, TEXT(""));
::InsertMenu(_hPluginsMenu, 1, MF_BYPOSITION, IDM_SETTING_PLUGINADM, TEXT("Plugins Admin..."));
}
}
for (size_t i = 0; i < nbPlugin; ++i) if (enablePluginAdmin)
{ {
addInMenuFromPMIndex(static_cast<int32_t>(i)); ::InsertMenu(_hPluginsMenu, i++, MF_BYPOSITION, IDM_SETTING_PLUGINADM, TEXT("Plugins Admin..."));
::InsertMenu(_hPluginsMenu, i++, MF_BYPOSITION | MF_SEPARATOR, 0, TEXT(""));
} }
return _hPluginsMenu;
::InsertMenu(_hPluginsMenu, i, MF_BYPOSITION, IDM_SETTING_OPENPLUGINSDIR, TEXT("Open Plugins Folder..."));
} }
return NULL;
for (size_t i = 0; i < nbPlugin; ++i)
{
addInMenuFromPMIndex(static_cast<int32_t>(i));
}
return _hPluginsMenu;
} }

View File

@ -2499,6 +2499,16 @@ void Notepad_plus::command(int id)
break; break;
} }
case IDM_SETTING_OPENPLUGINSDIR:
{
const TCHAR* pluginHomePath = NppParameters::getInstance()->getPluginRootDir();
if (pluginHomePath && pluginHomePath[0])
{
::ShellExecute(NULL, NULL, pluginHomePath, NULL, NULL, SW_SHOWNORMAL);
}
break;
}
case IDM_SETTING_SHORTCUT_MAPPER : case IDM_SETTING_SHORTCUT_MAPPER :
case IDM_SETTING_SHORTCUT_MAPPER_MACRO : case IDM_SETTING_SHORTCUT_MAPPER_MACRO :
case IDM_SETTING_SHORTCUT_MAPPER_RUN : case IDM_SETTING_SHORTCUT_MAPPER_RUN :

View File

@ -548,7 +548,8 @@
#define IDM_SETTING_SHORTCUT_MAPPER (IDM_SETTING + 9) #define IDM_SETTING_SHORTCUT_MAPPER (IDM_SETTING + 9)
#define IDM_SETTING_REMEMBER_LAST_SESSION (IDM_SETTING + 10) #define IDM_SETTING_REMEMBER_LAST_SESSION (IDM_SETTING + 10)
#define IDM_SETTING_PREFERECE (IDM_SETTING + 11) #define IDM_SETTING_PREFERECE (IDM_SETTING + 11)
#define IDM_SETTING_PLUGINADM (IDM_SETTING + 15) #define IDM_SETTING_PLUGINADM (IDM_SETTING + 14)
#define IDM_SETTING_OPENPLUGINSDIR (IDM_SETTING + 15)
#define IDM_SETTING_SHORTCUT_MAPPER_MACRO (IDM_SETTING + 16) #define IDM_SETTING_SHORTCUT_MAPPER_MACRO (IDM_SETTING + 16)
#define IDM_SETTING_SHORTCUT_MAPPER_RUN (IDM_SETTING + 17) #define IDM_SETTING_SHORTCUT_MAPPER_RUN (IDM_SETTING + 17)
#define IDM_SETTING_EDITCONTEXTMENU (IDM_SETTING + 18) #define IDM_SETTING_EDITCONTEXTMENU (IDM_SETTING + 18)