Skip to content

Commit

Permalink
Set new module parent early enough to allow pad clearance to be shown
Browse files Browse the repository at this point in the history
  • Loading branch information
craftyjon committed Apr 14, 2019
1 parent 593a518 commit a771e0e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pcbnew/board_connected_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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;
Expand All @@ -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();
}
Expand Down
4 changes: 4 additions & 0 deletions pcbnew/tools/pcb_editor_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,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 );
Expand Down Expand Up @@ -487,6 +488,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() )
Expand Down

0 comments on commit a771e0e

Please sign in to comment.