From b6934bf5471e216c699c6a26d744fc1474480b71 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 21 Jul 2018 14:51:08 +0100 Subject: [PATCH] Remove duplicate labels from global label popup. Fixes: lp:1782895 * https://bugs.launchpad.net/kicad/+bug/1782895 --- eeschema/dialogs/dialog_edit_label.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/eeschema/dialogs/dialog_edit_label.cpp b/eeschema/dialogs/dialog_edit_label.cpp index 2bdbb43d51..2f774aeeac 100644 --- a/eeschema/dialogs/dialog_edit_label.cpp +++ b/eeschema/dialogs/dialog_edit_label.cpp @@ -221,16 +221,21 @@ bool DIALOG_LABEL_EDITOR::TransferDataToWindow() if( m_valueCombo->IsShown() ) { // Load the combobox with the existing labels of the same type - wxArrayString existingLabels; - SCH_SCREENS allScreens; + std::set existingLabels; + SCH_SCREENS allScreens; for( SCH_SCREEN* screen = allScreens.GetFirst(); screen; screen = allScreens.GetNext() ) for( SCH_ITEM* item = screen->GetDrawItems(); item; item = item->Next() ) if( item->Type() == m_CurrentText->Type() ) - existingLabels.push_back( static_cast( item )->GetText() ); + existingLabels.insert( static_cast( item )->GetText() ); - existingLabels.Sort(); - m_valueCombo->Append( existingLabels ); + wxArrayString existingLabelArray; + + for( wxString label : existingLabels ) + existingLabelArray.push_back( label ); + + // existingLabelArray.Sort(); + m_valueCombo->Append( existingLabelArray ); } // Set text options: