diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp index 8fe17ba275..f9da0d5a00 100644 --- a/eeschema/hotkeys.cpp +++ b/eeschema/hotkeys.cpp @@ -673,8 +673,13 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) if( DrawStruct == NULL ) { - // Find the schematic object to move under the cursor - DrawStruct = SchematicGeneralLocateAndDisplay( false ); + // For a drag or copy command, try to find first a component: + if( DrawStruct == NULL && HK_Descr->m_Idcommand != HK_MOVE_COMPONENT_OR_ITEM ) + DrawStruct = LocateSmallestComponent( GetScreen() ); + + // If no component, find the schematic object to move/drag or copy under the cursor + if( DrawStruct == NULL ) + DrawStruct = SchematicGeneralLocateAndDisplay( false ); if( DrawStruct == NULL ) break; diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp index 996d447174..8d402feb74 100644 --- a/eeschema/lib_field.cpp +++ b/eeschema/lib_field.cpp @@ -326,8 +326,6 @@ void LIB_FIELD::drawGraphic( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& if( aData ) text = *(wxString*)aData; - else if( InEditMode() ) - text = GetFullText( m_Unit ); else text = m_Text; diff --git a/eeschema/symbdraw.cpp b/eeschema/symbdraw.cpp index f6311205dc..f34f97c5ae 100644 --- a/eeschema/symbdraw.cpp +++ b/eeschema/symbdraw.cpp @@ -242,7 +242,16 @@ static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool era BASE_SCREEN* Screen = panel->GetScreen(); item->SetEraseLastDrawItem( erase ); - item->Draw( panel, DC, Screen->GetCursorDrawPosition(), -1, g_XorMode, NULL, + // if item is the reference field, we must add the current unit id + if( item->Type() == LIB_FIELD_T ) + { + int unit = ((LIB_EDIT_FRAME*)panel->GetParent())->GetUnit(); + wxString text = ((LIB_FIELD*)item)->GetFullText( unit ); + item->Draw( panel, DC, Screen->GetCursorDrawPosition(), -1, g_XorMode, &text, + DefaultTransform ); + } + else + item->Draw( panel, DC, Screen->GetCursorDrawPosition(), -1, g_XorMode, NULL, DefaultTransform ); } @@ -254,9 +263,6 @@ void LIB_EDIT_FRAME::StartMoveDrawSymbol( wxDC* DC ) SetCursor( wxCURSOR_HAND ); - if( m_drawItem->GetUnit() != m_unit ) - m_drawItem->SetUnit( m_unit ); - TempCopyComponent(); m_drawItem->BeginEdit( IS_MOVED, GetScreen()->GetCursorDrawPosition() ); DrawPanel->ManageCurseur = RedrawWhileMovingCursor;