GAL ratsnest code cleanup
This commit is contained in:
parent
0cc2c87ef8
commit
3bcbe0dfbd
|
@ -481,7 +481,7 @@ void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard )
|
|||
|
||||
if( IsGalCanvasActive() )
|
||||
{
|
||||
aBoard->GetRatsnest()->Recalculate();
|
||||
aBoard->GetRatsnest()->ProcessBoard();
|
||||
|
||||
// reload the worksheet
|
||||
SetPageSettings( aBoard->GetPageSettings() );
|
||||
|
@ -673,17 +673,8 @@ void PCB_EDIT_FRAME::Show3D_Frame( wxCommandEvent& event )
|
|||
|
||||
void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable )
|
||||
{
|
||||
if( aEnable )
|
||||
{
|
||||
BOARD* board = GetBoard();
|
||||
|
||||
if( board )
|
||||
board->GetRatsnest()->ProcessBoard();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !aEnable )
|
||||
Compile_Ratsnest( NULL, true );
|
||||
}
|
||||
|
||||
PCB_BASE_EDIT_FRAME::UseGalCanvas( aEnable );
|
||||
|
||||
|
|
|
@ -1044,10 +1044,8 @@ bool RN_DATA::Add( const BOARD_ITEM* aItem )
|
|||
if( net < 1 ) // do not process unconnected items
|
||||
return false;
|
||||
|
||||
wxASSERT( (unsigned) net < m_nets.size() );
|
||||
/// @todo if the assert above has not been triggered for a long time,
|
||||
/// then removed the autoresize code below
|
||||
if( net >= (int) m_nets.size() ) // Autoresize
|
||||
// Autoresize is necessary e.g. for module editor
|
||||
if( net >= (int) m_nets.size() )
|
||||
m_nets.resize( net + 1 );
|
||||
}
|
||||
else if( aItem->Type() == PCB_MODULE_T )
|
||||
|
@ -1061,10 +1059,8 @@ bool RN_DATA::Add( const BOARD_ITEM* aItem )
|
|||
if( net < 1 ) // do not process unconnected items
|
||||
continue;
|
||||
|
||||
wxASSERT( (unsigned) net < m_nets.size() );
|
||||
/// @todo if the assert above has not been triggered for a long time,
|
||||
/// then removed the autoresize code below
|
||||
if( net >= (int) m_nets.size() ) // Autoresize
|
||||
// Autoresize is necessary e.g. for module editor
|
||||
if( net >= (int) m_nets.size() )
|
||||
m_nets.resize( net + 1 );
|
||||
|
||||
m_nets[net].AddItem( pad );
|
||||
|
@ -1120,16 +1116,12 @@ bool RN_DATA::Remove( const BOARD_ITEM* aItem )
|
|||
if( net < 1 ) // do not process unconnected items
|
||||
return false;
|
||||
|
||||
wxASSERT( (unsigned) net < m_nets.size() );
|
||||
/// @todo if the assert above has not been triggered for a long time,
|
||||
/// then removed the autoresize code below
|
||||
#ifdef NDEBUG
|
||||
if( net >= (int) m_nets.size() ) // Autoresize
|
||||
// Autoresize is necessary e.g. for module editor
|
||||
if( net >= (int) m_nets.size() )
|
||||
{
|
||||
m_nets.resize( net + 1 );
|
||||
return false; // if it was resized, then surely the item had not been added before
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if( aItem->Type() == PCB_MODULE_T )
|
||||
{
|
||||
|
@ -1142,16 +1134,12 @@ bool RN_DATA::Remove( const BOARD_ITEM* aItem )
|
|||
if( net < 1 ) // do not process unconnected items
|
||||
continue;
|
||||
|
||||
wxASSERT( (unsigned) net < m_nets.size() );
|
||||
/// @todo if the assert above has not been triggered for a long time,
|
||||
/// then removed the autoresize code below
|
||||
#ifdef NDEBUG
|
||||
if( net >= (int) m_nets.size() ) // Autoresize
|
||||
// Autoresize is necessary e.g. for module editor
|
||||
if( net >= (int) m_nets.size() )
|
||||
{
|
||||
m_nets.resize( net + 1 );
|
||||
return false; // if it was resized, then surely the item had not been added before
|
||||
}
|
||||
#endif
|
||||
|
||||
m_nets[net].RemoveItem( pad );
|
||||
}
|
||||
|
@ -1259,9 +1247,6 @@ void RN_DATA::Recalculate( int aNet )
|
|||
{
|
||||
unsigned int netCount = m_board->GetNetCount();
|
||||
|
||||
if( netCount > m_nets.size() )
|
||||
m_nets.resize( netCount );
|
||||
|
||||
if( aNet < 0 && netCount > 1 ) // Recompute everything
|
||||
{
|
||||
#ifdef PROFILE
|
||||
|
|
|
@ -501,8 +501,8 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
|
|||
MODULE* module = static_cast<MODULE*>( item );
|
||||
module->RunOnChildren( std::bind( &KIGFX::VIEW::Add, view, _1) );
|
||||
}
|
||||
view->Add( item );
|
||||
|
||||
view->Add( item );
|
||||
item->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
|
||||
build_item_list = true;
|
||||
break;
|
||||
|
@ -552,17 +552,8 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
|
|||
{
|
||||
// Compile ratsnest propagates nets from pads to tracks
|
||||
/// @todo LEGACY Compile_Ratsnest() has to be rewritten and moved to RN_DATA
|
||||
Compile_Ratsnest( NULL, true );
|
||||
|
||||
if( GetModel()->Type() == PCB_T )
|
||||
{
|
||||
/// @todo LEGACY Compile_Ratsnest() might have changed nets for tracks,
|
||||
//so we need to refresh them
|
||||
BOARD* board = static_cast<BOARD*>( GetModel() );
|
||||
|
||||
for( TRACK* track = board->m_Track; track; track = track->Next() )
|
||||
track->ViewUpdate();
|
||||
}
|
||||
if( deep_reBuild_ratsnest )
|
||||
Compile_Ratsnest( NULL, false );
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue