Browse Source

Refresh component when children change.

pull/13/head
Jeff Young 7 years ago
parent
commit
268565ee41
  1. 12
      eeschema/sch_edit_frame.cpp
  2. 5
      eeschema/sch_edit_frame.h
  3. 5
      eeschema/sch_line.cpp
  4. 17
      eeschema/schedit.cpp

12
eeschema/sch_edit_frame.cpp

@ -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 )
{
event.Enable( m_blockItems.GetCount() > 0 );

5
eeschema/sch_edit_frame.h

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

5
eeschema/sch_line.cpp

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

17
eeschema/schedit.cpp

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

Loading…
Cancel
Save