Refresh component when children change.

This commit is contained in:
Jeff Young 2018-09-09 20:34:09 +01:00
parent 37cfa3fed9
commit 268565ee41
4 changed files with 28 additions and 11 deletions

View File

@ -752,6 +752,18 @@ void SCH_EDIT_FRAME::OnModify()
} }
void SCH_EDIT_FRAME::RefreshItem( SCH_ITEM* aItem )
{
GetCanvas()->GetView()->Update( aItem );
// Component children are drawn from their parents so we must also dirty the parent.
if( aItem->GetParent() && aItem->GetParent()->Type() == SCH_COMPONENT_T )
GetCanvas()->GetView()->Update( aItem->GetParent(), KIGFX::REPAINT );
GetCanvas()->Refresh();
}
void SCH_EDIT_FRAME::OnUpdatePaste( wxUpdateUIEvent& event ) void SCH_EDIT_FRAME::OnUpdatePaste( wxUpdateUIEvent& event )
{ {
event.Enable( m_blockItems.GetCount() > 0 ); event.Enable( m_blockItems.GetCount() > 0 );

View File

@ -347,6 +347,11 @@ public:
*/ */
void OnModify(); void OnModify();
/**
* Mark an item for refresh.
*/
void RefreshItem( SCH_ITEM* aItem );
virtual wxString GetScreenDesc() const override; virtual wxString GetScreenDesc() const override;
/** /**

View File

@ -796,10 +796,7 @@ int SCH_EDIT_FRAME::EditLine( SCH_LINE* aLine, bool aRedraw )
return wxID_CANCEL; return wxID_CANCEL;
if( aRedraw ) if( aRedraw )
{ RefreshItem( aLine );
GetCanvas()->GetView()->Update( aLine );
GetCanvas()->Refresh();
}
return wxID_OK; return wxID_OK;
} }

View File

@ -764,7 +764,11 @@ void SCH_EDIT_FRAME::PrepareMoveItem( SCH_ITEM* aItem, wxDC* aDC )
SetRepeatItem( NULL ); SetRepeatItem( NULL );
if( !aItem->IsNew() ) if( aItem->IsNew() )
{
GetCanvas()->GetView()->Add( aItem );
}
else
{ {
if( (aItem->Type() == SCH_SHEET_PIN_T) || (aItem->Type() == SCH_FIELD_T) ) if( (aItem->Type() == SCH_SHEET_PIN_T) || (aItem->Type() == SCH_FIELD_T) )
SetUndoItem( (SCH_ITEM*) aItem->GetParent() ); SetUndoItem( (SCH_ITEM*) aItem->GetParent() );
@ -952,8 +956,7 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
GetChars( item->GetClass() ) ) ); GetChars( item->GetClass() ) ) );
} }
GetCanvas()->GetView()->Update( item ); RefreshItem( item );
GetCanvas()->Refresh();
if( item->GetFlags() == 0 ) if( item->GetFlags() == 0 )
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
@ -1115,8 +1118,7 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
GetChars( item->GetClass() ) ) ); GetChars( item->GetClass() ) ) );
} }
GetCanvas()->GetView()->Update( item ); RefreshItem( item );
GetCanvas()->Refresh();
if( item->GetFlags() == 0 ) if( item->GetFlags() == 0 )
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
@ -1157,8 +1159,10 @@ void SCH_EDIT_FRAME::OnDragItem( wxCommandEvent& aEvent )
// When a junction or a node is found, a BLOCK_DRAG is better // When a junction or a node is found, a BLOCK_DRAG is better
if( m_collectedItems.IsCorner() || m_collectedItems.IsNode( false ) if( m_collectedItems.IsCorner() || m_collectedItems.IsNode( false )
|| m_collectedItems.IsDraggableJunction() ) || m_collectedItems.IsDraggableJunction() )
{
dragType = BLOCK_DRAG; dragType = BLOCK_DRAG;
} }
}
switch( item->Type() ) switch( item->Type() )
{ {
@ -1310,8 +1314,7 @@ void SCH_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent )
; ;
} }
GetCanvas()->GetView()->Update( item ); RefreshItem( item );
GetCanvas()->Refresh();
if( item->GetFlags() == 0 ) if( item->GetFlags() == 0 )
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );