Fix show/hide of default netclass

This commit is contained in:
Jon Evans 2020-08-19 07:47:20 -04:00
parent 4b7c883095
commit 249de20c6b
1 changed files with 11 additions and 1 deletions

View File

@ -1907,7 +1907,8 @@ void APPEARANCE_CONTROLS::onNetclassContextMenu( wxCommandEvent& aEvent )
APPEARANCE_SETTING* setting = m_netclassSettingsMap.count( m_contextMenuNetclass ) ?
m_netclassSettingsMap.at( m_contextMenuNetclass ) : nullptr;
NETCLASSPTR defaultClass = classes.GetDefault();
NETCLASSPTR defaultClass = classes.GetDefault();
wxString defaultClassName = defaultClass->GetName();
auto runOnNetsOfClass =
[&]( NETCLASSPTR aClass, std::function<void( NETINFO_ITEM* )> aFunction )
@ -1996,6 +1997,10 @@ void APPEARANCE_CONTROLS::onNetclassContextMenu( wxCommandEvent& aEvent )
case ID_SHOW_ALL_NETS:
{
showNetclass( defaultClassName );
wxASSERT( m_netclassSettingsMap.count( defaultClassName ) );
m_netclassSettingsMap.at( defaultClassName )->ctl_visibility->SetValue( true );
for( const auto& pair : classes.NetClasses() )
{
showNetclass( pair.first );
@ -2009,6 +2014,11 @@ void APPEARANCE_CONTROLS::onNetclassContextMenu( wxCommandEvent& aEvent )
case ID_HIDE_OTHER_NETS:
{
bool showDefault = m_contextMenuNetclass == defaultClassName;
showNetclass( defaultClassName, showDefault );
wxASSERT( m_netclassSettingsMap.count( defaultClassName ) );
m_netclassSettingsMap.at( defaultClassName )->ctl_visibility->SetValue( showDefault );
for( const auto& pair : classes.NetClasses() )
{
bool show = pair.first == m_contextMenuNetclass;