Fix pasting of items from board to Footprint Editor.
In particular, map the netlist info to the orphaned item, and adjust the position of module graphic items to no longer be module-relative. Fixes https://gitlab.com/kicad/code/kicad/issues/4032
This commit is contained in:
parent
437f888c25
commit
51b9944667
|
@ -89,7 +89,7 @@ public:
|
|||
*/
|
||||
void SetNet( NETINFO_ITEM* aNetInfo )
|
||||
{
|
||||
assert( aNetInfo->GetBoard() == GetBoard() );
|
||||
wxASSERT( aNetInfo->GetBoard() == GetBoard() || aNetInfo == NETINFO_LIST::OrphanedItem() );
|
||||
m_netinfo = aNetInfo;
|
||||
}
|
||||
|
||||
|
|
|
@ -1771,14 +1771,14 @@ const std::vector<BOARD_CONNECTED_ITEM*> BOARD::AllConnectedItems()
|
|||
|
||||
void BOARD::ClearAllNetCodes()
|
||||
{
|
||||
for ( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
|
||||
for( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
|
||||
item->SetNetCode( 0 );
|
||||
}
|
||||
|
||||
|
||||
void BOARD::MapNets( const BOARD* aDestBoard )
|
||||
{
|
||||
for ( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
|
||||
for( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
|
||||
{
|
||||
NETINFO_ITEM* netInfo = aDestBoard->FindNet( item->GetNetname() );
|
||||
|
||||
|
|
|
@ -205,8 +205,7 @@ public:
|
|||
*/
|
||||
int GetClearance()
|
||||
{
|
||||
wxASSERT( m_NetClass );
|
||||
return m_NetClass->GetClearance();
|
||||
return m_NetClass ? m_NetClass->GetClearance() : 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -628,11 +628,19 @@ int PCBNEW_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
|||
if( !clipItem )
|
||||
return 0;
|
||||
|
||||
if( clipItem->Type() == PCB_T )
|
||||
static_cast<BOARD*>( clipItem )->MapNets( m_frame->GetBoard() );
|
||||
|
||||
bool editModules = m_editModules || frame()->IsType( FRAME_FOOTPRINT_EDITOR );
|
||||
|
||||
if( clipItem->Type() == PCB_T )
|
||||
{
|
||||
if( editModules )
|
||||
{
|
||||
for( BOARD_CONNECTED_ITEM* item : static_cast<BOARD*>( clipItem )->AllConnectedItems() )
|
||||
item->SetNet( NETINFO_LIST::OrphanedItem() );
|
||||
}
|
||||
else
|
||||
static_cast<BOARD*>( clipItem )->MapNets( m_frame->GetBoard() );
|
||||
}
|
||||
|
||||
// The clipboard can contain two different things, an entire kicad_pcb
|
||||
// or a single module
|
||||
|
||||
|
@ -667,6 +675,7 @@ int PCBNEW_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
|||
|
||||
for( auto item : clipModule->GraphicalItems() )
|
||||
{
|
||||
item->Move( clipModule->GetPosition() );
|
||||
item->SetParent( editModule );
|
||||
pastedItems.push_back( item );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue