This fix required sorting all of the LIB_PART draw items to ensure
accurate comparison between the symbols stored in the schematic and the
original library symbols. This has a noticeable impact on symbol library
load performance. It may also cause significant changes the next time
the library is saved due to changes in the draw item sorting. Hashing
may be a better solution here but this addressed the immediate problem.
A skeleton method SCH_SCREEN::SwapSymbolLinks() was added because there
is most likely an issue with orphaned symbols in the schematic library
symbol cache during undo/redo operations. More testing is required to
verify this.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7263
Junctions should only be wire endings when ending directly on the wire.
This is the requirement for netlisting, so we need to follow it in the
auto-end as well.
SCH_LABEL needs to allow ending because any wire that touches the label
will be connected, so there's a use case for this. However, the
bounding box for local labels did not include their connection point, so
we increase that box a bit. Note that this might have the opposite
effect to https://gitlab.com/kicad/code/kicad/-/issues/7689
Fixes https://gitlab.com/kicad/code/kicad/issues/7714
This also makes sure that the user gets a warning before saving over
an older s-expr format. While that won't always be wanted, it's now
in the infobar (like in PCBNew), so it's not too onerous.§
Fixes https://gitlab.com/kicad/code/kicad/issues/7347
The variable `m_Initialized` in `BASE_SCREEN` is used by
`SCH_EDIT_FRAME` to mark whether a screen had its zoom level initialized
by the "zoom to fit screen" action. When this variable is `false`, the
function `SCH_EDIT_FRAME::DisplayCurrentSheet()` performs "zoom to fit
screen", modifying the zoom level. This function is indirectly called in
the undo routines, so if `m_Initialized` is not set to `true`, a zoom
change will occur when the user undoes an operation, a behavior that is
undesired.
`m_Initialized` was not initialized to `true` for the null schematic
(the schematic that is loaded if no project is loaded), causing the
aforementioned undesired behavior.
To prevent this, I've changed the `SCH_EDIT_FRAME` constructor to set
`m_Initialized` to `true`, since it zooms to fit screen already. I've
moved `m_Initialized` from `BASE_SCREEN` to `SCH_SCREEN`, as it is used
only in Eeschema, and renamed it to `m_zoomInitialized`, a name I
believe that better describes what this variable does.
I've also introduced the function `SCH_EDIT_FRAME::initScreenZoom()` to
group the "zoom to fit screen" action with setting `m_Initialized` to
`true`, as they often should occur together.
I'd also like to say that I'm not confident whether
`SCH_EDIT_FRAME::DisplayCurrentSheet()` should perform the zoom level
initialization at this point, but I have decided to not change this
behavior for now, as the commit history suggests it's several years old.
Fixes https://gitlab.com/kicad/code/kicad/issues/7343
1) Generalize SCH_ITEM owners (SCH_COMPONENT, SCH_SHEET, and now
SCH_GLOBALLABEL)
2) Generalize hypertext items
3) Use SCH_FIELD autoplace infrastructure for placing intersheet
references
4) Use textVar infrastructure for buildin intersheet references.
As an important side-effect this also fixes the undo issues with
intersheet refs.
The groundwork has now been laid for per sheet instance data. Initially
this only supports sheet page numbers but could be expanded to include
other per sheet instance information.
ADDED: Support for user defined schematic page numbers.
Also fixes a couple of bugs where resolving a textVar reference
to the refDes or unit wouldn't get the correct value in a
hierarchical schematic. (Unlogged.)
Fixes https://gitlab.com/kicad/code/kicad/issues/5397
This was causing junctions to not always be added on wire
segments that overlapped component pins, because the pin
might not be part of the component bounding box before
UpdateLocalLibSymbolLinks() is called. When the bbox
was never updated, these symbols weren't collected by
the rtree query for objects overlapping a point.
Set up a new lineage for SCH_ITEMS to get back to the SCHEMATIC
they live on: Items will all be parented to the SCH_SCREEN that
they are added to, and each SCH_SCREEN will point back to the
SCHEMATIC that it is part of. Note that this hierarchy is not
the same as the actual schematic hierarchy, which continues to
be managed through SCH_SHEETs and SCH_SHEET_PATHS.
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.
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.
Also fixes a bug where we were depending on the old deque stuff's
deterministic traversal, which isn't provided by the new RTree stuff.
Fixes https://gitlab.com/kicad/code/kicad/issues/2433
The components are reloaded when libraries change and when loading a
schematic. The initial load does not contain pins and so bbox hits may
miss elements.
Fixes#3800 | https://gitlab.com/kicad/code/kicad/issues/3800
This moves EESchema DLIST structures to rtree. These changes are more
fundamental than the pcbnew changes from 9163ac543888c01d11d1877d7c1
and 961b22d60 as eeschema operations were more dependent on passing
drawing list references around with SCH_ITEM* objects.
New v6 can test multiple points not previously considered. This
corrects the test to ensure that junctions are correctly added when
lines are present.
Fixes#3729 | https://gitlab.com/kicad/code/kicad/issues/3729
Do not check the connection graph when editing the symbol library table
from KiCad because the connection graph object is no valid when the
schematic editor is not open.
Fixes kicad/code/kicad#3682
The new symbol library changes left stale pointers in the connection
graph because the SCH_COMPONENT object pins were not always getting
updated when a new copy of the library symbol was updated.
Force a full update of the connection graph whenever the schematic
library symbol links are refreshed. This seems like overkill but it
ensures that there a no stale libraries items left in the connection
graph.
Fixes kicad/code/kicad#3658
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.
Apparently there are some issues with wxString::CmpNoCase() that was
causing the sheet file name case sensitivity test to incorrectly fail.
Converting the name strings to lower case before comparing resolved
the issue.
Add missing check for root sheet when searching sheet hierarchies for
already loaded schematics. This prevents the root sheet from being
omitted when adding new sheets using the root sheet file name.
CHANGED: Make file name tests case sensitive so that schematic sheet
file names on non-Windows systems can be uses as expected.
Warn users when attempting to use schematic file names that only vary
by case sensitivity that doing so will result in a project that is not
portable to Windows.
Fixes lp:1843415
https://bugs.launchpad.net/kicad/+bug/1843415
When more than one item has the duplicated timestamp, the update code
doesn't accurately change the duplicates as it only checks that a single
sort has not adjacent duplicates.
This adds all items to a set, ensuring that updated timestamps are
unique to the schematic, which prevents reseting or mangling the units
for duplicated components.
When checking for 3 or more connections, at least one of them must be
a pin. Otherwise we need to fall down to the next check which also
ensures that at least one of them is not parallel.
Fixes: lp:1841458
* https://bugs.launchpad.net/kicad/+bug/1841458
Do not add cache library from another project to old library list. This
is wrong and can cause all kinds of symbol library linking issues. It's
better to force the user to fix broken symbol library links than the false
security of using multiple cache libraries.
Use correct paths when appending schematic outside of the current project
path when hierarchical sheets are appended. If the path can be relative,
give the user the option to use either relative or absolute paths.
Do not change symbol library names in schematics appended from a source
outside the current project. This will almost ensure the symbol library
links will be broken in the source project.
When the appended schematic is from another project, attempt to check all
of the possible combinations of symbol library table importing that could
cause broken symbol library links and give the user the option of canceling
the append operation or live with the possibility that there may be broken
symbol library links.
When the append schematic is in the current project path but not part of
the schematic, check to see if there are any library nicknames that do
no exist in the project symbol library table and give the user a chance
to cancel the append process.
Bus upgrades: core new connectivity code
Bus upgrades: eeschema integration and modifications
Bus upgrades: eeschema dialogs
Bus upgrades: netlist export
Bus upgrades: file format changes
When loading a part in libedit, also transfer certain screen
settings to the incoming SCH_SCREEN, from the current
SCH_SCREEN.
Currently, the grid settings are transferred, but this could
also do other settings if needed.
Also remove some duplicate commentary and mention why the
grid is set in a SCH_SCREEN even though the BASE_SCREEN ctor
sets the same default.
Fixes: lp:1815108
* https://bugs.launchpad.net/kicad/+bug/1815108
The standard DIM() macro was not typesafe as it happily deferred errors
to runtime that can be caught at compile time. Replacing it with a
generic C++11 constexpr allows for typecasting, comparison and compile
time error checking.
When expanding the drag item to allow corners, we accidentally picked up
other items in the list. This limits the items that can be dragged to
only those that are explicitly in the draggable list.
A side effect of this commit is that when converting from move to drag
(with tab), items not in the draggable list will be left in place.
Fixes: lp:1787966
* https://bugs.launchpad.net/kicad/+bug/1787966
Previously, when creating a new instance of a sheet, the full set of references
was cleared.
Moreover, if this sheet has sub-sheets, the annotation was incorrectly handled
Now only (and all) new sheet path(s) created have a reference cleared, as expected.
(new sheet paths can be more than one, if the new instance of the sheet has sub-sheets)
Fixes: lp:1789048
https://bugs.launchpad.net/kicad/+bug/1789048
It was only a overzealous (in this case) assert, with no issue.
The fix avoid calling DeleteAll() when there is nothing to delete.
Fixes: lp:1787810
https://bugs.launchpad.net/kicad/+bug/1787810
Allows buses to acquire junctions based on their connections. Buses
can only have junctions with other buses. Also allows buses to be
draggable junctions for collections
This adjusts the selection addition criteria for
blocks to allow items such as labels to connect to
lines not at the endpoints. It also uses the same
logic to correctly gather bus-wire, bus-bus entries.
Fixes: lp:1738941
* https://bugs.launchpad.net/kicad/+bug/1738941
Pins are weak_ptrs to the library, so they require a lock() before
accessing. This imposes a performance hit on fast loops that access
the pin list repeatedly. This patch caches the pin position locally
for each component, updating only when needed.
Fixes: lp:1737363
* https://bugs.launchpad.net/kicad/+bug/1737363
Fixes the connection display and dragging behavior of wires,
busses and their entries.
The implemented drag logic is:
-busses and bus-bus entries drag each other when connected at endpoints
-wires and wire-bus entries drag each other when connected at endpoints
-entries do not drag wires or busses when connected to wire middles
-wire-bus entries do not drag busses
The implemented connection logic is:
-bus-bus entries connect busses to busses but not wires
-wire-bus entries connect wires to busses but not wire to wires or
busses to busses
BreakSegment now breaks a known segment and BreakSegments
breaks all segments. This allows functions to break a
segment without needing to iterate through the whole list.
Dragging a full line that is connected to a component
now drags the component as part of the block, maintaining
connections.
Fixes: lp:1167714
* https://bugs.launchpad.net/kicad/+bug/1167714
All of the schematic object load and save code is implemented in the
legacy schematic plugin so it is no longer required.
Remove unused file with old schematic file loader.
Doxygen comment cleaning.
Use the legacy plugin schematic loader in the sheet edit and append
schematic code paths.
Check for fully qualified LIB_ID objects (must have library nickname)
when loading existing schematics when edit sheets.
Rewrite append schematic feature to handle import issues rather than
change the name and file name of all of the sheets in the imported
schematic. This includes the following:
- Load the schematic into a temporary SCH_SHEET object.
- Make sure the imported schematic does not cause any hierarchy
recursion issues.
- Verify the imported schematic uses fully qualified #LIB_ID objects
(symbol library table).
- Check to see if any symbol libraries need to be added to the current
project's symbol library table. This includes:
- Check if the symbol library already exists in the project or global
symbol library table.
- Convert symbol library URLS that use the ${KIPRJMOD} environment
variable to absolute paths. ${KIPRJMOD} will not be the same for
this project.
- Check for duplicate symbol library nicknames and change the new symbol
library nickname to prevent library name clashes.
- Update all schematic symbol LIB_ID object library nicknames when the
library nickname was changed to prevent clashes.
- Check for duplicate sheet names which is illegal and automatically
rename any duplicate sheets in the imported schematic.
- Clear all of the annotation in the imported schematic to prevent
clashes.
- Append the objects from the temporary sheet to the current page.
- Replace any duplicate time stamps.
- Refresh the symbol library links.
Add support code to SCH_SCREEN object to assist with schematic import.
Doxygen comment cleaning.
Fixes lp:1731760
https://bugs.launchpad.net/kicad/+bug/1731760