13728 Commits

Author SHA1 Message Date
Jon Evans 755280dec1 Defer initialization of PIN_LAYOUT_CACHE until it is needed 2026-03-19 21:32:07 -04:00
Jon Evans 067533928b Reduce memory usage of EDA_SHAPE pt 2 2026-03-19 21:32:06 -04:00
Jon Evans 082ec945fc Reduce memory usage of text/fields
Lazy construction of caches that are only needed
for some of these reduces their footprint significantly.
2026-03-19 21:25:34 -04:00
Seth Hillbrand 72ea57d861 Allow local labels without pins if they connect
Local labels on a sheet need to be able to connect just to other labels
for intersheet routing.  This was mistakenly disallowed to check to for
dangling local labels
2026-03-19 14:21:31 -07:00
Seth Hillbrand 2439de47b7 Provide lazy loading of webview panel
Avoid instantiating the panel prior to it being shown (if at all)
2026-03-18 21:36:14 -07:00
Seth Hillbrand 36f0da1556 eeschema: abort async loads before destroying library tables
Background async library loading workers hold raw LIBRARY_TABLE_ROW
pointers into the LIBRARY_TABLE::m_rows vector. When ProjectChanged()
calls LoadProjectTables(), it destroys the old LIBRARY_TABLE objects
via unique_ptr replacement.

The workers were not aborted until after the tables were destroyed,
creating a window where workers could access freed memory.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23480
2026-03-18 12:18:23 -07:00
Mike Williams 08349b8d8a design blocks: don't crash on missing preview widget
Copied from footprint preview widget, which has the same issue
2026-03-18 10:12:43 -04:00
Bernhard Kirchen 1cece2de21 use expected color for DNP marker on sheets when plotting
Fixes https://gitlab.com/kicad/code/kicad/-/issues/23465
2026-03-17 17:11:36 +01:00
Bernhard Kirchen e3f049f4d9 ADDED: expand VARIANT and VARIANT_DESC in drawing sheets
* add VARIANT and VARIANT_DESC to the list of known vars in the drawing
  sheet editor.
* cache variant and variant description in respective objects.
* expand the respective text variables when building the drawing sheet.
* keep the cached variant and its description up-to-date when selecting
  a variant in the GUI.
* pass variant and its description to the plotters.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23430
2026-03-17 15:39:34 +00:00
Damjan Prerad 0e8c7d92a3 eeschema: add sheet custom fields to Properties panel
Extend the schematic Properties panel dynamic field handling to cover
SCH_SHEET items in addition to SCH_SYMBOL items.

This allows custom subsheet attributes added in Sheet Properties to
appear in the Properties panel.
2026-03-17 12:51:26 +01:00
Damjan Prerad 4d14471ef6 Refresh symbol chooser description caches after library parse
Fixes https://gitlab.com/kicad/code/kicad/-/work_items/23456
2026-03-16 23:50:08 +01:00
Seth Hillbrand 0c10366e84 Fix symbol chooser flicker with missing libraries
Libraries with permanent load errors (LOAD_ERROR) were re-added to
m_pending_load_libraries on every timer tick, creating an infinite
retry loop. Each iteration called m_lazyLoadHandler() which triggered
Regenerate(), rebuilding the tree and resetting scroll position every
second.

Skip LOAD_ERROR libraries instead of retrying them, and only call the
lazy load handler when at least one library was actually loaded in the
current iteration.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23455
2026-03-16 12:16:45 -07:00
Seth Hillbrand 902048a172 Move history autosave Prettify, file I/O, and git ops to background thread
Savers now serialize to in-memory HISTORY_FILE_DATA on the UI thread,
then Prettify + file writes + git stage/diff/commit run on a background
thread via GetKiCadThreadPool(). An atomic skip-if-busy flag prevents
overlapping saves; WaitForPendingSave() ensures clean shutdown.

Extracted FormatBoardToFormatter and FormatSchematicToFormatter so
SaveToHistory can serialize without touching disk. PROJECT savers use
sourcePath for file-copy semantics since project files are small.
2026-03-16 12:16:45 -07:00
Jeff Young 4241db8488 Formatting. 2026-03-16 19:06:07 +00:00
Bernhard Kirchen 911231f3ad add support for rule areas in edit -> attributes menu
Fixes https://gitlab.com/kicad/code/kicad/-/issues/23400
2026-03-13 20:27:02 +00:00
Andrew James Miller 27c033a465 Fix "Open file after plot" to use preferred PDF viewer rather than always using system default. 2026-03-13 19:02:46 +00:00
Bernhard Kirchen c040d62dec constrict cell props to table cells in properties panel
shapes like rectangles, arcs, circles, etc. must not show cell
properties in the properties panel.

closes #23398.
2026-03-13 18:57:03 +00:00
Bernhard Kirchen e81dae62ef honor rule area "exclude from BOM" in BOM
choose ResolveExcludedFromBOM() over GetExcludedFromBOM() to test refs
for exclusion from BOM in order to honor a rule area's "exclude from
BOM" flag for all refs inside that area.

closes #23411.
2026-03-13 18:53:49 +00:00
Seth Hillbrand 1c68440a17 Mark schematic modified when editing variants
Variant add, delete, rename, and copy operations in the Bulk Edit
Symbol Fields dialog (and toolbar variant selector) modify the
schematic data model but did not call OnModify(), so closing eeschema
afterward would not prompt to save changes.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23410
2026-03-12 12:10:24 -07:00
Seth Hillbrand f3441c00a3 Import Altium project variants
Parse variant data from Altium .PrjPcb project files and
apply it to both schematic symbols and board footprints
during import. Each ProjectVariant section is read as an
INI group, and per-component variation entries are mapped
to KiCad variant structures on the matching designators.
2026-03-12 09:33:59 -07:00
Wayne Stambaugh f7e9c7a11d Use cached hierarchy when resolving schematic items. 2026-03-12 08:35:45 -04:00
Seth Hillbrand 71d347b540 Remote Symbol: cap ZSTD decompressed size before allocation
A malicious or corrupt ZSTD frame content-size header could cause an
unbounded allocation.  Clamp the expected size against the provider's
max_download_bytes (if available) or a 64 MB fallback before calling
resize().
2026-03-11 13:43:26 -07:00
Seth Hillbrand 9482730559 Eeschema: share SCH_SCREEN across top-level sheets referencing same file
When multiple top-level sheets in a multi-root schematic reference the
same sub-sheet file, each sub-sheet must share a single SCH_SCREEN
object.  Previously, loadHierarchy() only searched the current root
sheet's hierarchy for an existing screen, so screens loaded by earlier
top-level sheets were never found.  This caused each top-level sheet to
create its own copy of the shared sub-sheet's screen, leading to data
loss on save as later writes would overwrite earlier ones.

Add m_loadedRootSheets to SCH_IO_KICAD_SEXPR to track root sheets from
prior LoadSchematicFile() calls within the same IO instance.  During
loadHierarchy(), after the existing search fails, also search through
previously loaded root sheets.  The cache is cleared when the SCHEMATIC
pointer changes, preventing stale references when the IO object is
reused for unrelated loads.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23403
2026-03-11 11:23:02 -07:00
Seth Hillbrand 2dbba4a60a Remote Symbol: consolidate, update and harden
Extract duplicated helpers from remote provider files into shared
utilities.  Split sendRpcMessage into purpose-specific functions.
Implement standard nonce-based exchange for re-auth.  Provide
additional models for more efficient model/symbol/fp/etc using
external URLs.  This allows us to better handle connection errors,
retries and large data packets.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23381
2026-03-11 06:41:44 -07:00
Wayne Stambaugh f982bd02cb Fix build warning.
The wxWidgets wxPATH_NORM_ALL definition throws a deprecated warning.
KiCad defines FN_NORMALIZE_FLAGS as a substitute to prevent the warning.
2026-03-10 09:18:55 -04:00
Wayne Stambaugh 585b79c369 Improve readability of variant exclude from BOM change.
The XOR of the variant exclude from BOM while technically correct gets
performed on every load which makes the intent of the change less clear.
The inversion of the state only needs to be performed when the file format
is older than the version defined in MR2485.  Also add a comment to let
developers know why this change was made.

MR https://gitlab.com/kicad/code/kicad/-/merge_requests/2485
2026-03-10 09:02:42 -04:00
Jon Evans e468788aa8 Fix up kicad-cli DRC project and library handling
Fixes https://gitlab.com/kicad/code/kicad/-/issues/23379
2026-03-09 20:42:29 -04:00
Bernhard Kirchen b49c6e1362 resolve trivial compiler warnings
introduced in 0f343a0abc and 92bb000ce6.
2026-03-09 20:48:33 +00:00
Bernhard Kirchen f4e0bd846f variants: fix boolean value for in_bom in serialzed schematic file 2026-03-09 11:58:41 -04:00
Jeff Young 81e6cfda17 Use correct instance path when climbing up the sheet hierarchy.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/23360
2026-03-08 16:49:24 +00:00
Jon Evans e761038f16 Remove parallel-path schematic CLI settings manager
This is not necessary, and since 10.0 causes invalid ERC
for several reasons:

1) Library loading now relies on grabbing the project path
   via Pgm().GetSettingsManager()

2) Bus alias definitions now live in the project file, also
   loaded through Pgm()

Also fix an issue where the LoadSchematic helper would wipe
out the bus aliases because `SCHEMATIC::Reset` could never
be called after the initial creation, but was via
`CreateDefaultScreens`.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23326
2026-03-08 10:10:11 -04:00
Jeff Young 92bb000ce6 Implement variant processing for text var resolution.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/23355
2026-03-08 12:26:28 +00:00
Jeff Young 3f7b8baff5 Reduce line-breaking. 2026-03-08 12:09:21 +00:00
Jeff Young 0f343a0abc Repair loss of earlier commit likely caused by auto-formatter.
Also fixes missing instance/variant logic when fetching
ExcludeFromSim, ExcludeFromBOM and ExcludeFromBoard.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22319
2026-03-08 12:09:21 +00:00
Jeff Young 4da7c180c2 Apply KiCad look & feel to DRC Rules Editor. 2026-03-07 19:28:46 +00:00
Jeff Young b19f3d6bab Formatting. 2026-03-07 19:28:46 +00:00
JamesJCode 69f218f8ff Auto-increment directive label fields on repeat item action
Fixes #23331
2026-03-06 21:47:15 +00:00
Ian McKernan 8acdf8d3ea Fix incorrect SVG export offset for symbols reference and value fields 2026-03-06 15:48:08 -05:00
Seth Hillbrand 2dbaa8d025 Initialize variant attributes from symbol/sheet defaults during parse
The S-expression serializer only writes variant attributes that differ
from the symbol/sheet default values.  When deserializing, the parser
created variants with all-false attribute defaults from the VARIANT
constructor.  This meant any variant attribute matching the owner's
default was silently lost on save/reload.

Call InitializeAttributes() on each variant immediately after
construction in the parser so that unparsed attributes inherit the
correct default values from the owning symbol or sheet.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23347
2026-03-06 12:31:34 -08:00
Seth Hillbrand e541232848 ERC: flag local labels with no local component pin connections
A local label that only connects to other labels or hierarchical sheet
pins without any component pin on the same sheet serves no local purpose
and is likely mislabeled. Extend the existing bus-member check to all
local labels so that ercCheckLabels() flags these cases as
ERCE_LABEL_NOT_CONNECTED.

The allPins > 1 guard prevents double-reporting with
ERCE_LABEL_SINGLE_PIN which already covers the allPins == 1 case.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23346
2026-03-06 11:53:09 -08:00
Seth Hillbrand fb1cab3e07 Fix "Save Library As" writing empty symbol library files
cacheLib() was unconditionally calling Load() for new caches even when
buffering was enabled, introduced by e013691d02 to fix issue #22191.
This broke "Save Library As" because the target file doesn't exist yet,
causing Load() to throw IO_ERROR. The exception was caught but no
symbols were added to the cache, resulting in an empty file

Additionally, the unbuffered library save path was passing the library
nickname instead of the target file path to the plugin's LoadSymbol/
SaveSymbol calls. While this was always wrong, it was masked before
e013691d02 because buffering mode skipped Load() entirely.

Fix cacheLib() to only call Load() for new caches when the library file
actually exists on disk, and fix the unbuffered save path to use the
target file path.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23337
2026-03-06 11:26:39 -08:00
Seth Hillbrand 1cf4284930 IPC-2581: use schematic revision for BOM
The BOM revision in IPC-2581 export was hardcoded to "1.0"
instead of reflecting the actual design revision.

The project file stores two separate fields: bomRev for
explicit user overrides set in the PCBnew export dialog or
via --bom-rev on the CLI, and schRevision for the value
auto-propagated from eeschema.
2026-03-06 09:13:56 -08:00
Seth Hillbrand 8dad270454 Invalidate pin count and chooser caches in RemoveDrawItem
AddDrawItem() called cachePinCount() and cacheChooserFields() after
adding items, but RemoveDrawItem() did not. This left stale cached
values after pin or field removal, causing incorrect pin counts and
stale chooser field data.
2026-03-05 09:39:04 -08:00
Seth Hillbrand 4a968e908a Fix dead sheet property validation in schematic parser
The non-const SCH_SHEET::GetField(FIELD_T) auto-creates missing
fields via emplace_back, so the null check could never be true.
Use FindField() instead, which returns nullptr when the field is
absent, making the validation check actually work.
2026-03-05 09:36:57 -08:00
Seth Hillbrand 4c8f58c123 Fix cacheShownDescription() not storing computed result
cacheShownDescription() computed shownText but never assigned it to
m_shownDescriptionCache, causing GetShownDescription() to always
return an empty string. Symbol descriptions in the chooser and
tooltips were blank as a result.
2026-03-05 09:34:36 -08:00
Seth Hillbrand a58e14178e Fix PADS multi-unit symbol import
Connector pins (e.g. J12-1 through J12-53) were imported as
separate single-pin symbols instead of units of one shared
symbol. Add BuildMultiUnitConnectorSymbol which creates a
multi-unit LIB_SYMBOL where each unit has the connector decal
graphics and one pin with the correct number.

Multi-gate parts like TL082 (U1-A, U1-B) appeared as separate
symbols because AddHierarchicalReference was called with the
unsuffixed reference "U1-A" instead of the stripped "U1".

Also move the connector SetRef call to after ApplyPartAttributes,
which only strips alphabetic gate suffixes and would otherwise
override the base reference back to "J12-1".
2026-03-05 09:04:36 -08:00
Seth Hillbrand 37b99c81c6 Fix net absorbing bus in connection graph
When a net subgraph name-matched a bus candidate, the absorption
condition at processSubGraphs only checked that the outer
connection was not a bus. It did not check whether the candidate
was a bus, so a net could absorb a bus subgraph. Later, when
resolving bus parents through the m_absorbed_by chain, the
absorbed-into subgraph had a net driver connection instead of a
bus, triggering the assertion in matchBusMember.

Add a check that the candidate is also not a bus before allowing
absorption. Also replace the assertion in matchBusMember with a
null return as defense in depth, since all callers already handle
null.
2026-03-04 12:32:57 -08:00
Alex Shvartzkop 2ff479425f Fix warning: "potentially uninitialized local variable". 2026-03-04 22:29:22 +03:00
Jon Evans 233a5cd83e Guard against accessing null field 2026-03-04 07:36:43 -05:00
Jon Evans 7b09f1f0c4 Hopefully better fix for msvc ambiguity rules 2026-03-03 23:08:42 -05:00