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
Refactor rescue objects so that they can support derivation.
Factor out legacy rescuer code to perform legacy project rescues.
Create new symbol library table rescuer for rescuing symbol library table
based projects.
Perform the correct rescue type on project load.
Add symbol library table remapping support to the tools menu for run on
demand as applicable.
Add flag to SCH_SCREENS::UpdateSymbolLinks() to allow forcing the symbol
link updates when the library modification hash has not changed.
Simplify some of the library editing code. There have been a few minor
changes in the behavior of the editor. If the current symbol is deleted
from the library, the next symbol in the library is not loaded. The
deleted symbol is cleared and the current symbol is empty.
Change component to symbol to align with the preferred terminology
discussed on the developer's mailing list.
Add separate update UI event for save library as to enable the menu entry
whenever a library is selected.
Change the select symbol list dialog to a single column using the LIB_ID
format LIB_NICKNAME:LIB_ITEM_NAME so that the selection can be parsed by
LIB_ID.
Add method to expand URI to LIB_TABLE_BASE.
Override wxApp::OnExceptionInMainLoop() in debug builds to make debugging
easier when an unhandled exception occurs in a wxUpdateUIEvent handler.
Change SCH_SCREENS::HasNoFullyDefinedLibIds() to return false when the
schematic has no symbols to prevent the remapping dialog from being run.
Use SCH_COMPONENT part reference when creating netlist rather than looking
up the library symbol.
Check the if the schematic being loaded has been remapped (no symbol
library table nicknames defined) and remap accordingly.
Fix issues when resolving the library symbol links in the schematic
symbols.
Add cache library fallback when resolving symbols that cannot be
remapped.
Add remap complete message to remap dialog.
Add HasLibrary() helper to LIB_TABLE_BASE.
Fix issues when loading library symbols using symbol library table.
Add hashing function to symbol library table.
Improve the symbol panel message to warn user when cache library is
used to resolve symbol.
In LIB_EDIT_FRAME::GetComponentFrom{Undo,Redo}List() methods, the
PICKED_ITEMS_LIST object which was retrieved from undo/redo list has not
been destroyed.
Rewritten SCH_SCREEN::ClearUndoORRedoList() to be easier to read.
Minor whitespace formatting.
Add loading symbol library table code to schematic PROJECT object.
Fix minor issues with loading global symbol library table.
Add default symbol library path environment variable to the environment
variable list and change the variable name to KICAD_SYMBOL_DIR.
Add code to SCH_SCREENS to test if all library nicknames of the symbol
library IDs are empty.
Remove unnecessary KICAD_USE_SCH_IO_MANAGER build option.
For some reason, the schematic symbol library link was being regenerated
every time the schematic was redrawn in SCH_SCREEN::Draw(). Remove the
re-link call from the Draw() and Plot() functions.
Add function the SCH_SCREENS to update the links in all of the schematic
sheets.
Update all schematic sheet symbol library links whenever the symbol
library list is modified or any library in the library list is modified.
That should cover all cases where the symbol library links could be
broken.
Refresh schematic window after applying library changes to update any
possible symbol changes.
Add KIWAY message to update the schematic when symbol library changes
could change the schematic. The KIWAY mail was used because the schematic
frame is not a parent of the symbol library editor so wxEvents cannot be
used.
For some reason, rather than using the LIB_PART object reference by an
SCH_COMPONENT to check if a pin was at a given position in the schematic,
a LIB_PART search was performed for every component in a schematic. This
made absolutely no sense and was changed to use the LIB_PART referenced
by the SCH_COMPONENT object. This should significantly speed up any
operations that call SCH_SCREEN functions, IsTerminalPoint(),
MarkConnections(), and IsJunctionNeeded().
Add function to SCH_COMPONENT to access PART_REF object.
eeschema now supports arbitrary colors for all object types, and
pcbnew does in GAL canvas. When switching from GAL to legacy canvas,
pcbnew will convert colors to the nearest legacy color.
Use LIB_ID instead of wxString for storing the library symbol information
in the schematic symbol in preparation for the upcoming symbol library table
implementation.
Change the FindLibAlias and FindLibPart functions in the PART_LIBS object
instead of wxString. Please note that only the library ID name is used to
search the list of libraries. The library nickname is ignored. Once the
symbol library table is implemented and full LIB_IDs are defined, the
library search code will no longer be used and will only be kept to load
older schematics that have not been converted.
Move SCH_LEGACY_PLUGIN_CACHE definition so that the legacy plugin knows
how to properly delete the cache object.
Make all EDA_TEXT data private and rename accessors to avoid function
name collisions in derived classes.
Overload EDA_TEXT's SetTextAngle() and SetEffects() in TEXTE_PCB.
Add support for preserving Reference text position, size, orientation
during a netlist import into a BOARD, as well as the one off footprint
update dialog.
* Remove wxDC and EDA_DRAW_FRAME parameters from SCH_SCREEN::SchematicCleanUp()
function call.
* Update all code that calls SCH_SCREEN::SchematicCleanUp() with wxDC and/or EDA_DRAW_FRAME
parameters.
* Fix a display refresh bug when incrementally inserting bus entries created in my last commit.
IsDanglingStateChanged() appears to be broke for bus entries.
* Remove wxDC and EDA_DRAW_PANEL as parameters from function
SCH_SCREEN::TestDanglingEnds().
* Change SCH_SCREEN::TestDanglingEnds() to return the connection change state
rather than the dangling end status which wasn't used anywhere.
* Update all calls to SCH_SCREEN::TestDanglingEnds() to remove wxDC and
EDA_DRAW_PANEL parameters and refresh connection indicators only if a
connection state change occurred.