Always use local bus member names for unfolding menu

This commit is contained in:
Jon Evans 2020-01-03 22:11:00 -05:00
parent 112be3bfd1
commit 5255a29bc0
3 changed files with 19 additions and 3 deletions

View File

@ -129,6 +129,7 @@ void SCH_CONNECTION::ConfigureFromLabel( wxString aLabel )
member->m_type = CONNECTION_NET;
member->m_prefix = m_prefix;
member->m_name = vector_member;
member->m_local_name = vector_member;
member->m_vector_index = i++;
m_members.push_back( member );
}
@ -137,6 +138,7 @@ void SCH_CONNECTION::ConfigureFromLabel( wxString aLabel )
{
m_type = CONNECTION_BUS_GROUP;
m_name = aLabel;
m_local_name = aLabel;
std::vector<wxString> members;
wxString group_name;
@ -172,6 +174,7 @@ void SCH_CONNECTION::ConfigureFromLabel( wxString aLabel )
else
{
m_name = aLabel;
m_local_name = aLabel;
m_type = CONNECTION_NET;
}
}
@ -181,6 +184,7 @@ void SCH_CONNECTION::Reset()
{
m_type = CONNECTION_NONE;
m_name.Empty();
m_local_name.Empty();
m_prefix.Empty();
m_suffix .Empty();
m_driver = nullptr;
@ -202,6 +206,7 @@ void SCH_CONNECTION::Clone( SCH_CONNECTION& aOther )
m_driver = aOther.Driver();
m_sheet = aOther.Sheet();
m_name = aOther.m_name;
// Note: m_local_name is not cloned
m_prefix = aOther.Prefix();
m_suffix = aOther.Suffix();
m_members = aOther.Members();

View File

@ -152,6 +152,8 @@ public:
return m_name;
}
wxString LocalName() const { return m_local_name; }
void SetName( const wxString& aName )
{
m_name = aName;
@ -327,7 +329,16 @@ private:
CONNECTION_TYPE m_type; ///< @see enum CONNECTION_TYPE
wxString m_name; ///< Name of the bus.
wxString m_name; ///< Name of the connection.
/**
* For bus members, we want to keep track of the "local" name of a member, that is,
* the name it takes on from its parent bus name. This is because we always want to use
* the local name for bus unfolding, matching within buses, etc. The actual resolved name
* of this bus member might change, for example if it's connected elsewhere to some other
* item with higher priority.
*/
wxString m_local_name;
///< Prefix if connection is member of a labeled bus group (or "" if not)
wxString m_prefix;

View File

@ -150,7 +150,7 @@ private:
for( const auto& member : connection->Members() )
{
int id = ID_POPUP_SCH_UNFOLD_BUS + ( idx++ );
wxString name = member->Name( true );
wxString name = member->LocalName();
if( member->Type() == CONNECTION_BUS )
{
@ -160,7 +160,7 @@ private:
for( const auto& sub_member : member->Members() )
{
id = ID_POPUP_SCH_UNFOLD_BUS + ( idx++ );
submenu->Append( id, sub_member->Name( true ), wxEmptyString );
submenu->Append( id, sub_member->LocalName(), wxEmptyString );
}
}
else