Commit Graph

45 Commits

Author SHA1 Message Date
Jon Evans 373fb56fb7 Fix legacy lib table loading logic
Also enforce locking of the mutex
2023-08-18 22:46:33 -04:00
jean-pierre charras 53b2fda184 Fix some minor compil and Coverity warnings. 2023-08-17 10:06:17 +02:00
Jon Evans 4c4bbdc8f3 Stricter API for LIB_TABLE
Prevent nickname map or row parent getting out of sync

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15315
2023-08-06 00:56:51 -04:00
Marek Roszko dffd2da8c8 Fix the shared_lock added and micro-opt the reindex 2023-02-18 11:28:19 -05:00
Marek Roszko e053fbefd7 Use a shared_mutex to read/write lock the nickIndex
Fixes sentry kicad-ax
2023-02-18 10:17:58 -05:00
Seth Hillbrand 442ee52905 Add versioning to lib tables
Sets lib table version to allow easier migration between versions
2023-01-23 22:21:12 +00:00
Seth Hillbrand 70a57505de Migrate lib tables to KICAD7 on open
If KiCad does not detect an environmental variable set for the old
library table variables AND the library table being opened references
the unset env var, we will dynamically update the env var to the new
value

Fixes https://gitlab.com/kicad/code/kicad/issues/13464
2023-01-23 22:21:12 +00:00
Seth Hillbrand efe12f2da5 Cleanup variable naming
Also remove ancient/unused code for lazy resolving
2023-01-23 22:21:12 +00:00
Jon Evans dd94b2d3a7 Rename PROPERTIES to STRING_UTF8_MAP for clarity
This class has nothing to do with the properties system
2022-11-06 11:51:52 -05:00
qu1ck 6ebb3baa3b PCM: autoload libs from installed packages to global lib tables
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/9713
2022-09-23 16:16:13 +00:00
Jon Evans 26ba8e1938 Don't use recursive mutex for nicknames anymore 2022-09-04 13:01:32 -04:00
Jon Evans 300d92438c Allow hiding symbol library tables from symbol chooser
Hidden but loaded libraries are useful when using database libraries
2022-08-26 20:18:40 -04:00
Jon Evans ae6a2a6443 ADDED: Database libraries MVP
Allows placing parts from an external database that reference symbols from another loaded library.

Includes:
- nanodbc wrapper
- database schematic library plugin
- basic tests

Fixes https://gitlab.com/kicad/code/kicad/-/issues/7436
2022-08-26 10:51:13 -04:00
Jeff Young a187076438 Use natural order sorting for FP libraries.
Fixes https://gitlab.com/kicad/code/kicad/issues/10349
2022-01-22 12:16:07 +00:00
Jeff Young de49f5090d Formatting (and auto reduction). 2022-01-22 12:16:07 +00:00
Seth Hillbrand 70841c6393 Fix a crash bug when changing footprint name
Save-As to a new footprint name will cause the fp table to reload.  We
were incorrectly locking the indices in a manner that did not protect
the proper index, causing lock errors that threw/crashed editor
2021-12-09 10:46:43 -08:00
Jeff Young f606679164 Proper numeric sorting for intersheet refs.
Also expunges the horrifically named std::remove and std::remove_if
(neither of which remove anything).
2021-10-01 18:29:21 +01:00
Jeff Young b84d1456d5 KIFACE_I -> KIFACE_BASE. 2021-09-14 23:45:14 +01:00
Ian McInerney ecd9bf696e Be consistent about using nullptr instead of 0
0 can be too easily overloaded into an int, so ensure we use nullptr
when we mean pointers.
2021-04-22 22:20:34 +01:00
Ian McInerney ae91042544 Implement thread safety for symbol loading routines
These functions can be called from any thread of the library
loader, so we need to ensure we have some thread safety with them.
2021-04-18 18:39:46 +01:00
Wayne Stambaugh 1eee72ec65 Fix library tree behavior when duplicate project table entry is disabled.
Fixes https://gitlab.com/kicad/code/kicad/issues/5438
2021-01-11 07:46:07 -05:00
Jeff Young bb232e6ac6 Unify LIB_IDs now that both are stored in sexpr files.
Fixes https://gitlab.com/kicad/code/kicad/issues/6764
2020-12-18 00:30:26 +00:00
Marek Roszko e928b2d8fd Split EDA_UNITS out from common. 2020-10-25 00:02:52 -04:00
jean-pierre charras 36bc44e6d7 more cleanup about removing useless include 2020-10-02 19:56:10 +02:00
Jeff Young cc9ac37a0e Add text variable support to envVar processing. 2020-04-05 20:52:26 +01:00
Jon Evans e59a3d981e Implement a new settings framework across all of KiCad
CHANGED: Settings are now stored in versioned sub-directories
ADDED: First-run dialog for migrating settings from a previous version
CHANGED: Settings are now stored as JSON files instead of wxConfig-style INI files
CHANGED: Color settings are now all stored in a separate settings file
CHANGED: The symbol editor and footprint editor now have their own settings files
CHANGED: Color settings are no longer exposed through BOARD object
CHANGED: Page layout editor now uses Eeschema's color scheme

Settings are now managed through a central SETTINGS_MANAGER held by PGM_BASE.
Existing settings will be migrated from the wxConfig format on first run of each application.
Per-application settings are now stored in one class for each application.
2020-02-19 23:44:56 -05:00
Simon Richter 48ce1239a2 Remove unused LIB_TABLE_ROW::Parse 2020-02-05 09:56:41 +00:00
Seth Hillbrand 0ba0c17245 Alphabetize Library Table returns
KiCad is case sensitive but we need to be consistent in displaying sort
order as case insensitive (same as file systems)

Fixes: lp:1836911
* https://bugs.launchpad.net/kicad/+bug/1836911

(cherry picked from commit ebba15fe67)
2019-08-19 16:07:13 -07:00
John Beard 84d79ec10d QA: LIB_TABLE tests
Some basic tests on LIB_TABLE and LIB_TABLE_ROW that demonstrate
the behaviour of fallbacks and various access methods.

Also add a few LIB_TABLE_BASE comments and changed some NULLs to
nullptr.
2019-02-04 19:44:54 -08:00
Jeff Young aa7da5dfcd Treat ${...} and $(...) envvar references uniformly.
Fixes: lp:1769282
* https://bugs.launchpad.net/kicad/+bug/1769282
2018-05-05 23:40:40 +01:00
Jeff Young 91cfecaa12 Don't allow wxDataViewCtrl updates during model update.
Also checks to make sure libraries are activated before adding
them to the component tree.

Fixes: lp:1765286
* https://bugs.launchpad.net/kicad/+bug/1765286
2018-04-28 10:45:32 +01:00
Wayne Stambaugh bf44d394c3 Eeschema: fix remapping bug on windows builds.
The Windows drive specifier C: was being interpreted as a valid URL by
wxURI which was performing a URL comparison instead of a file comparison
which always failed in LIB_TABLE_BASE::FindRowByURI().  Change test for
URI to search string for "://" to determine if the comparison should be
a URI (string) comparison or a file (wxFileName) comparison.

Don't run final rescue unless the user performs the remapping.
2018-01-03 08:37:54 -05:00
Wayne Stambaugh 8f0e6469ca Minor symbol remapping fixes.
The remapping utility would create a new project specific library when a
symbolic link pointed to a library already defined in the symbol library
table.  Now the comparison checks to see if the library path and file
name are actually a symbolic link if the file names are not the same when
the symbol library table entry is a file name rather than a URL.  URLs
are simple string comparisons.

Disable the remap button after the remapping completed.

Remove some commented out code from the edit symbol in schematic dialog.

Fixes lp:1738634

https://bugs.launchpad.net/kicad/+bug/1738634
2017-12-22 08:03:49 -05:00
Oliver 8b140186fe Only enumerate active libraries 2017-11-21 08:18:35 -05:00
Oliver f85ce87e44 Toggle LIB_TABLE_ROW enabled/disabled in grid editor
- Checkbox editor for enabled / disabled status
2017-11-21 08:18:17 -05:00
Oliver 7cdb78e852 Added "enabled" parameter for LIB_TABLE_ROW
- Read and write from lib-table working
2017-11-21 08:18:06 -05:00
Wayne Stambaugh 36f6d4a1f4 Convert symbol library editor over to use symbol library table.
Simplify some of the library editing code.  There have been a few minor
changes in the behavior of the editor.  If the current symbol is deleted
from the library, the next symbol in the library is not loaded.  The
deleted symbol is cleared and the current symbol is empty.

Change component to symbol to align with the preferred terminology
discussed on the developer's mailing list.

Add separate update UI event for save library as to enable the menu entry
whenever a library is selected.

Change the select symbol list dialog to a single column using the LIB_ID
format LIB_NICKNAME:LIB_ITEM_NAME so that the selection can be parsed by
LIB_ID.

Add method to expand URI to LIB_TABLE_BASE.

Override wxApp::OnExceptionInMainLoop() in debug builds to make debugging
easier when an unhandled exception occurs in a wxUpdateUIEvent handler.

Change SCH_SCREENS::HasNoFullyDefinedLibIds() to return false when the
schematic has no symbols to prevent the remapping dialog from being run.

Use SCH_COMPONENT part reference when creating netlist rather than looking
up the library symbol.
2017-11-09 18:50:20 -05:00
Wayne Stambaugh 0cf2df51c6 Convert symbol library viewer over to symbol library table.
Remove all instances of PART_LIBS and replace them with SYMBOL_LIB_TABLE
except for the CMP_TREE_MODEL_ADAPTER which requires updating as well.

Return the selected symbol using the LIB_NICKNAME:SYMBOL_NAME format when
viewer is launched as modal.

Add code to SYMBOL_LIB_TABLE object to allow enumerating symbol library
power symbols only.

Add a non-const version of LIB_TABLE::findRow().

Remove redundant information from Doxygen comments.
2017-11-09 18:50:17 -05:00
Wayne Stambaugh 96c3d5ff21 Enable symbol library table remapping.
Check the if the schematic being loaded has been remapped (no symbol
library table nicknames defined) and remap accordingly.

Fix issues when resolving the library symbol links in the schematic
symbols.

Add cache library fallback when resolving symbols that cannot be
remapped.

Add remap complete message to remap dialog.

Add HasLibrary() helper to LIB_TABLE_BASE.

Fix issues when loading library symbols using symbol library table.

Add hashing function to symbol library table.

Improve the symbol panel message to warn user when cache library is
used to resolve symbol.
2017-11-09 18:50:17 -05:00
Kristoffer Ödmark 19d5cc7548 Removed all exception specifiers since deprecated.
Exception specifiers are deprecated in cpp11, so went through them all
and removed them from the code.
2017-06-12 13:54:55 -04:00
Wayne Stambaugh b4e2757119 Make FP_TBL_MODEL reusable.
Factor out the FP_LIB_TABLE specific content from FP_TBL_MODEL into a new
LIB_TABLE_GRID class that can be used for any library table grid mix in.

Create new FP_LIB_TABLE_GRID object for the footprint library edit dialog.

Add method GetEnvVariables() to return any environment variables found in
a LIB_TABLE object.
2017-03-30 18:36:37 -04:00
Wayne Stambaugh 9ddb4fe67e Fix uncaught exception in footprint and symbol library table parsers.
Fixes Coverity CID 154580
Fixes Coverity CID 154581
Fixes Coverity CID 154582
Fixes Coverity CID 154583
Fixes Coverity CID 154584
Fixes Coverity CID 154585
2017-03-17 07:56:47 -04:00
jean-pierre charras d7ed3ede72 Ensure paths and filenames are always stored with '/' as separator in fp_lib_table, like in other kicad files.
Ensure also paths and filenames read from a fp_lib_table always use '/' as separator (works fine on Windows)
Fixes: lp:1658534
https://bugs.launchpad.net/kicad/+bug/1658534
2017-01-23 11:32:58 +01:00
Wayne Stambaugh 64c892ee23 Make footprint ID into a generic library ID.
Rename FPID to LIB_ID as is now used as a generic library identifier and
is no longer specific to footprints.

Remove all mention of footprint from the new LIB_ID doxygen comments and
code.

Rename files fpid.h and fpid.cpp to lib_id.h and lib_id.cpp.

Rename fp_lib_table.keywords file to lib_table.keywords and adjust CMake
build dependencies accordingly.

Update all source files effected by the code and file name changes.

Update .gitignore for file name changes.
2016-11-20 18:35:08 -05:00
Wayne Stambaugh 40e93d263d Split out library table common code into separate source files. 2016-11-20 13:34:03 -05:00