780 Commits

Author SHA1 Message Date
Jeff Young
cff261ce2e Don't allow stack addresses to escape via long-life handlers. 2025-09-02 14:19:17 +01: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
Jeff Young
4024a15a17 Don't reference stack variables from a long-life lambda.
In particular, a lambda for conditional menus should
never capture more than `[this]`.  Even the tool's
frame pointer could change.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21615
2025-09-01 12:44:20 +01:00
Seth Hillbrand
4e7fa189aa Refactor gfx import cleanup
Break up monolithic function into responsibilities.  Adjust cleanup to
correctly modify each graphical pairing.  Fix drc test to properly
report gap distances that are relevant to outlines

Fixes https://gitlab.com/kicad/code/kicad/-/issues/13090
2025-08-25 11:33:26 -07:00
Jeff Young
3f85071f91 Don't double mirror groups.
Also removes previous fix, which had side-effects.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/8121

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20465
2025-08-21 12:29:34 +01:00
Jeff Young
1ceac1dafd Simplify locking to just be another filter now that we don't have a dialog. 2025-08-20 15:24:36 +01:00
John Beard
105b9fcfe8 Pcbnew: fix occasional failure-to-select for dragging
In the Drag tool client filter function, sometimes,
GuessSelectionCandidates trims the collector's item list.
But we used the old contents of the per-type vectors to make
judgements about what was connected.

If a call came in with 2 tracks (e.g. near a knee) and one
was removed by GuessSelectionCandidates, sometimes the
other one would be the one selected for removal in the
2 tracks/0 via case. This leaves the collector empty.

The other case, where the item removed by GuessSelectionCandidates
was removed from the collector is silent, as removing an item
not in the collector is a no-op.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/21517
2025-08-20 20:34:08 +08:00
Jeff Young
b0945ee697 Don't push someone else's commit. 2025-08-20 13:19:37 +01:00
Jeff Young
e9f8b72666 Allow clearing of multiple tuning patterns.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/21508
2025-08-20 13:19:37 +01:00
Jeff Young
6f389fd320 Tighten parent/child undo/redo architecture.
Always look for pre-existing undo/redo record.  Checking for IsNew()
is less robust and should be avoided.  Also moves the checking to a
location where it will be easier to ensure that it's uniform.

Push get-undo-level-item processing down a level so it is uniformly
called.

Make sure tables & labels are uniformly handled.

