Fixed freeze after updating a footprint using the FP editor.
This commit is contained in:
parent
edf64afa3e
commit
b0b64ac964
|
@ -437,65 +437,41 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
m_toolManager->RunAction( COMMON_ACTIONS::selectionClear, true );
|
m_toolManager->RunAction( COMMON_ACTIONS::selectionClear, true );
|
||||||
|
BOARD_COMMIT commit( pcbframe );
|
||||||
|
|
||||||
// Create the "new" module
|
// Create the "new" module
|
||||||
MODULE* newmodule = new MODULE( *module_in_edit );
|
MODULE* newmodule = new MODULE( *module_in_edit );
|
||||||
newmodule->SetParent( mainpcb );
|
newmodule->SetParent( mainpcb );
|
||||||
newmodule->SetLink( 0 );
|
newmodule->SetLink( 0 );
|
||||||
|
|
||||||
// Put the footprint in the main pcb linked list.
|
|
||||||
mainpcb->Add( newmodule );
|
|
||||||
|
|
||||||
if( source_module ) // this is an update command
|
if( source_module ) // this is an update command
|
||||||
{
|
{
|
||||||
// In the main board,
|
// In the main board,
|
||||||
// the new module replace the old module (pos, orient, ref, value
|
// the new module replace the old module (pos, orient, ref, value
|
||||||
// and connexions are kept)
|
// and connexions are kept)
|
||||||
// and the source_module (old module) is deleted
|
// and the source_module (old module) is deleted
|
||||||
BOARD_COMMIT commit( pcbframe );
|
|
||||||
|
|
||||||
if( pcbframe->IsGalCanvasActive() )
|
|
||||||
{
|
|
||||||
KIGFX::VIEW* view = pcbframe->GetGalCanvas()->GetView();
|
|
||||||
source_module->RunOnChildren( std::bind( &KIGFX::VIEW::Remove, view,
|
|
||||||
std::placeholders::_1 ) );
|
|
||||||
view->Remove( source_module );
|
|
||||||
}
|
|
||||||
|
|
||||||
pcbframe->Exchange_Module( source_module, newmodule, commit );
|
pcbframe->Exchange_Module( source_module, newmodule, commit );
|
||||||
newmodule->SetTimeStamp( module_in_edit->GetLink() );
|
newmodule->SetTimeStamp( module_in_edit->GetLink() );
|
||||||
|
commit.Push( wxT( "Update module" ) );
|
||||||
commit.Push( wxT( "" ) );
|
|
||||||
}
|
}
|
||||||
else // This is an insert command
|
else // This is an insert command
|
||||||
{
|
{
|
||||||
wxPoint cursor_pos = pcbframe->GetCrossHairPosition();
|
wxPoint cursor_pos = pcbframe->GetCrossHairPosition();
|
||||||
|
|
||||||
|
commit.Add( newmodule );
|
||||||
pcbframe->SetCrossHairPosition( wxPoint( 0, 0 ) );
|
pcbframe->SetCrossHairPosition( wxPoint( 0, 0 ) );
|
||||||
pcbframe->PlaceModule( newmodule, NULL );
|
pcbframe->PlaceModule( newmodule, NULL );
|
||||||
newmodule->SetPosition( wxPoint( 0, 0 ) );
|
newmodule->SetPosition( wxPoint( 0, 0 ) );
|
||||||
pcbframe->SetCrossHairPosition( cursor_pos );
|
pcbframe->SetCrossHairPosition( cursor_pos );
|
||||||
newmodule->SetTimeStamp( GetNewTimeStamp() );
|
newmodule->SetTimeStamp( GetNewTimeStamp() );
|
||||||
pcbframe->SaveCopyInUndoList( newmodule, UR_NEW );
|
commit.Push( wxT( "Insert module" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
newmodule->ClearFlags();
|
newmodule->ClearFlags();
|
||||||
GetScreen()->ClrModify();
|
GetScreen()->ClrModify();
|
||||||
pcbframe->SetCurItem( NULL );
|
pcbframe->SetCurItem( NULL );
|
||||||
|
// @todo LEGACY should be unnecessary
|
||||||
mainpcb->m_Status_Pcb = 0;
|
mainpcb->m_Status_Pcb = 0;
|
||||||
|
|
||||||
if( pcbframe->IsGalCanvasActive() )
|
|
||||||
{
|
|
||||||
RN_DATA* ratsnest = pcbframe->GetBoard()->GetRatsnest();
|
|
||||||
ratsnest->Update( newmodule );
|
|
||||||
ratsnest->Recalculate();
|
|
||||||
|
|
||||||
KIGFX::VIEW* view = pcbframe->GetGalCanvas()->GetView();
|
|
||||||
newmodule->RunOnChildren( std::bind( &KIGFX::VIEW::Add, view,
|
|
||||||
std::placeholders::_1 ) );
|
|
||||||
view->Add( newmodule );
|
|
||||||
pcbframe->GetGalCanvas()->ForceRefresh();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue