58 Commits

Author SHA1 Message Date
Seth Hillbrand
60822714de Prevent mutex deadlock
Load calls migrate so they don't both need locks
2025-07-14 14:22:46 -07:00
Jeff Young
f7e85a7b20 Improved thread safety. 2025-07-14 13:17:53 +01:00
Jeff Young
abc23a313d Lock safety.
("row" should not exceed the lifetime of "lock".)
2025-06-05 18:01:44 +01:00
Jeff Young
5dc8e9a5de Formatting. 2025-02-01 11:38:07 +00:00
Wayne Stambaugh
f161d94521 Common folder housekeeping part 2. 2025-01-14 15:25:05 -05:00
Seth Hillbrand
0b2d4d4879 Revise Copyright statement to align with TLF
Recommendation is to avoid using the year nomenclature as this
information is already encoded in the git repo.  Avoids needing to
repeatly update.

Also updates AUTHORS.txt from current repo with contributor names
2025-01-01 14:12:04 -08:00
Jeff Young
f40cb8dcb8 Remove a couple of fixed-version-number stragglers.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18809
2024-12-26 17:53:03 +00:00
John Beard
653d85f9fc Abstract LIB_TABLE IO to allow non-file-based tables
Mostly intended right now for allowing testing of library tables
to help with testing chained loading, but it also decouples the
idea of a library table from on-disk files in general.

All current (real) lib table implementations continue to use the
file-based IO.

This could be made more general (not just for tables) if really
needed.
2024-09-19 06:35:43 +01:00
Seth Hillbrand
7214ef1f14 Remove basic masking class map_string_utf8
This is just std::map<std::string, UTF8>, using the class just masks
what it is and adds unclear functions.
2024-08-19 11:51:13 -07:00
Jeff Young
431087fc7c Don't deadlock when adding rows. 2024-07-23 17:49:34 +01:00
Jeff Young
0f099ac65e Use lock when clearing and loading libTables.
Also make sure it's re-indexed after loading.
2024-07-23 09:53:01 +00:00
Jeff Young
d5c7ac5065 Fix scoping of lock. 2024-07-21 17:44:07 +01:00
Jon Evans
639f59839e Make sure database library has updated pointer to library table
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17903


(cherry picked from commit 1a76fce2552bc570ca9a7256326ea08646ec11e8)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2024-05-03 15:39:33 +00:00
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 ebba15fe67682d4e970e592b76993375975b0b06)
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