8 Commits

Author SHA1 Message Date
John Beard
e76b2089bb Symbol edit: add symbol flatten action
This removes inheritance from the symbol.

This doesn't play well with undo, but then again, neither does symbol
deletion, so that seems like a higher-level symbol editor issue.

Relates-To: https://gitlab.com/kicad/code/kicad/-/issues/8895
2025-09-03 00:24:32 +08:00
Seth Hillbrand
679ee7e4d1 Refactor symbol creation to extract from GUI
Adds QA testing to creation routine
2025-08-22 12:11:12 -07: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
John Beard
a8f4dfd47d SYMBOL_BUFFER: Enforce non-null returns
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.
2024-09-19 06:35:43 +01:00
John Beard
06eab304e5 SYMBOL_LIBRARY_MANAGER: Formalise ownership when creating SYMBOL_BUFFERs
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.
2024-09-19 06:35:43 +01:00
John Beard
49a0318fe5 SYMBOL_LIBRARY_MANAGER: Clarify UpdateBuffer ownership
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.
2024-09-19 06:35:43 +01:00
John Beard
a756b058ae SYMBOL_LIBRARY_MANAGER: Clarify ownership semantics
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).
2024-09-19 06:35:43 +01:00
Wayne Stambaugh
9ff8d02e60 Symbol library manager object changes.
* Fix issue handling symbols with multiple inheritance.
* Remove unused code from the symbol library manager object.
* Splits out the library buffer and symbol buffer object so the can be unit
  tested without having to mock the symbol library manager object.
* Add unit tests for library buffer and symbol buffer objects.
2023-10-09 14:58:49 -04:00