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

@ -240,6 +240,7 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataToWindow()
{ {
// Load the combobox with the existing labels of the same type // Load the combobox with the existing labels of the same type
std::set<wxString> existingLabels; std::set<wxString> existingLabels;
std::vector<std::shared_ptr<BUS_ALIAS>> busAliases;
SCH_SCREENS allScreens( m_Parent->Schematic().Root() ); SCH_SCREENS allScreens( m_Parent->Schematic().Root() );
for( SCH_SCREEN* screen = allScreens.GetFirst(); screen; screen = allScreens.GetNext() ) 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 ); const SCH_LABEL_BASE* label = static_cast<const SCH_LABEL_BASE*>( item );
existingLabels.insert( UnescapeString( label->GetText() ) ); 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; wxArrayString existingLabelArray;
for( const wxString& label : existingLabels ) for( const wxString& label : existingLabels )