Also fixes a bug where the pretty printer didn't insert
linebreaks for a forest (it assumed a single tree root).
Also further regularises bool and quote formatting.
UNDEFINED_LAYER is -2, so simple checking evenness isn't
enough to check if it's copper or not. Notciable when the
FABMASTER import puts things on UNDEFINED_LAYER while it's
processing items.
Currently, unselecting the bold option resets the thickness to the
standard size instead of reverting to the original thickness.
To address this, the original thickness should be preserved so it
can be restored when bold is turned off.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18975
Handle boolean value parsing during paste operation. The boolean value
was not being handled correctly in grid_tricks, which prevented the
boolean value from being pasted into the target row
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18985
This means that an early return or an exception between
a manual Push/Pop (or an omission of the Pop) cannot
corrupt the layer stack.
It also means the GAL doesn't have to maintain its own
stack (with the in-scope GAL_SCOPED_ATTRS taking that role).
Reomve the Push/PopDepth functions, as they're only ever
used in pairs, and doing it manually needs more care.
Implement a simple RAII GAL attribute save/restore
class that handles putting the GAL back the way it was found.
This makes draw methods easier to write, as they don't need
to worry if a called method will upset the attribute context
(as long as the caller saves the context, or the callee does).
Obviously not a good idea to use in tight loops, but when text
is involved, this is negligible!
On reflection, the forward vector makes more sense, because
the value in the edit box is then the same as the vector the
user just drew with the ruler.
For segment, circle, beziers, these are the same in all editors and only
need access to the EDA_SHAPE nature, so we can remove the duplication
entirely.
For TABLECELLs, while the cells are polymorphic in that PCB and SCH
cells are both EDA_SHAPEs (via the TEXTBOXes), the parent TABLES
are not polymorphic, and thus the implementation can't be trivially
de-duplicated. Rather than do something with templates, just keep
it simple for now and maybe look at unifying tables later on.
This adds the concept of editing _other_ items to the one
that informs the POINT_EDIT_BEHAVIOR - in this case connected
lines. This is one of the motivations behind this system,
as it will allow to bring similar logic to Pcbnew.
This introduces the POINT_EDITOR_BEHAVIOR class, which
allows a "behavior" to be defined, which covers the creation
of edit points, updating the points on edit, and pushing the
edited points back into the object.
This keeps the logic for a single item "type" (e.g. a SEGMENT
or TEXTBOX, etc) in one place, rather than fragmneted throughout
the POINT_EDITOR class, where the invariants like point count
are difficult to keep track of as the TOOL progresses.
For now, it's implemented as an optional class, just for SEGMENT
and other tpyes work as before. Adding new types is then a
"pin-compatible" drop-in process.
Also fix the previous code for clearing unknown keys to use
a JSON pointer so that it functions correctly when the JSON path
is more than one level deep.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18734
Includes zoom to selection, and pan to selection (which
centres the result but doesn't change the zoom).
I'm not sure this is the perfect solution to search pane
settings, but it's near to the action, but not taking up
too much space, doesn't need to open a modal to mess
with it, and has room for more options in future.
I haven't made toggling these options into full-blown
TOOL_ACTIONs, but they could be if a hotkey to toggle
these is desirable - it's an ACTION_MENU, so it should
just slot in..
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/16192
Then you can just toggle back and forth with '/'.
One day, these frames should use a tool manager for this
kind of thing (also for the ruler tool, but lots of other
things on top), but for now just bind a char hook.