Apparently the < operator was never implemented for SCH_JUNCTION objects
so they were not get sorted which was causing the large diffs between
schematic saves.
Fixes https://gitlab.com/kicad/code/kicad/issues/4369
The duplicate sheet code path assigned a SCH_SCREEN object instead of a
SCH_SHEET object as a parent. A recently added assertion to check for
this did it's job.
Fixes https://gitlab.com/kicad/code/kicad/issues/4369
In order to avoid confusion when loading legacy schematics, updating time
stamp UUIDs is no longer performed. If users where not experiencing issues
with time stamp clashes with shared schematics then this was probably a
case of me being overly cautious.
The original conversion code has be moved to
SCH_EDIT_FRAME::ConvertTimeStampUuids() so the working functionality is
not lost. This function should not be used until a way is found to update
the board from the schematics with the appropriate settings.
Move updating the pin maps from external code to the SCH_COMPONENT object
when changing the symbol body style (DeMorgan). This is a vein attempt
to make the SCH_COMPONENT object self contained so we don't have to depend
on the caller needing to figure out how to keep internal objects synced.
SCH_SCREEN::UpdateSymbolLinks() should only be called when working with
the legacy schematic file format. Add schematic symbol library symbol
links should be set using SCH_COMPONENT::SetLibSymbol() which updates
the symbol link and pin map accordingly.
Change the schematic symbol LIB_ID edit dialog to properly use the new
SCH_COMPONENT::SetLibSymbol() function.
Use flattened (root) library symbols to prevent broken library symbols
in schematic files.
Remove the edited symbol from screen before making changes to the symbol
to prevent potential orphaned symbol libraries being saved in schematic
file.
Add some defensive programming to let developers know that an invalid
library symbol link was used when calling SCH_COMPONENT::SetLibSymbol().
Removed some rogue calls to SCH_SCREEN::UpdateSymbolLinks() which should
only be called the last time the schematic is loaded from the legacy file
format. After that, all symbol library links should be changed using
SCH_COMPONENT::SetLibSymbol() which will prevent the pin maps from ending
up with broken symbol library pin links.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4318
There has been a long standing (since the beginning of the project?)
issue with sharing schematics between projects. It has been somewhat
supported for complex hierarchies (a sheet shared multiple times in a
single design) but it has not been well supported for simple hierarchies
(the symbol references cannot be changed in the shared schematic). This
issue has been resolved by moving all of the symbol instance sheet paths
from the symbol definitions in the all of the project files and save all
symbol path instances in the root sheet. This ensures that orphaned
symbol instance paths do not accumulate in shared schematic files and
that designs that reuse schematic in simple hierarchies can how have
different references. It also allows the root schematic from one project
to be uses as a sub-sheet in another project.
When legacy schematics are loaded, all sheet and symbol UUIDs are
converted from time stamps to true UUIDs. This is done to ensure there
are no sheet path instance clashes between projects. That being said,
there are no checks for this. It is assumed that the probability of
UUID clashes is so low that it doesn't make sense to test for them.
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.
Some items (tracks and footprint graphic items) when reading were added in reverse order
of the initial file, creating useless differences and breaking source comparisons.
Also fixes a bug where a bunch of eeschema settings weren't getting
loaded because it looked like they were larger than the max value
(which wasn't being scaled from mils to internal units).
Fixes https://gitlab.com/kicad/code/kicad/issues/2089