Add bus aliases to pre-canned labels in the label combobox.

Fixes https://gitlab.com/kicad/code/kicad/issues/12248
This commit is contained in:
Jeff Young 2022-08-20 16:07:22 +01:00
parent 5c98715667
commit 942732057b
1 changed files with 10 additions and 2 deletions

View File

@ -239,8 +239,9 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataToWindow()
if( m_currentLabel->Type() == SCH_GLOBAL_LABEL_T || m_currentLabel->Type() == SCH_LABEL_T )
{
// Load the combobox with the existing labels of the same type
std::set<wxString> existingLabels;
SCH_SCREENS allScreens( m_Parent->Schematic().Root() );
std::set<wxString> existingLabels;
std::vector<std::shared_ptr<BUS_ALIAS>> busAliases;
SCH_SCREENS allScreens( m_Parent->Schematic().Root() );
for( SCH_SCREEN* screen = allScreens.GetFirst(); screen; screen = allScreens.GetNext() )
{
@ -249,8 +250,15 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataToWindow()
const SCH_LABEL_BASE* label = static_cast<const SCH_LABEL_BASE*>( item );
existingLabels.insert( UnescapeString( label->GetText() ) );
}
std::unordered_set<std::shared_ptr<BUS_ALIAS>> sheetAliases = screen->GetBusAliases();
busAliases.insert( busAliases.end(), sheetAliases.begin(), sheetAliases.end() );
}
// Add bus aliases to label list
for( const std::shared_ptr<BUS_ALIAS>& busAlias : busAliases )
existingLabels.insert( wxT( "{" ) + busAlias->GetName() + wxT( "}" ) );
wxArrayString existingLabelArray;
for( const wxString& label : existingLabels )