Fixed wrong reference point for copied items in subsequent module editor invocations (GAL).

This commit is contained in:
Maciej Suminski 2014-07-09 14:23:13 +02:00
parent ac8ee56e51
commit e3c4f425dc
2 changed files with 7 additions and 4 deletions

View File

@ -107,6 +107,7 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
SetCrossHairPosition( wxPoint( 0, 0 ) ); SetCrossHairPosition( wxPoint( 0, 0 ) );
PlaceModule( newModule, NULL ); PlaceModule( newModule, NULL );
newModule->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not be initialized at the moment
// Put it on FRONT layer, // Put it on FRONT layer,
// because this is the default in ModEdit, and in libs // because this is the default in ModEdit, and in libs

View File

@ -453,7 +453,7 @@ int EDIT_TOOL::CopyItems( TOOL_EVENT& aEvent )
frame->DisplayToolMsg( _( "Select reference point" ) ); frame->DisplayToolMsg( _( "Select reference point" ) );
bool cancelled = false; bool cancelled = false;
VECTOR2I cursorPos; VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
while( OPT_TOOL_EVENT evt = Wait() ) while( OPT_TOOL_EVENT evt = Wait() )
{ {
@ -490,8 +490,10 @@ int EDIT_TOOL::CopyItems( TOOL_EVENT& aEvent )
module.Add( clone ); module.Add( clone );
} }
// Set the new relative internal local coordinates of footprint items // Set the new relative internal local coordinates of copied items
wxPoint moveVector = module.GetPosition() - wxPoint( cursorPos.x, cursorPos.y ); MODULE* editedModule = getModel<BOARD>()->m_Modules;
wxPoint moveVector = module.GetPosition() + editedModule->GetPosition() -
wxPoint( cursorPos.x, cursorPos.y );
module.MoveAnchorPosition( moveVector ); module.MoveAnchorPosition( moveVector );
io.Format( &module, 0 ); io.Format( &module, 0 );
@ -499,7 +501,7 @@ int EDIT_TOOL::CopyItems( TOOL_EVENT& aEvent )
m_toolMgr->SaveClipboard( data ); m_toolMgr->SaveClipboard( data );
} }
frame->DisplayToolMsg( wxString::Format( _( "Copied %d items" ), selection.Size() ) ); frame->DisplayToolMsg( wxString::Format( _( "Copied %d item(s)" ), selection.Size() ) );
controls->SetSnapping( false ); controls->SetSnapping( false );
controls->ShowCursor( false ); controls->ShowCursor( false );
controls->SetAutoPan( false ); controls->SetAutoPan( false );