Remove excessive schematic symbol library re-linking.
For some reason, the schematic symbol library link was being regenerated every time the schematic was redrawn in SCH_SCREEN::Draw(). Remove the re-link call from the Draw() and Plot() functions. Add function the SCH_SCREENS to update the links in all of the schematic sheets. Update all schematic sheet symbol library links whenever the symbol library list is modified or any library in the library list is modified. That should cover all cases where the symbol library links could be broken. Refresh schematic window after applying library changes to update any possible symbol changes. Add KIWAY message to update the schematic when symbol library changes could change the schematic. The KIWAY mail was used because the schematic frame is not a parent of the symbol library editor so wxEvents cannot be used.
This commit is contained in:
parent
84835ed4e1
commit
f181961866
|
@ -230,7 +230,8 @@ public:
|
|||
* loads all of the project's libraries into this container, which should
|
||||
* be cleared before calling it.
|
||||
*/
|
||||
void LoadAllLibraries( PROJECT* aProject, bool aShowProgress=true ) throw( IO_ERROR, boost::bad_pointer );
|
||||
void LoadAllLibraries( PROJECT* aProject, bool aShowProgress=true )
|
||||
throw( IO_ERROR, boost::bad_pointer );
|
||||
|
||||
/**
|
||||
* Function LibNamesAndPaths
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -587,6 +587,8 @@ public:
|
|||
int GetMarkerCount( enum MARKER_BASE::TYPEMARKER aMarkerType,
|
||||
enum MARKER_BASE::MARKER_SEVERITY aSeverity );
|
||||
|
||||
void UpdateSymbolLinks();
|
||||
|
||||
private:
|
||||
void AddScreenToList( SCH_SCREEN* aScreen );
|
||||
void BuildScreenList( EDA_ITEM* aItem );
|
||||
|
|
|
@ -33,8 +33,9 @@
|
|||
#include <kiway_express.h>
|
||||
#include <macros.h>
|
||||
#include <eda_dde.h>
|
||||
#include <schframe.h>
|
||||
#include <class_drawpanel.h>
|
||||
|
||||
#include <schframe.h>
|
||||
#include <general.h>
|
||||
#include <eeschema_id.h>
|
||||
#include <lib_draw_item.h>
|
||||
|
@ -217,6 +218,10 @@ void SCH_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
|
|||
}
|
||||
break;
|
||||
|
||||
case MAIL_SCH_REFRESH:
|
||||
GetCanvas()->Refresh();
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
|
|
@ -152,6 +152,15 @@ void LIB_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event )
|
|||
// Force a reload of the PART_LIBS
|
||||
prj->SetElem( PROJECT::ELEM_SCH_PART_LIBS, NULL );
|
||||
prj->SetElem( PROJECT::ELEM_SCH_SEARCH_STACK, NULL );
|
||||
|
||||
// Update the schematic symbol library links.
|
||||
SCH_SCREENS schematic;
|
||||
|
||||
schematic.UpdateSymbolLinks();
|
||||
|
||||
// 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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,6 +231,12 @@ void SCH_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event )
|
|||
// Force a reload of the PART_LIBS
|
||||
prj->SetElem( PROJECT::ELEM_SCH_PART_LIBS, NULL );
|
||||
prj->SetElem( PROJECT::ELEM_SCH_SEARCH_STACK, NULL );
|
||||
|
||||
// Update the schematic symbol library links.
|
||||
SCH_SCREENS schematic;
|
||||
|
||||
schematic.UpdateSymbolLinks();
|
||||
GetCanvas()->Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include <class_library.h>
|
||||
#include <template_fieldnames.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <schframe.h>
|
||||
|
||||
#include <dialog_choose_component.h>
|
||||
#include <component_tree_search_container.h>
|
||||
|
@ -445,6 +446,21 @@ bool LIB_EDIT_FRAME::SaveActiveLibrary( bool newFile )
|
|||
UpdateAliasSelectList();
|
||||
UpdatePartSelectList();
|
||||
|
||||
// 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.
|
||||
if( !newFile )
|
||||
{
|
||||
SCH_SCREENS schematic;
|
||||
|
||||
schematic.UpdateSymbolLinks();
|
||||
|
||||
// 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 );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -534,7 +550,8 @@ void LIB_EDIT_FRAME::DeleteOnePart( wxCommandEvent& event )
|
|||
search_container.AddLibrary( *lib );
|
||||
|
||||
wxString dialogTitle;
|
||||
dialogTitle.Printf( _( "Delete Component (%u items loaded)" ), search_container.GetComponentsCount() );
|
||||
dialogTitle.Printf( _( "Delete Component (%u items loaded)" ),
|
||||
search_container.GetComponentsCount() );
|
||||
|
||||
DIALOG_CHOOSE_COMPONENT dlg( this, dialogTitle, &search_container, m_convert );
|
||||
|
||||
|
|
|
@ -133,6 +133,11 @@ static bool insert_library( PROJECT *aProject, PART_LIB *aLibrary, size_t aIndex
|
|||
}
|
||||
aProject->SetElem( PROJECT::ELEM_SCH_PART_LIBS, libs );
|
||||
|
||||
// Update the schematic symbol library links since the library list has changed.
|
||||
SCH_SCREENS schematic;
|
||||
|
||||
schematic.UpdateSymbolLinks();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -562,8 +562,6 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode
|
|||
* their SCH_SCREEN::Draw() draws nothing
|
||||
*/
|
||||
|
||||
CheckComponentsToPartsLinks();
|
||||
|
||||
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
|
||||
{
|
||||
if( item->IsMoving() || item->IsResized() )
|
||||
|
@ -584,8 +582,6 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode
|
|||
*/
|
||||
void SCH_SCREEN::Plot( PLOTTER* aPlotter )
|
||||
{
|
||||
CheckComponentsToPartsLinks();
|
||||
|
||||
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
|
||||
{
|
||||
aPlotter->SetCurrentLineWidth( item->GetPenSize() );
|
||||
|
@ -1386,12 +1382,6 @@ void SCH_SCREENS::BuildScreenList( EDA_ITEM* aItem )
|
|||
{
|
||||
SCH_SCREEN* screen = (SCH_SCREEN*) aItem;
|
||||
|
||||
// Ensure each component has its pointer to its part lib LIB_PART
|
||||
// up to date (the cost is low if this is the case)
|
||||
// We do this update here, because most of time this function is called
|
||||
// to create a netlist, or an ERC, which need this update
|
||||
screen->CheckComponentsToPartsLinks();
|
||||
|
||||
AddScreenToList( screen );
|
||||
EDA_ITEM* strct = screen->GetDrawItems();
|
||||
|
||||
|
@ -1524,6 +1514,14 @@ int SCH_SCREENS::GetMarkerCount( enum MARKER_BASE::TYPEMARKER aMarkerType,
|
|||
return count;
|
||||
}
|
||||
|
||||
|
||||
void SCH_SCREENS::UpdateSymbolLinks()
|
||||
{
|
||||
for( SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() )
|
||||
screen->CheckComponentsToPartsLinks();
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
void SCH_SCREEN::Show( int nestLevel, std::ostream& os ) const
|
||||
{
|
||||
|
|
|
@ -40,8 +40,11 @@ enum MAIL_T
|
|||
MAIL_BACKANNOTATE_FOOTPRINTS, ///< CVPCB->SCH footprint stuffing at cvpcb termination
|
||||
MAIL_EESCHEMA_NETLIST, ///< EESCHEMA->CVPCB netlist immediately after launching CVPCB
|
||||
MAIL_SCH_PCB_UPDATE, ///< Sch->PCB forward update
|
||||
MAIL_SCH_PCB_UPDATE_REQUEST ///< Sch->PCB forward update, requests SCH to re-generate netlist and send it to PCB via another mail (kind of bootstrap)
|
||||
|
||||
///< Sch->PCB forward update, requests SCH to re-generate netlist and send it to PCB
|
||||
///< via another mail (kind of bootstrap)
|
||||
MAIL_SCH_PCB_UPDATE_REQUEST,
|
||||
MAIL_SCH_REFRESH ///< The the schematic editor to refresh the display.
|
||||
};
|
||||
|
||||
#endif // MAIL_TYPE_H_
|
||||
|
|
Loading…
Reference in New Issue