Remove duplicate labels from global label popup.

Fixes: lp:1782895
* https://bugs.launchpad.net/kicad/+bug/1782895
This commit is contained in:
Jeff Young 2018-07-21 14:51:08 +01:00
parent 833e0b3c0f
commit b6934bf547
1 changed files with 10 additions and 5 deletions

View File

@ -221,16 +221,21 @@ bool DIALOG_LABEL_EDITOR::TransferDataToWindow()
if( m_valueCombo->IsShown() ) if( m_valueCombo->IsShown() )
{ {
// Load the combobox with the existing labels of the same type // Load the combobox with the existing labels of the same type
wxArrayString existingLabels; std::set<wxString> existingLabels;
SCH_SCREENS allScreens; SCH_SCREENS allScreens;
for( SCH_SCREEN* screen = allScreens.GetFirst(); screen; screen = allScreens.GetNext() ) for( SCH_SCREEN* screen = allScreens.GetFirst(); screen; screen = allScreens.GetNext() )
for( SCH_ITEM* item = screen->GetDrawItems(); item; item = item->Next() ) for( SCH_ITEM* item = screen->GetDrawItems(); item; item = item->Next() )
if( item->Type() == m_CurrentText->Type() ) if( item->Type() == m_CurrentText->Type() )
existingLabels.push_back( static_cast<SCH_TEXT*>( item )->GetText() ); existingLabels.insert( static_cast<SCH_TEXT*>( item )->GetText() );
existingLabels.Sort(); wxArrayString existingLabelArray;
m_valueCombo->Append( existingLabels );
for( wxString label : existingLabels )
existingLabelArray.push_back( label );
// existingLabelArray.Sort();
m_valueCombo->Append( existingLabelArray );
} }
// Set text options: // Set text options: