1948 Commits

Author SHA1 Message Date
Alex Shvartzkop 2f18ec973d Don't raise KICAD_MANAGER_FRAME in ctor.
There's no point trying to raise a window before showing.

This triggered the wx issue https://github.com/wxWidgets/wxWidgets/issues/25348
2026-03-18 15:25:33 +03: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
Seth Hillbrand b16cead02a Accept all Altium PCB extensions on import
When importing an Altium project, the handler only recognized
PcbDoc files. Projects that reference Circuit Studio, Circuit
Maker, or SolidWorks PCB files (CSPcbDoc, CMPcbDoc, SWPcbDoc)
had their board silently skipped. Map each extension to its
correct PCB_IO plugin type so the right parser is used.
2026-03-12 08:15:26 -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
Seth Hillbrand b79862e7b8 Reset git cancel flag when opening new project
EmptyTreePrj() sets the KIGIT_COMMON cancel flag to true during
project close to stop in-flight git operations. However, when
ReCreateTreePrj() opens a new git repository for the next project,
the cancel flag was never reset to false. Since the KIGIT_COMMON
object persists across project switches (owned by PROJECT_TREE),
all git operations (status icons, sync, fetch) were permanently
disabled after the first project close.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23344
2026-03-06 11:44:56 -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 4a3899d30d Add PCM v2 schema and content negotiation
Load both v1 and v2 JSON schemas at startup and select the
validator based on the repository's schema_version field. Send
an Accept header with the v2 vendor media type so the server
can respond with the appropriate schema version.

Defuse the v1 schema by removing forward-looking type enum
values and opening the category field to free strings. Add a
v2 schema that uses pattern-validated open strings for type,
category, and license.

Skip packages with unrecognized types in the dialog rather
than displaying broken entries.
2026-03-05 15:08:20 -08:00
Seth Hillbrand 5852001c71 Fix import project lockup on cancel
When the "directory not empty" dialog appeared during non-KiCad
project import, clicking No fell through to CreateNewProject and
LoadProject on the non-empty directory. This caused the main
thread to hang in LOCAL_HISTORY::Init as libgit2 tried to index
all files in the source directory.

The dialog now has Yes/No/Cancel buttons. Cancel and mkdir
failures loop back to directory selection instead of aborting
or falling through. No continues with the non-empty directory.
2026-03-04 12:32:57 -08:00
Seth Hillbrand ea87a99c9e Remove partial layer map from PCB import
The --layer-map and --auto-map CLI arguments were mistakenly committed
in a rebase.  This will be a v11 feature, so remove the flags for v10.
2026-03-04 09:32:35 -08:00
Seth Hillbrand 37cbfbdaaa Fix build warnings
So. many. build warnings. :)  Ran multiple times with clang and gcc to
try to get them all
2026-03-02 13:28:48 -08:00
Seth Hillbrand 5a9d351400 Accept bare generated-field names in CLI BOM export
The CLI BOM export requires generated field names like ${QUANTITY}
and ${DNP} to be wrapped in ${} delimiters. When users pass these
on the command line inside double quotes, the shell expands ${VAR}
to an empty string, silently dropping the field from the output.

Normalize field names in the job handler so that bare tokens like
QUANTITY, DNP, ITEM_NUMBER, EXCLUDE_FROM_BOM, EXCLUDE_FROM_BOARD,
and EXCLUDE_FROM_SIM are accepted alongside the canonical ${} form.
Update the default --fields value and help text to use the shell-safe
bare form.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22613
2026-02-23 18:03:52 -08:00
Seth Hillbrand fa774866be Use addVariantsArg() for PCB CLI exports
Replace hand-rolled --variant argument registration and parsing
in 9 PCB export commands with the existing addVariantsArg()
infrastructure from CLI::COMMAND. This removes redundant
ARG_VARIANT defines that shadowed the one in command.h, and
replaces manual From_UTF8 parsing with m_argVariantNames
populated automatically by COMMAND::Perform().
2026-02-22 19:05:28 -08:00
Seth Hillbrand 93760c58f8 Add --variant support to all PCB export commands
The variant system correctly affected 3D visualization but all CLI
export paths (STEP, SVG, PDF, DXF, PS, Gerber, IPC-2581, ODB++) lost
the in-memory variant state because kicad-cli loads the board fresh
from disk.

Add m_variant field to JOB_EXPORT_PCB_3D, JOB_EXPORT_PCB_IPC2581, and
JOB_EXPORT_PCB_ODB. Add --variant CLI argument to all PCB plot, 3D,
IPC-2581, and ODB++ export commands. Each job handler now calls
SetCurrentVariant() on the board after loading, so variant-aware DNP
and BOM filtering works correctly during export.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23159
2026-02-20 16:41:50 -08:00
Jeff Young c927d9ddb7 Meet irreflexive sort criteria.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/23154
2026-02-19 13:28:57 +00:00
Jeff Young a2058a5e4e Formatting. 2026-02-19 13:28:42 +00:00
Seth Hillbrand 34ff7a5977 Minor cleanups
Remove stale m_ShowRepairSchematic member from
advanced_config.h left behind when RepairSchematic() was
retired. Remove unnecessary const_cast in wxExecute call
in jobs_runner.cpp. Fix stray semicolon after return in
pcb_barcode.cpp and use >= ZINT_ERROR instead of truthiness
for the ZBarcode_Buffer_Vector return check.
2026-02-18 20:16:44 -08:00
Seth Hillbrand 90af730dbc Run jobset Execute Command through a shell for proper expansion
The Execute Command job in jobsets was calling wxExecute() with a plain
string, which on Unix calls execvp() directly without shell interpretation.
This meant that shell features like glob expansion (*.txt), pipes (|),
and other shell constructs did not work when invoking binaries directly.
Shell scripts worked because the shebang invoked a shell that handled
expansion.

Fix by using the array form of wxExecute to invoke the platform shell
(/bin/sh -c on Unix, cmd.exe /c on Windows), passing the entire command
as a single argument. This avoids quoting issues with shell metacharacters
while ensuring all shell features work consistently.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21708
2026-02-18 18:19:56 -08:00
Seth Hillbrand 5903b426be Remove deprecated CLI gerber and arg
The standalone `pcb export gerber` command was deprecated in
V9 in favor of `pcb export gerbers`. The `--plot-invisible-text`
argument was deprecated across pcb export dxf, gerbers, pdf,
and svg when the underlying action was removed.

Per the one-cycle deprecation policy, both are now removed for
V10. The gerber base class is preserved since gerbers inherits
from it. Shell completions for bash and zsh are updated, and the
CLI test now uses the gerbers directory-output interface.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23056
2026-02-16 20:14:05 -08:00
Seth Hillbrand c52ab91c84 Reduce compile times by extracting headers
Break the most expensive header include chains that contaminate the
largest number of translation units

New lightweight headers for extractdded types:
font_metrics.h, mouse_drag_action.h, board_project_settings_params.h,
common_settings_internals.h, wx_infobar_message_type.h,
zone_layer_properties_grid.h
2026-02-13 17:10:45 -08:00
Seth Hillbrand c0230e74c1 Attempt to fix crash on exit
The update check runs on the thread pool and captures a raw pointer to the
KICAD_MANAGER_FRAME for CallAfter. If the update check completes during
frame destruction, the CallAfter targets a partially-destroyed window,
causing a segfault in wxWindowBase::RemoveEventHandler via wxAuiNotebook
destruction.  At least, that is the theory...

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22593
2026-02-13 11:05:53 -08:00
Seth Hillbrand 36e7a2c014 Fix linker error on Fedora Rawhide
GetCurrentFileName() was defined inline in kicad_manager_frame.h,
calling GetProjectFileName() which is only defined in the kicad
module. When GCC 15 emits the out-of-line vtable entry into
libcommon.a, programs like bitmap2component that link libcommon
without the kicad module fail with an undefined reference. Moving
the definition to the .cpp file keeps the symbol reference within
the kicad module where it can be resolved.
2026-02-11 11:28:54 -08:00
Seth Hillbrand e12751da40 Eeschema: Add gEDA/Lepton EDA importer
Add a schematic importer for gEDA and Lepton EDA .sch files.
The importer parses the full gEDA file format including
components, nets, buses, attributes, text, graphical
primitives, and paths with bezier curves.

A builtin symbol library ships 39 standard gEDA symbols so
import works without a gEDA installation. Symbol resolution
follows an 11-step search chain matching native gEDA/Lepton
conventions across environment variables, system paths, XDG
directories, RC files, config files, and project directories.
Last-found-wins priority matches native gEDA behavior.

RC file parsing handles gafrc and gschemrc component-library
directives. Lepton-EDA INI configs (lepton.conf, geda.conf)
are also parsed.

Project import reads gEDA .prj files and discovers schematics
and PCBs automatically.

File format knowledge and embedded symbol definitions derived
from gEDA/gaf (C) 1998-2010 Ales Hvezda, 1998-2016 gEDA
Contributors, and Lepton EDA (C) 2017-2024 Lepton EDA
Contributors. Both licensed under GNU GPL v2 or later.
2026-02-11 11:20:41 -08:00
Seth Hillbrand 0e7a052af0 PADS: add ASCII format importer for PCB and schematic files
Add complete import support for PADS ASCII (.asc) files, covering both
PCB layouts and schematics. The importer handles board outlines, copper
pours, routing with via inference, footprint decals, net assignment,
design rules, and component placement for PCB files. For schematics, it
supports symbol building from CAEDECAL definitions, multi-gate and
multi-variant parts, power symbols, wire routing, net labeling, arc
graphics, title blocks, and hierarchical sheet connectivity.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19944
2026-02-10 21:21:22 -08:00
Seth Hillbrand 7db7083cd0 Use project-relative paths in sym-lib-table for imported libraries
When importing Altium projects, the MAIL_ADD_LOCAL_LIB handler stored
absolute paths in the sym-lib-table for native Altium library files
(.SchLib). This caused broken library references when the project was
moved to a different location.

