Library Editor: fixed library manager synchronization to sym-lib-table

This commit is contained in:
Maciej Suminski 2017-11-14 17:21:38 +01:00
parent b229286313
commit d3d2770093
3 changed files with 5 additions and 5 deletions

View File

@ -49,7 +49,7 @@ void LIB_MANAGER::Sync( bool aForce )
if( aForce || m_syncHash != libTableHash ) if( aForce || m_syncHash != libTableHash )
{ {
getAdapter()->Sync(); getAdapter()->Sync( aForce );
m_syncHash = libTableHash; m_syncHash = libTableHash;
} }
} }
@ -76,7 +76,7 @@ int LIB_MANAGER::GetLibraryHash( const wxString& aLibrary ) const
auto row = m_symbolTable->FindRow( aLibrary ); auto row = m_symbolTable->FindRow( aLibrary );
// return -1 if library does not exist or 0 if not modified // return -1 if library does not exist or 0 if not modified
return row ? std::hash<std::string>{}( row->GetFullURI( true ).ToStdString() ) : -1; return row ? std::hash<std::string>{}( aLibrary.ToStdString() + row->GetFullURI( true ).ToStdString() ) : -1;
} }

View File

@ -79,11 +79,11 @@ bool LIB_MANAGER_ADAPTER::IsContainer( const wxDataViewItem& aItem ) const
} }
void LIB_MANAGER_ADAPTER::Sync() void LIB_MANAGER_ADAPTER::Sync( bool aForce )
{ {
int libMgrHash = m_libMgr->GetHash(); int libMgrHash = m_libMgr->GetHash();
if( m_lastSyncHash == libMgrHash ) if( !aForce && m_lastSyncHash == libMgrHash )
return; return;
m_lastSyncHash = libMgrHash; m_lastSyncHash = libMgrHash;

View File

@ -45,7 +45,7 @@ public:
void UpdateLibrary( const wxString& aLibraryName ); void UpdateLibrary( const wxString& aLibraryName );
void Sync(); void Sync( bool aForce = false );
protected: protected:
void updateLibrary( CMP_TREE_NODE_LIB& aLibNode ); void updateLibrary( CMP_TREE_NODE_LIB& aLibNode );