Adjust pad sub-menu enablements

The apply settings and push settings options now take account of the
validity of the global pad settings when deciding whether to show or
not.

Global pad push now requires a source pad and doesn't push from the
global pad setting when there is no selection.

The whole submenu is hidden when there are no enabled items.

Fixes: lp:1664016
* https://bugs.launchpad.net/kicad/+bug/1664016
This commit is contained in:
John Beard
2017-02-20 11:08:34 +01:00
committed by Maciej Suminski
parent 6164b9be2a
commit ca91c27852
4 changed files with 106 additions and 25 deletions
+19
View File
@@ -187,6 +187,25 @@ void CONTEXT_MENU::Clear()
}
bool CONTEXT_MENU::HasEnabledItems() const
{
bool hasEnabled = false;
auto& items = GetMenuItems();
for( auto item : items )
{
if( item->IsEnabled() && !item->IsSeparator() )
{
hasEnabled = true;
break;
}
}
return hasEnabled;
}
void CONTEXT_MENU::UpdateAll()
{
try