Fix variable updating in SCH_FIELDs (which are not directly in the view).

This commit is contained in:
Jeff Young 2023-02-05 20:50:24 +00:00
parent fb225acefc
commit 3ecd6ec186
2 changed files with 54 additions and 19 deletions

View File

@ -1481,25 +1481,42 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_CLEANUP_FLAGS aCleanupFlags )
GetCanvas()->GetView()->UpdateAllItemsConditionally(
[]( KIGFX::VIEW_ITEM* aItem ) -> int
{
SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aItem );
int flags = 0;
SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aItem );
SCH_CONNECTION* connection = item ? item->Connection() : nullptr;
if( connection && connection->HasDriverChanged() )
{
connection->ClearDriverChanged();
return KIGFX::REPAINT;
flags |= KIGFX::REPAINT;
}
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
if( text && text->HasTextVars() )
if( item )
{
text->ClearRenderCache();
text->ClearBoundingBoxCache();
return KIGFX::GEOMETRY | KIGFX::REPAINT;
item->RunOnChildren(
[&flags]( SCH_ITEM* aChild )
{
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild );
if( text && text->HasTextVars() )
{
text->ClearRenderCache();
text->ClearBoundingBoxCache();
flags |= KIGFX::GEOMETRY | KIGFX::REPAINT;
}
} );
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
if( text && text->HasTextVars() )
{
text->ClearRenderCache();
text->ClearBoundingBoxCache();
flags |= KIGFX::GEOMETRY | KIGFX::REPAINT;
}
}
return 0;
return flags;
} );
if( highlightedItem )

View File

@ -961,27 +961,45 @@ int SCH_EDITOR_CONTROL::AssignNetclass( const TOOL_EVENT& aEvent )
getView()->UpdateAllItemsConditionally(
[]( KIGFX::VIEW_ITEM* aItem ) -> int
{
int flags = 0;
// Netclass coloured items
//
if( dynamic_cast<SCH_LINE*>( aItem ) )
return KIGFX::REPAINT;
flags |= KIGFX::REPAINT;
else if( dynamic_cast<SCH_JUNCTION*>( aItem ) )
return KIGFX::REPAINT;
flags |= KIGFX::REPAINT;
else if( dynamic_cast<SCH_BUS_ENTRY_BASE*>( aItem ) )
return KIGFX::REPAINT;
flags |= KIGFX::REPAINT;
// Items that might reference an item's netclass name
//
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
if( text && text->HasTextVars() )
if( SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aItem ) )
{
text->ClearRenderCache();
text->ClearBoundingBoxCache();
return KIGFX::GEOMETRY | KIGFX::REPAINT;
item->RunOnChildren(
[&flags]( SCH_ITEM* aChild )
{
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild );
if( text && text->HasTextVars() )
{
text->ClearRenderCache();
text->ClearBoundingBoxCache();
flags |= KIGFX::GEOMETRY | KIGFX::REPAINT;
}
} );
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
if( text && text->HasTextVars() )
{
text->ClearRenderCache();
text->ClearBoundingBoxCache();
flags |= KIGFX::GEOMETRY | KIGFX::REPAINT;
}
}
return 0;
return flags;
} );
}