Pcbnew: fix missing connectivity update when adding an item.
Skipping connectivity update when adding an item is possible only when loading a file Fixes #10879 https://gitlab.com/kicad/code/kicad/issues/10879
This commit is contained in:
parent
8ee81e0fc4
commit
2fddc9daf3
|
@ -671,7 +671,7 @@ void BOARD::CacheTriangulation( PROGRESS_REPORTER* aReporter, const std::vector<
|
|||
}
|
||||
|
||||
|
||||
void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
|
||||
void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode, bool aSkipConnectivity )
|
||||
{
|
||||
if( aBoardItem == nullptr )
|
||||
{
|
||||
|
@ -757,9 +757,11 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
|
|||
aBoardItem->SetParent( this );
|
||||
aBoardItem->ClearEditFlags();
|
||||
|
||||
if( !aSkipConnectivity )
|
||||
m_connectivity->Add( aBoardItem );
|
||||
|
||||
if( aMode != ADD_MODE::BULK_INSERT && aMode != ADD_MODE::BULK_APPEND )
|
||||
{
|
||||
m_connectivity->Add( aBoardItem );
|
||||
InvokeListeners( &BOARD_LISTENER::OnBoardItemAdded, *this, aBoardItem );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-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
|
||||
|
@ -292,8 +292,11 @@ public:
|
|||
void SetGenerator( const wxString& aGenerator ) { m_generator = aGenerator; }
|
||||
const wxString& GetGenerator() const { return m_generator; }
|
||||
|
||||
void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT ) override;
|
||||
///< @copydoc BOARD_ITEM_CONTAINER::Add()
|
||||
void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT,
|
||||
bool aSkipConnectivity = false ) override;
|
||||
|
||||
///< @copydoc BOARD_ITEM_CONTAINER::Remove()
|
||||
void Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aMode = REMOVE_MODE::NORMAL ) override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 CERN
|
||||
* Copyright (C) 2016-2017 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2016-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
|
@ -60,8 +60,11 @@ public:
|
|||
/**
|
||||
* @brief Adds an item to the container.
|
||||
* @param aMode decides whether the item is added in the beginning or at the end of the list.
|
||||
* @param aSkipConnectivity skip connectivity update (usefull for file loading, when
|
||||
* the connectivity is updated after end of loading).
|
||||
*/
|
||||
virtual void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT ) = 0;
|
||||
virtual void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT,
|
||||
bool aSkipConnectivity = false ) = 0;
|
||||
|
||||
/**
|
||||
* @brief Removes an item from the container.
|
||||
|
|
|
@ -496,7 +496,7 @@ void FOOTPRINT::ClearAllNets()
|
|||
}
|
||||
|
||||
|
||||
void FOOTPRINT::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
|
||||
void FOOTPRINT::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode, bool aSkipConnectivity )
|
||||
{
|
||||
switch( aBoardItem->Type() )
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-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
|
||||
|
@ -126,7 +126,8 @@ public:
|
|||
void SetPrivateLayers( LSET aLayers ) { m_privateLayers = aLayers; }
|
||||
|
||||
///< @copydoc BOARD_ITEM_CONTAINER::Add()
|
||||
void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT ) override;
|
||||
void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT,
|
||||
bool aSkipConnectivity = false ) override;
|
||||
|
||||
///< @copydoc BOARD_ITEM_CONTAINER::Remove()
|
||||
void Remove( BOARD_ITEM* aItem, REMOVE_MODE aMode = REMOVE_MODE::NORMAL ) override;
|
||||
|
|
|
@ -843,44 +843,44 @@ BOARD* PCB_PARSER::parseBOARD_unchecked()
|
|||
case T_gr_circle:
|
||||
case T_gr_rect:
|
||||
item = parsePCB_SHAPE();
|
||||
m_board->Add( item, ADD_MODE::BULK_APPEND );
|
||||
m_board->Add( item, ADD_MODE::BULK_APPEND, true );
|
||||
bulkAddedItems.push_back( item );
|
||||
break;
|
||||
|
||||
case T_gr_text:
|
||||
item = parsePCB_TEXT();
|
||||
m_board->Add( item, ADD_MODE::BULK_APPEND );
|
||||
m_board->Add( item, ADD_MODE::BULK_APPEND, true );
|
||||
bulkAddedItems.push_back( item );
|
||||
break;
|
||||
|
||||
case T_gr_text_box:
|
||||
item = parsePCB_TEXTBOX();
|
||||
m_board->Add( item, ADD_MODE::BULK_APPEND );
|
||||
m_board->Add( item, ADD_MODE::BULK_APPEND, true );
|
||||
bulkAddedItems.push_back( item );
|
||||
break;
|
||||
|
||||
case T_dimension:
|
||||
item = parseDIMENSION( m_board, false );
|
||||
m_board->Add( item, ADD_MODE::BULK_APPEND );
|
||||
m_board->Add( item, ADD_MODE::BULK_APPEND, true );
|
||||
bulkAddedItems.push_back( item );
|
||||
break;
|
||||
|
||||
case T_module: // legacy token
|
||||
case T_footprint:
|
||||
item = parseFOOTPRINT();
|
||||
m_board->Add( item, ADD_MODE::BULK_APPEND );
|
||||
m_board->Add( item, ADD_MODE::BULK_APPEND, true );
|
||||
bulkAddedItems.push_back( item );
|
||||
break;
|
||||
|
||||
case T_segment:
|
||||
item = parsePCB_TRACK();
|
||||
m_board->Add( item, ADD_MODE::BULK_APPEND );
|
||||
m_board->Add( item, ADD_MODE::BULK_APPEND, true );
|
||||
bulkAddedItems.push_back( item );
|
||||
break;
|
||||
|
||||
case T_arc:
|
||||
item = parseARC();
|
||||
m_board->Add( item, ADD_MODE::BULK_APPEND );
|
||||
m_board->Add( item, ADD_MODE::BULK_APPEND, true );
|
||||
bulkAddedItems.push_back( item );
|
||||
break;
|
||||
|
||||
|
@ -890,19 +890,19 @@ BOARD* PCB_PARSER::parseBOARD_unchecked()
|
|||
|
||||
case T_via:
|
||||
item = parsePCB_VIA();
|
||||
m_board->Add( item, ADD_MODE::BULK_APPEND );
|
||||
m_board->Add( item, ADD_MODE::BULK_APPEND, true );
|
||||
bulkAddedItems.push_back( item );
|
||||
break;
|
||||
|
||||
case T_zone:
|
||||
item = parseZONE( m_board );
|
||||
m_board->Add( item, ADD_MODE::BULK_APPEND );
|
||||
m_board->Add( item, ADD_MODE::BULK_APPEND, true );
|
||||
bulkAddedItems.push_back( item );
|
||||
break;
|
||||
|
||||
case T_target:
|
||||
item = parsePCB_TARGET();
|
||||
m_board->Add( item, ADD_MODE::BULK_APPEND );
|
||||
m_board->Add( item, ADD_MODE::BULK_APPEND, true );
|
||||
bulkAddedItems.push_back( item );
|
||||
break;
|
||||
|
||||
|
@ -1052,9 +1052,9 @@ void PCB_PARSER::resolveGroups( BOARD_ITEM* aParent )
|
|||
group->SetLocked( true );
|
||||
|
||||
if( aGrp.parent->Type() == PCB_FOOTPRINT_T )
|
||||
static_cast<FOOTPRINT*>( aGrp.parent )->Add( group );
|
||||
static_cast<FOOTPRINT*>( aGrp.parent )->Add( group, ADD_MODE::INSERT, true );
|
||||
else
|
||||
static_cast<BOARD*>( aGrp.parent )->Add( group );
|
||||
static_cast<BOARD*>( aGrp.parent )->Add( group, ADD_MODE::INSERT, true );
|
||||
}
|
||||
|
||||
wxString error;
|
||||
|
@ -2354,7 +2354,7 @@ void PCB_PARSER::parseNETINFO_ITEM()
|
|||
if( netCode > NETINFO_LIST::UNCONNECTED || !m_board->FindNet( NETINFO_LIST::UNCONNECTED ) )
|
||||
{
|
||||
NETINFO_ITEM* net = new NETINFO_ITEM( m_board, name, netCode );
|
||||
m_board->Add( net );
|
||||
m_board->Add( net, ADD_MODE::INSERT, true );
|
||||
|
||||
// Store the new code mapping
|
||||
pushValueIntoMap( netCode, net->GetNetCode() );
|
||||
|
@ -3721,7 +3721,7 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments
|
|||
break;
|
||||
|
||||
default:
|
||||
footprint->Add( text, ADD_MODE::APPEND );
|
||||
footprint->Add( text, ADD_MODE::APPEND, true );
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -3732,7 +3732,7 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments
|
|||
FP_TEXTBOX* textbox = parseFP_TEXTBOX();
|
||||
textbox->SetParent( footprint.get() );
|
||||
textbox->SetDrawCoord();
|
||||
footprint->Add( textbox, ADD_MODE::APPEND );
|
||||
footprint->Add( textbox, ADD_MODE::APPEND, true );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3746,14 +3746,14 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments
|
|||
FP_SHAPE* shape = parseFP_SHAPE();
|
||||
shape->SetParent( footprint.get() );
|
||||
shape->SetDrawCoord();
|
||||
footprint->Add( shape, ADD_MODE::APPEND );
|
||||
footprint->Add( shape, ADD_MODE::APPEND, true );
|
||||
break;
|
||||
}
|
||||
|
||||
case T_dimension:
|
||||
{
|
||||
PCB_DIMENSION_BASE* dimension = parseDIMENSION( footprint.get(), true );
|
||||
footprint->Add( dimension, ADD_MODE::APPEND );
|
||||
footprint->Add( dimension, ADD_MODE::APPEND, true );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3764,7 +3764,7 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments
|
|||
|
||||
RotatePoint( pt, footprint->GetOrientation() );
|
||||
pad->SetPosition( pt + footprint->GetPosition() );
|
||||
footprint->Add( pad, ADD_MODE::APPEND );
|
||||
footprint->Add( pad, ADD_MODE::APPEND, true );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3779,7 +3779,7 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments
|
|||
case T_zone:
|
||||
{
|
||||
ZONE* zone = parseZONE( footprint.get() );
|
||||
footprint->Add( zone, ADD_MODE::APPEND );
|
||||
footprint->Add( zone, ADD_MODE::APPEND, true );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -5872,7 +5872,7 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
|
|||
{
|
||||
int newnetcode = m_board->GetNetCount();
|
||||
net = new NETINFO_ITEM( m_board, netnameFromfile, newnetcode );
|
||||
m_board->Add( net );
|
||||
m_board->Add( net, ADD_MODE::INSERT, true );
|
||||
|
||||
// Store the new code mapping
|
||||
pushValueIntoMap( newnetcode, net->GetNetCode() );
|
||||
|
|
Loading…
Reference in New Issue