Now library files outside the project directory are copied into it
during import, and the sym-lib-table URI uses ${KIPRJMOD}/ prefix
for project-relative paths. This matches the behavior of the Eagle,
CADSTAR, and EasyEDA Pro importers.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22941
2026-02-10 11:40:49 -08:00
Adam Wysocki 15a12b5392 CLI: Enable plotPadNumbers when sketching pads on fab layers 2026-02-08 20:45:26 +00:00
Jeff Young 94757f6239 Set an actual min height to project tree.
This allows the local history pane to be resized upwards.
Using -1 *should* mean "don't set", but it evidently has
some side-effects, after which the splitter bar will only
move down and not up.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22959
2026-02-08 15:04:03 +00:00
Jeff Young 596604590e Formatting. 2026-02-08 15:04:03 +00:00
Jeff Young 949e24dff4 Fix a couple more strings. 2026-02-06 15:53:01 +00:00
Jeff Young 482b4a4782 String fixes.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/22947
2026-02-05 18:09:01 +00:00
jean-pierre charras 9c1654c496 DIALOG_TEMPLATE_SELECTOR: disable call on MINGW to RunScriptAsync(), not working. 2026-02-05 12:38:35 +01:00
Jon Evans 04de9391d6 Formatting fixup 2026-02-04 18:35:27 -05:00
Jon Evans fc5d551692 Preload libraries even when no project is loaded
Fixes https://gitlab.com/kicad/code/kicad/-/issues/22924
2026-02-04 18:34:02 -05:00
John Beard 19d463d144 CLI: correct file/dir output argument types in the CLI help.
SCH_EXPORT_PLOT_COMMAND had a default true (all others default
false) for dir output.
2026-02-04 16:24:04 +08:00
Seth Hillbrand f22dba503c Defer template list refresh after duplication to prevent use-after-free
Duplicating a template copies files that trigger OnFileSystemEvent,
which starts a 500ms refresh timer. The subsequent DisplayInfoMessage
runs a modal event loop during which the timer fires, calling
RefreshTemplateList which destroys all TEMPLATE_WIDGETs including the
one whose onDuplicateTemplate is still on the call stack. When the
modal dialog closes, any further member access is undefined behavior.

Defer both the info message and the refresh via CallAfter so they
execute after the event handler has returned and the call stack is
clean.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22931
2026-02-03 14:49:18 -08:00
Alex Shvartzkop 3c3313108f Avoid template title clipping in template selector dialog. 2026-02-04 01:31:55 +03:00
Alex Shvartzkop d0b22171ae Add "Open Template Folder" in template selector dialog. 2026-02-04 00:55:10 +03:00
Alex Shvartzkop f51c08584b Create default template if directory exists but not files. 2026-02-04 00:55:10 +03:00
Alex Shvartzkop 7bed2f08c9 Move template selector CSS to common styles. 2026-02-04 00:55:10 +03:00
Alex Shvartzkop 1082ce08da Modernize CSS in template selector dialog.
Hope this works on GTK.
2026-02-03 10:13:47 +03:00
Mark Roszko f95a58c5dd KIWAY_EXPRESS -> KIWAY_MAIL_EVENT 2026-02-02 20:33:08 -05:00
Mark Roszko dcc67e0d1f KIWAY_PLAYER and EDA_BASE_FRAME dont need to take turns parents to language change 2026-02-02 20:32:53 -05:00
John Beard 29dada48a6 CLI: Document sym upgrade can output to file or directory
Relates-to: https://gitlab.com/kicad/code/kicad/-/issues/22912
2026-02-03 02:26:56 +08:00
Alex Shvartzkop ff5e6e906e "Back" doesn't translate too well. 2026-02-02 18:08:14 +03:00
John Beard 8536f5ec42 CLI: sym upgrade should accept unpacked libraries as input
File and directory are both OK, so just check for existence.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/22912
2026-02-02 21:06:23 +08:00
Alex Shvartzkop 17b2f85a6f Add borders to template entries. 2026-02-01 20:27:29 +03:00
Seth Hillbrand 700427adbf Improve Advanced Configuration editor with sorting and filtering
Configuration entries are now sorted alphabetically and a search
control filters the list by key name as you type. Double-clicking
a boolean value toggles it instead of opening a text editor.
2026-02-01 07:51:06 -08:00
Alex Shvartzkop d6192e29e9 Improve local history pane sizing, tooltips; use local date formats. 2026-02-01 17:25:52 +03:00
Alex Shvartzkop 3cfcc4c9ae Fix local history pane tooltip glitches on MSW.
Also improves titles and sizing.
2026-02-01 15:54:42 +03:00
Alex Shvartzkop 3cc38ce6b2 Generate bitmap bundle from template icon bitmap (64x64) 2026-02-01 02:23:51 +03:00
Alex Shvartzkop 4b3ec34db9 Fix template selector icons on high-DPI. 2026-02-01 01:52:28 +03:00