diff --git a/common/dialogs/eda_list_dialog.cpp b/common/dialogs/eda_list_dialog.cpp index 9c4e578f52..0ad2d625f6 100644 --- a/common/dialogs/eda_list_dialog.cpp +++ b/common/dialogs/eda_list_dialog.cpp @@ -40,10 +40,11 @@ static int DEFAULT_COL_WIDTHS[] = { 200, 600 }; EDA_LIST_DIALOG::EDA_LIST_DIALOG( wxWindow* aParent, const wxString& aTitle, const wxArrayString& aItemHeaders, const std::vector& aItemList, - const wxString& aPreselectText ) : + const wxString& aPreselectText, bool aSortList ) : EDA_LIST_DIALOG_BASE( aParent, wxID_ANY, aTitle ) { m_itemsList = &aItemList; + m_sortList = aSortList; m_filterBox->SetHint( _( "Filter" ) ); @@ -234,5 +235,6 @@ static int wxCALLBACK myCompareFunction( wxIntPtr aItem1, wxIntPtr aItem2, void EDA_LIST_DIALOG::sortList() { - m_listBox->SortItems( myCompareFunction, 0 ); + if( m_sortList ) + m_listBox->SortItems( myCompareFunction, 0 ); } diff --git a/include/eda_list_dialog.h b/include/eda_list_dialog.h index 175f5de96a..227a459ef7 100644 --- a/include/eda_list_dialog.h +++ b/include/eda_list_dialog.h @@ -52,7 +52,8 @@ public: */ EDA_LIST_DIALOG( wxWindow* aParent, const wxString& aTitle, const wxArrayString& aItemHeaders, const std::vector& aItemList, - const wxString& aPreselectText = wxEmptyString ); + const wxString& aPreselectText = wxEmptyString, + bool aSortList = true ); void SetListLabel( const wxString& aLabel ); void SetOKLabel( const wxString& aLabel ); @@ -80,6 +81,7 @@ private: private: const std::vector* m_itemsList; + bool m_sortList; }; diff --git a/pcbnew/board_stackup_manager/panel_board_stackup.cpp b/pcbnew/board_stackup_manager/panel_board_stackup.cpp index 892b7ebda4..d42c680859 100644 --- a/pcbnew/board_stackup_manager/panel_board_stackup.cpp +++ b/pcbnew/board_stackup_manager/panel_board_stackup.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -307,7 +307,8 @@ void PANEL_SETUP_BOARD_STACKUP::onAddDielectricLayer( wxCommandEvent& event ) } } - EDA_LIST_DIALOG dlg( m_parentDialog, _( "Add Dielectric Layer" ), headers, d_list ); + EDA_LIST_DIALOG dlg( m_parentDialog, _( "Add Dielectric Layer" ), headers, d_list, + wxEmptyString, false /* do not sort the list: it is **expected** in stack order */); dlg.SetListLabel( _( "Select layer to add:" ) ); dlg.HideFilter(); @@ -363,7 +364,8 @@ void PANEL_SETUP_BOARD_STACKUP::onRemoveDielectricLayer( wxCommandEvent& event ) } } - EDA_LIST_DIALOG dlg( m_parentDialog, _( "Remove Dielectric Layer" ), headers, d_list ); + EDA_LIST_DIALOG dlg( m_parentDialog, _( "Remove Dielectric Layer" ), headers, d_list, + wxEmptyString, false /* do not sort the list: it is **expected** in stack order */); dlg.SetListLabel( _( "Select layer to remove:" ) ); dlg.HideFilter();