Set new module parent early enough to allow pad clearance to be shown

Fixes: lp:1824587
* https://bugs.launchpad.net/kicad/+bug/1824587
This commit is contained in:
Jon Evans 2019-04-14 14:25:32 -04:00
parent ad5a1fd963
commit 1d2db311b2
2 changed files with 10 additions and 2 deletions

View File

@ -36,6 +36,10 @@
#include <connectivity/connectivity_data.h>
const wxChar* const traceMask = wxT( "BOARD_CONNECTED_ITEM" );
BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) :
BOARD_ITEM( aParent, idtype ), m_netinfo( &NETINFO_LIST::ORPHANED_ITEM )
{
@ -94,7 +98,7 @@ int BOARD_CONNECTED_ITEM::GetClearance( BOARD_CONNECTED_ITEM* aItem ) const
}
else
{
DBG(printf( "%s: NULL netclass,type %d", __func__, Type() );)
wxLogTrace( traceMask, "%s: NULL netclass,type %d", __func__, Type() );
}
return 0;
@ -112,7 +116,7 @@ NETCLASSPTR BOARD_CONNECTED_ITEM::GetNetClass() const
if( board == NULL ) // Should not occur
{
DBG(printf( "%s: NULL board,type %d", __func__, Type() );)
wxLogTrace( traceMask, "%s: NULL board,type %d", __func__, Type() );
return NETCLASSPTR();
}

View File

@ -428,6 +428,7 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
SELECTION& selection = selTool->GetSelection();
BOARD_COMMIT commit( m_frame );
BOARD* board = getModel<BOARD>();
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
controls->ShowCursor( true );
@ -485,6 +486,9 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
module->SetFlags( IS_NEW ); // whatever
module->SetTimeStamp( GetNewTimeStamp() );
// Set parent so that clearance can be loaded
module->SetParent( board );
// Put it on FRONT layer,
// (Can be stored flipped if the lib is an archive built from a board)
if( module->IsFlipped() )