Libedit: fix a bug (affects only multi parts per packages) after moving an item.

This commit is contained in:
jean-pierre charras 2010-12-22 12:18:38 +01:00
parent b98538ec35
commit 69b19f5148
3 changed files with 17 additions and 8 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;