Proper numeric sorting for intersheet refs.
Also expunges the horrifically named std::remove and std::remove_if (neither of which remove anything).
This commit is contained in:
parent
5d579d14c1
commit
f606679164
|
@ -25,8 +25,7 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
#include <core/kicad_algo.h>
|
||||||
|
|
||||||
#include <commit.h>
|
#include <commit.h>
|
||||||
#include <eda_item.h>
|
#include <eda_item.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
|
@ -137,16 +136,6 @@ int COMMIT::GetStatus( EDA_ITEM* aItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class Container, class F>
|
|
||||||
void eraseIf( Container& c, F&& f )
|
|
||||||
{
|
|
||||||
c.erase( std::remove_if( c.begin(),
|
|
||||||
c.end(),
|
|
||||||
std::forward<F>( f ) ),
|
|
||||||
c.end() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
COMMIT& COMMIT::createModified( EDA_ITEM* aItem, EDA_ITEM* aCopy, int aExtraFlags )
|
COMMIT& COMMIT::createModified( EDA_ITEM* aItem, EDA_ITEM* aCopy, int aExtraFlags )
|
||||||
{
|
{
|
||||||
EDA_ITEM* parent = parentObject( aItem );
|
EDA_ITEM* parent = parentObject( aItem );
|
||||||
|
@ -171,10 +160,10 @@ void COMMIT::makeEntry( EDA_ITEM* aItem, CHANGE_TYPE aType, EDA_ITEM* aCopy )
|
||||||
|
|
||||||
if( m_changedItems.find( aItem ) != m_changedItems.end() )
|
if( m_changedItems.find( aItem ) != m_changedItems.end() )
|
||||||
{
|
{
|
||||||
eraseIf( m_changes, [aItem] ( const COMMIT_LINE& aEnt )
|
alg::delete_if( m_changes, [aItem]( const COMMIT_LINE& aEnt )
|
||||||
{
|
{
|
||||||
return aEnt.m_item == aItem;
|
return aEnt.m_item == aItem;
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
COMMIT_LINE ent;
|
COMMIT_LINE ent;
|
||||||
|
|
|
@ -292,10 +292,11 @@ std::vector<wxString> LIB_TABLE::GetLogicalLibs()
|
||||||
}
|
}
|
||||||
|
|
||||||
// We want to allow case-sensitive duplicates but sort by case-insensitive ordering
|
// We want to allow case-sensitive duplicates but sort by case-insensitive ordering
|
||||||
std::sort( ret.begin(), ret.end(), []( const wxString& lhs, const wxString& rhs )
|
std::sort( ret.begin(), ret.end(),
|
||||||
{
|
[]( const wxString& lhs, const wxString& rhs )
|
||||||
return lhs.CmpNoCase( rhs ) < 0;
|
{
|
||||||
} );
|
return lhs.CmpNoCase( rhs ) < 0;
|
||||||
|
} );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <core/kicad_algo.h>
|
#include <core/kicad_algo.h>
|
||||||
#include <core/optional.h>
|
#include <core/optional.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <common.h>
|
|
||||||
#include <core/kicad_algo.h>
|
#include <core/kicad_algo.h>
|
||||||
#include "bus_alias.h"
|
#include "bus_alias.h"
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,12 @@
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <algorithm>
|
|
||||||
#include <future>
|
#include <future>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <profile.h>
|
#include <profile.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
#include <core/kicad_algo.h>
|
||||||
#include <erc.h>
|
#include <erc.h>
|
||||||
#include <pin_type.h>
|
#include <pin_type.h>
|
||||||
#include <sch_bus_entry.h>
|
#include <sch_bus_entry.h>
|
||||||
|
@ -1054,7 +1054,7 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
||||||
wxLogTrace( ConnTrace, "%ld (%s) is weakly driven and not unique. Changing to %s.",
|
wxLogTrace( ConnTrace, "%ld (%s) is weakly driven and not unique. Changing to %s.",
|
||||||
subgraph->m_code, name, new_name );
|
subgraph->m_code, name, new_name );
|
||||||
|
|
||||||
vec->erase( std::remove( vec->begin(), vec->end(), subgraph ), vec->end() );
|
alg::delete_matching( *vec, subgraph );
|
||||||
|
|
||||||
m_net_name_to_subgraphs_map[new_name].emplace_back( subgraph );
|
m_net_name_to_subgraphs_map[new_name].emplace_back( subgraph );
|
||||||
|
|
||||||
|
@ -1307,12 +1307,10 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Absorbed subgraphs should no longer be considered
|
// Absorbed subgraphs should no longer be considered
|
||||||
m_driver_subgraphs.erase( std::remove_if( m_driver_subgraphs.begin(), m_driver_subgraphs.end(),
|
alg::delete_if( m_driver_subgraphs, [&]( const CONNECTION_SUBGRAPH* candidate ) -> bool
|
||||||
[&] ( const CONNECTION_SUBGRAPH* candidate ) -> bool
|
{
|
||||||
{
|
return candidate->m_absorbed;
|
||||||
return candidate->m_absorbed;
|
} );
|
||||||
} ),
|
|
||||||
m_driver_subgraphs.end() );
|
|
||||||
|
|
||||||
// Store global subgraphs for later reference
|
// Store global subgraphs for later reference
|
||||||
std::vector<CONNECTION_SUBGRAPH*> global_subgraphs;
|
std::vector<CONNECTION_SUBGRAPH*> global_subgraphs;
|
||||||
|
@ -2031,7 +2029,7 @@ void CONNECTION_GRAPH::recacheSubgraphName( CONNECTION_SUBGRAPH* aSubgraph,
|
||||||
if( it != m_net_name_to_subgraphs_map.end() )
|
if( it != m_net_name_to_subgraphs_map.end() )
|
||||||
{
|
{
|
||||||
std::vector<CONNECTION_SUBGRAPH*>& vec = it->second;
|
std::vector<CONNECTION_SUBGRAPH*>& vec = it->second;
|
||||||
vec.erase( std::remove( vec.begin(), vec.end(), aSubgraph ), vec.end() );
|
alg::delete_matching( vec, aSubgraph );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogTrace( ConnTrace, "recacheSubgraphName: %s => %s", aOldName,
|
wxLogTrace( ConnTrace, "recacheSubgraphName: %s => %s", aOldName,
|
||||||
|
|
|
@ -22,12 +22,12 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <symbol_library.h>
|
#include <symbol_library.h>
|
||||||
#include <dialog_choose_symbol.h>
|
#include <dialog_choose_symbol.h>
|
||||||
#include <eeschema_settings.h>
|
#include <eeschema_settings.h>
|
||||||
#include <kiface_base.h>
|
#include <kiface_base.h>
|
||||||
#include <sch_base_frame.h>
|
#include <sch_base_frame.h>
|
||||||
|
#include <core/kicad_algo.h>
|
||||||
#include <template_fieldnames.h>
|
#include <template_fieldnames.h>
|
||||||
#include <widgets/footprint_preview_widget.h>
|
#include <widgets/footprint_preview_widget.h>
|
||||||
#include <widgets/footprint_select_widget.h>
|
#include <widgets/footprint_select_widget.h>
|
||||||
|
@ -487,12 +487,10 @@ void DIALOG_CHOOSE_SYMBOL::OnFootprintSelected( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
m_fp_override = aEvent.GetString();
|
m_fp_override = aEvent.GetString();
|
||||||
|
|
||||||
m_field_edits.erase( std::remove_if( m_field_edits.begin(), m_field_edits.end(),
|
alg::delete_if( m_field_edits, []( std::pair<int, wxString> const& i )
|
||||||
[]( std::pair<int, wxString> const& i )
|
{
|
||||||
{
|
return i.first == FOOTPRINT_FIELD;
|
||||||
return i.first == FOOTPRINT_FIELD;
|
} );
|
||||||
} ),
|
|
||||||
m_field_edits.end() );
|
|
||||||
|
|
||||||
m_field_edits.emplace_back( std::make_pair( FOOTPRINT_FIELD, m_fp_override ) );
|
m_field_edits.emplace_back( std::make_pair( FOOTPRINT_FIELD, m_fp_override ) );
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "dialog_spice_model.h"
|
#include "dialog_spice_model.h"
|
||||||
|
|
||||||
#include <sim/spice_value.h>
|
#include <sim/spice_value.h>
|
||||||
|
#include <core/kicad_algo.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <project.h>
|
#include <project.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
@ -311,21 +312,17 @@ bool DIALOG_SPICE_MODEL::TransferDataFromWindow()
|
||||||
|
|
||||||
if( m_useSchFields )
|
if( m_useSchFields )
|
||||||
{
|
{
|
||||||
m_schfields->erase( std::remove_if( m_schfields->begin(), m_schfields->end(),
|
alg::delete_if( *m_schfields, [&]( const SCH_FIELD& f )
|
||||||
[&]( const SCH_FIELD& f )
|
{
|
||||||
{
|
return f.GetName() == spiceField;
|
||||||
return f.GetName() == spiceField;
|
} );
|
||||||
} ),
|
|
||||||
m_schfields->end() );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_libfields->erase( std::remove_if( m_libfields->begin(), m_libfields->end(),
|
alg::delete_if( *m_libfields, [&]( const LIB_FIELD& f )
|
||||||
[&]( const LIB_FIELD& f )
|
{
|
||||||
{
|
return f.GetName() == spiceField;
|
||||||
return f.GetName() == spiceField;
|
} );
|
||||||
} ),
|
|
||||||
m_libfields->end() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
#include <core/kicad_algo.h>
|
#include <core/kicad_algo.h>
|
||||||
#include <dialog_update_symbol_fields.h>
|
#include <dialog_update_symbol_fields.h>
|
||||||
#include <lib_symbol.h>
|
#include <lib_symbol.h>
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
#include <core/kicad_algo.h>
|
||||||
#include <symbol_library.h>
|
#include <symbol_library.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <eeschema_id.h>
|
#include <eeschema_id.h>
|
||||||
|
@ -181,12 +181,10 @@ PICKED_SYMBOL SCH_BASE_FRAME::PickSymbolFromLibTree( const SCHLIB_FILTER* aFilte
|
||||||
|
|
||||||
if( sel.LibId.IsValid() )
|
if( sel.LibId.IsValid() )
|
||||||
{
|
{
|
||||||
aHistoryList.erase( std::remove_if( aHistoryList.begin(), aHistoryList.end(),
|
alg::delete_if( aHistoryList, [&sel]( PICKED_SYMBOL const& i )
|
||||||
[ &sel ]( PICKED_SYMBOL const& i )
|
{
|
||||||
{
|
return i.LibId == sel.LibId;
|
||||||
return i.LibId == sel.LibId;
|
} );
|
||||||
} ),
|
|
||||||
aHistoryList.end() );
|
|
||||||
|
|
||||||
aHistoryList.insert( aHistoryList.begin(), sel );
|
aHistoryList.insert( aHistoryList.begin(), sel );
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include <sch_edit_frame.h>
|
#include <sch_edit_frame.h>
|
||||||
#include <plotters/plotter.h>
|
#include <plotters/plotter.h>
|
||||||
#include <bitmaps.h>
|
#include <bitmaps.h>
|
||||||
|
#include <core/kicad_algo.h>
|
||||||
#include <core/mirror.h>
|
#include <core/mirror.h>
|
||||||
#include <kiway.h>
|
#include <kiway.h>
|
||||||
#include <general.h>
|
#include <general.h>
|
||||||
|
@ -52,7 +53,6 @@
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
#include <tools/ee_actions.h>
|
#include <tools/ee_actions.h>
|
||||||
|
|
||||||
|
|
||||||
SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_ITEM* aParent,
|
SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_ITEM* aParent,
|
||||||
const wxString& aName ) :
|
const wxString& aName ) :
|
||||||
SCH_ITEM( aParent, SCH_FIELD_T ),
|
SCH_ITEM( aParent, SCH_FIELD_T ),
|
||||||
|
@ -531,19 +531,21 @@ void SCH_FIELD::DoHypertextMenu( EDA_DRAW_FRAME* aFrame )
|
||||||
std::vector<wxString> pageListCopy;
|
std::vector<wxString> pageListCopy;
|
||||||
|
|
||||||
pageListCopy.insert( pageListCopy.end(), it->second.begin(), it->second.end() );
|
pageListCopy.insert( pageListCopy.end(), it->second.begin(), it->second.end() );
|
||||||
std::sort( pageListCopy.begin(), pageListCopy.end() );
|
|
||||||
|
|
||||||
if( !Schematic()->Settings().m_IntersheetRefsListOwnPage )
|
if( !Schematic()->Settings().m_IntersheetRefsListOwnPage )
|
||||||
{
|
{
|
||||||
wxString currentPage = Schematic()->CurrentSheet().GetPageNumber();
|
wxString currentPage = Schematic()->CurrentSheet().GetPageNumber();
|
||||||
pageListCopy.erase( std::remove( pageListCopy.begin(),
|
alg::delete_matching( pageListCopy, currentPage );
|
||||||
pageListCopy.end(),
|
|
||||||
currentPage ), pageListCopy.end() );
|
|
||||||
|
|
||||||
if( pageListCopy.empty() )
|
if( pageListCopy.empty() )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::sort( pageListCopy.begin(), pageListCopy.end(),
|
||||||
|
[]( const wxString& a, const wxString& b ) -> bool
|
||||||
|
{
|
||||||
|
return StrNumCmp( a, b, true ) < 0;
|
||||||
|
} );
|
||||||
|
|
||||||
for( const SCH_SHEET_PATH& sheet : Schematic()->GetSheets() )
|
for( const SCH_SHEET_PATH& sheet : Schematic()->GetSheets() )
|
||||||
{
|
{
|
||||||
if( sheet.size() == 1 )
|
if( sheet.size() == 1 )
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include <project/project_file.h>
|
#include <project/project_file.h>
|
||||||
#include <project/net_settings.h>
|
#include <project/net_settings.h>
|
||||||
#include <core/mirror.h>
|
#include <core/mirror.h>
|
||||||
|
#include <core/kicad_algo.h>
|
||||||
#include <trigo.h>
|
#include <trigo.h>
|
||||||
|
|
||||||
using KIGFX::SCH_RENDER_SETTINGS;
|
using KIGFX::SCH_RENDER_SETTINGS;
|
||||||
|
@ -1249,14 +1250,16 @@ bool SCH_GLOBALLABEL::ResolveTextVar( wxString* token, int aDepth ) const
|
||||||
std::vector<wxString> pageListCopy;
|
std::vector<wxString> pageListCopy;
|
||||||
|
|
||||||
pageListCopy.insert( pageListCopy.end(), it->second.begin(), it->second.end() );
|
pageListCopy.insert( pageListCopy.end(), it->second.begin(), it->second.end() );
|
||||||
std::sort( pageListCopy.begin(), pageListCopy.end() );
|
std::sort( pageListCopy.begin(), pageListCopy.end(),
|
||||||
|
[]( const wxString& a, const wxString& b ) -> bool
|
||||||
|
{
|
||||||
|
return StrNumCmp( a, b, true ) <= 0;
|
||||||
|
} );
|
||||||
|
|
||||||
if( !settings.m_IntersheetRefsListOwnPage )
|
if( !settings.m_IntersheetRefsListOwnPage )
|
||||||
{
|
{
|
||||||
wxString currentPage = Schematic()->CurrentSheet().GetPageNumber();
|
wxString currentPage = Schematic()->CurrentSheet().GetPageNumber();
|
||||||
pageListCopy.erase( std::remove( pageListCopy.begin(),
|
alg::delete_matching( pageListCopy, currentPage );
|
||||||
pageListCopy.end(),
|
|
||||||
currentPage ), pageListCopy.end() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( settings.m_IntersheetRefsFormatShort ) && ( pageListCopy.size() > 2 ) )
|
if( ( settings.m_IntersheetRefsFormatShort ) && ( pageListCopy.size() > 2 ) )
|
||||||
|
|
|
@ -66,7 +66,6 @@
|
||||||
#include <symbol_editor_settings.h>
|
#include <symbol_editor_settings.h>
|
||||||
#include <dialogs/dialog_text_and_label_properties.h>
|
#include <dialogs/dialog_text_and_label_properties.h>
|
||||||
#include <core/kicad_algo.h>
|
#include <core/kicad_algo.h>
|
||||||
//#include <wx/filedlg.h>
|
|
||||||
#include <wx/textdlg.h>
|
#include <wx/textdlg.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2007-2008 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 2004-2020 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2004-2021 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -22,16 +22,11 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @file collector.h
|
|
||||||
* @brief COLLECTOR class definition.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef COLLECTOR_H
|
#ifndef COLLECTOR_H
|
||||||
#define COLLECTOR_H
|
#define COLLECTOR_H
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <core/kicad_algo.h>
|
||||||
#include <eda_item.h> // SEARCH_RESULT
|
#include <eda_item.h> // SEARCH_RESULT
|
||||||
#include <eda_rect.h>
|
#include <eda_rect.h>
|
||||||
|
|
||||||
|
@ -124,12 +119,10 @@ public:
|
||||||
*/
|
*/
|
||||||
void Remove( const EDA_ITEM* aItem )
|
void Remove( const EDA_ITEM* aItem )
|
||||||
{
|
{
|
||||||
m_list.erase( std::remove_if( m_list.begin(), m_list.end(),
|
alg::delete_if( m_list, [&aItem]( const EDA_ITEM* aCandidate )
|
||||||
[&aItem]( const EDA_ITEM* aCandidate )
|
{
|
||||||
{
|
return aCandidate == aItem;
|
||||||
return aCandidate == aItem;
|
} );
|
||||||
} ),
|
|
||||||
m_list.end() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -153,6 +153,28 @@ bool within_wrapped_range( T __val, T __minval, T __maxval, T __wrap )
|
||||||
return __val >= __minval || __val <= __maxval;
|
return __val >= __minval || __val <= __maxval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Covers for the horrifically named std::remove and std::remove_if (neither of which remove
|
||||||
|
* anything).
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @brief Deletes all values from \a __c which match \a __value.
|
||||||
|
*/
|
||||||
|
template <class _Container, typename _Value>
|
||||||
|
void delete_matching( _Container& __c, _Value __value )
|
||||||
|
{
|
||||||
|
__c.erase( std::remove( __c.begin(), __c.end(), __value ), __c.end() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Deletes all values from \a __c for which \a __f returns true.
|
||||||
|
*/
|
||||||
|
template <class _Container, class _Function>
|
||||||
|
void delete_if( _Container& __c, _Function&& __f )
|
||||||
|
{
|
||||||
|
__c.erase( std::remove_if( __c.begin(), __c.end(), std::forward<_Function>( __f ) ), __c.end() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace alg
|
} // namespace alg
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <limits.h> // for INT_MAX
|
#include <limits.h> // for INT_MAX
|
||||||
#include <math.h> // for hypot
|
#include <math.h> // for hypot
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <drc/drc_rtree.h>
|
#include <drc/drc_rtree.h>
|
||||||
#include <pcb_base_frame.h>
|
#include <pcb_base_frame.h>
|
||||||
|
@ -744,45 +743,25 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aRemoveMode )
|
||||||
}
|
}
|
||||||
|
|
||||||
case PCB_MARKER_T:
|
case PCB_MARKER_T:
|
||||||
m_markers.erase( std::remove_if( m_markers.begin(), m_markers.end(),
|
alg::delete_matching( m_markers, aBoardItem );
|
||||||
[aBoardItem]( BOARD_ITEM* aItem )
|
|
||||||
{
|
|
||||||
return aItem == aBoardItem;
|
|
||||||
} ) );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_GROUP_T:
|
case PCB_GROUP_T:
|
||||||
m_groups.erase( std::remove_if( m_groups.begin(), m_groups.end(),
|
alg::delete_matching( m_groups, aBoardItem );
|
||||||
[aBoardItem]( BOARD_ITEM* aItem )
|
|
||||||
{
|
|
||||||
return aItem == aBoardItem;
|
|
||||||
} ) );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_ZONE_T:
|
case PCB_ZONE_T:
|
||||||
m_zones.erase( std::remove_if( m_zones.begin(), m_zones.end(),
|
alg::delete_matching( m_zones, aBoardItem );
|
||||||
[aBoardItem]( BOARD_ITEM* aItem )
|
|
||||||
{
|
|
||||||
return aItem == aBoardItem;
|
|
||||||
} ) );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_FOOTPRINT_T:
|
case PCB_FOOTPRINT_T:
|
||||||
m_footprints.erase( std::remove_if( m_footprints.begin(), m_footprints.end(),
|
alg::delete_matching( m_footprints, aBoardItem );
|
||||||
[aBoardItem]( BOARD_ITEM* aItem )
|
|
||||||
{
|
|
||||||
return aItem == aBoardItem;
|
|
||||||
} ) );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_TRACE_T:
|
case PCB_TRACE_T:
|
||||||
case PCB_ARC_T:
|
case PCB_ARC_T:
|
||||||
case PCB_VIA_T:
|
case PCB_VIA_T:
|
||||||
m_tracks.erase( std::remove_if( m_tracks.begin(), m_tracks.end(),
|
alg::delete_matching( m_tracks, aBoardItem );
|
||||||
[aBoardItem]( BOARD_ITEM* aItem )
|
|
||||||
{
|
|
||||||
return aItem == aBoardItem;
|
|
||||||
} ) );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_DIM_ALIGNED_T:
|
case PCB_DIM_ALIGNED_T:
|
||||||
|
@ -792,11 +771,7 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aRemoveMode )
|
||||||
case PCB_SHAPE_T:
|
case PCB_SHAPE_T:
|
||||||
case PCB_TEXT_T:
|
case PCB_TEXT_T:
|
||||||
case PCB_TARGET_T:
|
case PCB_TARGET_T:
|
||||||
m_drawings.erase( std::remove_if( m_drawings.begin(), m_drawings.end(),
|
alg::delete_matching( m_drawings, aBoardItem );
|
||||||
[aBoardItem](BOARD_ITEM* aItem)
|
|
||||||
{
|
|
||||||
return aItem == aBoardItem;
|
|
||||||
} ) );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// other types may use linked list
|
// other types may use linked list
|
||||||
|
|
|
@ -1563,9 +1563,7 @@ void DIALOG_NET_INSPECTOR::buildNetsList()
|
||||||
m_netsList->UnselectAll();
|
m_netsList->UnselectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
prev_selected_netcodes.erase( std::remove( prev_selected_netcodes.begin(),
|
alg::delete_matching( prev_selected_netcodes, -1 );
|
||||||
prev_selected_netcodes.end(), -1 ),
|
|
||||||
prev_selected_netcodes.end() );
|
|
||||||
|
|
||||||
m_frame->GetCanvas()->GetView()->GetPainter()->GetSettings()->SetHighlight( false );
|
m_frame->GetCanvas()->GetView()->GetPainter()->GetSettings()->SetHighlight( false );
|
||||||
|
|
||||||
|
|
|
@ -206,16 +206,13 @@ FABMASTER::section_type FABMASTER::detectType( size_t aOffset )
|
||||||
std::string row3{};
|
std::string row3{};
|
||||||
|
|
||||||
/// We strip the underscores from all column names as some export variants use them and some do not
|
/// We strip the underscores from all column names as some export variants use them and some do not
|
||||||
row1.erase( std::remove_if( row1.begin(), row1.end(), []( char c ){ return c == '_'; } ),
|
alg::delete_if( row1, []( char c ){ return c == '_'; } );
|
||||||
row1.end() );
|
alg::delete_if( row2, []( char c ){ return c == '_'; } );
|
||||||
row2.erase( std::remove_if( row2.begin(), row2.end(), []( char c ){ return c == '_'; } ),
|
|
||||||
row2.end() );
|
|
||||||
|
|
||||||
if( row.size() > 3 )
|
if( row.size() > 3 )
|
||||||
{
|
{
|
||||||
row3 = row[3];
|
row3 = row[3];
|
||||||
row3.erase( std::remove_if( row3.begin(), row3.end(), []( char c ){ return c == '_'; } ),
|
alg::delete_if( row3, []( char c ){ return c == '_'; } );
|
||||||
row3.end() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( row1 == "REFDES" && row2 == "COMPCLASS" )
|
if( row1 == "REFDES" && row2 == "COMPCLASS" )
|
||||||
|
@ -303,14 +300,13 @@ int FABMASTER::getColFromName( size_t aRow, const std::string& aStr )
|
||||||
if( aRow >= rows.size() )
|
if( aRow >= rows.size() )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
auto header = rows[aRow];
|
std::vector<std::string> header = rows[aRow];
|
||||||
|
|
||||||
for( size_t i = 0; i < header.size(); i++ )
|
for( size_t i = 0; i < header.size(); i++ )
|
||||||
{
|
{
|
||||||
/// Some Fabmaster headers include the underscores while others do not
|
/// Some Fabmaster headers include the underscores while others do not
|
||||||
/// so we strip them uniformly before comparing
|
/// so we strip them uniformly before comparing
|
||||||
header[i].erase( std::remove_if( header[i].begin(), header[i].end(),
|
alg::delete_if( header[i], []( const char c ) { return c == '_'; } );
|
||||||
[]( const char c ){ return c == '_'; } ), header[i].end() );
|
|
||||||
|
|
||||||
if( header[i] == aStr )
|
if( header[i] == aStr )
|
||||||
return i;
|
return i;
|
||||||
|
|
|
@ -24,9 +24,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <algorithm>
|
|
||||||
#include <future>
|
#include <future>
|
||||||
|
#include <core/kicad_algo.h>
|
||||||
#include <advanced_config.h>
|
#include <advanced_config.h>
|
||||||
#include <board.h>
|
#include <board.h>
|
||||||
#include <board_design_settings.h>
|
#include <board_design_settings.h>
|
||||||
|
@ -284,12 +283,10 @@ bool ZONE_FILLER::Fill( std::vector<ZONE*>& aZones, bool aCheck, wxWindow* aPare
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toFill.erase( std::remove_if( toFill.begin(), toFill.end(),
|
alg::delete_if( toFill, [&]( const std::pair<ZONE*, PCB_LAYER_ID> pair ) -> bool
|
||||||
[&] ( const std::pair<ZONE*, PCB_LAYER_ID> pair ) -> bool
|
{
|
||||||
{
|
return pair.first->GetFillFlag( pair.second );
|
||||||
return pair.first->GetFillFlag( pair.second );
|
} );
|
||||||
} ),
|
|
||||||
toFill.end() );
|
|
||||||
|
|
||||||
if( m_progressReporter && m_progressReporter->IsCancelled() )
|
if( m_progressReporter && m_progressReporter->IsCancelled() )
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue