732 Commits

Author SHA1 Message Date
Damjan Prerad 8b2cb94cb1 pcbnew: fix Flip Board View from custom toolbars
Flip Board View did not work correctly when it was added to a
custom toolbar. The board flip worked from the view menu or
appearance panel.

This change stores the board flip state in PCB_DISPLAY_OPTIONS
and applies it through SetDisplayOptions(), the same way other
display toggles are handled. The toolbar, menu, and appearance
panel now use the same state, so Flip Board View works correctly
from custom toolbars.
2026-03-18 12:41:51 +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
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
John Beard c4c19018c3 Pcbnew: Restrict includes of pad.h/footprint.h
There are some headers which don't need to include pad.h (which brings
padstack.h) - they just need forward defines.

While pad.h is not an especially heavy include on the scale of things,
footprint is quite heavy. And both reduce inclusion load and
reduce the number of files needlessly sensitive to changes in headers.
2026-03-05 02:18:34 +08:00
John Beard 113746dc81 Pcbnew: move PCB_TRACK types to a lightweight header
This lightens the load when including forwards for PCB_TRACK and
friends as we don't need all the transitive includes. Sometimes
you just need the enums - many users just wanted VIATYPE, or
just needed a forward.

And reduces transitive code churn when something is changed in the
header - this reduces the files affected by a change in
pcb_track.h from nearly 400 to under 200.
2026-03-04 23:28:31 +08:00
Seth Hillbrand 1e2a2fb02c Fix minor safety and visibility issues
Move onUpdateUI from public to private in EDA_BASE_FRAME since
it is an internal event handler bound via Bind(), not part of
the public API.

Capture the empty-check result before erasing rows in
library_manager.cpp to avoid using invalidated iterators from
the subrange returned by std::ranges::remove_if.

Add null guards to the netHighlightCond toolbar condition
lambda in PCB_EDIT_FRAME to prevent null dereference during
shutdown, matching the pattern used by other toolbar
conditions fixed in f962de966b.
2026-02-27 19:13:47 -08:00
Seth Hillbrand f962de966b Fix crash in toolbar conditions during shutdown
Guard GetPcbNewSettings() calls in setupUIConditions() lambdas
against null return. The settings manager deregisters the
PCBNEW_SETTINGS object during cleanup before wxLogGui::Flush
finishes, leaving the toolbar idle update to dereference a null
pointer.
2026-02-27 15:21:23 -08:00
Akhil Velagapudi 4a458b1cf1 Preserve embedded model files on footprint update 2026-02-26 18:58:57 -08:00
Jeff Young de3917f1a9 Formatting; naming conventions. 2026-02-20 18:56:52 +00:00
Seth Hillbrand fb58cc4187 Prevent single-element groups
Groups with fewer than two items serve no purpose. All
user-facing group creation paths now require at least two
items before creating a group. The Group menu action is
greyed out when fewer than two items are selected.

When items are removed from a group via RemoveFromGroup,
pruneExistingGroups, or the netlist updater, the group is
dissolved if it drops below two members. Importers are left
unchanged since they reflect external file structure.
2026-02-19 09:43:01 -08:00
Seth Hillbrand 82bc53003d Guard cross-probe flash timer against active move operations
The cross-probe flash timer periodically toggles selection visibility to
create a visual "flash" effect. When this timer fires during an active
move operation (via the coroutine's Wait() yielding to the event loop),
it calls ClearSelection/AddItemToSel which toggle view()->Hide() on items
being rendered through the selection overlay, corrupting the VIEW state.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22993
2026-02-17 12:35:23 -08:00
Damjan Prerad 78861b081a Close DRC Rule Editor dialog when KiCad exits
The DRC Rule Editor was not being closed during shutdown, causing it to linger briefly after the main window closed. Register a window name and close it in both doCloseWindow() and the destructor, matching how the DRC dialog is handled.
2026-02-15 14:01:19 -08:00
Seth Hillbrand 6c9c75eb07 Remove property.h and property_mgr.h from inspectable.h
This breaks the view_item.h -> inspectable.h -> property.h chain that
pulled wx/propgrid/property.h into 150-200 TUs. The lean inspectable.h
now includes only wx/any.h, wx/string.h, wx/variant.h.

Headers using DECLARE_ENUM_TO_WXANY (board_item.h, sch_item.h) retain
their property.h include since the macro requires it.
2026-02-13 19:54:46 -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
Jeff Young f53c2e17a9 Rework of 0970fb8b.
SetMinSize( ..., -1 ) still required for non-growable
panels.
2026-02-09 14:04:51 +00:00
Jeff Young 0970fb8b71 A little bit of safety based on 94757f6239.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/22468
2026-02-08 20:30:13 +00:00
Jon Evans 3aab5e3b7b Fix IPC API not permitting operations when a single polygon is selected
(cherry picked from commit a366808478)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2026-02-04 09:38:14 -05:00
Jeff Young a04f982275 Remove ShowQuasiModal TODOs and actually make them ShowModal() this time. 2026-01-31 22:00:20 +00:00
Jeff Young df5b456145 TODO reduction: try Dimension Properties dialog sans-quasimodal. 2026-01-31 15:13:29 +00:00
Jeff Young efc9e78cf0 TODO reduction: try Dimension Properties dialog sans-quasimodal. 2026-01-31 15:13:29 +00:00
Damjan 396e6230d7 Fix crash when closing PCB editor while footprint chooser is open 2026-01-27 09:33:22 -05:00
Wayne Stambaugh d69d31ef37 Fix library item comparison dialog layout issues.
Force resize to prevent clipping of updated "Apply" button string changes.

Do not use board canvas background and foreground colors for sizers.
2026-01-23 13:48:29 -05:00
Wayne Stambaugh a3428462ad Coding policy fixes. 2026-01-17 07:42:52 -05:00
Wayne Stambaugh 8bc56cd501 Defensive programming measures.
Recent issue conversations are suggesting that it's no possible for
footprints to contain null fields.  Rather than blindly dereferencing
field pointers in loops, check to make sure the field pointer is not
null before dereferencing.
2026-01-14 10:39:14 -05:00
Seth Hillbrand a3a12399f2 Add graphical editor for custom design rules 2026-01-12 21:42:45 -08:00
jean-pierre charras 78ec6bf876 Fix bug: matchItemsBySimilarity(): ensure pad numbers are taken in account
This bug was responsible of clearing pad nets when updated footprints from lib.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22625
2026-01-09 07:51:54 +01:00
Seth Hillbrand 9f6edf4edd Pre-initialize the OwnClearance cache
Thread this so that massive boards can set up their cache quickly

(cherry picked from commit 0b9ff5e2bc)
2026-01-07 17:54:59 -08:00
Alex Shvartzkop 2dd484f034 Improve layer pair icon drawing and update; generate more sizes. 2026-01-07 17:17:18 +05:00
Seth Hillbrand 6bad3c58e1 Added: PCB Variant support
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2131
2026-01-05 17:47:39 -08:00
Seth Hillbrand 3770bc9f35 Fixup some local snapshot issues
- Added README.txt
- Cleared up destruction oop
- Clarified actions when restoring after accidental crash

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22586
2025-12-29 15:10:20 -08:00
Mark Roszko dad49d5dba Reduce tiny fp errors that can be introduced when updating footprints
Moving by the cursor position (double) and then back to the integer coordinate position sometimes added tiny tiny tiny shifts in the coordinate.
2025-12-06 15:39:57 -05:00
Jon Evans baa29c1a58 Port footprint library table to new system 2025-11-04 06:54:53 -05:00
Seth Hillbrand a3acf25262 Rework local history for safer backup
- Prompt before removing any files
- Check directory for additional files
2025-10-27 18:11:17 -07:00
Seth Hillbrand 3238d43b94 Make RestoreCommit safer
Track success and rollback changes if anything fails
2025-10-23 15:48:35 -07:00
Seth Hillbrand 8257870ac3 ADDED: Local History
Local history combines project backup and autosave into a single place
where arbitrary history can be stored efficiently and restored to any
point in time.  Git commits are made on a debouce timer to hold
modifications, allowing the user to step backwards in time to arbitrary
points.  Restoring backups does not remove the existing files and
choosing to restore an autosave point does not remove the state of the
files prior to the restore, providing additional safety.

Keeps the maximum storage size limit but removes the additional
limitations of number of backups/backups per day, etc as these are not
relevant to a CoW-based backup as unchanged files do not take up
additional space.
2025-10-23 15:36:07 -07:00
JamesJCode b7ce289e4e ADDED: PCB Tuning Profiles
Tuning profiles build on the previous delay tuning work to allow
the definition of track geometries per-layer for a given tuning
profile. These can be calculated from a target impedance (with
all relevant geometry taken from the board stackup), or entered
manually.

Tuning profiles can be configured to enable time-domain tuning,
and to automatically generate track geometry DRC rules for net
classes which have an assigned tuning profile.

Adds a DRC check for net classes with a tuning profile assigned
which is not itself defined.
2025-10-15 18:58:12 +01:00
Seth Hillbrand e257912b04 Move a bunch of strings to trace_helpers
Actually forgot about this file for a while until being reminded
2025-10-14 18:23:48 -07:00
Seth Hillbrand 7b26c57e07 Update movement constrainer
When moving an object in pcbnew, instead of using the constrainer to
restrict motion, we use it to build snapping guidelines that are visible
to the designer and make keeping movement on the various axes easier but
not required
2025-10-09 14:47:19 -07:00
Seth Hillbrand 592e8542a3 Fix botched merge
These were in place previously but one of my rebases broke it.  This
should get us back to compiling
2025-09-26 16:15:37 -07:00
Seth Hillbrand 4a74153315 Updating barcode support
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4393
2025-09-26 11:35:36 -07:00
Seth Hillbrand 61ab7cc915 ADDED: AUI Memory
Using the new wx3.3 routines to serialize the state of our AUI elements,
we store them using JSON in the preferences for each window

I have left the SavePerspective in place for now to see how legacy
(mostly *nix) builds handle this and provide a smooth transition to 3.3

Fixes https://gitlab.com/kicad/code/kicad/-/issues/2381
2025-09-24 18:43:47 -07:00
Jeff Young e9ccae85f2 ADDED: Update Symbol/Footprint from Library... buttons to diff dialogs.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/21646
2025-09-24 11:36:49 +01:00
Seth Hillbrand 0785e7525b Auto-update flyout icons when changed
Provides an update action to refresh the icon display when the user
changes the angle mode using a hotkey.  Also unifies the angle modes
between schematic, pcb and library editors
2025-09-22 12:19:20 -07:00
Seth Hillbrand 5d50dc7ced Preserve as much footprint data as possible
When updating the footprint from library, try to match as many things to
their new counterparts as possible to minimize VCS churn

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21308
2025-09-19 09:53:22 -07:00
Alex Shvartzkop 89af3c34b9 Support vector graphics drag-and-drop in PCB and schematic editors.
This just shows the import dialogs with filename pre-populated.
2025-09-17 00:44:29 +03:00
Jeff Young 18b56539a6 Keep Board Setup in front when called from DRC dialog. 2025-09-11 15:47:13 +01:00
Seth Hillbrand 0c35068e8d ADDED: Optional flashing with cross-probing
Sometimes it is hard to find an element especially if we do not zoom to
the part.  The flash should help draw your eye to the relevant part

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19842
2025-09-07 18:08:04 -07:00
John Beard e016dc52fd Pcbnew: Add concept of a 'point'
This is a zero-dimensional object that can be used for snapping
and documentation of useful, but non-physical features on a
board or footprint. They do not correspond to any physical
output in exports or plots.

Points do have a "size", but this is a graphical property only
and determines how large they are drawn on the board.

They also have a layer, which allows them to be selected and
made visible according to layer filters.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/4691
2025-09-01 23:44:21 +08:00
Seth Hillbrand 26f0c03e61 ADDED: support for 45 degree crosshairs
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6047
2025-08-23 06:20:00 -07:00
Seth Hillbrand 8330cf5d12 Separate reset text pos from other attr
Position is frequently usefully placed and we might not want to nuke it
just to get the updated text

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18387
2025-08-22 20:11:03 -07:00