Skip to content

Commit b081788

Browse files
committed
- keep menus also in case scripts are located just at a deeper nesting level - avoid compiler warning about type conversion
1 parent 50fd498 commit b081788

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

PythonScript/src/MenuManager.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ bool MenuManager::findScripts(HMENU hBaseMenu, size_t basePathLength, tstring& p
415415
HANDLE hFound = FindFirstFile(searchPath.c_str(), &findData);
416416
BOOL found = (hFound != INVALID_HANDLE_VALUE) ? TRUE : FALSE;
417417
idx_t position = 0;
418+
bool subDirScriptsFoundAllDirs = false;
418419

419420
while (found)
420421
{
@@ -439,6 +440,8 @@ bool MenuManager::findScripts(HMENU hBaseMenu, size_t basePathLength, tstring& p
439440
}
440441

441442
bool subDirScriptsFound = findScripts(hSubmenu, basePathLength, searchPath);
443+
subDirScriptsFoundAllDirs |= subDirScriptsFound;
444+
442445
if (subDirScriptsFound )
443446
{
444447
// startID = nextID;
@@ -468,6 +471,12 @@ bool MenuManager::findScripts(HMENU hBaseMenu, size_t basePathLength, tstring& p
468471

469472
bool scriptsFound = (TRUE == found);
470473

474+
if(subDirScriptsFoundAllDirs)
475+
{
476+
//keep menu also in case scripts are found in a deeper nested submenu
477+
scriptsFound = true;
478+
}
479+
471480
while(found)
472481
{
473482
tstring fullFilename(path);
@@ -720,7 +729,7 @@ void MenuManager::reconfigure()
720729
if (position < m_originalDynamicCount)
721730
{
722731
ShortcutKey sk;
723-
BOOL hasKey = ::SendMessage(m_hNotepad, NPPM_GETSHORTCUTBYCMDID, static_cast<WPARAM>(m_funcItems[m_dynamicStartIndex + position - 1]._cmdID), reinterpret_cast<LPARAM>(&sk));
732+
BOOL hasKey = static_cast<BOOL>(::SendMessage(m_hNotepad, NPPM_GETSHORTCUTBYCMDID, static_cast<WPARAM>(m_funcItems[m_dynamicStartIndex + position - 1]._cmdID), reinterpret_cast<LPARAM>(&sk)));
724733

725734
tstring menuTitle(filename);
726735

0 commit comments

Comments
 (0)