Remove incorrect usage of Get/SetGroupId() for storing lastPin
(which we don't use anyway).

Lists of deleted and changed items MUST include the screen pointer.
An item could be changed on one screen but not on another.

Also tightens handling of PCB_NETINFO_T items, which are not in the
view.

Also fixes a bug where there is no increment parameter if you assign
the base increment command to a hotkey.
(This was discovered while testing the above changes.)

Also fixes a bug where delete during a move in PCB Editor did an
undo instead of a delete.
(Again, found while testing above.)

An experiment was also run to collapse shared parts of SCH_EDIT_FRAME
and SYMBOL_EDITOR_FRAME into SCH_BASE_EDIT_FRAME.  However, sharing the
undo code actually increased complexity, and there was very little else
of value in SCH_BASE_EDIT_FRAME (other than the Increment() routines).
2025-08-18 19:20:09 +01:00
John Beard
9de414d1b3 Pcbnew: polygon boolean subtraction: area ordering is more robust
This will also handle the case when more than two items are subtracted,
e.g. many small items witrhin one larger item.  Again, thanks to
Kliment for a smart idea!
2025-07-14 03:58:28 +08:00
John Beard
8d07eb7f24 Pcbnew: polygon booleans - try subtraction in both orders if null result
While there is technically some kinds of defined order (last selected item is
'A' in the 'A - B (- C...)' operation, it's easy to drag select and then
get a null result.

So if this happens to a non-commutative operation, try again in the
reverse order. In the usual case (2 items), this will get what the user,
presumably, wants. If there are more than 2, it will either work, or the
user can undo and try merging the "B" operand before subtracting, or do
them one at a time (at which point the order-reverse logic will help
again).

Thanks to Kliment for an this usability suggestion!
2025-07-13 22:10:30 +08:00
John Beard
401eba4e91 Pcbnew: handle circles in polygon booleans 2025-07-13 04:48:52 +08:00
Jeff Young
edbe570d42 Respect non-free-pads mode for Move Exactly.
(Also makes sure the filters are always in the
same order, though this may be immaterial.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21183
2025-07-07 09:19:57 +01:00
Jeff Young
69b23df4c3 Make sure we don't end up with stale picker handlers (lots of Sentry tickets). 2025-07-04 12:10:59 -06:00
Jeff Young
02365bb206 Don't special-case footprint children for undo of delete.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/21204
2025-06-28 21:08:08 -06:00
Jeff Young
3424f2bd4c Fix presumptive cast (KICAD-J24). 2025-06-26 19:42:14 -06:00
Jeff Young
100260ed59 Don't be pedantic about selection contents when exposing commands.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/21112
2025-06-23 16:01:24 -06:00
jean-pierre charras
b621e0ccf5 Pcbnew: fix position of rectangles after a Rotate command. 2025-06-15 16:48:19 +02:00
Jeff Young
7fbf51b17c Be more pedantic about RECURSE_MODE.
Also fixes an invalid iterator bug.

Also adds mirroring support for PCB_GROUPs.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21107
2025-06-12 11:21:28 +01:00
Jeff Young
31cf3f9b53 Nullptr safety. 2025-06-02 13:29:49 +01:00
Jeff Young
f58fc0b952 Rewrite GROUP undo based on uuids.
This also removes the GROUP/UNGROUP-specific undo actions.

This also fixes a bunch of undo bugs when duplicating
group members, creating pins, etc.

This also fixes some undo bugs when dividing wires etc.

This also fixes some bugs with new sch items not
being created within an entered group.
2025-05-21 14:24:59 +01:00
Mike Williams
8ad9634498 pcb: add track change layer command
Works the same as the prev/next layer commands, but the addition of CTRL
brings the track with it.
2025-05-20 15:48:49 -04:00
Mike Williams
8ec70ee92b PCB: unroute segment
Works like the backspace key in the router, but for segments that are
already placed.
2025-05-19 14:05:14 -04:00
Jeff Young
ec6bc85a29 No requirement to UNGROUP when we're recording entire parent FP.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20589
2025-04-09 12:18:26 +01:00
Mike Williams
40058ebe80 actions: move all basic selection operations to common actions 2025-04-02 12:02:01 -04:00
Mike Williams
05e9772d54 groups: extract common class methods into EDA_GROUP base class 2025-04-01 14:34:20 -04:00
Mike Williams
a90b8ec57a pcb: merge RunOnChildren/Descendants into one function with a mode 2025-03-27 13:16:09 -04:00
JamesJCode
ede5faee72 Implement dynamic assignment of component classes 2025-03-15 14:33:47 +00:00
Jeff Young
3c32f4d31d Refresh preview after rotate/flip/mirror during move.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19561
2025-03-14 13:17:52 +00:00
Jeff Young
e48a2b5ee4 Don't report non-meeting line-pairs.
We're called on each line pair, so a rect would otherwise
always report to failures for the two pairs of opposite
sides.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20326
2025-03-13 16:32:25 +00:00
Damjan
bded181ad0 pcbnew: table rotation: table jumps if rotation ends at 180° 2025-03-07 20:38:56 +00:00
Jeff Young
59d6152cf0 Cleanup stale comment. 2025-02-24 11:08:29 +00:00
Dmitry Rezvanov
663f00da25 Add "Route Selected From Other End" action to edit context menu 2025-02-19 18:12:04 +00:00
Ian McInerney
97b725fb42 Add Route Selected to the context menu
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19571
2025-02-09 23:00:26 +00:00
Roberto Fernandez Bautista
c5120b9090 Add fake-autoroute to context menus (router and edit) 2025-01-31 15:49:27 +01:00
John Beard
d55877ce27 Increment tool: use parent commit when appropriate, avoid double preview
Cloning the item into the previewe means that if we later increment
it, the preview clone doesn't update. Use the non-owning preview
interface to use the item directly in the preview.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/19433
2025-01-15 00:26:09 +08:00
Alex Shvartzkop
129e37f63d Drag footprints only in non-hover selections. 2025-01-10 21:14:13 +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
Ian McInerney
d5c5050d29 Fix initialization order of the events in pcbnew
The TOOL_EVENT constructor searches for ACTONS::cancelInteractive. That
action is global, so we need to ensure it is created before we try to
create these events - so switch to a create on first use paradigm for
the events.
2024-12-31 00:18:10 +00:00
Jeff Young
97439d2cf6 Handle group duplicate in footprint editor.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19245
2024-12-06 18:24:26 +00:00
Jeff Young
9c338c12c7 Typos. 2024-12-06 18:24:26 +00:00
Jeff Young
bb533f3f4a Fix multiple-footprint drag.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19101
2024-12-02 12:43:57 +00:00
John Beard
c39573ace3 Pcbnew: get footprint by name doesn't have to be a member on PCB_BASE_FRAME
This function doesn't access anything private to PCB_BASE_FRAME. So
split it into a static and slim the PCB_BASE_FRAME API just a
smidgen.
2024-11-01 20:35:50 +08:00
John Beard
c956e6761b Pcbnew: add interative relative offset tool 2024-10-30 09:00:14 +08:00
John Beard
2391e5ecdc Pcbnew array: allow selecting the center point interactively
This involves recasting the array tool from the slightly
eccentric ARRAY_CREATOR class into a full-blown TOOL, which
allows it to usefuly store state asd the dialog hides. This
is modelled on the POSITION_RELATIVE_TOOL strategy.

The by-radius-and-point mechanism is removed entirely,
as it's very fiddly and hard to describe in the UI,
and what you probably really want to do is get your
item onto the circle with tools like "move exact",
and then define the circle origin (now using the picker
tool)

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/16783
2024-10-28 22:01:14 +08:00
Jon Evans
673bb2f152 Fix fallthrough warning 2024-10-26 22:10:50 -04:00
John Beard
5545dfd02b Incrementing: add some types to selection filters 2024-10-26 17:56:32 +08:00
John Beard
2c2ff64911 Allow incrementing different parts of strings with modifiers
Primary increment is the right most bit, secondary is the next
rightmost. So you can increment 'A1' to 'A2' or 'B1' with
Shift-Alt-Scroll and Ctrl-Alt-Scroll respectively.
2024-10-26 16:01:07 +08:00
John Beard
9c9542deea Bind multiply-modified scroll events to the increment action
Implemented as handling un-consumed scroll events that the
WX_VIEW_CONTROLS doesn't want because it has too many mods
set. Then dispatch these as TA_MOUSE_WHEEL events.

The default action from the selection tools is to run the
'increment' ACTION, which is implemented differently in the
various tools: eeschema can increment labels, symedit
does pin names and numbers, and fpedit does pad numbers.
2024-10-26 16:00:58 +08:00