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,8 +477,6 @@ void PluginsManager::addInMenuFromPMIndex(int i)
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();
@ -487,12 +485,18 @@ HMENU PluginsManager::setMenu(HMENU hMenu, const TCHAR *menuName, bool enablePlu
_hPluginsMenu = ::CreateMenu();
::InsertMenu(hMenu, MENUINDEX_PLUGINS, MF_BYPOSITION | MF_POPUP, (UINT_PTR)_hPluginsMenu, nom_menu);
if (enablePluginAdmin)
{
int i = 1;
if (nbPlugin > 0)
::InsertMenu(_hPluginsMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, TEXT(""));
::InsertMenu(_hPluginsMenu, 1, MF_BYPOSITION, IDM_SETTING_PLUGINADM, TEXT("Plugins Admin..."));
if (enablePluginAdmin)
{
::InsertMenu(_hPluginsMenu, i++, MF_BYPOSITION, IDM_SETTING_PLUGINADM, TEXT("Plugins Admin..."));
::InsertMenu(_hPluginsMenu, i++, MF_BYPOSITION | MF_SEPARATOR, 0, TEXT(""));
}
::InsertMenu(_hPluginsMenu, i, MF_BYPOSITION, IDM_SETTING_OPENPLUGINSDIR, TEXT("Open Plugins Folder..."));
}
for (size_t i = 0; i < nbPlugin; ++i)
@ -500,8 +504,6 @@ HMENU PluginsManager::setMenu(HMENU hMenu, const TCHAR *menuName, bool enablePlu
addInMenuFromPMIndex(static_cast<int32_t>(i));
}
return _hPluginsMenu;
}
return NULL;
}

View File

@ -2499,6 +2499,16 @@ void Notepad_plus::command(int id)
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_MACRO :
case IDM_SETTING_SHORTCUT_MAPPER_RUN :

View File

@ -548,7 +548,8 @@
#define IDM_SETTING_SHORTCUT_MAPPER (IDM_SETTING + 9)
#define IDM_SETTING_REMEMBER_LAST_SESSION (IDM_SETTING + 10)
#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_RUN (IDM_SETTING + 17)
#define IDM_SETTING_EDITCONTEXTMENU (IDM_SETTING + 18)