libs 0019: remote lib edit — invalidate, don't auto-reload; editor copy counted + re-read
- kicadLibsInvalidate: a peer's edit only drops the lib's plugin entry + pcbnew's PreloadedFootprints (the cache the old reload never cleared — tree/preview/ LoadFootprint/update-from-library kept serving the old body); the fat re-load now runs lazily or from Update-from-library (kicadLibsReload, which also clears the preloaded cache) - usage bridges count the Footprint/Symbol Editor's open copy; update re-opens an unmodified copy, reports a modified one - embind TU gets eeschema/symbol_editor on its include path; smoke probes - kicad → 27051b46e2 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Wd1r3ewftpV1DBSEArpRa
This commit is contained in:
parent
d7cb570f07
commit
767f2abfc0
8 changed files with 307 additions and 10 deletions
|
|
@ -77,6 +77,33 @@ inline void reloadLibrary( std::string aKind, std::string aNickname )
|
|||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Cheap counterpart of reloadLibrary (libs 0019): drop the lib's LIB_DATA
|
||||
* entry (plugin instance + parsed cache) so the NEXT access re-reads the
|
||||
* provider — no eager LoadLibraryEntry fat-load, no tree mail. A remote edit
|
||||
* calls this; the fat-load happens lazily when the user looks at the lib,
|
||||
* or explicitly through reloadLibrary from "Update from library".
|
||||
* (pcbnew's FOOTPRINT_LIBRARY_ADAPTER::PreloadedFootprints is invalidated by
|
||||
* the pcbnew-side caller — this header stays common-code only.)
|
||||
*/
|
||||
inline void invalidateLibrary( std::string aKind, std::string aNickname )
|
||||
{
|
||||
KIWAY_PLAYER* top =
|
||||
wxTheApp ? dynamic_cast<KIWAY_PLAYER*>( wxTheApp->GetTopWindow() ) : nullptr;
|
||||
|
||||
if( !top )
|
||||
return;
|
||||
|
||||
const bool fp = aKind == "footprint";
|
||||
const wxString nick = wxString::FromUTF8( aNickname.c_str() );
|
||||
|
||||
pcbjam_collab::runOnCoroutine( top, [fp, nick]()
|
||||
{
|
||||
Pgm().GetLibraryManager().ReloadLibraryEntry(
|
||||
fp ? LIBRARY_TABLE_TYPE::FOOTPRINT : LIBRARY_TABLE_TYPE::SYMBOL, nick );
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add one PCBJAM lib-table row at RUNTIME and load it — the lib SET is
|
||||
* otherwise frozen at boot (sym/fp-lib-table are written once in preRun).
|
||||
|
|
|
|||
Loading…
Reference in a new issue