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

@ -476,8 +476,6 @@ 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"); const TCHAR *nom_menu = (menuName && menuName[0])?menuName:TEXT("&Plugins");
size_t nbPlugin = _pluginInfos.size(); size_t nbPlugin = _pluginInfos.size();
@ -487,12 +485,18 @@ HMENU PluginsManager::setMenu(HMENU hMenu, const TCHAR *menuName, bool enablePlu
_hPluginsMenu = ::CreateMenu(); _hPluginsMenu = ::CreateMenu();
::InsertMenu(hMenu, MENUINDEX_PLUGINS, MF_BYPOSITION | MF_POPUP, (UINT_PTR)_hPluginsMenu, nom_menu); ::InsertMenu(hMenu, MENUINDEX_PLUGINS, MF_BYPOSITION | MF_POPUP, (UINT_PTR)_hPluginsMenu, nom_menu);
if (enablePluginAdmin) int i = 1;
{
if (nbPlugin > 0) if (nbPlugin > 0)
::InsertMenu(_hPluginsMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, TEXT("")); ::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) for (size_t i = 0; i < nbPlugin; ++i)
@ -501,8 +505,6 @@ HMENU PluginsManager::setMenu(HMENU hMenu, const TCHAR *menuName, bool enablePlu
} }
return _hPluginsMenu; return _hPluginsMenu;
} }
return NULL;
}
void PluginsManager::runPluginCommand(size_t i) void PluginsManager::runPluginCommand(size_t i)

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)