In particular, there was a typo that kept library values from being
updated, and there was missing logic to fetch the various field names
from the library parts (and the change-to part).
Also implements some performance gains by desisting from copying
LIB_FIELDs around every time we want to look at them.
Fixes https://gitlab.com/kicad/code/kicad/issues/6733
Fixes https://gitlab.com/kicad/code/kicad/issues/6749
Don't use clone to copy an EDA_ITEM. Use Duplicate().
Even if you give the clone a new KIID, all its children will still be clones.
Create Duplicate() in LIB_PART
CHANGED: Derived library symbols will inherit optional fields defined by
their parent symbol and override existing optional fields.
CHANGED: The symbol editor will now only display the fields defined in
derived symbols rather than show mandatory fields inherited from the
parent symbol. Showing fields that cannot be edited would be confusing.
CHANGED: All mandatory fields in derived symbols can be edited. This
not only includes the field value but also all text properties.
Kill the dual datasheet variable storage which caused many datasheet
bugs over the years. The datasheet is now always stored in the data
sheet field.
This is a very large and potentially disruptive change so this will be an
unusually long and detailed commit message.
The new file formats are now the default in both the schematic and symbol
library editors. Existing symbol libraries will be saved in their current
format until new features are added to library symbols. Once this happens,
both the legacy schematic and symbol file formats will be no longer be
savable and existing libraries will have to be converted. Saving to the
legacy file formats is still available for round robin testing and should
not be used for normal editing.
When loading the legacy schematic file, it is imperative that the schematic
library symbols are rescued and/or remapped to valid library identifiers.
Otherwise, there will be no way to link to the original library symbol and
the user will be required manually set the library identifier. The cached
symbol will be saved in the schematic file so the last library symbol in
the cache will still be used but there will be no way to update it from the
original library.
The next save after loading a legacy schematic file will be converted to
the s-expression file format. Schematics with hierarchical sheets will
automatically have all sheet file name extensions changed to .kicad_sym
and saved to the new format as well.
Appending schematics requires that the schematic to append has already been
converted to the new file format. This is required to ensure that library
symbols are guaranteed to be valid for the appended schematic.
The schematic symbol library symbol link resolution has been moved out of
the SCH_COMPONENT object and move into the SCH_SCREEN object that owns the
symbol. This was done to ensure that there is a single place where the
library symbol links get resolved rather than the dozen or so different
code paths that previously existed. It also removes the necessity of the
SCH_COMPONENT object of requiring any knowledge of the symbol library table
and/or the cache library.
When opening an s-expression schematic, the legacy cache library is not
loaded so any library symbols not rescued cannot be loaded. Broken library
symbol links will have to be manually resolved by adding the cache library
to the symbol library table and changing the links in the schematic symbol.
Now that the library symbols are embedded in the schematic file, the
SCH_SCREEN object maintains the list of library symbols for the schematic
automatically. No external manipulation of this library cache should ever
occur.
ADDED: S-expression schematic and symbol library file formats.
This implements all existing symbol library object support and the ability
to save and load symbol library files between file formats for round robin
testing.
CHANGES: Symbol library file format has been converted to s-expressions.
Add support code for picking apart symbols at some future junction that
will allow full inheritance conversion of existing symbol libraries. For
now, symbols arranged by unit and body style numbers are nested for round
robin testing of symbol libraries once the parser is complete.
When searching for fields, the code was sometimes comparing translated and not translated names.
This is an issue for mandatory fields, in non English languages.
Translated field names should be used only in messages.
Abandon the previous behavior of always creating a new copy of the
buffered symbol which required a re-parenting of every derived symbol
to prevent accidentally orphaning a derived symbol parent symbol
pointers.
This change required something that should have been done a long time
ago by adding an assignment operator to LIB_PART. The assignment
operator makes it possible to create a single copy of the symbol to
buffer which gets updated rather than deleting the last copy and
replacing it with a new copy.
Add a clear method to the MULTIVECTOR class so that existing LIB_PART
object draw items can be removed before assigning the draw items from
the part being assigned.
Fixes#3672https://gitlab.com/kicad/code/kicad/issues/3672
Replace some C casts with C++ dynamic_cast.
Fix iterator bug when deleting inherited symbols from legacy file format
symbol library cache.
Remove unnecessary const when return wxString object instead of reference.
Don't clobber value file when load aliases in legacy symbol library cache
parser.
Use actual symbol library LIB_PART pointer rather than a flattened copy
of the symbol. This fixed a bug when displaying the parent field in the
message panel for derived symbols.
Simplify the flatten code by copying the parent and updating the lesser
information from the inherited symbol.
This change completely removes the LIB_ALIAS design pattern an replaces
it by allowing LIB_PART objects to inherit from other LIB_PART objects.
The initial implementation only allows for single inheritance and only
supports the mandatory fields in the derived part because that is all
that the current symbol library file format will support. Once the new
file format is implemented and saving to the old file format is deprecated,
more complex inheritance will be added. The LIB_ALIAS information saved
in the document files was move into the LIB_PART object. This change
impacts virtually every part of the schematic and symbol library editor
code so this commit message is woefully incomplete.
REMOVE: Removed the symbol aliases concept from the schematic and symbol
editors and the symbol viewer.
NEW: Replace the symbol alias concept with simple inheritance that allows
a library symbol to be derived from another library symbol.
We add LIB_ALIAS to the VIEW rtree when choosing a new symbol or
browsing. The actual display element may change based on the unit or
demorgan representation but there will only ever be a single one drawn.
This will set the view bbox to maximum to ensure it is always checked
for drawing.
Related to lp:1796960
https://bugs.launchpad.net/kicad/+bug/1796960
Be more intelligent about sorting lib tree items. (Footprint
entries, for instance, come out of an already-sorted list.)
Don't recreate menus twice when laoding Footprint Editor.
More pervasive use of WX_FILENAME to avoid expensive calls to
wxFileName::SplitPath() and string concatenation.
For POSIX kernels do all the work on the file-system side so we
don't have to keep converting back and forth between encodings.
When LIB_ALIAS is renamed, it validates the new name. In case the name
typed in the field edit dialog is invalid, there was a discrepancy
between the name used further in the code and the actual alias name.
Fixes: lp:1765375
* https://bugs.launchpad.net/kicad/+bug/1765375
Schematic components have illegal characters replaced during load,
leading to broken component-symbol links. To avoid this, library symbols
should have their names fixed in the same way.
Fixes: lp:1752419
* https://bugs.launchpad.net/kicad/+bug/1752419
This commit aims at making the pin edit coupling easier to understand.
It renames the mode to 'synchronized pin edit', shortens the description
and inverts the logic to avoid double negation.
To make the code clearer, two items have their name changed to fit the
new description:
- m_editPinsSeparately -> m_syncPinEdit
- ID_LIBEDIT_EDIT_PIN_BY_PIN -> ID_LIBEDIT_SYNC_PIN_EDIT
This commit is a partial revert of aa81f5b9 & 445ac505. LIB_ID should
not be modified when a library is assigned to its part, as the library
nickname cannot be evaluated during the assignment and might be
different than its filename.
The GetName() method attempts to access the first LIB_ALIAS pointer in
the m_aliases member without checking if m_aliases is empty. This
should never happen because a new LIB_PART creates a LIB_ALIAS object
in the ctor. Some how, this is getting bypassed and causing Eeschema
to crash in the LIB_PART dtor on debug builds. GetName() now checks
for an empty alias list to prevent a null pointer segfault.
Fixes lp:1739614
https://bugs.launchpad.net/kicad/+bug/1739614
This is the last of the object save/load code that was not moved into
the SCH_LEGACY_PLUGIN object. All schematic and library I/O is now
performed in the SCH_LEGACY_PLUGIN object and as been removed from the
schematic and library objects.
The old single symbol file format has been replaced with the normal
symbol library file format since there was no difference between them
except the SYMBOL token. The SYMBOL token was no longer being read
since the introduction of the SCH_LEGACY_PLUGIN symbol library loader.
Update the Doxygen comments in all of the modified files.