We don't allow these to be set on the default netclass, so we
don't need to resolve it if they are missing in a custom netclass.
The renderer will use the colors specified in the application
color scheme.
Previously, start and end points were moved, and therefore the shape itself was
modified. It was probably unexpected.
Now just align the arc start point or the circle center point on grid.
Don't enforce that every merge result has to be
non-disjoint. Sometimes it will merge in the end
when gaps are filled in by other shapes. Even if
not, at the end, just create a new polygon for
each disjoint polygon.
This is a little bit like the bounding hull tool, but the
output is "exact" and it only supports the most common
source items.
By 'exact', this means that rounded corners are real arc
segments rather than polygonal approximations. Obviously,
this is rather tricky in the general case, and especially
for any concave shape or anything with a bezier in it.
Envisioned main uses:
* Creating courtyard and silkscreen offsets in footprints
* Making slots around line or arcs.
The one thing that it does not currently do, but which it might
plausibly do without reimplementing Clipper is convex polygons,
which would bring trapezoidal pad outsets for free. But that
is a stretch goal, and bounding hull can be used.
This is useful if you want to give some preset options
to a user (e.g. recently used value) but stil have them
controlled and presented using the UNIT_BINDER logic.
Lot of things can be const which makes the interface
a bit more legible and safe to use - lots of things are
accessing pointers that if they changed, would have wierd
and unpredicatable effects.
Probably of minor concern in practice, but a lot of strings
and vectors are being copied when they don't have to be.
Very crude profiling indicates this could save 30-50% of the time in
KIBIS::KIBIS after ParseFile, but this is incidental to
clarifying the API of the classes.
Report is const as it doesn't change the logical state of the
IBIS_ANY object (if m_reporter were a ref, it'd be mutable).
If a T* isn't null-checked inside a function, pass as ref
to show that the function expects and requires non-nullity.
A copy-paste-o meant that this wasn't working and
was also trashing the enable variable.
Add a test that loads an IBS file in the QA directory
that demonstrates this is fixed.
This would be OK if m_reporter were overwritten in the
derived ctor after being filled with junk in the base
ctor. But this is not always true - the null ctor doesn't
do it. So it can stick about and fool the null check.
Rather than just doing that, push the reponsibility for
maintaining the m_reporter invariant contract (if it isn't null,
you may use it) to the base class ctor.
And get rid of the shadowing m_reporter in KIBIS.
This function just uses the buffer, it doesn't retain
part-ownership, so it doesn't need to get a copy of the
shared_ptr (or even know that the shared_ptr exists).
A reference count of the buffers is safely held by the caller
in SaveLibrary while this function executes.
SYMBOL_BUFFER GetSymbol and GetOriginal cannot return null,
as the SYMBOL_BUFFER class internally ensures that the
original and current symbol pointers are always filled
through checks in the ctor and setters.
This means that clients don't need to null-check the returns,
which is good because they mostly already do not.
Return references instead, to formalise the non-nullity of
these pointers and absolve the calling code of having to
consider if they might be null.
Previously, SYMBOL_BUFFER took plain pointers and took ownership
of it (plus the ownership of an internal new'd pointer).
Use unique_ptr to express this relationship more clearly and
safely.
Add a non-null assert in SYMBOL_BUFFER's ctor.
Use more restricted-scope variables in a couple of places where
a re-used variable was not required.
There are still memory-leak opportunities in here, for example
SaveBuffer new's things and can return without handing them over
or deleting.
Again, this doesn't retain part-ownership of the pointer
and null is a wxCHECK failure. So hoist the null check
and then handle it as a ref (=non null, caller owns).
Also fixes a trivial mem leak in test_symbol_library_manager.cpp.
DeleteBuffer took a std::shared_ptr by value. This means
it claims to take (and keep) part-ownership of the pointed-to
item. However, this function does not take any ownership or
change the item, it just refers to it. It also does not null-check
the pointer. So it should be a const reference to the item.
Ownership semantics are then: the caller retains ownership
while the function executes.
(It also saves a shared_ptr ref count, but that won't be
important here).
Mostly intended right now for allowing testing of library tables
to help with testing chained loading, but it also decouples the
idea of a library table from on-disk files in general.
All current (real) lib table implementations continue to use the
file-based IO.
This could be made more general (not just for tables) if really
needed.
Makes it easier to reason about oval shapes in geometric terms.
For now, this isn't a SHAPE, but it could be (and it's a
fairly common primitive, so it could be useful, though the
obvious use (clearance) is equivalent to a SEG with a clearance,
which is already a function that exists.
Very minor tweaks:
* "When creating tracks" -> "When routing tracks"
This setting affects the router tool, but not, say,
copy/paste or other non-router ways to create tracks.
* The 'Snap to tracks' setting also toggles snapping to
vias, so say so.
Relates-To: https://gitlab.com/kicad/code/kicad/-/issues/18508
Probably this should be replaced with a less error-prone
approach. Right now the LSET -> BASE_SET system is risky
because it is converting a signed enum (PCB_LAYER_ID) to
a size_t in all the underlying operations.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18738
Before we edited the grid settings directly so cancel would keep your
changes.
Also includes numerous QoL improvements borrowed from Ian's patch,
and a few other small fixes.
This makes it clearer that it is a polyfill-type affair
and make it easier to swap for the std:: one when the
compiler support is guaranteed.
Also avoid double underscores in parameter names,
as well as underscore-capital latter as they are reserved.