diff --git a/common/displlst.cpp b/common/displlst.cpp index 7b046cdd5f..f11aad64af 100644 --- a/common/displlst.cpp +++ b/common/displlst.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2019 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 @@ -23,10 +23,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/** - * @file displlst.cpp - */ - #include #include #include @@ -46,11 +42,9 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl const std::vector& aItemList, const wxString& aSelection, void( *aCallBackFunction )( wxString&, void* ), - void* aCallBackFunctionData, - bool aSortList, bool aShowHeaders ) : + void* aCallBackFunctionData ) : EDA_LIST_DIALOG_BASE( aParent, wxID_ANY, aTitle ) { - m_sortList = aSortList; m_cb_func = aCallBackFunction; m_cb_data = aCallBackFunctionData; m_itemsListCp = &aItemList; @@ -59,7 +53,7 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl initDialog( aItemHeaders, aSelection ); - if( !aShowHeaders ) + if( aItemHeaders.IsEmpty() ) m_listBox->SetSingleStyle( wxLC_NO_HEADER, true ); // DIALOG_SHIM needs a unique hash_key because classname is not sufficient @@ -111,12 +105,6 @@ void EDA_LIST_DIALOG::initDialog( const wxArrayString& aItemHeaders, const wxStr } -void EDA_LIST_DIALOG::SetFilterHint( const wxString& aHint ) -{ - m_filterBox->SetHint( aHint ); -} - - void EDA_LIST_DIALOG::SetListLabel( const wxString& aLabel ) { m_listLabel->SetLabel( aLabel ); @@ -148,8 +136,7 @@ void EDA_LIST_DIALOG::textChangeInFilterBox( wxCommandEvent& event ) } } - if( m_sortList ) - sortList(); + sortList(); } @@ -219,8 +206,7 @@ void EDA_LIST_DIALOG::InsertItems( const std::vector< wxArrayString >& itemList, } } - if( m_sortList ) - sortList(); + sortList(); } diff --git a/eeschema/libedit/libedit.cpp b/eeschema/libedit/libedit.cpp index 8ffc2be30d..d5872b13c0 100644 --- a/eeschema/libedit/libedit.cpp +++ b/eeschema/libedit/libedit.cpp @@ -413,9 +413,6 @@ void LIB_EDIT_FRAME::savePartAs() std::vector< wxArrayString > itemsToDisplay; std::vector< wxString > libNicknames = tbl->GetLogicalLibs(); - headers.Add( _( "Nickname" ) ); - headers.Add( _( "Description" ) ); - for( const auto& name : libNicknames ) { wxArrayString item; @@ -424,8 +421,7 @@ void LIB_EDIT_FRAME::savePartAs() itemsToDisplay.push_back( item ); } - EDA_LIST_DIALOG dlg( this, _( "Save Copy of Symbol" ), headers, itemsToDisplay, old_lib, - nullptr, nullptr, /* sort */ false, /* show headers */ false ); + EDA_LIST_DIALOG dlg( this, _( "Save Copy of Symbol" ), headers, itemsToDisplay, old_lib ); dlg.SetListLabel( _( "Save in library:" ) ); dlg.SetOKLabel( _( "Save" ) ); diff --git a/include/dialog_helpers.h b/include/dialog_helpers.h index e1f98c26ac..bb2dea7051 100644 --- a/include/dialog_helpers.h +++ b/include/dialog_helpers.h @@ -39,8 +39,6 @@ class EDA_DRAW_FRAME; -#define SORT_LIST true - /** * class EDA_LIST_DIALOG * @@ -58,25 +56,21 @@ public: * Constructor: * @param aParent Pointer to the parent window. * @param aTitle = The title shown on top. - * @param aItemHeaders is an array containing the column header names for the dialog. + * @param aItemHeaders an optional array containing the column header names for the dialog. * @param aItemList = A wxArrayString of the list of elements. * @param aRefText = An item name if an item must be preselected. * @param aCallBackFunction = callback function to display comments * @param aCallBackFunctionData = a pointer to pass to @a aCallBackFunction - * @param aSortList = true to sort list items by alphabetic order. - * @param aShowHeaders = true if the list should have headers. */ EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitle, const wxArrayString& aItemHeaders, const std::vector& aItemList, const wxString& aRefText, void (* aCallBackFunction)( wxString& text, void* data ) = NULL, - void* aCallBackFunctionData = NULL, - bool aSortList = false, bool aShowHeaders = true ); + void* aCallBackFunctionData = NULL ); // ~EDA_LIST_DIALOG() {} - void SetFilterHint( const wxString& aHint ); void SetListLabel( const wxString& aLabel ); void SetOKLabel( const wxString& aLabel ); @@ -100,7 +94,6 @@ private: void initDialog( const wxArrayString& aItemHeaders, const wxString& aSelection); void sortList(); - bool m_sortList; void (* m_cb_func)( wxString& text, void* data ); void* m_cb_data; const std::vector* m_itemsListCp; diff --git a/pcbnew/footprint_libraries_utils.cpp b/pcbnew/footprint_libraries_utils.cpp index e5ed59d22f..d216823cd0 100644 --- a/pcbnew/footprint_libraries_utils.cpp +++ b/pcbnew/footprint_libraries_utils.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2019 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 @@ -21,21 +21,13 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/** - * @file librairi.cpp - * @brief Manage module (footprint) libraries. - */ - #include -#include - #include #include #include #include #include #include -#include #include #include #include @@ -48,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -883,19 +874,15 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintAs( MODULE* aModule ) std::vector itemsToDisplay; std::vector nicknames = tbl->GetLogicalLibs(); - headers.Add( _( "Nickname" ) ); - headers.Add( _( "Description" ) ); - - for( unsigned i = 0; i < nicknames.size(); i++ ) + for( const wxString& nickname : nicknames ) { wxArrayString item; - item.Add( nicknames[i] ); - item.Add( tbl->GetDescription( nicknames[i] ) ); + item.Add( nickname ); + item.Add( tbl->GetDescription( nickname ) ); itemsToDisplay.push_back( item ); } - EDA_LIST_DIALOG dlg( this, FMT_SAVE_MODULE, headers, itemsToDisplay, libraryName, - nullptr, nullptr, /* sort */ false, /* show headers */ false ); + EDA_LIST_DIALOG dlg( this, FMT_SAVE_MODULE, headers, itemsToDisplay, libraryName ); dlg.SetListLabel( _( "Save in library:" ) ); dlg.SetOKLabel( _( "Save" ) ); diff --git a/pcbnew/load_select_footprint.cpp b/pcbnew/load_select_footprint.cpp index 669e10d4dd..5aa15f574b 100644 --- a/pcbnew/load_select_footprint.cpp +++ b/pcbnew/load_select_footprint.cpp @@ -372,7 +372,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::SelectFootprintFromBoard( BOARD* aPcb ) itemsToDisplay.push_back( item ); } - EDA_LIST_DIALOG dlg( this, msg, headers, itemsToDisplay, wxEmptyString, NULL, NULL, SORT_LIST ); + EDA_LIST_DIALOG dlg( this, msg, headers, itemsToDisplay, wxEmptyString ); if( dlg.ShowModal() == wxID_OK ) fpname = dlg.GetTextSelection();