eeschema: Prevent excess link updates

Refreshing the symbols for each paint is excessive to catch the change
from library loads.  Instead we catch them on the KIWAY MAIL update
This commit is contained in:
Seth Hillbrand 2018-12-06 05:33:12 -07:00
parent b8de4e73bf
commit ed506dd05e
3 changed files with 6 additions and 19 deletions

View File

@ -257,10 +257,15 @@ void SCH_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
break;
case MAIL_SCH_REFRESH:
{
SCH_SCREENS schematic;
schematic.UpdateSymbolLinks();
schematic.TestDanglingEnds();
GetCanvas()->GetView()->UpdateAllItems( KIGFX::ALL );
GetCanvas()->Refresh();
break;
}
case MAIL_IMPORT_FILE:
{
// Extract file format type and path (plugin type and path separated with \n)

View File

@ -1491,15 +1491,6 @@ bool LIB_EDIT_FRAME::SynchronizePins()
void LIB_EDIT_FRAME::refreshSchematic()
{
// This is not the most effecient way to do this because the changed library may not have
// any effect on the schematic symbol links. Since this is not called very often, take the
// hit here rather than the myriad other places (including SCH_SCREEN::Draw()) where it was
// being called.
SCH_SCREENS schematic;
schematic.UpdateSymbolLinks();
schematic.TestDanglingEnds();
// There may be no parent window so use KIWAY message to refresh the schematic editor
// in case any symbols have changed.
Kiway().ExpressMail( FRAME_SCH, MAIL_SCH_REFRESH, std::string( "" ), this );

View File

@ -685,15 +685,6 @@ void SCH_DRAW_PANEL::onPaint( wxPaintEvent& aEvent )
// (depending on platforms). Do nothing in this case
return;
SCH_SCREEN* screen = static_cast<SCH_SCREEN*>( GetScreen() );
// The screen might be null if the wxPaintEvent is fired after the parent frame deletion
if( !screen )
return;
// Ensure links are up to date, even if a library was reloaded for some reason:
screen->UpdateSymbolLinks();
if( m_painter )
static_cast<KIGFX::SCH_PAINTER*>(m_painter.get())->GetSettings()->ImportLegacyColors( nullptr );